Browse Source

面料损耗更新

fenghaifu 2 years ago
parent
commit
4602dd2ace

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/entity/FabricCostInvoice.java

@@ -52,6 +52,9 @@ public class FabricCostInvoice {
 	@ApiModelProperty(value = "批号")
 	private  String cBatch;
 
+	@ApiModelProperty(value = "手动修改标识")
+	private  Boolean bManual;
+
 	public String getId(){
 		return cVCName+cBusType+cVenAbbName;
 	}
@@ -69,6 +72,17 @@ public class FabricCostInvoice {
 		ret.setCVenAbbName(detail.getCVenAbbName());
 		ret.setCBusType(detail.getCBusType());
 		ret.setIMoney(detail.getIMoney());
+		ret.setBManual(false);
+		return ret;
+	}
+
+	public static FabricCostInvoice getAdjustItem(){
+		FabricCostInvoice ret = new FabricCostInvoice();
+		ret.setCVCName("调整");
+		ret.setCVenAbbName("");
+		ret.setCBusType("");
+		ret.setIMoney(0.0);
+		ret.setBManual(true);
 		return ret;
 	}
 

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/mapper/xml/FabricLossMapper.xml

@@ -210,7 +210,7 @@
 		d.cVCName,c.cVenName,c.cVenAbbName,
 			 x.cInvCode as cInvCode,y.cInvName as cInvName,isnull(x.cFree1,'') as cColor,isnull(x.cBatch,'') as cBatch,
 			 isnull(x.iQuantity,0) as iQuantityIn,
-			 isnull(isnull((select  sum(n.iSum) from  PurBillVouchs  n where n.RdsId =x.autoid),x.iProcessFee),0) as iProcessFee,
+			 isnull(isnull((select  sum(n.iSum) from  PurBillVouchs  n where n.RdsId =x.autoid),0),0) as iProcessFee,
 			 isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
 			 isnull((select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID),0) as iQuantityOut,
 			 y.cInvCCode
@@ -392,7 +392,7 @@
 	<select id="getOmInOutInfoListByDetailId" resultType="map">
 
 		select a.MODetailsID,
-		isnull((select  isnull(sum(y.iSum),sum(x.iProcessFee)) from  rdrecords01 x inner join PurBillVouchs  y on y.RdsId =x.autoid where x.iOMoDID=a.MODetailsID),0) as iProcessFee,
+		isnull((select  isnull(sum(y.iSum),0) from  rdrecords01 x inner join PurBillVouchs  y on y.RdsId =x.autoid where x.iOMoDID=a.MODetailsID),0) as iProcessFee,
 		isnull((select  sum(x.iQuantity) from  rdrecords01 x where x.iOMoDID=a.MODetailsID),0) as iQuantityIn,
 		b.cinvcode+isnull(b.cfree1,'')+isnull(b.cbatch,'') as cInvIdOut,b.iQuantity as iQuantityOut
 		from OM_MODetails a
@@ -549,7 +549,7 @@
 		d.cVCName,c.cVenName,c.cVenAbbName,
 			 x.cInvCode as cInvCode,y.cInvName as cInvName,isnull(x.cFree1,'') as cColor,isnull(x.cBatch,'') as cBatch,
 			 isnull(x.iQuantity,0) as iQuantityIn,
-			 isnull(isnull((select  sum(n.iSum) from  PurBillVouchs  n where n.RdsId =x.autoid),x.iProcessFee),0) as iProcessFee,
+			 isnull(isnull((select  sum(n.iSum) from  PurBillVouchs  n where n.RdsId =x.autoid),0),0) as iProcessFee,
 			 isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
 			 (select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID) as iQuantityOut,
 			 y.cInvCCode

+ 23 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/service/impl/FabricLossServiceImpl.java

@@ -759,6 +759,19 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 
 		fabricCostInvoiceList.addAll(inoutCostList);
 
+		// 调整行
+		FabricCostInvoice adjustItem = FabricCostInvoice.getAdjustItem();
+		if (editData != null){
+			List<FabricCostInvoice> costInvoiceList = editData.getFabricCostInvoiceList();
+			if (oConvertUtils.listIsNotEmpty(costInvoiceList)) {
+				Optional<FabricCostInvoice> findOpt = costInvoiceList.stream().filter(e->"调整".equalsIgnoreCase(e.getCVCName())).findFirst();
+				if (findOpt.isPresent()){
+					adjustItem = findOpt.get();
+				}
+			}
+		}
+		fabricCostInvoiceList.add(adjustItem);
+
 		ret.setFabricCostInvoiceList(fabricCostInvoiceList);
 	}
 
@@ -1514,6 +1527,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			}
 		}
 		// 生成父类
+		List<FabricCostInvoice> curCostInvoiceList = new ArrayList<>();
 		for (FabricCostInvoiceDetail invoiceDetail : costInvoiceDetailList){
 			Optional<FabricCostInvoice> findOpt = costInvoiceList.stream().filter(e->e.getId().equalsIgnoreCase(invoiceDetail.getParentId())).findFirst();
 			if (findOpt.isPresent()){
@@ -1523,12 +1537,16 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 				FabricCostInvoice item = FabricCostInvoice.getByDetail(invoiceDetail);
 				item.setIMoney(DoubleOperation.mul(item.getIMoney(),-1.0,2));
 				costInvoiceList.add(item);
+				curCostInvoiceList.add(item);
 				item.setCostInvoiceDetailList(costInvoiceDetailList.stream().filter(e->e.getParentId().equalsIgnoreCase(item.getId())).collect(Collectors.toList()));
-				// 设置保存的工厂
-				Optional<FabricCostInvoice> findSaveOpt = saveCostInvoiceList.stream().filter(e->e.getCVCName().equalsIgnoreCase(item.getCVCName()) ).findFirst();
-				if (findSaveOpt.isPresent()){
-					item.setCVenAbbName(findSaveOpt.get().getCVenAbbName());
-				}
+
+			}
+		}
+		for (FabricCostInvoice costInvoice : curCostInvoiceList){
+			// 设置保存的工厂
+			Optional<FabricCostInvoice> findSaveOpt = saveCostInvoiceList.stream().filter(e->e.getCVCName().equalsIgnoreCase(costInvoice.getCVCName()) ).findFirst();
+			if (findSaveOpt.isPresent()){
+				costInvoice.setCVenAbbName(findSaveOpt.get().getCVenAbbName());
 			}
 		}