|
|
|
@ -11,6 +11,7 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPartShippingGroup;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingList;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.shipping.MesLoadingListDetail;
|
|
|
|
@ -62,6 +63,10 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
|
|
|
|
|
//校验装车单
|
|
|
|
|
MesLoadingList loadingListResult = checkLoadingList(loadingList.getOrderCode(), loadingList.getOrganizeCode(),loadingList.getIsPass(),loadingList.getModifyUser());
|
|
|
|
|
//跳过
|
|
|
|
|
if(Objects.equals(MesPcnExtConstWords.THREE,loadingList.getIsPass())){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//若生成装车单,则一定有装车单明细
|
|
|
|
|
DdlPackBean orderDetailPackBean = DdlPackBean.getDdlPackBean(loadingList.getOrganizeCode());
|
|
|
|
@ -141,7 +146,8 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
//MesLoadingList loadingList = checkLoadingList(model.getOrderCode(), organizeCode,model.getIsPass(),userInfo);
|
|
|
|
|
|
|
|
|
|
//根据扫描的发运单以及前端传的发运单明细,进行匹配,若没有找到扫描的发运单,则提示扫描的发运单号不在此装车单中,请检查数据!。
|
|
|
|
|
if(!Objects.isNull(model.getIsPass()) && CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == model.getIsPass()){
|
|
|
|
|
//1 跳过
|
|
|
|
|
if(!Objects.isNull(model.getIsPass()) && Objects.equals(MesPcnExtConstWords.ONE,model.getIsPass())){
|
|
|
|
|
Optional<MesLoadingListDetail> loadingListDetailOptional = model.getDetailList().stream().filter(t -> !Objects.equals(t.getTempStatus(), MesCommonConstant.TRUE_INTEGER)).findFirst();
|
|
|
|
|
if(loadingListDetailOptional.isPresent()){
|
|
|
|
|
MesLoadingListDetail loadingListDetail = loadingListDetailOptional.get();
|
|
|
|
@ -222,12 +228,8 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
vehiclesOrderDetailList.forEach(k -> {
|
|
|
|
|
if(MesExtEnumUtil.LOADING_ORDER_DETAIL_SHIPPING_STATUS.SHIPPINGED.getValue() == k.getStatus()){
|
|
|
|
|
k.setStatus(MesExtEnumUtil.LOADING_ORDER_DETAIL_SHIPPING_STATUS.PUBLISHED.getValue()); // todo 不改变为发运状态
|
|
|
|
|
}else if(MesExtEnumUtil.LOADING_ORDER_DETAIL_SHIPPING_STATUS.SKIP.getValue() == k.getStatus()){
|
|
|
|
|
//关闭发运单明细
|
|
|
|
|
closeOrder(loadingList, k, userInfo);
|
|
|
|
|
}
|
|
|
|
|
k.setSystemSyncStatus(CommonEnumUtil.FALSE);
|
|
|
|
|
// k.setStatus(MesExtEnumUtil.LOADING_ORDER_DETAIL_SHIPPING_STATUS.SHIPPINGED.getValue()); todo 不改变为发运状态
|
|
|
|
|
ConvertBean.serviceModelUpdate(k, userInfo);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -259,10 +261,6 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
loadingListDetail.setStatus(status);
|
|
|
|
|
//根据是否启动记忆判断 若启用记忆,则根据保存数据库
|
|
|
|
|
if (Objects.equals(loadingList.getIsEnableMemory(), MesCommonConstant.TRUE_INTEGER)) {
|
|
|
|
|
//关闭跳过的单据
|
|
|
|
|
if(MesExtEnumUtil.LOADING_ORDER_DETAIL_SHIPPING_STATUS.SKIP.getValue() == status){
|
|
|
|
|
closeOrder(loadingList, loadingListDetail, userName);
|
|
|
|
|
}
|
|
|
|
|
//若装车单状态为创建或发布已生成ASN 则写入开始扫描时间
|
|
|
|
|
if (loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.CREATE.getValue() ||
|
|
|
|
|
loadingList.getStatus() == MesExtEnumUtil.MES_LOADING_STATUS.PUBLISH.getValue() ||
|
|
|
|
@ -279,18 +277,6 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void closeOrder(MesLoadingList loadingList, MesLoadingListDetail loadingListDetail, String userName) {
|
|
|
|
|
//关闭发运单明细
|
|
|
|
|
// List<Long> idList = new ArrayList<>();
|
|
|
|
|
// idList.add(loadingList.getId());
|
|
|
|
|
// List<MesShippingOrderManagement> mesShippingOrderManagementList = getMesShippingOrderManagementList(loadingList.getOrganizeCode(),idList);
|
|
|
|
|
// if(!CollectionUtils.isEmpty(mesShippingOrderManagementList)){
|
|
|
|
|
// closeShippingOrderDetails(loadingList.getOrganizeCode(), userName,MesPcnExtConstWords.SHIP_PASS, mesShippingOrderManagementList.stream().filter(t-> loadingListDetail.getShippingCode().equals(t.getShippingCode())).map(MesShippingOrderManagement::getId).collect(Collectors.toList()));
|
|
|
|
|
// }
|
|
|
|
|
// //关闭发运单
|
|
|
|
|
// closeShippingOrder(loadingList.getOrganizeCode(), userName,MesPcnExtConstWords.SHIP_PASS, mesShippingOrderManagementList.stream().filter(t-> loadingListDetail.getShippingCode().equals(t.getShippingCode())).map(MesShippingOrderManagement::getId).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private MesPartShippingGroup getMesPartShippingGroup(String org, String partShippingGroupCode) {
|
|
|
|
|
MesPartShippingGroup shippingGroup = mesPartShippingGroupService.getMesPartShippingGroup(org, partShippingGroupCode);
|
|
|
|
|
if(Objects.isNull(shippingGroup)){
|
|
|
|
@ -333,7 +319,6 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
loadingListStatusList.add(MesExtEnumUtil.MES_LOADING_STATUS.CREATE_ASN.getValue());
|
|
|
|
|
loadingListStatusList.add(MesExtEnumUtil.MES_LOADING_STATUS.LOADING.getValue());
|
|
|
|
|
List<Integer> statusList = new ArrayList<>();
|
|
|
|
|
statusList.add(MesExtEnumUtil.MES_LOADING_STATUS.LOADING.getValue());
|
|
|
|
|
statusList.add(MesExtEnumUtil.MES_LOADING_STATUS.SCANNED.getValue());
|
|
|
|
|
statusList.add(MesExtEnumUtil.MES_LOADING_STATUS.ASN.getValue());
|
|
|
|
|
//最后一个扫描完成的装车单信息
|
|
|
|
@ -352,14 +337,19 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
DdlPreparedPack.getInPackList(loadingListStatusList, "status", orderPackBean);
|
|
|
|
|
boolean exit = vehiclesOrderRepository.isExitByHql(orderPackBean);
|
|
|
|
|
if (exit) {
|
|
|
|
|
//强过
|
|
|
|
|
if((!Objects.isNull(isPass) && CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue() == isPass)){
|
|
|
|
|
//updateLoadingListClose(loadingListStatusList,loadingList,userName);
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(loadingList.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(loadingList.getId(), "id",packBean);
|
|
|
|
|
vehiclesOrderRepository.updateByProperties(new String[]{"modifyUser", "modifyDatetime","remark"},
|
|
|
|
|
new Object[]{userName, TimeTool.getNowTime(true),MesPcnExtConstWords.STRONGER_PASS}, packBean);
|
|
|
|
|
|
|
|
|
|
//1强过 3跳过
|
|
|
|
|
if((!Objects.isNull(isPass) && (Objects.equals(MesPcnExtConstWords.ONE,isPass) || Objects.equals(MesPcnExtConstWords.THREE,isPass)))){
|
|
|
|
|
if(Objects.equals(MesPcnExtConstWords.ONE,isPass)){
|
|
|
|
|
loadingList.setRemark(MesPcnExtConstWords.STRONGER_PASS);
|
|
|
|
|
}else{
|
|
|
|
|
//跳过的单据和明细,系统默认是完成的
|
|
|
|
|
loadingList.setStatus(MesExtEnumUtil.MES_LOADING_STATUS.SCANNED.getValue());
|
|
|
|
|
loadingList.setRemark(MesPcnExtConstWords.SHIP_PASS);
|
|
|
|
|
//明细跳过
|
|
|
|
|
updateLoadingDetails(loadingList.getOrganizeCode(),userName,loadingList.getId());
|
|
|
|
|
}
|
|
|
|
|
ConvertBean.serviceModelUpdate(loadingList,userName);
|
|
|
|
|
vehiclesOrderRepository.update(loadingList);
|
|
|
|
|
}else {
|
|
|
|
|
throw new ImppBusiException(String.format("【%s】装车单对应排序【%s】前存在未扫描发运的装车单,请检查数据!",
|
|
|
|
|
orderCode, loadingList.getSeq()));
|
|
|
|
@ -385,68 +375,12 @@ public class MesShippingLoadingCheckService implements IMesShippingLoadingCheckS
|
|
|
|
|
vehiclesOrderDetailRepository.update(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateLoadingListClose(List<Integer> loadingListStatusList,MesLoadingList loadingList,String userName){
|
|
|
|
|
List<MesLoadingList> mesLoadingList = getMesLoadingListList(loadingListStatusList, loadingList);
|
|
|
|
|
if(CollectionUtils.isEmpty(mesLoadingList)) return;
|
|
|
|
|
List<Long> idList = mesLoadingList.stream().map(MesLoadingList::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
//关闭装发运单明细
|
|
|
|
|
List<MesShippingOrderManagement> mesShippingOrderManagementList = getMesShippingOrderManagementList(loadingList.getOrganizeCode(), idList);
|
|
|
|
|
if(!CollectionUtils.isEmpty(mesShippingOrderManagementList)){
|
|
|
|
|
closeShippingOrderDetails(loadingList.getOrganizeCode(), userName,MesPcnExtConstWords.STRONGER_PASS, mesShippingOrderManagementList.stream().map(MesShippingOrderManagement::getId).collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
//关闭发运单
|
|
|
|
|
closeShippingOrder(loadingList.getOrganizeCode(), userName,MesPcnExtConstWords.STRONGER_PASS, mesShippingOrderManagementList.stream().map(MesShippingOrderManagement::getId).collect(Collectors.toList()));
|
|
|
|
|
//关闭装车单明细
|
|
|
|
|
closeLoadingDetails(loadingList.getOrganizeCode(), userName, idList);
|
|
|
|
|
//关闭装车单
|
|
|
|
|
closeLoadingOrder(loadingList.getOrganizeCode(), userName, idList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void closeShippingOrderDetails(String organizeCode, String userName,String remark, List<Long> idList) {
|
|
|
|
|
if(CollectionUtils.isEmpty(idList)|| StringUtils.isEmpty(organizeCode)) return;
|
|
|
|
|
private void updateLoadingDetails(String organizeCode, String userName, long id) {
|
|
|
|
|
if(StringUtil.isEmptyAndNull(id) || StringUtils.isEmpty(organizeCode)) return;
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getInPackList(idList, "pid",packBean);
|
|
|
|
|
shippingOrderManagementDetailRepository.updateByProperties(new String[]{"modifyUser", "modifyDatetime", "status","remark"},
|
|
|
|
|
new Object[]{userName, TimeTool.getNowTime(true), MesExtEnumUtil.SHIPPING_ORDER_DETAIL_SHIPPING_STATUS.CLOSE.getValue(),remark}, packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesShippingOrderManagement> getMesShippingOrderManagementList(String organizeCode, List<Long> idList) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getInPackList(idList,"loadingListId",packBean);
|
|
|
|
|
return shippingOrderManagementRepository.findByHqlWhere(packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void closeShippingOrder(String organizeCode, String userName,String remark, List<Long> idList) {
|
|
|
|
|
if(CollectionUtils.isEmpty(idList)|| StringUtils.isEmpty(organizeCode)) return;
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getInPackList(idList, "id",packBean);
|
|
|
|
|
shippingOrderManagementRepository.updateByProperties(new String[]{"modifyUser", "modifyDatetime", "status","remark"},
|
|
|
|
|
new Object[]{userName, TimeTool.getNowTime(true), MesExtEnumUtil.SHIPPING_ORDER_STATUS.CLOSE.getValue(),remark}, packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void closeLoadingDetails(String organizeCode, String userName, List<Long> idList) {
|
|
|
|
|
if(CollectionUtils.isEmpty(idList)|| StringUtils.isEmpty(organizeCode)) return;
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getInPackList(idList, "pid",packBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(id, "pid",packBean);
|
|
|
|
|
vehiclesOrderDetailRepository.updateByProperties(new String[]{"modifyUser", "modifyDatetime", "status","remark"},
|
|
|
|
|
new Object[]{userName, TimeTool.getNowTime(true), MesExtEnumUtil.LOADING_ORDER_DETAIL_SHIPPING_STATUS.CLOSE.getValue(),MesPcnExtConstWords.STRONGER_PASS}, packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void closeLoadingOrder(String organizeCode, String userName, List<Long> idList) {
|
|
|
|
|
if(CollectionUtils.isEmpty(idList)|| StringUtils.isEmpty(organizeCode)) return;
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getInPackList(idList, "id",packBean);
|
|
|
|
|
vehiclesOrderRepository.updateByProperties(new String[]{"modifyUser", "modifyDatetime", "status","remark"},
|
|
|
|
|
new Object[]{userName, TimeTool.getNowTime(true), MesExtEnumUtil.MES_LOADING_STATUS.CLOSED.getValue(),MesPcnExtConstWords.STRONGER_PASS}, packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesLoadingList> getMesLoadingListList(List<Integer> loadingListStatusList, MesLoadingList loadingList) {
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(loadingList.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringSmallerNotEqualPack(loadingList.getSeq(), "seq", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(loadingList.getPartShippingGroupCode(),"partShippingGroupCode",packBean);
|
|
|
|
|
DdlPreparedPack.getInPackList(loadingListStatusList, "status", packBean);
|
|
|
|
|
return vehiclesOrderRepository.findByHqlWhere(packBean);
|
|
|
|
|
new Object[]{userName, TimeTool.getNowTime(true), MesExtEnumUtil.LOADING_ORDER_DETAIL_SHIPPING_STATUS.SKIP.getValue(),MesPcnExtConstWords.SHIP_PASS}, packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|