Browse Source

面料损耗更新

fenghaifu 1 year ago
parent
commit
a25d12d31c

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

@@ -51,6 +51,10 @@ public class FabricCostClothes {
 	@ApiModelProperty(value = "原币金额")
 	private  Double iOriSum;
 
+	//原币金额
+	@ApiModelProperty(value = "累计开票数量")
+	private  Double iSumBillQuantity;
+
 	// 出运日期
 	@ApiModelProperty(value = "出运日期")
 	private  String cShipTime;

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

@@ -114,7 +114,7 @@
 		select a.cCode,a.cBusType,b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,b.iQuantity,e.cInvName,
 		isnull(b.iSumBillQuantity,0) as iQuantityInvoice,
 		isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum/b.iQuantity),0) as iPrice,
-		isnull(isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))*x.iPBVQuantity else x.iSum end) from PurBillVouchs  x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),b.iSum ),0) as iPurchuseMoney,
+		isnull((select sum(case when y.cexch_name='美元' then convert(decimal(18,4),isnull(x.cdefine27,'0'))+x.iOriSum*y.cExchRate else x.iOriSum  end) from PurBillVouchs  x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),0) as iPurchuseMoney,
 		isnull((select sum(x.iMoney)/sum(x.iPBVQuantity ) from PurBillVouchs x inner join purbillvouch y on x.PBVID =y.PBVID where x.RdsId =b.autoid),0) as iNoTaxPrice,
 		isnull(b.iSQuantity,0) as iQuantitySettle,
 		g.cVCName,f.cVenName ,f.cVenAbbName,isnull(d.cPOID,'') as cPlanCode,e.cInvCCode,
@@ -154,7 +154,8 @@
 
 		select cPBVCode,cVenName,cVenAbbName,cShipTime,isnull(sum(iSum),0) as iSum,
 		isnull(sum(iOriSum),0) as iOriSum,isnull(sum(iQuantity),0) as iQuantity,
-		isnull(sum(iPBVQuantity),0) as iPBVQuantity,isnull(sum(iSQuantity),0) as iSQuantity
+		isnull(sum(iPBVQuantity),0) as iPBVQuantity,isnull(sum(iSQuantity),0) as iSQuantity,
+		isnull(sum(iSumBillQuantity ),0) as iSumBillQuantity
 		from VIEW_FabricLoss_Cost_Clothes where trim(cCode) like CONCAT(#{code},'%') and cCode not like '%样%'
 		group by
 		cPBVCode,cVenName,cVenAbbName,cShipTime

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

@@ -117,7 +117,10 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 				if (fabricCostClothes.getCShipTime() != null && fabricCostClothes.getCShipTime().length()>10){
 					fabricCostClothes.setCShipTime(fabricCostClothes.getCShipTime().substring(0, 10));
 				}
-
+				if (fabricCostClothes.getISumBillQuantity()>fabricCostClothes.getIPBVQuantity()){
+					fabricCostClothes.setIQuantity(fabricCostClothes.getIPBVQuantity());
+					fabricCostClothes.setISQuantity(fabricCostClothes.getIPBVQuantity());
+				}
 				List<FabricCostClothesDetail> fabricCostClothesDetailList = new ArrayList<>();
 				FabricCostClothesDetail fabricCostClothesDetail = new FabricCostClothesDetail();
 
@@ -1695,7 +1698,8 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			if ("期初".equalsIgnoreCase(moOrderCK.getCBatchOut()) ||
 					"普通采购".equalsIgnoreCase(moOrderCK.getCBusType())  && !"杂纱".equalsIgnoreCase(moOrderCK.getCInvNameOut())){
 				lyysList.add(poOrderOut);
-			}else if ("其他入库".equalsIgnoreCase(moOrderCK.getCBusType()) ||
+			}else if (oConvertUtils.isEmpty(moOrderCK.getCBusType()) ||
+					"其他入库".equalsIgnoreCase(moOrderCK.getCBusType()) ||
 					"转换入库".equalsIgnoreCase(moOrderCK.getCBusType()) ||
 					oConvertUtils.isNotEmpty(moOrderCK.getCSourceInvId()) && !moOrderCK.getCSourceInvId().equalsIgnoreCase(moOrderCK.getInvOutId()) ||
 					"杂纱".equalsIgnoreCase(moOrderCK.getCInvNameOut())){