自动化立体仓库 - WMS系统
zwl
2025-10-28 d3c7820992ccfb3296ec031a7c019a4300347b83
完善erp对接2.0
11个文件已修改
203 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MobileController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/mapper/ExdMaterialMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/third/service/ExdMaterialService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/asrs/LocDetlMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/third/ExdMaterialMapper.xml 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/order/OrderDetlStockOut.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -21,6 +21,7 @@
import com.zy.common.web.BaseController;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import com.zy.third.entity.ExdMaterial;
import com.zy.third.entity.ExdvYanbu;
import com.zy.third.mapper.ExdMaterialMapper;
import lombok.extern.slf4j.Slf4j;
@@ -467,7 +468,7 @@
        }
        //空托盘缓冲区 小:E8  大:E9
        String rStaNo = "E8";
        if (barcode.substring(0, 1).equals("9")) {
            String type = "ZONE"; //区域
            if (barcode.substring(0, 1).equals("9")) {
                rStaNo = "E9";
@@ -575,10 +576,8 @@
            if (bool) {
                return R.ok();
            } else {
                return R.error();
                return R.error(msg);
            }
        }
        return R.error();
    }
    /**
@@ -879,7 +878,10 @@
        } else if (sourceStaNo.equals("R02")) {
            rcsParam.put("carrierDir", "90");
        } else {
        } else if(sourceStaNo.substring(0,1).equals("C")){
            rcsParam.put("carrierDir", "90");
        }
        else{
            rcsParam.put("carrierDir", "180");
        }
@@ -950,13 +952,18 @@
        }
        R r = R.ok();
        //防止有未下架的物料直接进行空板回库或者拣料回库
        WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("wrk_sts", 33));
        if (!Cools.isEmpty(wrkMast1)) {
            return R.error("该托盘="+wrkMast1.getBarcode()+",没有下架,请下架后再回库!!!");
        }
        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("io_type", 103, 105, 107));
        if (wrkMast == null) {
            r = FillEmptyPalletsStack(sourceStaNo, staNo);
        } else {
            if (wrkMast.getWrkSts() > 30) {
                return R.error("该托盘={},没有下架,请下架后再回库!!!");
                return R.error("该托盘="+wrkMast.getBarcode()+",没有下架,请下架后再回库!!!");
            }
            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("sta_no", wrkMast.getStaNo()).in("io_type", 101, 103, 105, 107).lt("wrk_sts", 33));
            if (!Cools.isEmpty(wrkMasts)) {
@@ -1006,9 +1013,15 @@
            return R.error("批次对应的验布数据不存在");
        }
        Mat mat = matService.selectByMatnr(barcode1.getItemnumber());
        if(Cools.isEmpty(mat.getUuid())) {
            ExdMaterial fnumber = exdMaterialMapper.getID(barcode1.getItemnumber());
            mat.setUuid(fnumber.getId());
        }
        mat.setAnfme(barcode1.getQty());
        mat.setBc(barcode);
        mat.setBatch(barcode1.getBatchno());
        matService.updateById(mat);
        return R.ok(mat);
    }
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -109,26 +109,26 @@
        Date now = new Date();
        //进行批号筛选,批号只能唯一
//        Set<String> batchs = new HashSet<>();
//        List<String> strings = new ArrayList<>();
        Set<String> batchs = new HashSet<>();
        List<String> strings = new ArrayList<>();
//        for (CombParam.CombMat mat : param.getCombMats()) {
//            if (Cools.isEmpty(mat.getBatch())) {
//                continue;
//            }
//            batchs.add(mat.getBatch());
//            strings.add(mat.getBatch());
//            WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("batch", mat.getBatch()));
//            WrkDetl batch = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", mat.getBatch()));
//            LocDetl batch1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", mat.getBatch()));
//            if (!Cools.isEmpty(batch) || !Cools.isEmpty(batch1) || !Cools.isEmpty(waitPakin)) {
//                throw new CoolException("该物料批号" + mat.getBatch() + "已在入库通知档、任务明细和库存中存在");
//            }
//        }
//        if (batchs.size() < strings.size()) {
//            throw new CoolException("有重复的物料批号");
//        }
        for (CombParam.CombMat mat : param.getCombMats()) {
            if (Cools.isEmpty(mat.getBatch())) {
                continue;
            }
            batchs.add(mat.getBatch());
            strings.add(mat.getBatch());
            WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("batch", mat.getBatch()));
            WrkDetl batch = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", mat.getBatch()));
            LocDetl batch1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", mat.getBatch()));
            if (!Cools.isEmpty(batch) || !Cools.isEmpty(batch1) || !Cools.isEmpty(waitPakin)) {
                throw new CoolException("该物料批号" + mat.getBatch() + "已在入库通知档、任务明细和库存中存在");
            }
        }
        if (batchs.size() < strings.size()) {
            throw new CoolException("有重复的物料批号");
        }
        int i = 1;
        // 无单组托
        if (Cools.isEmpty(param.getOrderNo())) {
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -487,6 +487,7 @@
            order1.setUpdateTime(new Date());
            order1.setSettle(2L);
            order1Service.insert(order1);
            order2=order1;
        }
        // 生成工作档明细
        for (LocDto locDto : taskDto.getLocDtos()) {
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -1,5 +1,6 @@
package com.zy.asrs.task.handler;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.exception.CoolException;
@@ -8,12 +9,14 @@
import com.zy.asrs.service.impl.OrderDetl1ServiceImpl;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.third.entity.ExdInstockTarget;
import com.zy.third.entity.ExdOutstockTarget;
import com.zy.third.entity.ExdvYanbu;
import com.zy.system.entity.User;
import com.zy.system.service.UserService;
import com.zy.third.entity.*;
import com.zy.third.mapper.ExdMaterialMapper;
import com.zy.third.service.ExdInstockTargetService;
import com.zy.third.service.ExdOutstockSourceService;
import com.zy.third.service.ExdOutstockTargetService;
import com.zy.third.service.ExdStockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -53,6 +56,12 @@
    private ExdMaterialMapper exdMaterialMapper;
    @Autowired
    private Order1Service order1Service;
    @Autowired
    private ExdOutstockSourceService exdOutstockSourceService;
    @Autowired
    private UserService userService;
    @Autowired
    private ExdStockService exdStockService;
    @Transactional
    public ReturnT<String> start(Order order) {
@@ -125,9 +134,9 @@
        for (OrderDetl1 orderDetl : orderDetls) {
            ExdvYanbu bacode = exdMaterialMapper.getBacode(orderDetl.getThreeCode());
            ExdvYanbu bacode = exdMaterialMapper.getBacode(orderDetl.getBatch());
            //获取主表明细
            OrderDetl orderDetl1 = orderDetlService.selectItem(orderDetl.getOrderNo(), orderDetl.getMatnr(), null);
            OrderDetl orderDetl1 = orderDetlService.selectItem(orderDetl.getOrderNo().split("-")[0], orderDetl.getMatnr(), null);
            //上报数量
            BigDecimal anfme = new BigDecimal(orderDetl1.getAnfme());
            BigDecimal Units = new BigDecimal((Cools.isEmpty(orderDetl1.getUnits()) ? 0.0 : orderDetl1.getUnits()));
@@ -147,12 +156,23 @@
            //单号 = erp订单号+物料编号+上报次数
            exdOutstockTarget.setFbillno(order.getOrderNo());
            //单据类型
            exdOutstockTarget.setFtrantype(21);
            //单据日期
            exdOutstockTarget.setFdate(DateUtils.convert(order.getOrderTime()));
            //红蓝字
            exdOutstockTarget.setFrob(1);
            //操作用户
            User id = userService.selectOne(new EntityWrapper<User>().eq("id", orderDetl.getCreateBy()));
            exdOutstockTarget.setFuserid(Integer.valueOf(id.getEmail()));
            //部门ID
            exdOutstockTarget.setFdeptid(7502);
            //供应商/客户ID
            exdOutstockTarget.setFsupplyid(0);
            //制单用户ID
            exdOutstockTarget.setFbillerid(Math.toIntExact(orderDetl.getUpdateBy()));
            exdOutstockTarget.setFbillerid(Integer.valueOf(id.getEmail()));
            //细表ID
            Integer c = Integer.valueOf(order.getOrderNo().split("-")[1]);
            exdOutstockTarget.setFentryid(c);
@@ -170,35 +190,35 @@
            //单位ID
            exdOutstockTarget.setFunitid(0);
            //源单号
            exdOutstockTarget.setFsourcebillno(orderDetl.getOrderNo());
            //源单细表ID 暂定
            exdOutstockTarget.setFsourceentryid(0);
            //源单内码 暂定
            exdOutstockTarget.setFsourceinterid(0);
            exdOutstockTarget.setFsourcebillno(orderDetl.getOrderNo().split("-")[0]);
            ExdOutstockSource exdOutstockSource = exdOutstockSourceService.selectOne(new EntityWrapper<ExdOutstockSource>()
                    .eq("FBillNo", orderDetl.getOrderNo().split("-")[0])
                    .eq("FItemID", mat.getUuid()));
            //源单细表ID
            exdOutstockTarget.setFsourceentryid(exdOutstockSource.getFentryid());
            //源单内码
            exdOutstockTarget.setFsourceinterid(exdOutstockSource.getFinterid());
            //源单单据类型
            exdOutstockTarget.setFsourcetrantype(0);
            exdOutstockTarget.setFsourcetrantype(81);
            //库位ID
            exdOutstockTarget.setFdcspid(0);
            //仓库ID 暂定
            exdOutstockTarget.setFdcstockid(0);
            //仓库ID
            Integer Fdcstockid = 19382;
            if(!Cools.isEmpty(bacode.getProdinkind())){
                ExdStock fname = exdStockService.selectOne(new EntityWrapper<ExdStock>().eq("Fname", bacode.getProdinkind()));
                Fdcstockid = Integer.valueOf(fname.getId());
            }
            exdOutstockTarget.setFdcstockid(Fdcstockid);
            //销售订单单号 暂定
            exdOutstockTarget.setForderbillno(orderDetl.getOrderNo());
            exdOutstockTarget.setForderbillno(exdOutstockSource.getForderbillno());
            //销售订单细表ID 暂定
            exdOutstockTarget.setForderentryid(0);
            exdOutstockTarget.setForderentryid(exdOutstockSource.getForderentryid());
            //销售订单内码 暂定
            exdOutstockTarget.setForderinterid(0);
            exdOutstockTarget.setForderinterid(exdOutstockSource.getForderinterid());
            //计划模式
            exdOutstockTarget.setFplanmode(0);
            //单据类型
            exdOutstockTarget.setFtrantype(21);
            //单据日期
            exdOutstockTarget.setFdate(DateUtils.convert(order.getOrderTime()));
            //红蓝字
            exdOutstockTarget.setFrob(orderDetl.getBeBatch());
            //操作用户
            exdOutstockTarget.setFuserid(Integer.getInteger(orderDetl.getColor()));
            exdOutstockTarget.setBarcode(orderDetl.getBatch());
            exdOutstockTarget.setGross(BigDecimal.valueOf(bacode.getGross()));
@@ -225,10 +245,10 @@
            }
        }
        for (OrderDetl1 orderDetl : orderDetls) {
            OrderDetl orderDetl1 = orderDetlService.selectItem(orderDetl.getOrderNo(), orderDetl.getMatnr(), null);
            orderDetl1.setUnits(orderDetl.getAnfme() + (Cools.isEmpty(orderDetl.getUnits()) ? 0.0 : orderDetl.getUnits()));
            OrderDetl orderDetl1 = orderDetlService.selectItem(orderDetl.getOrderNo().split("-")[0], orderDetl.getMatnr(), null);
            orderDetl1.setUnits(orderDetl.getAnfme() + (Cools.isEmpty(orderDetl1.getUnits()) ? 0.0 : orderDetl1.getUnits()));
            orderDetl1.setUpdateTime(new Date());
            orderDetl1Service.updateById(orderDetl);
            orderDetlService.updateById(orderDetl1);
        }
        return SUCCESS;
    }
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -2,12 +2,15 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.service.impl.MatServiceImpl;
import com.zy.asrs.service.impl.OrderDetl1ServiceImpl;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.system.entity.User;
import com.zy.system.service.impl.UserServiceImpl;
import com.zy.third.entity.ExdInstockTarget;
import com.zy.third.entity.ExdStock;
import com.zy.third.entity.ExdvYanbu;
@@ -55,6 +58,8 @@
    private MatServiceImpl matServiceImpl;
    @Autowired
    private OrderDetl1ServiceImpl orderDetl1Service;
    @Autowired
    private UserServiceImpl userService;
    @Transactional
    public ReturnT<String> start(WrkMast wrkMast) {
@@ -516,7 +521,7 @@
    private void write(WrkMast wrkMast, List<WrkDetl> wrkDetls) {
        ExdInstockTarget exdInstockTarge;
        int i = -1;
        int i = 1;
        for (WrkDetl wrkDetl : wrkDetls) {
            if (Cools.isEmpty(wrkDetl.getOrderNo()) && !Cools.isEmpty(wrkDetl.getInspect()) && wrkDetl.getInspect() == 1) {
                ExdvYanbu bacode = exdMaterialMapper.getBacode(wrkDetl.getThreeCode());
@@ -525,16 +530,17 @@
                    return;
                }
                exdInstockTarge = new ExdInstockTarget();
                exdInstockTarge.setFtrantype(21);
                exdInstockTarge.setFtrantype(2);
                exdInstockTarge.setFdate(new Date());
                exdInstockTarge.setFrob(1);
                exdInstockTarge.setFdeptid(7502);
                //供应商/客户ID
                exdInstockTarge.setFsupplyid(0);
                //wms操作员
                exdInstockTarge.setFbillerid(Integer.valueOf(wrkDetl.getColor()));
                exdInstockTarge.setFfmanagerid(Integer.valueOf(wrkDetl.getColor()));
                exdInstockTarge.setFsmanagerid(Integer.valueOf(wrkDetl.getColor()));
                User id = userService.selectOne(new EntityWrapper<User>().eq("id", wrkDetl.getColor()));
                exdInstockTarge.setFbillerid(Integer.valueOf(id.getEmail()));
                exdInstockTarge.setFfmanagerid(17938);
                exdInstockTarge.setFsmanagerid(17938);
                exdInstockTarge.setFentryid(i);
                //物料ID
                Mat mat = matServiceImpl.selectByMatnr(wrkDetl.getMatnr());
@@ -554,8 +560,13 @@
                //库位ID
                exdInstockTarge.setFdcspid(0);
                //仓库ID
                ExdStock fname = exdStockService.selectOne(new EntityWrapper<ExdStock>().eq("Fname", wrkDetl.getBrand()));
                exdInstockTarge.setFdcstockid(Integer.valueOf(fname.getId()));
                Integer Fdcstockid = 19382;
                if(!Cools.isEmpty(bacode.getProdinkind())){
                    ExdStock fname = exdStockService.selectOne(new EntityWrapper<ExdStock>().eq("Fname", bacode.getProdinkind()));
                    Fdcstockid = Integer.valueOf(fname.getId());
                }
                exdInstockTarge.setFdcstockid(Integer.valueOf(Fdcstockid));
                //exdInstockTarge.setFdcspid(wrkMast.getLocNo());
@@ -571,7 +582,9 @@
                //仓库
                exdInstockTarge.setProdinkind(bacode.getProdinkind());
                //exdInstockTarge.setProdInKind("特采库");
                exdInstockTargetService.insert(exdInstockTarge);
                if(!exdInstockTargetService.insert(exdInstockTarge)){
                    throw new CoolException("验布入库完成插入入库表失败");
                }
                i++;
            }
        }
src/main/java/com/zy/third/mapper/ExdMaterialMapper.java
@@ -16,7 +16,7 @@
public interface ExdMaterialMapper extends BaseMapper<ExdMaterial> {
    ExdvYanbu getBacode(@Param("barcode") String barcode);
    ExdMaterial getID(@Param("itemnumber") String itemnumber);
    List<ExdMaterial> listAll();
}
src/main/java/com/zy/third/service/ExdMaterialService.java
@@ -10,4 +10,5 @@
*/
public interface ExdMaterialService extends IService<ExdMaterial> {
}
src/main/resources/application.yml
@@ -33,12 +33,12 @@
    #    password: root
    #driver-class-name: com.mysql.cj.jdbc.Driver
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
#    jdbc-url: jdbc:sqlserver://192.168.3.148:1433;databasename=wms_middle
#    username: wms
#    password: wms@aunde
    jdbc-url: jdbc:sqlserver://127.0.0.1:1433;databasename=ycawdasrs
    username: sa
    password: sa@123
    jdbc-url: jdbc:sqlserver://192.168.3.148:1433;databasename=wms_middle
    username: wms
    password: wms@aunde
#    jdbc-url: jdbc:sqlserver://127.0.0.1:1433;databasename=ycawdasrs
#    username: sa
#    password: sa@123
mybatis-plus:
  mapper-locations: classpath:mapper/*.xml 
src/main/resources/mapper/asrs/LocDetlMapper.xml
@@ -89,7 +89,7 @@
            and a.loc_no like '%' + #{loc_no} + '%'
        </if>
        <if test="matnr!=null and matnr!='' ">
            and a.matnr like '%' + #{matnr} + '%'
            and a.matnr = #{matnr}
        </if>
        <if test="zpallet!=null and zpallet!='' ">
            and a.zpallet like '%' + #{zpallet} + '%'
src/main/resources/mapper/third/ExdMaterialMapper.xml
@@ -30,12 +30,22 @@
    </select>
    <select id="getBacode" resultType="com.zy.third.entity.ExdvYanbu" parameterType="string">
--             SELECT top 1 *
--       FROM [Textile].[trade].[TianfuQcResult]
--       where Barcode = #{barcode}
           SELECT top 1 *
         FROM TianfuQcResult
      FROM [Textile].[trade].[TianfuQcResult]
         where Barcode = #{barcode}
<!--            SELECT top 1 *
         FROM TianfuQcResult
          where Barcode = #{barcode}-->
       </select>
    <select id="getID" resultType="com.zy.third.entity.ExdMaterial" parameterType="string">
        select top 1 *
        from Exd_Material
        where Fnumber = #{itemnumber}
        <!--            SELECT top 1 *
                 FROM TianfuQcResult
                  where Barcode = #{barcode}-->
       </select>
src/main/webapp/static/js/order/OrderDetlStockOut.js
@@ -329,6 +329,7 @@
                    layer.close(layerIndex);
                    layer.msg(res.msg, {icon: 1});
                    tableIns.reload({where: null});
                    tableIns.reload({data: null});
                    tableInss.reload({where: null, page: {curr: 1}});
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/";