应急件库位管理演示问题修复

tags/yfai-pcn-ext-v2.3
jun 7 months ago
parent e2433f1a78
commit 827ba97c7b

@ -20,4 +20,7 @@ public interface IMesEmergencyLocationService {
@ApiOperation("操作")
void doAction(MesEmergencyLocationModel mesEmergencyLocationModel);
@ApiOperation("发运出库")
void doShippingStockOutOnline(String organizeCode, String workOrderNo, String userName, boolean isShipping);
}

@ -1,5 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEmergencyLocationLogService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEmergencyLocationService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderExtService;
@ -7,14 +8,17 @@ import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.StringUtilExt;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEmergencyLocationModel;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.util.DateUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
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.MesConfig;
import cn.estsh.i3plus.pojo.mes.bean.MesEmergencyLocation;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
import cn.estsh.i3plus.pojo.mes.repository.MesConfigRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesEmergencyLocationRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
@ -23,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
@ -47,12 +52,29 @@ public class MesEmergencyLocationServiceImpl implements IMesEmergencyLocationSer
@Autowired
private IMesWorkOrderExtService mesWorkOrderExtService;
@Autowired
private IMesConfigService mesConfigService;
@Autowired
private MesConfigRepository mesConfigRepository;
@Override
public List<MesEmergencyLocation> findMesEmergencyLocationList(String organizeCode, String workCenterCode) {
if (StringUtil.isEmptyAndNull(organizeCode) || StringUtil.isEmptyAndNull(workCenterCode)) {
return null;
}
return findMesEmergencyLocationList(organizeCode, CommonEnumUtil.VALID, workCenterCode);
List<MesEmergencyLocation> emergencyLocationList = findMesEmergencyLocationList(organizeCode, CommonEnumUtil.VALID, workCenterCode);
if(CollectionUtils.isEmpty(emergencyLocationList)){
return emergencyLocationList;
}
int remindDay = Integer.parseInt(mesConfigService.getCfgValue(organizeCode, MesPcnExtConstWords.REMIND_DAY));
//超过提醒天数标记黄色
emergencyLocationList.forEach(location -> {
if (!StringUtil.isEmpty(location.getInDate()) && new Date().compareTo(DateUtil.addDays(location.getInDate(), remindDay)) > MesPcnExtConstWords.ZERO) {
location.setColor(MesExtEnumUtil.COLOR.YELLOW.getValue());
}
});
return emergencyLocationList;
}
@Override
@ -70,6 +92,30 @@ public class MesEmergencyLocationServiceImpl implements IMesEmergencyLocationSer
}
}
@Override
public void doShippingStockOutOnline(String organizeCode, String workOrderNo, String userName, boolean isShipping) {
if (StringUtil.isEmpty(organizeCode) || StringUtil.isEmpty(workOrderNo)) return;
//校验加工单信息
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(organizeCode, workOrderNo, null, isShipping);
if (Objects.isNull(locationWorkOrder)) return;
locationWorkOrder.setOutDate(TimeTool.getNowTime(true));
locationWorkOrder.setStockType(MesExtEnumUtil.EMERGENCY_LOCATION_STOCK_TYPE.EMERGENCY_LOCATION_STOCK_TYPE_20.getValue());
ConvertBean.serviceModelUpdate(locationWorkOrder, userName);
//记录日志
mesEmergencyLocationLogService.insertMesEmergencyLocationLog(locationWorkOrder);
//数据解绑
locationWorkOrder.setWorkOrderNo(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setOfflineDate(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setCustPartNo(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setPartName(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setInDate(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setOutDate(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setVehicleNo(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setSystemSyncStatus(CommonEnumUtil.FALSE);
mesEmergencyLocationRepository.update(locationWorkOrder);
}
private List<MesEmergencyLocation> findMesEmergencyLocationList(String organizeCode, Integer status, String workCenterCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
@ -105,23 +151,7 @@ public class MesEmergencyLocationServiceImpl implements IMesEmergencyLocationSer
private void doStockOutOnline(MesEmergencyLocationModel model) {
ValidatorBean.checkNotNull(model.getWorkOrderNo(), "加工单号不能为空");
//校验加工单信息
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(model);
locationWorkOrder.setOutDate(TimeTool.getNowTime(true));
locationWorkOrder.setStockType(MesExtEnumUtil.EMERGENCY_LOCATION_STOCK_TYPE.EMERGENCY_LOCATION_STOCK_TYPE_20.getValue());
ConvertBean.serviceModelUpdate(locationWorkOrder, model.getUserName());
//记录日志
mesEmergencyLocationLogService.insertMesEmergencyLocationLog(locationWorkOrder);
//数据解绑
locationWorkOrder.setWorkOrderNo(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setOfflineDate(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setCustPartNo(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setPartName(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setInDate(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setOutDate(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setVehicleNo(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setSystemSyncStatus(CommonEnumUtil.FALSE);
mesEmergencyLocationRepository.update(locationWorkOrder);
doShippingStockOutOnline(model.getOrganizeCode(), model.getWorkOrderNo(), model.getUserName(), false);
}
private void doGpInspectionOnline(MesEmergencyLocationModel model) {
@ -131,7 +161,7 @@ public class MesEmergencyLocationServiceImpl implements IMesEmergencyLocationSer
if (Objects.isNull(workOrder)) {
MesPcnException.throwMesBusiException("加工单【%s】信息不存在", model.getWorkOrderNo());
}
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(model);
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(model.getOrganizeCode(), model.getWorkOrderNo(), model.getWorkCenterCode(), false);
if (MesExtEnumUtil.EMERGENCY_LOCATION_STOCK_TYPE.EMERGENCY_LOCATION_STOCK_TYPE_30.getValue() == locationWorkOrder.getStockType()) {
locationWorkOrder.setStockType(MesExtEnumUtil.EMERGENCY_LOCATION_STOCK_TYPE.EMERGENCY_LOCATION_STOCK_TYPE_40.getValue());
} else {
@ -149,6 +179,9 @@ public class MesEmergencyLocationServiceImpl implements IMesEmergencyLocationSer
ValidatorBean.checkNotNull(model.getLocationNumber(), "库位数不能为空");
ValidatorBean.checkNotNull(model.getRemindDay(), "提醒天数不能为空");
List<MesEmergencyLocation> locationList = findMesEmergencyLocationList(model.getOrganizeCode(), null, model.getWorkCenterCode());
//更新系统参数
updateMesConfig(model);
int lastNumber = 0;
if (!CollectionUtils.isEmpty(locationList)) {
lastNumber = locationList.get(locationList.size() - MesPcnExtConstWords.ONE).getLocationNumber();
@ -183,13 +216,24 @@ public class MesEmergencyLocationServiceImpl implements IMesEmergencyLocationSer
}
}
private MesEmergencyLocation getMesEmergencyLocation(MesEmergencyLocationModel model) {
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(model.getOrganizeCode(), null, null, model.getWorkOrderNo());
if (Objects.isNull(locationWorkOrder)) {
MesPcnException.throwMesBusiException("加工单【%s】应急件库位管理信息不存在", model.getWorkOrderNo());
private void updateMesConfig(MesEmergencyLocationModel model) {
MesConfig remindDayCfg = mesConfigService.getMesConfig(model.getOrganizeCode(), MesPcnExtConstWords.REMIND_DAY);
if(model.getRemindDay() != Integer.parseInt(remindDayCfg.getCfgValue())){
remindDayCfg.setCfgValue(model.getRemindDay().toString());
ConvertBean.serviceModelUpdate(remindDayCfg, model.getUserName());
mesConfigRepository.update(remindDayCfg);
}
if (!model.getWorkCenterCode().equals(locationWorkOrder.getWorkCenterCode())) {
MesPcnException.throwMesBusiException("加工单【%s】所在产线【%s】与当前产线【%s】不匹配", model.getWorkOrderNo(), locationWorkOrder.getWorkCenterCode(), model.getWorkCenterCode());
}
private MesEmergencyLocation getMesEmergencyLocation(String organizeCode,String workOrderNo,String workCenterCode,boolean isShipping) {
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(organizeCode, null, null, workOrderNo);
if (!isShipping){
if (Objects.isNull(locationWorkOrder)) {
MesPcnException.throwMesBusiException("加工单【%s】应急件库位管理信息不存在", workOrderNo);
}
if (!workCenterCode.equals(locationWorkOrder.getWorkCenterCode())) {
MesPcnException.throwMesBusiException("加工单【%s】所在产线【%s】与当前产线【%s】不匹配", workOrderNo, locationWorkOrder.getWorkCenterCode(), workCenterCode);
}
}
return locationWorkOrder;
}

@ -19,6 +19,7 @@ import cn.estsh.i3plus.pojo.mes.bean.*;
import cn.estsh.i3plus.pojo.mes.repository.*;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -318,7 +319,7 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
if (!org.apache.shiro.util.CollectionUtils.isEmpty(pullingOrderPartInfos)) {
mesPullingOrder.setPartList(pullingOrderPartInfos);
}
resultMap.put("orderInfo", mesPullingOrder);
resultMap.put("orderInfo", JSONObject.toJSONString(mesPullingOrder));
resultMap.put("success", true);
resultMap.put("message", message);

@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -90,6 +91,9 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
@Autowired
private IMesEquipVariableRwExtService equipVariableRwExtService;
@Autowired
private IMesEmergencyLocationService mesEmergencyLocationService;
@Override
public MesSortShippingCheckModel doShippingOrderNoQuery(MesShippingOrderManagement shippingOrderManagement) {
//校验发运单
@ -454,9 +458,12 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService
workOrder.setShippingTime(TimeTool.getNowTime(true));
workOrder.setWorkOrderStatus(MesExtEnumUtil.ORDER_STATUS.SHIPPING.getValue());
produceSn.setSystemSyncStatus(CommonEnumUtil.FALSE);
ConvertBean.serviceModelUpdate(workOrder, userInfo);
produceSn.setModifyUser(userInfo);
produceSn.setModifyDatetime((new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")).format(new Date()));
mesWorkOrderList.add(workOrder);
}
//更新应急件库位管理库存出库
mesEmergencyLocationService.doShippingStockOutOnline(organizeCode, detail.getVisualOrderNo(), userInfo, true);
}
}
//条码格式(扫描目视单,扫描条码)

@ -249,6 +249,8 @@ public class MesPcnExtConstWords {
public static final String LOCATION = "location";
//库位序号
public static final String LOCATION_NUMBER = "locationNumber";
//提醒天数
public static final String REMIND_DAY = "REMIND_DAY";
//BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties)

Loading…
Cancel
Save