Explorar el Código

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU2/DAL-DAZHOU-WMSH-API

txf hace 3 años
padre
commit
d2b80eca31

+ 12 - 0
src/main/java/com/steerinfo/dil/controller/WmshGridMaterialController.java

@@ -8,6 +8,7 @@ import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -92,4 +93,15 @@ public class WmshGridMaterialController extends BaseRESTfulController {
         return success(data);
     }
 
+    //清场
+    @ApiModelProperty(value = "清场远程调用")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "amsContractBreach", value = "违约规则实体", required = false, dataType = "AmsContractBreach"),
+    })
+    @PostMapping("/clearWmshGridMaterial")
+    public RESTfulResult clearWmshGridMaterial(@RequestBody Map<String,Object> map) {
+        int result = wmshGridMaterialService.clearWmshGridMaterial(map);
+        return success(result);
+    }
+
 }

+ 4 - 9
src/main/java/com/steerinfo/dil/controller/WmshInboundResultController.java

@@ -3,6 +3,8 @@ package com.steerinfo.dil.controller;
 import com.steerinfo.dil.model.WmshInboundResult;
 import com.steerinfo.dil.service.impl.WmshGridMaterialServiceImpl;
 import com.steerinfo.dil.service.impl.WmshInboundResultServiceImpl;
+
+
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
 import com.steerinfo.dil.util.PageListAdd;
@@ -50,16 +52,9 @@ public class WmshInboundResultController extends BaseRESTfulController {
             @ApiImplicitParam(name = "wmshInboundResult", value = "入库实绩", required = false, dataType = "WmshInboundResult"),
     })
     @PostMapping("/addWarehousingResult")
-    public RESTfulResult addWarehousingResult(@RequestBody(required = false) WmshInboundResult wmshInboundResult){
-        int i1 = wmshInboundResultService.addWarehousingResult(wmshInboundResult);
-        BigDecimal batchId = wmshInboundResult.getBatchId();
-        BigDecimal portId = wmshInboundResult.getPortId();
-        BigDecimal resultMaterialNumber = wmshInboundResult.getResultMaterialNumber();
+    public RESTfulResult addWarehousingResult(@RequestBody(required = false) Map<String,Object> map){
+        int i1 = wmshInboundResultService.addWarehousingResult(map);
         BigDecimal status = new BigDecimal(1);
-        Map<String,Object> map = new HashMap<>();
-        map.put("batchId",batchId);
-        map.put("portId",portId);
-        map.put("resultTonnage",resultMaterialNumber);
         map.put("status",status);
         int i2 = wmshGridMaterialService.updatePortStock(map);
         return success(i1 + i2);

+ 14 - 8
src/main/java/com/steerinfo/dil/controller/WmshOutboundResultController.java

@@ -56,9 +56,9 @@ public class WmshOutboundResultController extends BaseRESTfulController {
     })
     @PostMapping("/getOutBoundResult")
     public RESTfulResult getOutBoundResult(@RequestBody(required=false) Map<String,Object> mapValue,
-                                      Integer apiId,
-                                      Integer pageNum,
-                                      Integer pageSize
+                                           Integer apiId,
+                                           Integer pageNum,
+                                           Integer pageSize
     ){
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
@@ -69,10 +69,16 @@ public class WmshOutboundResultController extends BaseRESTfulController {
 
     @ApiOperation(value="添加港存库出库实绩")
     @PostMapping("/addResult")
-    public RESTfulResult addResult(@RequestBody(required = false) Map<String, Object> map){
-        int i = wmshOutboundResultService.addResult(map);
-        map.put("status",new BigDecimal(0));
-        wmshGridMaterialService.updatePortStock(map);
-        return success(i);
+    public RESTfulResult addResult(@RequestBody(required = false) Map<String, Object> map) throws Exception {
+        wmshOutboundResultService.addResult(map);
+        map.put("status", new BigDecimal(0));
+        int i1 = wmshGridMaterialService.updatePortStock(map);
+        if (i1 == -1){
+//            System.out.println("港存库出库数量大于实时库存");
+            return failed("出库数量大于港存库实时库存");
+    }else {
+
+            return success();
+        }
     }
 }

+ 1 - 0
src/main/java/com/steerinfo/dil/service/IWmshGridMaterialService.java

@@ -39,4 +39,5 @@ public interface IWmshGridMaterialService {
      */
     int updatePortStock(Map<String, Object> map);
 
+    int clearWmshGridMaterial(Map<String, Object> map);
 }

+ 1 - 1
src/main/java/com/steerinfo/dil/service/IWmshInboundResultService.java

@@ -21,7 +21,7 @@ import java.util.Map;
 public interface IWmshInboundResultService{
 
     //添加入库实绩
-    int addWarehousingResult(WmshInboundResult wmshInboundResult);
+    int addWarehousingResult(Map<String,Object> map);
 
     //查询港存库入库实绩
     List<Map<String, Object>> getAllResult(Map<String, Object> map);

+ 21 - 3
src/main/java/com/steerinfo/dil/service/impl/WmshGridMaterialServiceImpl.java

@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -58,13 +59,14 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
      */
     @Override
     public int updatePortStock(Map<String,Object> map) {
-        BigDecimal portId = DataChange.dataToBigDecimal(map.get("portId"));
+        BigDecimal portId = DataChange.dataToBigDecimal(map.get("downSwimPortId"));
         BigDecimal batchId = DataChange.dataToBigDecimal(map.get("batchId"));
         BigDecimal tonnage = DataChange.dataToBigDecimal(map.get("resultTonnage"));
         BigDecimal status = DataChange.dataToBigDecimal(map.get("status"));
         Map<String,Object> selectMap = new HashMap<>();
         selectMap.put("portId",portId);
         selectMap.put("batchId",batchId);
+        //查找是否有港存库实时库存
         List<WmshGridMaterial> wmshGridMaterials = wmshGridMaterialMapper.selectByParameters(selectMap);
         if (wmshGridMaterials.size() == 0) {
             WmshGridMaterial wmshGridMaterial = new WmshGridMaterial();
@@ -85,8 +87,24 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
         else {
             gmsTonnage = new BigDecimal(tonnage.doubleValue() + oldGmsTonnage.doubleValue());
         }
-        wmshGridMaterial.setGmTonnage(gmsTonnage);
-        return wmshGridMaterialMapper.updateByPrimaryKeySelective(wmshGridMaterial);
+        if (gmsTonnage.intValue()>=0) {
+            wmshGridMaterial.setGmTonnage(gmsTonnage);
+        }else {
+            return -1;
+        }
+        wmshGridMaterial.setUpdateTime(new Date());
+        int i = wmshGridMaterialMapper.updateByPrimaryKeySelective(wmshGridMaterial);
+        return i;
+    }
+
+    @Override
+    public int clearWmshGridMaterial(Map<String, Object> map) {
+        BigDecimal gmId =DataChange.dataToBigDecimal(map.get("gmId"));
+        WmshGridMaterial wmshGridMaterial=new WmshGridMaterial();
+        wmshGridMaterial.setGmId(gmId);
+        wmshGridMaterial.setGmTonnage(new BigDecimal(0));
+        int i = wmshGridMaterialMapper.updateByPrimaryKeySelective(wmshGridMaterial);
+        return i;
     }
 
 }

+ 3 - 2
src/main/java/com/steerinfo/dil/service/impl/WmshInboundResultServiceImpl.java

@@ -34,12 +34,13 @@ public class WmshInboundResultServiceImpl implements IWmshInboundResultService {
 
     /**
      * 添加港存库 入库实绩
-     * @param wmshInboundResult
+     * @param
      * @return
      */
     @Override
-    public int addWarehousingResult(WmshInboundResult wmshInboundResult) {
+    public int addWarehousingResult(Map<String,Object> map) {
         //获取主键
+        WmshInboundResult wmshInboundResult=new WmshInboundResult();
         Integer id = wmshInboundResultMapper.getResultId();
         wmshInboundResult.setResultId(new BigDecimal(id));
         //生成入库编号