自动化立体仓库 - WMS系统
lty
2025-03-14 83d6be1ca1ee0197993e76e46d4e99e805c057b0
src/main/java/com/zy/third/lk/task/LKInTBScheduler.java
@@ -1,11 +1,11 @@
package com.zy.third.lk.task;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.DocType;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.DocTypeService;
@@ -93,11 +93,9 @@
     */
    @Transactional(rollbackFor = Throwable.class)
    public boolean insertInDet(OrderDetl orderDetl) {
        String sqlInDetTb = "select * from lk_InDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        String sqlInDetTb = "select * from lk_InDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        List<InDetTB> inDets = erpSqlServer.select(sqlInDetTb, InDetTB.class);
        String sqlInDetTbBak = "select * from lk_InDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        String sqlInDetTbBak = "select * from lk_InDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        List<InDetTBBak> inDetBaks = erpSqlServer.select(sqlInDetTbBak, InDetTBBak.class);
        if (!inDets.isEmpty() || !inDetBaks.isEmpty()) {
            log.error("该单号料号中间表表身已存在:" + orderDetl.getOrderNo() + "==>>" + orderDetl.getOrderNo());
@@ -111,7 +109,7 @@
            return true;
        } else {
            log.error("入库回传失败,实体类打印:{}", content);
            return false;
            throw new CoolException("服务器内部错误,请联系管理员");
        }
    }
@@ -154,7 +152,7 @@
            return true;
        } else {
            log.error("入库单表头回传失败:" + content);
            return false;
            throw new CoolException("服务器内部错误,请联系管理员");
        }
    }
@@ -166,11 +164,9 @@
     */
    @Transactional(rollbackFor = Throwable.class)
    public boolean insertOutDet(OrderDetl orderDetl) {
        String sqlInDetTb = "select * from lk_OutDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        String sqlInDetTb = "select * from lk_OutDetTB where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        List<OutDetTB> inDets = erpSqlServer.select(sqlInDetTb, OutDetTB.class);
        String sqlInDetTbBak = "select * from lk_OutDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " +
                " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        String sqlInDetTbBak = "select * from lk_OutDetTB_Bak where BillNo='" + orderDetl.getOrderNo() + "' and " + " ItemId='" + orderDetl.getMatnr() + "' and ItemBatch='" + orderDetl.getBatch() + "' and proType='" + orderDetl.getSpecs() + "'";
        List<OutDetTBBak> inDetBaks = erpSqlServer.select(sqlInDetTbBak, OutDetTBBak.class);
        if (!inDets.isEmpty() || !inDetBaks.isEmpty()) {
            log.error("该单号料号中间表表身已存在:" + orderDetl.getOrderNo() + "==>>" + orderDetl.getOrderNo());
@@ -184,7 +180,7 @@
            return true;
        } else {
            log.error("入库回传失败,实体类打印:" + content.toString());
            return false;
            throw new CoolException("服务器内部错误,请联系管理员");
        }
    }
@@ -227,7 +223,7 @@
            return true;
        } else {
            log.error("入库单表头回传失败:" + content);
            return false;
            throw new CoolException("服务器内部错误,请联系管理员");
        }
    }
@@ -242,7 +238,14 @@
        if (!Cools.isEmpty(orderDetl.getProType())) content.put("proType", "'" + orderDetl.getProType() + "'");
        if (!Cools.isEmpty(orderDetl.getMemo())) content.put("remark", "'" + orderDetl.getMemo() + "'");
        if (!Cools.isEmpty(orderDetl.getOutOrderNo())) content.put("OrderNo", "'" + orderDetl.getOutOrderNo() + "'");
        if (!Cools.isEmpty(orderDetl.getQty())) content.put("MainNum", orderDetl.getQty());
        if (!Cools.isEmpty(orderDetl.getQty())) {
            if (orderDetl.getQty() > orderDetl.getAnfme() && orderDetl.getQty() > orderDetl.getWorkQty()) {
                log.info("修正错误数量:{}", JSON.toJSON(orderDetl));
                content.put("MainNum", orderDetl.getWorkQty());
            } else {
                content.put("MainNum", orderDetl.getQty());
            }
        }
        if (!Cools.isEmpty(orderDetl.getWareId())) content.put("WareId", "'" + orderDetl.getWareId() + "'");
        if (!Cools.isEmpty(orderDetl.getWareName())) content.put("WareName", "'" + orderDetl.getWareName() + "'");
        if (!Cools.isEmpty(orderDetl.getPacking())) content.put("Packing", "'" + orderDetl.getPacking() + "'");