1
0
Переглянути джерело

修复 Eccs 拉取 OMS 仓库库存和门店库存功能

lvjian 2 роки тому
батько
коміт
325a970a4f

+ 7 - 1
eccs-biz/src/main/java/com/emato/biz/mapper/warehouse/WbInveMngMapper.java

@@ -19,6 +19,12 @@ public interface WbInveMngMapper {
      * @param oWbInveMng 库存管理
      * @return 库存管理,wms入库回传时,增加库存数集合
      */
-    public List<OWbInveMng> selectWbInveMngList(OWbInveMng oWbInveMng);
+    List<OWbInveMng> selectWbInveMngList(OWbInveMng oWbInveMng);
 
+    /**
+     * 保存或修改仓库库存
+     *
+     * @param oWbInveMng
+     */
+    void saveOrUpdate(OWbInveMng oWbInveMng);
 }

+ 7 - 0
eccs-biz/src/main/java/com/emato/biz/mapper/warehouse/WbMerchShopInveMapper.java

@@ -22,4 +22,11 @@ public interface WbMerchShopInveMapper {
      */
     List<OWbMerchShopInve> selectWbMerchShopInveList(OWbMerchShopInve oWbMerchShopInve);
 
+    /**
+     * 保存或修改商户门店库存
+     *
+     * @param oWbMerchShopInve
+     */
+    void saveOrUpdate(OWbMerchShopInve oWbMerchShopInve);
+
 }

+ 2 - 8
eccs-biz/src/main/java/com/emato/biz/service/impl/OWbInveMngServiceImpl.java

@@ -157,28 +157,22 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
         String timestamp = String.valueOf(System.currentTimeMillis()/1000);
         sParaTemp.put("timestamp", timestamp);
         //生成要请求给oms秘钥
-//        String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
         LOGGER.info("md5混淆码参数:" + OmsConfig.getMd5Salt());
         String sign = OmsSign.sign(sParaTemp,OmsConfig.getMd5Salt());
         sParaTemp.put("sign", sign);
         //构建Request
         String  url = OmsConfig.getQueryMngInveUrl();
-//        url = "http://127.0.0.1:8680/al/shop/order/query";
         String jsonParam = JSONObject.toJSONString(sParaTemp);
         Request request = OkHttpUtils.buildRequest(jsonParam,url,"");
         LOGGER.info("oms的请求报文:" + request);
         // 同步访问,返回结果字符串
         String responseString = null;
         try {
-            // url = "http://120.76.26.84:8680/al/queryOmsInfo/queryInveMng";
             JSONObject jsonObject = httpPost(url,JSONObject.parseObject(jsonParam));
-//            responseString = OkHttpUtils.post(request,null);
-
 
             LOGGER.info("oms的响应报文"+jsonObject.toString());
 
             //解析响应数据
-//            JSONObject jsonObject = JSONObject.parseObject(responseString);
             JSONArray result = (JSONArray) jsonObject.get("data");
             Object msg = jsonObject.get("msg");
             Object code = jsonObject.get("code");
@@ -192,8 +186,8 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
 
                 JSONObject o = (JSONObject) result.get(i);
                 OWbInveMng oWbInveMng = o.toJavaObject(OWbInveMng.class);
-    //                OWbInveMng wb = (OWbInveMng) o;
-                oWbInveMngMapper.saveOrUpdate(oWbInveMng);
+                //oWbInveMngMapper.saveOrUpdate(oWbInveMng);
+                wbInveMngMapper.saveOrUpdate(oWbInveMng);
             }
 
             if("202".equals(code)){

+ 4 - 7
eccs-biz/src/main/java/com/emato/biz/service/impl/OWbMerchShopInveServiceImpl.java

@@ -141,14 +141,12 @@ public class OWbMerchShopInveServiceImpl implements IOWbMerchShopInveService
         sParaTemp.put("merchId",OmsConfig.getMerchSn());
         String timestamp = String.valueOf(System.currentTimeMillis()/1000);
         sParaTemp.put("timestamp", timestamp);
-        //生成要请求给oms秘钥
-//        String sign = OmsSign.sign(sParaTemp,cus.getWaybill().get("secret-key"));
+        //生成要请求给 oms 秘钥
         LOGGER.info("md5混淆码参数:" + OmsConfig.getMd5Salt());
         String sign = OmsSign.sign(sParaTemp,OmsConfig.getMd5Salt());
         sParaTemp.put("sign", sign);
-        //构建Request
+        //构建 Request
         String  url = OmsConfig.getQueryShopMngInveUrl();
-//        url = "http://127.0.0.1:8680/al/shop/order/query";
         Request request = OkHttpUtils.buildRequest(url, JSON.toJSONString(sParaTemp));
         LOGGER.info("oms的请求报文:" + request);
         // 同步访问,返回结果字符串
@@ -160,8 +158,6 @@ public class OWbMerchShopInveServiceImpl implements IOWbMerchShopInveService
         } catch (Exception e) {
             LOGGER.error("拉取 OMS 门店库存数据异常 => ", e);
             throw new ServiceException("拉取 OMS 门店库存数据异常");
-            //return 1;
-//            throw e;
         }
 
         try {
@@ -182,7 +178,8 @@ public class OWbMerchShopInveServiceImpl implements IOWbMerchShopInveService
 
                 JSONObject o = (JSONObject) result.get(i);
                 OWbMerchShopInve oWbMerchShopInve = o.toJavaObject(OWbMerchShopInve.class);
-                oWbMerchShopInveMapper.saveOrUpdate(oWbMerchShopInve);
+                //oWbMerchShopInveMapper.saveOrUpdate(oWbMerchShopInve);
+                wbMerchShopInveMapper.saveOrUpdate(oWbMerchShopInve);
             }
         } catch (Exception e) {
             LOGGER.error("拉取 OMS 数据后,插入数据异常 => ", e);

+ 2 - 4
eccs-biz/src/main/resources/mapper/biz/warehouse/OWbInveMngMapper.xml

@@ -196,8 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             creater_sn,
             create_time,
             moder_sn,
-            mod_time,
-            tstm
+            mod_time
             )
             values (
 
@@ -227,8 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{createrSn},
             #{createTime},
             #{moderSn},
-            #{modTime},
-            #{tstm}
+            #{modTime}
             )
             ON DUPLICATE KEY UPDATE
             inve_status = #{inveStatus},

+ 77 - 0
eccs-biz/src/main/resources/mapper/biz/warehouse/WbInveMngMapper.xml

@@ -81,4 +81,81 @@
         </where>
     </select>
 
+    <insert id="saveOrUpdate">
+        insert into wb_inve_mng
+        (
+            inve_sn,
+            merch_sn,
+            merch_name,
+            ems_class_code,
+            sku,
+            inve_status,
+            ware_sn,
+            cus_code,
+            bonded_code,
+            inve_num,
+            valid_num,
+            freeze_num,
+            ex_ware_num,
+            return_num,
+            expire_num,
+            check_add_num,
+            check_cut_num,
+            damage_num,
+            spot_check_num,
+            arrived_add_num,
+            arrived_cut_num,
+            other_num,
+            is_valid,
+            creater_sn,
+            create_time,
+            moder_sn,
+            mod_time
+        )
+        values (
+           #{inveSn},
+           #{merchSn},
+           #{merchName},
+           #{emsClassCode},
+           #{sku},
+           #{inveStatus},
+           #{wareSn},
+           #{cusCode},
+           #{bondedCode},
+           #{inveNum},
+           #{validNum},
+           #{freezeNum},
+           #{exWareNum},
+           #{returnNum},
+           #{expireNum},
+           #{checkAddNum},
+           #{checkCutNum},
+           #{damageNum},
+           #{spotCheckNum},
+           #{arrivedAddNum},
+           #{arrivedCutNum},
+           #{otherNum},
+           #{isValid},
+           #{createrSn},
+           #{createTime},
+           #{moderSn},
+           #{modTime}
+        ) ON DUPLICATE KEY UPDATE
+         inve_status = #{inveStatus},
+         inve_num = #{inveNum},
+         valid_num = #{validNum},
+         freeze_num = #{freezeNum},
+         ex_ware_num = #{exWareNum},
+         return_num = #{returnNum},
+         expire_num = #{expireNum},
+         check_add_num= #{checkAddNum},
+         check_cut_num= #{checkCutNum},
+         damage_num= #{damageNum},
+         spot_check_num= #{spotCheckNum},
+         arrived_add_num= #{arrivedAddNum},
+         arrived_cut_num = #{arrivedCutNum},
+         other_num = #{otherNum},
+         is_valid= #{isValid}
+    </insert>
+
 </mapper>

+ 104 - 0
eccs-biz/src/main/resources/mapper/biz/warehouse/WbMerchShopInveMapper.xml

@@ -97,5 +97,109 @@
         </where>
     </select>
 
+    <!-- 保存或修改商户门店库存 -->
+    <insert id="saveOrUpdate">
+        insert into wb_merch_shop_inve
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="shopInveSn != null">shop_inve_sn,</if>
+            <if test="shopSn != null">shop_sn,</if>
+            <if test="merchSn != null">merch_sn,</if>
+            <if test="merchName != null">merch_name,</if>
+            <if test="thirdPartyMerchCode != null">third_party_merch_code,</if>
+            <if test="thirdPartyMerchName != null">third_party_merch_name,</if>
+            <if test="sku != null">sku,</if>
+            <if test="cusCode != null">cus_code,</if>
+            <if test="bondedCode != null">bonded_code,</if>
+            <if test="wareSn != null">ware_sn,</if>
+            <if test="goodsBizType != null">goods_biz_type,</if>
+            <if test="shopInve != null">shop_inve,</if>
+            <if test="shopValid != null">shop_valid,</if>
+            <if test="shopFreezeNum != null">shop_freeze_num,</if>
+            <if test="shopDamageNum != null">shop_damage_num,</if>
+            <if test="shopDestroyLostNum != null">shop_destroy_lost_num,</if>
+            <if test="shopExpireNum != null">shop_expire_num,</if>
+            <if test="shopSampleFreezeNum != null">shop_sample_freeze_num,</if>
+            <if test="shopMinus != null">shop_minus,</if>
+            <if test="shopSupp != null">shop_supp,</if>
+            <if test="inQty != null">in_qty,</if>
+            <if test="outQty != null">out_qty,</if>
+            <if test="returnQty != null">return_qty,</if>
+            <if test="saleQty != null">sale_qty,</if>
+            <if test="locInQty != null">loc_in_qty,</if>
+            <if test="locOutQty != null">loc_out_qty,</if>
+            <if test="isValid != null">is_valid,</if>
+            <if test="createrSn != null">creater_sn,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="moderSn != null">moder_sn,</if>
+            <if test="modTime != null">mod_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="shopInveSn != null">#{shopInveSn},</if>
+            <if test="shopSn != null">#{shopSn},</if>
+            <if test="merchSn != null">#{merchSn},</if>
+            <if test="merchName != null">#{merchName},</if>
+            <if test="thirdPartyMerchCode != null">#{thirdPartyMerchCode},</if>
+            <if test="thirdPartyMerchName != null">#{thirdPartyMerchName},</if>
+            <if test="sku != null">#{sku},</if>
+            <if test="cusCode != null">#{cusCode},</if>
+            <if test="bondedCode != null">#{bondedCode},</if>
+            <if test="wareSn != null">#{wareSn},</if>
+            <if test="goodsBizType != null">#{goodsBizType},</if>
+            <if test="shopInve != null">#{shopInve},</if>
+            <if test="shopValid != null">#{shopValid},</if>
+            <if test="shopFreezeNum != null">#{shopFreezeNum},</if>
+            <if test="shopDamageNum != null">#{shopDamageNum},</if>
+            <if test="shopDestroyLostNum != null">#{shopDestroyLostNum},</if>
+            <if test="shopExpireNum != null">#{shopExpireNum},</if>
+            <if test="shopSampleFreezeNum != null">#{shopSampleFreezeNum},</if>
+            <if test="shopMinus != null">#{shopMinus},</if>
+            <if test="shopSupp != null">#{shopSupp},</if>
+            <if test="inQty != null">#{inQty},</if>
+            <if test="outQty != null">#{outQty},</if>
+            <if test="returnQty != null">#{returnQty},</if>
+            <if test="saleQty != null">#{saleQty},</if>
+            <if test="locInQty != null">#{locInQty},</if>
+            <if test="locOutQty != null">#{locOutQty},</if>
+            <if test="isValid != null">#{isValid},</if>
+            <if test="createrSn != null">#{createrSn},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="moderSn != null">#{moderSn},</if>
+            <if test="modTime != null">#{modTime},</if>
+        </trim>
+
+        ON DUPLICATE KEY UPDATE
+        <trim prefix="" suffixOverrides=",">
+            <if test="shopSn != null">shop_sn = #{shopSn},</if>
+            <if test="merchSn != null">merch_sn = #{merchSn},</if>
+            <if test="merchName != null">merch_name = #{merchName},</if>
+            <if test="thirdPartyMerchCode != null">third_party_merch_code = #{thirdPartyMerchCode},</if>
+            <if test="thirdPartyMerchName != null">third_party_merch_name = #{thirdPartyMerchName},</if>
+            <if test="sku != null">sku = #{sku},</if>
+            <if test="cusCode != null">cus_code = #{cusCode},</if>
+            <if test="bondedCode != null">bonded_code = #{bondedCode},</if>
+            <if test="wareSn != null">ware_sn = #{wareSn},</if>
+            <if test="goodsBizType != null">goods_biz_type = #{goodsBizType},</if>
+            <if test="shopInve != null">shop_inve = #{shopInve},</if>
+            <if test="shopValid != null">shop_valid = #{shopValid},</if>
+            <if test="shopFreezeNum != null">shop_freeze_num = #{shopFreezeNum},</if>
+            <if test="shopDamageNum != null">shop_damage_num = #{shopDamageNum},</if>
+            <if test="shopDestroyLostNum != null">shop_destroy_lost_num = #{shopDestroyLostNum},</if>
+            <if test="shopExpireNum != null">shop_expire_num = #{shopExpireNum},</if>
+            <if test="shopSampleFreezeNum != null">shop_sample_freeze_num = #{shopSampleFreezeNum},</if>
+            <if test="shopMinus != null">shop_minus = #{shopMinus},</if>
+            <if test="shopSupp != null">shop_supp = #{shopSupp},</if>
+            <if test="inQty != null">in_qty = #{inQty},</if>
+            <if test="outQty != null">out_qty = #{outQty},</if>
+            <if test="returnQty != null">return_qty = #{returnQty},</if>
+            <if test="saleQty != null">sale_qty = #{saleQty},</if>
+            <if test="locInQty != null">loc_in_qty = #{locInQty},</if>
+            <if test="locOutQty != null">loc_out_qty = #{locOutQty},</if>
+            <if test="isValid != null">is_valid = #{isValid},</if>
+            <if test="createrSn != null">creater_sn = #{createrSn},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="moderSn != null">moder_sn = #{moderSn},</if>
+            <if test="modTime != null">mod_time = #{modTime},</if>
+        </trim>
+    </insert>
 
 </mapper>