Browse Source

面料损耗更新

fenghaifu 2 years ago
parent
commit
40cd58b8f5

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

@@ -6,6 +6,8 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 
 
+import java.util.Date;
+
 /**
 /**
  * @author fenghaifu
  * @author fenghaifu
  * @version V1.0
  * @version V1.0
@@ -70,6 +72,9 @@ public class FabricCommonIn {
 	// 形态转换物料源头物料id
 	// 形态转换物料源头物料id
 	private String cSourceInvId;
 	private String cSourceInvId;
 
 
+	@ApiModelProperty(value = "来源单据日期")
+	private Date dDate;
+
 
 
 	public String getParentId(){
 	public String getParentId(){
 		return cInvCode+cColor;
 		return cInvCode+cColor;

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

@@ -57,11 +57,17 @@ public class FabricCostInvoice {
 	@ApiModelProperty(value = "手动修改标识")
 	@ApiModelProperty(value = "手动修改标识")
 	private  Boolean bManual;
 	private  Boolean bManual;
 
 
-	public String getId(){
-		return cVCName+cBusType+cVenAbbName;
-	}
 	// 排序号
 	// 排序号
 	int order;
 	int order;
+
+	public FabricCostInvoice(){
+		cInvCode = "";
+	}
+
+	public String getId(){
+		return cVCName+cBusType+cVenAbbName+cInvCode;
+	}
+
 	public String getInvId(){
 	public String getInvId(){
 		return cInvCode+cColor+cBatch;
 		return cInvCode+cColor+cBatch;
 	}
 	}
@@ -74,6 +80,9 @@ public class FabricCostInvoice {
 		ret.setCVenAbbName(detail.getCVenAbbName());
 		ret.setCVenAbbName(detail.getCVenAbbName());
 		ret.setCBusType(detail.getCBusType());
 		ret.setCBusType(detail.getCBusType());
 		ret.setIMoney(detail.getIMoney());
 		ret.setIMoney(detail.getIMoney());
+		if ("转入成本".equalsIgnoreCase(detail.getCBusType()) || "转出成本".equalsIgnoreCase(detail.getCBusType())){
+			ret.cInvCode = detail.getCInvCode();
+		}
 		ret.setBManual(false);
 		ret.setBManual(false);
 		return ret;
 		return ret;
 	}
 	}

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

@@ -5,9 +5,12 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.system.util.DoubleOperation;
 import org.jeecg.modules.system.util.DoubleOperation;
 import org.jeecg.modules.system.util.oConvertUtils;
 import org.jeecg.modules.system.util.oConvertUtils;
 
 
+import java.util.Date;
+
 /**
 /**
  * @author fenghaifu
  * @author fenghaifu
  * @version V1.0
  * @version V1.0
@@ -35,6 +38,8 @@ public class FabricCostInvoiceDetail {
 
 
 	@ApiModelProperty(value = "转入-来源订单号/转出-本款订单号")
 	@ApiModelProperty(value = "转入-来源订单号/转出-本款订单号")
 	private  String cCode;
 	private  String cCode;
+	@ApiModelProperty(value = "来源单据日期")
+	private String cDate;
 	@ApiModelProperty(value = "存货编码")
 	@ApiModelProperty(value = "存货编码")
 	private  String cInvCode;
 	private  String cInvCode;
 	@ApiModelProperty(value = "存货名称")
 	@ApiModelProperty(value = "存货名称")
@@ -51,9 +56,15 @@ public class FabricCostInvoiceDetail {
 	private  Double iMoney;
 	private  Double iMoney;
 	@ApiModelProperty(value = "手动修改标识")
 	@ApiModelProperty(value = "手动修改标识")
 	private  Boolean bManual;
 	private  Boolean bManual;
+	//@ApiModelProperty(value = "存货分类名称")
+	//private  String cInvCName;
 
 
 	public String getParentId(){
 	public String getParentId(){
-		return cVCName+cBusType+cVenAbbName;
+		String ret  = cVCName + cBusType + cVenAbbName;
+		if ("转入成本".equalsIgnoreCase(cBusType) || "转出成本".equalsIgnoreCase(cBusType)){
+			ret = cVCName + cBusType + cVenAbbName + cInvCode;
+		}
+		return ret;
 	}
 	}
 	public String getId(){
 	public String getId(){
 		return cCode+cInvCode+cColor+cBatch+ oConvertUtils.getString(iPrice);
 		return cCode+cInvCode+cColor+cBatch+ oConvertUtils.getString(iPrice);
@@ -66,12 +77,14 @@ public class FabricCostInvoiceDetail {
 	public static FabricCostInvoiceDetail get(FabricMoOrderCK moOrderCK, String busType) {
 	public static FabricCostInvoiceDetail get(FabricMoOrderCK moOrderCK, String busType) {
 		FabricCostInvoiceDetail ret = new FabricCostInvoiceDetail();
 		FabricCostInvoiceDetail ret = new FabricCostInvoiceDetail();
 		// 销售出库和成衣出库的类型取物料名+颜色
 		// 销售出库和成衣出库的类型取物料名+颜色
+		/*
 		if (moOrderCK.getIPrice() == null){
 		if (moOrderCK.getIPrice() == null){
 			ret.setCVCName(moOrderCK.getCInvNameOut()+" "+moOrderCK.getCColorOut());
 			ret.setCVCName(moOrderCK.getCInvNameOut()+" "+moOrderCK.getCColorOut());
 		}else {
 		}else {
 			ret.setCVCName(oConvertUtils.getString(moOrderCK.getCVCName()));
 			ret.setCVCName(oConvertUtils.getString(moOrderCK.getCVCName()));
-		}
-		ret.setCVenAbbName(oConvertUtils.getString(moOrderCK.getCPlanCode())+" "+moOrderCK.getCVenAbbName());
+		}*/
+		ret.setCVCName(moOrderCK.getCInvCNameOut() + " " + moOrderCK.getCInvNameOut());
+		ret.setCVenAbbName(oConvertUtils.getString(moOrderCK.getCPlanCode())+" "+oConvertUtils.getString(moOrderCK.getCVenAbbName()));
 		ret.setCBusType(busType);
 		ret.setCBusType(busType);
 		ret.setCCode(moOrderCK.getCPlanCode());
 		ret.setCCode(moOrderCK.getCPlanCode());
 		ret.setCInvCode(moOrderCK.getCInvCodeOut());
 		ret.setCInvCode(moOrderCK.getCInvCodeOut());
@@ -82,13 +95,17 @@ public class FabricCostInvoiceDetail {
 		ret.setIQuantity(DoubleOperation.getScale(moOrderCK.getIQuantityOut(), 4));
 		ret.setIQuantity(DoubleOperation.getScale(moOrderCK.getIQuantityOut(), 4));
 		ret.setIMoney(DoubleOperation.mul(ret.getIPrice(), ret.getIQuantity(), 2));
 		ret.setIMoney(DoubleOperation.mul(ret.getIPrice(), ret.getIQuantity(), 2));
 		ret.setBManual(moOrderCK.getIPrice() == null ? true:false);
 		ret.setBManual(moOrderCK.getIPrice() == null ? true:false);
+		if (moOrderCK.getDDate() != null) {
+			ret.setCDate(DateUtils.date2Str(moOrderCK.getDDate(), DateUtils.date_sdf.get()));
+		}
 		return ret;
 		return ret;
 	}
 	}
 
 
 	// 转出成本,根据入库获取
 	// 转出成本,根据入库获取
 	public static FabricCostInvoiceDetail get(FabricPoOrderIn poOrderIn, String busType){
 	public static FabricCostInvoiceDetail get(FabricPoOrderIn poOrderIn, String busType){
 		FabricCostInvoiceDetail ret = new FabricCostInvoiceDetail();
 		FabricCostInvoiceDetail ret = new FabricCostInvoiceDetail();
-		ret.setCVCName(oConvertUtils.getString(poOrderIn.getCInvName()));
+		//ret.setCVCName(oConvertUtils.getString(poOrderIn.getCInvName()));
+		ret.setCVCName(poOrderIn.getCInvCName() + " " + poOrderIn.getCInvName());
 		ret.setCVenAbbName("");
 		ret.setCVenAbbName("");
 		ret.setCBusType(busType);
 		ret.setCBusType(busType);
 		ret.setCCode(poOrderIn.getCPlanCode());
 		ret.setCCode(poOrderIn.getCPlanCode());
@@ -100,6 +117,9 @@ public class FabricCostInvoiceDetail {
 		ret.setIQuantity(DoubleOperation.getScale(poOrderIn.getIQuantity(),4));
 		ret.setIQuantity(DoubleOperation.getScale(poOrderIn.getIQuantity(),4));
 		ret.setIMoney(DoubleOperation.mul(ret.getIPrice(),ret.getIQuantity(), 2));
 		ret.setIMoney(DoubleOperation.mul(ret.getIPrice(),ret.getIQuantity(), 2));
 		ret.setBManual(false);
 		ret.setBManual(false);
+		if (poOrderIn.getDDate() != null) {
+			ret.setCDate(DateUtils.date2Str(poOrderIn.getDDate(), DateUtils.date_sdf.get()));
+		}
 		return ret;
 		return ret;
 	}
 	}
 }
 }

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

@@ -9,6 +9,7 @@ import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.system.util.DoubleOperation;
 import org.jeecg.modules.system.util.DoubleOperation;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Optional;
 import java.util.Optional;
 
 
@@ -33,6 +34,8 @@ public class FabricMoOrderCK {
     private String  cVCName;
     private String  cVCName;
     @ApiModelProperty(value = "出库存货分类")
     @ApiModelProperty(value = "出库存货分类")
     private  String cInvCCodeOut;
     private  String cInvCCodeOut;
+    @ApiModelProperty(value = "出库存货分类名称")
+    private  String cInvCNameOut;
     @ApiModelProperty(value = "材料出库物料编码")
     @ApiModelProperty(value = "材料出库物料编码")
     private  String cInvCodeOut;
     private  String cInvCodeOut;
     @ApiModelProperty(value = "材料出库物料名称")
     @ApiModelProperty(value = "材料出库物料名称")
@@ -64,6 +67,8 @@ public class FabricMoOrderCK {
     // 入库物料编号+颜色
     // 入库物料编号+颜色
     private  String cInvCodeColorIn;
     private  String cInvCodeColorIn;
 
 
+    @ApiModelProperty(value = "来源单据日期")
+    private Date dDate;
     // 计划号,采购订单号或者委外订单号
     // 计划号,采购订单号或者委外订单号
     private String cPlanCode;
     private String cPlanCode;
     // 是否本计划入库物料
     // 是否本计划入库物料
@@ -95,6 +100,7 @@ public class FabricMoOrderCK {
         poOrderIn.setITempUseSum(DoubleOperation.add(poOrderIn.getITempUseSum(),curSum));
         poOrderIn.setITempUseSum(DoubleOperation.add(poOrderIn.getITempUseSum(),curSum));
 
 
         FabricMoOrderCK retItem = new FabricMoOrderCK();
         FabricMoOrderCK retItem = new FabricMoOrderCK();
+        retItem.setCInvCNameOut(this.getCInvCNameOut());
         retItem.setCBusType(poOrderIn.getCBusType());
         retItem.setCBusType(poOrderIn.getCBusType());
         retItem.setCCode(poOrderIn.getCCode());
         retItem.setCCode(poOrderIn.getCCode());
         retItem.setCVenName(poOrderIn.getCVenName());
         retItem.setCVenName(poOrderIn.getCVenName());
@@ -123,6 +129,9 @@ public class FabricMoOrderCK {
         }
         }
         retItem.setIMoney(DoubleOperation.mul(retItem.getIPrice(),curSum,2));
         retItem.setIMoney(DoubleOperation.mul(retItem.getIPrice(),curSum,2));
         retItem.setCSourceInvId("");
         retItem.setCSourceInvId("");
+        if (poOrderIn.getDDate() != null){
+            retItem.setDDate(poOrderIn.getDDate());
+        }
         return retItem;
         return retItem;
     }
     }
 
 
@@ -139,6 +148,7 @@ public class FabricMoOrderCK {
         commonIn.setITempUseSum(DoubleOperation.add(commonIn.getITempUseSum(),curSum));
         commonIn.setITempUseSum(DoubleOperation.add(commonIn.getITempUseSum(),curSum));
 
 
         FabricMoOrderCK retItem = new FabricMoOrderCK();
         FabricMoOrderCK retItem = new FabricMoOrderCK();
+        retItem.setCInvCNameOut(this.getCInvCNameOut());
         retItem.setCBusType(commonIn.getCBusType());
         retItem.setCBusType(commonIn.getCBusType());
         retItem.setCCode(commonIn.getCCode());
         retItem.setCCode(commonIn.getCCode());
         retItem.setCVenName(commonIn.getCVenName());
         retItem.setCVenName(commonIn.getCVenName());
@@ -172,6 +182,9 @@ public class FabricMoOrderCK {
         }else{
         }else{
             retItem.setCSourceInvId(commonIn.getCSourceInvId());
             retItem.setCSourceInvId(commonIn.getCSourceInvId());
         }
         }
+        if (commonIn.getDDate() != null){
+            retItem.setDDate(commonIn.getDDate());
+        }
         return retItem;
         return retItem;
     }
     }
     /**
     /**
@@ -187,6 +200,7 @@ public class FabricMoOrderCK {
         moIn.setITempUseSum(DoubleOperation.add(moIn.getITempUseSum(),curSum));
         moIn.setITempUseSum(DoubleOperation.add(moIn.getITempUseSum(),curSum));
 
 
         FabricMoOrderCK retItem = new FabricMoOrderCK();
         FabricMoOrderCK retItem = new FabricMoOrderCK();
+        retItem.setCInvCNameOut(this.getCInvCNameOut());
         retItem.setCBusType("委外加工");
         retItem.setCBusType("委外加工");
         retItem.setCCode(moIn.getCCode());
         retItem.setCCode(moIn.getCCode());
         retItem.setCVenName(moIn.getCVenName());
         retItem.setCVenName(moIn.getCVenName());
@@ -217,6 +231,9 @@ public class FabricMoOrderCK {
         retItem.setIMoney(DoubleOperation.mul(retItem.getIPrice(),curSum,2));
         retItem.setIMoney(DoubleOperation.mul(retItem.getIPrice(),curSum,2));
 
 
         retItem.setCSourceInvId("");
         retItem.setCSourceInvId("");
+        if (moIn.getDDate() != null){
+            retItem.setDDate(moIn.getDDate());
+        }
         return retItem;
         return retItem;
     }
     }
 
 

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

@@ -7,6 +7,8 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.common.util.oConvertUtils;
 
 
+import java.util.Date;
+
 @Data
 @Data
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
@@ -24,6 +26,8 @@ public class FabricMoOrderRK {
     private  String cVenAbbName;
     private  String cVenAbbName;
     @ApiModelProperty(value = "存货分类")
     @ApiModelProperty(value = "存货分类")
     private  String cInvCCode;
     private  String cInvCCode;
+    @ApiModelProperty(value = "存货分类名称")
+    private  String cInvCName;
     @ApiModelProperty(value = "物料编码")
     @ApiModelProperty(value = "物料编码")
     private  String cInvCode;
     private  String cInvCode;
     @ApiModelProperty(value = "物料名称")
     @ApiModelProperty(value = "物料名称")
@@ -55,6 +59,8 @@ public class FabricMoOrderRK {
 
 
     @ApiModelProperty(value = "无税加工费")
     @ApiModelProperty(value = "无税加工费")
     private  Double iNoTaxProcessFee;
     private  Double iNoTaxProcessFee;
+    @ApiModelProperty(value = "来源单据日期")
+    private Date dDate;
 
 
     public String getInvId(){return cInvCode+cColor+cBatch;}
     public String getInvId(){return cInvCode+cColor+cBatch;}
     // 委外订单行入库详情分组
     // 委外订单行入库详情分组

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

@@ -6,6 +6,8 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 
 
+import java.util.Date;
+
 /**
 /**
  * @author fenghaifu
  * @author fenghaifu
  * @version V1.0
  * @version V1.0
@@ -30,6 +32,8 @@ public class FabricPoOrderIn {
 
 
 	@ApiModelProperty(value = "存货分类")
 	@ApiModelProperty(value = "存货分类")
 	private  String cInvCCode;
 	private  String cInvCCode;
+	@ApiModelProperty(value = "存货分类名称")
+	private  String cInvCName;
 	//存货编码
 	//存货编码
 	@ApiModelProperty(value = "存货编码")
 	@ApiModelProperty(value = "存货编码")
 	private  String cInvCode;
 	private  String cInvCode;
@@ -73,6 +77,8 @@ public class FabricPoOrderIn {
 	private String  cVenAbbName;
 	private String  cVenAbbName;
 	// 计划号
 	// 计划号
 	private String cPlanCode;
 	private String cPlanCode;
+	@ApiModelProperty(value = "来源单据日期")
+	private Date dDate;
 
 
 	// 计算过程临时用到的,累计使用数量
 	// 计算过程临时用到的,累计使用数量
 	private Double iTempUseSum;
 	private Double iTempUseSum;
@@ -101,6 +107,10 @@ public class FabricPoOrderIn {
 		formatItem.setIPrice(itemIn.getIPrice());
 		formatItem.setIPrice(itemIn.getIPrice());
 		formatItem.setCInvName(itemIn.getCInvName()+" "+itemIn.getCColor());
 		formatItem.setCInvName(itemIn.getCInvName()+" "+itemIn.getCColor());
 		formatItem.setCPlanCode(itemIn.getCPlanCode());
 		formatItem.setCPlanCode(itemIn.getCPlanCode());
+		formatItem.setCInvCName(itemIn.getCInvCName());
+		if (itemIn.getDDate() != null){
+			formatItem.setDDate(itemIn.getDDate());
+		}
 		return formatItem;
 		return formatItem;
 	}
 	}
 }
 }

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

@@ -13,7 +13,7 @@
 		exists (select x.moid from om_mobody x inner join Inventory y on x.cinvcode=y.cinvcode where x.moid=om_momain.moid and
 		exists (select x.moid from om_mobody x inner join Inventory y on x.cinvcode=y.cinvcode where x.moid=om_momain.moid and
 		(y.cInvCCode like '01%' or y.cInvCCode like '02%' or y.cInvCCode like '03%' or y.cInvCCode like '04%')   )
 		(y.cInvCCode like '01%' or y.cInvCCode like '02%' or y.cInvCCode like '03%' or y.cInvCCode like '04%')   )
 		and
 		and
-		exists (select x.cVenCode from Vendor x where x.cVenCode=om_momain.cVenCode and x.cVCCode='0105')
+		exists (select x.cVenCode from Vendor x where x.cVenCode=om_momain.cVenCode and x.cVCCode in ('0105','0107','0108'))
 		and (cCode like CONCAT(#{code},'%') and cCode not like '%样%')
 		and (cCode like CONCAT(#{code},'%') and cCode not like '%样%')
 	</select>
 	</select>
 	<!-- 排单数量 -->
 	<!-- 排单数量 -->
@@ -117,7 +117,9 @@
 		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(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(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((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,
 		isnull(b.iSQuantity,0) as iQuantitySettle,
-		g.cVCName,f.cVenName ,f.cVenAbbName,isnull(d.cPOID,'') as cPlanCode,e.cInvCCode
+		g.cVCName,f.cVenName ,f.cVenAbbName,isnull(d.cPOID,'') as cPlanCode,e.cInvCCode,
+		(select top 1 cInvCName from InventoryClass y where charindex(y.cinvccode,e.cInvCCode)>0 and len(y.cinvccode)=4 order by len(y.cinvccode),y.cinvccode) as cInvCName,
+		d.dPODate as dDate
 		from RdRecord01 a inner join RdRecords01 b on a.id=b.id
 		from RdRecord01 a inner join RdRecords01 b on a.id=b.id
 		inner join PO_Podetails c on  b.iposid=c.id
 		inner join PO_Podetails c on  b.iposid=c.id
 		inner join PO_Pomain d on d.poid=c.poid
 		inner join PO_Pomain d on d.poid=c.poid
@@ -203,7 +205,7 @@
 	</select>
 	</select>
 	<!--委外订单-采购入库详情-->
 	<!--委外订单-采购入库详情-->
 	<select id="getOmInDetailList" resultType="org.jeecg.modules.report.entity.FabricMoOrderRK">
 	<select id="getOmInDetailList" resultType="org.jeecg.modules.report.entity.FabricMoOrderRK">
-	select cPlanCode,cCode,MODetailsID,cVCName,cVenName,cVenAbbName,cInvCCode,cInvCode,cInvName,cColor,cBatch,
+	select cPlanCode,cCode,MODetailsID,cVCName,cVenName,cVenAbbName,cInvCCode,cInvCName,cInvCode,cInvName,cColor,cBatch,dDate,
 		sum(iQuantityIn) as iQuantityIn,sum(iProcessFee) as iProcessFee, sum(iNoTaxProcessFee) as iNoTaxProcessFee, sum(iSQuantity) as iSQuantity,
 		sum(iQuantityIn) as iQuantityIn,sum(iProcessFee) as iProcessFee, sum(iNoTaxProcessFee) as iNoTaxProcessFee, sum(iSQuantity) as iSQuantity,
 		sum(iQuantityOut) as iQuantityOut,sum(iSumBillQuantity) as iSumBillQuantity
 		sum(iQuantityOut) as iQuantityOut,sum(iSumBillQuantity) as iSumBillQuantity
 	 from (
 	 from (
@@ -215,7 +217,9 @@
 			 isnull((select  sum(n.iMoney ) from  PurBillVouchs n inner join purbillvouch m on m.PBVID =n.PBVID where n.RdsId =x.autoid),0) as iNoTaxProcessFee,
 			 isnull((select  sum(n.iMoney ) from  PurBillVouchs n inner join purbillvouch m on m.PBVID =n.PBVID where n.RdsId =x.autoid),0) as iNoTaxProcessFee,
 			 isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
 			 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,
 			 isnull((select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID),0) as iQuantityOut,
-			 y.cInvCCode
+			 y.cInvCCode,
+			 (select top 1 cInvCName from InventoryClass n where charindex(n.cinvccode,y.cInvCCode)>0 and len(n.cinvccode)=4 order by len(n.cinvccode),n.cinvccode) as cInvCName,
+			 a.dDate
 		FROM
 		FROM
 		om_momain a
 		om_momain a
 		INNER JOIN OM_MODetails b ON a.moid = b.moid
 		INNER JOIN OM_MODetails b ON a.moid = b.moid
@@ -227,18 +231,20 @@
 		WHERE
 		WHERE
 		y.cInvCCode NOT LIKE '19%'
 		y.cInvCCode NOT LIKE '19%'
 		AND a.cCode LIKE CONCAT(#{code},'%') and a.cCode not like '%样%'
 		AND a.cCode LIKE CONCAT(#{code},'%') and a.cCode not like '%样%'
-	) as t1 group by cPlanCode,cCode,MODetailsID,cVCName,cVenName,cVenAbbName,cInvCCode,cInvCode,cInvName,cColor,cBatch
+	) as t1 group by cPlanCode,cCode,MODetailsID,cVCName,cVenName,cVenAbbName,cInvCCode,cInvCName,cInvCode,cInvName,cColor,cBatch,dDate
 
 
 	</select>
 	</select>
 	<!-- 获取委外订单行id,出库物料信息,出库数量 -->
 	<!-- 获取委外订单行id,出库物料信息,出库数量 -->
 	<select id="getOmRowOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
 	<select id="getOmRowOutList" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
-		select MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cOmCode,cOmVenAbbName,sum(iQuantityOut) as iQuantityOut from
+		select MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cOmCode,cOmVenAbbName,cInvCNameOut,
+		sum(iQuantityOut) as iQuantityOut from
 		((
 		((
 			select b.MODetailsID,
 			select b.MODetailsID,
 				d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
 				d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
 				isnull(d.cBatch,'') as cBatchOut,
 				isnull(d.cBatch,'') as cBatchOut,
 				d.iQuantity-isnull(d.iSQuantity,0) as iQuantityOut,
 				d.iQuantity-isnull(d.iSQuantity,0) as iQuantityOut,
-				z.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName
+				z.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName,
+				(select top 1 cInvCName from InventoryClass y where charindex(y.cinvccode,z.cInvCCode)>0 and len(y.cinvccode)=4 order by len(y.cinvccode),y.cinvccode) as cInvCNameOut
 			FROM
 			FROM
 			om_momain a
 			om_momain a
 				INNER JOIN OM_MODetails b ON a.moid = b.moid
 				INNER JOIN OM_MODetails b ON a.moid = b.moid
@@ -254,7 +260,9 @@
 				g.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(g.cColor,'') as cColorOut,
 				g.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(g.cColor,'') as cColorOut,
 				isnull(g.cBatch,'') as cBatchOut,
 				isnull(g.cBatch,'') as cBatchOut,
 				g.iQuantity as iQuantityOut,
 				g.iQuantity as iQuantityOut,
-				z.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName
+				z.cInvCCode as cInvCCodeOut,a.cCode as cOmCode,x.cVenAbbName as cOmVenAbbName,
+				(select top 1 cInvCName from InventoryClass y where charindex(y.cinvccode,z.cInvCCode)>0 and len(y.cinvccode)=4 order by len(y.cinvccode),y.cinvccode) as cInvCNameOut
+
 			FROM
 			FROM
 			om_momain a
 			om_momain a
 				INNER JOIN OM_MODetails b ON a.moid = b.moid
 				INNER JOIN OM_MODetails b ON a.moid = b.moid
@@ -267,7 +275,7 @@
 				c.cInvCCode NOT LIKE '19%'
 				c.cInvCCode NOT LIKE '19%'
 				AND a.cCode LIKE CONCAT(#{code},'%') and a.cCode not like '%样%'
 				AND a.cCode LIKE CONCAT(#{code},'%') and a.cCode not like '%样%'
 		)) as t1
 		)) as t1
-		group by MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cOmCode,cOmVenAbbName
+		group by MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cInvCNameOut,cOmCode,cOmVenAbbName
 	</select>
 	</select>
 	<!-- 获取销售订单附件 -->
 	<!-- 获取销售订单附件 -->
 	<select id="getSoAccList" resultType="org.jeecg.modules.report.entity.AccessorItem">
 	<select id="getSoAccList" resultType="org.jeecg.modules.report.entity.AccessorItem">
@@ -467,13 +475,14 @@
 	</select>
 	</select>
 	<!-- 根据委外订单子表id获取委外出库信息,用于计算其他委外订单 -->
 	<!-- 根据委外订单子表id获取委外出库信息,用于计算其他委外订单 -->
 	<select id="getOmRowOutListByDetailId" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
 	<select id="getOmRowOutListByDetailId" resultType="org.jeecg.modules.report.entity.FabricMoOrderCK">
-		select MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,sum(iQuantityOut) as iQuantityOut from
+		select MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cInvCNameOut,sum(iQuantityOut) as iQuantityOut from
 		((
 		((
 			select b.MODetailsID,
 			select b.MODetailsID,
 				d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
 				d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cFree1,'') as cColorOut,
 				isnull(d.cBatch,'') as cBatchOut,
 				isnull(d.cBatch,'') as cBatchOut,
 				d.iQuantity-isnull(d.iSQuantity,0) as iQuantityOut,
 				d.iQuantity-isnull(d.iSQuantity,0) as iQuantityOut,
-				z.cInvCCode as cInvCCodeOut
+				z.cInvCCode as cInvCCodeOut,
+				(select top 1 cInvCName from InventoryClass y where charindex(y.cinvccode,z.cInvCCode)>0 and len(y.cinvccode)=4 order by len(y.cinvccode),y.cinvccode) as cInvCNameOut
 			FROM
 			FROM
 			om_momain a
 			om_momain a
 				inner join OM_MODetails b on a.moid = b.moid
 				inner join OM_MODetails b on a.moid = b.moid
@@ -490,7 +499,8 @@
 				d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cColor,'') as cColorOut,
 				d.cInvCode as cInvCodeOut,z.cInvName as cInvNameOut,isnull(d.cColor,'') as cColorOut,
 				isnull(d.cBatch,'') as cBatchOut,
 				isnull(d.cBatch,'') as cBatchOut,
 				d.iQuantity as iQuantityOut,
 				d.iQuantity as iQuantityOut,
-				z.cInvCCode as cInvCCodeOut
+				z.cInvCCode as cInvCCodeOut,
+				(select top 1 cInvCName from InventoryClass y where charindex(y.cinvccode,z.cInvCCode)>0 and len(y.cinvccode)=4 order by len(y.cinvccode),y.cinvccode) as cInvCNameOut
 			FROM
 			FROM
 				om_momain a
 				om_momain a
 				inner join OM_MODetails b on a.moid = b.moid
 				inner join OM_MODetails b on a.moid = b.moid
@@ -505,7 +515,7 @@
 				</foreach>
 				</foreach>
 		)
 		)
 		) as t1
 		) as t1
-		group by  MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut
+		group by  MODetailsID,cInvCodeOut,cInvNameOut,cColorOut,cBatchOut,cInvCCodeOut,cInvCNameOut
 	</select>
 	</select>
 	<!-- 根据物料id获取入库信息:采购入库、委外入库、转换入库、其他入库 -->
 	<!-- 根据物料id获取入库信息:采购入库、委外入库、转换入库、其他入库 -->
 	<select id="getInListByInvId" resultType="org.jeecg.modules.report.entity.FabricCommonIn">
 	<select id="getInListByInvId" resultType="org.jeecg.modules.report.entity.FabricCommonIn">
@@ -513,13 +523,13 @@
 		(
 		(
 		select  b.AutoId,a.cCode,isnull(b.cPOID,'') as cPlanCode,a.cBusType,e.cVCName,d.cVenName,d.cVenAbbName,
 		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,
 		b.cInvCode,isnull(b.cFree1,'') as cColor,isnull(b.cBatch,'') as cBatch,f.cInvName,b.iQuantity,
-		case when a.cbustype='委外加工' then 0 else
-		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)  end
-		as iPrice,
-		isnull(b.iOMoDID,0) as MODetailsID,isnull(b.iPOsID,0) as PoDetailsID,f.cInvCCode,1.0 as iRate
+		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
 
 
 		from rdrecords01 b
 		from rdrecords01 b
 			inner join rdrecord01 a on  a.id=b.id
 			inner join rdrecord01 a on  a.id=b.id
+			inner join PO_Podetails g on b.iposid=g.id
+			inner join PO_Pomain h on h.POID  =g.POID
 			inner join Vendor d on d.cVenCode=a.cVenCode
 			inner join Vendor d on d.cVenCode=a.cVenCode
 			inner join VendorClass e on d.cVCCode =e.cVCCode
 			inner join VendorClass e on d.cVCCode =e.cVCCode
 			inner join Inventory  f ON b.cinvcode = f.cinvcode
 			inner join Inventory  f ON b.cinvcode = f.cinvcode
@@ -528,10 +538,29 @@
 			#{item}
 			#{item}
 		</foreach>
 		</foreach>
 		) union all (
 		) union all (
+		(
+		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
+
+		from rdrecords01 b
+		inner join rdrecord01 a on  a.id=b.id
+		inner join OM_MODetails g on b.iOMoDID=g.MODetailsID
+		inner join om_momain h on h.moid  =g.moid
+		inner join Vendor d on d.cVenCode=a.cVenCode
+		inner join VendorClass e on d.cVCCode =e.cVCCode
+		inner join Inventory  f ON b.cinvcode = f.cinvcode
+		where  b.cInvCode + isnull(b.cFree1,'') + isnull(b.cBatch,'')  in
+		<foreach  item="item" collection="invIdList" index="index"  open="(" separator="," close=")">
+			#{item}
+		</foreach>
+		)
+		) union all (
 		select  b.AutoId,a.cCode, isnull(a.cdefine9,'') as cPlanCode,a.cBusType,'' as cVCName,'' as cVenName,'' as cVenAbbName,
 		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,
 		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,
 		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
+		0 as MODetailsID, 0 as PoDetailsID,f.cInvCCode,1.0 as iRate,a.dDate
 		from rdrecords08 b
 		from rdrecords08 b
 		inner join rdrecord08 a on  a.id=b.id
 		inner join rdrecord08 a on  a.id=b.id
 		inner join Inventory  f ON b.cinvcode = f.cinvcode
 		inner join Inventory  f ON b.cinvcode = f.cinvcode
@@ -560,7 +589,7 @@
 			 isnull(isnull((select  sum(case when m.cexch_name='美元' then convert(decimal(18,4),isnull(n.cdefine27,'0'))*n.iPBVQuantity else n.iSum end) from  PurBillVouchs n inner join purbillvouch m on m.PBVID =n.PBVID where n.RdsId =x.autoid),0),0) as iProcessFee,
 			 isnull(isnull((select  sum(case when m.cexch_name='美元' then convert(decimal(18,4),isnull(n.cdefine27,'0'))*n.iPBVQuantity else n.iSum end) from  PurBillVouchs n inner join purbillvouch m on m.PBVID =n.PBVID where n.RdsId =x.autoid),0),0) as iProcessFee,
 			 isnull(x.iSumBillQuantity,0) as iSumBillQuantity,isnull(x.iSQuantity,0) as iSQuantity,
 			 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,
 			 (select sum(isnull(iquantity,0)) as iQuantityOut from rdrecords11 d where d.iOMoDID=b.MODetailsID) as iQuantityOut,
-			 y.cInvCCode
+			 y.cInvCCode,a.dDate
 		FROM
 		FROM
 		om_momain a
 		om_momain a
 		INNER JOIN OM_MODetails b ON a.moid = b.moid
 		INNER JOIN OM_MODetails b ON a.moid = b.moid
@@ -581,7 +610,8 @@
 
 
 		select distinct c.autoid,'' as cOmCode,c.cInvCode as cInvCodeOut,b.cInvName as cInvNameOut,
 		select distinct c.autoid,'' as cOmCode,c.cInvCode as cInvCodeOut,b.cInvName as cInvNameOut,
 		isnull(c.cFree1,'') as cColorOut,isnull(c.cBatch,'') as cBatchOut,c.iQuantity as iQuantityOut,
 		isnull(c.cFree1,'') as cColorOut,isnull(c.cBatch,'') as cBatchOut,c.iQuantity as iQuantityOut,
-				isnull(c.cbatchproperty9,'') as cVenAbbName
+				isnull(c.cbatchproperty9,'') as cVenAbbName,b.cInvCCode as cInvCCodeOut,
+		(select top 1 cInvCName from InventoryClass y where charindex(y.cinvccode,b.cInvCCode)>0 and len(y.cinvccode)=4 order by len(y.cinvccode),y.cinvccode) as cInvCNameOut
 		from rdrecords32 c inner join SO_SODetails d on c.iorderdid=d.iSOsID
 		from rdrecords32 c inner join SO_SODetails d on c.iorderdid=d.iSOsID
 		inner join so_somain e on e.id=d.id
 		inner join so_somain e on e.id=d.id
 		INNER JOIN Inventory b ON c.cinvcode = b.cinvcode
 		INNER JOIN Inventory b ON c.cinvcode = b.cinvcode

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

@@ -1464,7 +1464,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 				for (FabricMoOrderCK omOut : outList) {
 				for (FabricMoOrderCK omOut : outList) {
 					FabricMoOrderCK omOutCopy = JSON.parseObject(JSON.toJSONString(omOut), FabricMoOrderCK.class);
 					FabricMoOrderCK omOutCopy = JSON.parseObject(JSON.toJSONString(omOut), FabricMoOrderCK.class);
 					omOutCopy.setCVCName(omOrder.getCVCName());
 					omOutCopy.setCVCName(omOrder.getCVCName());
-					omOutCopy.setCVenAbbName(omOrder.getCVenAbbName());
+					omOutCopy.setCVenAbbName(omOut.getCVenAbbName());
 					allOutList.add(omOutCopy);
 					allOutList.add(omOutCopy);
 				}
 				}
 			}
 			}