Ver Fonte

面辅料接收云工厂调整

huxy há 2 anos atrás
pai
commit
0e66b2cd7f

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

@@ -570,7 +570,7 @@ public class SyPackingListFabricController {
 	 @AutoLog(value = "装箱单面辅料JSON")
 	 @ApiOperation(value="装箱单面辅料JSON", notes="装箱单面辅料JSON")
 	 @GetMapping(value = "/pushSplt")
-	 public List pushSplt(String id) {
+	 public JSONObject pushSplt(String id) {
 		 List list=new ArrayList();
 		 SyPackingListFabric syPackingListFabric= syPackingListFabricService.getById(id);
 		 QueryWrapper queryWrapper=new QueryWrapper();
@@ -582,10 +582,10 @@ public class SyPackingListFabricController {
 		 syPackingListFabric.setSyPackingListFabricItem(items);
 		 syPackingListFabric.setCreateTime(null);
 		 list.add(syPackingListFabric);
-		// Gson userGson = new GsonBuilder().create();
-		// //JSONObject jsonObjec=new JSONObject();
-		// jsonObjec.put("splfi", userGson.toJson(JSONObject.toJSON(list)));
-		 return list;
+		 Gson userGson = new GsonBuilder().create();
+		 JSONObject jsonObjec=new JSONObject();
+		 jsonObjec.put("splfi", userGson.toJson(JSONObject.toJSON(list)));
+		 return jsonObjec;
 	 }
 
 	 @AutoLog(value = "测试接收功能")

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

@@ -496,6 +496,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	@Transactional
 	public void saveList(List<SyPackingListFabric> syPackingListTailorings) {
 		for (SyPackingListFabric syPackingListFabric : syPackingListTailorings){
+			syPackingListFabric.setId(null);
 			SimpleDateFormat sf= new SimpleDateFormat("yyMMdd");
 			QueryWrapper<SyPackingListFabric> queryWrapperCount=new QueryWrapper<>();
 			queryWrapperCount.like("create_time", new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis()));
@@ -507,8 +508,32 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			syPackingListFabric.setDelFlag("0");
 			syPackingListFabricMapper.insert(syPackingListFabric);
 			for (SyPackingListFabricItem s1 : syPackingListFabric.getSyPackingListFabricItem()) {
+				s1.setId(null);
 				s1.setDelFlag("0");
 				s1.setSyPackingListFabricId(syPackingListFabric.getId());
+				SyShippingDetailsItem item=syShippingDetailsItemMapper.selectById(s1.getSyShippingDetailsItemId());
+				if(item!=null){
+					//规格型号	超发	发运明细剩余数量	业务部门		价格	总价(计算)
+					s1.setSalesDepartment(item.getSalesDepartment());//业务部门
+					s1.setPrice(item.getSalesUnitPrice());//销售单价
+					s1.setSpecificationAndModel(item.getSpecificationAndModel());//规格型号
+					s1.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getSurplusQuantity()));//超发数量
+					s1.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()).intValue());//剩余数量
+					item.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getSurplusQuantity()));
+					item.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()));
+					syShippingDetailsItemMapper.updateById(item);
+					if(s1.getActualDeclaredQuantity()!=null){
+						s1.setTotalPrice(s1.getActualDeclaredQuantity().multiply(s1.getPrice()));//实际报关数量*单价
+					}
+					if((s1.getInventoryCode().indexOf("03")!=-1&&!s1.getInventoryCode().equals("0399")) ||
+						(s1.getInventoryCode().indexOf("04")!=-1&&!s1.getInventoryCode().equals("0499"))){
+						if(s1!=null&&s1.getMasterMetering().equals("KG")){//当单位为KG时
+							s1.setTotalPrice(s1.getNetWeight().multiply(s1.getPrice()));//净重*单价
+						}else if(s1!=null&&s1.getMasterMetering().equals("M")){
+							s1.setTotalPrice(s1.getMeter().multiply(s1.getPrice()));//米数*单价
+						}
+					}
+				}
 				syPackingListFabricItemMapper.insert(s1);
 			}
 		}