Browse Source

增加补料单

koul 3 years ago
parent
commit
0df5f4e9cc

+ 1 - 1
src/main/java/com/uas/eis/controller/ERPController.java

@@ -51,7 +51,7 @@ public class ERPController {
     }
 
     /**
-     *推送料单
+     *推送料单
      * @param data
      * @return
      */

+ 44 - 6
src/main/java/com/uas/eis/entity/ProdInOutMakeGive.java

@@ -11,16 +11,54 @@ import java.util.List;
  */
 public class ProdInOutMakeGive {
 
-    @JSONField(name = "fInterID")
-    private int pi_id;
-    @JSONField(name = "Code")
-    private String pi_inoutno;
     @JSONField(name = "mesUser")
     private String mesUser;
     @JSONField(name = "mesPwd")
     private String mesPwd;
-    @JSONField(name = "flag")
-    private int flag;
+    @JSONField(name = "prodNo")
+    private String maCodes;
+    @JSONField(name = "feedNo")
+    private String pi_inoutno;
     @JSONField(name = "detail")
     private List<ProdInOutMakeGiveDetail> detail;
+
+    public String getMesUser() {
+        return mesUser;
+    }
+
+    public void setMesUser(String mesUser) {
+        this.mesUser = mesUser;
+    }
+
+    public String getMesPwd() {
+        return mesPwd;
+    }
+
+    public void setMesPwd(String mesPwd) {
+        this.mesPwd = mesPwd;
+    }
+
+    public String getMaCodes() {
+        return maCodes;
+    }
+
+    public void setMaCodes(String maCodes) {
+        this.maCodes = maCodes;
+    }
+
+    public String getPi_inoutno() {
+        return pi_inoutno;
+    }
+
+    public void setPi_inoutno(String pi_inoutno) {
+        this.pi_inoutno = pi_inoutno;
+    }
+
+    public List<ProdInOutMakeGiveDetail> getDetail() {
+        return detail;
+    }
+
+    public void setDetail(List<ProdInOutMakeGiveDetail> detail) {
+        this.detail = detail;
+    }
 }

+ 1 - 40
src/main/java/com/uas/eis/entity/ProdInOutMakeGiveDetail.java

@@ -9,21 +9,6 @@ import com.alibaba.fastjson.annotation.JSONField;
  */
 public class ProdInOutMakeGiveDetail {
 
-    /**
-     * MES用户
-     */
-    @JSONField(name = "mesUser")
-    private String mesUser;
-    /**
-     *	MES密码,MD5加密	String
-     */
-    @JSONField(name = "mesPwd")
-    private String mesPwd;
-    /**
-     * 补料单号
-     */
-    @JSONField(name = "journalNo")
-    private String pi_inoutno;
     /**
      *	工令单号	String
      */
@@ -32,7 +17,7 @@ public class ProdInOutMakeGiveDetail {
     /**
      *	工令BOMID
      */
-    @JSONField(name = "lineId")
+    @JSONField(name = "bomId")
     private Integer mm_id;
     /**
      *	物料编号	String
@@ -75,30 +60,6 @@ public class ProdInOutMakeGiveDetail {
     @JSONField(name = "flag")
     private Integer flag;
 
-    public String getMesUser() {
-        return mesUser;
-    }
-
-    public void setMesUser(String mesUser) {
-        this.mesUser = mesUser;
-    }
-
-    public String getMesPwd() {
-        return mesPwd;
-    }
-
-    public void setMesPwd(String mesPwd) {
-        this.mesPwd = mesPwd;
-    }
-
-    public String getPi_inoutno() {
-        return pi_inoutno;
-    }
-
-    public void setPi_inoutno(String pi_inoutno) {
-        this.pi_inoutno = pi_inoutno;
-    }
-
     public String getPd_ordercode() {
         return pd_ordercode;
     }

+ 8 - 6
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -73,7 +73,7 @@ public class ERPServiceImpl implements ERPService {
     public ApiResult<String> syncUpdateReceiveByErp(String data) {
         try {
             Map<Object, Object> store = BaseUtil.parseFormStoreToMap(data);
-            VerifyApply verifyApply = baseDao.getJdbcTemplate().queryForObject("select va_id,va_mescode,va_code,to_char(va_date,'yyyy-MM-dd HH24:mi:ss') va_date,va_vendcode,va_vendname,va_currency,va_rate,va_paymentscode,va_payments,va_transport,va_sendcode,va_emcode,va_emname,va_departmentcode,va_department,va_recorder,case when nvl(va_cop,' ')=' ' then 'BYT' else va_cop end va_cop,va_remark,va_ancode,va_factory,0 version,va_type,va_pucode,case when nvl(va_pucode,' ')=' ' then 0 else (select pu_id from purchase where pu_code=va_pucode) end pu_id,va_status,1 posted,to_char(va_auditdate,'yyyy-MM-dd HH24:mi:ss') va_auditdate,va_auditman,va_custcode,va_custname from VerifyApply where va_id=?",
+            VerifyApply verifyApply = baseDao.getJdbcTemplate().queryForObject("select va_id,va_mescode,va_code,to_char(va_date,'yyyy-MM-dd HH24:mi:ss') va_date,va_vendcode,va_vendname,va_currency,va_rate,va_paymentscode,va_payments,va_transport,va_sendcode,va_emcode,va_emname,va_departmentcode,va_department,va_recorder,'BYT' va_cop,va_remark,va_ancode,va_factory,0 version,va_type,va_pucode,case when nvl(va_pucode,' ')=' ' then 0 else (select pu_id from purchase where pu_code=va_pucode) end pu_id,va_status,1 posted,to_char(va_auditdate,'yyyy-MM-dd HH24:mi:ss') va_auditdate,va_auditman,va_custcode,va_custname from VerifyApply where va_id=?",
                     new BeanPropertyRowMapper<VerifyApply>(VerifyApply.class), store.get("va_id"));
             SqlRowList rs = baseDao.queryForRowSet("select case when va_custcode='AR214' or nvl(va_custcode,' ')=' ' then 'BYT' else nvl(cu_mescode,cu_code) end cu_code,cu_name from verifyapply left join customer on va_custcode=cu_code where va_id="+store.get("va_id"));
             if (rs.next()){
@@ -150,13 +150,15 @@ public class ERPServiceImpl implements ERPService {
             String mesUser = tokenConfig.get("mesUser");
             String mesPwd = MD5Util.encodeByMD5(tokenConfig.get("mesPwd"));
             int flag = Integer.parseInt(StringUtil.nvl(store.get("flag"), "-1"));
-            List<ProdInOutMakeGiveDetail> prodInOutMakeGiveDetails = baseDao.query("select '"+mesUser+"' mesUser,'"+mesPwd+"' mesPwd," +
-                    "pi_inoutno,pd_ordercode,mm_id,pd_prodcode,pd_outqty," +
-                    "case when pr_kh_user='柏英特' or nvl(pr_kh_user,' ')=' ' then 'BYT' else nvl(cu_mescode,cu_code) end pi_cop," +
-                    "cu_name,pi_recordman,to_char(pi_recorddate,'yyyy-MM-dd HH24:mi:ss') pi_recorddate,pi_updateman," +
+            ProdInOutMakeGive prodInOutMakeGive = baseDao.getJdbcTemplate().queryForObject("select '"+mesUser+"' mesUser,'"+mesPwd+"' mesPwd,(select wm_concat(distinct pd_ordercode) from prodiodetail where pd_piid=pi_id) maCodes,pi_inoutno from prodinout where pi_id=?",
+                    new BeanPropertyRowMapper<ProdInOutMakeGive>(ProdInOutMakeGive.class), store.get("pi_id"));
+
+            List<ProdInOutMakeGiveDetail> prodInOutMakeGiveDetails = baseDao.query("select pd_ordercode,mm_id,pd_prodcode,pd_outqty," +
+                    "'BYT' pi_cop,pi_recordman,to_char(pi_recorddate,'yyyy-MM-dd HH24:mi:ss') pi_recorddate,pi_updateman," +
                     "case when pi_updatedate is not null then to_char(pi_updatedate,'yyyy-MM-dd HH24:mi:ss') else null end pi_updatedate,"+flag+" flag " +
                     "from prodiodetail left join prodinout on pd_piid=pi_id left join product on pd_prodcode=pr_code left join customer on cu_shortname=pr_kh_user left join MakeMaterial on pd_ordercode=mm_code and pd_orderdetno=mm_detno where nvl(pd_outqty,0)>nvl((select sum(ba_remain) from batch where nvl(ba_macode,' ')=pd_ordercode and pd_prodcode=ba_prodcode and ba_whcode in (select wh_code from Warehouse where wh_statuscode='AUDITED' and wh_description like '%线边仓%') and nvl(ba_remain,0)>0),0) and pi_id=" + store.get("pi_id"), ProdInOutMakeGiveDetail.class);
-            return syncMES(JSON.toJSONString(prodInOutMakeGiveDetails, SerializerFeature.WriteMapNullValue).replace("null","\"\""),tokenConfig.get("syncProdInOutMakeGive"));
+            prodInOutMakeGive.setDetail(prodInOutMakeGiveDetails);
+            return syncMES(JSON.toJSONString(prodInOutMakeGive, SerializerFeature.WriteMapNullValue).replace("null","\"\""),tokenConfig.get("syncProdInOutMakeGive"));
         }catch (Exception e){
             logger.error("同步补料单异常信息:"+e.getMessage());
             e.printStackTrace();