Przeglądaj źródła

修改库存调拨单查询

liyg 2 lat temu
rodzic
commit
9530af3f68

+ 21 - 5
src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java

@@ -9,10 +9,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @ author    :TXF
@@ -264,6 +261,25 @@ public class StatisticalReportImpl implements IStatisticalReportService {
 
     @Override
     public List<Map<String, Object>> getInwardSaleSteelOrder(Map<String, Object> map) {
-        return statisticalReportMapper.getInwardSaleSteelOrder(map);
+        List<Map<String, Object>> results=statisticalReportMapper.getInwardSaleSteelOrder(map);
+        if(results!=null){
+            //遍历找到所有已使用的分录
+            Set<BigDecimal> saleMaterialIds=new HashSet<>();
+            for(Map<String,Object> temp:results){
+                if(temp.get("orderId")!=null){
+                    saleMaterialIds.add(DataChange.dataToBigDecimal(temp.get("saleMaterialId")));
+                }
+            }
+            //查询分录已使用但订单id为null的记录
+            List<Map<String, Object>> disResults=new ArrayList<>();
+            for(Map<String,Object> temp:results){
+                if(temp.get("orderId")==null && saleMaterialIds.contains(DataChange.dataToBigDecimal(temp.get("saleMaterialId")))){
+                    disResults.add(temp);
+                }
+            }
+            //删除这些记录,防止重复派单
+            results.removeAll(disResults);
+        }
+        return results;
     }
 }