Explorar o código

厂边库重新出库BUG修改。

xiaosonghong hai 2 meses
pai
achega
1a560bbf0e

+ 11 - 6
src/main/java/com/steerinfo/dil/service/impl/OyeResultServiceImpl.java

@@ -729,9 +729,11 @@ public class OyeResultServiceImpl implements IOyeResultService {
             }
             //根据实绩id获取件数、理重、净重
             Map<String,Object> oldMes = oyeOutboundResultMapper.getOldMes(resultId);
-            BigDecimal netWeightSub = netWeight.subtract(DataChange.dataToBigDecimal(oldMes.get("netWeight")));
-            BigDecimal theoryWeightSub = theoryWeight.subtract(DataChange.dataToBigDecimal(oldMes.get("theoryWeight")));
-            if (netWeightSub.compareTo(new BigDecimal(0)) == 0 && theoryWeightSub.compareTo(new BigDecimal(0)) == 0) {
+            BigDecimal materialNumberOld = materialNumber.subtract(DataChange.dataToBigDecimal(oldMes.get("materialNumber")));
+            BigDecimal netWeightOld = netWeight.subtract(DataChange.dataToBigDecimal(oldMes.get("netWeight")));
+            BigDecimal theoryWeightOld = theoryWeight.subtract(DataChange.dataToBigDecimal(oldMes.get("theoryWeight")));
+            if (netWeightOld.compareTo(new BigDecimal(0)) == 0 && theoryWeightOld.compareTo(new BigDecimal(0)) == 0
+                    && materialNumberOld.compareTo(new BigDecimal(0)) == 0) {
                 continue;
             }
             OyeOutboundResult oyeOutboundResult = oyeOutboundResultMapper.selectByPrimaryKey(resultId);
@@ -742,9 +744,9 @@ public class OyeResultServiceImpl implements IOyeResultService {
             map.put("flag",2);
             Map<String, Object> updateRealMap = new HashMap<>();
             updateRealMap.put("inventoryId",oldMes.get("inventoryId"));
-            updateRealMap.put("materialNumber",materialNumber.subtract(DataChange.dataToBigDecimal(oldMes.get("materialNumber"))));
-            updateRealMap.put("netWeight",netWeightSub);
-            updateRealMap.put("theoryWeight",theoryWeightSub);
+            updateRealMap.put("materialNumber", materialNumberOld);
+            updateRealMap.put("netWeight",netWeightOld);
+            updateRealMap.put("theoryWeight",theoryWeightOld);
             OyeRealtimeInventory oyeRealtimeInventory = updateRealTimeInventory(updateRealMap);
             oyeRealtimeInventories.add(oyeRealtimeInventory);
             TmstruckWeightBatch  tmstruckWeightBatch  = tmstruckWeightBatchMapper.selectByPrimaryKey(weightBatchId);
@@ -759,6 +761,9 @@ public class OyeResultServiceImpl implements IOyeResultService {
             oyeOutboundResultMapper.updateOrderStatus(DataChange.dataToBigDecimal(map.get("orderId")));
             oyeOutboundResults.add(oyeOutboundResult);
         }
+        if(oyeOutboundResults.isEmpty()){
+            return 1;
+        }
         oyeOutboundResultMapper.batchUpdate(oyeOutboundResults);
         oyeRealtimeInventoryMapper.batchUpdate(oyeRealtimeInventories);
         tmstruckWeightBatchMapper.batchUpdate(tmstruckWeightBatches);