Forráskód Böngészése

面料损耗更新

fenghaifu 2 éve
szülő
commit
ec6f4854cd

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

@@ -0,0 +1,30 @@
+package org.jeecg.modules.report.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @author fenghaifu
+ * @version V1.0
+ * @Copyright: 上海萃颠信息科技有限公司. All rights reserved.
+ * @Title:FabricAccident
+ * @projectName jeecg-boot-parent
+ * @Description:面料损耗-质量事故单
+ * @date: 2022-11-08 14:25
+ * @updatehistory: 2022-11-08 14:25 新增
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="面料损耗-质量事故单", description="面料损耗-质量事故单")
+public class FabricAccident {
+	@ApiModelProperty(value = "事故单号")
+	private  String cPBVCode;
+	@ApiModelProperty(value = "供应商简称")
+	private  String cVenAbbName;
+	@ApiModelProperty(value = "金额")
+	private  Double iOriSum;
+}

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

@@ -42,6 +42,8 @@ public class FabricLoss {
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date dateTime;
+    // 备注1
+    private String noteOne;
 
     // 采购订单列表
     List<FabricPoOrder> fabricPoOrderList;
@@ -61,6 +63,8 @@ public class FabricLoss {
     List<FabricCostCloth> fabricCostClothList;
     // 销售订单附件
     List<AccessorItem> accessorItemList;
+    // 事故单
+    List<FabricAccident> fabricAccidentList;
 
     // 是否成功
     boolean success;

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

@@ -44,6 +44,8 @@ public class FabricOMOrder {
     private  Double iQuantityMoreLess;
     @ApiModelProperty(value = "损耗")
     private  String cQuantityLoss;
+    @ApiModelProperty(value = "染厂色号")
+    private  String cColorNumber;
     @ApiModelProperty(value = "子表id")
     private  String iOMoDID;
     @ApiModelProperty(value = "单位类型(入库)")

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

@@ -2,10 +2,13 @@ package org.jeecg.modules.report.entity;
 
 import java.io.Serializable;
 import java.util.Date;
+
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -21,8 +24,9 @@ import org.jeecgframework.poi.excel.annotation.Excel;
  * @Date:   2022-11-07
  * @Version: V1.0
  */
+
 @Data
-@TableName("sy_fabric_loss_report")
+@TableName(autoResultMap = true)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @ApiModel(value="sy_fabric_loss_report对象", description="森语报表")
@@ -39,7 +43,8 @@ public class SyFabricLossReport {
 	/**计划内容*/
 	@Excel(name = "计划内容", width = 15)
     @ApiModelProperty(value = "计划内容")
-	private Object content;
+	@TableField(typeHandler = FastjsonTypeHandler.class)
+	private JSONObject content;
 	/**创建人*/
 	@Excel(name = "创建人", width = 15)
     @ApiModelProperty(value = "创建人")

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

@@ -152,4 +152,7 @@ public interface FabricLossMapper extends BaseMapper<FabricLoss> {
 	// 获取委外订单国内出库数量
 	@DS("multi-three")
 	List<FabricPoOrderOut> getOmInGwOutList(@Param("invIdList")List<String> invIdList);
+	// 获取事故单
+	@DS("multi-three")
+	List<FabricAccident> getAccidentList(@Param("code")String code);
 }

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

@@ -81,14 +81,14 @@
 		and (c.cInvCCode LIKE '01%'
 		or c.cInvCCode LIKE '02%'
 		or c.cInvCCode LIKE '03%'
-		or c.cInvCCode LIKE '04%')
+		or c.cInvCCode LIKE '04%') and c.cInvCCode not in ('0299','0399','0499')
 		) as t1 group by cVenName,cVenAbbName,cPOID,cInvCode,cInvName,cColor<!--,cBatch-->
 	</select>
 	<!-- 其他入库纱,找委外订单的材料出库单,获取物料号+批号,物料号+批号再其他入库单 -->
 	<select id="getPurchaseListOtherInList" resultType="org.jeecg.modules.report.entity.FabricPoOrderOut">
 		(
 			SELECT
-				a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,
+				a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,d.cInvName,a.cInvCode,isnull(a.cFree1,'') as cColor,
 				isnull(isnull(stuff((SELECT ',' + x.cdefine9 FROM rdrecord08 x
 					inner join RdRecords08 y on x.id=y.id
 					where y.cInvCode + isnull( y.cFree1, '' ) + isnull( y.cBatch, '' )=
@@ -109,10 +109,20 @@
 					WHERE
 					a.cbustype = '其他入库'
 				) and
+				a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) not IN (
+					SELECT
+					u.cInvCode + isnull( u.cFree1, '' ) + isnull( u.cBatch, '' )
+					FROM
+					rdrecords01 u
+					inner join RdRecord01 v on u.id=v.id
+					inner join OM_MODetails w on u.iOMoDID =w.MODetailsID
+					inner join om_momain x on w.moid  =x.moid
+					where x.cCode  like CONCAT(#{code},'%')
+				) and
 				d.cinvname &lt;&gt; '杂纱' and a.iquantity>0
 		) union all (
 			SELECT
-				a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,
+				a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,d.cInvName,a.cInvCode,isnull(a.cFree1,'') as cColor,
 				isnull(isnull(stuff((SELECT ',' + x.cdefine9 FROM rdrecord08 x
 					inner join RdRecords08 y on x.id=y.id
 					where y.cInvCode + isnull( y.cFree1, '' ) + isnull( y.cBatch, '' ) in (
@@ -146,10 +156,20 @@
 					WHERE
 					a.cbustype = '其他入库'
 				) and
+				a.cInvCode + isnull( a.cFree1, '' ) + isnull( a.cBatch, '' ) not IN (
+					SELECT
+					u.cInvCode + isnull( u.cFree1, '' ) + isnull( u.cBatch, '' )
+					FROM
+					rdrecords01 u
+					inner join RdRecord01 v on u.id=v.id
+					inner join OM_MODetails w on u.iOMoDID =w.MODetailsID
+					inner join om_momain x on w.moid  =x.moid
+					where x.cCode  like CONCAT(#{code},'%')
+				) and
 				d.cinvname &lt;&gt; '杂纱'  and a.iquantity>0
 		) union all (
 			SELECT
-				a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,'杂纱' as cPlanCode
+				a.comcode as cCode,isnull(a.iSQuantity,a.iquantity) as iQuantity,isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,d.cInvName,a.cInvCode,isnull(a.cFree1,'') as cColor,'杂纱' as cPlanCode
 			FROM
 				rdrecords11 a
 				INNER JOIN Inventory d ON a.cinvcode = d.cinvcode
@@ -165,7 +185,7 @@
 		(
 		SELECT
 			a.comcode as cCode,case when a.iSQuantity is null or a.iSQuantity=0 then a.iquantity else a.iSQuantity end as iQuantity,
-			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,
+			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,d.cInvName,
 			case when a.cBatch is not null and a.cBatch='期初' then '期初'
 			else
 				isnull(stuff((
@@ -205,7 +225,7 @@
 		) union all (
 		SELECT
 			a.comcode as cCode,case when a.iSQuantity is null or a.iSQuantity=0 then a.iquantity else a.iSQuantity end as iQuantity,
-			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,
+			isnull(a.iUnitCost,0) as iPrice,isnull(a.cBatch,'') as cBatch,a.cInvCode,isnull(a.cFree1,'') as cColor,d.cInvName,
 			case when a.cBatch is not null and a.cBatch='期初' then '期初'
 			else
 				isnull(stuff((
@@ -251,7 +271,7 @@
 	</select>
 	<!--获取所有委外订单 cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
 	<select id="getOmOrderListAll" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
-		select cVCName,cVenName ,cVenAbbName ,cVenCode ,cInvCode,cInvName,cComUnitCode,cColor,
+		select cVCName,cVenName ,cVenAbbName ,cVenCode ,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor,
 			isnull(sum(iQuantityOut),0) as iQuantityOut,
 			isnull(sum(iQuantity),0) as iQuantity,
 			isnull(sum(iQuantityIn),0) as iQuantityIn
@@ -260,7 +280,7 @@
 			SELECT e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,b.cFree1 as cColor,
 				(select sum(iQuantity) from rdrecords11 x where x.iOMoDID=b.MODetailsID) as iQuantityOut,
 				(select sum(iQuantity) from RdRecords01 x where x.iOMoDID=b.MODetailsID) as iQuantityIn,
-				b.iQuantity,b.MODetailsID
+				b.iQuantity,b.MODetailsID,isnull(b.cdefine30,'') as cColorNumber
 			FROM
 				om_momain a
 				INNER JOIN OM_MODetails b ON a.moid = b.moid
@@ -271,13 +291,13 @@
 				c.cInvCCode NOT LIKE '19%'
 				AND a.cCode LIKE CONCAT(#{code},'%')
 
-		) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cInvCode,cInvName,cComUnitCode,cColor
-		order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor
+		) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
+		order by cVCName,cVenName,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
 
 	</select>
 	<!--获取销售出库委外订单:物料+颜色在销售出库表中,cComUnitCode : 计量单位,02(PCS)根,04(M)米-->
 	<select id="getOmOrderListGw" resultType="org.jeecg.modules.report.entity.FabricOMOrder">
-		select cVCName,cVenName ,cVenAbbName ,cVenCode ,cInvCode,cInvName,cComUnitCode,cColor,
+		select cVCName,cVenName ,cVenAbbName ,cVenCode ,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor,
 			isnull(sum(iQuantityOut),0) as iQuantityOut,
 			isnull(sum(iQuantity),0) as iQuantity,
 			isnull(sum(iQuantityIn),0) as iQuantityIn
@@ -286,7 +306,7 @@
 			SELECT e.cVCName,d.cVenName ,d.cVenAbbName ,a.cVenCode ,c.cInvCode,c.cInvName,c.cComUnitCode,b.cFree1 as cColor,
 				(select sum(iQuantity) from rdrecords11 x where x.iOMoDID=b.MODetailsID) as iQuantityOut,
 				(select sum(iQuantity) from RdRecords01 x where x.iOMoDID=b.MODetailsID) as iQuantityIn,
-				b.iQuantity,b.MODetailsID
+				b.iQuantity,b.MODetailsID,isnull(b.cdefine30,'') as cColorNumber
 			FROM
 				om_momain a
 				INNER JOIN OM_MODetails b ON a.moid = b.moid
@@ -299,8 +319,8 @@
 				and b.cInvCode+isnull(b.cFree1,'') in (
 				select cInvCode+isnull(cFree1,'') from rdrecords32 where cbatch like CONCAT(#{code},'%')
 				)
-		) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cInvCode,cInvName,cComUnitCode,cColor
-		order by cVCName,cVenName,cInvCode,cInvName,cComUnitCode,cColor
+		) as t1 group by cVCName,cVenName,cVenAbbName,cVenCode,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
+		order by cVCName,cVenName,cColorNumber,cInvCode,cInvName,cComUnitCode,cColor
 
 	</select>
 	<!--获取本次采购入库的委外材料出库单,已核销的取核销数量-->
@@ -844,4 +864,16 @@
 		</foreach>
 
 	</select>
+	<!-- 获取事故单 -->
+	<select id="getAccidentList" resultType="org.jeecg.modules.report.entity.FabricAccident">
+		SELECT ah.cPBVCode,VEN.cVenAbbName,sum(A.iOriSum) as iOriSum
+		from PurBillVouchs a
+		left join PurBillVouch ah on ah.pbvid=a.pbvid
+		left join Inventory inv on inv.cInvCode=a.cInvCode
+		left join Vendor ven on ven.cVenCode=ah.cvencode
+		where cPBVBillType='03'
+			and inv.cInvName='事故单' and ah.cDefine2 like CONCAT(#{code},'%')
+		group by ah.cPBVCode,VEN.cVenAbbName
+
+	</select>
 </mapper>

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

@@ -550,6 +550,9 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			// 根据委外出库设置采购入库单价
 			setMoneyByOm(ret);
 
+			// 质量事故单
+			ret.setFabricAccidentList(fabricLossMapper.getAccidentList(code));
+
 			return  ret;
 		}
 		return null;