自动化立体仓库 - WMS系统
#
18516761980
2023-02-04 f0eeec1f6db4cfc0f9e3f2de5c765d06d5831201
src/main/java/com/zy/ints/task/scheduler/ErpDetTbScheduler.java
@@ -59,7 +59,7 @@
    @Scheduled(cron = "${erp.refreshtime}")
    public void InOrOutOrder() {
        if (!erpEnabledErpDetTb) return;
        String sqlSelectErpDetTb = "select BIL_NO as billNo,prd_no as prdNo,ITM as itm,ADD_ID as addId2,QTY as qty,PRD_MARK as prdMark,WH as wh,BIL_DATE as billdate,STATUS as status,Temp1 as temp1,Temp2 as temp2,Temp3 as temp3 from ERP_DETTB where 1=1";
        String sqlSelectErpDetTb = "select BIL_NO as billNo,prd_no as prdNo,ITM as itm,ADD_ID as addId2,QTY as qty,PRD_MARK as prdMark,WH as wh,STATUS as status,Temp1 as temp1,Temp2 as temp2,Temp3 as temp3 from ERP_DETTB where 1=1";
        String sqlUpDateErpDetTbOne = "update ERP_DETTB set STATUS=1 where 1=1 and PRD_NO=";
        String sqlUpDateErpDetTbTwo = "update ERP_DETTB set STATUS=2 ";
@@ -72,8 +72,13 @@
                    if (status == 0) {
                        Mat mat = matService.selectByMatnr(erpDetTb.getPrdNo());
                        if (Cools.isEmpty(mat)) {
                            erpSqlServer.update(sqlUpDateErpDetTbTwo + ",Temp1='品号信息在立库不存在,请先添加商品!!!'" + "where 1=1 and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'");
                            callApiLogSave(erpDetTb, "ERP_DETTB", "品号信息在立库不存在,请先添加商品!!!", false);
                            if(Cools.isEmpty(erpDetTb.getTemp1())){
                                erpSqlServer.update(sqlUpDateErpDetTbTwo + ",Temp1='品号信息在立库不存在,请先添加商品!!!'" + "where 1=1 "
                                        +" and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'"
                                        +" and ITM=" + "'" + erpDetTb.getItm() + "'"
                                        +" and BIL_NO=" + "'" + erpDetTb.getBillNo() + "'");
                                callApiLogSave(erpDetTb, "ERP_DETTB", "品号信息在立库不存在,请先添加商品!!!", false);
                            }
                        } else {
                            Order order = orderService.selectByNo(erpDetTb.getBillNo());
                            if (Cools.isEmpty(order)) {
@@ -113,8 +118,8 @@
                                        now,    // 修改时间
                                        null    // 备注
                                );
                                String InAndOut = erpDetTb.getAddId2()==2 ? "(出库)" : "(入库)";
                                DocType docType = docTypeService.selectOrAdd("ERP订单"+InAndOut, erpDetTb.getAddId2()==1);
                                String InAndOut = erpDetTb.getAddId2().equals(2) ? "(出库)" : "(入库)";
                                DocType docType = docTypeService.selectOrAdd("ERP订单"+InAndOut, erpDetTb.getAddId2().equals(1));
                                if (!Cools.isEmpty(docType)) {
                                    order.setDocType(docType.getDocId());
                                    if (!orderService.insert(order)) {
@@ -150,8 +155,13 @@
                                        erpSqlServer.update(sqlUpDateErpDetTbOne + "'" + erpDetTb.getPrdNo() + "'");
                                        callApiLogSave(erpDetTb, "ERP_DETTB", "接收ERP下发订单接收成功!!", true);
                                    } else {
                                        erpSqlServer.update(sqlUpDateErpDetTbTwo + ",temp1='添加订单明细档失败!!!'" + "where 1=1 and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'");
                                        callApiLogSave(erpDetTb, "ERP_DETTB", "ERP下发订单接收失败!!", false);
                                        if (Cools.isEmpty(erpDetTb.getTemp2())){
                                            erpSqlServer.update(sqlUpDateErpDetTbTwo + ",temp2='添加订单明细档失败!!!'" + "where 1=1 "
                                                    +" and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'"
                                                    +" and ITM=" + "'" + erpDetTb.getItm() + "'"
                                                    +" and BIL_NO=" + "'" + erpDetTb.getBillNo() + "'");
                                            callApiLogSave(erpDetTb, "ERP_DETTB", "ERP下发订单接收失败!!", false);
                                        }
                                    }
                                }
                            }
@@ -185,7 +195,13 @@
//                        callApiLogSave(erpDetTb, "ERP_DETTB", "ERP下发订单备份后删除成功!!", true);
                    } else {
                        callApiLogSave(erpDetTb, "ERP_DETTB", "接收ERP下发订单失败!!!状态异常!!!", false);
                        if (Cools.isEmpty(erpDetTb.getTemp1()) && Cools.isEmpty(erpDetTb.getTemp2()) && Cools.isEmpty(erpDetTb.getTemp3())){
                            erpSqlServer.update(sqlUpDateErpDetTbTwo + ",Temp1='接收ERP下发订单失败!!!状态异常!!!请ERP、立库双方协助解决。'" + "where 1=1 "
                                    +" and PRD_NO=" + "'" + erpDetTb.getPrdNo() + "'"
                                    +" and ITM=" + "'" + erpDetTb.getItm() + "'"
                                    +" and BIL_NO=" + "'" + erpDetTb.getBillNo() + "'");
                            callApiLogSave(erpDetTb, "ERP_DETTB", "接收ERP下发订单失败!!!状态异常!!!", false);
                        }
                    }
                }
            }