新火炬后端单体项目初始化代码
zhangherong
11 小时以前 99af0223ae0858c69d1b75106d5f8bb0ab14b129
art: 移库单回调出库逻辑添加
已添加2个文件
已修改10个文件
280 ■■■■ 文件已修改
db/双林新火炬MES数据库设计.pdma.json 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/service/ILswMaterialOutboundService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/entity/MesTransferOrderPrint.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/enums/TransferOrderStatusEnum.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/service/IMesTransferOrderPrintService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/service/impl/MesTransferOrderPrintServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/request/WMSWebServiceSendItem.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java 97 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-prod.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
db/Ë«ÁÖлð¾æMESÊý¾Ý¿âÉè¼Æ.pdma.json
@@ -4,7 +4,7 @@
  "avatar": "",
  "version": "4.9.2",
  "createdTime": "2025-3-10 16:38:19",
  "updatedTime": "2025-8-20 15:14:16",
  "updatedTime": "2025-8-27 16:35:43",
  "dbConns": [],
  "profile": {
    "default": {
@@ -632,7 +632,7 @@
      "#DDE5FF"
    ],
    "DDLToggleCase": "L",
    "menuWidth": "304px"
    "menuWidth": "331px"
  },
  "entities": [
    {
@@ -62650,6 +62650,42 @@
          "id": "9056CBAC-AC31-46AC-802D-7ECC455F7834"
        },
        {
          "defKey": "inventory_id",
          "defName": "库存ID",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": "",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
          "id": "F0CCB50E-95F3-4D54-BE72-846BDAD32511"
        },
        {
          "defKey": "warehouse_id",
          "defName": "库存地",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": "",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
          "id": "3892DFB2-BCFA-413E-9930-4B88E5C8EFE8"
        },
        {
          "defKey": "batch_number",
          "defName": "批次号",
          "comment": "",
@@ -62730,24 +62766,6 @@
          "extProps": {},
          "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4",
          "id": "5B833F2B-D8C6-478D-B830-604D2CC6AAF0"
        },
        {
          "defKey": "work_order_id",
          "defName": "工单ID",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": "",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
          "id": "8D4EEF04-86ED-455F-A843-E9CAADBA042C"
        }
      ],
      "correlations": [],
@@ -64290,8 +64308,8 @@
          "id": "144B6087-1070-4007-9882-2A64F8AAAD91"
        },
        {
          "defKey": "order_category",
          "defName": "移库类型",
          "defKey": "inventory_id",
          "defName": "库存ID",
          "comment": "",
          "type": "",
          "len": "",
@@ -64304,8 +64322,8 @@
          "refDict": "",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792",
          "id": "EB0DE062-AF2C-4401-8773-663BBDB65F84"
          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
          "id": "F0B826E3-51CF-4FA3-A239-95CFBAA64184"
        },
        {
          "defKey": "original_warehouse_id",
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java
@@ -15,6 +15,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
@@ -31,7 +32,7 @@
public class LswMaterialOutbound implements Serializable {
    private static final long serialVersionUID = 1L;
    /**主键*/
    /**主键*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
@@ -69,6 +70,14 @@
    @ApiModelProperty(value = "产线ID")
    @Dict(dictTable = "base_factory", dicCode = "id", dicText = "factory_name")
    private String factoryId;
    /**库存ID*/
    @Excel(name = "库存ID", width = 15)
    @ApiModelProperty(value = "库存ID")
    private String inventoryId;
    /**线边库ID*/
    @Excel(name = "线边库ID", width = 15)
    @ApiModelProperty(value = "线边库ID")
    private String warehouseId;
    /**批次号*/
    @Excel(name = "批次号", width = 15)
    @ApiModelProperty(value = "批次号")
@@ -86,9 +95,5 @@
    /**出库数量*/
    @Excel(name = "出库数量", width = 15)
    @ApiModelProperty(value = "出库数量")
    private Double quantity;
    /**工单ID*/
    @Excel(name = "工单ID", width = 15)
    @ApiModelProperty(value = "工单ID")
    private String workOrderId;
    private BigDecimal quantity;
}
src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
package org.jeecg.modules.lsw.enums;
public enum MaterialInventoryCategoryEnum {
    INBOUND, //入库
    UNLOADING, //下料
    ;
}
src/main/java/org/jeecg/modules/lsw/service/ILswMaterialOutboundService.java
@@ -15,4 +15,11 @@
 */
public interface ILswMaterialOutboundService extends IService<LswMaterialOutbound> {
    IPage<Map<String, Object>> getlswMaterialOutboundListData(Integer pageNo, Integer pageSize, HttpServletRequest req);
    /**
     * ç‰©æ–™å‡ºåº“
     * @param outbound
     * @return
     */
    boolean outboundMaterial(LswMaterialOutbound outbound);
}
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java
@@ -4,23 +4,37 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.lsw.entity.LswMaterial;
import org.jeecg.modules.lsw.entity.LswMaterialInventory;
import org.jeecg.modules.lsw.entity.LswMaterialOutbound;
import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum;
import org.jeecg.modules.lsw.mapper.LswMaterialOutboundMapper;
import org.jeecg.modules.lsw.service.ILswMaterialInboundService;
import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialOutboundService;
import org.jeecg.modules.lsw.service.ILswMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * @Description: ç‰©æ–™å‡ºåº“单
 * @Author: jeecg-boot
 * @Date:   2025-06-30
 * @Date: 2025-06-30
 * @Version: V1.0
 */
@Service
public class LswMaterialOutboundServiceImpl extends ServiceImpl<LswMaterialOutboundMapper, LswMaterialOutbound> implements ILswMaterialOutboundService {
    @Autowired
    private ILswMaterialService materialService;
    @Autowired
    private ILswMaterialInventoryService materialInventoryService;
    @Override
    public IPage<Map<String, Object>> getlswMaterialOutboundListData(Integer pageNo, Integer pageSize, HttpServletRequest req) {
@@ -40,4 +54,30 @@
        }
        return super.getBaseMapper().getlswMaterialOutboundListData(pageData, paramMap);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean outboundMaterial(LswMaterialOutbound outbound) {
        if (StringUtils.isBlank(outbound.getMaterialNumber())
                || StringUtils.isBlank(outbound.getFactoryId())
                || StringUtils.isBlank(outbound.getWarehouseId())
                || outbound.getQuantity() == null
                || outbound.getQuantity().intValue() > 0
                || StringUtils.isBlank(outbound.getBatchNumber())
        || StringUtils.isBlank(outbound.getInventoryId())) {
            return false;
        }
        LswMaterialInventory inventory = materialInventoryService.getById(outbound.getInventoryId());
        if(inventory == null) {
            return false;
        }
        //更新库存状态
        inventory.setInventoryStatus(MaterialInventoryStatusEnum.OUTBOUND.name());
        materialInventoryService.updateById(inventory);
        //保存出库信息
        outbound.setDelFlag(CommonConstant.DEL_FLAG_0);
        outbound.setOutboundTime(new Date());
        super.save(outbound);
        return true;
    }
}
src/main/java/org/jeecg/modules/mes/entity/MesTransferOrderPrint.java
@@ -61,11 +61,10 @@
    @Excel(name = "移库单号", width = 15)
    @ApiModelProperty(value = "移库单号")
    private String workOrderCode;
    /**移库类型*/
    @Excel(name = "移库类型", width = 15, dicCode = "order_category")
    @Dict(dicCode = "order_category")
    @ApiModelProperty(value = "移库类型")
    private String orderCategory;
    /**库存ID*/
    @Excel(name = "库存ID", width = 15)
    @ApiModelProperty(value = "库存ID")
    private String inventoryId;
    /**原库存地*/
    @Excel(name = "原库存地", width = 15)
    @ApiModelProperty(value = "原库存地")
src/main/java/org/jeecg/modules/mes/enums/TransferOrderStatusEnum.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
package org.jeecg.modules.mes.enums;
public enum TransferOrderStatusEnum {
    NEW, //新建
    PRINTED, //已打印、已请求WMS
    COMPLETED, //已完成
    CANCELED, //已撤销
    ;
}
src/main/java/org/jeecg/modules/mes/service/IMesTransferOrderPrintService.java
@@ -13,4 +13,11 @@
 */
public interface IMesTransferOrderPrintService extends IService<MesTransferOrderPrint> {
    List<MesTransferOrderPrint> queryOrderPrintByOrderId(String orderId);
    /**
     * æ ¹æ®ç§»åº“单号查询移库记录
     * @param orderCode
     * @return
     */
    MesTransferOrderPrint queryByOrderCode(String orderCode);
}
src/main/java/org/jeecg/modules/mes/service/impl/MesTransferOrderPrintServiceImpl.java
@@ -1,6 +1,9 @@
package org.jeecg.modules.mes.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.mes.entity.MesTransferOrderPrint;
import org.jeecg.modules.mes.mapper.MesTransferOrderPrintMapper;
import org.jeecg.modules.mes.service.IMesTransferOrderPrintService;
@@ -21,4 +24,16 @@
    public List<MesTransferOrderPrint> queryOrderPrintByOrderId(String orderId) {
        return baseMapper.queryOrderPrintByOrderId(orderId);
    }
    @Override
    public MesTransferOrderPrint queryByOrderCode(String orderCode) {
        LambdaQueryWrapper<MesTransferOrderPrint> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MesTransferOrderPrint::getWorkOrderCode, orderCode);
        wrapper.eq(MesTransferOrderPrint::getDelFlag, CommonConstant.DEFAULT_0);
        List<MesTransferOrderPrint> list = super.list(wrapper);
        if(CollectionUtil.isNotEmpty(list)) {
            return list.get(0);
        }
        return null;
    }
}
src/main/java/org/jeecg/modules/wms/request/WMSWebServiceSendItem.java
@@ -44,7 +44,7 @@
    /** é¢„留号 */
    @XmlElement(name = "ReservationOrder")
    private String reservationOrder;
    /** å¯¹é½æ–¹å¼ */
    /** MES移库单号 */
    @XmlElement(name = "Align")
    private String align;
    /** æ‰˜å· */
src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java
@@ -7,11 +7,20 @@
import org.jeecg.common.constant.ApiLogCategoryEnum;
import org.jeecg.modules.base.entity.LineSideWarehouse;
import org.jeecg.modules.base.service.ILineSideWarehouseService;
import org.jeecg.modules.lsw.entity.LswMaterial;
import org.jeecg.modules.lsw.entity.LswMaterialInbound;
import org.jeecg.modules.lsw.entity.LswMaterialInventory;
import org.jeecg.modules.lsw.entity.LswMaterialOutbound;
import org.jeecg.modules.lsw.service.ILswMaterialInboundService;
import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialOutboundService;
import org.jeecg.modules.lsw.service.ILswMaterialService;
import org.jeecg.modules.mes.entity.MesMaterialTransferRequest;
import org.jeecg.modules.mes.entity.MesTransferOrderPrint;
import org.jeecg.modules.mes.enums.MaterialTransferRequestStatus;
import org.jeecg.modules.mes.enums.TransferOrderStatusEnum;
import org.jeecg.modules.mes.service.IMesMaterialTransferRequestService;
import org.jeecg.modules.mes.service.IMesTransferOrderPrintService;
import org.jeecg.modules.wms.dto.WSResponse;
import org.jeecg.modules.wms.request.ReceiveWMSScanItemList;
import org.jeecg.modules.wms.request.WMSWebServiceSendItem;
@@ -40,6 +49,14 @@
    private ILineSideWarehouseService lineSideWarehouseService;
    @Autowired
    private ILswMaterialInboundService materialInboundService;
    @Autowired
    private IMesTransferOrderPrintService transferOrderPrintService;
    @Autowired
    private ILswMaterialOutboundService materialOutboundService;
    @Autowired
    private ILswMaterialInventoryService materialInventoryService;
    @Autowired
    private ILswMaterialService materialService;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -55,7 +72,6 @@
            response.setErrorDesc("传入的参数为空!");
            return response;
        }
        String errorCode = "N";
        int errorCount = 0;
        int successCount = 0;
        StringBuilder errorMsg = new StringBuilder();
@@ -65,23 +81,23 @@
                MesMaterialTransferRequest transferRequest = materialTransferRequestService.queryByReservationCode(item.getReservationOrder());
                if (transferRequest == null) {
                    errorCount++;
                    errorMsg.append("根据预留号[").append(item.getReservationOrder()).append("]未找到物料拉动单!");
                    errorMsg.append("根据预留号[").append(item.getReservationOrder()).append("]未找到物料拉动单!\n");
                    continue;
                }
                LineSideWarehouse warehouse = lineSideWarehouseService.getById(transferRequest.getTargetWarehouseId());
                if(warehouse == null || !warehouse.getWarehouseCode().equals(item.getDestSection())) {
                if (warehouse == null || !warehouse.getWarehouseCode().equals(item.getDestSection())) {
                    errorCount++;
                    errorMsg.append("线边库[").append(item.getDestSection()).append("]未找到!");
                    errorMsg.append("线边库[").append(item.getDestSection()).append("]未找到!\n");
                    continue;
                }
                if(!transferRequest.getMaterialNumber().equals(item.getSkuCode())) {
                if (!transferRequest.getMaterialNumber().equals(item.getSkuCode())) {
                    errorCount++;
                    errorMsg.append("物料编号[").append(item.getSkuCode()).append("]不匹配!");
                    errorMsg.append("物料编号[").append(item.getSkuCode()).append("]不匹配!\n");
                    continue;
                }
                if(StringUtils.isBlank(item.getTrackLot())) {
                if (StringUtils.isBlank(item.getTrackLot())) {
                    errorCount++;
                    errorMsg.append("批次号[").append(item.getTrackLot()).append("]不能为空!");
                    errorMsg.append("批次号[").append(item.getTrackLot()).append("]不能为空!\n");
                    continue;
                }
                transferRequest.setRequestStatus(MaterialTransferRequestStatus.CHECKED_IN.name());
@@ -99,17 +115,78 @@
                inbound.setQuantity(item.getQuantity());
                inbound.setFactoryId(warehouse.getFactoryId());
                boolean b = materialInboundService.inboundMaterial(inbound);
                if(!b) {
                if (!b) {
                    errorCount++;
                    errorMsg.append("预留号[").append(item.getReservationOrder()).append("]入库失败!");
                    errorMsg.append("预留号[").append(item.getReservationOrder()).append("]入库失败!\n");
                    continue;
                }
                //更新物料拉动单
                materialTransferRequestService.updateById(transferRequest);
                successCount++;
            } else if (StringUtils.isNotBlank(item.getAlign())) {
                //移库单回调
                MesTransferOrderPrint transferOrder = transferOrderPrintService.queryByOrderCode(item.getAlign());
                if (transferOrder == null) {
                    errorCount++;
                    errorMsg.append("移库单[").append(item.getAlign()).append("]不存在!\n");
                    continue;
                }
                LswMaterialInventory inventory = materialInventoryService.getById(item.getMesStockID());
                if (inventory == null) {
                    errorCount++;
                    errorMsg.append("库存信息[").append(item.getMesStockID()).append("]不存在!\n");
                    continue;
                }
                LswMaterial material = materialService.queryByMaterialNumber(item.getSkuCode());
                if(material == null) {
                    errorCount++;
                    errorMsg.append("物料编号[").append(item.getSkuCode()).append("]不存在!\n");
                    continue;
                }
                LineSideWarehouse warehouse = lineSideWarehouseService.getById(transferOrder.getOriginalWarehouseId());
                if (warehouse == null || !warehouse.getWarehouseCode().equals(item.getDestSection())) {
                    errorCount++;
                    errorMsg.append("线边库[").append(item.getDestSection()).append("]未找到!\n");
                    continue;
                }
                //移库单更改
                transferOrder.setOrderStatus(TransferOrderStatusEnum.COMPLETED.name());
                //成品出库
                LswMaterialOutbound outbound = new LswMaterialOutbound();
                outbound.setBatchNumber(inventory.getBatchNumber());
                outbound.setQuantity(item.getQuantity());
                outbound.setMaterialNumber(material.getMaterialNumber());
                outbound.setMaterialName(material.getMaterialName());
                outbound.setInventoryId(inventory.getId());
                outbound.setWarehouseId(transferOrder.getOriginalWarehouseId());
                outbound.setFactoryId(warehouse.getFactoryId());
                outbound.setOutboundStaff("WMS");
                boolean b = materialOutboundService.outboundMaterial(outbound);
                if (!b) {
                    errorCount++;
                    errorMsg.append("移库单[").append(item.getAlign()).append("]出库失败!\n");
                    continue;
                }
                transferOrderPrintService.updateById(transferOrder);
                successCount++;
            }
        }
        //处理返回结果
        if (errorCount > 0) {
            response.setErrorCode("N");
            if (successCount > 0) {
                String msg = "成功执行" + successCount + "条,失败" + errorCount + "条!\n";
                errorMsg.insert(0, msg);
            } else {
                String msg = "失败" + errorCount + "条!\n";
                errorMsg.insert(0, msg);
            }
            response.setErrorDesc(errorMsg.toString());
        } else {
            response.setErrorCode("Y");
            String msg = "成功执行" + successCount + "条!\n";
            response.setErrorDesc(msg);
        }
        return response;
    }
}
src/main/resources/application-prod.yml
@@ -306,5 +306,5 @@
xhj:
  factoryCode: 2301
  orderType: Z001
  productionManager: 010
  productionManager: 012
  orderStatus: REL