Sfoglia il codice sorgente

MES测试地址更改

koul 3 anni fa
parent
commit
caf520d2c6

+ 12 - 35
src/main/java/com/uas/eis/service/Impl/MESServiceImpl.java

@@ -784,21 +784,6 @@ public class MESServiceImpl implements MESService {
                 if (count2 <= 0) {
                 if (count2 <= 0) {
                     return ApiResponse.failRsp("10056", requestId, "MES仓库编号在ERP没有对应关系,请联系管理员新增!");
                     return ApiResponse.failRsp("10056", requestId, "MES仓库编号在ERP没有对应关系,请联系管理员新增!");
                 }
                 }
-                /*warehouses2 = baseDao.getFieldsDataByCondition("customtabledetail left join customtable on cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code", "cd_varchar50_3,wh_description", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
-                //获取领料单拨出仓库
-                int mmdetno = Integer.parseInt(StringUtil.nvl(baseDao.getFieldDataByCondition("MakeMaterial","mm_detno","mm_id in (" + lineId + ")"), "0"));
-                Object data2 = baseDao.getFieldDataByCondition("prodiodetail", "min(pd_batchcode)","pd_piclass='生产领料单' and pd_ordercode='" + macode + "' and pd_orderdetno=" + mmdetno);
-                Object pdwhcode = baseDao.getFieldDataByCondition("prodiodetail", "pd_whcode","pd_piclass='拨出单' and pd_batchcode='" + data2 + "'");
-                int nocost = Integer.parseInt(StringUtil.nvl(baseDao.getFieldDataByCondition("Warehouse", "nvl(wh_nocost,0)", "wh_code='" + pdwhcode + "'"), "0"));
-                int nocost1 = Integer.parseInt(StringUtil.nvl(baseDao.getFieldDataByCondition("Warehouse", "nvl(wh_nocost,0)", "wh_code='" + warehouses2[0] + "'"), "0"));
-                if (nocost != nocost1) {
-                    if (nocost == -1) {
-                        return ApiResponse.failRsp("10058", requestId, "工单BOM领料仓是零值仓,不允许退有值仓!");
-                    }
-                    if (nocost == 0) {
-                        return ApiResponse.failRsp("10059", requestId, "工单BOM领料仓是有值仓,不允许退零值仓!");
-                    }
-                }*/
             }
             }
         }
         }
         for (int i = 0; i <jsonArray.size() ; i++) {
         for (int i = 0; i <jsonArray.size() ; i++) {
@@ -892,11 +877,11 @@ public class MESServiceImpl implements MESService {
         }
         }
         baseDao.execute(sqls);
         baseDao.execute(sqls);
         baseDao.execute("delete from prodiodetail where pd_inqty=0 and pd_piclass='"+tlpiclass+"' and pd_piid="+tlid);
         baseDao.execute("delete from prodiodetail where pd_inqty=0 and pd_piclass='"+tlpiclass+"' and pd_piid="+tlid);
+        Employee employee = baseDao.getJdbcTemplate().queryForObject("select * from employee where em_code=?", new BeanPropertyRowMapper<Employee>(Employee.class), "mes");
         int count = baseDao.getCount("select count(1) from prodiodetail where pd_piid=" + tlid);
         int count = baseDao.getCount("select count(1) from prodiodetail where pd_piid=" + tlid);
         if (count<=0){
         if (count<=0){
             baseDao.deleteById("prodinout","pi_id",tlid);
             baseDao.deleteById("prodinout","pi_id",tlid);
         }
         }
-        Employee employee = baseDao.getJdbcTemplate().queryForObject("select * from employee where em_code=?", new BeanPropertyRowMapper<Employee>(Employee.class), "mes");
         if (count>0) {
         if (count>0) {
             String s1 = postProdInOut(tlid, tlcaller, employee);
             String s1 = postProdInOut(tlid, tlcaller, employee);
             logger.info("S1==" + s1);
             logger.info("S1==" + s1);
@@ -909,6 +894,9 @@ public class MESServiceImpl implements MESService {
         if (s!=null){
         if (s!=null){
             return ApiResponse.successRsp("0",requestId,bcpiclass+":"+code+",过账失败,请在ERP重新过账!");
             return ApiResponse.successRsp("0",requestId,bcpiclass+":"+code+",过账失败,请在ERP重新过账!");
         }
         }
+        if (count<=0) {
+            return ApiResponse.successRsp("0",requestId,bcpiclass+":"+code+",请在ERP查看!");
+        }
         return ApiResponse.successRsp("0",requestId,tlpiclass+":"+tlcode+","+bcpiclass+":"+code+",请在ERP查看!");
         return ApiResponse.successRsp("0",requestId,tlpiclass+":"+tlcode+","+bcpiclass+":"+code+",请在ERP查看!");
     }
     }
 
 
@@ -1340,17 +1328,6 @@ public class MESServiceImpl implements MESService {
             }
             }
             Object[] warehouses = baseDao.getFieldsDataByCondition("customtabledetail left join customtable on cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code", "cd_varchar50_3,wh_description", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
             Object[] warehouses = baseDao.getFieldsDataByCondition("customtabledetail left join customtable on cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code", "cd_varchar50_3,wh_description", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
             String ficmoBillNo = StringUtil.nvl(object.get("FICMOBillNo"), "");
             String ficmoBillNo = StringUtil.nvl(object.get("FICMOBillNo"), "");
-           /* Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID2"), "{}"));
-            String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
-            if ("".equals(whcode2)){
-                return ApiResponse.failRsp("10044",requestId,"发料仓库不能为空!");
-            }
-            int count2 = baseDao.getCount("select count(1) from customtabledetail left join customtable on cd_ctid=ct_id where ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
-            if (count2<=0){
-                return ApiResponse.failRsp("10045",requestId,"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
-            }
-            Object[] warehouses2 = baseDao.getFieldsDataByCondition("customtabledetail left join customtable on cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code", "cd_varchar50_3,wh_description", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
-*/
             int lineId = Integer.parseInt(StringUtil.nvl(object.get("lineId"), "0"));
             int lineId = Integer.parseInt(StringUtil.nvl(object.get("lineId"), "0"));
             int count4 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
             int count4 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
             if (count4<=0){
             if (count4<=0){
@@ -1437,17 +1414,17 @@ public class MESServiceImpl implements MESService {
                 }
                 }
                 //退回仓库
                 //退回仓库
                 Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID1"), "{}"));
                 Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID1"), "{}"));
-                String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
-                if ("".equals(whcode2)) {
+                String whcode = StringUtil.nvl(map2.get("FNumber"), "");
+                if ("".equals(whcode)) {
                     return ApiResponse.failRsp("10055", requestId, "物料退回仓库不能为空!");
                     return ApiResponse.failRsp("10055", requestId, "物料退回仓库不能为空!");
                 }
                 }
-                int count2 = baseDao.getCount("select count(1) from customtabledetail left join customtable on cd_ctid=ct_id where ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
-                if (count2 <= 0) {
+                int count = baseDao.getCount("select count(1) from customtabledetail left join customtable on cd_ctid=ct_id where ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
+                if (count <= 0) {
                     return ApiResponse.failRsp("10056", requestId, "MES仓库编号在ERP没有对应关系,请联系管理员新增!");
                     return ApiResponse.failRsp("10056", requestId, "MES仓库编号在ERP没有对应关系,请联系管理员新增!");
                 }
                 }
-                Object[] warehouses2 = baseDao.getFieldsDataByCondition("customtabledetail left join customtable on " +
-                        "cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code", "cd_varchar50_3,wh_description,wh_nocost", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
-                Double outqty = Double.parseDouble(StringUtil.nvl(baseDao.getFieldDataByCondition("prodiodetail left join Warehouse on pd_whcode=wh_code", "sum(nvl(pd_outqty,0)-nvl(pd_inqty,0))", "pd_piclass in ("+piclass+ ") and pd_ordercode='" + macode + "' and pd_prodcode='" + itemNo + "' and nvl(wh_nocost,0)=" + warehouses2[2]),"0"));
+                Object[] warehouses = baseDao.getFieldsDataByCondition("customtabledetail left join customtable on " +
+                        "cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code", "cd_varchar50_3,wh_description,wh_nocost", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
+                Double outqty = Double.parseDouble(StringUtil.nvl(baseDao.getFieldDataByCondition("prodiodetail left join Warehouse on pd_whcode=wh_code", "sum(nvl(pd_outqty,0)-nvl(pd_inqty,0))", "pd_piclass in ("+piclass+ ") and pd_ordercode='" + macode + "' and pd_prodcode='" + itemNo + "' and nvl(wh_nocost,0)=" + warehouses[2]),"0"));
                 if (qty.compareTo(outqty) > 0) {
                 if (qty.compareTo(outqty) > 0) {
                     return ApiResponse.failRsp("10058", requestId, "退料数量不允许超过对应的发料数,请确定仓库属性和领料数量!");
                     return ApiResponse.failRsp("10058", requestId, "退料数量不允许超过对应的发料数,请确定仓库属性和领料数量!");
                 }
                 }
@@ -1458,7 +1435,7 @@ public class MESServiceImpl implements MESService {
                 }
                 }
                 Object[] objs = baseDao.getFieldsDataByCondition("Make left join MakeMaterial on ma_id=mm_maid", new String[] { "mm_id", "mm_code","mm_detno", "mm_mdcode", "mm_prodcode", "mm_wccode"}, "mm_id in (" + lineId+")");
                 Object[] objs = baseDao.getFieldsDataByCondition("Make left join MakeMaterial on ma_id=mm_maid", new String[] { "mm_id", "mm_code","mm_detno", "mm_mdcode", "mm_prodcode", "mm_wccode"}, "mm_id in (" + lineId+")");
                 Object prid = baseDao.getFieldDataByCondition("Product", "pr_id", "pr_code='" + itemNo + "'");
                 Object prid = baseDao.getFieldDataByCondition("Product", "pr_id", "pr_code='" + itemNo + "'");
-                sqls.add("INSERT INTO ProdIODetail(pd_id, pd_piid, pd_inoutno, pd_piclass, pd_pdno, pd_status,pd_auditstatuscode,pd_auditstatus,pd_prodcode,pd_ordercode, pd_orderdetno,pd_macode,pd_madetno,pd_plancode, pd_wccode, pd_orderid, pd_prodid,pd_whcode,pd_whname,pd_inqty,pd_description) VALUES (PRODIODETAIL_SEQ.nextval,"+tlid+",'"+tlcode+"','"+tlpiclass+"',"+detno+ ",0,'ENTERING','在录入','"+itemNo+"','"+ficmoBillNo+"',"+objs[2]+",'"+ficmoBillNo+"',"+objs[2]+ ",'"+objs[3]+"','"+objs[5]+"',"+lineId+","+prid+",'"+warehouses2[0]+"','"+warehouses2[1]+"',"+qty+ ",'"+taskType+"')");
+                sqls.add("INSERT INTO ProdIODetail(pd_id, pd_piid, pd_inoutno, pd_piclass, pd_pdno, pd_status,pd_auditstatuscode,pd_auditstatus,pd_prodcode,pd_ordercode, pd_orderdetno,pd_macode,pd_madetno,pd_plancode, pd_wccode, pd_orderid, pd_prodid,pd_whcode,pd_whname,pd_inqty,pd_description) VALUES (PRODIODETAIL_SEQ.nextval,"+tlid+",'"+tlcode+"','"+tlpiclass+"',"+detno+ ",0,'ENTERING','在录入','"+itemNo+"','"+ficmoBillNo+"',"+objs[2]+",'"+ficmoBillNo+"',"+objs[2]+ ",'"+objs[3]+"','"+objs[5]+"',"+lineId+","+prid+",'"+warehouses[0]+"','"+warehouses[1]+"',"+qty+ ",'"+taskType+"')");
                 detno++;
                 detno++;
             }
             }
             sqls.add("update prodiodetail set (pd_mcid,pd_jobcode)=(select mc_id,mm_mdcode from MakeMaterial,makecraft where pd_orderdetno=mm_detno and pd_ordercode=mm_code and mm_mdcode=mc_code) where pd_piid="
             sqls.add("update prodiodetail set (pd_mcid,pd_jobcode)=(select mc_id,mm_mdcode from MakeMaterial,makecraft where pd_orderdetno=mm_detno and pd_ordercode=mm_code and mm_mdcode=mc_code) where pd_piid="

+ 4 - 4
src/main/java/com/uas/eis/task/ScheduleTask.java

@@ -27,7 +27,7 @@ public class ScheduleTask {
     public void syncProducts() {
     public void syncProducts() {
         logger.info("同步物料资料开始");
         logger.info("同步物料资料开始");
         Date date = new Date();
         Date date = new Date();
-        //scheduleTaskService.syncProducts();
+        scheduleTaskService.syncProducts();
         logger.info("同步物料资料结束:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
         logger.info("同步物料资料结束:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
 
 
     }
     }
@@ -38,7 +38,7 @@ public class ScheduleTask {
     public void syncMakeBases() {
     public void syncMakeBases() {
         logger.info("同步工单开始");
         logger.info("同步工单开始");
         Date date = new Date();
         Date date = new Date();
-        //scheduleTaskService.syncMakeBases();
+        scheduleTaskService.syncMakeBases();
         logger.info("同步工单结束:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
         logger.info("同步工单结束:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
 
 
     }
     }
@@ -49,7 +49,7 @@ public class ScheduleTask {
     public void syncMakeBaseDetails() {
     public void syncMakeBaseDetails() {
         logger.info("同步工单BOM开始");
         logger.info("同步工单BOM开始");
         Date date = new Date();
         Date date = new Date();
-        //scheduleTaskService.syncMakeBaseDetails();
+        scheduleTaskService.syncMakeBaseDetails();
         logger.info("同步工单BOM:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
         logger.info("同步工单BOM:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
 
 
     }
     }
@@ -60,7 +60,7 @@ public class ScheduleTask {
     public void syncMakematerialReplace() {
     public void syncMakematerialReplace() {
         logger.info("同步替代料开始");
         logger.info("同步替代料开始");
         Date date = new Date();
         Date date = new Date();
-        //scheduleTaskService.syncMakematerialReplace();
+        scheduleTaskService.syncMakematerialReplace();
         logger.info("同步替代料:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
         logger.info("同步替代料:用时" + ((System.currentTimeMillis() - date.getTime()) / 1000));
 
 
     }
     }

+ 1 - 1
src/main/resources/api_sign_key_mapping.properties

@@ -1,7 +1,7 @@
 BOYT=f9d17c1047fd468081e39ce33bb41bb7
 BOYT=f9d17c1047fd468081e39ce33bb41bb7
 mesUser=ERP
 mesUser=ERP
 mesPwd=erp.com
 mesPwd=erp.com
-mesHttp=http://192.168.16.244:8088/mrs/
+mesHttp=http://218.17.190.142:9910/mrs/
 syncProduct=updateItemByErp
 syncProduct=updateItemByErp
 syncMakeBase=updateProdByErp
 syncMakeBase=updateProdByErp
 syncMakeBaseDetail=updateProdBomByErp
 syncMakeBaseDetail=updateProdBomByErp