Преглед изворни кода

调整推送u8数据和面辅料单位获取来源

huxy пре 1 година
родитељ
комит
bd040dccf8

+ 7 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -1027,21 +1027,16 @@ public class SyPackingListFabricController {
 	 public Result updateSyItem( ) {
 		List<SyPackingListFabricItem> items=syPackingListFabricItemService.list();
 		int num=0;
-		for (SyPackingListFabricItem item:items){
-			if(item.getSyShippingDetailsItemId()!=null){
-				SyShippingDetailsItem syItem=syShippingDetailsItemMapper.selectById(item.getSyShippingDetailsItemId());
-				if(syItem!=null){
-					item.setOmpoId(syItem.getOmpoId());
-					item.setOmpoIdItem(syItem.getOmpoIdItem());
-					item.setOmpoAccount(syItem.getOmpoAccount());
-					if(syItem.getPurOrSubOrder()!=null){
-						item.setPurOrSubOrder(syItem.getPurOrSubOrder());
-					}
-					num=num+1;
-				}
+		for (SyPackingListFabricItem item : items){
+			if(item.getMasterMetering()!=null&&item.getMasterMetering().equals("KG")){
+				item.setTotalPrice(item.getPrice().multiply(item.getNetWeight()));
+				syPackingListFabricItemService.updateById(item);
+				num++;
 			}
 		}
 
 	 	return Result.ok("更新了"+num+"条数据");
 	 }
+
+
  }

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

@@ -122,9 +122,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			SyShippingDetailsItem detailsItem=syShippingDetailsItemMapper.selectById(entity.getSyShippingDetailsItemId());
 			//detailsItem.setIsReference(1);//修改成已被参照
 			//剩余数量-这次入库数量=新剩余数量
-			detailsItem.setOrderRemainingQuantity(detailsItem.getOrderRemainingQuantity().subtract(entity.getInventoryQuantity()));
+			//detailsItem.setOrderRemainingQuantity(detailsItem.getOrderRemainingQuantity().subtract(entity.getInventoryQuantity()));
 			//此次入库数量-剩余数量=超发数量
-			detailsItem.setExcessQuantity(entity.getInventoryQuantity().subtract(detailsItem.getOrderRemainingQuantity()));
+			//detailsItem.setExcessQuantity(entity.getInventoryQuantity().subtract(detailsItem.getOrderRemainingQuantity()));
 			detailsItem.setIsReference(2);//面辅料回写
 			entity.setSalesman(detailsItem.getSalesman());//获取业务员
 			entity.setSalesDepartment(detailsItem.getSalesDepartment());//获取业务部门
@@ -176,6 +176,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	 * @param syShippingDetailsItemId 出运明细id
 	 * @return
 	 */
+	@Transactional
 	public int  updateQuantity(BigDecimal quantity,String syShippingDetailsItemId){
 		QueryWrapper queryWrapper=new QueryWrapper();
 		queryWrapper.eq("sy_shipping_details_item_id", syShippingDetailsItemId);//出运明细id
@@ -201,6 +202,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				excessQuantity=null;//转为null
 			}
 		}
+
+		SyShippingDetailsItem item=syShippingDetailsItemMapper.selectById(syShippingDetailsItemId);
+		item.setOrderRemainingQuantity(remainingQuantity);//出运明细剩余数量
+		item.setExcessQuantity(excessQuantity);//出运明细超发数量
+		syShippingDetailsItemMapper.updateById(item);
+
 		UpdateWrapper updateWrapper=new UpdateWrapper();
 		updateWrapper.set("remaining_Quantity",remainingQuantity);
 		updateWrapper.set("excess_Quantity",excessQuantity);
@@ -208,6 +215,17 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return syPackingListFabricItemMapper.update(null,updateWrapper);
 	}
 
+	/**
+	 * 根据订单数据id获取单位
+	 * @param id
+	 * @return
+	 */
+	public String getMasterMetering(String id){
+		SyOrderDataItem syOrderDataItem=syOrderDataItemMapper.selectById(id);
+		System.out.println("单位\t"+syOrderDataItem.getMasterMetering());
+		return syOrderDataItem.getMasterMetering();
+	}
+
 	/**
 	 * 通过主页的编辑来修改数据
 	 * @param syPackingListFabric
@@ -543,7 +561,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					s1.setPrice(item.getSalesUnitPrice());//销售单价
 					s1.setGroupId(oConvertUtils.getId());//分组id
 					s1.setInventoryCcode(item.getInventoryCcode());//物料分类
-					s1.setMasterMetering(item.getMasterMetering());//单位
+					s1.setMasterMetering(getMasterMetering(item.getSyOrderDataItemId()));//计量单位
 					syPackingListFabric.setSyDeclarationElementsId(item.getShippingDetailsId());//出运明细主表id
 					s1.setSpecificationAndModel(item.getSpecificationAndModel());//规格型号
 					s1.setAccount(item.getAccount());//账套号
@@ -588,10 +606,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					s1.setSpecificationAndModel(item.getSpecificationAndModel());//规格型号
 
 					if(s1.getActualDeclaredQuantity()!=null){
-						s1.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getOrderRemainingQuantity()));//超发数量
-						s1.setRemainingQuantity(item.getOrderRemainingQuantity().subtract(s1.getActualDeclaredQuantity()));//剩余数量
-						item.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getOrderRemainingQuantity()));
-						item.setOrderRemainingQuantity(item.getOrderRemainingQuantity().subtract(s1.getActualDeclaredQuantity()));
+						//s1.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getOrderRemainingQuantity()));//超发数量
+						//s1.setRemainingQuantity(item.getOrderRemainingQuantity().subtract(s1.getActualDeclaredQuantity()));//剩余数量
+						/*item.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getOrderRemainingQuantity()));
+						item.setOrderRemainingQuantity(item.getOrderRemainingQuantity().subtract(s1.getActualDeclaredQuantity()));*/
 						updateQuantity(s1.getActualDeclaredQuantity(),s1.getSyShippingDetailsItemId());
 					}
 					item.setIsReference(2);
@@ -651,6 +669,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					item.setSyOrderDataItemId(syShippingDetailsItem.getSyOrderDataItemId());//销售订单主表id
 					item.setSyOrderDataId(syShippingDetailsItem.getSyOrderDataId());//销售订单子表id
 					item.setGroupId(oConvertUtils.getId());
+					item.setMasterMetering(getMasterMetering(item.getSyOrderDataItemId()));
 					item.setPurOrSubOrder(syShippingDetailsItem.getPurOrSubOrder());//委外采购订单
 					item.setManualYarnUnitPrice(syShippingDetailsItem.getManualYarnUnitPrice());//手册纱单价
 					item.setManualYarnFlag(syShippingDetailsItem.getManualYarnFlag());//手册纱单价
@@ -697,10 +716,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 					}
 					if(item.getActualDeclaredQuantity()!=null){//计算超发和剩余数量
-						item.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getOrderRemainingQuantity()));//超发数量
-						item.setRemainingQuantity(syShippingDetailsItem.getOrderRemainingQuantity().subtract(item.getActualDeclaredQuantity()));//剩余数量
-						syShippingDetailsItem.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getOrderRemainingQuantity()));
-						syShippingDetailsItem.setOrderRemainingQuantity(syShippingDetailsItem.getOrderRemainingQuantity().subtract(item.getActualDeclaredQuantity()));
+						//item.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getOrderRemainingQuantity()));//超发数量
+						//item.setRemainingQuantity(syShippingDetailsItem.getOrderRemainingQuantity().subtract(item.getActualDeclaredQuantity()));//剩余数量
+						/*syShippingDetailsItem.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getOrderRemainingQuantity()));
+						syShippingDetailsItem.setOrderRemainingQuantity(syShippingDetailsItem.getOrderRemainingQuantity().subtract(item.getActualDeclaredQuantity()));*/
 						syShippingDetailsItem.setIsReference(2);//回写
 						syShippingDetailsItemMapper.updateById(syShippingDetailsItem);
 						updateQuantity(item.getActualDeclaredQuantity(),item.getSyShippingDetailsItemId());
@@ -1050,13 +1069,14 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
 				}
 				if(!mapt.get("CVENCODE").equals("one")){//查询供应商表获取编码 	顺序---3
-					String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
-					if(wheCode!=null){
-						map.put("CWHCODE",wheCode);//仓库编码
-						map4.put("CWHCODE",wheCode);//仓库编码
-						mapItem3.put("CWHCODE",wheCode);//仓库编码	这个是子表需要字段
-						mapItem6.put("CWHCODE",wheCode);//仓库编码
+					if(!mapt.containsKey("CWHCODE")){
+						String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
+						mapt.put("CWHCODE",wheCode);
 					}
+					map.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码
+					map4.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码
+					mapItem3.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码	这个是子表需要字段
+					mapItem6.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码
 				}
 				mapt.put("poid","one");//重置销售订单id
 
@@ -1666,9 +1686,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							sy1.setSupplierCodePrintingPlant(syShippingDetailsItem.getSupplierCode());//供应商
 							sy1.setSyShippingDetailsId(syShippingDetailsItem.getShippingDetailsId());//出运明细主表id
 							sy1.setFactoryUnitPrice(syShippingDetailsItem.getFactoryUnitPrice());
-							if(sy1.getMasterMetering()==null){
-								sy1.setMasterMetering(syShippingDetailsItem.getMasterMetering());
-							}
+							sy1.setMasterMetering(getMasterMetering(sy1.getSyOrderDataItemId()));//单位
 							sy1.setSyShippingDetailsItemId(syShippingDetailsItem.getId());//出运明细子表id
 							sy1.setManualYarnUnitPrice(syShippingDetailsItem.getManualYarnUnitPrice());//手册纱单价
 							sy1.setManualYarnFlag(syShippingDetailsItem.getManualYarnFlag());//是否手册纱

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -809,6 +809,8 @@ public class SyPackingListTailoringController {
 
 	 }
 
+
+
 	 protected static void refreshSheet(Workbook workbook,List<SyPackingListTailoring> items) {
 		 CellStyle cellStyle = workbook.createCellStyle();//设置单元格样式
 

+ 10 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

@@ -829,9 +829,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 				Map<String,Object> orderDataItem=null;// inum
 				if(!mapt.get("account").equals("903")){ //采购订单子表数据  顺序---2
-					System.out.println("mapt.get(\"orderNumber\")\n"+mapt.get("orderNumber"));
+					/*System.out.println("mapt.get(\"orderNumber\")\n"+mapt.get("orderNumber"));
 					System.out.println("mapt.containsKey(\"itemSort\")\t"+mapt.containsKey("itemSort"));
-					System.out.println("item.getOmpoIdItem()\t"+item.getOmpoIdItem());
+					System.out.println("item.getOmpoIdItem()\t"+item.getOmpoIdItem());*/
 					if(!mapt.containsKey("itemSort")){  //第一次进行循环
 						orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("PO_PoDetails", "ID='"+item.getOmpoIdItem()+"'","ID");
 					}else{
@@ -868,14 +868,16 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					/*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
 					mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
 				}
+
 				if(!mapt.get("CVENCODE").equals("one")){//查询供应商表获取编码 	顺序---3
-					String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
-					if(wheCode!=null){
-						map.put("CWHCODE",wheCode);//仓库编码
-						map4.put("CWHCODE",wheCode);//仓库编码
-						mapItem3.put("CWHCODE",wheCode);//仓库编码	这个是子表需要字段
-						mapItem6.put("CWHCODE",wheCode);//仓库编码
+					if(!mapt.containsKey("CWHCODE")){
+						String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
+						mapt.put("CWHCODE",wheCode);
 					}
+					map.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码
+					map4.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码
+					mapItem3.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码	这个是子表需要字段
+					mapItem6.put("CWHCODE",mapt.get("CWHCODE"));//仓库编码
 				}
 				mapt.put("poid","one");//重置销售订单id