Forráskód Böngészése

修改拉取仓库库存按钮

lvjian 2 éve
szülő
commit
9faf6880e5

+ 1 - 0
build.gradle

@@ -173,6 +173,7 @@ subprojects {
         bitwalker_agent = '1.21'
         jsonwebtoken = '0.9.1'
 
+        hutool = '5.8.16'
     }
 }
 

+ 1 - 0
eccs-biz/build.gradle

@@ -33,6 +33,7 @@ dependencies {
     implementation "io.springfox:springfox-swagger2:${swagger}"
     implementation "io.springfox:springfox-swagger-ui:${swagger}"
 
+    implementation "cn.hutool:hutool-all:${hutool}"
 }
 
 test {

+ 2 - 1
eccs-biz/src/main/java/com/emato/biz/controller/warehouse/OWbInveMngController.java

@@ -125,8 +125,9 @@ public class OWbInveMngController extends BaseController
         SysDept sysDept = sysDeptService.selectDeptById(user.getDeptId());
         // 获取当前商户号
         String merchSn = sysDept.getMerchSn();
+        queryVO.setMerchId(merchSn);
 
-        return toAjax(oWbInveMngService.pullInveMng(merchSn));
+        return oWbInveMngService.pullInveMng(queryVO);
     }
 
 }

+ 62 - 11
eccs-biz/src/main/java/com/emato/biz/domain/warehouse/PullInveQueryVO.java

@@ -1,5 +1,7 @@
 package com.emato.biz.domain.warehouse;
 
+import com.emato.biz.config.OmsConfig;
+
 /**
  * 拉取库存 VO
  *
@@ -9,16 +11,56 @@ package com.emato.biz.domain.warehouse;
  */
 public class PullInveQueryVO {
 
-    private String merchSn;
+    /**
+     * 商户号
+     */
+    private String merchId;
+
+    /**
+     * 第三方商户编号
+     */
+    private String thirdMerchId;
 
+    /**
+     * sku
+     */
     private String sku;
 
-    public String getMerchSn() {
-        return merchSn;
+    /**
+     * 页
+     */
+    private Integer page = 1;
+
+    /**
+     * 页数
+     */
+    private Integer limit = 3;
+
+    @Override
+    public String toString() {
+        return "PullInveQueryVO{" +
+                "merchId='" + merchId + '\'' +
+                ", thirdMerchId='" + thirdMerchId + '\'' +
+                ", sku='" + sku + '\'' +
+                ", page=" + page +
+                ", limit=" + limit +
+                '}';
+    }
+
+    public String getThirdMerchId() {
+        return thirdMerchId;
     }
 
-    public void setMerchSn(String merchSn) {
-        this.merchSn = merchSn;
+    public void setThirdMerchId(String thirdMerchId) {
+        this.thirdMerchId = thirdMerchId;
+    }
+
+    public String getMerchId() {
+        return merchId;
+    }
+
+    public void setMerchId(String merchId) {
+        this.merchId = merchId;
     }
 
     public String getSku() {
@@ -29,12 +71,21 @@ public class PullInveQueryVO {
         this.sku = sku;
     }
 
-    @Override
-    public String toString() {
-        return "PullInveQueryVO{" +
-                "merchSn='" + merchSn + '\'' +
-                ", sku='" + sku + '\'' +
-                '}';
+    public Integer getPage() {
+        return page;
     }
 
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+
+
 }

+ 59 - 7
eccs-biz/src/main/java/com/emato/biz/service/impl/OWbInveMngServiceImpl.java

@@ -3,12 +3,18 @@ package com.emato.biz.service.impl;
 import java.io.IOException;
 import java.util.*;
 
+import cn.hutool.http.HttpException;
+import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.emato.biz.config.OmsConfig;
+import com.emato.biz.domain.warehouse.PullInveQueryVO;
 import com.emato.biz.mapper.warehouse.WbInveMngMapper;
+import com.emato.common.core.domain.AjaxResult;
+import com.emato.common.exception.ServiceException;
 import com.emato.common.utils.DateUtils;
+import com.emato.common.utils.oms.JacksonUtils;
 import com.emato.common.utils.oms.OkHttpUtils;
 import com.emato.common.utils.oms.request.OmsSign;
 import okhttp3.Request;
@@ -45,11 +51,57 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
     @Resource
     private WbInveMngMapper wbInveMngMapper;
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(OWbInveMngServiceImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(OWbInveMngServiceImpl.class);
 
 
+    /**
+     * 根据条件拉取 OMS 数据
+     *
+     * @param queryVO
+     * @return
+     */
+    @Override
+    public AjaxResult pullInveMng(PullInveQueryVO queryVO) {
+        // 构建请求报文
+        // 初始化请求 oms 参数 Map
+        Map<String, String> reqOmsPram = new TreeMap<>();
+        queryVO.setThirdMerchId("tmb770630141444423680");
+        // 请求 oms 数据
+        reqOmsPram.put("data", JacksonUtils.toJsonStr(queryVO));
+        // 请求 oms 商户号
+        reqOmsPram.put("merchId", OmsConfig.getMerchSn());
+        log.debug("===== 请求 oms 商户号 ====> {}", OmsConfig.getMerchSn());
+        // 请求 oms 时间戳
+        String timestamp = System.currentTimeMillis()/1000 + "";
+        reqOmsPram.put("timestamp", timestamp);
+        log.debug("===== 请求 oms 时间戳 ====> {}", timestamp);
+        // 请求 oms 签名
+        String sign = OmsSign.sign(reqOmsPram, OmsConfig.getMd5Salt());
+        reqOmsPram.put("sign", sign);
+        // oms 请求地址
+        String url = OmsConfig.getQueryMngInveUrl();
+        log.debug("===== 请求 oms 地址 ====> {}", url);
+        // 请求 oms 报文
+        String reqBody = JacksonUtils.toJsonStr(reqOmsPram);
+        log.debug("===== 请求 oms 报文 ====> {}", reqBody);
+
+        // oms 返回数据
+        String body = null;
+        try {
+            body = HttpRequest.post(url)
+                    .body(JacksonUtils.toJsonStr(reqOmsPram))
+                    .execute()
+                    .body();
+        } catch (Exception e) {
+            throw new ServiceException("请求 OMS 异常!");
+        }
+        log.debug("OMS 响应信息 => {}", body);
 
 
+        // 获取响应,入库
+        return AjaxResult.success("拉取库存成功!");
+    }
+
     /**
      * 查询库存管理,wms入库回传时,增加库存数
      *
@@ -157,20 +209,20 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
         String timestamp = String.valueOf(System.currentTimeMillis()/1000);
         sParaTemp.put("timestamp", timestamp);
         //生成要请求给oms秘钥
-        LOGGER.info("md5混淆码参数:" + OmsConfig.getMd5Salt());
+        log.info("md5混淆码参数:" + OmsConfig.getMd5Salt());
         String sign = OmsSign.sign(sParaTemp,OmsConfig.getMd5Salt());
         sParaTemp.put("sign", sign);
         //构建Request
         String  url = OmsConfig.getQueryMngInveUrl();
         String jsonParam = JSONObject.toJSONString(sParaTemp);
-        LOGGER.info("Eccs 请求 OMS url => {}, 请求 OMS 报文 => {}", url, jsonParam);
+        log.info("Eccs 请求 OMS url => {}, 请求 OMS 报文 => {}", url, jsonParam);
 
         // 同步访问,返回结果字符串
         String responseString = null;
         try {
             JSONObject jsonObject = httpPost(url,JSONObject.parseObject(jsonParam));
 
-            LOGGER.info("oms的响应报文"+jsonObject.toString());
+            log.info("oms的响应报文"+jsonObject.toString());
 
             //解析响应数据
             JSONArray result = (JSONArray) jsonObject.get("data");
@@ -195,7 +247,7 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
             }
 
         } catch (Exception e) {
-            LOGGER.error(e.getMessage());
+            log.error(e.getMessage());
             return 1;
         }
 
@@ -236,13 +288,13 @@ public class OWbInveMngServiceImpl implements IOWbInveMngService
                 }
                 catch (Exception e)
                 {
-                    LOGGER.error("post请求提交失败:" + url, e);
+                    log.error("post请求提交失败:" + url, e);
                 }
             }
         }
         catch (IOException e)
         {
-            LOGGER.error("post请求提交失败:" + url, e);
+            log.error("post请求提交失败:" + url, e);
         }
         finally
         {

+ 11 - 0
eccs-biz/src/main/java/com/emato/biz/service/warehouse/IOWbInveMngService.java

@@ -2,6 +2,8 @@ package com.emato.biz.service.warehouse;
 
 import java.util.List;
 import com.emato.biz.domain.warehouse.OWbInveMng;
+import com.emato.biz.domain.warehouse.PullInveQueryVO;
+import com.emato.common.core.domain.AjaxResult;
 
 /**
  * 库存管理,wms入库回传时,增加库存数Service接口
@@ -11,6 +13,15 @@ import com.emato.biz.domain.warehouse.OWbInveMng;
  */
 public interface IOWbInveMngService
 {
+
+    /**
+     * 根据条件拉取 OMS 数据
+     *
+     * @param queryVO
+     * @return
+     */
+    AjaxResult pullInveMng(PullInveQueryVO queryVO);
+
     /**
      * 查询库存管理,wms入库回传时,增加库存数
      *

+ 40 - 39
eccs-biz/src/main/resources/oms-config.yml

@@ -14,61 +14,62 @@ oms:
 
 
   #==================== 开发环境 ws.ds-bay.com ====================
-#  # 查询商户信息接口
-#  queryMerchantInfoUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryMerchantInfoUrl
-#  # 查询第三方商户信息接口
-#  queryThirdMerchantInfoUrl:
-#  # 查询库存接口
-#  queryMngInveUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryInveMng
-#  # 查询门店库存接口
-#  queryShopMngInveUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopInveMng
-#  # 查询入库单接口
-#  queryInveReceiptUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryInveReceiptGoods
-#  # 查询入库单明细接口
-#  queryInveReceiptDetailUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryInveReceiptGoods
-#  # 查询结转接口
-#  queryAdjustmentUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryAdjustmentRecord
-#  # 查询结转明细接口
-#  queryAdjustmentDetailUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryAdjustmentDetail
-#  # 查询出区接口
-#  queryInveShipmentUrl:
-#  # 查询出区明细接口
-#  queryInveShipmentDetailUrl:
-#  # 查询门店进货接口
-#  queryShopInUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopIn
-#  # 查询门店出场接口
-#  queryShopOutUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopOut
-#  # 查询门店转移接口
-#  queryShopMoveUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopMove
-
-#
-#  #==================== 测试环境 ws.ds-bay.com ====================
   # 查询商户信息接口
-  queryMerchantInfoUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryMerchantInfoUrl
+  queryMerchantInfoUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryMerchantInfoUrl
   # 查询第三方商户信息接口
   queryThirdMerchantInfoUrl:
   # 查询库存接口
-  queryMngInveUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryInveMng
+  #queryMngInveUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryInveMng
+  queryMngInveUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryWbInve
   # 查询门店库存接口
-  queryShopMngInveUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopInveMng
+  queryShopMngInveUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopInveMng
   # 查询入库单接口
-  queryInveReceiptUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryInveReceiptGoods
+  queryInveReceiptUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryInveReceiptGoods
   # 查询入库单明细接口
-  queryInveReceiptDetailUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryInveReceiptGoods
+  queryInveReceiptDetailUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryInveReceiptGoods
   # 查询结转接口
-  queryAdjustmentUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryAdjustmentRecord
+  queryAdjustmentUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryAdjustmentRecord
   # 查询结转明细接口
-  queryAdjustmentDetailUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryAdjustmentDetail
+  queryAdjustmentDetailUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryAdjustmentDetail
   # 查询出区接口
   queryInveShipmentUrl:
   # 查询出区明细接口
   queryInveShipmentDetailUrl:
   # 查询门店进货接口
-  queryShopInUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopIn
+  queryShopInUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopIn
   # 查询门店出场接口
-  queryShopOutUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopOut
+  queryShopOutUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopOut
   # 查询门店转移接口
-  queryShopMoveUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopMove
+  queryShopMoveUrl: http://127.0.0.1:8086/al/queryOmsInfo/queryShopMove
+
+
+#  #==================== 测试环境 ws.ds-bay.com ====================
+#  # 查询商户信息接口
+#  queryMerchantInfoUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryMerchantInfoUrl
+#  # 查询第三方商户信息接口
+#  queryThirdMerchantInfoUrl:
+#  # 查询库存接口
+#  queryMngInveUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryInveMng
+#  # 查询门店库存接口
+#  queryShopMngInveUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopInveMng
+#  # 查询入库单接口
+#  queryInveReceiptUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryInveReceiptGoods
+#  # 查询入库单明细接口
+#  queryInveReceiptDetailUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryInveReceiptGoods
+#  # 查询结转接口
+#  queryAdjustmentUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryAdjustmentRecord
+#  # 查询结转明细接口
+#  queryAdjustmentDetailUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryAdjustmentDetail
+#  # 查询出区接口
+#  queryInveShipmentUrl:
+#  # 查询出区明细接口
+#  queryInveShipmentDetailUrl:
+#  # 查询门店进货接口
+#  queryShopInUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopIn
+#  # 查询门店出场接口
+#  queryShopOutUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopOut
+#  # 查询门店转移接口
+#  queryShopMoveUrl: http://183.3.221.143:8086/al/queryOmsInfo/queryShopMove
 
 
 #  #==================== 生产环境 ws.ds-bay.com ====================

+ 8 - 6
eccs-ui/src/views/warehouse/invemng/index.vue

@@ -243,8 +243,8 @@
     <el-dialog title="拉取库存" :visible.sync="pullDialog" width="500px" append-to-body>
       <el-form ref="pullForm" :model="pullForm" :rules="rules" label-width="80px">
 
-        <el-form-item label="商户编号" prop="merchSn">
-          <el-input v-model="pullForm.merchSn" placeholder="请输入商户编号" />
+        <el-form-item label="商户编号" prop="merchId">
+          <el-input v-model="pullForm.merchId" placeholder="请输入商户编号" />
         </el-form-item>
 
         <el-form-item label="SKU" prop="sku">
@@ -359,7 +359,7 @@ export default {
      */
     resetPullForm() {
       this.pullForm = {
-        merchSn: null,
+        merchId: null,
         sku: null
       };
       this.resetForm("pullForm");
@@ -519,17 +519,19 @@ export default {
       console.log("传入的拉取参数 => ", queryParams);
       // 添加遮罩
       const _this = this;
-
+      let that = this;
       this.$confirm('是否确认拉取仓库库存?', "警告", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
       }).then(function() {
         return pullInvemng(queryParams).then(res => {
-          // 关闭对话
-          _this.closePullDialog();
+          // 关闭弹出
+          that.closePullDialog();
           _this.$alert("拉取库存成功...");
         }).catch(err => {
+          // 关闭弹出框
+          that.closePullDialog();
           _this.$alert("拉取库存异常...");
         })