txf 3 rokov pred
rodič
commit
38eaaf11f2

+ 0 - 2
src/main/java/com/steerinfo/dil/controller/WmshOutboundResultController.java

@@ -74,10 +74,8 @@ public class WmshOutboundResultController extends BaseRESTfulController {
         map.put("status", new BigDecimal(0));
         int i1 = wmshGridMaterialService.updatePortStock(map);
         if (i1 == -1){
-//            System.out.println("港存库出库数量大于实时库存");
             return failed("出库数量大于港存库实时库存");
     }else {
-
             return success();
         }
     }

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

@@ -82,10 +82,10 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
         BigDecimal oldGmsTonnage = wmshGridMaterial.getGmTonnage();
         BigDecimal gmsTonnage;
         if (status.intValue() == 0) {
-            gmsTonnage = new BigDecimal(oldGmsTonnage.doubleValue() - tonnage.doubleValue());
+            gmsTonnage = oldGmsTonnage.subtract(tonnage);
         }
         else {
-            gmsTonnage = new BigDecimal(tonnage.doubleValue() + oldGmsTonnage.doubleValue());
+            gmsTonnage = tonnage.add(oldGmsTonnage);
         }
         if (gmsTonnage.intValue()>=0) {
             wmshGridMaterial.setGmTonnage(gmsTonnage);

+ 5 - 0
src/main/java/com/steerinfo/dil/service/impl/WmshOutboundResultServiceImpl.java

@@ -6,6 +6,7 @@ import com.steerinfo.dil.service.IWmshOutboundResultService;
 import com.steerinfo.dil.util.DataChange;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -31,6 +32,9 @@ public class WmshOutboundResultServiceImpl implements IWmshOutboundResultService
     @Autowired
     private WmshOutboundResultMapper wmshOutboundResultMapper;
 
+    @Autowired
+    private WmshGridMaterialServiceImpl wmshGridMaterialService;
+
     /**
      * 查询所有的出库实绩
      * @param map
@@ -51,6 +55,7 @@ public class WmshOutboundResultServiceImpl implements IWmshOutboundResultService
      * @return
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public int addResult(Map<String, Object> map) {
         WmshOutboundResult wmshOutboundResult = new WmshOutboundResult();
         //获取主键