浏览代码

正式系统打包配置

fenghaifu 2 年之前
父节点
当前提交
a4761f85c4

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

@@ -58,6 +58,10 @@ public class FabricCommonIn {
 	//含税单价-采购发票单价
 	@ApiModelProperty(value = "含税单价")
 	private Double iPrice;
+	// 开票数量,用于计算采购入库单价比率
+	private Double iQuantityInvoice;
+	// 结算数量,用于计算采购入库单价比率
+	private Double iQuantitySettle;
 
 	// 转换系数 转换前/转换后
 	private Double iRate;

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

@@ -36,6 +36,8 @@ public class FabricCostAssist {
 	@ApiModelProperty(value = "供应商缩写")
 	private  String cVenAbbName;
 	//存货名称
+	@ApiModelProperty(value = "存货编码")
+	private  String cInvCode;
 	@ApiModelProperty(value = "存货名称")
 	private  String cInvName;
 	//计量单位
@@ -62,5 +64,8 @@ public class FabricCostAssist {
 	@ApiModelProperty(value = "无税金额")
 	private  Double iNoTaxMoney;
 
+	// 匹配成本发票详情,订单号+物料编码
+	public String getCostInvoiceDetailMatchId(){return cPoid+cInvCode;}
+
 	List<FabricCostAssistDetail> fabricCostAssistDetailList;
 }

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

@@ -73,6 +73,8 @@ public class FabricCostInvoiceDetail {
 	public String getNPId(){
 		return cCode+cInvCode+cColor+cBatch;
 	}
+	// 匹配开票成本—辅料,订单号+物料编码
+	public String getCostAssistMatchId(){return cCode+cInvCode;}
 	// 转入成本,根据出库获取
 	public static FabricCostInvoiceDetail get(FabricMoOrderCK moOrderCK, String busType) {
 		FabricCostInvoiceDetail ret = new FabricCostInvoiceDetail();

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

@@ -32,4 +32,8 @@ public class FabricInPrice {
 	private  String cVenAbbName;
 	@ApiModelProperty(value = "单据类型")
 	private  String cBusType;
+	// 开票数量,用于计算采购入库单价比率
+	private Double iQuantityInvoice;
+	// 结算数量,用于计算采购入库单价比率
+	private Double iQuantitySettle;
 }

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

@@ -381,7 +381,9 @@
 	<select id="getPoInPriceList" resultType="org.jeecg.modules.report.entity.FabricInPrice">
 		select isnull(d.cPOID,'') as cPlanCode, a.cBusType,a.cCode,g.cVCName,f.cVenName ,f.cVenAbbName,
 		b.AutoId,
-		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)/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(b.iSumBillQuantity,0) as iQuantityInvoice,
+		isnull(b.iSQuantity,0) as iQuantitySettle
 		from rdrecords01 b
 		inner join RdRecord01 a on a.id=b.id
 		inner join PO_Podetails c on  b.iposid=c.id
@@ -396,7 +398,9 @@
 	<!-- 根据入库单子表id获取其他入库价格 -->
 	<select id="getOtherInPriceList" resultType="org.jeecg.modules.report.entity.FabricInPrice">
 		select  b.AutoId,
-		isnull(case when a.cMaker='王行乔' then b.iPrice/b.iQuantity else b.iPrice*1.13/b.iQuantity end,0) as iPrice
+		isnull(case when a.cMaker='王行乔' then b.iPrice/b.iQuantity else b.iPrice*1.13/b.iQuantity end,0) as iPrice,
+		0 as iQuantityInvoice,
+		0 as iQuantitySettle
 		from rdrecords08 b
 		inner join rdrecord08 a on  a.id=b.id
 		where b.autoId in
@@ -524,7 +528,9 @@
 		select  b.AutoId,a.cCode,isnull(b.cPOID,'') as cPlanCode,a.cBusType,e.cVCName,d.cVenName,d.cVenAbbName,
 		b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,f.cInvName,b.iQuantity,
 		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(b.iOMoDID,0) as MODetailsID,isnull(b.iPOsID,0) as PoDetailsID,f.cInvCCode,1.0 as iRate,h.dPODate as dDate
+		isnull(b.iOMoDID,0) as MODetailsID,isnull(b.iPOsID,0) as PoDetailsID,f.cInvCCode,1.0 as iRate,h.dPODate as dDate,
+		isnull(b.iSumBillQuantity,0) as iQuantityInvoice,
+		isnull(b.iSQuantity,0) as iQuantitySettle
 
 		from rdrecords01 b
 			inner join rdrecord01 a on  a.id=b.id
@@ -542,8 +548,9 @@
 		select  b.AutoId,a.cCode,isnull(b.cPOID,'') as cPlanCode,a.cBusType,e.cVCName,d.cVenName,d.cVenAbbName,
 		b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,f.cInvName,b.iQuantity,
 		0 as iPrice,
-		isnull(b.iOMoDID,0) as MODetailsID,isnull(b.iPOsID,0) as PoDetailsID,f.cInvCCode,1.0 as iRate,h.dDate
-
+		isnull(b.iOMoDID,0) as MODetailsID,isnull(b.iPOsID,0) as PoDetailsID,f.cInvCCode,1.0 as iRate,h.dDate,
+		0 as iQuantityInvoice,
+		0 as iQuantitySettle
 		from rdrecords01 b
 		inner join rdrecord01 a on  a.id=b.id
 		inner join OM_MODetails g on b.iOMoDID=g.MODetailsID
@@ -560,7 +567,9 @@
 		select  b.AutoId,a.cCode, isnull(a.cdefine9,'') as cPlanCode,a.cBusType,'' as cVCName,'' as cVenName,'' as cVenAbbName,
 		b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,f.cInvname,b.iQuantity,
 		isnull(case when a.cMaker='王行乔' then b.iPrice/b.iQuantity else b.iPrice*1.13/b.iQuantity end,0) as iPrice,
-		0 as MODetailsID, 0 as PoDetailsID,f.cInvCCode,1.0 as iRate,a.dDate
+		0 as MODetailsID, 0 as PoDetailsID,f.cInvCCode,1.0 as iRate,a.dDate,
+		0 as iQuantityInvoice,
+		0 as iQuantitySettle
 		from rdrecords08 b
 		inner join rdrecord08 a on  a.id=b.id
 		inner join Inventory  f ON b.cinvcode = f.cinvcode

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

@@ -126,7 +126,35 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			}
 			//开票成本 - 辅料
 			List<FabricCostAssist> fabricCostAssistList = fabricLossMapper.getCostAssistList(code);
+			// 去掉成本发票中的转入成本,根据订单号+物料编号
+			List<FabricCostInvoice> costInvoiceList = ret.getFabricCostInvoiceList();
+			if (oConvertUtils.listIsNotEmpty(costInvoiceList)){
+				List<FabricCostInvoice> filterList = costInvoiceList.stream().filter(e->"转入成本".equalsIgnoreCase(e.getCBusType())).collect(Collectors.toList());
+				if (oConvertUtils.listIsNotEmpty(filterList)){
+					for (FabricCostInvoice invoice : filterList){
+						List<FabricCostInvoiceDetail> costInvoiceDetailList = invoice.getCostInvoiceDetailList();
+						if (oConvertUtils.listIsNotEmpty(costInvoiceDetailList)){
+							for (FabricCostInvoiceDetail detail : costInvoiceDetailList){
+								Double dQuantity = detail.getIQuantity();
+								List<FabricCostAssist> findCostAssistList = fabricCostAssistList.stream().filter(e->e.getCostInvoiceDetailMatchId().equalsIgnoreCase(detail.getCostAssistMatchId())).collect(Collectors.toList());
+								if (oConvertUtils.listIsNotEmpty(findCostAssistList)){
+									for (FabricCostAssist assist : findCostAssistList){
+										Double dSub = Math.min(dQuantity, assist.getIQuantityIn());
+										assist.setIQuantityIn(DoubleOperation.sub(assist.getIQuantityIn(),dSub));
+										dQuantity = DoubleOperation.sub(dQuantity, dSub);
+										if (dQuantity<=0){
+											break;
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			fabricCostAssistList = fabricCostAssistList.stream().filter(e->e.getIQuantityIn()>0).collect(Collectors.toList());
 			for (FabricCostAssist fabricCostAssist : fabricCostAssistList){
+
 				List<FabricCostAssistDetail> fabricCostAssistDetailList = new ArrayList<>();
 				FabricCostAssistDetail fabricCostAssistDetail = new FabricCostAssistDetail();
 				fabricCostAssistDetail.setIQuantityInvoice(fabricCostAssist.getIQuantityInvoice());
@@ -502,7 +530,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 		}
 		// 获取本次采购入库详情
 		List<FabricPoOrderIn> fabricPoOrderInList = fabricLossMapper.getPurchaseInList(code);
-		// 设置未开票数量和未结算数量,采购单价
+		// 设置未开票数量和未结算数量,采购单价,采购单价设置成:开票数量/结算数量*单价
 		for (FabricPoOrderIn fabricPoOrderIn: fabricPoOrderInList){
 			fabricPoOrderIn.setIQuantityNInvoice(DoubleOperation.sub(fabricPoOrderIn.getIQuantity(),fabricPoOrderIn.getIQuantityInvoice()));
 			fabricPoOrderIn.setIQuantityNSettle(DoubleOperation.sub(fabricPoOrderIn.getIQuantity(),fabricPoOrderIn.getIQuantitySettle()));
@@ -512,7 +540,11 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 				FabricMoOrderCK findItem = findOpt.get();
 				fabricPoOrderIn.setIPrice(DoubleOperation.getScale(findItem.getIPrice(),4));
 			}else {
-				fabricPoOrderIn.setIPrice(DoubleOperation.getScale(fabricPoOrderIn.getIPrice(),4));
+				if (fabricPoOrderIn.getIQuantitySettle() != 0 && fabricPoOrderIn.getIQuantityInvoice() != 0){
+					fabricPoOrderIn.setIPrice(DoubleOperation.getScale(fabricPoOrderIn.getIPrice()*fabricPoOrderIn.getIQuantityInvoice()/fabricPoOrderIn.getIQuantitySettle(),4));
+				}else {
+					fabricPoOrderIn.setIPrice(DoubleOperation.getScale(fabricPoOrderIn.getIPrice(), 4));
+				}
 			}
 		}
 
@@ -848,12 +880,28 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 		List<FabricCommonIn> otherInList = new ArrayList<>();
 		if (otherInInvId.size()>0) {
 			otherInList = fabricLossMapper.getInListByInvId(otherInInvId);
-
-			otherInList.forEach(e -> e.setITempUseSum(0.0));
+			// 设置单价比例
+			otherInList.forEach(e -> {
+				e.setITempUseSum(0.0);
+				if (e.getIQuantityInvoice() != 0 && e.getIQuantitySettle() != 0){
+					e.setIPrice(DoubleOperation.getScale(e.getIPrice()*e.getIQuantityInvoice()/e.getIQuantitySettle(),4));
+				}
+			});
 			// 设置其他委外订单入库的材料成本,只计算一层
 			setOtherOmInPriceList(code, otherInList);
 			// 设置形态转换入库成本,及源头物料
 			setAssemVouchInPriceList(otherInList);
+			// 批号为空的,去掉订单号,日期,金额为0
+			for (FabricCommonIn  commonIn : otherInList){
+				if (oConvertUtils.isEmpty(commonIn.getCBatch())){
+					commonIn.setCPlanCode("");
+					commonIn.setDDate(null);
+					commonIn.setIPrice(0.0);
+					commonIn.setCCode("");
+					commonIn.setCVenAbbName("");
+					commonIn.setCVenName("");
+				}
+			}
 		}
 		// 设置非本次委外加工出入库成本
 		List<FabricMoOrderCK> findOutList = rowOutList.stream().filter(e->e.getIQuantityOut()!=0).collect(Collectors.toList());
@@ -1028,8 +1076,14 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			List<String> invIdList = new ArrayList<>();
 			outList.forEach(e->invIdList.add(e.getInvOutId()));
 			List<FabricCommonIn> inList = fabricLossMapper.getInListByInvId(invIdList);
-			// 入库价格保留四位小数
-			inList.forEach(e->e.setIPrice(DoubleOperation.getScale(e.getIPrice(),4)));
+			// 设置价格比例,入库价格保留四位小数
+			inList.forEach(e->{
+				if (e.getIQuantityInvoice() != 0 && e.getIQuantitySettle() != 0){
+					e.setIPrice(DoubleOperation.getScale(e.getIPrice()*e.getIQuantityInvoice()/e.getIQuantitySettle(),4));
+				}else {
+					e.setIPrice(DoubleOperation.getScale(e.getIPrice(), 4));
+				}
+			});
 			// 设置形态转换的源头单价,及源头物料
 			setAssemVouchInPriceList(inList);
 
@@ -1133,6 +1187,11 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 				!"委外入库".equalsIgnoreCase(e.getCBusType())).map(FabricAssemVouchsOrgIn::getAutoId).collect(Collectors.toList());
 		if (autoIdList.size()>0){
 			List<FabricInPrice> priceList = fabricLossMapper.getPoInPriceList(autoIdList);
+			priceList.forEach(e -> {
+				if (e.getIQuantityInvoice() != 0 && e.getIQuantitySettle() != 0){
+					e.setIPrice(DoubleOperation.getScale(e.getIPrice()*e.getIQuantityInvoice()/e.getIQuantitySettle(),4));
+				}
+			});
 			setAssemVouchsInPrice(commonInList, assemVouchsInvIdList, priceList);
 		}
 
@@ -1158,8 +1217,14 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			List<String> invIdList = new ArrayList<>();
 			outList.forEach(e->invIdList.add(e.getInvOutId()));
 			List<FabricCommonIn> inList = fabricLossMapper.getInListByInvId(invIdList);
-			// 入库价格保留四位小数
-			inList.forEach(e->e.setIPrice(DoubleOperation.getScale(e.getIPrice(),4)));
+			// 设置价格比例,入库价格保留四位小数
+			inList.forEach(e-> {
+				if (e.getIQuantityInvoice() != 0 && e.getIQuantitySettle() != 0){
+					e.setIPrice(DoubleOperation.getScale(e.getIPrice()*e.getIQuantityInvoice()/e.getIQuantitySettle(),4));
+				}else {
+					e.setIPrice(DoubleOperation.getScale(e.getIPrice(), 4));
+				}
+			});
 
 			for (Integer detailId : moDetailIdList){
 				Double iOutTotalMoney = 0.0;// 出库材料费用
@@ -1485,6 +1550,11 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			List<String> invIdList = new ArrayList<>();
 			otherOutList.forEach(e -> invIdList.add(e.getInvOutId()));
 			List<FabricCommonIn> inList = fabricLossMapper.getInListByInvId(invIdList);
+			inList.forEach(e -> {
+				if (e.getIQuantityInvoice() != 0 && e.getIQuantitySettle() != 0){
+					e.setIPrice(DoubleOperation.getScale(e.getIPrice()*e.getIQuantityInvoice()/e.getIQuantitySettle(),4));
+				}
+			});
 			inList = getAssemVouchSourceInvId(inList);
 			for (FabricCommonIn item : inList) {
 				List<FabricMoOrderCK> findList = otherOutList.stream().filter(e -> e.getInvOutId().equalsIgnoreCase(item.getInvId())).collect(Collectors.toList());

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -281,7 +281,7 @@ jeecg :
     enabled: true
 #cas单点登录
 cas:
-  prefixUrl: http://220.191.168.86:18005/cas
+  prefixUrl: http://www.myfitt.cn:18005/cas
 #Mybatis输出sql日志
 logging:
   level: