MES:
原材料条码:合并物料新增原材料条码功能(可以选择多个物料生成一个条码放在一个托盘上)
DMS:
点巡检计划生成工单功能修改
master
xs 10 months ago
parent 926d049353
commit 9140abb1d1

@ -2,7 +2,10 @@ package com.hw.mes.api.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.mes.api.domain.vo.MesPurchaseOrderVo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
@ -187,6 +190,10 @@ public class MesBaseBarcodeInfo extends BaseEntity
private String bindOrFlag;//如果是1查询条码连着配对码一起查询
private List<MesSaleOrderRelate> mesSaleOrderRelateList;
public String getLocationCode() {
return locationCode;
}
@ -595,6 +602,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
this.bindOrFlag = bindOrFlag;
}
public List<MesSaleOrderRelate> getMesSaleOrderRelateList() {
return mesSaleOrderRelateList;
}
public void setMesSaleOrderRelateList(List<MesSaleOrderRelate> mesSaleOrderRelateList) {
this.mesSaleOrderRelateList = mesSaleOrderRelateList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -105,6 +105,10 @@ public class MesBaseMaterialInfo extends BaseEntity
@Excel(name = "所属产线;多个用,隔开")
private String prodlineId;
//物料分类1ERP同步2虚拟物料3MES物料
private String materialClassfication;
/** 激活标识1-是0-否 */
@Excel(name = "激活标识1-是0-否")
private String activeFlag;
@ -341,6 +345,15 @@ public class MesBaseMaterialInfo extends BaseEntity
{
return prodlineId;
}
public String getMaterialClassfication() {
return materialClassfication;
}
public void setMaterialClassfication(String materialClassfication) {
this.materialClassfication = materialClassfication;
}
public void setActiveFlag(String activeFlag)
{
this.activeFlag = activeFlag;

@ -0,0 +1,332 @@
package com.hw.mes.api.domain;
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.Objects;
/**
* mes_order_bind
*
* @author xins
* @date 2024-05-16
*/
public class MesOrderBind extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long orderBindId;
/**
* (10)
*/
@Excel(name = "安全库存标识(1是0否)")
private String safeFlag;
/**
* ID;FID
*/
@Excel(name = "销售订单ID;对应FID")
private Long saleOrderId;
/**
*
*/
@Excel(name = "销售订单编号")
private String saleOrderCode;
/**
* ERPID
*/
@Excel(name = "ERP成品ID")
private Long productId;
/**
*
*/
@Excel(name = "成品编号")
private String productCode;
/**
*
*/
@Excel(name = "成品名称")
private String productName;
/**
* ID
*/
@Excel(name = "采购订单ID")
private Long purchaseOrderId;
/**
*
*/
@Excel(name = "采购订单编号")
private String poNo;
/**
* ERPID
*/
@Excel(name = "ERP物料ID")
private Long materialId;
/**
*
*/
@Excel(name = "物料编号")
private String materialCode;
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/**
*
*/
@Excel(name = "绑定数量")
private BigDecimal bindAmount;
/**
*
*/
private BigDecimal barcodeAmount;
private String productSpec;
private String materialSpec;
private String specificationParameter;
private BigDecimal saleOrderAmount;
private BigDecimal availableAmount;//可用数量
private int index;//序号
private String mergeFlag;//合并新增条码时使用
private String singleFlag;//单独新增条码时使用
public void setOrderBindId(Long orderBindId) {
this.orderBindId = orderBindId;
}
public Long getOrderBindId() {
return orderBindId;
}
public void setSafeFlag(String safeFlag) {
this.safeFlag = safeFlag;
}
public String getSafeFlag() {
return safeFlag;
}
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderCode(String saleOrderCode) {
this.saleOrderCode = saleOrderCode;
}
public String getSaleOrderCode() {
return saleOrderCode;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public Long getProductId() {
return productId;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode() {
return productCode;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setPurchaseOrderId(Long purchaseOrderId) {
this.purchaseOrderId = purchaseOrderId;
}
public Long getPurchaseOrderId() {
return purchaseOrderId;
}
public void setPoNo(String poNo) {
this.poNo = poNo;
}
public String getPoNo() {
return poNo;
}
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 void setBindAmount(BigDecimal bindAmount) {
this.bindAmount = bindAmount;
}
public BigDecimal getBindAmount() {
return bindAmount;
}
public BigDecimal getBarcodeAmount() {
return barcodeAmount;
}
public void setBarcodeAmount(BigDecimal barcodeAmount) {
this.barcodeAmount = barcodeAmount;
}
public String getProductSpec() {
return productSpec;
}
public void setProductSpec(String productSpec) {
this.productSpec = productSpec;
}
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 BigDecimal getSaleOrderAmount() {
return saleOrderAmount;
}
public void setSaleOrderAmount(BigDecimal saleOrderAmount) {
this.saleOrderAmount = saleOrderAmount;
}
public BigDecimal getAvailableAmount() {
return availableAmount;
}
public void setAvailableAmount(BigDecimal availableAmount) {
this.availableAmount = availableAmount;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
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;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("orderBindId", getOrderBindId())
.append("safeFlag", getSafeFlag())
.append("saleOrderId", getSaleOrderId())
.append("saleOrderCode", getSaleOrderCode())
.append("productId", getProductId())
.append("productCode", getProductCode())
.append("productName", getProductName())
.append("purchaseOrderId", getPurchaseOrderId())
.append("poNo", getPoNo())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("bindAmount", getBindAmount())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MesOrderBind that = (MesOrderBind) o;
return Objects.equals(orderBindId, that.orderBindId)
&& bindAmount.compareTo(that.bindAmount) == 0
&& barcodeAmount.compareTo(that.barcodeAmount) == 0;
}
@Override
public int hashCode() {
return Objects.hash(orderBindId, bindAmount, barcodeAmount);
}
}

@ -0,0 +1,179 @@
package com.hw.mes.api.domain;
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;
/**
* mes_sale_order_relate
*
* @author xins
* @date 2024-09-09
*/
public class MesSaleOrderRelate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long saleOrderRelateId;
/** 销售订单ID */
@Excel(name = "销售订单ID")
private Long saleOrderId;
/** 条码信息 */
private String barcodeInfo;
/** 采购订单绑定销售订单ID */
private Long orderBindId;
/** 关联销售订单ID */
@Excel(name = "关联销售订单ID")
private Long relateSaleOrderId;
private Long materialId;
/** 采购订单ID */
private Long purchaseOrderId;
/** 关联销售订单的数量,有可能小于原销售订单的订单数量 */
@Excel(name = "关联销售订单的数量,有可能小于原销售订单的订单数量")
private BigDecimal relateSaleOrderAmount;
private String productCode;
private String productName;
private String productSpec;
/**
*
*/
private Date planDeliveryDate;
private int index;
public void setSaleOrderRelateId(Long saleOrderRelateId)
{
this.saleOrderRelateId = saleOrderRelateId;
}
public Long getSaleOrderRelateId()
{
return saleOrderRelateId;
}
public void setSaleOrderId(Long saleOrderId)
{
this.saleOrderId = saleOrderId;
}
public Long getSaleOrderId()
{
return saleOrderId;
}
public String getBarcodeInfo() {
return barcodeInfo;
}
public void setBarcodeInfo(String barcodeInfo) {
this.barcodeInfo = barcodeInfo;
}
public Long getOrderBindId() {
return orderBindId;
}
public void setOrderBindId(Long orderBindId) {
this.orderBindId = orderBindId;
}
public void setRelateSaleOrderId(Long relateSaleOrderId)
{
this.relateSaleOrderId = relateSaleOrderId;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getPurchaseOrderId() {
return purchaseOrderId;
}
public void setPurchaseOrderId(Long purchaseOrderId) {
this.purchaseOrderId = purchaseOrderId;
}
public Long getRelateSaleOrderId()
{
return relateSaleOrderId;
}
public BigDecimal getRelateSaleOrderAmount() {
return relateSaleOrderAmount;
}
public void setRelateSaleOrderAmount(BigDecimal relateSaleOrderAmount) {
this.relateSaleOrderAmount = relateSaleOrderAmount;
}
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 Date getPlanDeliveryDate() {
return planDeliveryDate;
}
public void setPlanDeliveryDate(Date planDeliveryDate) {
this.planDeliveryDate = planDeliveryDate;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("saleOrderRelateId", getSaleOrderRelateId())
.append("saleOrderId", getSaleOrderId())
.append("relateSaleOrderId", getRelateSaleOrderId())
.append("relateSaleOrderAmout", getRelateSaleOrderAmount())
.toString();
}
}

@ -0,0 +1,51 @@
package com.hw.mes.api.domain.vo;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
/**
* @Description: VO
* @ClassName: MesPurchaseOrderVo
* @Author : xins
* @Date :2024-09-07 16:29
* @Version :1.0
*/
@Data
public class MesPurchaseOrderVo {
//序号
@NotNull(message = "序号不能为空")
private int index;
//采购订单ID
@NotNull(message = "采购订单ID为空")
private Long purchaseOrderId;
//ERP物料ID
@NotNull(message = "ERP物料ID为空")
private Long materialId;
//采购数量
@NotNull(message = "采购数量为空")
private BigDecimal orderAmount;
//订单已绑定的数量-订单已生成的条码数量
@NotBlank(message = "订单已绑定的数量(中间以-分开)订单已生成的条码数量")
private String orderBindBarcodeAmount;
// //采购数量
// @NotBlank(message = "安全库存的数量(中间以-分开)安全库存已生成的条码数量")
// private String safeBindBarcodeAmount;
//物料编码
@NotBlank(message = "物料编码")
private String materialCode;
}

@ -4,6 +4,7 @@ import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.ServiceNameConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo;
import com.hw.wms.api.factory.RemoteWmsFallbackFactory;
@ -60,4 +61,8 @@ public interface RemoteWmsService {
@PostMapping("/api/synchronizeProductOutstockInformationToERP/{days}")
public R<AjaxResult> synchronizeProductOutstockInformationToERP(@PathVariable("days") Integer days, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/wmswarehouse/allocateVirtualMaterial")
public R<Boolean> allocateVirtualMaterial(@RequestBody WmsWarehouseMaterial wmsWarehouseMaterial, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -0,0 +1,118 @@
package com.hw.wms.api.domain;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wms_warehouse_material
*
* @author xins
* @date 2024-01-09
*/
public class WmsWarehouseMaterial extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long warehouseMaterialId;
/** 仓库ID */
private Long warehouseId;
private Integer warehouseFloor;
/** 库位编码;单独需要针对库位设置的,后续扩展使用 */
private String locationCode;
/** 存储类型(1、物料2、物料类型);先支持物料 */
private String storageType;
/** 根据存储类型对应各自表的主键 */
private Long storageId;
private String materialCode;
private String materialName;
public Long getWarehouseMaterialId() {
return warehouseMaterialId;
}
public void setWarehouseMaterialId(Long warehouseMaterialId) {
this.warehouseMaterialId = warehouseMaterialId;
}
public void setWarehouseId(Long warehouseId)
{
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
{
return warehouseId;
}
public Integer getWarehouseFloor() {
return warehouseFloor;
}
public void setWarehouseFloor(Integer warehouseFloor) {
this.warehouseFloor = warehouseFloor;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setStorageType(String storageType)
{
this.storageType = storageType;
}
public String getStorageType()
{
return storageType;
}
public void setStorageId(Long storageId)
{
this.storageId = storageId;
}
public Long getStorageId()
{
return storageId;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("warehouseId", getWarehouseId())
.append("locationCode", getLocationCode())
.append("storageType", getStorageType())
.append("storageId", getStorageId())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.toString();
}
}

@ -3,6 +3,7 @@ package com.hw.wms.api.factory;
import com.hw.common.core.domain.R;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.wms.api.RemoteWmsService;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo;
import org.slf4j.Logger;
@ -54,6 +55,11 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<RemoteWmsServic
return R.fail("是否存在成品库存信息获取失败:" + throwable.getMessage());
}
@Override
public R<Boolean> allocateVirtualMaterial(WmsWarehouseMaterial wmsWarehouseMaterial, String source) {
return R.fail("配置仓库虚拟物料失败:" + throwable.getMessage());
}
};
}
}

@ -124,6 +124,7 @@ public class MesConstants {
/**
* (0,1,2)
*/
public static final String MES_MATERIAL_BOM_CHECK_TYPE_NO = "0";//不校验
public static final String MES_MATERIAL_BOM_CHECK_TYPE_MANUAL = "1";//人工校验
@ -216,4 +217,52 @@ public class MesConstants {
*
*/
public static final String MES_PURCHASE_ORDER_STATUS_TOPURCHASE = "1";//待采购
/**
* (1, 3,)
*/
public static final String MES_MATERIAL_CATEGORIES_RAW= "1"; //原材料
/**
* 1ERP23MES
*/
public static final String MES_MATERIAL_CLASSFICATION_VIRTUAL= "2"; //虚拟物料
/**
*
*/
public static final String MES_SALE_ORDER_IS_RELEASE_TO_PUBLISH = "0";//待发布工单
/**
* :1ERP2
*/
public static final String MES_PURCHASE_ORDER_CLASSFICATION_VIRTUAL= "2"; //虚拟采购订单
/**
* :1ERP2
*/
public static final String MES_SALE_ORDER_CLASSFICATION_VIRTUAL= "2"; //虚拟销售订单
/**
* 1 2 3
*/
public static final String MES_PURCHASE_ORDER_IS_FLAG_BIND_FINISHEED = "3";//绑定完成
/**
* BOM
*/
public static final String MES_MATERIAL_BOM_ACTIVE_FLAG_NORMAL = "1";//正常
public static final String MES_MATERIAL_BOM_ACTIVE_FLAG_STOP = "0";//停用
/**
* BOM
*/
public static final long MES_MATERIAL_BOM_TOP_FLAG_YES = 1;//是
public static final long MES_MATERIAL_BOM_TOP_FLAG_NO = 0;//否
}

@ -12,7 +12,8 @@ import java.util.stream.Collectors;
public enum WmsLocationStatus
{
NORMAL("1", "正常"), AUTOLOCK("2", "自动锁定"), MANUALLOCK("3", "人工锁定"),
MOVELOCK("4", "移库锁定"), MERGELOCK("5", "合库锁定");
MOVELOCK("4", "移库锁定"), MERGELOCK("5", "合库锁定"),
OUTLOCK("6", "出库锁定"),OUTSIDELOCATIONABNORMAL("8", "因浅库位异常导致深库位不可用"),ABNORMAL("9", "异常");
private final String code;
private final String info;

@ -0,0 +1,51 @@
package com.hw.common.core.utils;
import javax.mail.*;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;
public class MailUtils {
public static void main(String[] args) {
// 设置发件人、收件人、SMTP服务器等信息
String senderEmail = "chencheng01@jsjyep.com";
String receiverEmail = "chencheng01@jsjyep.com";
String password = "QH6faJaWw5rgvM4u";
String host = "smtp.exmail.qq.com"; // SMTP服务器地址
int port = 465; // 端口号如果是SSL连接常用465非SSL常用587或25
// 设置邮件服务器的属性
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl.enable", "true"); // 启用SSL
props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // 设置SSL/TLS版本
// props.put("mail.smtp.starttls.enable", "true"); // 如果是SSL连接则不需要这行
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
// 创建会话
Session session = Session.getInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(senderEmail, password);
}
});
try {
// 创建邮件消息
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(senderEmail));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiverEmail));
message.setSubject("测试");
message.setText("测试正文内容");
// 发送邮件
Transport.send(message);
System.out.println("邮件已成功发送!");
} catch (MessagingException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}

@ -0,0 +1,4 @@
package com.hw.common.core.utils;
public class dd {
}

@ -282,6 +282,26 @@ public class Seq {
public static final String stopUsingCode = "DEL";
// 虚拟销售订单编码
public static final String mesVirtualSaleOrderSeqType = "virtualsaleorder";
// 虚拟销售订单信息的接口序列数
private static AtomicInteger mesVirtualSaleOrderSeq = new AtomicInteger(1);
// 虚拟销售订单信息的记录标识
public static final String mesVirtualSaleOrderCode = "VS";
// 虚拟采购订单编码
public static final String mesVirtualPurchaseOrderSeqType = "virtualpurchaseorder";
// 虚拟采购订单信息的接口序列数
private static AtomicInteger mesVirtualPurchasaeOrderSeq = new AtomicInteger(1);
// 虚拟采购订单信息的记录标识
public static final String mesVirtualPurchaseOrderCode = "VP";
/**
*
*
@ -390,6 +410,10 @@ public class Seq {
atomicInt = mesBindBarcodeSeq;
}else if (stopUsingSeqType.equals(type)) {
atomicInt = stopUsingSeq;
}else if (mesVirtualSaleOrderSeqType.equals(type)) {
atomicInt = mesVirtualSaleOrderSeq;
}else if (mesVirtualPurchaseOrderSeqType.equals(type)) {
atomicInt = mesVirtualPurchasaeOrderSeq;
}
return getId(atomicInt, 3, code);
}

@ -1,34 +1,20 @@
package com.hw.dms.controller;
import java.util.Date;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.dms.domain.DmsBaseMaintStation;
import com.hw.job.api.RemoteJobService;
import com.hw.job.api.domain.SysJob;
import com.hw.job.api.util.CronUtils;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.dms.domain.DmsPlanLube;
import com.hw.dms.service.IDmsPlanLubeService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.job.api.RemoteJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller

@ -0,0 +1,63 @@
package com.hw.dms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* dms_inspect_project_device
*
* @author xins
* @date 2024-09-12
*/
public class DmsInspectProjectDevice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 点巡检项目ID */
private Long inspectProjectId;
/** 关联类型(1设备类型) */
private String targetType;
/** 关联类型为1时关联dms_base_device_type的主键 */
private Long targetId;
public void setInspectProjectId(Long inspectProjectId)
{
this.inspectProjectId = inspectProjectId;
}
public Long getInspectProjectId()
{
return inspectProjectId;
}
public void setTargetType(String targetType)
{
this.targetType = targetType;
}
public String getTargetType()
{
return targetType;
}
public void setTargetId(Long targetId)
{
this.targetId = targetId;
}
public Long getTargetId()
{
return targetId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("inspectProjectId", getInspectProjectId())
.append("targetType", getTargetType())
.append("targetId", getTargetId())
.toString();
}
}

@ -0,0 +1,61 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsInspectProjectDevice;
/**
* Mapper
*
* @author xins
* @date 2024-09-12
*/
public interface DmsInspectProjectDeviceMapper
{
/**
*
*
* @param inspectProjectId
* @return
*/
public DmsInspectProjectDevice selectDmsInspectProjectDeviceByInspectProjectId(Long inspectProjectId);
/**
*
*
* @param dmsInspectProjectDevice
* @return
*/
public List<DmsInspectProjectDevice> selectDmsInspectProjectDeviceList(DmsInspectProjectDevice dmsInspectProjectDevice);
/**
*
*
* @param dmsInspectProjectDevice
* @return
*/
public int insertDmsInspectProjectDevice(DmsInspectProjectDevice dmsInspectProjectDevice);
/**
*
*
* @param dmsInspectProjectDevice
* @return
*/
public int updateDmsInspectProjectDevice(DmsInspectProjectDevice dmsInspectProjectDevice);
/**
*
*
* @param inspectProjectId
* @return
*/
public int deleteDmsInspectProjectDeviceByInspectProjectId(Long inspectProjectId);
/**
*
*
* @param inspectProjectIds
* @return
*/
public int deleteDmsInspectProjectDeviceByInspectProjectIds(Long[] inspectProjectIds);
}

@ -7,10 +7,7 @@ import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.dms.domain.DmsBillsInspectInstance;
import com.hw.dms.domain.DmsBillsInspectInstanceActivity;
import com.hw.dms.domain.DmsInspectInstanceDetail;
import com.hw.dms.domain.DmsInspectInstanceDetailProject;
import com.hw.dms.domain.*;
import com.hw.dms.domain.vo.DmsBillsInspectInstanceScanVo;
import com.hw.dms.mapper.*;
import com.hw.dms.service.IDmsBillsInspectInstanceService;
@ -47,6 +44,10 @@ public class DmsBillsInspectInstanceServiceImpl implements IDmsBillsInspectInsta
@Autowired
private DmsInspectInstanceDetailProjectMapper dmsInspectInstanceDetailPrjectMapper;
@Autowired
private DmsInspectRouteDetailMapper dmsInspectRouteDetailMapper;
@Autowired
private DmsInspectProjectDeviceMapper dmsInspectProjectDeviceMapper;
@Autowired
private RemoteSysCommonService remoteSysCommonService;
/**
@ -88,6 +89,7 @@ public class DmsBillsInspectInstanceServiceImpl implements IDmsBillsInspectInsta
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertDmsBillsInspectInstance(DmsBillsInspectInstance dmsBillsInspectInstance) {
LoginUser user = SecurityUtils.getLoginUser();
//写死105也可根据传入对象的wfprocessid作为传参。
@ -100,9 +102,9 @@ public class DmsBillsInspectInstanceServiceImpl implements IDmsBillsInspectInsta
dmsBillsInspectInstance.setCreateTime(DateUtils.getNowDate());
dmsBillsInspectInstance.setIsFlag("1");
dmsBillsInspectInstance.setInspectStatus(DmsConstants.DMS_BILLS_INSPECT_INSTANCE_INSPECT_STATUS_TO_INSPECT);
dmsBillsInspectInstance.setCreateBy(user.getUsername());
dmsBillsInspectInstance.setCreateBy(SecurityUtils.getUsername());
int i = dmsBillsInspectInstanceMapper.insertDmsBillsInspectInstance(dmsBillsInspectInstance);
List<DmsBillsInspectInstance> dmsBillsInspectInstances = dmsBillsInspectInstanceMapper.selectDmsBillsInspectInstanceList(dmsBillsInspectInstance);
// List<DmsBillsInspectInstance> dmsBillsInspectInstances = dmsBillsInspectInstanceMapper.selectDmsBillsInspectInstanceList(dmsBillsInspectInstance);
//新建第一步工单实例节点
DmsBillsInspectInstanceActivity dmsBillsInspectInstanceActivity = new DmsBillsInspectInstanceActivity();
dmsBillsInspectInstanceActivity.setInspectInstanceId(dmsBillsInspectInstance.getInspectInstanceId());
@ -112,6 +114,35 @@ public class DmsBillsInspectInstanceServiceImpl implements IDmsBillsInspectInsta
dmsBillsInspectInstanceActivity.setProcessStepOrder(1l);
dmsBillsInspectInstanceActivity.setProcessActivityId(aLong);
dmsBillsInspectInstanceActivityMapper.insertDmsBillsInspectInstanceActivity(dmsBillsInspectInstanceActivity);
//新建点巡检工单明细
DmsInspectRouteDetail queryInspectRouteDetail = new DmsInspectRouteDetail();
queryInspectRouteDetail.setInspectRouteId(dmsBillsInspectInstance.getInspectRouteId());
List<DmsInspectRouteDetail> dmsInspectRouteDetails = dmsInspectRouteDetailMapper.selectDmsInspectRouteDetailList(queryInspectRouteDetail);
for(DmsInspectRouteDetail dmsInspectRouteDetail:dmsInspectRouteDetails){
DmsInspectInstanceDetail dmsInspectInstanceDetail = new DmsInspectInstanceDetail();
Long deviceId = dmsInspectRouteDetail.getDeviceId();
dmsInspectInstanceDetail.setInspectInstanceId(dmsBillsInspectInstance.getInspectInstanceId());
dmsInspectInstanceDetail.setLineStep(dmsInspectRouteDetail.getLineStep());
dmsInspectInstanceDetail.setDeviceId(deviceId);
dmsInspectInstanceDetail.setInstanceDetailStatus("1");
dmsInspectInstanceDetail.setInspectStandard(dmsInspectRouteDetail.getInspectStandard());
dmsInspectInstanceDetailMapper.insertDmsInspectInstanceDetail(dmsInspectInstanceDetail);
DmsInspectProjectDevice queryInspectProjectDevice = new DmsInspectProjectDevice();
queryInspectProjectDevice.setTargetType("2");
queryInspectProjectDevice.setTargetId(deviceId);
List<DmsInspectProjectDevice> dmsInspectProjectDevices = dmsInspectProjectDeviceMapper.selectDmsInspectProjectDeviceList(queryInspectProjectDevice);
for(DmsInspectProjectDevice dmsInspectProjectDevice:dmsInspectProjectDevices){
DmsInspectInstanceDetailProject dmsInspectInstanceDetailProject = new DmsInspectInstanceDetailProject();
dmsInspectInstanceDetailProject.setInstanceDetailId(dmsInspectInstanceDetail.getInstanceDetailId());
dmsInspectInstanceDetailProject.setInspectProjectId(dmsInspectProjectDevice.getInspectProjectId());
dmsInspectInstanceDetailProject.setCreateTime(new Date());
dmsInspectInstanceDetailProjectMapper.insertDmsInspectInstanceDetailProject(dmsInspectInstanceDetailProject);
}
}
return i;
}

@ -130,9 +130,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDmsInspectInstanceDetailProjectJoinList" parameterType="DmsInspectInstanceDetailProject" resultMap="DmsInspectInstanceDetailProjectResult">
<include refid="selectDmsInspectInstanceDetailProjectJoinVo"/>
<where>
<if test="deviceId != null "> and exists (select 1 from dms_inspect_project_device dipd where dipd.target_type=1
and dipd.target_id = (select device_type_id from dms_base_device_ledger where device_id=#{deviceId})
and dipd.inspect_project_id = dbip.inspect_project_id)</if>
<if test="deviceId != null "> and exists (select 1 from dms_inspect_project_device dipd where dipd.target_type=2
and dipd.target_id = #{deviceId} and dipd.inspect_project_id = dbip.inspect_project_id)</if>
<if test="instanceDetailId != null "> and instance_detail_id = #{instanceDetailId}</if>
<if test="inspectProjectId != null "> and inspect_project_id = #{inspectProjectId}</if>
<if test="inspectProjectStatus != null and inspectProjectStatus != ''"> and inspect_project_status = #{inspectProjectStatus}</if>

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.dms.mapper.DmsInspectProjectDeviceMapper">
<resultMap type="DmsInspectProjectDevice" id="DmsInspectProjectDeviceResult">
<result property="inspectProjectId" column="inspect_project_id" />
<result property="targetType" column="target_type" />
<result property="targetId" column="target_id" />
</resultMap>
<sql id="selectDmsInspectProjectDeviceVo">
select inspect_project_id, target_type, target_id from dms_inspect_project_device
</sql>
<select id="selectDmsInspectProjectDeviceList" parameterType="DmsInspectProjectDevice" resultMap="DmsInspectProjectDeviceResult">
<include refid="selectDmsInspectProjectDeviceVo"/>
<where>
<if test="targetId != null "> and target_id = #{targetId}</if>
<if test="targetType != null and targetType != ''"> and target_type = #{targetType}</if>
</where>
</select>
<select id="selectDmsInspectProjectDeviceByInspectProjectId" parameterType="Long" resultMap="DmsInspectProjectDeviceResult">
<include refid="selectDmsInspectProjectDeviceVo"/>
where inspect_project_id = #{inspectProjectId}
</select>
<insert id="insertDmsInspectProjectDevice" parameterType="DmsInspectProjectDevice">
insert into dms_inspect_project_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="inspectProjectId != null">inspect_project_id,</if>
<if test="targetType != null">target_type,</if>
<if test="targetId != null">target_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="inspectProjectId != null">#{inspectProjectId},</if>
<if test="targetType != null">#{targetType},</if>
<if test="targetId != null">#{targetId},</if>
</trim>
</insert>
<update id="updateDmsInspectProjectDevice" parameterType="DmsInspectProjectDevice">
update dms_inspect_project_device
<trim prefix="SET" suffixOverrides=",">
<if test="targetType != null">target_type = #{targetType},</if>
<if test="targetId != null">target_id = #{targetId},</if>
</trim>
where inspect_project_id = #{inspectProjectId}
</update>
<delete id="deleteDmsInspectProjectDeviceByInspectProjectId" parameterType="Long">
delete from dms_inspect_project_device where inspect_project_id = #{inspectProjectId}
</delete>
<delete id="deleteDmsInspectProjectDeviceByInspectProjectIds" parameterType="String">
delete from dms_inspect_project_device where inspect_project_id in
<foreach item="inspectProjectId" collection="array" open="(" separator="," close=")">
#{inspectProjectId}
</foreach>
</delete>
</mapper>

@ -31,6 +31,10 @@ public class MesConfig
private Long laserProcessId;
/**五楼原料周转区仓库ID*/
private Long fifthCabinetWarehouseId;
public String getSocketServerHost() {
return socketServerHost;
}
@ -62,4 +66,12 @@ public class MesConfig
public void setLaserProcessId(Long laserProcessId) {
this.laserProcessId = laserProcessId;
}
public Long getFifthCabinetWarehouseId() {
return fifthCabinetWarehouseId;
}
public void setFifthCabinetWarehouseId(Long fifthCabinetWarehouseId) {
this.fifthCabinetWarehouseId = fifthCabinetWarehouseId;
}
}

@ -360,4 +360,17 @@ public class MesBaseBarcodeInfoController extends BaseController
return R.ok(mesBaseBarcodeInfoService.transferBaseBarcodeInfos(mesBaseBarcodeInfos));
}
/**
*
*/
@RequiresPermissions("mes:barcode:mergeAdd")
@Log(title = "条码信息", businessType = BusinessType.INSERT)
@PostMapping("/mergeAdd")
public AjaxResult mergeAdd(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo)
{
return toAjax(mesBaseBarcodeInfoService.generateMergeRawBarcode(mesBaseBarcodeInfo));
}
}

@ -1,10 +1,11 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.service.IMesOrderBindService;
import com.hw.mes.service.IMesSaleOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -41,6 +42,9 @@ public class MesPurchaseOrderController extends BaseController
@Autowired
private IMesSaleOrderService mesSaleOrderService;
@Autowired
private IMesOrderBindService mesOrderBindService;
/**
*
*/
@ -212,4 +216,21 @@ public class MesPurchaseOrderController extends BaseController
return toAjax(mesPurchaseOrderService.deleteMesOrderBindByOrderBindIds(orderBindIds));
}
/**
*
*/
// @RequiresPermissions("mes:purchaseOrder:list")
@GetMapping("/getOrderBinds")
public TableDataInfo getOrderBinds(MesOrderBind mesOrderBind)
{
startPage();
List<MesOrderBind> list = mesOrderBindService.selectMesOrderBindJoinList(mesOrderBind);
return getDataTable(list);
}
}

@ -22,6 +22,16 @@ public class MesMaterialBom extends TreeEntity {
*/
private Long materialBomId;
/**
*1ERP23MES
*/
private String materialClassfication;
/**
*ERPID
*/
private Long erpMaterialId;
/**
* ID
*/
@ -121,6 +131,7 @@ public class MesMaterialBom extends TreeEntity {
return materialBomId;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
@ -129,6 +140,22 @@ public class MesMaterialBom extends TreeEntity {
return materialId;
}
public String getMaterialClassfication() {
return materialClassfication;
}
public void setMaterialClassfication(String materialClassfication) {
this.materialClassfication = materialClassfication;
}
public Long getErpMaterialId() {
return erpMaterialId;
}
public void setErpMaterialId(Long erpMaterialId) {
this.erpMaterialId = erpMaterialId;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}

@ -1,260 +1,270 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import java.util.Objects;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_order_bind
*
* @author xins
* @date 2024-05-16
*/
public class MesOrderBind extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long orderBindId;
/**
* (10)
*/
@Excel(name = "安全库存标识(1是0否)")
private String safeFlag;
/**
* ID;FID
*/
@Excel(name = "销售订单ID;对应FID")
private Long saleOrderId;
/**
*
*/
@Excel(name = "销售订单编号")
private String saleOrderCode;
/**
* ERPID
*/
@Excel(name = "ERP成品ID")
private Long productId;
/**
*
*/
@Excel(name = "成品编号")
private String productCode;
/**
*
*/
@Excel(name = "成品名称")
private String productName;
/**
* ID
*/
@Excel(name = "采购订单ID")
private Long purchaseOrderId;
/**
*
*/
@Excel(name = "采购订单编号")
private String poNo;
/**
* ERPID
*/
@Excel(name = "ERP物料ID")
private Long materialId;
/**
*
*/
@Excel(name = "物料编号")
private String materialCode;
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/**
*
*/
@Excel(name = "绑定数量")
private BigDecimal bindAmount;
/**
*
*/
private BigDecimal barcodeAmount;
private String productSpec;
public void setOrderBindId(Long orderBindId) {
this.orderBindId = orderBindId;
}
public Long getOrderBindId() {
return orderBindId;
}
public void setSafeFlag(String safeFlag) {
this.safeFlag = safeFlag;
}
public String getSafeFlag() {
return safeFlag;
}
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderCode(String saleOrderCode) {
this.saleOrderCode = saleOrderCode;
}
public String getSaleOrderCode() {
return saleOrderCode;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public Long getProductId() {
return productId;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode() {
return productCode;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setPurchaseOrderId(Long purchaseOrderId) {
this.purchaseOrderId = purchaseOrderId;
}
public Long getPurchaseOrderId() {
return purchaseOrderId;
}
public void setPoNo(String poNo) {
this.poNo = poNo;
}
public String getPoNo() {
return poNo;
}
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 void setBindAmount(BigDecimal bindAmount) {
this.bindAmount = bindAmount;
}
public BigDecimal getBindAmount() {
return bindAmount;
}
public BigDecimal getBarcodeAmount() {
return barcodeAmount;
}
public void setBarcodeAmount(BigDecimal barcodeAmount) {
this.barcodeAmount = barcodeAmount;
}
public String getProductSpec() {
return productSpec;
}
public void setProductSpec(String productSpec) {
this.productSpec = productSpec;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("orderBindId", getOrderBindId())
.append("safeFlag", getSafeFlag())
.append("saleOrderId", getSaleOrderId())
.append("saleOrderCode", getSaleOrderCode())
.append("productId", getProductId())
.append("productCode", getProductCode())
.append("productName", getProductName())
.append("purchaseOrderId", getPurchaseOrderId())
.append("poNo", getPoNo())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("bindAmount", getBindAmount())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MesOrderBind that = (MesOrderBind) o;
return Objects.equals(orderBindId, that.orderBindId) && barcodeAmount.compareTo(that.barcodeAmount) == 0;
}
@Override
public int hashCode() {
return Objects.hash(orderBindId, barcodeAmount);
}
}
//package com.hw.mes.domain;
//
//import java.math.BigDecimal;
//import java.util.Objects;
//
//import org.apache.commons.lang3.builder.ToStringBuilder;
//import org.apache.commons.lang3.builder.ToStringStyle;
//import com.hw.common.core.annotation.Excel;
//import com.hw.common.core.web.domain.BaseEntity;
//
///**
// * 采购销售订单绑定信息对象 mes_order_bind
// *
// * @author xins
// * @date 2024-05-16
// */
//public class MesOrderBind extends BaseEntity {
// private static final long serialVersionUID = 1L;
//
// /**
// * 主键标识
// */
// private Long orderBindId;
//
// /**
// * 安全库存标识(1是0否)
// */
// @Excel(name = "安全库存标识(1是0否)")
// private String safeFlag;
//
// /**
// * 销售订单ID;对应FID
// */
// @Excel(name = "销售订单ID;对应FID")
// private Long saleOrderId;
//
// /**
// * 销售订单编号
// */
// @Excel(name = "销售订单编号")
// private String saleOrderCode;
//
// /**
// * ERP成品ID
// */
// @Excel(name = "ERP成品ID")
// private Long productId;
//
// /**
// * 成品编号
// */
// @Excel(name = "成品编号")
// private String productCode;
//
// /**
// * 成品名称
// */
// @Excel(name = "成品名称")
// private String productName;
//
// /**
// * 采购订单ID
// */
// @Excel(name = "采购订单ID")
// private Long purchaseOrderId;
//
// /**
// * 采购订单编号
// */
// @Excel(name = "采购订单编号")
// private String poNo;
//
// /**
// * ERP物料ID
// */
// @Excel(name = "ERP物料ID")
// private Long materialId;
//
// /**
// * 物料编号
// */
// @Excel(name = "物料编号")
// private String materialCode;
//
// /**
// * 物料名称
// */
// @Excel(name = "物料名称")
// private String materialName;
//
// /**
// * 绑定数量
// */
// @Excel(name = "绑定数量")
// private BigDecimal bindAmount;
//
// /**
// * 绑定条码数量
// */
// private BigDecimal barcodeAmount;
//
// private String productSpec;
//
// private String materialSpec;
//
// public void setOrderBindId(Long orderBindId) {
// this.orderBindId = orderBindId;
// }
//
// public Long getOrderBindId() {
// return orderBindId;
// }
//
// public void setSafeFlag(String safeFlag) {
// this.safeFlag = safeFlag;
// }
//
// public String getSafeFlag() {
// return safeFlag;
// }
//
// public void setSaleOrderId(Long saleOrderId) {
// this.saleOrderId = saleOrderId;
// }
//
// public Long getSaleOrderId() {
// return saleOrderId;
// }
//
// public void setSaleOrderCode(String saleOrderCode) {
// this.saleOrderCode = saleOrderCode;
// }
//
// public String getSaleOrderCode() {
// return saleOrderCode;
// }
//
// public void setProductId(Long productId) {
// this.productId = productId;
// }
//
// public Long getProductId() {
// return productId;
// }
//
// public void setProductCode(String productCode) {
// this.productCode = productCode;
// }
//
// public String getProductCode() {
// return productCode;
// }
//
// public void setProductName(String productName) {
// this.productName = productName;
// }
//
// public String getProductName() {
// return productName;
// }
//
// public void setPurchaseOrderId(Long purchaseOrderId) {
// this.purchaseOrderId = purchaseOrderId;
// }
//
// public Long getPurchaseOrderId() {
// return purchaseOrderId;
// }
//
// public void setPoNo(String poNo) {
// this.poNo = poNo;
// }
//
// public String getPoNo() {
// return poNo;
// }
//
// 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 void setBindAmount(BigDecimal bindAmount) {
// this.bindAmount = bindAmount;
// }
//
// public BigDecimal getBindAmount() {
// return bindAmount;
// }
//
// public BigDecimal getBarcodeAmount() {
// return barcodeAmount;
// }
//
// public void setBarcodeAmount(BigDecimal barcodeAmount) {
// this.barcodeAmount = barcodeAmount;
// }
//
// public String getProductSpec() {
// return productSpec;
// }
//
// public void setProductSpec(String productSpec) {
// this.productSpec = productSpec;
// }
//
// public String getMaterialSpec() {
// return materialSpec;
// }
//
// public void setMaterialSpec(String materialSpec) {
// this.materialSpec = materialSpec;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
// .append("orderBindId", getOrderBindId())
// .append("safeFlag", getSafeFlag())
// .append("saleOrderId", getSaleOrderId())
// .append("saleOrderCode", getSaleOrderCode())
// .append("productId", getProductId())
// .append("productCode", getProductCode())
// .append("productName", getProductName())
// .append("purchaseOrderId", getPurchaseOrderId())
// .append("poNo", getPoNo())
// .append("materialId", getMaterialId())
// .append("materialCode", getMaterialCode())
// .append("materialName", getMaterialName())
// .append("bindAmount", getBindAmount())
// .append("remark", getRemark())
// .append("createBy", getCreateBy())
// .append("createTime", getCreateTime())
// .append("updateBy", getUpdateBy())
// .append("updateTime", getUpdateTime())
// .toString();
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// MesOrderBind that = (MesOrderBind) o;
// return Objects.equals(orderBindId, that.orderBindId) && barcodeAmount.compareTo(that.barcodeAmount) == 0;
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(orderBindId, barcodeAmount);
// }
//}

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.mes.api.domain.MesOrderBind;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
@ -67,6 +68,12 @@ public class MesPurchaseOrder extends BaseEntity {
@Excel(name = "物料名称;对应FMaterialId.FName")
private String materialName;
/**
* :1ERP2
*/
private String purchaseOrderClassfication;
/**
* ;FQty
*/
@ -404,6 +411,14 @@ public class MesPurchaseOrder extends BaseEntity {
return materialName;
}
public String getPurchaseOrderClassfication() {
return purchaseOrderClassfication;
}
public void setPurchaseOrderClassfication(String purchaseOrderClassfication) {
this.purchaseOrderClassfication = purchaseOrderClassfication;
}
public void setOrderAmount(BigDecimal orderAmount) {
this.orderAmount = orderAmount;
}
@ -655,12 +670,20 @@ public class MesPurchaseOrder extends BaseEntity {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MesPurchaseOrder that = (MesPurchaseOrder) o;
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);
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);
return Objects.hash(purchaseOrderId, orderAmount, boundAmount, safeAmount, orderBindBarcodeAmount, safeBindBarcodeAmount);
}
}

@ -0,0 +1,80 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_purchase_order_relate
*
* @author xins
* @date 2024-09-09
*/
public class MesPurchaseOrderRelate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long purchaseOrderRelateId;
/** 采购订单IDMES生成的 */
@Excel(name = "采购订单IDMES生成的")
private Long purchaseOrderId;
/** 关联采购订单ID */
@Excel(name = "关联采购订单ID")
private Long relatePurchaseOrderId;
/** 关联采购订单的订单数量 */
@Excel(name = "关联采购订单的订单数量")
private BigDecimal relatePurchaseOrderAmount;
public void setPurchaseOrderRelateId(Long purchaseOrderRelateId)
{
this.purchaseOrderRelateId = purchaseOrderRelateId;
}
public Long getPurchaseOrderRelateId()
{
return purchaseOrderRelateId;
}
public void setPurchaseOrderId(Long purchaseOrderId)
{
this.purchaseOrderId = purchaseOrderId;
}
public Long getPurchaseOrderId()
{
return purchaseOrderId;
}
public void setRelatePurchaseOrderId(Long relatePurchaseOrderId)
{
this.relatePurchaseOrderId = relatePurchaseOrderId;
}
public Long getRelatePurchaseOrderId()
{
return relatePurchaseOrderId;
}
public void setRelatePurchaseOrderAmount(BigDecimal relatePurchaseOrderAmount)
{
this.relatePurchaseOrderAmount = relatePurchaseOrderAmount;
}
public BigDecimal getRelatePurchaseOrderAmount()
{
return relatePurchaseOrderAmount;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("purchaseOrderRelateId", getPurchaseOrderRelateId())
.append("purchaseOrderId", getPurchaseOrderId())
.append("relatePurchaseOrderId", getRelatePurchaseOrderId())
.append("relatePurchaseOrderAmount", getRelatePurchaseOrderAmount())
.toString();
}
}

@ -178,6 +178,8 @@ public class MesSaleOrder extends BaseEntity {
*/
private String materialModel;
private String saleOrderClassfication;
private String materialSpec;
private Long erpMaterialId;
@ -192,6 +194,14 @@ public class MesSaleOrder extends BaseEntity {
this.materialModel = materialModel;
}
public String getSaleOrderClassfication() {
return saleOrderClassfication;
}
public void setSaleOrderClassfication(String saleOrderClassfication) {
this.saleOrderClassfication = saleOrderClassfication;
}
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}

@ -0,0 +1,106 @@
//package com.hw.mes.domain;
//
//import java.math.BigDecimal;
//import java.util.Date;
//
//import org.apache.commons.lang3.builder.ToStringBuilder;
//import org.apache.commons.lang3.builder.ToStringStyle;
//import com.hw.common.core.annotation.Excel;
//import com.hw.common.core.web.domain.BaseEntity;
//
///**
// * 销售订单关联信息对象 mes_sale_order_relate
// *
// * @author xins
// * @date 2024-09-09
// */
//public class MesSaleOrderRelate extends BaseEntity
//{
// private static final long serialVersionUID = 1L;
//
// /** 主键 */
// private Long saleOrderRelateId;
//
// /** 销售订单ID */
// @Excel(name = "销售订单ID")
// private Long saleOrderId;
//
// /** 关联销售订单ID */
// @Excel(name = "关联销售订单ID")
// private Long relateSaleOrderId;
//
// /** 采购订单ID */
// private Long purchaseOrderId;
//
// /** 关联销售订单的数量,有可能小于原销售订单的订单数量 */
// @Excel(name = "关联销售订单的数量,有可能小于原销售订单的订单数量")
// private BigDecimal relateSaleOrderAmout;
//
// /**
// * 此字段不保存
// */
// private Date planDeliveryDate;
//
// public void setSaleOrderRelateId(Long saleOrderRelateId)
// {
// this.saleOrderRelateId = saleOrderRelateId;
// }
//
// public Long getSaleOrderRelateId()
// {
// return saleOrderRelateId;
// }
// public void setSaleOrderId(Long saleOrderId)
// {
// this.saleOrderId = saleOrderId;
// }
//
// public Long getSaleOrderId()
// {
// return saleOrderId;
// }
// public void setRelateSaleOrderId(Long relateSaleOrderId)
// {
// this.relateSaleOrderId = relateSaleOrderId;
// }
//
// public Long getPurchaseOrderId() {
// return purchaseOrderId;
// }
//
// public void setPurchaseOrderId(Long purchaseOrderId) {
// this.purchaseOrderId = purchaseOrderId;
// }
//
// public Long getRelateSaleOrderId()
// {
// return relateSaleOrderId;
// }
// public void setRelateSaleOrderAmout(BigDecimal relateSaleOrderAmout)
// {
// this.relateSaleOrderAmout = relateSaleOrderAmout;
// }
//
// public BigDecimal getRelateSaleOrderAmout()
// {
// return relateSaleOrderAmout;
// }
//
// public Date getPlanDeliveryDate() {
// return planDeliveryDate;
// }
//
// public void setPlanDeliveryDate(Date planDeliveryDate) {
// this.planDeliveryDate = planDeliveryDate;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
// .append("saleOrderRelateId", getSaleOrderRelateId())
// .append("saleOrderId", getSaleOrderId())
// .append("relateSaleOrderId", getRelateSaleOrderId())
// .append("relateSaleOrderAmout", getRelateSaleOrderAmout())
// .toString();
// }
//}

@ -1,7 +1,6 @@
package com.hw.mes.domain.vo;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.domain.MesProductPlan;
import com.hw.mes.api.domain.MesOrderBind;
import lombok.Data;
import javax.validation.constraints.NotEmpty;

@ -1,7 +1,7 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.api.domain.MesOrderBind;
/**
* Mapper
@ -58,4 +58,13 @@ public interface MesOrderBindMapper
* @return
*/
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds);
/**
* ,Join material
*
* @param mesOrderBind
* @return
*/
public List<MesOrderBind> selectMesOrderBindJoinList(MesOrderBind mesOrderBind);
}

@ -2,7 +2,7 @@ package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.domain.MesPurchaseOrder;
import org.apache.ibatis.annotations.Param;

@ -0,0 +1,70 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesPurchaseOrderRelate;
/**
* Mapper
*
* @author xins
* @date 2024-09-09
*/
public interface MesPurchaseOrderRelateMapper
{
/**
*
*
* @param purchaseOrderRelateId
* @return
*/
public MesPurchaseOrderRelate selectMesPurchaseOrderRelateByPurchaseOrderRelateId(Long purchaseOrderRelateId);
/**
*
*
* @param mesPurchaseOrderRelate
* @return
*/
public List<MesPurchaseOrderRelate> selectMesPurchaseOrderRelateList(MesPurchaseOrderRelate mesPurchaseOrderRelate);
/**
*
*
* @param mesPurchaseOrderRelate
* @return
*/
public int insertMesPurchaseOrderRelate(MesPurchaseOrderRelate mesPurchaseOrderRelate);
/**
*
*
* @param mesPurchaseOrderRelate
* @return
*/
public int updateMesPurchaseOrderRelate(MesPurchaseOrderRelate mesPurchaseOrderRelate);
/**
*
*
* @param purchaseOrderRelateId
* @return
*/
public int deleteMesPurchaseOrderRelateByPurchaseOrderRelateId(Long purchaseOrderRelateId);
/**
*
*
* @param purchaseOrderRelateIds
* @return
*/
public int deleteMesPurchaseOrderRelateByPurchaseOrderRelateIds(Long[] purchaseOrderRelateIds);
/**
*
*
* @param mesPurchaseOrderRelateList
* @return
*/
public int batchMesPurchaseOrderRelate(List<MesPurchaseOrderRelate> mesPurchaseOrderRelateList);
}

@ -67,4 +67,5 @@ public interface MesSaleOrderMapper
*/
public List<MesSaleOrder> selectMesSaleOrderJoinMaterialList(MesSaleOrder mesSaleOrder);
}

@ -0,0 +1,69 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.api.domain.MesSaleOrderRelate;
/**
* Mapper
*
* @author xins
* @date 2024-09-09
*/
public interface MesSaleOrderRelateMapper
{
/**
*
*
* @param saleOrderRelateId
* @return
*/
public MesSaleOrderRelate selectMesSaleOrderRelateBySaleOrderRelateId(Long saleOrderRelateId);
/**
*
*
* @param mesSaleOrderRelate
* @return
*/
public List<MesSaleOrderRelate> selectMesSaleOrderRelateList(MesSaleOrderRelate mesSaleOrderRelate);
/**
*
*
* @param mesSaleOrderRelate
* @return
*/
public int insertMesSaleOrderRelate(MesSaleOrderRelate mesSaleOrderRelate);
/**
*
*
* @param mesSaleOrderRelate
* @return
*/
public int updateMesSaleOrderRelate(MesSaleOrderRelate mesSaleOrderRelate);
/**
*
*
* @param saleOrderRelateId
* @return
*/
public int deleteMesSaleOrderRelateBySaleOrderRelateId(Long saleOrderRelateId);
/**
*
*
* @param saleOrderRelateIds
* @return
*/
public int deleteMesSaleOrderRelateBySaleOrderRelateIds(Long[] saleOrderRelateIds);
/**
*
*
* @param mesSaleOrderRelateList
* @return
*/
public int batchMesSaleOrderRelate(List<MesSaleOrderRelate> mesSaleOrderRelateList);
}

@ -193,4 +193,10 @@ public interface IMesBaseBarcodeInfoService
* @return
*/
public boolean transferBaseBarcodeInfos(List<MesBaseBarcodeInfo> mesBaseBarcodeInfos);
/**
*
* @param mesBaseBarcodeInfo
*/
public int generateMergeRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo);
}

@ -1,7 +1,7 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.api.domain.MesOrderBind;
/**
* Service
@ -58,4 +58,13 @@ public interface IMesOrderBindService
* @return
*/
public int deleteMesOrderBindByOrderBindId(Long orderBindId);
/**
* ,Join material
*
* @param mesOrderBind
* @return
*/
public List<MesOrderBind> selectMesOrderBindJoinList(MesOrderBind mesOrderBind);
}

@ -1,14 +1,9 @@
package com.hw.mes.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.hw.common.core.constant.Constants;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.QmsConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.*;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
@ -17,6 +12,9 @@ import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.config.MesConfig;
import com.hw.mes.domain.*;
import com.hw.mes.domain.vo.MesBindBarcodeVo;
import com.hw.mes.mapper.*;
@ -27,6 +25,7 @@ import com.hw.printer.api.RemotePrinterService;
import com.hw.printer.api.domain.vo.PrintContentVo;
import com.hw.printer.api.domain.vo.PrinterVo;
import com.hw.wms.api.RemoteWmsService;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo;
import org.springframework.beans.factory.annotation.Autowired;
@ -72,6 +71,21 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
@Autowired
private MesProductPlanDetailMapper mesProductPlanDetailMapper;
@Autowired
private MesPurchaseOrderMapper mesPurchaseOrderMapper;
@Autowired
private MesSaleOrderMapper mesSaleOrderMapper;
@Autowired
private MesMaterialBomMapper mesMaterialBomMapper;
@Autowired
private MesSaleOrderRelateMapper mesSaleOrderRelateMapper;
@Autowired
private MesConfig mesConfig;
@Resource
private RemoteWmsService remoteWmsService;
@ -180,7 +194,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
if (canBindAmount.compareTo(BigDecimal.ONE) >= 0) {
for (int i = 0; i < canBindAmount.intValue(); i++) {
// 生成数量条的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate);
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
toInsertedBarcodeInfo.setSaleOrderId(mesOrderBind.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(mesOrderBind.getSaleOrderCode());
@ -202,7 +216,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成条码数量的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate);
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
toInsertedBarcodeInfo.setSaleOrderId(0L);
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
@ -247,7 +261,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成数量条的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate);
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
toInsertedBarcodeInfo.setSaleOrderId(0L);
toInsertedBarcodeInfos.add(toInsertedBarcodeInfo);
@ -493,14 +507,14 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
public MesBaseBarcodeInfo getInsertedBarcodeInfo(MesBaseBarcodeInfo mesBaseBarcodeInfo, String batchCode, String userName, Date currentDate) {
public MesBaseBarcodeInfo getInsertedBarcodeInfo(MesBaseBarcodeInfo mesBaseBarcodeInfo, String barcodeInfo, String batchCode, String userName, Date currentDate) {
MesBaseBarcodeInfo toInsertedBarcodeInfo = new MesBaseBarcodeInfo();
//同一批次的批次代码相同
toInsertedBarcodeInfo.setBatchCode(batchCode);
toInsertedBarcodeInfo.setPurchaseOrderId(mesBaseBarcodeInfo.getPurchaseOrderId());
toInsertedBarcodeInfo.setPoNo(mesBaseBarcodeInfo.getPoNo());
toInsertedBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW);
toInsertedBarcodeInfo.setBarcodeInfo(Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode));
toInsertedBarcodeInfo.setBarcodeInfo(barcodeInfo);
toInsertedBarcodeInfo.setMaterialId(mesBaseBarcodeInfo.getMaterialId());
toInsertedBarcodeInfo.setProductionDate(mesBaseBarcodeInfo.getProductionDate());
toInsertedBarcodeInfo.setLastOutstockDate(mesBaseBarcodeInfo.getLastOutstockDate());
@ -1114,4 +1128,450 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
return updateSize > 0;
}
/**
*
*
* @param mesBaseBarcodeInfo
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int generateMergeRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
List<MesSaleOrderRelate> mesSaleOrderRelateList = mesBaseBarcodeInfo.getMesSaleOrderRelateList();
List<MesMaterialBom> toUpdatedMaterialBoms = new ArrayList<>();
StringBuilder errorMsgBuilder = new StringBuilder();
for (MesSaleOrderRelate mesSaleOrderRelate : mesSaleOrderRelateList) {
Long orderBindId = mesSaleOrderRelate.getOrderBindId();
MesOrderBind dbOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
if (dbOrderBind.getBindAmount().compareTo(BigDecimal.ONE)!=0) {
errorMsgBuilder.append(String.format("序号%s订单绑定数量需要为1", mesSaleOrderRelate.getIndex()));
}
if(dbOrderBind.getBarcodeAmount().compareTo(BigDecimal.ONE)>=0){
errorMsgBuilder.append(String.format("序号%s已经生成条码不能再次选择", mesSaleOrderRelate.getIndex()));
}
Long relateSaleOrderId = mesSaleOrderRelate.getRelateSaleOrderId();
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setRelateSaleOrderId(relateSaleOrderId);
List<MesSaleOrderRelate> mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate);
if (mesSaleOrderRelates != null && !mesSaleOrderRelates.isEmpty()) {
errorMsgBuilder.append(String.format("序号%s销售订单已经关联过;", mesSaleOrderRelate.getIndex()));
}
MesSaleOrder saleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(relateSaleOrderId);
BigDecimal saleOrderAmount = saleOrder.getOrderAmount();
BigDecimal availableAmount = mesSaleOrderRelate.getRelateSaleOrderAmount();
if (availableAmount.compareTo(BigDecimal.ONE) != 0) {
errorMsgBuilder.append(String.format("序号%s需要选择可用数量为1的信息;", mesSaleOrderRelate.getIndex()));
}
if (!saleOrder.getIsRelease().equals(MesConstants.MES_SALE_ORDER_IS_RELEASE_TO_PUBLISH)) {
errorMsgBuilder.append(String.format("序号%s销售订单已经发布工单不能合并;", mesSaleOrderRelate.getIndex()));
}
if (saleOrderAmount.compareTo(availableAmount) != 0) {
errorMsgBuilder.append(String.format("序号%s需要选择销售订单数量为1的信息;", mesSaleOrderRelate.getIndex()));
}
Long erpMaterialId = saleOrder.getMaterialId();
MesMaterialBom queryMaterialBom = new MesMaterialBom();
queryMaterialBom.setErpMaterialId(erpMaterialId);
queryMaterialBom.setActiveFlag(MesConstants.MES_MATERIAL_BOM_ACTIVE_FLAG_NORMAL);
queryMaterialBom.setParentId(0L);
List<MesMaterialBom> mesMaterialBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom);
if (mesMaterialBoms == null || mesMaterialBoms.isEmpty()) {
errorMsgBuilder.append("序号").append(mesSaleOrderRelate.getIndex()).append("销售订单成品没有配置bom信息[成品编号:")
.append(mesSaleOrderRelate.getProductCode()).append("成品名称:").append(mesSaleOrderRelate.getProductName())
.append("成品规格").append(mesSaleOrderRelate.getProductSpec());
} else if (mesMaterialBoms.size() > 1) {
errorMsgBuilder.append("序号").append(mesSaleOrderRelate.getIndex()).append("销售订单成品配置bom信息多余一条[成品编号:")
.append(mesSaleOrderRelate.getProductCode()).append("成品名称:").append(mesSaleOrderRelate.getProductName())
.append("成品规格").append(mesSaleOrderRelate.getProductSpec());
} else {
MesMaterialBom mesMaterialBom = mesMaterialBoms.get(0);
toUpdatedMaterialBoms.add(mesMaterialBom);
}
//更新采购订单和销售订单绑定信息的条码数量
dbOrderBind.setBarcodeAmount(dbOrderBind.getBarcodeAmount().add(availableAmount));
dbOrderBind.setUpdateTime(currentDate);
dbOrderBind.setUpdateBy(userName);
mesOrderBindMapper.updateMesOrderBind(dbOrderBind);
// materialCodes.add(mesPurchaseOrderVo.getMaterialCode());
}
if (errorMsgBuilder.length() > 0) {
throw new ServiceException(errorMsgBuilder.toString());
}
//新建虚拟物料
String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode);
Long materialId = this.insertNewVirtualMaterial(barcodeInfo, userName, currentDate);
//创建虚拟销售订单,保存对应的销售订单列表
MesSaleOrder virtualSaleOrder = this.insertNewVirtualSaleOrder(materialId, barcodeInfo, mesSaleOrderRelateList, userName, currentDate);
//创建虚拟bom并合并销售订单的bom信息
this.insertVirtualMaterialBom(materialId, barcodeInfo, toUpdatedMaterialBoms, userName, currentDate);
//生成条码
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
MesBaseBarcodeInfo toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, barcodeInfo, batchCode, userName, currentDate);
toInsertedBarcodeInfo.setPurchaseOrderId(-1L);
toInsertedBarcodeInfo.setMaterialId(materialId);
toInsertedBarcodeInfo.setSaleOrderId(virtualSaleOrder.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(virtualSaleOrder.getSaleorderCode());
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
// toInsertedBarcodeInfo.setBarcodeSpec(materialCodes.toString());
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
//更新warehouse配置
WmsWarehouseMaterial warehouseMaterial = new WmsWarehouseMaterial();
warehouseMaterial.setWarehouseId(mesConfig.getFifthCabinetWarehouseId());
warehouseMaterial.setWarehouseFloor(5);
warehouseMaterial.setStorageType(WmsConstants.WMS_WAREHOUSE_MATERIAL_STORAGE_TYPE_MATERIAL);
warehouseMaterial.setStorageId(materialId);
R<Boolean> isAllocateMaterial = remoteWmsService.allocateVirtualMaterial(warehouseMaterial, SecurityConstants.INNER);
if (!isAllocateMaterial.getData()) {
throw new RuntimeException("仓库配置物料失败,请重试或联系管理员");
}
return 1;
}
public long insertNewVirtualMaterial(String barcodeInfo, String userName, Date currentDate) {
//虚拟成品和虚拟原材料用一个物料
MesBaseMaterialInfo mesBaseMaterialInfo = new MesBaseMaterialInfo();
mesBaseMaterialInfo.setMaterialCode(barcodeInfo);
mesBaseMaterialInfo.setMaterialName(barcodeInfo);
mesBaseMaterialInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
// mesBaseMaterialInfo.setMaterialCategories(MesConstants.MES_MATERIAL_CATEGORIES_RAW);
mesBaseMaterialInfo.setActiveFlag(MesConstants.MES_MATERIAL_ALWAYS_FLAG_NO);
mesBaseMaterialInfo.setMaterialClassfication(MesConstants.MES_MATERIAL_CLASSFICATION_VIRTUAL);
mesBaseMaterialInfo.setActiveFlag(MesConstants.MES_MATERIAL_ACTIVE_FLAG_NORMAL);
mesBaseMaterialInfo.setApplyFlag(MesConstants.MES_MATERIAL_APPLY_FLAG_YES);
mesBaseMaterialInfo.setCreateBy(userName);
mesBaseMaterialInfo.setCreateTime(currentDate);
mesBaseMaterialInfoMapper.insertMesBaseMaterialInfo(mesBaseMaterialInfo);
return mesBaseMaterialInfo.getMaterialId();
}
public MesSaleOrder insertNewVirtualSaleOrder(Long materialId, String barcodeInfo,
List<MesSaleOrderRelate> mesSaleOrderRelates, String userName, Date currentDate) {
// Optional<MesSaleOrderRelate> minMesSaleOrderRelate = mesSaleOrderRelates.stream()
// .filter(msor -> msor.getPlanDeliveryDate() != null)
// .min((obj1, obj2) -> obj1.getPlanDeliveryDate().compareTo(obj2.getPlanDeliveryDate()));
MesSaleOrder mesSaleOrder = new MesSaleOrder();
mesSaleOrder.setMaterialId(materialId);
mesSaleOrder.setMaterialCode(barcodeInfo);
mesSaleOrder.setMaterialName(barcodeInfo);
mesSaleOrder.setOrderAmount(BigDecimal.ONE);
mesSaleOrder.setSaleorderCode(Seq.getId(Seq.mesVirtualSaleOrderSeqType, Seq.mesVirtualSaleOrderCode));
mesSaleOrder.setIsRelease(MesConstants.MES_SALE_ORDER_IS_RELEASE_TO_PUBLISH);
// mesSaleOrder.setPlanDeliveryDate();
mesSaleOrder.setSaleOrderClassfication(MesConstants.MES_SALE_ORDER_CLASSFICATION_VIRTUAL);
mesSaleOrder.setCreateBy(userName);
mesSaleOrder.setCreateTime(currentDate);
mesSaleOrderMapper.insertMesSaleOrder(mesSaleOrder);
mesSaleOrderRelates.forEach(msor -> {
msor.setSaleOrderId(mesSaleOrder.getSaleOrderId());
msor.setBarcodeInfo(barcodeInfo);
});
mesSaleOrderRelateMapper.batchMesSaleOrderRelate(mesSaleOrderRelates);
return mesSaleOrder;
}
public void insertVirtualMaterialBom(Long materialId, String barcodeInfo, List<MesMaterialBom> toUpdatedMaterialBoms, String userName, Date currentDate) {
MesMaterialBom virtualMaterialBom = new MesMaterialBom();
virtualMaterialBom.setMaterialBomDesc(barcodeInfo);
virtualMaterialBom.setParentId(0L);
virtualMaterialBom.setAncestors("0");
virtualMaterialBom.setMaterialClassfication(MesConstants.MES_MATERIAL_CLASSFICATION_VIRTUAL);
virtualMaterialBom.setErpMaterialId(0L);
virtualMaterialBom.setMaterialId(materialId);
virtualMaterialBom.setMaterialName(barcodeInfo);
virtualMaterialBom.setStandardAmount(BigDecimal.ONE);
virtualMaterialBom.setTopFlag(MesConstants.MES_MATERIAL_BOM_TOP_FLAG_YES);
virtualMaterialBom.setCheckType(MesConstants.MES_MATERIAL_BOM_CHECK_TYPE_NO);
virtualMaterialBom.setActiveFlag(MesConstants.MES_MATERIAL_ACTIVE_FLAG_NORMAL);
virtualMaterialBom.setCreateBy(userName);
virtualMaterialBom.setCreateTime(currentDate);
mesMaterialBomMapper.insertMesMaterialBom(virtualMaterialBom);
toUpdatedMaterialBoms.forEach(umb -> {
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);
});
}
// public MesPurchaseOrder insertVirtualPurchaseOrder(Long materialId, String barcodeInfo, BigDecimal sumOrderAmount,
// List<MesPurchaseOrderRelate> mesPurchaseOrderRelates,String userName, Date currentDate) {
// MesPurchaseOrder virtualPurchaseOrder = new MesPurchaseOrder();
// virtualPurchaseOrder.setMaterialId(materialId);
// virtualPurchaseOrder.setMaterialCode(barcodeInfo);
// virtualPurchaseOrder.setMaterialName(barcodeInfo);
// virtualPurchaseOrder.setOrderAmount(sumOrderAmount);
// virtualPurchaseOrder.setPoNo(Seq.getId(Seq.mesVirtualPurchaseOrderSeqType,Seq.mesVirtualPurchaseOrderCode));
// virtualPurchaseOrder.setIsFlag(MesConstants.MES_PURCHASE_ORDER_IS_FLAG_BIND_FINISHEED);
// virtualPurchaseOrder.setOrderStatus(MesConstants.MES_PURCHASE_ORDER_STATUS_TOPURCHASE);
// virtualPurchaseOrder.setPurchaseOrderClassfication(MesConstants.MES_PURCHASE_ORDER_CLASSFICATION_VIRTUAL);
//
// virtualPurchaseOrder.setCreateBy(userName);
// virtualPurchaseOrder.setCreateTime(currentDate);
//
//
// long purchaseOrderId = mesPurchaseOrderMapper.insertMesPurchaseOrder(virtualPurchaseOrder);
// virtualPurchaseOrder.setPurchaseOrderId(purchaseOrderId);
//
// mesPurchaseOrderRelates.forEach(mpor -> {
// mpor.setPurchaseOrderId(purchaseOrderId);
// });
//
// mesPurchaseOrderRelateMapper.batchMesPurchaseOrderRelate(mesPurchaseOrderRelates);
//
// return virtualPurchaseOrder;
//
// }
// @Transactional(rollbackFor = Exception.class)
// public void generateMergeRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
// Date currentDate = new Date();
// String userName = SecurityUtils.getUsername();
// List<MesPurchaseOrderVo> purchaseOrderVoList = mesBaseBarcodeInfo.getPurchaseOrderVoList();
//// MesPurchaseOrderVo firstPurchaseOrderVo = purchaseOrderVoList.get(0);
//
//// List<Map<String, MesOrderBind>> allMesOrderBindsMap = new ArrayList<>();
//
// List<String> materialCodes = new ArrayList<>();
// for (MesPurchaseOrderVo mesPurchaseOrderVo : purchaseOrderVoList) {
// Long purchaseOrderId = mesPurchaseOrderVo.getPurchaseOrderId();
//// MesOrderBind queryOrderBind = new MesOrderBind();
//// queryOrderBind.setPurchaseOrderId(purchaseOrderId);
//// List<MesOrderBind> mesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind);
//// if (mesOrderBinds == null || mesOrderBinds.isEmpty()) {
//// throw new ServiceException("请将选择的所有采购订单明细都绑定销售订单");
//// }
// //根据采购订单号来分组
//// Map<String, MesOrderBind> mesOrderBindsMap = mesOrderBinds.stream().filter(ob ->
//// ob.getBindAmount().compareTo(ob.getBarcodeAmount()) > 0)
//// .collect(Collectors.toMap(MesOrderBind::getPoNo, e -> e));
////
//// allMesOrderBindsMap.add(mesOrderBindsMap);
//
// Long erpMaterialId = mesPurchaseOrderVo.getMaterialId();
// materialCodes.add(mesPurchaseOrderVo.getMaterialCode());
//
// MesPurchaseOrder queryPurchaseOrder = new MesPurchaseOrder();
// queryPurchaseOrder.setPurchaseOrderId(purchaseOrderId);
// List<MesPurchaseOrder> dbPurchaseOrders = mesPurchaseOrderMapper.selectPurchaseOrderBindList(queryPurchaseOrder);
// MesPurchaseOrder dbPurchaseOrder = dbPurchaseOrders.get(0);
//
// MesPurchaseOrder mesPurchaseOrder = new MesPurchaseOrder();
// mesPurchaseOrder.setPurchaseOrderId(purchaseOrderId);
// mesPurchaseOrder.setOrderAmount(mesPurchaseOrderVo.getOrderAmount());
// mesPurchaseOrder.setOrderBindBarcodeAmount(mesPurchaseOrderVo.getOrderBindBarcodeAmount());
// mesPurchaseOrder.setSafeBindBarcodeAmount(mesPurchaseOrderVo.getSafeBindBarcodeAmount());
//
// if (!mesPurchaseOrder.equals(dbPurchaseOrder)) {
// throw new ServiceException("数据有变化,请重新更新");
// }
//
// }
//
// // 收集Map的key集合
//// List<Set<String>> allSaleOrderCodeSets = new ArrayList<>();
//// for (Map<String, MesOrderBind> allMesOrderBindMap : allMesOrderBindsMap) {
//// allSaleOrderCodeSets.add(allMesOrderBindMap.keySet());
//// }
//
// //取saleordercode的交集saleordercode相同但是saleorderid可以不相同
//// Set<String> saleOrderCodeIntersection = allSaleOrderCodeSets.stream()
//// .reduce((set1, set2) -> {
//// set1.retainAll(set2); // 保留交集部分
//// return set1;
//// })
//// .orElse(Collections.emptySet()); // 如果没有交集,则返回一个空集合
////
//// if (saleOrderCodeIntersection.isEmpty()) {
//// throw new ServiceException("选择的采购订单信息没有绑定同一销售订单号");
//// }
//
//
// //更新绑定信息的条码数量
//// Long saleOrderId = saleOrderIdIntersection.stream().findFirst().get();
// String saleorderCode = "", safeFlag = "";
// for (Map<Long, MesOrderBind> allMesOrderBindMap : allMesOrderBindsMap) {
// MesOrderBind toUpdatedMesOrderBind = allMesOrderBindMap.get(saleOrderId);
// saleorderCode = toUpdatedMesOrderBind.getSaleOrderCode();
// safeFlag = toUpdatedMesOrderBind.getSafeFlag();
// toUpdatedMesOrderBind.setBarcodeAmount(toUpdatedMesOrderBind.getBarcodeAmount().add(BigDecimal.ONE));
// toUpdatedMesOrderBind.setUpdateBy(userName);
// toUpdatedMesOrderBind.setUpdateTime(currentDate);
// mesOrderBindMapper.updateMesOrderBind(toUpdatedMesOrderBind);
// }
//
// //新建物料
// String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode);
// Long materialId = this.insertNewVirtualMaterial(barcodeInfo, userName, currentDate);
//
//
// //合并采购订单
//
//
// //生成条码
// String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
// mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
// MesBaseBarcodeInfo toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, barcodeInfo, batchCode, userName, currentDate);
//// toInsertedBarcodeInfo.setPurchaseOrderId();
//// toInsertedBarcodeInfo.setPoNo();
// toInsertedBarcodeInfo.setMaterialId(materialId);
// toInsertedBarcodeInfo.setSaleOrderId(saleOrderId);
// toInsertedBarcodeInfo.setSaleorderCode(saleorderCode);
// toInsertedBarcodeInfo.setSafeFlag(safeFlag);
// toInsertedBarcodeInfo.setBarcodeSpec(materialCodes.toString());
//
// mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
//
// //更新warehouse配置
//
// }
// /**
// * 合并采购订单生成原材料条码
// * @param mesBaseBarcodeInfo 条码信息
// */
// @Override
// @Transactional(rollbackFor = Exception.class)
// public int generateMergeRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
// Date currentDate = new Date();
// String userName = SecurityUtils.getUsername();
// List<MesOrderBind> mesOrderBinds = mesBaseBarcodeInfo.getMesOrderBinds();
//
// List<String> materialCodes = new ArrayList<>();
// List<MesSaleOrderRelate> toInsertSaleOrderRelates = new ArrayList<>();
//
// for (MesOrderBind mesOrderBind : mesOrderBinds) {
// Long purchaseOrderId = mesPurchaseOrderVo.getPurchaseOrderId();
//
//// Long erpMaterialId = mesPurchaseOrderVo.getMaterialId();
// materialCodes.add(mesPurchaseOrderVo.getMaterialCode());
//
// MesPurchaseOrder queryPurchaseOrder = new MesPurchaseOrder();
// queryPurchaseOrder.setPurchaseOrderId(purchaseOrderId);
// List<MesPurchaseOrder> dbPurchaseOrders = mesPurchaseOrderMapper.selectPurchaseOrderBindList(queryPurchaseOrder);
// MesPurchaseOrder dbPurchaseOrder = dbPurchaseOrders.get(0);
// dbPurchaseOrder.setSafeBindBarcodeAmount("");
// MesPurchaseOrder mesPurchaseOrder = new MesPurchaseOrder();
// mesPurchaseOrder.setPurchaseOrderId(purchaseOrderId);
//
// mesPurchaseOrder.setOrderAmount(mesPurchaseOrderVo.getOrderAmount());
// mesPurchaseOrder.setOrderBindBarcodeAmount(mesPurchaseOrderVo.getOrderBindBarcodeAmount());
// mesPurchaseOrder.setSafeBindBarcodeAmount("");
//
// if (!mesPurchaseOrder.equals(dbPurchaseOrder)) {
// throw new ServiceException("数据有变化,请重新更新");
// }
//
// //只生成采购订单绑定销售订单的,安全库存的不绑定
// MesOrderBind queryOrderBind = new MesOrderBind();
// queryOrderBind.setPurchaseOrderId(purchaseOrderId);
// List<MesOrderBind> mesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind);
// if (mesOrderBinds == null || mesOrderBinds.isEmpty()) {
// throw new ServiceException("请将选择的所有采购订单明细都绑定销售订单");
// }
//
// mesOrderBinds.stream().filter(mob -> mob.getBindAmount().compareTo(mob.getBarcodeAmount()) > 0 && mob.getSaleOrderId() > 0)
// .forEach(filterMob -> {
// Long saleOrderId = filterMob.getSaleOrderId();
// MesSaleOrder saleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(saleOrderId);
// BigDecimal saleOrderAmount = saleOrder.getOrderAmount();
// BigDecimal barcodeAmount = filterMob.getBindAmount().subtract(filterMob.getBarcodeAmount());
// if (saleOrderAmount.compareTo(barcodeAmount) < 0) {
// throw new ServiceException(String.format("销售订单数量[%s]小于可用采购绑定数量[%s],请通知管理员修改采购订单绑定销售订单信息", saleOrderAmount, barcodeAmount));
// }
//
//
// //校验对应的销售订单合并后的销售数量
//// MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
//// querySaleOrderRelate.setRelateSaleOrderId(saleOrderId);
//// List<MesSaleOrderRelate> mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate);
//
// MesSaleOrderRelate mesSaleOrderRelate = new MesSaleOrderRelate();
// mesSaleOrderRelate.setRelateSaleOrderId(saleOrderId);
// mesSaleOrderRelate.setRelateSaleOrderAmout(barcodeAmount);
// mesSaleOrderRelate.setPurchaseOrderId(purchaseOrderId);
// mesSaleOrderRelate.setPlanDeliveryDate(saleOrder.getPlanDeliveryDate());
//
// toInsertSaleOrderRelates.add(mesSaleOrderRelate);
//
// filterMob.setBarcodeAmount(filterMob.getBindAmount());
// filterMob.setUpdateTime(currentDate);
// filterMob.setUpdateBy(userName);
//
// mesOrderBindMapper.updateMesOrderBind(filterMob);
// });
//
//
////
// }
//
//
// //新建虚拟物料
// String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode);
// Long materialId = this.insertNewVirtualMaterial(barcodeInfo, userName, currentDate);
//
// //创建虚拟销售订单,保存对应的销售订单列表
// BigDecimal sumOrderAmount =
// toInsertSaleOrderRelates.stream()
// .map(MesSaleOrderRelate::getRelateSaleOrderAmout)
// .reduce(BigDecimal.ZERO, BigDecimal::add);
// MesSaleOrder virtualSaleOrder = this.insertNewVirtualSaleOrder(materialId, barcodeInfo,sumOrderAmount, toInsertSaleOrderRelates, userName, currentDate);
//
//
// //生成条码
// String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
// mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
// MesBaseBarcodeInfo toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, barcodeInfo, batchCode, userName, currentDate);
// toInsertedBarcodeInfo.setPurchaseOrderId(0L);
// toInsertedBarcodeInfo.setMaterialId(materialId);
// toInsertedBarcodeInfo.setSaleOrderId(virtualSaleOrder.getSaleOrderId());
// toInsertedBarcodeInfo.setSaleorderCode(virtualSaleOrder.getSaleorderCode());
// toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
// toInsertedBarcodeInfo.setBarcodeSpec(materialCodes.toString());
//
// mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
//
// //更新warehouse配置
//
// return 1;
// }
}

@ -9,11 +9,8 @@ import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import com.hw.mes.mapper.MesOrderBindMapper;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBaseMaterialInfoMapper;

@ -1,11 +1,13 @@
package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesOrderBindMapper;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.service.IMesOrderBindService;
/**
@ -15,8 +17,7 @@ import com.hw.mes.service.IMesOrderBindService;
* @date 2024-05-16
*/
@Service
public class MesOrderBindServiceImpl implements IMesOrderBindService
{
public class MesOrderBindServiceImpl implements IMesOrderBindService {
@Autowired
private MesOrderBindMapper mesOrderBindMapper;
@ -27,8 +28,7 @@ public class MesOrderBindServiceImpl implements IMesOrderBindService
* @return
*/
@Override
public MesOrderBind selectMesOrderBindByOrderBindId(Long orderBindId)
{
public MesOrderBind selectMesOrderBindByOrderBindId(Long orderBindId) {
return mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
}
@ -39,8 +39,7 @@ public class MesOrderBindServiceImpl implements IMesOrderBindService
* @return
*/
@Override
public List<MesOrderBind> selectMesOrderBindList(MesOrderBind mesOrderBind)
{
public List<MesOrderBind> selectMesOrderBindList(MesOrderBind mesOrderBind) {
return mesOrderBindMapper.selectMesOrderBindList(mesOrderBind);
}
@ -51,8 +50,7 @@ public class MesOrderBindServiceImpl implements IMesOrderBindService
* @return
*/
@Override
public int insertMesOrderBind(MesOrderBind mesOrderBind)
{
public int insertMesOrderBind(MesOrderBind mesOrderBind) {
mesOrderBind.setCreateTime(DateUtils.getNowDate());
return mesOrderBindMapper.insertMesOrderBind(mesOrderBind);
}
@ -64,8 +62,7 @@ public class MesOrderBindServiceImpl implements IMesOrderBindService
* @return
*/
@Override
public int updateMesOrderBind(MesOrderBind mesOrderBind)
{
public int updateMesOrderBind(MesOrderBind mesOrderBind) {
mesOrderBind.setUpdateTime(DateUtils.getNowDate());
return mesOrderBindMapper.updateMesOrderBind(mesOrderBind);
}
@ -77,8 +74,7 @@ public class MesOrderBindServiceImpl implements IMesOrderBindService
* @return
*/
@Override
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds)
{
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds) {
return mesOrderBindMapper.deleteMesOrderBindByOrderBindIds(orderBindIds);
}
@ -89,8 +85,23 @@ public class MesOrderBindServiceImpl implements IMesOrderBindService
* @return
*/
@Override
public int deleteMesOrderBindByOrderBindId(Long orderBindId)
{
public int deleteMesOrderBindByOrderBindId(Long orderBindId) {
return mesOrderBindMapper.deleteMesOrderBindByOrderBindId(orderBindId);
}
/**
* ,Join material
*
* @param mesOrderBind
* @return
*/
@Override
public List<MesOrderBind> selectMesOrderBindJoinList(MesOrderBind mesOrderBind) {
mesOrderBind.setMaterialSpec(StringUtils.isNotEmpty(mesOrderBind.getMaterialSpec())
? mesOrderBind.getMaterialSpec().replaceAll("\\s+", "") : "");
mesOrderBind.setSpecificationParameter(StringUtils.isNotEmpty(mesOrderBind.getSpecificationParameter())
? mesOrderBind.getSpecificationParameter().replaceAll("\\s+", "") : "");
return mesOrderBindMapper.selectMesOrderBindJoinList(mesOrderBind);
}
}

@ -11,11 +11,9 @@ import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.domain.vo.MesOrderBindVo;
import com.hw.mes.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -349,13 +347,13 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
orderBind.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
orderBind.setSaleOrderId(saleOrderId);
orderBind.setSaleOrderCode(saleOrder.getSaleorderCode());
orderBind.setProductId(purchaseOrder.getMaterialId());
orderBind.setProductCode(purchaseOrder.getMaterialCode());
orderBind.setProductName(purchaseOrder.getMaterialName());
orderBind.setProductId(saleOrder.getMaterialId());
orderBind.setProductCode(saleOrder.getMaterialCode());
orderBind.setProductName(saleOrder.getMaterialName());
orderBind.setPurchaseOrderId(purchaseOrderId);
orderBind.setMaterialId(saleOrder.getMaterialId());
orderBind.setMaterialCode(saleOrder.getMaterialCode());
orderBind.setMaterialName(saleOrder.getMaterialName());
orderBind.setMaterialId(purchaseOrder.getMaterialId());
orderBind.setMaterialCode(purchaseOrder.getMaterialCode());
orderBind.setMaterialName(purchaseOrder.getMaterialName());
orderBind.setBindAmount(purchaseOrder.getUpdateAmount());
orderBind.setPoNo(purchaseOrder.getPoNo());
orderBind.setCreateTime(currentDate);

@ -27,6 +27,7 @@
<result property="createOrgId" column="create_org_id"/>
<result property="useOrgId" column="use_org_id"/>
<result property="prodlineId" column="prodline_id"/>
<result property="materialClassfication" column="material_classfication"/>
<result property="activeFlag" column="active_flag"/>
<result property="deletedFlag" column="deleted_flag"/>
<result property="remark" column="remark"/>
@ -65,6 +66,7 @@
bmi.create_org_id,
bmi.purchase_price_unit_id,
bmi.use_org_id,
bmi.material_classfication,
bmi.prodline_id,
bmi.active_flag,
bmi.deleted_flag,
@ -146,6 +148,7 @@
<if test="createOrgId != null">create_org_id,</if>
<if test="useOrgId != null">use_org_id,</if>
<if test="prodlineId != null">prodline_id,</if>
<if test="materialClassfication != null and materialClassfication != ''">material_classfication,</if>
<if test="activeFlag != null">active_flag,</if>
<if test="deletedFlag != null">deleted_flag,</if>
<if test="remark != null">remark,</if>
@ -175,6 +178,8 @@
<if test="createOrgId != null">#{createOrgId},</if>
<if test="useOrgId != null">#{useOrgId},</if>
<if test="prodlineId != null">#{prodlineId},</if>
<if test="materialClassfication != null and materialClassfication != ''">#{materialClassfication},</if>
<if test="activeFlag != null">#{activeFlag},</if>
<if test="deletedFlag != null">#{deletedFlag},</if>
<if test="remark != null">#{remark},</if>

@ -8,6 +8,8 @@
<result property="materialBomId" column="material_bom_id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="materialClassfication" column="material_classfication"/>
<result property="erpMaterialId" column="erp_material_id"/>
<result property="materialId" column="material_id"/>
<result property="materialName" column="material_name"/>
<result property="standardAmount" column="standard_amount"/>
@ -32,6 +34,8 @@
select material_bom_id,
parent_id,
ancestors,
material_classfication,
erp_material_id,
material_id,
material_name,
material_bom_desc,
@ -56,6 +60,7 @@
<if test="parentId != null ">and parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''">and ancestors like concat('%', #{ancestors},'%')</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
<if test="erpMaterialId != null ">and erp_material_id = #{erpMaterialId}</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
'%')
</if>
@ -80,6 +85,8 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="materialClassfication != null and materialClassfication != ''">material_classfication,</if>
<if test="erpMaterialId != null">erp_material_id,</if>
<if test="materialId != null">material_id,</if>
<if test="materialName != null">material_name,</if>
<if test="materialBomDesc != null">material_bom_desc,</if>
@ -98,6 +105,8 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="materialClassfication != null and materialClassfication != ''">#{materialClassfication},</if>
<if test="erpMaterialId != null">#{erpMaterialId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialBomDesc != null">#{materialBomDesc},</if>

@ -24,6 +24,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="productSpec" column="product_spec" />
<result property="materialSpec" column="material_spec" />
<result property="specificationParameter" column="specification_parameter" />
<result property="saleOrderAmount" column="order_amount" />
</resultMap>
<sql id="selectMesOrderBindVo">
@ -130,4 +135,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{orderBindId}
</foreach>
</delete>
<select id="selectMesOrderBindJoinList" parameterType="MesOrderBind" resultMap="MesOrderBindResult">
select mob.order_bind_id, mob.safe_flag, mob.sale_order_id, mob.sale_order_code,
mob.purchase_order_id, mob.po_no, mob.bind_amount, mob.barcode_amount,
mob.product_id,pbmi.material_code as product_code,pbmi.material_name as product_name,pbmi.material_spec as product_spec,
mob.material_id,mbmi.material_code,mbmi.material_name,mbmi.material_spec,mso.specification_parameter,
mso.order_amount
from mes_order_bind mob left join mes_base_material_info pbmi on mob.product_id=pbmi.material_id
left join mes_base_material_info mbmi on mob.material_id=mbmi.material_id
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id
<where>
<if test="mergeFlag != null and mergeFlag != ''"> and mob.bind_amount=1 and mob.barcode_amount=0 and mso.order_amount=1</if>
<if test="singleFlag != null and singleFlag != ''"> and mob.bind_amount &gt; mob.barcode_amount</if>
<if test="safeFlag != null and safeFlag != ''"> and mob.safe_flag = #{safeFlag}</if>
<if test="saleOrderCode != null and saleOrderCode != ''"> and mob.sale_order_code like concat('%', #{saleOrderCode}, '%')</if>
<if test="productCode != null and productCode != ''"> and pbmi.product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and pbmi.product_name like concat('%', #{productName}, '%')</if>
<if test="poNo != null and poNo != ''"> and mob.po_no like concat('%', #{poNo}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code = like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if>
<if test="specificationParameter != null and specificationParameter != ''">and replace(mso.specification_parameter,' ','') like concat('%', #{specificationParameter},
'%')</if>
</where>
order by mob.order_bind_id desc
</select>
</mapper>

@ -13,6 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="purchaseOrderClassfication" column="purchase_order_classfication" />
<result property="orderAmount" column="order_amount" />
<result property="completeAmount" column="complete_amount" />
<result property="approveDate" column="approve_date" />
@ -140,6 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialId != null">material_id,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="purchaseOrderClassfication != null">purchase_order_classfication,</if>
<if test="orderAmount != null">order_amount,</if>
<if test="completeAmount != null">complete_amount,</if>
<if test="approveDate != null">approve_date,</if>
@ -164,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialId != null">#{materialId},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="purchaseOrderClassfication != null">#{purchaseOrderClassfication},</if>
<if test="orderAmount != null">#{orderAmount},</if>
<if test="completeAmount != null">#{completeAmount},</if>
<if test="approveDate != null">#{approveDate},</if>
@ -250,7 +253,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mpo.fentry_id,
mpo.po_no,
mpo.document_status,
mpo.material_id,
mpo.material_id as erp_material_id,
mbmi.material_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
@ -330,7 +334,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mob.order_bind_id
from mes_order_bind mob
left join mes_purchase_order mpo on mpo.purchase_order_id = mob.purchase_order_id
left join mes_base_material_info mbmi on mbmi.material_id = mpo.material_id
left join mes_base_material_info mbmi on mbmi.material_id = mob.material_id
<where>
<if test="saleOrderId != null "> and mob.sale_order_id = #{saleOrderId}</if>
<if test="poNo != null and poNo != ''"> and mpo.po_no = #{poNo}</if>
@ -376,6 +380,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="specificationParameter != null and specificationParameter != ''"> and mpo.specification_parameter like concat('%', #{specificationParameter}, '%')</if>
<if test="materialSpec != null and materialSpec != ''"> and mbmi.material_spec like concat('%', #{materialSpec}, '%')</if>
<if test="purchaseOrderId != null "> and mpo.purchase_order_id = #{purchaseOrderId}</if>
</where>
order by mpo.erp_modify_date desc,mpo.po_no ,mpo.material_name
</select>

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesPurchaseOrderRelateMapper">
<resultMap type="MesPurchaseOrderRelate" id="MesPurchaseOrderRelateResult">
<result property="purchaseOrderRelateId" column="purchase_order_relate_id" />
<result property="purchaseOrderId" column="purchase_order_id" />
<result property="relatePurchaseOrderId" column="relate_purchase_order_id" />
<result property="relatePurchaseOrderAmount" column="relate_purchase_order_amount" />
</resultMap>
<sql id="selectMesPurchaseOrderRelateVo">
select purchase_order_relate_id, purchase_order_id, relate_purchase_order_id, relate_purchase_order_amount from mes_purchase_order_relate
</sql>
<select id="selectMesPurchaseOrderRelateList" parameterType="MesPurchaseOrderRelate" resultMap="MesPurchaseOrderRelateResult">
<include refid="selectMesPurchaseOrderRelateVo"/>
<where>
<if test="purchaseOrderId != null "> and purchase_order_id = #{purchaseOrderId}</if>
<if test="relatePurchaseOrderId != null "> and relate_purchase_order_id = #{relatePurchaseOrderId}</if>
<if test="relatePurchaseOrderAmount != null "> and relate_purchase_order_amount = #{relatePurchaseOrderAmount}</if>
</where>
</select>
<select id="selectMesPurchaseOrderRelateByPurchaseOrderRelateId" parameterType="Long" resultMap="MesPurchaseOrderRelateResult">
<include refid="selectMesPurchaseOrderRelateVo"/>
where purchase_order_relate_id = #{purchaseOrderRelateId}
</select>
<insert id="insertMesPurchaseOrderRelate" parameterType="MesPurchaseOrderRelate" useGeneratedKeys="true" keyProperty="purchaseOrderRelateId">
insert into mes_purchase_order_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="relatePurchaseOrderId != null">relate_purchase_order_id,</if>
<if test="relatePurchaseOrderAmount != null">relate_purchase_order_amount,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseOrderId != null">#{purchaseOrderId},</if>
<if test="relatePurchaseOrderId != null">#{relatePurchaseOrderId},</if>
<if test="relatePurchaseOrderAmount != null">#{relatePurchaseOrderAmount},</if>
</trim>
</insert>
<update id="updateMesPurchaseOrderRelate" parameterType="MesPurchaseOrderRelate">
update mes_purchase_order_relate
<trim prefix="SET" suffixOverrides=",">
<if test="purchaseOrderId != null">purchase_order_id = #{purchaseOrderId},</if>
<if test="relatePurchaseOrderId != null">relate_purchase_order_id = #{relatePurchaseOrderId},</if>
<if test="relatePurchaseOrderAmount != null">relate_purchase_order_amount = #{relatePurchaseOrderAmount},</if>
</trim>
where purchase_order_relate_id = #{purchaseOrderRelateId}
</update>
<delete id="deleteMesPurchaseOrderRelateByPurchaseOrderRelateId" parameterType="Long">
delete from mes_purchase_order_relate where purchase_order_relate_id = #{purchaseOrderRelateId}
</delete>
<delete id="deleteMesPurchaseOrderRelateByPurchaseOrderRelateIds" parameterType="String">
delete from mes_purchase_order_relate where purchase_order_relate_id in
<foreach item="purchaseOrderRelateId" collection="array" open="(" separator="," close=")">
#{purchaseOrderRelateId}
</foreach>
</delete>
<insert id="batchMesPurchaseOrderRelate">
insert into mes_purchase_order_relate( purchase_order_id, relate_purchase_order_id, relate_purchase_order_amount) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.purchaseOrderId}, #{item.relatePurchaseOrderId}, #{item.relatePurchaseOrderAmount})
</foreach>
</insert>
</mapper>

@ -29,6 +29,7 @@
<result property="beginDate" column="begin_date"/>
<result property="endDate" column="end_date"/>
<result property="completeDate" column="complete_date"/>
<result property="saleOrderClassfication" column="sale_order_classfication"/>
<result property="isFlag" column="is_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
@ -54,6 +55,7 @@
material_name,
material_model,
matkl,
sale_order_classfication,
order_amount,
complete_amount,
release_qty,
@ -127,6 +129,7 @@
<if test="orderAmount != null">order_amount,</if>
<if test="completeAmount != null">complete_amount,</if>
<if test="releaseQty != null">release_qty,</if>
<if test="saleOrderClassfication != null">sale_order_classfication,</if>
<if test="isRelease != null">is_release,</if>
<if test="approveDate != null">approve_date,</if>
<if test="erpModifyDate != null">erp_modify_date,</if>
@ -156,6 +159,7 @@
<if test="orderAmount != null">#{orderAmount},</if>
<if test="completeAmount != null">#{completeAmount},</if>
<if test="releaseQty != null">#{releaseQty},</if>
<if test="saleOrderClassfication != null">#{saleOrderClassfication},</if>
<if test="isRelease != null">#{isRelease},</if>
<if test="approveDate != null">#{approveDate},</if>
<if test="erpModifyDate != null">#{erpModifyDate},</if>
@ -264,4 +268,5 @@
order by mso.erp_modify_date desc
</select>
</mapper>

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesSaleOrderRelateMapper">
<resultMap type="MesSaleOrderRelate" id="MesSaleOrderRelateResult">
<result property="saleOrderRelateId" column="sale_order_relate_id" />
<result property="saleOrderId" column="sale_order_id" />
<result property="barcodeInfo" column="barcode_info" />
<result property="orderBindId" column="order_bind_id" />
<result property="relateSaleOrderId" column="relate_sale_order_id" />
<result property="materialId" column="material_id" />
<result property="purchaseOrderId" column="purchase_order_id" />
<result property="relateSaleOrderAmount" column="relate_sale_order_amount" />
</resultMap>
<sql id="selectMesSaleOrderRelateVo">
select sale_order_relate_id, sale_order_id,barcode_info, order_bind_id,relate_sale_order_id,material_id, relate_sale_order_amount from mes_sale_order_relate
</sql>
<select id="selectMesSaleOrderRelateList" parameterType="MesSaleOrderRelate" resultMap="MesSaleOrderRelateResult">
<include refid="selectMesSaleOrderRelateVo"/>
<where>
<if test="saleOrderId != null "> and sale_order_id = #{saleOrderId}</if>
<if test="relateSaleOrderId != null "> and relate_sale_order_id = #{relateSaleOrderId}</if>
<if test="relateSaleOrderAmount != null "> and relate_sale_order_amount = #{relateSaleOrderAmount}</if>
</where>
</select>
<select id="selectMesSaleOrderRelateBySaleOrderRelateId" parameterType="Long" resultMap="MesSaleOrderRelateResult">
<include refid="selectMesSaleOrderRelateVo"/>
where sale_order_relate_id = #{saleOrderRelateId}
</select>
<insert id="insertMesSaleOrderRelate" parameterType="MesSaleOrderRelate" useGeneratedKeys="true" keyProperty="saleOrderRelateId">
insert into mes_sale_order_relate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="saleOrderId != null">sale_order_id,</if>
<if test="barcodeInfo != null">barcode_info,</if>
<if test="orderBindId != null">order_bind_id,</if>
<if test="relateSaleOrderId != null">relate_sale_order_id,</if>
<if test="materialId != null">material_id,</if>
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="relateSaleOrderAmount != null">relate_sale_order_amount,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="saleOrderId != null">#{saleOrderId},</if>
<if test="barcodeInfo != null">#{barcodeInfo},</if>
<if test="orderBindId != null">#{orderBindId},</if>
<if test="relateSaleOrderId != null">#{relateSaleOrderId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="purchaseOrderId != null">#{purchaseOrderId},</if>
<if test="relateSaleOrderAmount != null">#{relateSaleOrderAmount},</if>
</trim>
</insert>
<update id="updateMesSaleOrderRelate" parameterType="MesSaleOrderRelate">
update mes_sale_order_relate
<trim prefix="SET" suffixOverrides=",">
<if test="saleOrderId != null">sale_order_id = #{saleOrderId},</if>
<if test="relateSaleOrderId != null">relate_sale_order_id = #{relateSaleOrderId},</if>
<if test="relateSaleOrderAmount != null">relate_sale_order_amount = #{relateSaleOrderAmount},</if>
</trim>
where sale_order_relate_id = #{saleOrderRelateId}
</update>
<delete id="deleteMesSaleOrderRelateBySaleOrderRelateId" parameterType="Long">
delete from mes_sale_order_relate where sale_order_relate_id = #{saleOrderRelateId}
</delete>
<delete id="deleteMesSaleOrderRelateBySaleOrderRelateIds" parameterType="String">
delete from mes_sale_order_relate where sale_order_relate_id in
<foreach item="saleOrderRelateId" collection="array" open="(" separator="," close=")">
#{saleOrderRelateId}
</foreach>
</delete>
<insert id="batchMesSaleOrderRelate">
insert into mes_sale_order_relate( sale_order_id, barcode_info,order_bind_id,relate_sale_order_id,material_id, purchase_order_id,relate_sale_order_amount) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.saleOrderId}, #{item.barcodeInfo}, #{item.orderBindId}, #{item.relateSaleOrderId}, #{item.materialId},#{item.purchaseOrderId}, #{item.relateSaleOrderAmount})
</foreach>
</insert>
</mapper>

@ -28,6 +28,11 @@ public class WmsConfig {
*/
private Long fifthSemiWarehouseId;
/**
* ID
*/
private Long fifthCabinetWarehouseId;
/**
* ID
*/
@ -82,6 +87,14 @@ public class WmsConfig {
this.fifthSemiWarehouseId = fifthSemiWarehouseId;
}
public Long getFifthCabinetWarehouseId() {
return fifthCabinetWarehouseId;
}
public void setFifthCabinetWarehouseId(Long fifthCabinetWarehouseId) {
this.fifthCabinetWarehouseId = fifthCabinetWarehouseId;
}
public Long getFirstFloorProductWarehouseId() {
return firstFloorProductWarehouseId;
}

@ -4,8 +4,12 @@ import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.domain.R;
import com.hw.common.security.annotation.InnerAuth;
import com.hw.wms.domain.WmsBaseCategory;
import com.hw.wms.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.domain.vo.WmsWarehouseMaterialCheckFormVo;
import com.hw.wms.domain.vo.WmsWarehouseMaterialCheckVo;
import com.hw.wms.service.IWmsBaseCategoryService;
import com.hw.wms.service.IWmsWarehouseMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
@ -152,6 +156,25 @@ public class WmsBaseWarehouseController extends BaseController {
return toAjax(wmsWarehouseMaterialService.deleteWmsWarehouseMaterialByWarehouseMaterialIds(warehouseMaterialIds));
}
/**
*
*/
@PostMapping("/checkWarehouseMaterials")
public AjaxResult checkWarehouseMaterials(@RequestBody List<WmsWarehouseMaterialCheckVo> wmsWarehouseMaterialCheckVos) {
return toAjax(wmsWarehouseMaterialService.checkWarehouseMaterials(wmsWarehouseMaterialCheckVos));
}
@Log(title = "仓库管理", businessType = BusinessType.ALLOCATE)
@PostMapping("/allocateVirtualMaterial")
@InnerAuth
public R<Boolean> allocateVirtualMaterial(@RequestBody WmsWarehouseMaterial wmsWarehouseMaterial) {
boolean isSuccess = wmsWarehouseMaterialService.insertWmsWarehouseMaterial(wmsWarehouseMaterial) > 0;
return R.ok(isSuccess);
}
// /**
// * 根据仓库分配可入库物料信息

@ -48,6 +48,8 @@ public class WmsBaseLocation extends BaseEntity
@Excel(name = "列")
private Long locColumn;
private Long locDeep;
/** 激活标记 1是 0否 */
@Excel(name = "激活标记 1是 0否")
private String activeFlag;
@ -231,6 +233,15 @@ public class WmsBaseLocation extends BaseEntity
{
return locColumn;
}
public Long getLocDeep() {
return locDeep;
}
public void setLocDeep(Long locDeep) {
this.locDeep = locDeep;
}
public void setActiveFlag(String activeFlag)
{
this.activeFlag = activeFlag;

@ -1,119 +1,119 @@
package com.hw.wms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* wms_warehouse_material
*
* @author xins
* @date 2024-01-09
*/
public class WmsWarehouseMaterial extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long warehouseMaterialId;
/** 仓库ID */
private Long warehouseId;
private Integer warehouseFloor;
/** 库位编码;单独需要针对库位设置的,后续扩展使用 */
private String locationCode;
/** 存储类型(1、物料2、物料类型);先支持物料 */
private String storageType;
/** 根据存储类型对应各自表的主键 */
private Long storageId;
private String materialCode;
private String materialName;
public Long getWarehouseMaterialId() {
return warehouseMaterialId;
}
public void setWarehouseMaterialId(Long warehouseMaterialId) {
this.warehouseMaterialId = warehouseMaterialId;
}
public void setWarehouseId(Long warehouseId)
{
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
{
return warehouseId;
}
public Integer getWarehouseFloor() {
return warehouseFloor;
}
public void setWarehouseFloor(Integer warehouseFloor) {
this.warehouseFloor = warehouseFloor;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setStorageType(String storageType)
{
this.storageType = storageType;
}
public String getStorageType()
{
return storageType;
}
public void setStorageId(Long storageId)
{
this.storageId = storageId;
}
public Long getStorageId()
{
return storageId;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("warehouseId", getWarehouseId())
.append("locationCode", getLocationCode())
.append("storageType", getStorageType())
.append("storageId", getStorageId())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.toString();
}
}
//package com.hw.wms.domain;
//
//import org.apache.commons.lang3.builder.ToStringBuilder;
//import org.apache.commons.lang3.builder.ToStringStyle;
//import com.hw.common.core.annotation.Excel;
//import com.hw.common.core.web.domain.BaseEntity;
//
///**
// * 仓库可储存物料信息对象 wms_warehouse_material
// *
// * @author xins
// * @date 2024-01-09
// */
//public class WmsWarehouseMaterial extends BaseEntity
//{
// private static final long serialVersionUID = 1L;
//
// private Long warehouseMaterialId;
//
// /** 仓库ID */
// private Long warehouseId;
//
// private Integer warehouseFloor;
//
// /** 库位编码;单独需要针对库位设置的,后续扩展使用 */
// private String locationCode;
//
// /** 存储类型(1、物料2、物料类型);先支持物料 */
// private String storageType;
//
// /** 根据存储类型对应各自表的主键 */
// private Long storageId;
//
// private String materialCode;
//
// private String materialName;
//
// public Long getWarehouseMaterialId() {
// return warehouseMaterialId;
// }
//
// public void setWarehouseMaterialId(Long warehouseMaterialId) {
// this.warehouseMaterialId = warehouseMaterialId;
// }
//
// public void setWarehouseId(Long warehouseId)
// {
// this.warehouseId = warehouseId;
// }
//
// public Long getWarehouseId()
// {
// return warehouseId;
// }
//
// public Integer getWarehouseFloor() {
// return warehouseFloor;
// }
//
// public void setWarehouseFloor(Integer warehouseFloor) {
// this.warehouseFloor = warehouseFloor;
// }
//
// public void setLocationCode(String locationCode)
// {
// this.locationCode = locationCode;
// }
//
// public String getLocationCode()
// {
// return locationCode;
// }
// public void setStorageType(String storageType)
// {
// this.storageType = storageType;
// }
//
// public String getStorageType()
// {
// return storageType;
// }
// public void setStorageId(Long storageId)
// {
// this.storageId = storageId;
// }
//
// public Long getStorageId()
// {
// return storageId;
// }
//
// public String getMaterialCode() {
// return materialCode;
// }
//
// public void setMaterialCode(String materialCode) {
// this.materialCode = materialCode;
// }
//
// public String getMaterialName() {
// return materialName;
// }
//
// public void setMaterialName(String materialName) {
// this.materialName = materialName;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
// .append("warehouseId", getWarehouseId())
// .append("locationCode", getLocationCode())
// .append("storageType", getStorageType())
// .append("storageId", getStorageId())
// .append("createTime", getCreateTime())
// .append("createBy", getCreateBy())
// .toString();
// }
//}

@ -0,0 +1,23 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @Description: VO from
* @ClassName: WmsWarehouseMaterialCheckVo
* @Author : xins
* @Date :2024-09-10 18:17
* @Version :1.0
*/
@Data
public class WmsWarehouseMaterialCheckFormVo {
private String flag;
private List<WmsWarehouseMaterialCheckVo> wmsWarehouseMaterialCheckVos;
}

@ -0,0 +1,33 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @Description: VO
* @ClassName: WmsWarehouseMaterialCheckVo
* @Author : xins
* @Date :2024-03-29 11:27
* @Version :1.0
*/
@Data
public class WmsWarehouseMaterialCheckVo {
//物料ID
// @NotNull(message="materialId必须输入")
private Long materialId;
// @NotEmpty(message="物料编码必须输入")
private String materialCode;
// @NotEmpty(message="物料名称必须输入")
private String materialName;
private String materialSpec;
// @NotNull(message="序号必须输入")
// private int index;
}

@ -2,7 +2,7 @@ package com.hw.wms.mapper;
import java.util.List;
import com.hw.wms.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
/**
* Mapper

@ -1,7 +1,8 @@
package com.hw.wms.service;
import java.util.List;
import com.hw.wms.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.domain.vo.WmsWarehouseMaterialCheckVo;
/**
* Service
@ -76,4 +77,13 @@ public interface IWmsWarehouseMaterialService
* @param materialIds
*/
public void batchInsertWarehouseMaterial(Long warehouseId, Integer warehouseFloor, Long[] materialIds);
/**
*
*
* @param wmsWarehouseMaterialCheckVos VO
* @return
*/
public int checkWarehouseMaterials(List<WmsWarehouseMaterialCheckVo> wmsWarehouseMaterialCheckVos);
}

@ -164,7 +164,7 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
if (locationStatus.equals(WmsLocationStatus.NORMAL.getCode())) {
return 1;
}
if (!locationStatus.equals(WmsLocationStatus.MANUALLOCK.getCode())) {
if (!locationStatus.equals(WmsLocationStatus.MANUALLOCK.getCode()) && !locationStatus.equals(WmsLocationStatus.OUTSIDELOCATIONABNORMAL.getCode())) {
throw new ServiceException("库位状态为" + WmsLocationStatus.locationStatusMap.get(locationStatus) + ",不能解锁");
}

@ -713,7 +713,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
}
/**
* AGV
* AGV
*
* @param wmsAgvRawOutstockVo
* @return
@ -868,7 +868,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
rawOutstockDetail.setLocationCode(oriBaseLocation.getLocationCode());
rawOutstockDetail.setMaterialBarcode(moveMaterialBarcode);
rawOutstockDetail.setMaterialId(moveMaterialId);
rawOutstockDetail.setPlanAmount(new BigDecimal(1));//todo agv数量默认1
rawOutstockDetail.setPlanAmount(new BigDecimal(1));
rawOutstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
rawOutstockDetail.setOutstockWay(WmsConstants.WMS_STOCK_WAY_AGV);
wmsRawOutstockDetailMapper.insertWmsRawOutstockDetail(rawOutstockDetail);
@ -898,7 +898,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
// rawInstockDetail.setLocationCode(targetBaseLocation.getLocationCode());
// rawInstockDetail.setMaterialBarcode(moveMaterialBarcode);
// rawInstockDetail.setMaterialId(moveMaterialId);
// rawInstockDetail.setPlanAmount(new BigDecimal(1));//todo agv数量默认1
// rawInstockDetail.setPlanAmount(new BigDecimal(1));
// rawInstockDetail.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
// rawInstockDetail.setInstockWay(WmsConstants.WMS_STOCK_WAY_AGV);
// wmsRawInstockDetailMapper.insertWmsRawInstockDetail(rawInstockDetail);

@ -5,13 +5,16 @@ import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.wms.config.WmsConfig;
import com.hw.wms.domain.vo.WmsWarehouseMaterialCheckVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsWarehouseMaterialMapper;
import com.hw.wms.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.service.IWmsWarehouseMaterialService;
/**
@ -25,6 +28,9 @@ public class WmsWarehouseMaterialServiceImpl implements IWmsWarehouseMaterialSer
@Autowired
private WmsWarehouseMaterialMapper wmsWarehouseMaterialMapper;
@Autowired
private WmsConfig wmsConfig;
/**
*
*
@ -56,6 +62,7 @@ public class WmsWarehouseMaterialServiceImpl implements IWmsWarehouseMaterialSer
@Override
public int insertWmsWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial) {
wmsWarehouseMaterial.setCreateTime(DateUtils.getNowDate());
wmsWarehouseMaterial.setCreateBy(SecurityUtils.getUsername());
return wmsWarehouseMaterialMapper.insertWmsWarehouseMaterial(wmsWarehouseMaterial);
}
@ -133,4 +140,44 @@ public class WmsWarehouseMaterialServiceImpl implements IWmsWarehouseMaterialSer
}
/**
*
*
* @param wmsWarehouseMaterialCheckVos VO
* @return
*/
@Override
public int checkWarehouseMaterials(List<WmsWarehouseMaterialCheckVo> wmsWarehouseMaterialCheckVos) {
StringBuilder errorMsgBuilder = new StringBuilder();
wmsWarehouseMaterialCheckVos.forEach(wmcv -> {
WmsWarehouseMaterial queryWarehouseMaterial = new WmsWarehouseMaterial();
queryWarehouseMaterial.setStorageId(wmcv.getMaterialId());
queryWarehouseMaterial.setStorageType(WmsConstants.WMS_WAREHOUSE_MATERIAL_STORAGE_TYPE_MATERIAL);
List<WmsWarehouseMaterial> wmsWarehouseMaterials = wmsWarehouseMaterialMapper.selectWmsWarehouseMaterialList(queryWarehouseMaterial);
if (wmsWarehouseMaterials == null || wmsWarehouseMaterials.isEmpty()) {
errorMsgBuilder.append("没有配置仓库信息['").append(",物料编码:").append(wmcv.getMaterialCode())
.append(",物料名称:").append(wmcv.getMaterialName()).append(",物料规格:").append(wmcv.getMaterialSpec())
.append("];");
}else{
WmsWarehouseMaterial wmsWarehouseMaterial = wmsWarehouseMaterials.get(0);
Long warehouseId = wmsWarehouseMaterial.getWarehouseId();
if(!warehouseId.equals(wmsConfig.getFifthCabinetWarehouseId())){
errorMsgBuilder.append("仓库信息配置不正确['").append(",物料编码:").append(wmcv.getMaterialCode())
.append(",物料名称:").append(wmcv.getMaterialName()).append(",物料规格:").append(wmcv.getMaterialSpec())
.append("];");
}
}
});
if (errorMsgBuilder.length() > 0) {
throw new ServiceException(errorMsgBuilder.toString());
}
return 1;
}
}

@ -15,6 +15,7 @@
<result property="locRow" column="loc_row" />
<result property="layerNum" column="layer_num" />
<result property="locColumn" column="loc_column" />
<result property="locDeep" column="loc_deep" />
<result property="activeFlag" column="active_flag" />
<result property="manualFlag" column="manual_flag" />
<result property="qtyLimit" column="qty_limit" />
@ -244,7 +245,8 @@
<select id="selectWmsBaseLocationJoinList" parameterType="WmsBaseLocation" resultMap="WmsBaseLocationResult">
select wbl.location_id, wbl.warehouse_id,wbl.agv_position_code, wbl.location_code,wbl.container_code, wbl.loc_row, wbl.layer_num, wbl.loc_column, wbl.active_flag, wbl.manual_flag,
select wbl.location_id, wbl.warehouse_id,wbl.agv_position_code, wbl.location_code,wbl.container_code,
wbl.loc_row, wbl.layer_num, wbl.loc_column, wbl.loc_deep,wbl.active_flag, wbl.manual_flag,
wbl.qty_limit, wbl.instock_flag, wbl.outstock_flag, wbl.location_status, wbl.remark,wbw.warehouse_name
from wms_base_location wbl left join wms_base_warehouse wbw on wbl.warehouse_id = wbw.warehouse_id
@ -253,6 +255,7 @@
<if test="locationCode != null and locationCode != ''"> and wbl.location_code = #{locationCode}</if>
<if test="locRow != null "> and wbl.loc_row = #{locRow}</if>
<if test="layerNum != null "> and wbl.layer_num = #{layerNum}</if>
<if test="locDeep != null "> and wbl.loc_deep = #{locDeep}</if>
<if test="locColumn != null "> and wbl.loc_column = #{locColumn}</if>
<if test="activeFlag != null and activeFlag != ''"> and wbl.active_flag = #{activeFlag}</if>
<if test="manualFlag != null and manualFlag != ''"> and wbl.manual_flag = #{manualFlag}</if>

@ -259,7 +259,7 @@
<where>
<if test="warehouseInstockType != null and warehouseInstockType != ''"> and warehouse_instock_type = #{warehouseInstockType}</if>
<if test="warehouseType != null and warehouseType != ''"> and warehouse_type = #{warehouseType}</if>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code like concat('%', #{warehouseCode}, '%')</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="warehouseCategoryId != null "> and warehouse_category_id = #{warehouseCategoryId}</if>
<if test="warehouseFloor != null "> and warehouse_floor = #{warehouseFloor}</if>

@ -24,6 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWmsWarehouseMaterialList" parameterType="WmsWarehouseMaterial" resultMap="WmsWarehouseMaterialResult">
<include refid="selectWmsWarehouseMaterialVo"/>
<where>
<if test="storageType != null and storageType != ''"> and storage_type = #{storageType}</if>
<if test="storageId != null "> and storage_id = #{storageId}</if>
</where>
</select>

@ -167,3 +167,13 @@ export function reprintBarcodes(barcodeIds) {
method: 'get'
})
}
// 合并采购订单新增原材料条码信息
export function mergeAddBarcode(data) {
return request({
url: '/mes/barcode/mergeAdd',
method: 'post',
data: data
})
}

@ -127,3 +127,14 @@ export function selectPurchaseOrderBindList(query) {
params: query
})
}
// 获取销售订单已绑定采购订单List,for 新增原材料条码
export function getOrderBinds(query) {
return request({
url: '/mes/purchaseOrder/getOrderBinds',
method: 'get',
params: query
})
}

@ -98,3 +98,13 @@ export function unallocateMaterials(data) {
params: data
})
}
// 校验仓库分配的物料信息列表
export function checkWarehouseMaterials(data) {
return request({
url: '/wms/wmswarehouse/checkWarehouseMaterials',
method: 'post',
data: data
})
}

@ -249,6 +249,10 @@ export default {
this.queryParams.planDetailCode = this.form.planDetailCode;
getStockTotal(this.queryParams).then(e => {
this.total = e.total;
// e.rows.forEach(ee =>{
// alert(parseFloat(ee.totalAmount-ee.occupyAmount).toFixed(2))
// });
this.wmsRawOutstockDetailList = e.rows.map(r => {
return {
stockTotalId: r.stockTotalId,
@ -257,9 +261,9 @@ export default {
materialName: r.materialName,
materialSpec: r.materialSpec,
safeFlag: r.safeFlag,
availableAmount: r.totalAmount - r.occupyAmount - r.frozenAmount,
unavailableAmount: r.occupyAmount + r.frozenAmount,
outstockAmount: r.outstockAmount,
availableAmount: parseFloat(r.totalAmount - r.occupyAmount - r.frozenAmount).toFixed(2),
unavailableAmount: parseFloat(r.occupyAmount + r.frozenAmount).toFixed(2),
outstockAmount: parseFloat(r.outstockAmount ? r.outstockAmount : 0).toFixed(2),
planAmount: this.planAmount
}
})

@ -723,14 +723,14 @@ export default {
// });
// }, 60 * 1000)
getLoginStationInfo().then(e => {
if(!e.data){
this.$modal.msgError("登录工位有误");
return;
}
this.loginStationInfo = e.data;
// if(!e.data){
// this.$modal.msgError("");
// return;
// }
// this.loginStationInfo = e.data;
//TODO
// this.loginStationInfo = {stationId:"1",stationCode:"ZP_02"}
this.loginStationInfo = {stationId:"1",stationCode:"ZP_02"}
this.getProductPlans();
this.getChartData();
});

@ -215,7 +215,8 @@
<el-form-item label="物料条码" prop="materialBarcode">
<el-select v-model="wmsForm.materialBarcode" ref="materialBarcodeRef" placeholder="请扫描或输入物料条码"
style="width:360px">
<el-option v-for="item in locationBarcodeList" :key="item.barcodeInfo" :label="`${item.materialName}(${item.materialSpec})`"
<el-option v-for="item in locationBarcodeList" :key="item.barcodeInfo"
:label="`${item.materialName}(${item.materialSpec})`"
:value="item.barcodeInfo"></el-option>
</el-select>
</el-form-item>
@ -229,7 +230,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitRawStock"> </el-button>
<el-button type="primary" v-loading="submitLoading" @click="submitRawStock"> </el-button>
</div>
</el-dialog>
</div>
@ -252,6 +253,7 @@ import {
} from "@/api/board";
import {monitorSerialData} from "@/utils/serial"
import {addWmslocation, updateWmslocation} from "@/api/wms/wmslocation";
const setState = (e) => {
if (e === '1') {
@ -325,11 +327,13 @@ export default {
},
STOCK_TYPE:{
INSTOCK:"1",//
OUTSTOCK:"2",//
RETURN:"3",//退
}
STOCK_TYPE: {
INSTOCK: "1",//
OUTSTOCK: "2",//
RETURN: "3",//退
},
submitLoading: false
}
},
async mounted() {
@ -999,7 +1003,7 @@ export default {
this.checkConnectSerial();
},
checkConnectSerial(){
checkConnectSerial() {
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
@ -1027,10 +1031,15 @@ export default {
},
submitRawStock() {
this.$refs["wmsForm"].validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.stockType === this.STOCK_TYPE.INSTOCK) {//
addRawInstock(this.wmsForm).then(response => {
this.$modal.msgSuccess("板材入库成功");
this.cancel();
}).finally(e => {
this.submitLoading = false;
});
} else if (this.stockType === this.STOCK_TYPE.OUTSTOCK) {//
this.wmsForm.outstockAmount = this.wmsForm.instockAmount;
@ -1065,7 +1074,7 @@ export default {
//
// });
} else if (this.stockType === this.STOCK_TYPE.RETURN) {//
} else if (this.stockType === this.STOCK_TYPE.RETURN) {//退
this.wmsForm.returnAmount = this.wmsForm.instockAmount;
this.wmsForm.planCode = this.form.planCode;
this.wmsForm.planDetailCode = this.form.planDetailCode;
@ -1076,6 +1085,8 @@ export default {
directRawReturn(this.wmsForm).then(response => {
this.$modal.msgSuccess("板材退库成功");
this.cancel();
}).finally(e => {
this.submitLoading = false;
});
@ -1102,12 +1113,22 @@ export default {
// });
}
}
});
},
directRawOutstock() {
directRawOutstock(this.wmsForm).then(response => {
this.$modal.msgSuccess("板材领取成功");
this.cancel();
}).finally(e => {
this.submitLoading = false;
});
},

@ -67,7 +67,6 @@
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table

@ -121,7 +121,6 @@
v-hasPermi="['dms:checkplan:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="checkplanList" @selection-change="handleSelectionChange">

@ -125,7 +125,6 @@
v-hasPermi="['dms:debugging:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="debuggingList" @selection-change="handleSelectionChange">

@ -114,7 +114,6 @@
v-hasPermi="['dms:dmsBaseInspectProject:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsBaseInspectProjectList" @selection-change="handleSelectionChange">

@ -105,7 +105,6 @@
v-hasPermi="['dms:dmsBaseInspectRoute:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsBaseInspectRouteList" @selection-change="handleSelectionChange">

@ -98,7 +98,6 @@
v-hasPermi="['dms:dmsBaseInspectStandard:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsBaseInspectStandardList" @selection-change="handleSelectionChange">

@ -98,7 +98,6 @@
v-hasPermi="['dms:billslubedetail:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="billslubedetailList" @selection-change="handleSelectionChange">

@ -98,7 +98,6 @@
v-hasPermi="['dms:billsmaintdetail:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="billsmaintdetailList" @selection-change="handleSelectionChange">

@ -113,7 +113,6 @@
v-hasPermi="['dms:dmsInfo:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsInfoList" @selection-change="handleSelectionChange">

@ -123,7 +123,6 @@
<!-- v-hasPermi="['dms:dmsInspectRouteDetail:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsInspectRouteDetailList" @selection-change="handleSelectionChange">

@ -130,7 +130,6 @@
v-hasPermi="['dms:dmsPlanInspect:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsPlanInspectList" @selection-change="handleSelectionChange">

@ -141,7 +141,6 @@
v-hasPermi="['dms:dmsRecordInspect:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsRecordInspectList" @selection-change="handleSelectionChange">

@ -174,7 +174,6 @@
v-hasPermi="['dms:dmsRecordLube:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsRecordLubeList" @selection-change="handleSelectionChange">

@ -123,7 +123,6 @@
v-hasPermi="['dms:dmsRepair:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dmsRepairList" @selection-change="handleSelectionChange">

@ -121,7 +121,7 @@
<!-- v-hasPermi="['dms:dmsRepairDetail:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="dmsRepairDetailList" @selection-change="handleSelectionChange">

@ -128,7 +128,6 @@
v-hasPermi="['dms:info:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">

@ -111,7 +111,6 @@
v-hasPermi="['dms:install:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="installList" @selection-change="handleSelectionChange">

@ -80,7 +80,7 @@
v-hasPermi="['dms:knowledgeLube:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="knowledgeLubeList" @selection-change="handleSelectionChange">

@ -76,7 +76,7 @@
v-hasPermi="['dms:knowledgeRepair:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="knowledgeRepairList" @selection-change="handleSelectionChange">

@ -78,7 +78,7 @@
v-hasPermi="['dms:konwledgeMaint:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="konwledgeMaintList" @selection-change="handleSelectionChange">

@ -166,7 +166,7 @@
v-hasPermi="['dms:ledger:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="ledgerList"

@ -91,7 +91,7 @@
v-hasPermi="['dms:lube:export']"
>导出</el-button>
</el-col-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="lubeList" @selection-change="handleSelectionChange">

@ -90,7 +90,7 @@
v-hasPermi="['dms:lubeStandard:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="lubeStandardList" @selection-change="handleSelectionChange">

@ -124,7 +124,7 @@
v-hasPermi="['dms:maint:export']"
>导出</el-button>
</el-col-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="maintList" @selection-change="handleSelectionChange">

@ -142,7 +142,7 @@
v-hasPermi="['dms:maintDetail:add']"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="maintDetailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />

@ -114,7 +114,7 @@
v-hasPermi="['dms:param:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="paramList" @selection-change="handleSelectionChange">

@ -106,7 +106,7 @@
v-hasPermi="['dms:specialDeviceParam:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="specialDeviceParamList" @selection-change="handleSelectionChange">

@ -98,7 +98,7 @@
v-hasPermi="['dms:standard:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table v-loading="loading" :data="standardList" @selection-change="handleSelectionChange">

@ -91,7 +91,6 @@
v-hasPermi="['dms:station:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="stationList" @selection-change="handleSelectionChange">

@ -83,7 +83,7 @@
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>-->
</el-row>
<!-- 用户表格 -->
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">

@ -122,11 +122,11 @@
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
:columns="columns"
></right-toolbar>
<!-- <right-toolbar-->
<!-- :showSearch.sync="showSearch"-->
<!-- @queryTable="getList"-->
<!-- :columns="columns"-->
<!-- ></right-toolbar>-->
</el-row>
<!-- 用户表格 -->
<el-table

@ -91,11 +91,11 @@
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
:columns="columns"
></right-toolbar>
<!-- <right-toolbar-->
<!-- :showSearch.sync="showSearch"-->
<!-- @queryTable="getList"-->
<!-- :columns="columns"-->
<!-- ></right-toolbar>-->
</el-row>
<el-table

@ -83,10 +83,10 @@
</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
<!-- <right-toolbar-->
<!-- :showSearch.sync="showSearch"-->
<!-- @queryTable="getList"-->
<!-- ></right-toolbar>-->
</el-row>
<el-table

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save