车间生产
四楼装配工序申请领料修改,生成成品条码完善(根据四楼到五楼内部生产的情况)
五楼拆分工序生成对内条码完善(根据四楼到五楼内部生产的情况)
master
xs 2 weeks ago
parent 930648c0d5
commit 6bf0312e5b

@ -6,6 +6,7 @@ import com.hw.common.core.domain.R;
import com.hw.mes.api.domain.*;
import com.hw.mes.api.domain.vo.MesBaseMaterialInfoVo;
import com.hw.mes.api.domain.vo.MesPdaProductPlanVo;
import com.hw.mes.api.domain.vo.MesPurchaseOrderVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.api.factory.RemoteMesFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
@ -212,4 +213,14 @@ public interface RemoteMesService {
@GetMapping("/saleOrder/getRelateMaterialsBySaleOrderId/{saleOrderId}")
public R<List<MesSaleOrderRelate>> getRelateMaterialsBySaleOrderId(@PathVariable("saleOrderId") Long saleOrderId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* ID
*
* @param purchaseOrderId ID
* @param source
* @return
*/
@GetMapping("/purchaseOrder/selectPurchaseOrderJoinSupplierProjectByOrderId/{purchaseOrderId}")
public R<MesPurchaseOrder> selectPurchaseOrderJoinSupplierProjectByOrderId(@PathVariable("purchaseOrderId") Long purchaseOrderId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -72,6 +72,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "物料ID")
private Long materialId;
/**成品ID在对内生产生成成品条码时保存对应五楼成品ID*/
private Long productId;
/**条码规格*/
private String barcodeSpec;
@ -331,6 +334,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
return materialId;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getBarcodeSpec() {
return barcodeSpec;
}

@ -0,0 +1,822 @@
package com.hw.mes.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* mes_purchase_order
*
* @author Yinq
* @date 2024-02-19
*/
public class MesPurchaseOrder extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long purchaseOrderId;
/**
* ERP;FID
*/
@Excel(name = "ERP的主键信息;对应FID")
private Long erpId;
/**
* ERPID;FPOOrderEntry.FEntryID
*/
@Excel(name = "对应金蝶ERP订单明细的ID;对应FPOOrderEntry.FEntryID")
private Long fentryId;
/**
* ;FBillNo
*/
@Excel(name = "采购订单编号;对应FBillNo")
private String poNo;
/**
* ;FDocumentStatus
*/
@Excel(name = "单据状态;FDocumentStatus")
private String documentStatus;
/**
* ID,
*/
@Excel(name = "物料ID,关联物料信息主键")
private Long materialId;
/**
* ;FMaterialId.FNumber
*/
@Excel(name = "物料编码;对应FMaterialId.FNumber")
private String materialCode;
/**
* ;FMaterialId.FName
*/
@Excel(name = "物料名称;对应FMaterialId.FName")
private String materialName;
/**
* :1ERP2
*/
private String purchaseOrderClassfication;
/**
* ;FQty
*/
@Excel(name = "订单计划数量;对应FQty")
private BigDecimal orderAmount;
/**
*
*/
@Excel(name = "完成采购数量")
private BigDecimal completeAmount;
/**
* ;FApproveDate
*/
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "审核日期;对应FApproveDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date approveDate;
/**
* ERP;FModifyDate
*/
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "ERP最后修改日期;对应FModifyDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date erpModifyDate;
/**
* ;FDeliveryDate
*/
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "计划交货日期;对应FDeliveryDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date planDeliveryDate;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date beginDate;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date endDate;
/**
* (123)
*/
@Excel(name = "订单状态(1待采购2采购中3采购完成)")
private String orderStatus;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "完成日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date completeDate;
/**
* 1-0-
*/
@Excel(name = "是否标识1-是0-否")
private String isFlag;
/**
* ;FUnitId
*/
@Excel(name = "采购单位;FUnitId")
private Long unitId;
/**
* ;FStockUnitID
*/
@Excel(name = "库存单位;FStockUnitID")
private Long stockUnitId;
/**
* ;FPriceUnitID
*/
@Excel(name = "计价单位;FPriceUnitID")
private Long priceUnitId;
/**
* ;FAuxPropId
*/
@Excel(name = "辅助属性;FAuxPropId")
private Long auxPropId;
/**
* ;FSrcBillNo
*/
@Excel(name = "源单编号;FSrcBillNo")
private String srcBillNo;
/**
* ;FPurchaseOrgId
*/
@Excel(name = "采购组织;FPurchaseOrgId")
private Long purchaseOrgId;
/**
* ;F_TOND_Base
*/
@Excel(name = "京源项目;F_TOND_Base")
private String tondBase;
/**
* ID;FSupplierId
*/
@Excel(name = "供应商ID;FSupplierId")
private Long supplierId;
/**
*
*/
private List<MesOrderBind> mesOrderBindList;
/**
*
*/
private String bindFlag;
/**
*
*/
private String specificationParameter;
/**
*
*/
private String materialSpec;
/**
*
*/
private Long saleOrderId;
/**
*
*/
private Long orderBindId;
/**
*
*/
private BigDecimal boundAmount;
/**
*
*/
private BigDecimal saleBindAmount;
/**
*
*/
private BigDecimal safeAmount;
/**
*
*/
private BigDecimal barcodeAmount;
/**
*
*/
private BigDecimal updateAmount;
/**
*
*/
private Long serialNumber;
/**
* ,-
*/
private String orderBindBarcodeAmount;
/**
* -
*/
private String safeBindBarcodeAmount;
private String batchFlag;
private BigDecimal batchAmount;
private long mesMaterialId;//物料信息表的物料ID主键
private String alwaysFlag;
private Long productId;
private String productCode;
private String productName;
private String productSpec;
private String safeFlag;
private String saleOrderCode;
private BigDecimal bindAmount;
private BigDecimal saleOrderAmount;
private String mergeFlag;
private String singleFlag;
private Long erpMaterialId;
/**
* code
*/
private String supplierCode;
private String projectNo;
public Long getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(Long serialNumber) {
this.serialNumber = serialNumber;
}
public BigDecimal getUpdateAmount() {
return updateAmount;
}
public void setUpdateAmount(BigDecimal updateAmount) {
this.updateAmount = updateAmount;
}
public BigDecimal getBoundAmount() {
return boundAmount;
}
public void setBoundAmount(BigDecimal boundAmount) {
this.boundAmount = boundAmount;
}
public BigDecimal getSaleBindAmount() {
return saleBindAmount;
}
public void setSaleBindAmount(BigDecimal saleBindAmount) {
this.saleBindAmount = saleBindAmount;
}
public BigDecimal getSafeAmount() {
return safeAmount;
}
public void setSafeAmount(BigDecimal safeAmount) {
this.safeAmount = safeAmount;
}
public BigDecimal getBarcodeAmount() {
return barcodeAmount;
}
public void setBarcodeAmount(BigDecimal barcodeAmount) {
this.barcodeAmount = barcodeAmount;
}
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
public Long getOrderBindId() {
return orderBindId;
}
public void setOrderBindId(Long orderBindId) {
this.orderBindId = orderBindId;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getSpecificationParameter() {
return specificationParameter;
}
public void setSpecificationParameter(String specificationParameter) {
this.specificationParameter = specificationParameter;
}
public void setPurchaseOrderId(Long purchaseOrderId) {
this.purchaseOrderId = purchaseOrderId;
}
public Long getPurchaseOrderId() {
return purchaseOrderId;
}
public void setErpId(Long erpId) {
this.erpId = erpId;
}
public Long getErpId() {
return erpId;
}
public void setFentryId(Long fentryId) {
this.fentryId = fentryId;
}
public Long getFentryId() {
return fentryId;
}
public void setPoNo(String poNo) {
this.poNo = poNo;
}
public String getPoNo() {
return poNo;
}
public void setDocumentStatus(String documentStatus) {
this.documentStatus = documentStatus;
}
public String getDocumentStatus() {
return documentStatus;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName() {
return materialName;
}
public String getPurchaseOrderClassfication() {
return purchaseOrderClassfication;
}
public void setPurchaseOrderClassfication(String purchaseOrderClassfication) {
this.purchaseOrderClassfication = purchaseOrderClassfication;
}
public void setOrderAmount(BigDecimal orderAmount) {
this.orderAmount = orderAmount;
}
public BigDecimal getOrderAmount() {
return orderAmount;
}
public void setCompleteAmount(BigDecimal completeAmount) {
this.completeAmount = completeAmount;
}
public BigDecimal getCompleteAmount() {
return completeAmount;
}
public void setApproveDate(Date approveDate) {
this.approveDate = approveDate;
}
public Date getApproveDate() {
return approveDate;
}
public void setErpModifyDate(Date erpModifyDate) {
this.erpModifyDate = erpModifyDate;
}
public Date getErpModifyDate() {
return erpModifyDate;
}
public void setPlanDeliveryDate(Date planDeliveryDate) {
this.planDeliveryDate = planDeliveryDate;
}
public Date getPlanDeliveryDate() {
return planDeliveryDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
public Date getBeginDate() {
return beginDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Date getEndDate() {
return endDate;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public String getOrderStatus() {
return orderStatus;
}
public void setCompleteDate(Date completeDate) {
this.completeDate = completeDate;
}
public Date getCompleteDate() {
return completeDate;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public String getIsFlag() {
return isFlag;
}
public void setUnitId(Long unitId) {
this.unitId = unitId;
}
public Long getUnitId() {
return unitId;
}
public void setStockUnitId(Long stockUnitId) {
this.stockUnitId = stockUnitId;
}
public Long getStockUnitId() {
return stockUnitId;
}
public void setPriceUnitId(Long priceUnitId) {
this.priceUnitId = priceUnitId;
}
public Long getPriceUnitId() {
return priceUnitId;
}
public void setAuxPropId(Long auxPropId) {
this.auxPropId = auxPropId;
}
public Long getAuxPropId() {
return auxPropId;
}
public void setSrcBillNo(String srcBillNo) {
this.srcBillNo = srcBillNo;
}
public String getSrcBillNo() {
return srcBillNo;
}
public void setPurchaseOrgId(Long purchaseOrgId) {
this.purchaseOrgId = purchaseOrgId;
}
public Long getPurchaseOrgId() {
return purchaseOrgId;
}
public void setTondBase(String tondBase) {
this.tondBase = tondBase;
}
public String getTondBase() {
return tondBase;
}
public void setSupplierId(Long supplierId) {
this.supplierId = supplierId;
}
public Long getSupplierId() {
return supplierId;
}
public List<MesOrderBind> getMesOrderBindList() {
return mesOrderBindList;
}
public void setMesOrderBindList(List<MesOrderBind> mesOrderBindList) {
this.mesOrderBindList = mesOrderBindList;
}
public String getBindFlag() {
return bindFlag;
}
public void setBindFlag(String bindFlag) {
this.bindFlag = bindFlag;
}
public String getOrderBindBarcodeAmount() {
return orderBindBarcodeAmount;
}
public void setOrderBindBarcodeAmount(String orderBindBarcodeAmount) {
this.orderBindBarcodeAmount = orderBindBarcodeAmount;
}
public String getSafeBindBarcodeAmount() {
return safeBindBarcodeAmount;
}
public void setSafeBindBarcodeAmount(String safeBindBarcodeAmount) {
this.safeBindBarcodeAmount = safeBindBarcodeAmount;
}
public String getBatchFlag() {
return batchFlag;
}
public void setBatchFlag(String batchFlag) {
this.batchFlag = batchFlag;
}
public BigDecimal getBatchAmount() {
return batchAmount;
}
public void setBatchAmount(BigDecimal batchAmount) {
this.batchAmount = batchAmount;
}
public long getMesMaterialId() {
return mesMaterialId;
}
public void setMesMaterialId(long mesMaterialId) {
this.mesMaterialId = mesMaterialId;
}
public String getAlwaysFlag() {
return alwaysFlag;
}
public void setAlwaysFlag(String alwaysFlag) {
this.alwaysFlag = alwaysFlag;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductSpec() {
return productSpec;
}
public void setProductSpec(String productSpec) {
this.productSpec = productSpec;
}
public String getSafeFlag() {
return safeFlag;
}
public void setSafeFlag(String safeFlag) {
this.safeFlag = safeFlag;
}
public String getSaleOrderCode() {
return saleOrderCode;
}
public void setSaleOrderCode(String saleOrderCode) {
this.saleOrderCode = saleOrderCode;
}
public BigDecimal getBindAmount() {
return bindAmount;
}
public void setBindAmount(BigDecimal bindAmount) {
this.bindAmount = bindAmount;
}
public BigDecimal getSaleOrderAmount() {
return saleOrderAmount;
}
public void setSaleOrderAmount(BigDecimal saleOrderAmount) {
this.saleOrderAmount = saleOrderAmount;
}
public String getMergeFlag() {
return mergeFlag;
}
public void setMergeFlag(String mergeFlag) {
this.mergeFlag = mergeFlag;
}
public String getSingleFlag() {
return singleFlag;
}
public void setSingleFlag(String singleFlag) {
this.singleFlag = singleFlag;
}
public Long getErpMaterialId() {
return erpMaterialId;
}
public void setErpMaterialId(Long erpMaterialId) {
this.erpMaterialId = erpMaterialId;
}
public String getSupplierCode() {
return supplierCode;
}
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
public String getProjectNo() {
return projectNo;
}
public void setProjectNo(String projectNo) {
this.projectNo = projectNo;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("purchaseOrderId", getPurchaseOrderId())
.append("erpId", getErpId())
.append("fentryId", getFentryId())
.append("poNo", getPoNo())
.append("documentStatus", getDocumentStatus())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("orderAmount", getOrderAmount())
.append("completeAmount", getCompleteAmount())
.append("approveDate", getApproveDate())
.append("erpModifyDate", getErpModifyDate())
.append("planDeliveryDate", getPlanDeliveryDate())
.append("beginDate", getBeginDate())
.append("endDate", getEndDate())
.append("orderStatus", getOrderStatus())
.append("completeDate", getCompleteDate())
.append("isFlag", getIsFlag())
.append("unitId", getUnitId())
.append("stockUnitId", getStockUnitId())
.append("priceUnitId", getPriceUnitId())
.append("auxPropId", getAuxPropId())
.append("srcBillNo", getSrcBillNo())
.append("purchaseOrgId", getPurchaseOrgId())
.append("tondBase", getTondBase())
.append("supplierId", getSupplierId())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("mesOrderBindList", getMesOrderBindList())
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MesPurchaseOrder that = (MesPurchaseOrder) o;
boundAmount = boundAmount == null ? BigDecimal.ZERO : boundAmount;
safeAmount = safeAmount == null ? BigDecimal.ZERO : safeAmount;
that.boundAmount = that.boundAmount == null ? BigDecimal.ZERO : that.boundAmount;
that.safeAmount = that.safeAmount == null ? BigDecimal.ZERO : that.safeAmount;
return Objects.equals(purchaseOrderId, that.purchaseOrderId)
&& orderAmount.compareTo(that.orderAmount) == 0 //订单数量
&& boundAmount.compareTo(that.boundAmount) == 0 //已绑定所有销售订单的总数量
&& safeAmount.compareTo(that.safeAmount) == 0 //安全库存数量
&& Objects.equals(orderBindBarcodeAmount, that.orderBindBarcodeAmount)//订单已绑定的数量-订单已生成的条码数量
&& Objects.equals(safeBindBarcodeAmount, that.safeBindBarcodeAmount); //安全库存的数量-安全库存已生成的条码数量
}
@Override
public int hashCode() {
return Objects.hash(purchaseOrderId, orderAmount, boundAmount, safeAmount, orderBindBarcodeAmount, safeBindBarcodeAmount);
}
}

@ -116,6 +116,11 @@ public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesServic
public R<List<MesSaleOrderRelate>> getRelateMaterialsBySaleOrderId(Long saleOrderId, String source) {
return R.fail("根据销售订单ID获取关联原材料信息失败:" + throwable.getMessage());
}
@Override
public R<MesPurchaseOrder> selectPurchaseOrderJoinSupplierProjectByOrderId(Long purchaseOrderId, String source) {
return R.fail("根据采购订单ID获取采购订单信息失败:" + throwable.getMessage());
}
};
}
}

@ -194,7 +194,7 @@ public class WmsConstants {
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL = "3";//组装出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_AUTO_OUTSTOCK = "4";//自动出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_AUTO_OUTSTOCK = "4";//自动出库(对于物料自动出库标识是是的在下一个采购订单入库时上一个采购订单的物料自动出库,)
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK = "5";//退货出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER = "9";//其他

@ -9,7 +9,7 @@ import com.hw.common.security.annotation.InnerAuth;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseBindBarcode;
import com.hw.mes.domain.MesPurchaseOrder;
import com.hw.mes.api.domain.MesPurchaseOrder;
import com.hw.mes.service.IMesBaseMaterialInfoService;
import com.hw.mes.service.IMesPurchaseOrderService;
import org.springframework.beans.factory.annotation.Autowired;

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.domain.R;
import com.hw.common.security.annotation.InnerAuth;
import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.service.IMesOrderBindService;
import com.hw.mes.service.IMesSaleOrderService;
@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesPurchaseOrder;
import com.hw.mes.api.domain.MesPurchaseOrder;
import com.hw.mes.service.IMesPurchaseOrderService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
@ -247,4 +248,15 @@ public class MesPurchaseOrderController extends BaseController
/**
*
*/
@InnerAuth
@GetMapping(value = "/selectPurchaseOrderJoinSupplierProjectByOrderId/{purchaseOrderId}")
public R<MesPurchaseOrder> selectPurchaseOrderJoinSupplierProjectByOrderId(@PathVariable("purchaseOrderId") Long purchaseOrderId)
{
MesPurchaseOrder mesPurchaseOrder = mesPurchaseOrderService.selectPurchaseOrderJoinSupplierProjectByOrderId(purchaseOrderId);
return R.ok(mesPurchaseOrder);
}
}

@ -119,7 +119,7 @@ public class MesSaleOrderController extends BaseController {
/**
*
*
*/
@InnerAuth
@GetMapping(value = "/getRelateProductsBySaleOrderId/{saleOrderId}")
@ -127,4 +127,14 @@ public class MesSaleOrderController extends BaseController {
List<MesSaleOrderRelate> list = mesSaleOrderService.getRelateProductsBySaleOrderId(saleOrderId);
return R.ok(list);
}
/**
*
*/
@InnerAuth
@GetMapping(value = "/getRelateMaterialsBySaleOrderId/{saleOrderId}")
public R<List<MesSaleOrderRelate>> getRelateMaterialsBySaleOrderId(@PathVariable("saleOrderId") Long saleOrderId) {
List<MesSaleOrderRelate> list = mesSaleOrderService.getRelateProductsBySaleOrderId(saleOrderId);
return R.ok(list);
}
}

@ -198,6 +198,8 @@ public class MesProductPlan extends BaseEntity
private String cabinetChannel;
private Long productId;//针对内部生产5楼的成品ID
public Long getSaleOrderId() {
return saleOrderId;
}
@ -587,6 +589,14 @@ public class MesProductPlan extends BaseEntity
this.cabinetChannel = cabinetChannel;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.mes.api.domain.MesPurchaseOrder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;

@ -3,7 +3,7 @@ package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.domain.MesPurchaseOrder;
import com.hw.mes.api.domain.MesPurchaseOrder;
import org.apache.ibatis.annotations.Param;
/**
@ -143,4 +143,13 @@ public interface MesPurchaseOrderMapper
public List<MesPurchaseOrder> selectNotRawInstockPurchaseOrderList(String applyDateStr);
/**
*
*
* @param purchaseOrderId
* @return
*/
public MesPurchaseOrder selectPurchaseOrderJoinSupplierProjectByOrderId(Long purchaseOrderId);
}

@ -3,7 +3,7 @@ package com.hw.mes.service;
import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.mes.domain.MesPurchaseOrder;
import com.hw.mes.api.domain.MesPurchaseOrder;
import com.hw.mes.domain.MesSaleOrder;
import org.springframework.transaction.annotation.Transactional;
@ -150,4 +150,12 @@ public interface IMesPurchaseOrderService
* @return List<MesPurchaseOrder>
*/
public int autoOutstockLastPurchaseOrders(String dateStr);
/**
* , Join supplier
*
* @param purchaseOrderId
* @return
*/
public MesPurchaseOrder selectPurchaseOrderJoinSupplierProjectByOrderId(Long purchaseOrderId);
}

@ -84,4 +84,11 @@ public interface IMesSaleOrderService
* @return
*/
public List<MesSaleOrderRelate> getRelateProductsBySaleOrderId(Long saleOrderId);
/**
* relatesaleorderId
* @param saleOrderId
* @return
*/
public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinList(Long saleOrderId);
}

@ -189,36 +189,36 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
String poNo = StringUtils.isEmpty(mesBaseBarcodeInfo.getPoNo()) ? "0" : mesBaseBarcodeInfo.getPoNo();
String batchCode = this.getRawBatchCode(poNo);
// if (!mesBaseMaterialInfo.getAlwaysFlag().equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)) {
Long orderBindId = mesBaseBarcodeInfo.getOrderBindId();
if (orderBindId == null) {
throw new ServiceException("请选择绑定销售订单信息的采购订单");
}
Long orderBindId = mesBaseBarcodeInfo.getOrderBindId();
if (orderBindId == null) {
throw new ServiceException("请选择绑定销售订单信息的采购订单");
}
MesOrderBind mesOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
BigDecimal bindAmount = mesOrderBind.getBindAmount();
BigDecimal bindBarcodeAmount = mesOrderBind.getBarcodeAmount();//已经生成的条码数量
BigDecimal availableAmount = bindAmount.subtract(bindBarcodeAmount);
if (barcodeAmount.compareTo(availableAmount) > 0) {
throw new ServiceException("条码数量不能大于可用数量");
}
MesOrderBind mesOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
BigDecimal bindAmount = mesOrderBind.getBindAmount();
BigDecimal bindBarcodeAmount = mesOrderBind.getBarcodeAmount();//已经生成的条码数量
BigDecimal availableAmount = bindAmount.subtract(bindBarcodeAmount);
if (barcodeAmount.compareTo(availableAmount) > 0) {
throw new ServiceException("条码数量不能大于可用数量");
}
MesBaseBarcodeInfo toInsertedBarcodeInfo;
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成条码数量的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
toInsertedBarcodeInfo.setSaleOrderId(mesOrderBind.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(mesOrderBind.getSaleOrderCode());
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
}
MesBaseBarcodeInfo toInsertedBarcodeInfo;
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成条码数量的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
toInsertedBarcodeInfo.setSaleOrderId(mesOrderBind.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(mesOrderBind.getSaleOrderCode());
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
}
//更新订单绑定的条码已绑定数量
mesOrderBind.setBarcodeAmount(bindBarcodeAmount.add(barcodeAmount));
mesOrderBind.setUpdateBy(userName);
mesOrderBind.setUpdateTime(currentDate);
mesOrderBindMapper.updateMesOrderBind(mesOrderBind);
//更新订单绑定的条码已绑定数量
mesOrderBind.setBarcodeAmount(bindBarcodeAmount.add(barcodeAmount));
mesOrderBind.setUpdateBy(userName);
mesOrderBind.setUpdateTime(currentDate);
mesOrderBindMapper.updateMesOrderBind(mesOrderBind);
// } else {
@ -869,6 +869,11 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
@Override
public int insertInternalMesBaseBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
Long materialId = 0L;
Long finalProductId = mesBaseBarcodeInfo.getProductId();
if (finalProductId == null) {
throw new ServiceException("没有成品信息");
}
String productBarcodes = mesBaseBarcodeInfo.getProductBarcode();//多个成品条码以,隔开
String splitCharacterEnglish = ",";
String splitCharacterChinese = "";
@ -993,6 +998,8 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
List<MesSaleOrderRelate> toInsertedSaleOrderRelateList = new ArrayList<>();
StringBuilder productNameTip = new StringBuilder();
boolean isProductSame = false;//用来判断四楼的成品对应五楼的成品是否跟五楼生产的成品一致
for (MesBaseBarcodeInfo productBarcodeInfo : productBarcodeInfoList) {
if (StringUtils.isNotEmpty(productBarcodeInfo.getPalletInfoCode())) {
productBarcodeInfo.setPalletInfoCode("");
@ -1002,47 +1009,61 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(productBarcodeInfo);
}
Long bindMaterialId = productBarcodeInfo.getMaterialId();
MesMaterialBom queryMaterialBom = new MesMaterialBom();
queryMaterialBom.setMaterialId(bindMaterialId);
queryMaterialBom.setActiveFlag(MesConstants.MES_MATERIAL_BOM_ACTIVE_FLAG_NORMAL);
List<MesMaterialBom> mesMaterialBomList = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom);
if (mesMaterialBomList == null || mesMaterialBomList.isEmpty()) {
allErrorMsgBuilder.append("成品条码[").append(productBarcodeInfo.getBarcodeInfo()).append("]没有维护生产bom信息;");
MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialId(productBarcodeInfo.getProductId());
productNameTip.append("成品条码:").append(productBarcodeInfo.getBarcodeInfo()).append(",成品编码为:").append(mesBaseMaterialInfo.getMaterialCode()).append(";");
if (productBarcodeInfo.getProductId().equals(finalProductId)) {
isProductSame = true;
}
Long bindMaterialId = productBarcodeInfo.getMaterialId();
// MesMaterialBom queryMaterialBom = new MesMaterialBom();
// queryMaterialBom.setMaterialId(bindMaterialId);
// queryMaterialBom.setActiveFlag(MesConstants.MES_MATERIAL_BOM_ACTIVE_FLAG_NORMAL);
// List<MesMaterialBom> mesMaterialBomList = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom);
// if (mesMaterialBomList == null || mesMaterialBomList.isEmpty()) {
// allErrorMsgBuilder.append("成品条码[").append(productBarcodeInfo.getBarcodeInfo()).append("]没有维护生产bom信息;");
// }
List<MesMaterialBom> childMaterialBomList = mesMaterialBomList.stream().
filter(materialBom -> materialBom.getParentId() != null && !materialBom.getParentId().equals(0L))
.collect(Collectors.toList());
// List<MesMaterialBom> childMaterialBomList = mesMaterialBomList.stream().
// filter(materialBom -> materialBom.getParentId() != null && !materialBom.getParentId().equals(0L))
// .collect(Collectors.toList());
if (childMaterialBomList == null || childMaterialBomList.isEmpty()) {
allErrorMsgBuilder.append("成品条码[").append(productBarcodeInfo.getBarcodeInfo()).append("]没有维护在五楼成品的生产bom信息中;");
} else if (childMaterialBomList.size() > 1) {
allErrorMsgBuilder.append("成品条码[").append(productBarcodeInfo.getBarcodeInfo())
.append("]五楼成品的生产bom信息不能多于1个[").append(mesMaterialBomList.size()).append("个];");
} else {
MesMaterialBom childMaterialBom = childMaterialBomList.get(0);
MesMaterialBom parentBom = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(childMaterialBom.getParentId());
//四楼到五楼,主要是多个成品合并到一个托盘后生成原材料条码需要保存以下信息,一个成品的保不保存无所谓
MesSaleOrderRelate saleOrderRelate = new MesSaleOrderRelate();
saleOrderRelate.setBarcodeInfo(barcodeInfo);
saleOrderRelate.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId());
saleOrderRelate.setVirtualMaterialId(materialId);
saleOrderRelate.setMaterialId(bindMaterialId);//四楼成品条码的物料id作为五楼原材料的物料id
saleOrderRelate.setProductId(parentBom.getMaterialId());
saleOrderRelate.setBindBarcode(productBarcodeInfo.getBarcodeInfo());
saleOrderRelate.setCreateBy(userName);
saleOrderRelate.setCreateTime(currentDate);
saleOrderRelate.setOrderBindId(0L);
saleOrderRelate.setRelateSaleOrderId(0L);
saleOrderRelate.setRelateSaleOrderCode("");
saleOrderRelate.setRelateSaleOrderAmount(BigDecimal.ONE);
toInsertedSaleOrderRelateList.add(saleOrderRelate);
// if (childMaterialBomList == null || childMaterialBomList.isEmpty()) {
// allErrorMsgBuilder.append("成品条码[").append(productBarcodeInfo.getBarcodeInfo()).append("]没有维护在五楼成品的生产bom信息中;");
// } else if (childMaterialBomList.size() > 1) {
// allErrorMsgBuilder.append("成品条码[").append(productBarcodeInfo.getBarcodeInfo())
// .append("]五楼成品的生产bom信息不能多于1个[").append(mesMaterialBomList.size()).append("个];");
// } else {
// MesMaterialBom childMaterialBom = childMaterialBomList.get(0);
// MesMaterialBom parentBom = mesMaterialBomMapper.selectMesMaterialBomByMaterialBomId(childMaterialBom.getParentId());
}
//不需要以下判断,在生成后托盘号会清空
// MesSaleOrderRelate bindBarcodeRelate = mesSaleOrderRelateMapper.selectMesSaleOrderRelateByBindBarcode(productBarcodeInfo.getBarcodeInfo());
// if (bindBarcodeRelate != null) {
// allErrorMsgBuilder.append("成品条码:").append(productBarcodeInfo.getBarcodeInfo()).append("已经生成过原材料条码;");
// }
//四楼到五楼,主要是多个成品合并到一个托盘后生成原材料条码需要保存以下信息,一个成品的保不保存无所谓
MesSaleOrderRelate saleOrderRelate = new MesSaleOrderRelate();
saleOrderRelate.setBarcodeInfo(barcodeInfo);
saleOrderRelate.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId());
saleOrderRelate.setVirtualMaterialId(materialId);
saleOrderRelate.setMaterialId(bindMaterialId);//四楼成品条码的物料id作为五楼原材料的物料id
saleOrderRelate.setProductId(productBarcodeInfo.getProductId());
saleOrderRelate.setBindBarcode(productBarcodeInfo.getBarcodeInfo());
saleOrderRelate.setCreateBy(userName);
saleOrderRelate.setCreateTime(currentDate);
saleOrderRelate.setOrderBindId(0L);
saleOrderRelate.setRelateSaleOrderId(0L);
saleOrderRelate.setRelateSaleOrderCode("");
saleOrderRelate.setRelateSaleOrderAmount(BigDecimal.ONE);
toInsertedSaleOrderRelateList.add(saleOrderRelate);
// }
}
if (!isProductSame) {
allErrorMsgBuilder.append("成品条码对应五楼成品与此生产明细不一致,[").append(productNameTip).append("];");
}
if (allErrorMsgBuilder.length() > 0) {
@ -1337,6 +1358,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
//purchaseorder可以不用判断主要看生成条码的数量
//找到销售订单物料的顶级bom信息
Long erpMaterialId = saleOrder.getMaterialId();
MesMaterialBom queryMaterialBom = new MesMaterialBom();
queryMaterialBom.setErpMaterialId(erpMaterialId);
@ -1352,6 +1374,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
.append(mesSaleOrderRelate.getProductCode()).append("成品名称:").append(mesSaleOrderRelate.getProductName())
.append("成品规格").append(mesSaleOrderRelate.getProductSpec()).append("; ");
} else {
//修改
MesMaterialBom mesMaterialBom = mesMaterialBoms.get(0);
//判断所选物料是否在销售订单的成品bom中在绑定时判断
@ -1493,12 +1516,24 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
mesMaterialBomMapper.insertMesMaterialBom(virtualMaterialBom);
toUpdatedMaterialBoms.forEach(umb -> {
MesMaterialBom queryChildBom = new MesMaterialBom();
queryChildBom.setParentId(umb.getParentId());
List<MesMaterialBom> childBomList = mesMaterialBomMapper.selectMesMaterialBomList(queryChildBom);
for (MesMaterialBom childBom : childBomList) {
childBom.setAncestors(childBom.getAncestors() + "," + virtualMaterialBom.getMaterialBomId());
childBom.setUpdateBy(userName);
childBom.setUpdateTime(currentDate);
mesMaterialBomMapper.updateMesMaterialBom(childBom);
}
umb.setParentId(virtualMaterialBom.getMaterialBomId());
umb.setAncestors(umb.getAncestors() + "," + umb.getParentId());
umb.setTopFlag(MesConstants.MES_MATERIAL_BOM_TOP_FLAG_NO);
umb.setUpdateBy(userName);
umb.setUpdateTime(currentDate);
mesMaterialBomMapper.updateMesMaterialBom(umb);
});
}

@ -309,9 +309,14 @@ public class MesImportImpl implements IMesImportService {
throw new ServiceException("Excel格式错误:请设置成文本格式");
}
int productNameIndex = productBom.indexOf("(");
if (productNameIndex < 0) productNameIndex = productBom.indexOf("");
if (productNameIndex > 0) {
productBom = productBom.substring(0,productNameIndex);
}
productBom = productBom.replaceAll(".*?", "");
productBom = productBom.replaceAll("(.*?)", "");
// productBom = productBom.replaceAll(".*?", "");
// productBom = productBom.replaceAll("(.*?)", "");
MesBaseMaterialInfo productMaterial = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(productBom);
if (productMaterial == null) {
throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!");
@ -355,6 +360,7 @@ public class MesImportImpl implements IMesImportService {
break;
}
Row rowC = sheet.getRow(i);
if (rowC == null) break;
Cell numberCell = rowC.getCell(0);
if (StringUtils.isNull(numberCell)) {
break;

@ -191,21 +191,21 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
}
if (mesProductOrder.getSaleType().equals(MesConstants.MES_PRODUCT_ORDER_SALE)) {
mesProductOrder.setProduceMaterialId(null);
mesProductOrder.setProduceMaterialId(-1L);
} else {
if (mesProductOrder.getProduceMaterialId() == null) {
throw new ServiceException("请选择生产物料");
}
//校验此生产物料是否在销售订单成品物料的生产bom中
MesMaterialBom queryMaterialBom = new MesMaterialBom();
queryMaterialBom.setMaterialId(mesProductOrder.getProduceMaterialId());
queryMaterialBom.setParentId(mesProductOrder.getMaterialBomId());
// queryMaterialBom.setActiveFlag(MesConstants.MES_MATERIAL_BOM_ACTIVE_FLAG_NORMAL);
List<MesMaterialBom> mesMaterialBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom);
if (mesMaterialBoms == null || mesMaterialBoms.isEmpty()) {
throw new ServiceException("所选择生产物料不在选择的成品bom中");
}
//不需要校验此生产物料是否在销售订单成品物料的生产bom中5楼的成品bom不包含4楼的成品4楼的bom也是单独的
// MesMaterialBom queryMaterialBom = new MesMaterialBom();
// queryMaterialBom.setMaterialId(mesProductOrder.getProduceMaterialId());
// queryMaterialBom.setParentId(mesProductOrder.getMaterialBomId());
//// queryMaterialBom.setActiveFlag(MesConstants.MES_MATERIAL_BOM_ACTIVE_FLAG_NORMAL);
// List<MesMaterialBom> mesMaterialBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom);
// if (mesMaterialBoms == null || mesMaterialBoms.isEmpty()) {
// throw new ServiceException("所选择生产物料不在选择的成品bom中");
// }
}
}

@ -23,7 +23,7 @@ import com.hw.wms.api.RemoteWmsService;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.domain.MesPurchaseOrder;
import com.hw.mes.api.domain.MesPurchaseOrder;
import com.hw.mes.service.IMesPurchaseOrderService;
import org.springframework.transaction.annotation.Transactional;
@ -570,4 +570,15 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
return 1;
}
/**
* , Join supplier
*
* @param purchaseOrderId
* @return
*/
@Override
public MesPurchaseOrder selectPurchaseOrderJoinSupplierProjectByOrderId(Long purchaseOrderId) {
return mesPurchaseOrderMapper.selectPurchaseOrderJoinSupplierProjectByOrderId(purchaseOrderId);
}
}

@ -182,4 +182,19 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
querySaleOrderRelate.setSaleOrderId(saleOrderId);
return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinProductList(querySaleOrderRelate);
}
/**
* relatesaleorderId
* @param saleOrderId
* @return
*/
@Override
public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinList(Long saleOrderId){
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setSaleOrderId(saleOrderId);
return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinList(querySaleOrderRelate);
}
}

@ -17,6 +17,7 @@
<result property="palletInfoCode" column="pallet_info_code"/>
<result property="bindBarcode" column="bind_barcode"/>
<result property="materialId" column="material_id"/>
<result property="productId" column="product_id"/>
<result property="barcodeSpec" column="barcode_spec"/>
<result property="manufacturerId" column="manufacturer_id"/>
<result property="amount" column="amount"/>
@ -63,6 +64,7 @@
bbi.pallet_info_code,
bbi.bind_barcode,
bbi.material_id,
bbi.product_id,
bbi.barcode_spec,
bmi.material_code,
bmi.material_name,
@ -176,6 +178,7 @@
<if test="palletInfoCode != null">pallet_info_code,</if>
<if test="bindBarcode != null">bind_barcode,</if>
<if test="materialId != null">material_id,</if>
<if test="productId != null">product_id,</if>
<if test="barcodeSpec != null and barcodeSpec != ''">barcode_spec,</if>
<if test="manufacturerId != null">manufacturer_id,</if>
<if test="amount != null">amount,</if>
@ -214,6 +217,7 @@
<if test="palletInfoCode != null">#{palletInfoCode},</if>
<if test="bindBarcode != null">#{bindBarcode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="productId != null">#{productId},</if>
<if test="barcodeSpec != null and barcodeSpec != ''">#{barcodeSpec},</if>
<if test="manufacturerId != null">#{manufacturerId},</if>
<if test="amount != null">#{amount},</if>

@ -368,6 +368,6 @@
<select id="selectMesBaseMaterialInfoByMaterialCode" parameterType="String" resultMap="MesBaseMaterialInfoResult">
<include refid="selectMesBaseMaterialInfoVo"/>
where bmi.material_code = #{materialCode}
where bmi.material_code = #{materialCode} limit 1
</select>
</mapper>

@ -54,7 +54,7 @@
<result property="processProductionTime" column="process_production_time"/>
<result property="nickName" column="nick_name"/>
<result property="cabinetChannel" column="cabinet_channel"/>
<result property="productId" column="product_id"/>
</resultMap>
<resultMap id="MesProductPlanMesProductPlanDetailResult" type="MesProductPlan" extends="MesProductPlanResult">
@ -349,7 +349,7 @@
mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,mpp.final_process_flag,mpp.user_id,
mpp.station_id, mpp.dispatch_amount, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time,
mpp.real_begin_time, mpp.real_end_time,
mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mpo.sale_type,mpo.cabinet_channel,
mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mpo.sale_type,mpo.cabinet_channel,mpo.material_id as product_id,
mbmi.material_code,mbmi.material_name,mbmi.material_spec
from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id
left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id

@ -63,6 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="saleOrderCode" column="sale_order_code" />
<result property="bindAmount" column="bind_amount" />
<result property="saleOrderAmount" column="sale_order_amount" />
<result property="supplierCode" column="supplier_code" />
<result property="projectNo" column="project_no" />
</resultMap>
@ -486,4 +488,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mpo.order_status ='3' group by mpo.purchase_order_id,mpo.po_no,mpo.material_id
</select>
<select id="selectPurchaseOrderJoinSupplierProjectByOrderId" parameterType="Long" resultMap="MesPurchaseOrderResult">
select a.purchase_order_id, a.po_no, a.document_status, a.tond_base, a.supplier_id,b.supplier_code,mpi.project_no
from mes_purchase_order a
left join mes_base_supplier_info b on a.supplier_id=b.erp_id
left join mes_project_info mpi on a.tond_base = mpi.erp_id
where a.purchase_order_id = #{purchaseOrderId}
</select>
</mapper>

@ -1,5 +1,7 @@
package com.hw.wms.controller;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.domain.R;
@ -607,9 +609,8 @@ public class WmsMobileController extends BaseController {
@GetMapping(value = "/getLockLocations")
public AjaxResult getLockLocations(WmsBaseLocation wmsBaseLocation) {
Map<String, List<String>> locationMap = wmsBaseLocationService.getLocationCodesGroupByWarehouse(wmsBaseLocation);
System.out.println(locationMap);
return success(locationMap);
JSONArray locationJsonArr = wmsBaseLocationService.getLocationCodesGroupByWarehouse(wmsBaseLocation);
return success(locationJsonArr);
}
}

@ -3,6 +3,8 @@ package com.hw.wms.service;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.utils.DateUtils;
import com.hw.wms.domain.WmsBaseLocation;
@ -132,5 +134,5 @@ public interface IWmsBaseLocationService
* @param wmsBaseLocation
* @return
*/
public Map<String,List<String>> getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation);
public JSONArray getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation);
}

@ -1,5 +1,7 @@
package com.hw.wms.service.impl;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.enums.WmsLocationStatus;
@ -291,15 +293,25 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
* @return
*/
@Override
public Map<String,List<String>> getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation){
public JSONArray getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation){
JSONArray locationCodesByWarehouseJsonArr = new JSONArray();
wmsBaseLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MANUAL_LOCK);
List<WmsBaseLocation> wmsBaseLocations = wmsBaseLocationMapper.selectWmsBaseLocationJoinList(wmsBaseLocation);
Map<String,List<String>> locationCodesByWarehouse = wmsBaseLocations.stream()
Map<String,List<String>> locationCodesByWarehouseMap = wmsBaseLocations.stream()
.collect(Collectors.groupingBy(
WmsBaseLocation::getWarehouseName,
Collectors.mapping(WmsBaseLocation::getLocationCode, Collectors.toList())
));
return locationCodesByWarehouse;
JSONObject locationCodesByWarehouseJson;
for (String warehouseName : locationCodesByWarehouseMap.keySet()) {
locationCodesByWarehouseJson = new JSONObject();
List<String> locationCodeStrs = locationCodesByWarehouseMap.get(warehouseName);
locationCodesByWarehouseJson.put("warehouseName",warehouseName);
locationCodesByWarehouseJson.put("locationCodes",locationCodeStrs);
locationCodesByWarehouseJsonArr.add(locationCodesByWarehouseJson);
}
return locationCodesByWarehouseJsonArr;
}
}

@ -7,6 +7,8 @@ import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.jindie.api.RemoteJindieService;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesPurchaseOrder;
import com.hw.wms.domain.WmsProductInstock;
import com.hw.wms.domain.WmsProductOutstock;
import com.hw.wms.domain.WmsRawInstock;
@ -51,6 +53,9 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
@Autowired
private WmsProductOutstockMapper wmsProductOutstockMapper;
@Autowired
private RemoteMesService remoteMesService;
@Autowired
private RemoteJindieService remoteJindieService;
@ -78,6 +83,15 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void syncInventoryInformation(Map<Long, List<WmsRawInstock>> purchaseOrderIdMap, Long purchaseOrderId, int result) {
R<MesPurchaseOrder> purchaseOrderData = remoteMesService.selectPurchaseOrderJoinSupplierProjectByOrderId(purchaseOrderId, SecurityConstants.INNER);
MesPurchaseOrder mesPurchaseOrder = null;
if (purchaseOrderData != null) {
mesPurchaseOrder = purchaseOrderData.getData();
}
String supplierCode = mesPurchaseOrder == null ? "": mesPurchaseOrder.getSupplierCode();
String projectNo = mesPurchaseOrder == null ? "" : mesPurchaseOrder.getProjectNo();
List<WmsRawInstock> wmsRawInstockList = purchaseOrderIdMap.get(purchaseOrderId);
JSONObject data = new JSONObject();
double FRealQty = wmsRawInstockList.stream().mapToDouble(item -> item.getInstockAmount().subtract(item.getErpAmount()).doubleValue()).sum();
@ -95,6 +109,8 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
data.put("FUnitID", instock.getUnitCode());
data.put("FRealQty", FRealQty);
data.put("FStockId", FStockId);
data.put("FSupplierCode", supplierCode);
data.put("FTondBase",projectNo);
String params = data.toJSONString();
R<AjaxResult> paramsResult = remoteJindieService.savePurchaseStorage(params, SecurityConstants.INNER);
String paramsResultData = paramsResult.getMsg();
@ -105,7 +121,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
log.info("synchronizeInventoryInformationToERP同步原材料入库成功:" + paramsResult.toString());
} else {
log.error("synchronizeInventoryInformationToERP同步原材料入库失败:" + paramsResult.toString());
throw new RuntimeException("同步原材料入库失败"+paramsResult.toString());
throw new RuntimeException("同步原材料入库失败" + paramsResult.toString());
}
}
@ -144,6 +160,8 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
wmsRawOutstockMapper.updateWmsRawOutstock(wmsRawOutstock);
}
// model.put("F_TOND_Combo", "一般领料"); //领料类型(必填项)
data.put("FDate", DateUtils.getTime());
data.put("FMaterialId", outstock.getMaterialCode());
data.put("FAuxPropId", outstock.getSpecificationParameter());
@ -167,6 +185,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
/**
* ERP
*
* @param days days
* @return
*/
@ -176,7 +195,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
int result = 0;
WmsProductInstock wmsProductInstock = new WmsProductInstock();
HashMap<String, Object> paramMap = new HashMap<>();
String beginTime= subtractDaysFromCurrentDate(days);
String beginTime = subtractDaysFromCurrentDate(days);
paramMap.put("beginTime", beginTime);
paramMap.put("endTime", DateUtils.getTime());
wmsProductInstock.setParams(paramMap);
@ -224,6 +243,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
/**
* ERP
*
* @param days days
* @return
*/
@ -233,7 +253,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi
int result = 0;
WmsProductOutstock wmsProductOutstock = new WmsProductOutstock();
HashMap<String, Object> paramMap = new HashMap<>();
String beginTime= subtractDaysFromCurrentDate(days);
String beginTime = subtractDaysFromCurrentDate(days);
paramMap.put("beginTime", beginTime);
paramMap.put("endTime", DateUtils.getTime());
wmsProductOutstock.setParams(paramMap);

@ -228,9 +228,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_purchase_order mpo on wri.purchase_order_id = mpo.purchase_order_id
where wri.execute_status = 2
and (wri.erp_status != 1 or wri.erp_status is null)
and wri.instock_type in (1, 3)
and wri.instock_type in (1, 3, 4)
and wri.instock_amount > if(wri.erp_amount is null, 0, wri.erp_amount)
and wri.purchase_order_id is not null and wri.purchase_order_id !=0
and mbmi.material_classfication = '1'
</select>

@ -378,7 +378,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where wro.real_outstock_amount > 0
and wro.outstock_amount >= wro.real_outstock_amount
and wro.real_outstock_amount > if(wro.erp_amount is null, 0, wro.erp_amount)
and wro.task_type in (1, 3, 9)
and wro.task_type in (1, 3, 5,9)
and mbmi.material_classfication = '1'
</select>
</mapper>

@ -511,6 +511,7 @@ export default {
planDetailCode: this.defineData.planDetailCode,
singleFlag: this.defineData.singleFlag,
saleOrderId: this.defineData.saleOrderId,
productId:this.defineData.productId,
batchFlag: '0',
bindBarcode: bindBarcode,
barcodeType: "",
@ -523,6 +524,7 @@ export default {
planId: this.defineData.planId,
planCode: this.defineData.planCode,
planDetailCode: this.defineData.planDetailCode,
productId : this.defineData.productId,
saleOrderId: this.defineData.saleOrderId,
saleorderCode: this.defineData.saleorderCode,
materialBomId: this.defineData.materialBomId,

@ -977,6 +977,7 @@ export default {
}
this.form = data.data || {}
this.form.materialId = val.materialId
this.form.productId = val.productId
this.form.materialBomId = val.materialBomId
this.form.materialCode = val.materialCode
this.form.materialName = val.materialName
@ -1018,6 +1019,7 @@ export default {
const {data} = await getNewestProductPlanDetail({planId: val.planId})
this.form = data || {}
this.form.materialId = val.materialId
this.form.productId = val.materialId
this.form.materialBomId = val.materialBomId
this.form.materialCode = val.materialCode
this.form.materialName = val.materialName

@ -889,13 +889,13 @@ export default {
}
this.reloadFlag = "0";
this.planId = row.planId
this.productId = row.materialId;
this.finalProductId = row.productId;//5ID
this.productId = row.materialId;//
this.materialBomId = row.materialBomId
this.nowMaterial = row.materialName
this.saleOrderId = row.saleOrderId
this.saleType = row.saleType
this.finalProcessFlag = row.finalProcessFlag
await getProductPlanDetails({pageNum: 1, pageSize: 5, planId: row.planId}).then(res => {
if (res.rows.length === 0) {
insertProductPlanDetails({
@ -924,7 +924,7 @@ export default {
planCode: val.planCode,
dispatchCode: val.dispatchCode,
planDetailCode: val.planDetailCode,
saleOrderId: val.saleOrderId,
saleOrderId: this.saleOrderId,
productId: this.productId,
materialBomId: this.materialBomId,
maxPlanAmount: 100000000,
@ -942,8 +942,10 @@ export default {
print(val) {
this.PrintData = val
this.PrintData.barcodeType = '4';//
this.PrintData.productId = val.materialId;
if (this.saleType === this.SALE_TYPE.INTERNAL) {
this.PrintData.singleFlag = this.SINGLE_FLAG.INTERNAL;
this.PrintData.productId = this.finalProductId;
} else {
this.PrintData.singleFlag = this.SINGLE_FLAG.NOT_SINGLE;
}

@ -365,7 +365,7 @@
</el-input>
</el-form-item>
<el-form-item label="成品BOM" prop="materialBomId" v-if="form.saleType !== MES_SALE_TYPE.MES_SALE_TYPE_PACKING">
<el-form-item label="成品BOM" prop="materialBomId" v-if="form.saleType === MES_SALE_TYPE.MES_SALE_TYPE_EXTERNAL">
<el-select v-model="form.materialBomId" placeholder="请选择物料BOM">
<el-option
v-for="item in materialBomList"
@ -384,6 +384,18 @@
</el-input>
</el-form-item>
<el-form-item label="物料BOM" prop="materialBomId" v-if="form.saleType === MES_SALE_TYPE.MES_SALE_TYPE_INTERNAL">
<el-select v-model="form.materialBomId" placeholder="请选择物料BOM">
<el-option
v-for="item in produceMaterialBomList"
:key="item.materialBomId"
:label="item.materialNameDesc"
:value="item.materialBomId"
:disabled = "item.activeFlag!=='1'"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="工艺路线" prop="dispatchId" v-if="form.saleType !== MES_SALE_TYPE.MES_SALE_TYPE_PACKING">
<el-select v-model="form.dispatchId" filterable placeholder="请选择工艺路线" :disabled="dispatchDisabled" clearable>
@ -848,6 +860,8 @@ export default {
{key: 29, label: `成品规格`, visible: true}, ],
//BOM
materialBomList: [],
//BOM
produceMaterialBomList: [],
//线
routeList: [],
saleOrderDisabled: true,
@ -1013,7 +1027,15 @@ export default {
if (this.selectType === this.MATERIAL_TYPE.RAW) {
this.form.produceMaterialId = selectedRow.materialId;
this.$set(this.form, 'produceMaterialName', selectedRow.materialName)
// this.form.produceMaterialName = selectedRow.materialName;//
getMaterialVisionList(this.form.produceMaterialId).then(response => {
this.produceMaterialBomList = response.data
if (this.produceMaterialBomList.length !== 0) {
// this.form.materialBomId = this.materialBomList[0].materialBomId
} else {
this.form.materialBomId = null;
this.$modal.msgError("该生产物料未维护BOM信息");
}
})
} else {
this.form.materialId = selectedRow.materialId;
this.$set(this.form, 'materialName', selectedRow.materialName)

Loading…
Cancel
Save