|
@@ -23,6 +23,7 @@ import org.jeecg.modules.documents.seclarationElements.mapper.SyDeclarationEleme
|
|
|
import org.jeecg.modules.documents.seclarationElements.mapper.SyDeclarationElementsMapper;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetails;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo;
|
|
|
import org.jeecg.modules.documents.shippingDetails.mapper.SyShippingDetailsItemMapper;
|
|
|
import org.jeecg.modules.documents.shippingDetails.mapper.SyShippingDetailsMapper;
|
|
@@ -84,23 +85,23 @@ import java.util.*;
|
|
|
@Service
|
|
|
public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFabricMapper, SyPackingListFabric> implements ISyPackingListFabricService, Job {
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyPackingListFabricMapper syPackingListFabricMapper;
|
|
|
@Autowired
|
|
|
private ISyPackingListFabricItemService syPackingListFabricItemService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyPackingListFabricItemMapper syPackingListFabricItemMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyShippingDetailsMapper syShippingDetailsMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyShippingDetailsItemMapper syShippingDetailsItemMapper;
|
|
|
@Autowired
|
|
|
private ISyShippingDetailsItemService iSyShippingDetailsItemService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyDeclarationElementsMapper syDeclarationElementsMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyOrderDataMapper syOrderDataMapper;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyOrderDataItemMapper syOrderDataItemMapper;
|
|
|
@Autowired
|
|
|
private ISenYuDataSourceOne senYuDataSourceOne;
|
|
@@ -110,7 +111,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
private ISenYuDataSourceThree senYuDataSourceThree;
|
|
|
@Autowired
|
|
|
private IDxpDataPlanService dxpDataPlanService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserMapper userMapper;//userMapper
|
|
|
|
|
|
String getUsername(String token){
|
|
@@ -1199,10 +1200,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
return strs;
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyPackingListTailoringMapper syPackingListTailoringMapper;//成衣mapper
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private PurchaseWarehousingMapper purchaseWarehousingMapper;//采购入库表
|
|
|
|
|
|
@Override
|
|
@@ -1238,7 +1239,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SyShippingOrderMapper syShippingOrderMapper;//托书主表
|
|
|
|
|
|
@Autowired
|
|
@@ -2280,7 +2281,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
}*/
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private DxpDataPlanMapper dxpDataPlanMapper;
|
|
|
|
|
|
/**
|
|
@@ -2946,4 +2947,111 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
}
|
|
|
return ids;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public RespUpdateVO saveSrmBill(SyPackingListFabric syPackingListFabric){
|
|
|
+ RespUpdateVO respUpdateVO = new RespUpdateVO();
|
|
|
+ respUpdateVO.setSuccess(false);
|
|
|
+ respUpdateVO.setExtraInfo("");
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyMMddHHmmssSSS");
|
|
|
+ String dateNo = "ML" + sf.format(System.currentTimeMillis()) + String.format("%03d", 1);//获取单据号
|
|
|
+ syPackingListFabric.setDelFlag("0");
|
|
|
+ syPackingListFabric.setStatus("0");
|
|
|
+ syPackingListFabric.setDocumentNo(dateNo);//单据号
|
|
|
+ syPackingListFabric.setDataSource("参照出运明细");//参照
|
|
|
+// String username = "admin";
|
|
|
+// if (oConvertUtils.isNotEmpty(token)) {
|
|
|
+// username = getUsername(token);
|
|
|
+// }
|
|
|
+// syPackingListFabric.setPreparedBy(username);//将admin设置为制单人
|
|
|
+// syPackingListFabric.setCreateBy(username);//将admin设置为制单人
|
|
|
+// if (username != null && username.equals("周泽济")) {
|
|
|
+// syPackingListFabric.setPushState("4");
|
|
|
+// }
|
|
|
+ syPackingListFabricMapper.insert(syPackingListFabric);
|
|
|
+ Map<String, String> mapId = new HashMap<String, String>();//key为发运明细子表id,value为分组id
|
|
|
+ BigDecimal total = new BigDecimal("0");//合计数量,初始为0
|
|
|
+ List<String> itemIds = new ArrayList<>();
|
|
|
+ for (SyPackingListFabricItem entity : syPackingListFabric.getSyPackingListFabricItem()) {
|
|
|
+ itemIds.add(entity.getSyShippingDetailsItemId());
|
|
|
+ //entity.setRemainingQuantity(entity.getInventoryQuantity());//入库数量
|
|
|
+ total = total.add(entity.getInventoryQuantity());//循环添加每条数据的入库数量
|
|
|
+ String key = entity.getSyShippingDetailsItemId();//获取发运明细子表id
|
|
|
+ if (!mapId.containsKey(key)) {//如果这个发运明细id没有分组id,就生成一个新的分组id
|
|
|
+ mapId.put(key, oConvertUtils.getId());
|
|
|
+ }
|
|
|
+ entity.setGroupId(mapId.get(key));//分组id
|
|
|
+ entity.setSyPackingListFabricId(syPackingListFabric.getId());//外键设置
|
|
|
+ entity.setDelFlag("0");//新增数据设置成未删除
|
|
|
+ //获取该发运明细子表数据,回写剩余数量
|
|
|
+ SyShippingDetailsItem detailsItem = syShippingDetailsItemMapper.selectById(entity.getSyShippingDetailsItemId());
|
|
|
+ //detailsItem.setIsReference(1);//修改成已被参照
|
|
|
+ //剩余数量-这次入库数量=新剩余数量
|
|
|
+ //detailsItem.setOrderRemainingQuantity(detailsItem.getOrderRemainingQuantity().subtract(entity.getInventoryQuantity()));
|
|
|
+ //此次入库数量-剩余数量=超发数量
|
|
|
+ //detailsItem.setExcessQuantity(entity.getInventoryQuantity().subtract(detailsItem.getOrderRemainingQuantity()));
|
|
|
+ detailsItem.setIsReference(2);//面辅料回写
|
|
|
+ entity.setSalesman(detailsItem.getSalesman());//获取业务员
|
|
|
+ entity.setIsTc(detailsItem.getIsTc());
|
|
|
+ entity.setSalesDepartment(detailsItem.getSalesDepartment());//获取业务部门
|
|
|
+ entity.setPreDeliveryDate(detailsItem.getPreDeliveryDate());//hod
|
|
|
+ entity.setOrderNumber(detailsItem.getOrderNumber());//获取订单号
|
|
|
+ entity.setSmallPo(detailsItem.getSmallPo());//小po
|
|
|
+ entity.setOmpoAccount(detailsItem.getOmpoAccount());
|
|
|
+ entity.setAccount(detailsItem.getAccount());
|
|
|
+ entity.setOmpoIdItem(detailsItem.getOmpoIdItem());
|
|
|
+ entity.setElementsId(detailsItem.getElementsId());
|
|
|
+ entity.setSyOrderDataItemId(detailsItem.getSyOrderDataItemId());
|
|
|
+ entity.setSyOrderDataId(detailsItem.getSyOrderDataId());
|
|
|
+ entity.setOmpoId(detailsItem.getOmpoId());
|
|
|
+ entity.setInventoryQuantity(entity.getActualDeclaredQuantity());//入库数量=实际报关数量
|
|
|
+ entity.setDistributionPoint(detailsItem.getDistributionPoint());//分销点
|
|
|
+ entity.setPurOrSubOrder(detailsItem.getPurOrSubOrder());//采购委外订单号
|
|
|
+ entity.setPrice(detailsItem.getSalesUnitPrice());//单价
|
|
|
+ entity.setFactoryUnitPrice(detailsItem.getFactoryUnitPrice());//工厂单价
|
|
|
+
|
|
|
+ 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.getInventoryCcode().substring(0, 2).equals("03") && !entity.getInventoryCcode().equals("0399")) ||
|
|
|
+ (entity.getInventoryCcode().substring(0, 2).equals("02") && !entity.getInventoryCcode().equals("0299")) ||
|
|
|
+ (entity.getInventoryCcode().substring(0, 2).equals("04") && !entity.getInventoryCcode().equals("0499"))) {
|
|
|
+ if (entity.getMeter() != null) {//前端计算米数
|
|
|
+ entity.setActualDeclaredQuantity(entity.getMeter());//修改报关数量
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (entity.getMasterMetering() != null && entity.getMasterMetering().equals("KG")) {//计算总价
|
|
|
+ if (entity.getNetWeight() != null) {
|
|
|
+ setNetWeight(entity);//净重保留两位小数
|
|
|
+ entity.setTotalPrice(entity.getNetWeight().multiply(entity.getPrice()).setScale(2, RoundingMode.HALF_UP));//净重*单价
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (entity.getActualDeclaredQuantity() != null) {
|
|
|
+ entity.setTotalPrice(entity.getActualDeclaredQuantity().multiply(entity.getPrice()).setScale(2, RoundingMode.HALF_UP));//实际报关数量*单价
|
|
|
+ }
|
|
|
+ }
|
|
|
+ syShippingDetailsItemMapper.updateById(detailsItem);
|
|
|
+ syPackingListFabricItemMapper.insert(entity);
|
|
|
+ respUpdateVO.setExtraInfo(respUpdateVO.getExtraInfo() + entity.getSrmId() + "," + entity.getId() + ";");
|
|
|
+ }
|
|
|
+ syPackingListFabric.setQuantity(total);//给数量附上初始值
|
|
|
+ syPackingListFabric.setRemainingQuantity(total);//给剩余数量附上初始值
|
|
|
+ syPackingListFabricMapper.updateById(syPackingListFabric);//重新修改数据
|
|
|
+ updateQuantitys(null, itemIds);
|
|
|
+ respUpdateVO.setMessage(syPackingListFabric.getId());
|
|
|
+ respUpdateVO.setSuccess(true);
|
|
|
+ }catch (Exception ex){
|
|
|
+ respUpdateVO.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+ return respUpdateVO;
|
|
|
+ }
|
|
|
}
|