Redeem 1 år sedan
förälder
incheckning
528b07bf97

+ 1 - 1
pom.xml

@@ -6,7 +6,7 @@
 
     <groupId>org.example</groupId>
     <artifactId>dil-wms-api</artifactId>
-    <version>1.5</version>
+    <version>1.6</version>
 
     <parent>
         <groupId>org.springframework.boot</groupId>

+ 13 - 1
src/main/java/com/steerinfo/dil/controller/OyeResultController.java

@@ -4,6 +4,7 @@ package com.steerinfo.dil.controller;
 import com.steerinfo.dil.feign.BmsTruckFeign;
 import com.steerinfo.dil.feign.OtmsFeign;
 import com.steerinfo.dil.mapper.OyeRealtimeInventoryMapper;
+import com.steerinfo.dil.model.OyeRealtimeInventory;
 import com.steerinfo.dil.service.impl.OyeResultServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
@@ -223,7 +224,18 @@ public class OyeResultController extends BaseRESTfulController {
         return success(columnList);
     }
 
-
+    @ApiOperation("更新实时库存")
+    @PostMapping("updateRealTimeInventory")
+    public RESTfulResult updateRealTimeInventory(@RequestBody Map<String,Object> map) {
+        try {
+            OyeRealtimeInventory oyeRealtimeInventory = oyeResultService.updateRealTimeInventory(map);
+            oyeRealtimeInventoryMapper.updateByPrimaryKeySelective(oyeRealtimeInventory);
+            return success("操作成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            return failed("更新失败");
+        }
+    }
 
 
 }

+ 5 - 1
src/main/java/com/steerinfo/dil/service/impl/OyeResultServiceImpl.java

@@ -92,6 +92,10 @@ public class OyeResultServiceImpl implements IOyeResultService {
             if (oyeInboundResultMapper.selectSaleMaterialID(DataChange.dataToBigDecimal(map.get("saleMaterialId"))) != null) {
                 throw new Exception("该分录已入库,无法继续入库");
             }
+            if (DataChange.dataToBigDecimal(map.get("netWeight")) == null || DataChange.dataToBigDecimal(map.get("netWeight")).intValue() == 0) {
+                throw new Exception("该分录无净重,不允许入库");
+            }
+            //判断该分录是否有净重
             //根据分录ID查询理重
             BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
             BigDecimal theoryWeightSaleMaterial = oyeRealtimeInventoryMapper.getTheoryWeight(DataChange.dataToBigDecimal(map.get("saleMaterialId")));
@@ -321,7 +325,7 @@ public class OyeResultServiceImpl implements IOyeResultService {
 
 
     @Transactional(rollbackFor = Exception.class)
-    public String updateInsertRealTime(Map<String, Object> map) throws Exception{
+    public synchronized String updateInsertRealTime(Map<String, Object> map) throws Exception{
         // 划分实时库存数据
         // 针对原先的库存,需要进行出库;针对划分后的库存需要进行入库;先出后入;
         // 创建出库需要的数据;