|
@@ -403,49 +403,53 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
}
|
|
|
//2.子表数据重新插入
|
|
|
int i=0;
|
|
|
+ List<String> shippingItemIds=new ArrayList<>();
|
|
|
for(SyPackingListFabricItem entity : syPackingListFabricItemList) {
|
|
|
+ shippingItemIds.add(entity.getSyShippingDetailsItemId());//获取出运明细子表id
|
|
|
if(maps.containsKey(entity.getId())){
|
|
|
//entity.setDelFlag("0");
|
|
|
//外键设置
|
|
|
//entity.setSyPackingListFabricId(syPackingListFabric.getId());
|
|
|
SyPackingListFabricItem entity1=maps.get(entity.getId());
|
|
|
+ entity1.setExcessQuantity(null);
|
|
|
+ entity1.setRemainingQuantity(null);
|
|
|
entity.setInventoryQuantity(entity.getActualDeclaredQuantity());//入库数量=实际报关数量
|
|
|
if(entity.getIsAdd()>0){//大于1就是新增数据
|
|
|
entity.setId(null);
|
|
|
syPackingListFabricItemMapper.insert(entity);
|
|
|
- if(entity.getMasterMetering()==null){
|
|
|
- throw new JeecgBootException("没有单位无法保存");
|
|
|
- }
|
|
|
- if(entity.getMasterMetering().equals("KG")){
|
|
|
- updateQuantity(entity.getNetWeight(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
- }else{
|
|
|
- updateQuantity(entity.getActualDeclaredQuantity(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
- }
|
|
|
+// if(entity.getMasterMetering()==null){
|
|
|
+// throw new JeecgBootException("没有单位无法保存");
|
|
|
+// }
|
|
|
+// if(entity.getMasterMetering().equals("KG")){
|
|
|
+// updateQuantity(entity.getNetWeight(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
+// }else{
|
|
|
+// updateQuantity(entity.getActualDeclaredQuantity(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
+// }
|
|
|
}else{
|
|
|
- if(entity.getMasterMetering().equals("KG")){//根据净重
|
|
|
- /*QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
- queryWrapper.eq("id", entity.getId());//子表id
|
|
|
- queryWrapper.select("net_Weight as netWeight");//获取实际报关数量合计*/
|
|
|
- BigDecimal netWeight=new BigDecimal("0");
|
|
|
- if(entity.getNetWeight()!=null){
|
|
|
- netWeight=entity.getNetWeight();
|
|
|
- }
|
|
|
- netWeight=netWeight.subtract(entity1.getNetWeight());
|
|
|
- //syPackingListFabricItemMapper.updateById(entity1);
|
|
|
- if(netWeight.doubleValue()!=0){
|
|
|
- updateQuantity(netWeight.negate(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
- }
|
|
|
- }else{//根据实际报关数量
|
|
|
- BigDecimal actualDeclaredQuantity=new BigDecimal("0");
|
|
|
- if(entity.getActualDeclaredQuantity()!=null){
|
|
|
- actualDeclaredQuantity=entity.getActualDeclaredQuantity();
|
|
|
- }
|
|
|
- actualDeclaredQuantity=actualDeclaredQuantity.subtract(entity1.getActualDeclaredQuantity());
|
|
|
- //syPackingListFabricItemMapper.updateById(entity1);
|
|
|
- if(actualDeclaredQuantity.doubleValue()!=0){
|
|
|
- updateQuantity(actualDeclaredQuantity.negate(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
- }
|
|
|
- }
|
|
|
+// if(entity.getMasterMetering().equals("KG")){//根据净重
|
|
|
+// /*QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
+// queryWrapper.eq("id", entity.getId());//子表id
|
|
|
+// queryWrapper.select("net_Weight as netWeight");//获取实际报关数量合计*/
|
|
|
+// BigDecimal netWeight=new BigDecimal("0");
|
|
|
+// if(entity.getNetWeight()!=null){
|
|
|
+// netWeight=entity.getNetWeight();
|
|
|
+// }
|
|
|
+// netWeight=netWeight.subtract(entity1.getNetWeight());
|
|
|
+// //syPackingListFabricItemMapper.updateById(entity1);
|
|
|
+// if(netWeight.doubleValue()!=0){
|
|
|
+// updateQuantity(netWeight.negate(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
+// }
|
|
|
+// }else{//根据实际报关数量
|
|
|
+// BigDecimal actualDeclaredQuantity=new BigDecimal("0");
|
|
|
+// if(entity.getActualDeclaredQuantity()!=null){
|
|
|
+// actualDeclaredQuantity=entity.getActualDeclaredQuantity();
|
|
|
+// }
|
|
|
+// actualDeclaredQuantity=actualDeclaredQuantity.subtract(entity1.getActualDeclaredQuantity());
|
|
|
+// //syPackingListFabricItemMapper.updateById(entity1);
|
|
|
+// if(actualDeclaredQuantity.doubleValue()!=0){
|
|
|
+// updateQuantity(actualDeclaredQuantity.negate(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
|
|
|
+// }
|
|
|
+// }
|
|
|
items2.add(entity);//获取所有子表
|
|
|
}
|
|
|
}else{
|
|
@@ -453,6 +457,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
}
|
|
|
}
|
|
|
syPackingListFabricItemService.updateBatchById(items2);
|
|
|
+ updateQuantitys(null,shippingItemIds);
|
|
|
return syPackingListFabric;
|
|
|
}
|
|
|
|