|
@@ -5,6 +5,7 @@ import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.service.CrudService;
|
|
import com.jeeplus.core.service.CrudService;
|
|
import com.jeeplus.modules.supply.judgementBills.entity.SupplyJudgementBills;
|
|
import com.jeeplus.modules.supply.judgementBills.entity.SupplyJudgementBills;
|
|
|
|
+import com.jeeplus.modules.supply.materialsProvidedByAForReview.entity.MaterialsProvidedByAForReview;
|
|
import com.jeeplus.modules.supply.particulars.entity.SupplyParticulars;
|
|
import com.jeeplus.modules.supply.particulars.entity.SupplyParticulars;
|
|
import com.jeeplus.modules.supply.particulars.mapper.SupplyParticularsMapper;
|
|
import com.jeeplus.modules.supply.particulars.mapper.SupplyParticularsMapper;
|
|
import com.jeeplus.modules.supply.stockOut.entity.SupplyStockOut;
|
|
import com.jeeplus.modules.supply.stockOut.entity.SupplyStockOut;
|
|
@@ -64,15 +65,35 @@ public class SupplyParticularsService extends CrudService<SupplyParticularsMappe
|
|
|
|
|
|
//根据项目定义号查询出库表信息
|
|
//根据项目定义号查询出库表信息
|
|
List<SupplyStockOut> supplyStockOutList;
|
|
List<SupplyStockOut> supplyStockOutList;
|
|
|
|
+ Map<String, List<SupplyStockOut>> supplyStockOutListMap;
|
|
//判定送审id是否为空
|
|
//判定送审id是否为空
|
|
//不为空则先通过送审id查询出库单中对应的项目定义号的信息
|
|
//不为空则先通过送审id查询出库单中对应的项目定义号的信息
|
|
if(StringUtils.isNotBlank(supplyParticulars.getSubmittalsId())){
|
|
if(StringUtils.isNotBlank(supplyParticulars.getSubmittalsId())){
|
|
supplyStockOutList = mapper.getSupplyStockOutList(projectDefinitionList,supplyParticulars.getSubmittalsId());
|
|
supplyStockOutList = mapper.getSupplyStockOutList(projectDefinitionList,supplyParticulars.getSubmittalsId());
|
|
|
|
+
|
|
|
|
+ //对出库单数据进行分组
|
|
|
|
+ supplyStockOutListMap = this.groupSupplyStockOut(supplyStockOutList);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //查询甲供材申报songshenid对应材料的数据和(根据物料编码进行分组)
|
|
|
|
+ List<SupplyStockOut> materialsProvidedByAForReviewList = mapper.getMaterialsProvidedByAForReviewList(supplyParticulars.getSubmittalsId());
|
|
|
|
+ //对甲供材数据进行分组(根据项目定义号进行分组)
|
|
|
|
+ Map<String, List<SupplyStockOut>> materialsProvidedByAForReviewMap = this.groupSupplyStockOut(materialsProvidedByAForReviewList);
|
|
|
|
+ //对出库单数据和甲供材数据进行处理
|
|
|
|
+ List<SupplyStockOut> newSupplyStockOutList = disposeMaterialsDataMap(supplyStockOutListMap, materialsProvidedByAForReviewMap);
|
|
|
|
+
|
|
|
|
+ supplyStockOutList = Lists.newArrayList();
|
|
|
|
+ supplyStockOutList.addAll(newSupplyStockOutList);
|
|
|
|
+ if(supplyStockOutList.size()>0){
|
|
|
|
+ //对出库单数据进行分组
|
|
|
|
+ supplyStockOutListMap = this.groupSupplyStockOut(supplyStockOutList);
|
|
|
|
+ }
|
|
|
|
+
|
|
}else{
|
|
}else{
|
|
supplyStockOutList = mapper.getSupplyStockOutList(projectDefinitionList,supplyParticulars.getSubmittalsId());
|
|
supplyStockOutList = mapper.getSupplyStockOutList(projectDefinitionList,supplyParticulars.getSubmittalsId());
|
|
|
|
+ //对出库单数据进行分组
|
|
|
|
+ supplyStockOutListMap = this.groupSupplyStockOut(supplyStockOutList);
|
|
}
|
|
}
|
|
- //对出库单数据进行分组
|
|
|
|
- Map<String, List<SupplyStockOut>> supplyStockOutListMap = this.groupSupplyStockOut(supplyStockOutList);
|
|
|
|
//查询审定单中的数据信息
|
|
//查询审定单中的数据信息
|
|
List<SupplyJudgementBills> supplyJudgementBillsList = mapper.getSupplyJudgementBillsListList(projectDefinitionList,supplyParticulars.getSubmittalsId());
|
|
List<SupplyJudgementBills> supplyJudgementBillsList = mapper.getSupplyJudgementBillsListList(projectDefinitionList,supplyParticulars.getSubmittalsId());
|
|
//对审定单数据进行分组
|
|
//对审定单数据进行分组
|
|
@@ -80,6 +101,24 @@ public class SupplyParticularsService extends CrudService<SupplyParticularsMappe
|
|
|
|
|
|
List<SupplyParticulars> supplyParticularsList = disposeDataMap(supplyStockOutListMap, supplyJudgementBillsListMap);
|
|
List<SupplyParticulars> supplyParticularsList = disposeDataMap(supplyStockOutListMap, supplyJudgementBillsListMap);
|
|
|
|
|
|
|
|
+ //根据物料编码查询历史出库单该物料所属类型,如果均未查到则归属其他类型,否则添加到对应类型中
|
|
|
|
+ for (SupplyParticulars info: supplyParticularsList) {
|
|
|
|
+ if("-".equals(info.getMaterialsType())){
|
|
|
|
+ String materialsType = mapper.getMaterialsType(info.getMaterialNumber());
|
|
|
|
+ switch (materialsType){
|
|
|
|
+ case "设备":
|
|
|
|
+ info.setMaterialsType("设备");
|
|
|
|
+ break;
|
|
|
|
+ case "材料":
|
|
|
|
+ info.setMaterialsType("材料");
|
|
|
|
+ break;
|
|
|
|
+ case "-":
|
|
|
|
+ info.setMaterialsType("-");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//对超欠供明细数据进行分组
|
|
//对超欠供明细数据进行分组
|
|
Map<String, List<SupplyParticulars>> supplyParticularsListMap = this.groupByMaterialsType(supplyParticularsList);
|
|
Map<String, List<SupplyParticulars>> supplyParticularsListMap = this.groupByMaterialsType(supplyParticularsList);
|
|
List<SupplyParticulars> particularsList = disposeDataMapByMaterialsType(supplyParticularsListMap);
|
|
List<SupplyParticulars> particularsList = disposeDataMapByMaterialsType(supplyParticularsListMap);
|
|
@@ -97,6 +136,49 @@ public class SupplyParticularsService extends CrudService<SupplyParticularsMappe
|
|
return page;
|
|
return page;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<SupplyStockOut> disposeMaterialsDataMap(Map<String, List<SupplyStockOut>> supplyStockOutListMap,Map<String, List<SupplyStockOut>> materialsProvidedByAForReviewMap){
|
|
|
|
+ List<SupplyStockOut> newSupplyStockOutList = Lists.newArrayList();
|
|
|
|
+
|
|
|
|
+ Set<String> supplyStockOutListMapKeySet = supplyStockOutListMap.keySet();
|
|
|
|
+ Set<String> materialsProvidedByAForReviewMapKeySet = materialsProvidedByAForReviewMap.keySet();
|
|
|
|
+ List<String> supplyStockOutListMapKeyList = new ArrayList<>(supplyStockOutListMapKeySet);
|
|
|
|
+ List<String> materialsProvidedByAForReviewMapKeyList = new ArrayList<>(materialsProvidedByAForReviewMapKeySet);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //获取迭代器
|
|
|
|
+ Iterator<String> materialsProvidedByAForReviewMapKey = materialsProvidedByAForReviewMapKeyList.iterator();
|
|
|
|
+ while (materialsProvidedByAForReviewMapKey.hasNext()){
|
|
|
|
+ String stockOutMapKey = materialsProvidedByAForReviewMapKey.next();
|
|
|
|
+
|
|
|
|
+ //获取迭代器
|
|
|
|
+ Iterator<String> supplyStockOutListMapKey = supplyStockOutListMapKeyList.iterator();
|
|
|
|
+ while (supplyStockOutListMapKey.hasNext()){
|
|
|
|
+ String stockOutListMapKey = supplyStockOutListMapKey.next();
|
|
|
|
+ if (stockOutMapKey.equals(stockOutListMapKey)){
|
|
|
|
+ //如果两个key键相同,则表示出库单和审定单均有该项目定义号的数据信息
|
|
|
|
+ //获取该key键对应的list数据
|
|
|
|
+ List<SupplyStockOut> supplyStockOutList = supplyStockOutListMap.get(stockOutMapKey);
|
|
|
|
+ List<SupplyStockOut> materialsProvidedByAForReview = materialsProvidedByAForReviewMap.get(stockOutMapKey);
|
|
|
|
+
|
|
|
|
+ //对相同项目定义号的数据进行处理
|
|
|
|
+ List<SupplyStockOut> supplyParticularsByMaterialNumberList = disposeMaterialDataList(supplyStockOutList, materialsProvidedByAForReview);
|
|
|
|
+ if(supplyParticularsByMaterialNumberList.size()>0){
|
|
|
|
+ newSupplyStockOutList.addAll(supplyParticularsByMaterialNumberList);
|
|
|
|
+ }
|
|
|
|
+ supplyStockOutListMapKey.remove();
|
|
|
|
+ supplyStockOutListMap.remove(stockOutMapKey);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ materialsProvidedByAForReviewMapKey.remove();
|
|
|
|
+ materialsProvidedByAForReviewMap.remove(stockOutMapKey);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return newSupplyStockOutList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 出库单数据分组
|
|
* 出库单数据分组
|
|
* @param supplyStockOutList
|
|
* @param supplyStockOutList
|
|
@@ -672,6 +754,76 @@ public class SupplyParticularsService extends CrudService<SupplyParticularsMappe
|
|
return supplyParticularsList;
|
|
return supplyParticularsList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 物料编码对应数据处理
|
|
|
|
+ * @param supplyStockOutList
|
|
|
|
+ * @param materialsProvidedByAForReviewList
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private List<SupplyStockOut> disposeMaterialDataList(List<SupplyStockOut> supplyStockOutList , List<SupplyStockOut> materialsProvidedByAForReviewList){
|
|
|
|
+ List<SupplyStockOut> newSupplyStockOutList = Lists.newArrayList();
|
|
|
|
+ if (supplyStockOutList.size() == 0 && materialsProvidedByAForReviewList.size() == 0){
|
|
|
|
+ return newSupplyStockOutList;
|
|
|
|
+ }
|
|
|
|
+ //将出库单根据物料编码进行分组
|
|
|
|
+ Map<String, List<SupplyStockOut>> stockOutMaterialNumberListMap = this.groupSupplyStockOutMaterialNumber(supplyStockOutList);
|
|
|
|
+ //将审定单根据物料编码进行分组
|
|
|
|
+ Map<String, List<SupplyStockOut>> materialsProvidedByAForReviewListMap = this.groupSupplyStockOutMaterialNumber(materialsProvidedByAForReviewList);
|
|
|
|
+
|
|
|
|
+ //获取所有审定单map对应的key键信息
|
|
|
|
+ Set<String> materialsProvidedByAForReviewListMapKeySet = materialsProvidedByAForReviewListMap.keySet();
|
|
|
|
+ List<String> materialsProvidedByAForReviewListMapKeyList = new ArrayList<>(materialsProvidedByAForReviewListMapKeySet);
|
|
|
|
+
|
|
|
|
+ //获取审定单中物料编码对应的出库单中的信息
|
|
|
|
+ Iterator<String> materialsProvidedByAForReviewListMapKey = materialsProvidedByAForReviewListMapKeyList.iterator();
|
|
|
|
+ while (materialsProvidedByAForReviewListMapKey.hasNext()){
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String materialNumber = materialsProvidedByAForReviewListMapKey.next();
|
|
|
|
+ //获取审定单指定数据
|
|
|
|
+ List<SupplyStockOut> materialsList = materialsProvidedByAForReviewListMap.get(materialNumber);
|
|
|
|
+ //因为相同物料编码的审定单数据仅存在一条,则通过下标获取特定审定单信息
|
|
|
|
+ SupplyStockOut materials = materialsList.get(0);
|
|
|
|
+ BigDecimal actualQuantityIssued = new BigDecimal(materials.getActualQuantityIssued());
|
|
|
|
+ //获取出库单中对应的物料编码信息
|
|
|
|
+ List<SupplyStockOut> stockOutMaterialNumberList = stockOutMaterialNumberListMap.get(materialNumber);
|
|
|
|
+ if(null != stockOutMaterialNumberList && stockOutMaterialNumberList.size()>0){
|
|
|
|
+ for (SupplyStockOut stockOut : stockOutMaterialNumberList) {
|
|
|
|
+ BigDecimal stockOutActualQuantityIssued = new BigDecimal(stockOut.getActualQuantityIssued());
|
|
|
|
+ //比较甲供材送审的物料数量和出库单物料数量
|
|
|
|
+ //如果出库单物料数量<甲供材送审的物料数量 出库单数据不变
|
|
|
|
+ //否则甲供材送审的物料数量更替为出库单物料数量
|
|
|
|
+ if(stockOutActualQuantityIssued.compareTo(actualQuantityIssued) == -1){
|
|
|
|
+ actualQuantityIssued = actualQuantityIssued.subtract(stockOutActualQuantityIssued);
|
|
|
|
+ newSupplyStockOutList.add(stockOut);
|
|
|
|
+ } else{
|
|
|
|
+ if(actualQuantityIssued.compareTo(new BigDecimal("0.000")) != 0){
|
|
|
|
+ stockOut.setActualQuantityIssued(actualQuantityIssued.toString());
|
|
|
|
+ actualQuantityIssued = new BigDecimal("0.000");
|
|
|
|
+ newSupplyStockOutList.add(stockOut);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //删除map中对应key键信息
|
|
|
|
+ materialsProvidedByAForReviewListMap.remove(materialNumber);
|
|
|
|
+ stockOutMaterialNumberListMap.remove(materialNumber);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取所有审定单map对应的key键信息
|
|
|
|
+ Set<String> stockOutMaterialNumberListMapKeySet = stockOutMaterialNumberListMap.keySet();
|
|
|
|
+ List<String> stockOutMaterialNumberListMapKeyList = new ArrayList<>(stockOutMaterialNumberListMapKeySet);
|
|
|
|
+ for (String infoStr : stockOutMaterialNumberListMapKeyList ) {
|
|
|
|
+ //获取出库单中对应的物料编码信息
|
|
|
|
+ List<SupplyStockOut> stockOutMaterialList = stockOutMaterialNumberListMap.get(infoStr);
|
|
|
|
+ newSupplyStockOutList.addAll(stockOutMaterialList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return newSupplyStockOutList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|