瀏覽代碼

面辅料导入提示

huxy 2 年之前
父節點
當前提交
88b5f40ccd

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

@@ -525,52 +525,49 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			BigDecimal total2=new BigDecimal("0");
 			BigDecimal total3=new BigDecimal("0");
 			String ids="";
-
 			for (SyPackingListFabricItem item :main.getSyPackingListFabricItem()){
 				SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(item.getSyShippingDetailsItemId());//获取物料分类和其他数据
 				//物料分类
 				if(syShippingDetailsItem!=null){//不为null
-					SyOrderDataItem syOrderDataItem=syOrderDataItemMapper.selectById(syShippingDetailsItem.getSyOrderDataItemId());//获取单位
 					item.setInventoryCcode(syShippingDetailsItem.getInventoryCcode());//物料分类
 					item.setPrice(syShippingDetailsItem.getSalesUnitPrice());//价格
-					if(syOrderDataItem!=null){//不为null
-
-						if((item.getInventoryCcode().indexOf("03")!=-1&&!item.getInventoryCcode().equals("0399")) ||
-								(item.getInventoryCcode().indexOf("02")!=-1&&!item.getInventoryCcode().equals("0299"))||
-								(item.getInventoryCcode().indexOf("04")!=-1&&!item.getInventoryCcode().equals("0499"))){//面料
-							//米数计算公式 净重/(门幅/100)/(克重/1000)
-							if(item.getNetWeight()!=null&&item.getGramWeight()!=null&&item.getWidth()!=null){
-								BigDecimal netWeight=item.getNetWeight();//净重
-								BigDecimal gramWeight=new BigDecimal(item.getGramWeight());//克重
-								BigDecimal width=new BigDecimal(item.getWidth());//门幅
-								if(gramWeight.intValue()==0||width.intValue()==0||netWeight.intValue()==0){
-
-								}else{
-									BigDecimal meter=netWeight.multiply(gramWeight).multiply(width).divide(new BigDecimal("100000"));//米数
-									item.setMeter(meter);//米数
-								}
-							}
+					item.setMasterMetering(syShippingDetailsItem.getMasterMetering());//单位
+					if((item.getInventoryCcode().indexOf("03")!=-1&&!item.getInventoryCcode().equals("0399")) ||
+							(item.getInventoryCcode().indexOf("02")!=-1&&!item.getInventoryCcode().equals("0299"))||
+							(item.getInventoryCcode().indexOf("04")!=-1&&!item.getInventoryCcode().equals("0499"))){//面料
+						//米数计算公式 净重/(门幅/100)/(克重/1000)
+						if(item.getNetWeight()!=null&&item.getGramWeight()!=null&&item.getWidth()!=null){
+							BigDecimal netWeight=item.getNetWeight();//净重
+							BigDecimal gramWeight=new BigDecimal(item.getGramWeight());//克重
+							BigDecimal width=new BigDecimal(item.getWidth());//门幅
+							if(gramWeight.intValue()==0||width.intValue()==0||netWeight.intValue()==0){
 
-							if(item!=null&&item.getMasterMetering().equals("KG")){//KG
-								item.setTotalPrice(item.getNetWeight().multiply(item.getPrice()));//净重*单价
-							}else if(item!=null&&item.getMasterMetering().equals("M")){//M
-								if(item.getMeter()==null){
-									throw new JeecgBootException("净重、门幅、克重之间有值为空,无法计算米数");
-								}
-								item.setTotalPrice(item.getMeter().multiply(item.getPrice()));//米数*单价
-							}else if(item.getActualDeclaredQuantity()!=null){//其他
-								item.setTotalPrice(item.getActualDeclaredQuantity().multiply(item.getPrice()));//米数*单价
 							}else{
-								throw new JeecgBootException("请给单位不为KG或者M的面辅料填上实际报关数量");
-							}
-						}else{////辅料
-							if(item.getActualDeclaredQuantity()!=null){//其他
-								item.setTotalPrice(item.getActualDeclaredQuantity().multiply(item.getPrice()));//米数*单价
-							}else{
-								throw new JeecgBootException("请给单位不为KG或者M的面辅料填上实际报关数量");
+								BigDecimal meter=netWeight.multiply(gramWeight).multiply(width).divide(new BigDecimal("100000"));//米数
+								item.setMeter(meter);//米数
 							}
 						}
 
+						if(item!=null&&item.getMasterMetering().equals("KG")){//KG
+							item.setTotalPrice(item.getNetWeight().multiply(item.getPrice()));//净重*单价
+							item.setActualDeclaredQuantity(item.getNetWeight());
+						}else if(item!=null&&item.getMasterMetering().equals("M")){//M
+							if(item.getMeter()==null){
+								throw new JeecgBootException("净重、门幅、克重之间有值为空,无法计算米数");
+							}
+							item.setActualDeclaredQuantity(item.getMeter());
+							item.setTotalPrice(item.getMeter().multiply(item.getPrice()));//米数*单价
+						}else if(item.getActualDeclaredQuantity()!=null){//其他
+							item.setTotalPrice(item.getActualDeclaredQuantity().multiply(item.getPrice()));//米数*单价
+						}else{
+							throw new JeecgBootException("请给单位不为KG或者M的面辅料填上实际报关数量");
+						}
+					}else{////辅料
+						if(item.getActualDeclaredQuantity()!=null){//其他
+							item.setTotalPrice(item.getActualDeclaredQuantity().multiply(item.getPrice()));//米数*单价
+						}else{
+							throw new JeecgBootException("请给单位不为KG或者M的面辅料填上实际报关数量");
+						}
 					}
 				}
 				//单位换算
@@ -586,7 +583,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				queryWrapper.select("sum(shipment_Quantity) as shipment_Quantity");
 				SyShippingDetailsItem syShippingDetails=syShippingDetailsItemMapper.selectOne(queryWrapper);
 				if(syShippingDetails==null){
-					throw new JeecgBootException("该单据在上游未找到");
+				//	throw new JeecgBootException("该单据在上游未找到");
 				}else{
 					total1=syShippingDetails.getShipmentQuantity();
 				}
@@ -599,6 +596,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					System.out.println("syPackingListFabricItem为\t"+syPackingListFabricItem.getActualDeclaredQuantity());//报关数量
 					//throw new JeecgBootException("该单据已被成衣参照!请勿重复操作");
 				}
+				//total2=syPackingListFabricItem.getActualDeclaredQuantity();
+			//	System.out.println("syPackingListFabricItem为\t"+syPackingListFabricItem.getActualDeclaredQuantity());//报关数量
 			}
 			strs+="第"+num+"页原单据数量"+total1+",已参照数量"+total2+",本次数量"+total3+";";
 			num++;