Browse Source

ERP同步表优化

HuKang 1 năm trước cách đây
mục cha
commit
54e97b720e

+ 17 - 12
src/main/java/com/warewms/controller/ErpWriteBackController.java

@@ -4,16 +4,16 @@ import com.warewms.common.utils.R;
 import com.warewms.entity.erp.ErpBarCodeList;
 import com.warewms.entity.erp.ErpOrderList;
 import com.warewms.service.impl.ErpSyncServiceImpl;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
+@Api("ERP测试")
 @Controller
 @RequestMapping("/erp/erpWriteData")
 @Slf4j
@@ -22,9 +22,14 @@ public class ErpWriteBackController {
     @Autowired
     private ErpSyncServiceImpl erpSyncService;
 
+    /**
+     * ERP同步表
+     *
+     * @return
+     */
     @ResponseBody
     @PostMapping("erpSync")
-    public R erpSync(){
+    public R erpSync() {
         erpSyncService.erpSync();
         return R.ok();
     }
@@ -32,20 +37,20 @@ public class ErpWriteBackController {
     /**
      * 中间表写入数据(叉车扫描条码记录表)
      */
+    @ApiOperation("中间表写入数据(叉车扫描条码记录表)")
     @ResponseBody
     @PostMapping("writeData")
-    public R writeData(@RequestParam List<ErpBarCodeList> erpBarCodeListList){
-        erpSyncService.writeBack(erpBarCodeListList);
-        return R.ok();
+    public String writeData(@RequestBody List<ErpBarCodeList> erpBarCodeListList) {
+        return erpSyncService.writeBack(erpBarCodeListList);
     }
 
     /**
      * 中间表修改数据(需求单扫描状态修改)
      */
+    @ApiOperation("中间表修改数据(需求单扫描状态修改)")
     @ResponseBody
-    @PostMapping("updaOrderStatus")
-    public R updaOrderStatus(@RequestParam ErpOrderList erpOrderList){
-        erpSyncService.updaErpStatus(erpOrderList);
-        return R.ok();
+    @PostMapping("updateOrderStatus")
+    public String updateOrderStatus(@RequestBody ErpOrderList erpOrderList) {
+        return erpSyncService.updateErpStatus(erpOrderList);
     }
 }

+ 1 - 1
src/main/java/com/warewms/entity/erp/ErpOrderList.java

@@ -5,7 +5,7 @@ import lombok.Data;
 import java.math.BigDecimal;
 
 @Data
-public class ErpOrderList {
+public class ErpOrderList{
     private String orderName;
     private int orderNo;
     private String ima01;

+ 2 - 2
src/main/java/com/warewms/service/ErpSyncService.java

@@ -8,7 +8,7 @@ import java.util.List;
 public interface ErpSyncService {
     void erpSync();
 
-    void writeBack(List<ErpBarCodeList> erpBarCodeListList);
+    String writeBack(List<ErpBarCodeList> erpBarCodeListList);
 
-    void updaErpStatus(ErpOrderList erpOrderList);
+    String updateErpStatus(ErpOrderList erpOrderList);
 }

+ 5 - 3
src/main/java/com/warewms/service/impl/ErpSyncServiceImpl.java

@@ -105,7 +105,7 @@ public class ErpSyncServiceImpl implements ErpSyncService {
 
     @JFinalTx
     @Override
-    public void writeBack(List<ErpBarCodeList> erpBarCodeListList) {
+    public String writeBack(List<ErpBarCodeList> erpBarCodeListList) {
         for (ErpBarCodeList erpBarCodeList : erpBarCodeListList) {
             Kv param = Kv.create();
             param.set("barcode",erpBarCodeList.getBarcode());
@@ -125,10 +125,11 @@ public class ErpSyncServiceImpl implements ErpSyncService {
                 throw new RRException("writeBack失败!");
             }
         }
+        return "200";
     }
 
     @Override
-    public void updaErpStatus(ErpOrderList erpOrderList) {
+    public String updateErpStatus(ErpOrderList erpOrderList) {
 
         Kv param = Kv.create();
         param.put("orderState", erpOrderList.getOrderState());
@@ -137,8 +138,9 @@ public class ErpSyncServiceImpl implements ErpSyncService {
         SqlPara update = Db.getSqlPara("erp.updaErpStatus", param);
 
         if(Db.update(update) == 0){
-            throw new RRException("updaOrderStatus——修改ERP需求单状态失败!");
+            return "500";
         }
+        return "200";
     }