Browse Source

工单增加委外处理

koul 4 years ago
parent
commit
012c0d9dec

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

@@ -84,12 +84,18 @@ public class MESServiceImpl implements MESService {
                 return ApiResponse.failRsp("10012",request.getHeader("RequestId"),"单据未审核或不存在,请确认!");
             }
             vaid = baseDao.getFieldDataByCondition("verifyApply", "va_id", "va_statuscode='AUDITED' and va_mescode='" + mesCode + "'");
-            int count1 = baseDao.getCount("select count(1) from VerifyApplyDetail where nvl(vad_pucode,' ')<>' ' and " +
-                    "vad_vaid=" + vaid);
-            if (count1>0){
-                caller="VerifyApply!ToPurcIn";
-                type="采购验收单";
-                djcaller="ProdInOut!PurcCheckin";
+            String vaClass = StringUtil.nvl(baseDao.getFieldDataByCondition("VerifyApply", "va_class", "va_id=" + vaid), "");
+            if ("委外收料单".equals(vaClass)) {
+                caller = "VerifyApply!ToOutsideCheckIn";
+                type = "委外验收单";
+                djcaller = "ProdInOut!OutsideCheckIn";
+            }else if("采购收料单".equals(vaClass)){
+                int count1 = baseDao.getCount("select count(1) from VerifyApplyDetail where nvl(vad_pucode,' ')<>' ' and vad_vaid=" + vaid);
+                if (count1 > 0) {
+                    caller = "VerifyApply!ToPurcIn";
+                    type = "采购验收单";
+                    djcaller = "ProdInOut!PurcCheckin";
+                }
             }
             //判断已转数
             Object chekQty = baseDao.getJdbcTemplate().queryForObject("select wmsys.wm_concat('收料单:'||vad_code||'序号:'||vad_detno)  from VerifyApplyDetail where vad_qty <= vad_yqty and vad_vaid = "+vaid, String.class);
@@ -97,7 +103,7 @@ public class MESServiceImpl implements MESService {
                 return ApiResponse.failRsp("10013",request.getHeader("RequestId"),"检测到" + chekQty + ",本次数量超出可转数量!");
             }
             if ("VerifyApply!ToPurcIn".equals(caller)) {
-                // 判断该收料通知单是否已经转入过采购验收单
+                // 判断该收料单是否已经转入过采购验收单
                 Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
                 code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and " + "PI_REFNO='采购收料单' and pi_class='采购验收单'");
                 if (code != null && !code.equals("")) {
@@ -105,13 +111,21 @@ public class MESServiceImpl implements MESService {
                 }
             }
             if ("VerifyApply!ToOtherIn".equals(caller)) {
-                // 判断该收料通知单是否已经转入过采购验收
+                // 判断该收料单是否已经转入过其它入库
                 Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
                 code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and PI_REFNO='采购收料单' and pi_class='其它入库单'");
                 if (code != null && !code.equals("")) {
                     return ApiResponse.failRsp("10014", request.getHeader("RequestId"), "该收料单已转入过其它入库单,单号[" + code + "]");
                 }
             }
+            if ("VerifyApply!ToOutsideCheckIn".equals(caller)) {
+                // 判断该收料单是否已经转入过委外验收单
+                Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
+                code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and PI_REFNO='采购收料单' and pi_class='委外验收单'");
+                if (code != null && !code.equals("")) {
+                    return ApiResponse.failRsp("10014", request.getHeader("RequestId"), "该收料单已转入过委外验收单,单号[" + code + "]");
+                }
+            }
             sellerName = StringUtil.nvl(jsonObject.get("sellerName"), "管理员");
         }
         JSONArray array = data.get("detail");
@@ -147,6 +161,7 @@ public class MESServiceImpl implements MESService {
         // 转入明细
         transferRepository.transferDetail(caller, vaid, key,employee);
         if (piid != 0) {
+            baseDao.execute("delete from prodiodetail where nvl(pd_inqty,0)<=0 and pd_piid="+piid);
             baseDao.updateByCondition("prodiodetail", "pd_whcode='"+warehouses[0]+"',pd_whname='"+warehouses[1]+"'", "pd_piid=" + piid);
             baseDao.updateByCondition("prodinout", "pi_whcode='"+warehouses[0]+"',pi_whname='"+warehouses[1]+"'", "pi_id=" + piid);
             baseDao.execute("update prodiodetail set pd_prodid=(select pr_id from product where pd_prodcode=pr_code) where pd_piid=" + piid

+ 1 - 1
src/main/java/com/uas/eis/service/Impl/ScheduleTaskServiceImpl.java

@@ -80,7 +80,7 @@ public class ScheduleTaskServiceImpl implements ScheduleTaskService {
             if (count>0){
                 status="C";
             }
-            Make make = baseDao.getJdbcTemplate().queryForObject("select ma_code,ma_prodcode,ma_qty,nvl(cu_mescode,'BYT') ma_custcode,pr_unit,pr_detail,pr_spec,ma_salecode,to_char(ma_planbegindate,'yyyy-MM-dd') ma_planbegindate,to_char(ma_planenddate,'yyyy-MM-dd') ma_planenddate,nvl(ma_cop,'BYT') ma_cop,'"+status+"' status,to_char(ma_date,'yyyy-MM-dd HH24:mi:ss') ma_date,ma_recorder,nvl(ma_version,0) ma_version,erpid,wc_id,'0' ma_kind,to_char(ma_modifydate,'yyyy-MM-dd HH24:mi:ss') ma_modifydate,ma_modifier,flag from mes_make left join product on ma_prodcode=pr_code left join workcenter on ma_wccode=wc_code left join customer on ma_custcode=cu_code where id=?",new BeanPropertyRowMapper<Make>(Make.class),rs.getInt("id"));
+            Make make = baseDao.getJdbcTemplate().queryForObject("select ma_code,ma_prodcode,ma_qty,nvl(cu_mescode,'BYT') ma_custcode,pr_unit,pr_detail,pr_spec,ma_salecode,to_char(ma_planbegindate,'yyyy-MM-dd') ma_planbegindate,to_char(ma_planenddate,'yyyy-MM-dd') ma_planenddate,nvl(ma_cop,'BYT') ma_cop,'"+status+"' status,to_char(ma_date,'yyyy-MM-dd HH24:mi:ss') ma_date,ma_recorder,nvl(ma_version,0) ma_version,erpid,wc_id,nvl(mk_id,0) ma_kind,to_char(ma_modifydate,'yyyy-MM-dd HH24:mi:ss') ma_modifydate,ma_modifier,flag from mes_make left join MakeKind on ma_kind=mk_name left join product on ma_prodcode=pr_code left join workcenter on ma_wccode=wc_code left join customer on ma_custcode=cu_code where id=?",new BeanPropertyRowMapper<Make>(Make.class),rs.getInt("id"));
             make.setMesPwd(MD5Util.encodeByMD5(tokenConfig.get("mesPwd")));
             make.setMesUser(tokenConfig.get("mesUser"));
             Map<String, Object> map = syncMES(JSON.toJSONString(make, SerializerFeature.WriteMapNullValue).replace("null", "\"\""), tokenConfig.get("syncMakeBase"));