Browse Source

面辅料bug修复

huxy 2 years ago
parent
commit
f9195e149c

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

@@ -319,4 +319,9 @@ public class SyPackingListFabricItem implements Serializable {
 
 	@TableField(exist = false)
 	private String venId;
+
+	/**项目/Item(存货编码)*/
+	@Excel(name = "区分成衣跟面辅料", width = 15)
+	@ApiModelProperty(value = "区分成衣跟面辅料")
+	private String inventoryCcode;
 }

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/mapper/SyPackingListFabricItemMapper.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.splfi.mapper;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
 import org.apache.ibatis.annotations.Param;
@@ -30,4 +32,8 @@ public interface SyPackingListFabricItemMapper extends BaseMapper<SyPackingListF
 	public List<SyPackingListFabricItem> getSyShippingDetailsDatas(@Param("ids") String[] ids,@Param("groupIds") String[] groupIds);
 
     List<SyPackingListFabricItem> getList(@Param("ids") Object[] toArray);
+
+	//List<Map<String, String>> getu8Data();
+
+	String[] getu8Data();
 }

+ 24 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/mapper/xml/SyPackingListFabricItemMapper.xml

@@ -22,6 +22,7 @@
 			/*a.declaration_Name,报关品名*/
 			(select declaration_Name from sy_declaration_elements where id=b.elements_Id) as declaration_Name,
 			c.master_Metering,/*主计量*/
+			b.inventory_CCode inventoryCCode,/*获取物料分类*/
 			c.weight as gramWeight,/*克重*/
 			b.salesman,/*业务员*/
 			b.item_Number,/*款号*/
@@ -67,6 +68,7 @@
 			AND inventory_Ccode!='0499' AND sy_shipping_details_item.id=b.id) supplierCodePrintingPlant,
 			b.account,/*账套号*/
 			b.inventory_CCode venId,/*获取物料分类*/
+			b.inventory_CCode inventoryCCode,/*获取物料分类*/
 			b.order_Remaining_Quantity as remaining_Quantity,/*剩余数量*/
 			b.supplier_code,/*获取供应商编码*/
 			b.supplier,/*获取供应商*/
@@ -130,4 +132,26 @@
 		</foreach>
 		order by group_id desc
 	</select>
+
+	<!--<select id="getu8Data"  resultMap="genderIsosid">-->
+	<select id="getu8Data"  resultMap="genderIsosid">
+		SELECT
+		sy_order_data_item_id as isosid
+		FROM `sy_shipping_details_item`
+		WHERE inventory_Ccode NOT LIKE '19%'
+		AND inventory_Ccode NOT LIKE '01%'
+		AND inventory_Ccode NOT LIKE '02%'
+		AND inventory_Ccode NOT LIKE '03%'
+		AND inventory_Ccode NOT LIKE '04%'
+		AND elements_Id IS NOT NULL
+		AND elements_Id !=''
+		AND sy_order_data_item_id
+		NOT IN
+		(SELECT id FROM `sy_packing_list_fabric_item`)
+	</select>
+
+	<resultMap id="genderIsosid" type="java.lang.String">
+		<result column="isosid" property="value" javaType="java.lang.String"/>
+	</resultMap>
+
 </mapper>

+ 29 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -39,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.io.Serializable;
+import java.lang.reflect.Array;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -112,6 +113,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			entity.setDistributionPoint(detailsItem.getDistributionPoint());//分销点
 			entity.setPurOrSubOrder(detailsItem.getPurOrSubOrder());//采购委外订单号
 			entity.setFactoryUnitPrice(detailsItem.getFactoryUnitPrice());//工厂单价
+			if(entity.getMasterMetering().equals("KG")){//当单位为KG时
+				entity.setTotalPrice(entity.getNetWeight().subtract(entity.getPrice()));//净重*单价
+			}else{
+				entity.setTotalPrice(entity.getActualDeclaredQuantity().subtract(entity.getPrice()));//实际报关数量*单价
+			}
 			syShippingDetailsItemMapper.updateById(detailsItem);
 			syPackingListFabricItemMapper.insert(entity);
 		}
@@ -144,6 +150,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				//此次入库数量-剩余数量=超发数量
 				s1.setExcessQuantity(entity.getInventoryQuantity().subtract(s1.getSurplusQuantity()));
 				syShippingDetailsItemMapper.updateById(s1);*/
+				if(entity.getMasterMetering().equals("KG")){//当单位为KG时
+					entity.setTotalPrice(entity.getNetWeight().subtract(entity.getPrice()));//净重*单价
+				}else{
+					entity.setTotalPrice(entity.getActualDeclaredQuantity().subtract(entity.getPrice()));//实际报关数量*单价
+				}
 				entity.setId(null);
 				syPackingListFabricItemMapper.insert(entity);
 			}else{
@@ -199,7 +210,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			if(syPackingListFabricItem.getExcessQuantity().intValue()<0){
 				syPackingListFabricItem.setExcessQuantity(new BigDecimal(0));//如果超发数量为-1就写为0
 			}
-			if(syPackingListFabricItem.getVenId().indexOf("04")>-1&&!syPackingListFabricItem.getVenId().equals("0499")){
+			if(syPackingListFabricItem.getVenId()!=null&&syPackingListFabricItem.getVenId().indexOf("04")>-1&&!syPackingListFabricItem.getVenId().equals("0499")){
 				//满足条件
 				SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(syPackingListFabricItem.getSyShippingDetailsItemId());//获取出运明细子表数据
 				syPackingListFabricItem.setSupplierCodeDyeingPlant(syShippingDetailsItem.getRSupplierCode());//染厂编码
@@ -251,10 +262,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	/**
 	 * 每3分钟拉取一次数据
 	 */
-	@Override
-	@Scheduled(fixedRate=1000*60*300)
+	//@Override
+	//@Scheduled(fixedRate=1000*60*300)
 	//@Transactional
-	public void getU8Data() {
+	public void getU8Data2() {
 		SimpleDateFormat sf= new SimpleDateFormat("yyMMdd");
 		try{
 			QueryWrapper<DxpDataPlan> queryWrapper = new QueryWrapper<>();
@@ -341,7 +352,6 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							"c.cInvStd  as specificationAndModel\n" +
 							"from rdrecord32 a \n" +
 							"left JOIN rdrecords32 b\n" +
-
 							"on a.id=b.id \n" +
 							"left join Inventory c\n" +
 							"on b.cInvCode=c.cInvCode\n" +
@@ -374,6 +384,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 						sy1.setActualDeclaredQuantity(sy1.getInventoryQuantity());//给报关数量赋值
 						sy1.setGroupId(sy1.getOrderNumber()+"-"+sy1.getInventoryCode()+"-"+sy1.getSize());
 						sy1.setSyPackingListFabricId(sy.getId());//获取主表id
+						if(sy1.getMasterMetering().equals("KG")){//当单位为KG时
+							sy1.setTotalPrice(sy1.getNetWeight().subtract(sy1.getPrice()));//净重*单价
+						}else{
+							sy1.setTotalPrice(sy1.getActualDeclaredQuantity().subtract(sy1.getPrice()));//实际报关数量*单价
+						}
 						sy1.setU8Pid(sy.getU8Id());
 						QueryWrapper<SyShippingDetailsItem> queryWrapper2 = new QueryWrapper<>();
 						queryWrapper2.eq("sy_order_data_item_id",sy1.getIsosid());
@@ -474,4 +489,13 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			}
 		}
 	}
+
+	//@Override
+	public void getU8Data(){
+		String[] arrs=syPackingListFabricItemMapper.getu8Data();//获取发运明细已提交的辅料
+		for (String arr : arrs){
+			System.out.println("arr\t"+arr);
+		}
+		System.out.println("arrs\n"+arrs);
+	}
 }