Browse Source

【华信科小米EDI对接】【7-外部供应商推送ASN箱单信息至小米SRM公用X5同步接口】【新增】

wub 5 months ago
parent
commit
4ea3502cb1

+ 34 - 0
src/main/java/com/uas/eis/sdk/dto/ASNBoxItem.java

@@ -0,0 +1,34 @@
+package com.uas.eis.sdk.dto;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+@Data
+public class ASNBoxItem {
+
+    @JsonProperty("BOX_SEQ")
+    private String BOX_SEQ;
+    @JsonProperty("BOX_NUM")
+    private String BOX_NUM;
+    @JsonProperty("CARTON_ID")
+    private String CARTON_ID;
+    @JsonProperty("MATERIAL_NUM")
+    private String MATERIAL_NUM;
+    @JsonProperty("SUPP_MAT_NUM")
+    private String SUPP_MAT_NUM;
+    @JsonProperty("SHIP_QTY")
+    private String SHIP_QTY;
+    @JsonProperty("MODELNUMBER")
+    private String MODELNUMBER;
+    @JsonProperty("BRAND")
+    private String BRAND;
+    @JsonProperty("COUNTRY_ORIGIN")
+    private String COUNTRY_ORIGIN;
+    @JsonProperty("NETWEI_PERPC")
+    private String NETWEI_PERPC;
+    @JsonProperty("DATE_CODE")
+    private String DATE_CODE;
+    @JsonProperty("PRODUCTION_LOT")
+    private String PRODUCTION_LOT;
+
+}

+ 28 - 0
src/main/java/com/uas/eis/sdk/dto/ASNBoxMain.java

@@ -0,0 +1,28 @@
+package com.uas.eis.sdk.dto;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ASNBoxMain {
+
+    @JsonProperty("SYSTEMID")
+    private String SYSTEMID;
+    @JsonProperty("GUID")
+    private String GUID;
+    @JsonProperty("MIASN_NUM")
+    private String MIASN_NUM;
+    @JsonProperty("DELIVERY_NOTICE")
+    private String DELIVERY_NOTICE;
+    @JsonProperty("SUPPLIER_CODE")
+    private String SUPPLIER_CODE;
+    @JsonProperty("SUPPLIER_NAME")
+    private String SUPPLIER_NAME;
+    @JsonProperty("OPERATE_TIME")
+    private String OPERATE_TIME;
+    @JsonProperty("IT_ASN_PACK")
+    private List<ASNBoxItem> IT_ASN_PACK;
+
+}

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

@@ -15,5 +15,5 @@ public interface ERPService {
     Map<String, Object> closePurchase(String data);
     Map<String, Object> deliInstruction(String data);
     Map<String, Object> createASN(String id);
-    Map<String, Object> createPACKINGASN(String id);
+    Map<String, Object> createPackingASN(String id);
 }

+ 47 - 2
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -472,8 +472,53 @@ public class ERPServiceImpl implements ERPService {
     }
 
     @Override
-    public Map<String, Object> createPACKINGASN(String id) {
-        return null;
+    public Map<String, Object> createPackingASN(String id) {
+        Map<String, Object> data = new HashMap<>();
+        UUID uuid = UUID.randomUUID();
+        ASNBoxMain asnBoxMain = new ASNBoxMain();
+        asnBoxMain.setSYSTEMID("SRM");
+        asnBoxMain.setGUID(uuid.toString().replaceAll("-", "").toUpperCase());
+        SqlRowList rs = baseDao.queryForRowSet("select * from asnBoxXM where asnb_id=" + id);
+        // 获取当前日期
+        Date currentDate = new Date();
+        // 创建SimpleDateFormat对象,指定格式
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        SimpleDateFormat hhmmss = new SimpleDateFormat("yyyyMMddHHMMSS");
+        Map<String, Object> result = new HashMap<>();
+        if (rs.next()){
+            String asn_code = rs.getGeneralString("asn_code");
+            asnBoxMain.setMIASN_NUM(rs.getGeneralString("miasn_num"));
+            asnBoxMain.setDELIVERY_NOTICE(rs.getGeneralString("delivery_notice"));
+            asnBoxMain.setSUPPLIER_CODE(rs.getGeneralString("supplier_code"));
+            asnBoxMain.setSUPPLIER_NAME(rs.getGeneralString("supplier_name"));
+            asnBoxMain.setOPERATE_TIME(rs.getGeneralString("operate_time"));
+            List<ASNBoxItem> IT_ASN_PACK = new ArrayList<>();
+            SqlRowList rs_asnbDetail = baseDao.queryForRowSet("select * from asnboxDetailXM where asnbd_asnbid=" + id);
+            if (rs_asnbDetail.next()){
+                ASNBoxItem asnBoxItem = new ASNBoxItem();
+                asnBoxItem.setBOX_SEQ(rs_asnbDetail.getGeneralString("box_seq"));
+                asnBoxItem.setBOX_NUM(rs_asnbDetail.getGeneralString("box_num"));
+                asnBoxItem.setCARTON_ID(rs_asnbDetail.getGeneralString("carton_id"));
+                asnBoxItem.setMATERIAL_NUM(rs_asnbDetail.getGeneralString("material_num"));
+                asnBoxItem.setSUPP_MAT_NUM(rs_asnbDetail.getGeneralString("supp_mat_num"));
+                asnBoxItem.setSHIP_QTY(rs_asnbDetail.getGeneralString("ship_qty"));
+                asnBoxItem.setMODELNUMBER(rs_asnbDetail.getGeneralString("modelnumber"));
+                asnBoxItem.setBRAND(rs_asnbDetail.getGeneralString("brand"));
+                asnBoxItem.setCOUNTRY_ORIGIN(rs_asnbDetail.getGeneralString("country_origin"));
+                asnBoxItem.setNETWEI_PERPC(rs_asnbDetail.getGeneralString("netwei_perpc"));
+                asnBoxItem.setDATE_CODE(rs_asnbDetail.getGeneralString("date_code"));
+                asnBoxItem.setPRODUCTION_LOT(rs_asnbDetail.getGeneralString("production_lot"));
+                IT_ASN_PACK.add(asnBoxItem);
+            }
+            asnBoxMain.setIT_ASN_PACK(IT_ASN_PACK);
+            //asnMain.setSUPPLIER_CODE("108207");
+            data.put("data", asnBoxMain);
+            EDIX5JsonHttpClient edix5JsonHttpClient = new EDIX5JsonHttpClient(xmediConfiguration.getX5appid(), xmediConfiguration.getX5appkey(), xmediConfiguration.getX5createAsnBoxUrl());
+            X5Response<Object> createAsn = edix5JsonHttpClient.post(data, xmediConfiguration, baseDao, "CreateAsn");
+            result.put("header", createAsn.getHeader());
+            result.put("body", createAsn.getBody());
+        }
+        return result;
     }
 
     public static String unescapeJsonWithJackson(String jsonString) {

+ 5 - 0
src/main/java/com/uas/eis/task/httpclient/EDIX5JsonHttpClient.java

@@ -40,7 +40,12 @@ public class EDIX5JsonHttpClient extends X5HttpClient {
             kind="采购订单确认";
         }else if("CreateAsn".equals(type)){
             kind="创建ASN";
+        }else if("CreateAsnBox".equals(type)){
+            kind="创建ASNBox";
+        }else if("PurchasePrint".equals(type)){
+            kind="采购单打印";
         }
+
         X5Response<T> x5Response;
         if (X5StringUtils.isEmpty(appid) || X5StringUtils.isEmpty(appkey) || X5StringUtils.isEmpty(url)) {
             throw new X5Exception("1016", "The request at least contains appid appkey and url.");

+ 22 - 0
src/main/java/com/uas/eis/utils/XMEDIConfiguration.java

@@ -84,6 +84,12 @@ public class XMEDIConfiguration {
     @Value("${xmedi.x5createAsnUrl}")
     private String x5createAsnUrl;
 
+    @Value("${xmedi.x5createAsnBoxUrl}")
+    private String x5createAsnBoxUrl;
+
+    @Value("${xmedi.x5PurchasePrintUrl}")
+    private String x5PurchasePrintUrl;
+
     public String getUsername() {
         return username;
     }
@@ -195,4 +201,20 @@ public class XMEDIConfiguration {
     public void setX5createAsnUrl(String x5createAsnUrl) {
         this.x5createAsnUrl = x5createAsnUrl;
     }
+
+    public String getX5createAsnBoxUrl() {
+        return x5createAsnBoxUrl;
+    }
+
+    public void setX5createAsnBoxUrl(String x5createAsnBoxUrl) {
+        this.x5createAsnBoxUrl = x5createAsnBoxUrl;
+    }
+
+    public String getX5PurchasePrintUrl() {
+        return x5PurchasePrintUrl;
+    }
+
+    public void setX5PurchasePrintUrl(String x5PurchasePrintUrl) {
+        this.x5PurchasePrintUrl = x5PurchasePrintUrl;
+    }
 }

+ 3 - 1
src/main/resources/application-prod.yml

@@ -5,7 +5,7 @@ spring:
         username: LHWX_HK_P
         password: select!#%*(
        # url: jdbc:oracle:thin:@113.108.118.106:1521:orcl
-        url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
+         url: jdbc:oracle:thin:@127.0.0.1:1521:orcl
       #url: jdbc:oracle:thin:@usoft.f3322.net:11561:orcl
 
     redis:
@@ -94,5 +94,7 @@ xmedi:
     x5ProductStockUrl: https://mipop.p.mi.com/HttpAdapter/HttpMessageServlet?interfaceNamespace=http://xiaomi.com/oem/dummy&interface=SI_MI_OEM_IF123_VENDOR_STOCK_S_OUT&senderService=HK_INFOTM_PRD&qos=BE
     x5confirmUrl: https://mipoq.p.mi.com/RESTAdapter/srm/b2b_api/infotm/purchase-order/confirm
     x5createAsnUrl: https://mipoq.p.mi.com/RESTAdapter/srm/b2b_api/infotm/asn/create
+    x5createAsnBoxUrl: https://mipoq.p.mi.com/RESTAdapter/srm/b2b_api/infotm/asn-packing-list/push
+    x5PurchasePrintUrl: https://mipoq.p.mi.com/RESTAdapter/srm/b2b_api/infotm/asn/print
     x5vendercode: 108207
     x5vendercodeSZ: 108717