|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesConfigService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesShippingOrderManagementService;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
@ -13,6 +13,7 @@ import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesJisShippingRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPartShippingGroupRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
@ -25,6 +26,8 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
@ -47,6 +50,9 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPartRepository partRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesPartService partService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesShippingOrderManagement bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getShippingGroupNo(), "shippingGroupNo", packBean);
|
|
|
|
@ -120,6 +126,11 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
groupDetailList.forEach(k -> {
|
|
|
|
|
MesShippingOrderManagementDetail detail = new MesShippingOrderManagementDetail();
|
|
|
|
|
|
|
|
|
|
MesPart part = partService.getPartByPartNo(k.getPartNo(), k.getOrganizeCode());
|
|
|
|
|
detail.setPartName(part.getPartName());
|
|
|
|
|
detail.setCustPartNo(k.getCustomerPartNo());
|
|
|
|
|
detail.setPlanQty(1D);
|
|
|
|
|
detail.setActualQty(1);
|
|
|
|
|
detail.setShippingOrderNo(finalBean.getShippingOrderNo());
|
|
|
|
|
detail.setOrganizeCode(k.getOrganizeCode());
|
|
|
|
|
detail.setStatus(MesExtEnumUtil.SHIPPING_ORDER_STATUS.CREATE.getValue());
|
|
|
|
@ -259,12 +270,13 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(originBean.getShippingOrderNo(), "shippingOrderNo", detailPackBean);
|
|
|
|
|
List<MesShippingOrderManagementDetail> detailDeleteList = detailService.findAll(detailPackBean);
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
|
Map<String, List<MesShippingOrderManagementDetail>> detailMap = detailDeleteList.stream().collect(Collectors.groupingBy(k -> k.getPartNo()));
|
|
|
|
|
|
|
|
|
|
List<MesJisShipping> jisShippingList = new ArrayList<>();
|
|
|
|
|
detailDeleteList.forEach(k -> {
|
|
|
|
|
detailMap.forEach((k, v) -> {
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(k.getPartNo(), "partNo", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(v.get(0).getPartNo(), "partNo", packBean);
|
|
|
|
|
MesPart part = partRepository.getByProperty(packBean);
|
|
|
|
|
|
|
|
|
|
MesJisShipping jisShipping = new MesJisShipping();
|
|
|
|
@ -277,13 +289,13 @@ public class MesShippingOrderManagementService extends BaseMesService<MesShippin
|
|
|
|
|
jisShipping.setErpWarerhouse(configService.getCfgValue(bean.getOrganizeCode(), "ERP_WARERHOUSE"));
|
|
|
|
|
jisShipping.setErpWarehous(configService.getCfgValue(bean.getOrganizeCode(), "ERP_WAREHOUS"));
|
|
|
|
|
jisShipping.setCusDock(originBean.getCustDockCode());
|
|
|
|
|
jisShipping.setCustOrderNo(k.getCustOrderNo());
|
|
|
|
|
jisShipping.setSerialNumber(k.getBarcode());
|
|
|
|
|
jisShipping.setQuantityPerCar(detailDeleteList.size());
|
|
|
|
|
jisShipping.setCustOrderNo(v.get(0).getCustOrderNo());
|
|
|
|
|
jisShipping.setSerialNumber(v.get(0).getBarcode());
|
|
|
|
|
jisShipping.setQuantityPerCar(v.size());
|
|
|
|
|
jisShipping.setShippingOrderCode(originBean.getShippingOrderNo());
|
|
|
|
|
jisShipping.setVin(k.getVin());
|
|
|
|
|
jisShipping.setCarNo(k.getVin());
|
|
|
|
|
if(!StringUtils.isEmpty(part)){
|
|
|
|
|
jisShipping.setVin(v.get(0).getVin());
|
|
|
|
|
jisShipping.setCarNo(v.get(0).getVin());
|
|
|
|
|
if (!StringUtils.isEmpty(part)) {
|
|
|
|
|
jisShipping.setUnit(part.getUnit());
|
|
|
|
|
}
|
|
|
|
|
jisShipping.setOffTime(TimeTool.getNowTime(true));
|
|
|
|
|