Browse Source

成本分配多发少发链接

zengtx 2 years ago
parent
commit
c00715cdfa

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationFabric.java

@@ -32,6 +32,9 @@ public class SyCostAllocationFabric implements Serializable {
     List<SyRemaining> syRemaining = new ArrayList<>();
     List<SyTransfer> syTransfers = new ArrayList<>();
 
+    //多发少发点进去的链接集合
+    List<SyCostAllocationFabric> pilosityFewerList;
+
     /**id*/
     @TableId(type = IdType.ASSIGN_ID)
     @ApiModelProperty(value = "id")

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/SyCostAllocationFabricMapper.java

@@ -27,4 +27,9 @@ public interface SyCostAllocationFabricMapper extends BaseMapper<SyCostAllocatio
 	List<SyTransfer> queryTransferByFabric(@Param("code") String code,@Param("goodName") String goodName);
 	@DS("multi-three")
 	List<SyRemaining> queryRemainingByFabric(@Param("code") String code, @Param("goodName") String goodName);
+
+	//面料sheet多发少发链接
+	@DS("multi-three")
+	List<SyCostAllocationFabric> querypilosityFewer(@Param("code") String code,@Param("goodName") String goodName);
+
 }

+ 69 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationFabricMapper.xml

@@ -234,4 +234,73 @@
 	and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499'
 	GROUP BY oti.cInvName,ot.cFree1
 	</select>
+
+	<select id="querypilosityFewer" parameterType="java.lang.String" resultType="org.jeecg.modules.cost.entity.SyCostAllocationFabric">
+
+select
+		tab.planQuantity as planQuantity,tab.color, tab.goodsName,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,(isnull(tab1.purchaseQuantity,0) - tab.planQuantity) as pilosityFewer
+
+		from
+		(
+		select ot.cFree1 as color,max(oti.cInvName) as goodsName,sum(ot.iQuantity) as planQuantity
+		from UFDATA_101_2021.dbo.om_momain om
+		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
+		join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
+		join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
+		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser') and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%') and oti.cInvName = #{goodName}
+		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499'
+		GROUP BY ot.cFree1
+		) tab
+		left join
+	 (
+		select rs.cFree1 as color,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
+		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where iordercode in (
+		select distinct od.csocode
+			from UFDATA_101_2021.dbo.PO_POmain om
+		join UFDATA_101_2021.dbo.PO_PODetails od on om.poid=od.poid
+		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser='asuser')
+		 and om.cPOID like CONCAT(#{code},'%')
+		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' and i.cInvCCode != '0299' and i.cInvName = #{goodName}
+		 and rs.cBatch like CONCAT(#{code},'%')
+		GROUP BY rs.cFree1
+		)tab1 on tab1.cInvName=tab.goodsName
+
+
+		union all
+
+		select
+		tab.planQuantity as planQuantity,tab.color, tab.goodsName,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,(isnull(tab1.purchaseQuantity,0) - tab.planQuantity) as pilosityFewer
+
+		from
+		(
+		select ot.cFree1 as color,max(oti.cInvName) as goodsName,sum(ot.iQuantity) as planQuantity
+		from UFDATA_103_2021.dbo.om_momain om
+		join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid
+		join UFDATA_103_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
+		join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
+		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser') and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%') and oti.cInvName = #{goodName}
+		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499'
+		GROUP BY ot.cFree1
+		) tab
+		left join
+	 (
+		select rs.cFree1 as color,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
+		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where iordercode in (
+		select distinct od.csocode
+			from UFDATA_103_2021.dbo.PO_POmain om
+		join UFDATA_103_2021.dbo.PO_PODetails od on om.poid=od.poid
+		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser='asuser')
+		 and om.cPOID like CONCAT(#{code},'%')
+		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' and i.cInvCCode != '0299' and i.cInvName = #{goodName}
+		 and rs.cBatch like CONCAT(#{code},'%')
+		GROUP BY rs.cFree1
+		)tab1 on tab1.cInvName=tab.goodsName
+
+	</select>
 </mapper>

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -277,6 +277,10 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 Fabric.setTransferCost(cost);
             }
 
+            //多发少发链接结合赋值
+            List<SyCostAllocationFabric> pilosityFeweList = syCostAllocationFabricMapper.querypilosityFewer(plannum,Fabric.getGoodsName());
+            Fabric.setPilosityFewerList(pilosityFeweList);
+
             //多发少发 = 购入数量-计划数量
             Fabric.setPilosityFewer(Fabric.getPurchaseQuantity().subtract(Fabric.getPlanQuantity()));
         }