|
@@ -142,7 +142,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
entity.setPurOrSubOrder(detailsItem.getPurOrSubOrder());//采购委外订单号
|
|
entity.setPurOrSubOrder(detailsItem.getPurOrSubOrder());//采购委外订单号
|
|
entity.setPrice(detailsItem.getSalesUnitPrice());//单价
|
|
entity.setPrice(detailsItem.getSalesUnitPrice());//单价
|
|
entity.setFactoryUnitPrice(detailsItem.getFactoryUnitPrice());//工厂单价
|
|
entity.setFactoryUnitPrice(detailsItem.getFactoryUnitPrice());//工厂单价
|
|
-
|
|
|
|
|
|
+ updateQuantity(entity.getActualDeclaredQuantity(),entity.getSyShippingDetailsItemId());
|
|
|
|
|
|
|
|
|
|
if((entity.getInventoryCcode().indexOf("03")!=-1&&!entity.getInventoryCcode().equals("0399")) ||
|
|
if((entity.getInventoryCcode().indexOf("03")!=-1&&!entity.getInventoryCcode().equals("0399")) ||
|
|
@@ -170,6 +170,41 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
return syPackingListFabric;
|
|
return syPackingListFabric;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @param quantity 本次数量
|
|
|
|
+ * @param syShippingDetailsItemId 出运明细id
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public int updateQuantity(BigDecimal quantity,String syShippingDetailsItemId){
|
|
|
|
+ QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("sy_shipping_details_item_id", syShippingDetailsItemId);//出运明细id
|
|
|
|
+ queryWrapper.eq("del_flag", "0");//未删除
|
|
|
|
+ queryWrapper.select("sum(actual_Declared_Quantity) as actualDeclaredQuantity");//获取实际报关数量合计
|
|
|
|
+ BigDecimal actualDeclaredQuantity=syPackingListFabricItemMapper.selectOne(queryWrapper).getActualDeclaredQuantity();
|
|
|
|
+ actualDeclaredQuantity.add(quantity);
|
|
|
|
+
|
|
|
|
+ QueryWrapper queryWrapper2=new QueryWrapper();
|
|
|
|
+ queryWrapper2.eq("id", syShippingDetailsItemId);//出运明细id
|
|
|
|
+ queryWrapper2.eq("del_flag", "0");//未删除
|
|
|
|
+ queryWrapper2.select("sum(shipment_Quantity) as shipment_Quantity");//获取发货数量
|
|
|
|
+ BigDecimal shipmentQuantity=syShippingDetailsItemMapper.selectOne(queryWrapper2).getShipmentQuantity();
|
|
|
|
+
|
|
|
|
+ BigDecimal remainingQuantity=shipmentQuantity.subtract(actualDeclaredQuantity);//剩余数量
|
|
|
|
+ BigDecimal excessQuantity=null;//超发数量
|
|
|
|
+ if(actualDeclaredQuantity.doubleValue()>shipmentQuantity.doubleValue()){
|
|
|
|
+ excessQuantity=actualDeclaredQuantity.subtract(shipmentQuantity);
|
|
|
|
+ }
|
|
|
|
+ if(excessQuantity.doubleValue()<=0){
|
|
|
|
+ excessQuantity=null;//转为null
|
|
|
|
+ }
|
|
|
|
+ UpdateWrapper updateWrapper=new UpdateWrapper();
|
|
|
|
+ updateWrapper.set("remaining_Quantity",remainingQuantity);
|
|
|
|
+ updateWrapper.set("excess_Quantity",excessQuantity);
|
|
|
|
+ updateWrapper.eq("sy_shipping_details_item_id",syShippingDetailsItemId);
|
|
|
|
+ return syPackingListFabricItemMapper.update(null,updateWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public SyPackingListFabric updateMain(SyPackingListFabric syPackingListFabric,List<SyPackingListFabricItem> syPackingListFabricItemList) {
|
|
public SyPackingListFabric updateMain(SyPackingListFabric syPackingListFabric,List<SyPackingListFabricItem> syPackingListFabricItemList) {
|
|
@@ -203,6 +238,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
entity.setInventoryQuantity(entity.getActualDeclaredQuantity());//入库数量=实际报关数量
|
|
entity.setInventoryQuantity(entity.getActualDeclaredQuantity());//入库数量=实际报关数量
|
|
if(entity.getIsAdd()>0){//大于1就是新增数据
|
|
if(entity.getIsAdd()>0){//大于1就是新增数据
|
|
|
|
+ updateQuantity(entity.getActualDeclaredQuantity(),entity.getSyShippingDetailsItemId());
|
|
//因为云工场得修改时得停止调用前面接口
|
|
//因为云工场得修改时得停止调用前面接口
|
|
/*SyShippingDetailsItem s1 =syShippingDetailsItemMapper.selectById(entity.getSyShippingDetailsItemId());
|
|
/*SyShippingDetailsItem s1 =syShippingDetailsItemMapper.selectById(entity.getSyShippingDetailsItemId());
|
|
//剩余数量-这次入库数量=新剩余数量
|
|
//剩余数量-这次入库数量=新剩余数量
|
|
@@ -224,6 +260,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
entity.setId(null);
|
|
entity.setId(null);
|
|
syPackingListFabricItemMapper.insert(entity);
|
|
syPackingListFabricItemMapper.insert(entity);
|
|
}else{
|
|
}else{
|
|
|
|
+ QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("id", entity.getId());//子表id
|
|
|
|
+ queryWrapper.select("actual_Declared_Quantity as actualDeclaredQuantity");//获取实际报关数量合计
|
|
|
|
+ BigDecimal actualDeclaredQuantity=syPackingListFabricItemMapper.selectOne(queryWrapper).getActualDeclaredQuantity();
|
|
|
|
+ actualDeclaredQuantity=actualDeclaredQuantity.subtract(entity.getActualDeclaredQuantity());
|
|
|
|
+ updateQuantity(actualDeclaredQuantity.negate(),entity.getSyShippingDetailsItemId());
|
|
syPackingListFabricItemMapper.updateById(entity);
|
|
syPackingListFabricItemMapper.updateById(entity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -233,6 +275,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public void delMain(String id) {
|
|
public void delMain(String id) {
|
|
|
|
+ QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("sy_packing_list_fabric_id",id);
|
|
|
|
+ List<SyPackingListFabricItem> syPackingListFabricItems=syPackingListFabricItemMapper.selectList(queryWrapper);
|
|
|
|
+ for(SyPackingListFabricItem item : syPackingListFabricItems){
|
|
|
|
+ updateQuantity(item.getActualDeclaredQuantity().negate(),item.getSyShippingDetailsItemId());
|
|
|
|
+ }
|
|
syPackingListFabricItemMapper.deleteByMainId(id);
|
|
syPackingListFabricItemMapper.deleteByMainId(id);
|
|
syPackingListFabricMapper.deleteByMainId(id);
|
|
syPackingListFabricMapper.deleteByMainId(id);
|
|
}
|
|
}
|
|
@@ -241,6 +289,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
@Transactional
|
|
@Transactional
|
|
public void delBatchMain(Collection<? extends Serializable> idList) {
|
|
public void delBatchMain(Collection<? extends Serializable> idList) {
|
|
for(Serializable id:idList) {
|
|
for(Serializable id:idList) {
|
|
|
|
+ QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("sy_packing_list_fabric_id",id);
|
|
|
|
+ List<SyPackingListFabricItem> syPackingListFabricItems=syPackingListFabricItemMapper.selectList(queryWrapper);
|
|
|
|
+ for(SyPackingListFabricItem item : syPackingListFabricItems){
|
|
|
|
+ updateQuantity(item.getActualDeclaredQuantity().negate(),item.getSyShippingDetailsItemId());
|
|
|
|
+ }
|
|
syPackingListFabricItemMapper.deleteByMainId(id.toString());
|
|
syPackingListFabricItemMapper.deleteByMainId(id.toString());
|
|
syPackingListFabricMapper.deleteByMainId(id.toString());
|
|
syPackingListFabricMapper.deleteByMainId(id.toString());
|
|
}
|
|
}
|
|
@@ -480,6 +534,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
s1.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()).intValue());//剩余数量
|
|
s1.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()).intValue());//剩余数量
|
|
item.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getSurplusQuantity()));
|
|
item.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getSurplusQuantity()));
|
|
item.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()));
|
|
item.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()));
|
|
|
|
+ updateQuantity(s1.getActualDeclaredQuantity(),s1.getSyShippingDetailsItemId());
|
|
}
|
|
}
|
|
item.setIsReference(2);
|
|
item.setIsReference(2);
|
|
syShippingDetailsItemMapper.updateById(item);
|
|
syShippingDetailsItemMapper.updateById(item);
|
|
@@ -590,6 +645,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
syShippingDetailsItem.setSurplusQuantity(syShippingDetailsItem.getSurplusQuantity().subtract(item.getActualDeclaredQuantity()));
|
|
syShippingDetailsItem.setSurplusQuantity(syShippingDetailsItem.getSurplusQuantity().subtract(item.getActualDeclaredQuantity()));
|
|
syShippingDetailsItem.setIsReference(2);//回写
|
|
syShippingDetailsItem.setIsReference(2);//回写
|
|
syShippingDetailsItemMapper.updateById(syShippingDetailsItem);
|
|
syShippingDetailsItemMapper.updateById(syShippingDetailsItem);
|
|
|
|
+ updateQuantity(item.getActualDeclaredQuantity(),item.getSyShippingDetailsItemId());
|
|
}
|
|
}
|
|
syPackingListFabricItemMapper.insert(item);
|
|
syPackingListFabricItemMapper.insert(item);
|
|
}
|
|
}
|
|
@@ -615,6 +671,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
|
|
|
|
String ids="";
|
|
String ids="";
|
|
|
|
+ String name="";
|
|
for (SyPackingListFabricItem item :main.getSyPackingListFabricItem()){
|
|
for (SyPackingListFabricItem item :main.getSyPackingListFabricItem()){
|
|
SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(item.getSyShippingDetailsItemId());//获取物料分类和其他数据
|
|
SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(item.getSyShippingDetailsItemId());//获取物料分类和其他数据
|
|
//物料分类
|
|
//物料分类
|
|
@@ -650,8 +707,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
}
|
|
}
|
|
//单位换算
|
|
//单位换算
|
|
total3=total3.add(item.getActualDeclaredQuantity());
|
|
total3=total3.add(item.getActualDeclaredQuantity());
|
|
|
|
+ name=item.getPlanLotNumber()+"-"+item.getDeclarationName();
|
|
ids+=item.getSyShippingDetailsItemId()+",";//获取出运明细子表id
|
|
ids+=item.getSyShippingDetailsItemId()+",";//获取出运明细子表id
|
|
-
|
|
|
|
}
|
|
}
|
|
if(!ids.equals("")){
|
|
if(!ids.equals("")){
|
|
|
|
|
|
@@ -674,7 +731,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
total2=syPackingListFabricItem.getActualDeclaredQuantity();
|
|
total2=syPackingListFabricItem.getActualDeclaredQuantity();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- strs+="第"+num+"页原单据数量"+total1+",已参照数量"+total2+",本次数量"+total3+";";
|
|
|
|
|
|
+ total1.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ total2.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ total3.setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ strs+=name+"的原单据数量"+total1+",已参照数量"+total2+",本次数量"+total3+";";
|
|
num++;
|
|
num++;
|
|
}
|
|
}
|
|
return strs;
|
|
return strs;
|
|
@@ -1572,6 +1632,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(sy1.getActualDeclaredQuantity()!=null){
|
|
|
|
+ updateQuantity(sy1.getActualDeclaredQuantity(),sy1.getSyShippingDetailsItemId());
|
|
|
|
+ }
|
|
|
|
+
|
|
items.add(sy1);
|
|
items.add(sy1);
|
|
syShippingDetailsItem.setIsPull("2");//拉取成功
|
|
syShippingDetailsItem.setIsPull("2");//拉取成功
|
|
syShippingDetailsItem.setIsReference(2);//回写
|
|
syShippingDetailsItem.setIsReference(2);//回写
|