Browse Source

工单结案限制领料

koul 3 years ago
parent
commit
4a51759c33
1 changed files with 14 additions and 8 deletions
  1. 14 8
      src/main/java/com/uas/eis/service/Impl/MESServiceImpl.java

+ 14 - 8
src/main/java/com/uas/eis/service/Impl/MESServiceImpl.java

@@ -724,8 +724,11 @@ public class MESServiceImpl implements MESService {
         JSONArray array = data.get("detail");
         if(array!=null&&array.size()>0){
             String macode = StringUtil.valueOf(JSON.parseObject(StringUtil.nvl(array.get(0), "{}")).get("FICMOBillNo"));
-            Object[] data1 = baseDao.getFieldsDataByCondition("Make", "ma_tasktype,ma_id", "ma_code in ('" + macode + "')");
+            Object[] data1 = baseDao.getFieldsDataByCondition("Make", "ma_tasktype,ma_id,ma_status", "ma_code in ('" + macode + "')");
             if (data1!=null&&data1.length>0) {
+                if ("已结案".equals(StringUtil.nvl(data1[2], ""))){
+                    return ApiResponse.failRsp("10045", requestId, "工单:"+macode+"在ERP已结案,不允许领料!");
+                }
                 ma_tasktype = StringUtil.nvl(data1[0], "");
                 maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
             }else {
@@ -1438,12 +1441,15 @@ public class MESServiceImpl implements MESService {
         JSONArray detail = data.get("detail");
         if(detail!=null&&detail.size()>0){
             String macode = StringUtil.valueOf(JSON.parseObject(StringUtil.nvl(detail.get(0), "{}")).get("FICMOBillNo"));
-            Object[] data1 = baseDao.getFieldsDataByCondition("Make", "ma_tasktype,ma_id", "ma_code in ('" + macode + "')");
+            Object[] data1 = baseDao.getFieldsDataByCondition("Make", "ma_tasktype,ma_id,ma_status", "ma_code in ('" + macode + "')");
             if (data1!=null&&data1.length>0) {
+                if ("已结案".equals(StringUtil.nvl(data1[2], ""))){
+                    return ApiResponse.failRsp("10041", requestId, "工单:"+macode+"在ERP已结案,不允许领料!");
+                }
                 ma_tasktype = StringUtil.nvl(data1[0], "");
                 maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
             }else {
-                return ApiResponse.failRsp("10041", requestId, "工单在ERP不存在,请核对!");
+                return ApiResponse.failRsp("10042", requestId, "工单在ERP不存在,请核对!");
             }
         }
         JSONArray main = data.get("main");
@@ -1475,28 +1481,28 @@ public class MESServiceImpl implements MESService {
             Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
             String itemNo = StringUtil.nvl(map.get("FNumber"), "");
             if ("".equals(itemNo)){
-                return ApiResponse.failRsp("10042",requestId,"物料不能为空!");
+                return ApiResponse.failRsp("10043",requestId,"物料不能为空!");
             }
             String fAuxQty = StringUtil.nvl(object.get("FAuxQty"), "0");
             if ("0".equals(fAuxQty)){
-                return ApiResponse.failRsp("10043",requestId,"实发数量不能为空!");
+                return ApiResponse.failRsp("10044",requestId,"实发数量不能为空!");
             }
             Double qty = Double.parseDouble(fAuxQty);
             Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FSCStockID2")));
             String whcode = StringUtil.nvl(map1.get("FNumber"), "");
             if ("".equals(whcode)){
-                return ApiResponse.failRsp("10043",requestId,"发料仓库不能为空!");
+                return ApiResponse.failRsp("10045",requestId,"发料仓库不能为空!");
             }
             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("10044",requestId,"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
+                return ApiResponse.failRsp("10046",requestId,"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
             }
             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"), "");
             int lineId = Integer.parseInt(StringUtil.nvl(object.get("lineId"), "0"));
             int count4 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
             if (count4<=0){
-                return ApiResponse.failRsp("10046",requestId,"工单BOM在ERP中不存在,物料编号:"+itemNo+",请联系管理员!");
+                return ApiResponse.failRsp("10047",requestId,"工单BOM在ERP中不存在,物料编号:"+itemNo+",请联系管理员!");
             }
             Object[] data1 = baseDao.getFieldsDataByCondition("MakeMaterial", "mm_detno,mm_maid","mm_id in (" + lineId + ")");
             maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));