Merge remote-tracking branch 'origin/dev-wuhan-temp' into dev-wuhan-temp

tags/yfai-pcn-ext-v2.3
臧学普 8 months ago
commit 13cb24991d

@ -0,0 +1,17 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.pojo.mes.bean.MesEmergencyLocation;
import io.swagger.annotations.ApiOperation;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/10/17 16:22
* @Modify:
**/
public interface IMesEmergencyLocationLogService {
@ApiOperation("新增应急件库位管理记录")
void insertMesEmergencyLocationLog(MesEmergencyLocation location);
}

@ -0,0 +1,23 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEmergencyLocationModel;
import cn.estsh.i3plus.pojo.mes.bean.MesEmergencyLocation;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/10/17 16:22
* @Modify:
**/
public interface IMesEmergencyLocationService {
@ApiOperation("查询应急件库位管理")
List<MesEmergencyLocation> findMesEmergencyLocationList(String organizeCode, String workCenterCode);
@ApiOperation("操作")
void doAction(MesEmergencyLocationModel mesEmergencyLocationModel);
}

@ -0,0 +1,61 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEmergencyLocationService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEmergencyLocationModel;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/10/17 16:16
* @Modify:
**/
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/emergencyLocation")
public class MesEmergencyLocationController {
@Autowired
private IMesEmergencyLocationService mesEmergencyLocationService;
@GetMapping("/query")
@ApiOperation(value = "查询绑定信息")
public ResultBean findMesRecyclablePackageBindingDetail(String organizeCode, String workCenterCode) {
try {
ValidatorBean.checkNotNull(workCenterCode, "产线代码不能为空");
ValidatorBean.checkNotNull(organizeCode, "工厂代码不能为空");
return ResultBean.success("查询成功").setResultList(mesEmergencyLocationService.findMesEmergencyLocationList(organizeCode, workCenterCode));
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@PostMapping("/doAction")
@ApiOperation(value = "操作")
public ResultBean doAction(@RequestBody MesEmergencyLocationModel model) {
try {
ValidatorBean.checkNotNull(model.getWorkCenterCode(), "产线代码不能为空");
ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂代码不能为空");
ValidatorBean.checkNotNull(model.getType(), "操作类型不能为空");
ValidatorBean.checkNotNull(model.getUserName(), "操作人不能为空");
mesEmergencyLocationService.doAction(model);
return ResultBean.success("操作成功");
} catch (ImppBusiException imppException) {
return ResultBean.fail(imppException);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -210,7 +210,7 @@ public class MesEquipmentLogDao implements IMesEquipmentLogDao {
for (MesEquipmentLog equipmentLog : equipmentLogList) {
if (null == equipmentLog) continue;
builder.append(" insert into mes_equipment_log_");
builder.append(" insert into mes_equipment_log_detail_");
if (!StringUtils.isEmpty(mesShardingAppendOrg) && mesShardingAppendOrg.toUpperCase().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.name())) builder.append(organizeCode.toLowerCase()).append(MesPcnExtConstWords.E_UNDERLINE);
builder.append(equipId);
builder.append("( id, organize_code, is_valid, is_deleted, create_user, create_date_time, modify_user, modify_date_time,");

@ -61,8 +61,9 @@ public class MesAssemblyExtService implements IMesAssemblyExtService {
//【排序线】获取生产工单装配件清单
List<MesWorkOrderAssembly> workOrderAssemblyList = getWorkOrderAssemblyList(prodRuleContext, false);
// 搜集待装配的数据
workOrderAssemblyList = CollectionUtils.isEmpty(workOrderAssemblyList) ? null : workOrderAssemblyList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0)).collect(Collectors.toList());
// 搜集待装配或者解绑的数据
workOrderAssemblyList = CollectionUtils.isEmpty(workOrderAssemblyList) ? null : workOrderAssemblyList.stream().filter(o -> (null != o &&
(o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 || o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0))).collect(Collectors.toList());
if (CollectionUtils.isEmpty(workOrderAssemblyList)) return null;
@ -275,7 +276,9 @@ public class MesAssemblyExtService implements IMesAssemblyExtService {
//根据生产工单装配件清单ID分组
private Map<Long, List<MesProductionAssembly>> groupProductionAssembly(List<MesProductionAssembly> productionAssemblyList) {
return CollectionUtils.isEmpty(productionAssemblyList) ? null : productionAssemblyList.stream().filter(o -> (null != o && o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) >= 0)).collect(Collectors.groupingBy(MesProductionAssembly::getSourceId));
return CollectionUtils.isEmpty(productionAssemblyList) ? null :
productionAssemblyList.stream().filter(o -> (null != o && (o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 ||
o.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_40.getValue()) == 0))).collect(Collectors.groupingBy(MesProductionAssembly::getSourceId));
}
//根据装配件清单ID获取装配件绑定记录

@ -0,0 +1,38 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEmergencyLocationLogService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.mes.bean.MesEmergencyLocation;
import cn.estsh.i3plus.pojo.mes.bean.MesEmergencyLocationLog;
import cn.estsh.i3plus.pojo.mes.repository.MesEmergencyLocationLogRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.UUID;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/10/17 16:23
* @Modify:
**/
@Slf4j
@Service
public class MesEmergencyLocationLogServiceImpl implements IMesEmergencyLocationLogService {
@Autowired
private MesEmergencyLocationLogRepository mesEmergencyLocationLogRepository;
@Override
public void insertMesEmergencyLocationLog(MesEmergencyLocation location) {
MesEmergencyLocationLog log = new MesEmergencyLocationLog();
BeanUtils.copyProperties(location,log, MesPcnExtConstWords.BASE_BEAN_FIELDS);
log.setFid(UUID.randomUUID().toString());
ConvertBean.serviceModelInitialize(log,location.getModifyUser());
mesEmergencyLocationLogRepository.insert(log);
}
}

@ -0,0 +1,233 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
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;
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.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.MesEmergencyLocation;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
import cn.estsh.i3plus.pojo.mes.repository.MesEmergencyLocationRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Objects;
/**
* @Description :
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/10/17 16:23
* @Modify:
**/
@Slf4j
@Service
public class MesEmergencyLocationServiceImpl implements IMesEmergencyLocationService {
@Autowired
private MesEmergencyLocationRepository mesEmergencyLocationRepository;
@Autowired
private IMesEmergencyLocationLogService mesEmergencyLocationLogService;
@Autowired
private IMesWorkOrderExtService mesWorkOrderExtService;
@Override
public List<MesEmergencyLocation> findMesEmergencyLocationList(String organizeCode, String workCenterCode) {
if (StringUtil.isEmptyAndNull(organizeCode) || StringUtil.isEmptyAndNull(workCenterCode)) {
return null;
}
return findMesEmergencyLocationList(organizeCode, CommonEnumUtil.VALID, workCenterCode);
}
@Override
public void doAction(MesEmergencyLocationModel model) {
switch (model.getType()) {
//入库
case 10: doStockInOnline(model);break;
//出库
case 20: doStockOutOnline(model);break;
//GP12
case 30: doGpInspectionOnline(model);break;
//设置
case 40: doEmergencySinkLocationSettingOnline(model);break;
default: MesPcnException.throwMesBusiException("扫描类型【%s】不存在", model.getType());break;
}
}
private List<MesEmergencyLocation> findMesEmergencyLocationList(String organizeCode, Integer status, String workCenterCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getNumEqualPack(status, MesPcnExtConstWords.STATUS, packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{MesPcnExtConstWords.LOCATION_NUMBER}, packBean);
return mesEmergencyLocationRepository.findByHqlWhere(packBean);
}
private void doStockInOnline(MesEmergencyLocationModel model) {
ValidatorBean.checkNotNull(model.getLocation(), "库位不能为空");
ValidatorBean.checkNotNull(model.getWorkOrderNo(), "加工单号不能为空");
//校验库位信息
MesEmergencyLocation location = getMesEmergencyLocation(model.getOrganizeCode(), model.getWorkCenterCode(), model.getLocation(), null);
checkLocation(model, location);
//校验加工单
MesWorkOrder workOrder = mesWorkOrderExtService.getWorkOrder(model.getOrganizeCode(), model.getWorkOrderNo());
checkWorkOrderNo(model, workOrder);
//数据绑定
location.setWorkOrderNo(workOrder.getWorkOrderNo());
location.setOfflineDate(workOrder.getOfflineTime());
location.setCustPartNo(workOrder.getCustPartNo());
location.setPartName(workOrder.getPartName());
location.setInDate(TimeTool.getNowTime(true));
location.setVehicleNo(workOrder.getCarModelCode());
location.setStockType(MesExtEnumUtil.EMERGENCY_LOCATION_STOCK_TYPE.EMERGENCY_LOCATION_STOCK_TYPE_10.getValue());
location.setSystemSyncStatus(CommonEnumUtil.FALSE);
ConvertBean.serviceModelUpdate(location, model.getUserName());
//记录日志
mesEmergencyLocationLogService.insertMesEmergencyLocationLog(location);
mesEmergencyLocationRepository.update(location);
}
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.setVehicleNo(MesPcnExtConstWords.EMPTY);
locationWorkOrder.setSystemSyncStatus(CommonEnumUtil.FALSE);
mesEmergencyLocationRepository.update(locationWorkOrder);
}
private void doGpInspectionOnline(MesEmergencyLocationModel model) {
ValidatorBean.checkNotNull(model.getWorkOrderNo(), "加工单号不能为空");
//校验加工单信息
MesWorkOrder workOrder = mesWorkOrderExtService.getWorkOrder(model.getOrganizeCode(), model.getWorkOrderNo());
if (Objects.isNull(workOrder)) {
MesPcnException.throwMesBusiException("加工单【%s】信息不存在", model.getWorkOrderNo());
}
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(model);
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 {
locationWorkOrder.setStockType(MesExtEnumUtil.EMERGENCY_LOCATION_STOCK_TYPE.EMERGENCY_LOCATION_STOCK_TYPE_30.getValue());
}
ConvertBean.serviceModelUpdate(locationWorkOrder, model.getUserName());
//记录日志
mesEmergencyLocationLogService.insertMesEmergencyLocationLog(locationWorkOrder);
//应急件库位管理更新
mesEmergencyLocationRepository.update(locationWorkOrder);
}
private void doEmergencySinkLocationSettingOnline(MesEmergencyLocationModel model) {
ValidatorBean.checkNotNull(model.getLocationNumber(), "库位数不能为空");
ValidatorBean.checkNotNull(model.getRemindDay(), "提醒天数不能为空");
List<MesEmergencyLocation> locationList = findMesEmergencyLocationList(model.getOrganizeCode(), null, model.getWorkCenterCode());
int lastNumber = 0;
if (!CollectionUtils.isEmpty(locationList)) {
lastNumber = locationList.get(locationList.size() - MesPcnExtConstWords.ONE).getLocationNumber();
if (locationList.size() > model.getLocationNumber()) {
//禁用多于库位
DdlPackBean packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(model.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getNumEqualPack(CommonEnumUtil.VALID, MesPcnExtConstWords.STATUS, packBean);
DdlPreparedPack.getNumberBiggerPack(model.getLocationNumber(), MesPcnExtConstWords.LOCATION_NUMBER, packBean);
mesEmergencyLocationRepository.updateByProperties(new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.STATUS},
new Object[]{model.getUserName(), TimeTool.getNowTime(true), CommonEnumUtil.FALSE}, packBean);
//解除小于库位
packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(model.getWorkCenterCode(), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getNumEqualPack(CommonEnumUtil.FALSE, MesPcnExtConstWords.STATUS, packBean);
DdlPreparedPack.getNumberSmallerEqualPack(model.getLocationNumber(), MesPcnExtConstWords.LOCATION_NUMBER, packBean);
mesEmergencyLocationRepository.updateByProperties(new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.STATUS},
new Object[]{model.getUserName(), TimeTool.getNowTime(true), CommonEnumUtil.VALID}, packBean);
}
}
//新增加
while (model.getLocationNumber() > lastNumber) {
MesEmergencyLocation location = new MesEmergencyLocation();
location.setOrganizeCode(model.getOrganizeCode());
location.setWorkCenterCode(model.getWorkCenterCode());
location.setStatus(CommonEnumUtil.VALID);
location.setLocationNumber(lastNumber++);
location.setLocation(model.getWorkCenterCode() + "kw" + StringUtilExt.stringFormat(String.valueOf(lastNumber), 4, true, "0"));
ConvertBean.serviceModelInitialize(location, model.getUserName());
mesEmergencyLocationRepository.insert(location);
}
}
private MesEmergencyLocation getMesEmergencyLocation(MesEmergencyLocationModel model) {
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(model.getOrganizeCode(), null, null, model.getWorkOrderNo());
if (Objects.isNull(locationWorkOrder)) {
MesPcnException.throwMesBusiException("加工单【%s】应急件库位管理信息不存在", model.getWorkOrderNo());
}
if (!model.getWorkCenterCode().equals(locationWorkOrder.getWorkCenterCode())) {
MesPcnException.throwMesBusiException("加工单【%s】所在产线【%s】与当前产线【%s】不匹配", model.getWorkOrderNo(), locationWorkOrder.getWorkCenterCode(), model.getWorkCenterCode());
}
return locationWorkOrder;
}
private void checkLocation(MesEmergencyLocationModel model, MesEmergencyLocation location) {
//校验库位是否存在
if (Objects.isNull(location)) {
MesPcnException.throwMesBusiException("产线【%s】库位【%s】信息不存在", model.getWorkCenterCode(), model.getLocation());
}
if (!StringUtil.isEmpty(location.getWorkOrderNo())) {
MesPcnException.throwMesBusiException("产线【%s】库位【%s】已存在加工单【%s】", model.getWorkCenterCode(), model.getLocation(), location.getWorkOrderNo());
}
}
private void checkWorkOrderNo(MesEmergencyLocationModel model, MesWorkOrder workOrder) {
//校验工单
if (Objects.isNull(workOrder)) {
MesPcnException.throwMesBusiException("加工单【%s】信息不存在", model.getWorkOrderNo());
}
//已完成状态才能入库
if (Objects.isNull(workOrder.getWorkOrderStatus()) || MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue() != workOrder.getWorkOrderStatus()) {
MesPcnException.throwMesBusiException("加工单【%s】状态为【%s】不为【已完成】", model.getWorkOrderNo(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()));
}
if (!model.getWorkCenterCode().equals(workOrder.getWorkCenterCode())) {
MesPcnException.throwMesBusiException("加工单【%s】所在产线【%s】与当前产线【%s】不匹配", model.getWorkOrderNo(), workOrder.getWorkCenterCode(), model.getWorkCenterCode());
}
//校验是否已经入库
MesEmergencyLocation locationWorkOrder = getMesEmergencyLocation(model.getOrganizeCode(), null, null, model.getWorkOrderNo());
if (!Objects.isNull(locationWorkOrder)) {
MesPcnException.throwMesBusiException("加工单号已经入库,产线【%s】库位【%s】", locationWorkOrder.getWorkCenterCode(), locationWorkOrder.getLocation());
}
}
public MesEmergencyLocation getMesEmergencyLocation(String organizeCode, String workCenterCode, String location, String workOrderNo) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getStringEqualPack(location, MesPcnExtConstWords.LOCATION, packBean);
DdlPreparedPack.getStringEqualPack(workOrderNo, MesPcnExtConstWords.WORK_ORDER_NO, packBean);
DdlPreparedPack.getNumEqualPack(CommonEnumUtil.VALID, MesPcnExtConstWords.STATUS, packBean);
return mesEmergencyLocationRepository.getByProperty(packBean);
}
}

@ -257,8 +257,9 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
@Override
public MesPullingOrderPartInfo doMesPullingOrderInfoJisScan(MesPullingOrderPartInfo mesPullingOrderInfo, String userName) {
MesPullingOrderPartInfo partInfo = mesPullingOrderPartInfoRepository.getById(mesPullingOrderInfo.getId());
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesPullingOrderInfo.getOrganizeCode());
DdlPreparedPack.getNumEqualPack(mesPullingOrderInfo.getId(), MesPcnExtConstWords.ID, packBean);
MesPullingOrderPartInfo partInfo = mesPullingOrderPartInfoRepository.getByProperty(packBean);
if (!StringUtil.isEmpty(partInfo)) {
//查拉动单明细对应的拉动组规则
DdlPackBean packBeanDetail = DdlPackBean.getDdlPackBean(partInfo.getOrganizeCode());
@ -268,6 +269,12 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
if (StringUtil.isEmpty(mesPartPullDetail)) {
MesPcnException.throwMesBusiException("工单【%s】拉动组数据为空", mesPullingOrderInfo.getWorkOrderNo());
}
//跳过码
if (mesPullingOrderInfo.getProductSn().equals(configService.getCfgValue(partInfo.getOrganizeCode(), MesPcnExtConstWords.JIS_SKIP_CODE))) {
//修改为已跳过
partInfo.setStatus(MesExtEnumUtil.PULL_ORDER_PART_STATUS.SKIP.getValue());
return updatePullingOrderPartInfo(userName, partInfo);
}
//校验规则
if (checkRule(mesPullingOrderInfo, mesPartPullDetail)) {
//校验成功修改颜色为黄色2
@ -314,22 +321,26 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
if (!StringUtil.isEmpty(partInfo)) {
//修改为已送料
partInfo.setStatus(MesExtEnumUtil.PULL_ORDER_PART_STATUS.SENTED.getValue());
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.GREEN.getCode());
ConvertBean.serviceModelUpdate(partInfo, userName);
mesPullingOrderPartInfoRepository.update(partInfo);
//拉动单改为已扫描
DdlPackBean packBean = DdlPackBean.getDdlPackBean(partInfo.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(partInfo.getPullingOrderNo(), "pullingOrderNo", packBean);
MesPullingOrderInfo pullingOrderInfo = mesPullingOrderInfoRepository.getByProperty(packBean);
if (!StringUtil.isEmpty(pullingOrderInfo)) {
pullingOrderInfo.setPullOrderStatus(MesExtEnumUtil.PULL_ORDER_STATUS.JIS_PULL.getValue());
ConvertBean.serviceModelUpdate(pullingOrderInfo, userName);
mesPullingOrderInfoRepository.update(pullingOrderInfo);
}
result.add(partInfo);
result.add(updatePullingOrderPartInfo(userName, partInfo));
}
}
return result;
}
private MesPullingOrderPartInfo updatePullingOrderPartInfo(String userName, MesPullingOrderPartInfo partInfo) {
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.GREEN.getCode());
ConvertBean.serviceModelUpdate(partInfo, userName);
mesPullingOrderPartInfoRepository.update(partInfo);
//拉动单改为已扫描
DdlPackBean packBean = DdlPackBean.getDdlPackBean(partInfo.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(partInfo.getPullingOrderNo(), "pullingOrderNo", packBean);
MesPullingOrderInfo pullingOrderInfo = mesPullingOrderInfoRepository.getByProperty(packBean);
if (!StringUtil.isEmpty(pullingOrderInfo)) {
pullingOrderInfo.setPullOrderStatus(MesExtEnumUtil.PULL_ORDER_STATUS.JIS_PULL.getValue());
ConvertBean.serviceModelUpdate(pullingOrderInfo, userName);
mesPullingOrderInfoRepository.update(pullingOrderInfo);
}
return partInfo;
}
}

@ -940,7 +940,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
List<String> centerList = Arrays.asList(workCenterCodes.split(","));
DdlPreparedPack.getInPack(centerList, "workCenterCode", ddlPackBean);
}*/
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"modifyDatetime"}, ddlPackBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"modifyDatetime"}, ddlPackBean);
String numStr = configService.getCfgValue(organizeCode, "MES_PCN_REPORT_NUM");
int num = StringUtils.isEmpty(numStr) ? 50 : Integer.valueOf(numStr);
@ -972,7 +972,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
List<String> centerList = Arrays.asList(workCenterCodes.split(","));
DdlPreparedPack.getNotInPack(centerList, "workCenterCode", ddlPackBean);
}
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"modifyDatetime"}, ddlPackBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"modifyDatetime"}, ddlPackBean);
String numStr = configService.getCfgValue(organizeCode, "MES_PCN_REPORT_NUM");
int num = StringUtils.isEmpty(numStr) ? 50 : Integer.valueOf(numStr);

@ -49,6 +49,8 @@ public class MesEvcRuleMatchBackValueService implements IMesEquipVariableCfgRule
//不过滤[)>字符
private MesEquipVariableCollectContext filterSpecialChar(MesEquipVariableCollectContext equipVariableCollectContext) {
equipVariableCollectContext.trimValue();
String realEquipVariableValue = equipVariableCollectContext.getEquipVariableValue();
String equipVariableValue = StringUtils.removePattern(equipVariableCollectContext.getEquipVariableValue(), "[^A-Z^a-z0-9_^\\s^\\-^/^\\.^\\[^\\)^\\>^\\:]");

@ -144,7 +144,7 @@ public class MesProductionSortModuleService extends BaseModuleService {
if (queueOrderModel.getStatus() == MesExtEnumUtil.QUEUE_ORDER_STATUS.FINISH.getValue()) isComplete = true;
else if (!isComplete) color = MesExtEnumUtil.COLOR.WHITE.getValue();
//跳号标黄色
if (index <= queueOrderList.size() && checkJumpNumber(queueOrderList.get(index).getWorkOrderSeq(), mesQueueOrder.getWorkOrderSeq())) color = MesExtEnumUtil.COLOR.YELLOW.getValue();
if (index < queueOrderList.size() && checkJumpNumber(queueOrderList.get(index).getWorkOrderSeq(), mesQueueOrder.getWorkOrderSeq())) color = MesExtEnumUtil.COLOR.YELLOW.getValue();
queueOrderModel.setColor(color);
queueOrderModels.add(queueOrderModel);
index++;

@ -82,35 +82,31 @@ public class MesFunctionEquDowntimeService extends BaseSwsService implements IFs
if (!StringUtil.isEmpty(type)) {
DdlPreparedPack.getStringEqualPack(type, "reasonTypeCode", ddlPackBeanDowntime);
}
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, ddlPackBeanDowntime);
MesDowntimeRecord mesDowntimeRecordDao = mesDowntimeRecordRDao.getByProperty(ddlPackBeanDowntime);
if (StringUtil.isEmpty(mesDowntimeRecordDao)) {
//新增设备停机记录
MesDowntimeRecord mesDowntimeRecord = new MesDowntimeRecord();
mesDowntimeRecord.setOrganizeCode(organizeCode);
mesDowntimeRecord.setEquipId(mesEquipment.getEquipId());
mesDowntimeRecord.setEquipmentCode(mesEquipment.getEquipmentCode());
mesDowntimeRecord.setAreaCode(reqBean.getAreaCode());
mesDowntimeRecord.setWorkCenterCode(reqBean.getWorkCenterCode());
mesDowntimeRecord.setWorkCellCode(reqBean.getWorkCellCode());
mesDowntimeRecord.setReasonCode(StringUtil.isEmpty(reason) ? "" : reason);
mesDowntimeRecord.setReasonTypeCode(StringUtil.isEmpty(type) ? "" : type);
ConvertBean.serviceModelInitialize(mesDowntimeRecord, userInfo);
mesDowntimeRecordRDao.insert(mesDowntimeRecord);
// //将当前新增数据的create_date_time时间些到上一条记录的modify_date_time字段
// DdlPackBean ddlPackBeanOt = DdlPackBean.getDdlPackBean(organizeCode);
// DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanOt);
// ddlPackBeanOt.setWhereAppend(ddlPackBeanOt.getWhereAppend() + " order by createDatetime desc ");
// MesDowntimeRecord mesDowntimeRecordOt = mesDowntimeRecordRDao.getByProperty(ddlPackBeanOt);
// if (StringUtil.isEmpty(mesDowntimeRecordOt)) {
// mesDowntimeRecordOt.setModifyDatetime(mesDowntimeRecord.getCreateDatetime());
// mesDowntimeRecordOt.setModifyUser(userInfo);
// mesDowntimeRecordRDao.update(mesDowntimeRecordOt);
// }
} else {
ConvertBean.serviceModelUpdate(mesDowntimeRecordDao, "MesDowntimeRecordJob");
mesDowntimeRecordRDao.update(mesDowntimeRecordDao);
if (!StringUtil.isEmpty(mesDowntimeRecordDao)) {
// 如果有停机结束时间,则不需要修改,否则需要
if (StringUtil.isEmpty(mesDowntimeRecordDao.getModifyDatetime())) {
ConvertBean.serviceModelUpdate(mesDowntimeRecordDao, "MesDowntimeRecordJob");
mesDowntimeRecordRDao.update(mesDowntimeRecordDao);
}
}
//新增设备停机记录
MesDowntimeRecord mesDowntimeRecord = new MesDowntimeRecord();
mesDowntimeRecord.setOrganizeCode(organizeCode);
mesDowntimeRecord.setEquipId(mesEquipment.getEquipId());
mesDowntimeRecord.setEquipmentCode(mesEquipment.getEquipmentCode());
mesDowntimeRecord.setAreaCode(reqBean.getAreaCode());
mesDowntimeRecord.setWorkCenterCode(reqBean.getWorkCenterCode());
mesDowntimeRecord.setWorkCellCode(reqBean.getWorkCellCode());
mesDowntimeRecord.setReasonCode(StringUtil.isEmpty(reason) ? "" : reason);
mesDowntimeRecord.setReasonTypeCode(StringUtil.isEmpty(type) ? "" : type);
ConvertBean.serviceModelInitialize(mesDowntimeRecord, userInfo);
mesDowntimeRecord.setModifyDatetime(null);
mesDowntimeRecordRDao.insert(mesDowntimeRecord);
return true;
} else {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(reqBean.getOrganizeCode());

@ -69,12 +69,6 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
List<MesProdRuleContext> prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean);
if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在非排序加工规则数据,请重置工序!");
//获取上下文产出零件数据信息集合
List<MesProductionPartContext> productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean);
//获取上下文进料零件条码信息集合
List<MesProductionPsInContext> productionPsInContextList = productionDispatchContextStepService.getProductionPsInContext(reqBean);
//判断是否存在装配件清单
if (!checkIsNeedScanAssembly(prodRuleContextList)) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "当前加工规则未配置装配件扫描项,当前无需匹配装配件条码!");
@ -105,6 +99,12 @@ public class MesAssemblyMatchSortStepService extends BaseStepService {
String assemblySn = equipVariableCollectContextList.stream().filter(o -> null != o).map(MesEquipVariableCollectContext::getEquipVariableValue).collect(Collectors.toList()).toString();
//匹配成功 【result=true 代表单次扫描匹配成功; hasUnBindAssembly=false 代表浑腔模式全部匹配成功】
if (result || !hasUnBindAssembly) {
//获取上下文产出零件条码信息集合
List<MesProductionPsOutContext> productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean);
//获取上下文工位扫描监控信息
MesScanMonitorContext scanMonitorContext = productionProcessContextStepService.dispatchScanMonitorContext(reqBean, true);
//无需扫描的需要先写库, 使用isSaveDb=1 进行标记
prodRuleContextList = ((MesAssemblySaveSortStepService) SpringContextsUtil.getBean("mesAssemblySaveSortStepService")).saveSortProductionAssembly(reqBean, prodRuleContextList, productionPsOutContextList, scanMonitorContext);
productionDispatchContextStepService.dispatchProdRuleDataContext(reqBean, prodRuleContextList);
((MesAssemblyShowSortStepService) SpringContextsUtil.getBean("mesAssemblyShowSortStepService")).showProductionAssembly(reqBean, resultBean, productionProcessContext.getWorkCenter(), prodRuleContextList, true, true);
suffix = (isSkip || isCavitySkip) ? stepResult.getMsg() : String.format("装配件条码%s匹配成功!", assemblySn);

@ -0,0 +1,173 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssemblyUnique;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyUniqueRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderAssemblyRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description :
* @Author : wangjie
**/
@Slf4j
@Service("mesAssemblySaveSortStepService")
public class MesAssemblySaveSortStepService extends BaseStepService {
@Autowired
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
@Autowired
private MesProductionAssemblyRepository productionAssemblyRepository;
@Autowired
private MesWorkOrderAssemblyRepository workOrderAssemblyRepository;
@Autowired
private MesProductionAssemblyUniqueRepository productionAssemblyUniqueRepository;
@Autowired
private SnowflakeIdMaker snowflakeIdMaker;
@Autowired
private IMesProduceSnExtService produceSnExtService;
public List<MesProdRuleContext> saveSortProductionAssembly(StationRequestBean reqBean, List<MesProdRuleContext> prodRuleContextList, List<MesProductionPsOutContext> productionPsOutContextList, MesScanMonitorContext scanMonitorContext) {
Map<Integer, MesProductionPsOutContext> ppMap = CollectionUtils.isEmpty(productionPsOutContextList) ? null : productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).collect(Collectors.toMap(MesProductionPsOutContext::getForeignKey, o -> o));
Long mouldRecordId = null != scanMonitorContext ? scanMonitorContext.getMouldRecordId() : null;
List<Long> productSnIdList = new ArrayList<>();
//获取模具号
String mouldNo = getMouldNo(reqBean, prodRuleContextList);
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
if (null == prodRuleContext) continue;
if (StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
//显示装配件的时候会进行赋值, 后续匹配的时候已经有值
if (StringUtils.isEmpty(prodRuleContext.getProductionRecordId())) prodRuleContext.setProductionRecordId(snowflakeIdMaker.nextId());
if (StringUtils.isEmpty(prodRuleContext.getMouldNo())) prodRuleContext.setMouldNo(mouldNo);
MesProductionPsOutContext productionPsOutContext = CollectionUtils.isEmpty(ppMap) ? null : ppMap.get(prodRuleContext.getForeignKey());
List<MesProductionAssemblySortContext> productionAssemblySortContextList = prodRuleContext.getSortAssemblyDataContext();
for (MesProductionAssemblySortContext productionAssemblySortContext : productionAssemblySortContextList) {
if (null == productionAssemblySortContext) continue;
if (productionAssemblySortContext.getIsSaveDb().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) continue;
if (productionAssemblySortContext.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0) continue;
if (StringUtils.isEmpty(productionAssemblySortContext.getId())) {
MesProductionAssembly productionAssembly = new MesProductionAssembly();
BeanUtils.copyProperties(productionAssemblySortContext, productionAssembly);
productionAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
if (null != productionPsOutContext) {
productionAssembly.setSerialNumber(productionPsOutContext.getSerialNumber());
productionAssembly.setCustSn(productionPsOutContext.getCustSn());
}
productionAssembly.setMouldRecordId(mouldRecordId);
productionAssembly.setProductionRecordId(prodRuleContext.getProductionRecordId());
productionAssembly.setMouldNo(mouldNo);
productionAssembly.setFid(UUID.randomUUID().toString());
productionAssembly.setOrganizeCode(reqBean.getOrganizeCode());
ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo());
productionAssembly.setRemark(getRemark(reqBean.getWorkCellCode(), productionAssemblySortContext.getWorkCellCode(), null));
productionAssembly = productionAssemblyRepository.insert(productionAssembly);
productionAssemblySortContext.setId(productionAssembly.getId());
} else {
productionAssemblyRepository.updateByProperties(
new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE},
new Object[]{productionAssemblySortContext.getId(), reqBean.getOrganizeCode()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS,
MesPcnExtConstWords.ASSEMBLY_STATUS, MesPcnExtConstWords.ASSEMBLY_SN, MesPcnExtConstWords.IS_SKIP, MesPcnExtConstWords.MOULD_NO,
MesPcnExtConstWords.MOULD_RECORD_ID, MesPcnExtConstWords.PRODUCTION_RECORD_ID, MesPcnExtConstWords.REMARK},
new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(),
productionAssemblySortContext.getAssemblyStatus(), productionAssemblySortContext.getAssemblySn(), productionAssemblySortContext.getIsSkip(), mouldNo,
mouldRecordId, prodRuleContext.getProductionRecordId(), getRemark(reqBean.getWorkCellCode(), productionAssemblySortContext.getWorkCellCode(), productionAssemblySortContext.getPaRemark())});
}
saveWorkOrderAssembly(reqBean, productionAssemblySortContext);
productionAssemblySortContext.isSaveDb();
saveProductionAssemblyUnique(reqBean, productionAssemblySortContext);
if (!StringUtils.isEmpty(productionAssemblySortContext.getProductSnId())) productSnIdList.add(productionAssemblySortContext.getProductSnId());
}
}
if (!CollectionUtils.isEmpty(productSnIdList)) produceSnExtService.saveProduceSnList(reqBean, MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY.getValue(), productSnIdList);
return prodRuleContextList;
}
private String getMouldNo(StationRequestBean reqBean, List<MesProdRuleContext> prodRuleContextList) {
Optional<MesProdRuleContext> optional = prodRuleContextList.stream().filter(o -> null != o && !StringUtils.isEmpty(o.getMouldNo())).findFirst();
if (null != optional && optional.isPresent()) return optional.get().getMouldNo();
MesEquipVariableCollectContext equipVariableCollectContext = productionDispatchContextStepService.getMouldNoContext(reqBean);
return null != equipVariableCollectContext ? equipVariableCollectContext.getEquipVariableValue() : null;
}
private String getRemark(String curWorkCellCode, String workCellCode, String remark) {
if (curWorkCellCode.equals(workCellCode)) return remark;
StringJoiner sj = new StringJoiner(MesPcnExtConstWords.SEMICOLON);
if (!StringUtils.isEmpty(remark)) sj.add(remark);
return sj.add(String.format("装配工位[%s]", curWorkCellCode)).toString();
}
private void saveProductionAssemblyUnique(StationRequestBean reqBean, MesProductionAssemblySortContext productionAssemblySortContext) {
if (productionAssemblySortContext.getMatchType().compareTo(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_30.getValue()) != 0 || StringUtils.isEmpty(productionAssemblySortContext.getAssemblySn())) return;
MesProductionAssemblyUnique productionAssemblyUnique = new MesProductionAssemblyUnique();
BeanUtils.copyProperties(productionAssemblySortContext, productionAssemblyUnique, MesPcnExtConstWords.ID);
productionAssemblyUnique.setPid(productionAssemblySortContext.getId());
productionAssemblyUnique.setOrganizeCode(reqBean.getOrganizeCode());
ConvertBean.serviceModelInitialize(productionAssemblyUnique, reqBean.getUserInfo());
productionAssemblyUniqueRepository.insert(productionAssemblyUnique);
}
private void saveWorkOrderAssembly(StationRequestBean reqBean, MesProductionAssemblySortContext productionAssemblySortContext) {
workOrderAssemblyRepository.updateByProperties(
new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE},
new Object[]{productionAssemblySortContext.getSourceId(), reqBean.getOrganizeCode()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.ASSEMBLY_STATUS, MesPcnExtConstWords.REMARK},
new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), productionAssemblySortContext.getAssemblyStatus(),
getRemark(reqBean.getWorkCellCode(), productionAssemblySortContext.getWorkCellCode(), productionAssemblySortContext.getWoaRemark())});
}
}

@ -8,18 +8,15 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.*;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssembly;
import cn.estsh.i3plus.pojo.mes.bean.MesProductionAssemblyUnique;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCenter;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesProductionAssemblyUniqueRepository;
import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderAssemblyRepository;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@ -35,7 +32,7 @@ import java.util.UUID;
import java.util.stream.Collectors;
/**
* @Description :
* @Description :
* @Author : wangjie
**/
@Slf4j
@ -55,9 +52,6 @@ public class MesAssemblySaveStepService extends BaseStepService {
private MesProductionAssemblyRepository productionAssemblyRepository;
@Autowired
private MesWorkOrderAssemblyRepository workOrderAssemblyRepository;
@Autowired
private MesProductionAssemblyUniqueRepository productionAssemblyUniqueRepository;
@Autowired
@ -89,16 +83,17 @@ public class MesAssemblySaveStepService extends BaseStepService {
if (CollectionUtils.isEmpty(productionPsOutContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在产出零件条码信息,请重置工序解决!");
MesScanMonitorContext scanMonitorContext = productionProcessContextStepService.dispatchScanMonitorContext(reqBean, true);
//从上下文中取出工位当前要使用的设备
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
MesWorkCenter workCenter = productionProcessContext.getWorkCenter();
Map<Integer, MesProductionPsOutContext> ppMap = CollectionUtils.isEmpty(productionPsOutContextList) ? null : productionPsOutContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()))).collect(Collectors.toMap(MesProductionPsOutContext::getForeignKey, o -> o));
List<Long> productSnIdList = new ArrayList<>();
//保存装配记录
prodRuleContextList.stream().filter(o -> null != o).forEach(o -> saveProductionAssemblyData(reqBean, resultBean, stepResult, productSnIdList, productionProcessContext, o, ppMap, cellEquipContext, workCenter));
prodRuleContextList.stream().filter(o -> null != o).forEach(o -> saveProductionAssemblyData(reqBean, productSnIdList, productionProcessContext, o, ppMap, cellEquipContext, scanMonitorContext));
if (!CollectionUtils.isEmpty(productSnIdList)) produceSnExtService.saveProduceSnList(reqBean, MesExtEnumUtil.PRODUCE_SN_STATUS.ASSEMBLY.getValue(), productSnIdList);
@ -106,26 +101,25 @@ public class MesAssemblySaveStepService extends BaseStepService {
}
private void saveProductionAssemblyData(StationRequestBean reqBean, StationResultBean resultBean, StepResult stepResult, List<Long> productSnIdList, MesProductionProcessContext productionProcessContext,
MesProdRuleContext prodRuleContext, Map<Integer, MesProductionPsOutContext> ppMap, MesCellEquipContext cellEquipContext, MesWorkCenter workCenter) {
private void saveProductionAssemblyData(StationRequestBean reqBean, List<Long> productSnIdList, MesProductionProcessContext productionProcessContext, MesProdRuleContext prodRuleContext,
Map<Integer, MesProductionPsOutContext> ppMap, MesCellEquipContext cellEquipContext, MesScanMonitorContext scanMonitorContext) {
if (StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) return;
List<MesProductionAssemblyContext> productionAssemblyContextList = prodRuleContext.getAssemblyDataContext(workCenter);
List<MesProductionAssemblyNosortContext> productionAssemblyNosortContextList = prodRuleContext.getNosortAssemblyDataContext();
MesProductionPsOutContext productionPsOutContext = CollectionUtils.isEmpty(ppMap) ? null : ppMap.get(prodRuleContext.getForeignKey());
for (MesProductionAssemblyContext productionAssemblyContext : productionAssemblyContextList) {
for (MesProductionAssemblyNosortContext productionAssemblyNosortContext : productionAssemblyNosortContextList) {
if (null == productionAssemblyContext) continue;
if (null == productionAssemblyNosortContext) continue;
MesProductionAssembly productionAssembly = new MesProductionAssembly();
BeanUtils.copyProperties(productionAssemblyContext, productionAssembly);
BeanUtils.copyProperties(productionAssemblyNosortContext, productionAssembly);
productionAssembly.setDataSource(workCenter.getCenterType());
productionAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
productionAssembly.setAreaCode(reqBean.getWorkCenterCode());
productionAssembly.setAreaCode(reqBean.getAreaCode());
productionAssembly.setWorkCenterCode(reqBean.getWorkCenterCode());
productionAssembly.setWorkCellCode(reqBean.getWorkCellCode());
productionAssembly.setProcessCode(reqBean.getProcessCode());
@ -147,46 +141,31 @@ public class MesAssemblySaveStepService extends BaseStepService {
productionAssembly.setCustSn(productionPsOutContext.getCustSn());
}
MesScanMonitorContext scanMonitorContext = productionProcessContextStepService.dispatchScanMonitorContext(reqBean, true);
if (null != scanMonitorContext) productionAssembly.setMouldRecordId(scanMonitorContext.getMouldRecordId());
productionAssembly.setFid(UUID.randomUUID().toString());
productionAssembly.setOrganizeCode(reqBean.getOrganizeCode());
ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo());
if (StringUtils.isEmpty(productionAssembly.getId())) {
ConvertBean.serviceModelInitialize(productionAssembly, reqBean.getUserInfo());
productionAssembly.setFid(UUID.randomUUID().toString());
productionAssembly = productionAssemblyRepository.insert(productionAssembly);
} else {
ConvertBean.serviceModelUpdate(productionAssembly, reqBean.getUserInfo());
productionAssemblyRepository.update(productionAssembly);
}
if (productionAssemblyContext.getMatchType().compareTo(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_30.getValue()) == 0) saveProductionAssemblyUnique(productionAssembly);
productionAssembly = productionAssemblyRepository.insert(productionAssembly);
if (!StringUtils.isEmpty(productionAssemblyContext.getProductSnId())) productSnIdList.add(productionAssemblyContext.getProductSnId());
saveProductionAssemblyUnique(productionAssembly);
if (productionAssemblyContext.getIsRepeat().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 && productionAssemblyContext.getIsRepeat2Cache().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0)
productionCustomContextStepService.dispatchRepeatAssemblySn(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), productionAssemblyContext);
if (!StringUtils.isEmpty(productionAssemblyNosortContext.getProductSnId())) productSnIdList.add(productionAssemblyNosortContext.getProductSnId());
if (workCenter.getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue()) == 0) saveWorkOrderAssembly(reqBean, productionAssemblyContext);
if (productionAssemblyNosortContext.getIsRepeat().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0 && productionAssemblyNosortContext.getIsRepeat2Cache().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0)
productionCustomContextStepService.dispatchRepeatAssemblySn(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), productionAssemblyNosortContext);
}
}
private void saveProductionAssemblyUnique(MesProductionAssembly productionAssembly) {
if (productionAssembly.getAssemblyStatus().compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) != 0) return;
if (productionAssembly.getMatchType().compareTo(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_30.getValue()) != 0 || StringUtils.isEmpty(productionAssembly.getAssemblySn())) return;
MesProductionAssemblyUnique productionAssemblyUnique = new MesProductionAssemblyUnique();
BeanUtils.copyProperties(productionAssembly, productionAssemblyUnique, MesPcnExtConstWords.ID);
productionAssemblyUnique.setPid(productionAssembly.getId());
productionAssemblyUniqueRepository.insert(productionAssemblyUnique);
}
private void saveWorkOrderAssembly(StationRequestBean reqBean, MesProductionAssemblyContext productionAssemblyContext) {
workOrderAssemblyRepository.updateByProperties(
new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE},
new Object[]{productionAssemblyContext.getSourceId(), reqBean.getOrganizeCode()},
new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.ASSEMBLY_STATUS},
new Object[]{reqBean.getUserInfo(), TimeTool.getNowTime(true), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), productionAssemblyContext.getAssemblyStatus()});
}
}

@ -1,5 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesAssemblyExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProdRuleCfgExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
@ -16,6 +17,7 @@ import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import cn.estsh.i3plus.pojo.mes.model.StationResultBean;
import cn.estsh.i3plus.pojo.mes.model.StepResult;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +52,9 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
@Autowired
private IFsmCommonService fsmCommonService;
@Autowired
public IMesAssemblyExtService assemblyExtService;
@Override
public StepResult execute(StationRequestBean reqBean) {
@ -72,9 +77,6 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
//从上下文中取出生产线对象
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
//加工规则数据信息集合
List<MesProdRuleContext> prodRuleContextList = new ArrayList<>();
//获取上下文产出零件数据信息集合
List<MesProductionPartContext> productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean);
@ -84,10 +86,18 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
//获取上下文产出零件条码信息集合
List<MesProductionPsOutContext> productionPsOutContextList = productionDispatchContextStepService.getProductionPsOutContext(reqBean);
//加工规则数据信息集合
List<MesProdRuleContext> prodRuleContextList = new ArrayList<>();
//封装排序加工规则
doHandleProdRuleData(reqBean, resultBean, productionProcessContext, cellEquipContext, prodRuleContextList, productionPartContextList, productionPsInContextList, productionPsOutContextList);
if (!CollectionUtils.isEmpty(prodRuleContextList)) {
//获取上下文工位扫描监控信息
MesScanMonitorContext scanMonitorContext = productionProcessContextStepService.dispatchScanMonitorContext(reqBean, true);
//无需扫描的需要先写库, 使用isSaveDb=1 进行标记
prodRuleContextList = ((MesAssemblySaveSortStepService) SpringContextsUtil.getBean("mesAssemblySaveSortStepService")).saveSortProductionAssembly(reqBean, prodRuleContextList, productionPsOutContextList, scanMonitorContext);
//保存上下文产品加工规则信息集合
productionDispatchContextStepService.dispatchProdRuleDataContext(reqBean, prodRuleContextList);
//保存上下文产出零件信息
@ -106,6 +116,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
//获取装配件信息(子类进行重写)
public MesProdRuleContext getProdRuleSortContext(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, MesCellEquipContext cellEquipContext, MesProductionPsInContext productionPsInContext) {
MesProdRuleContext prodRuleContext = new MesProdRuleContext(
reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), reqBean.getProcessCode(), productionProcessContext.getCraftCode()).isCheckBindSeq(productionProcessContext.getWorkCell().getIsSeqScan())
@ -157,6 +168,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
productionPartContextList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(productionPsInContext.getWorkOrderNo()))).findFirst().get().foreignKey(productionPsInContext.foreignKey(foreignKey += 1).getForeignKey());
productionPsOutContextList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(productionPsInContext.getWorkOrderNo()))).findFirst().get().foreignKey(productionPsInContext.getForeignKey());
//获取装配件信息
prodRuleContextList.add(getProdRuleSortContext(reqBean, productionProcessContext, cellEquipContext, productionPsInContext));
}

@ -1,5 +1,6 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesStationService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesCellEquipContext;
@ -38,6 +39,9 @@ public class MesProcessMethodStepService extends BaseStepService {
@Autowired
private IMesProductionProcessContextStepService productionProcessContextStepService;
@Autowired
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
@Override
public StepResult execute(StationRequestBean reqBean) {
StationResultBean resultBean = new StationResultBean();
@ -53,14 +57,17 @@ public class MesProcessMethodStepService extends BaseStepService {
//当前工位使用的设备
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
//删除就绪信号
productionDispatchContextStepService.removeReadySignalContext(reqBean);
//根据设备代码获取点位信息
MesStation station = mesStationService.getMesStationByEquipmentCode(reqBean.getOrganizeCode(), cellEquipContext.getEquipmentCode());
if (Objects.isNull(station) || Objects.isNull(station.getProcessMethod())){
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, String.format("设备[%s]站点信息未维护", cellEquipContext.getEquipmentCode()));
return stepNonCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(),stepResult, String.format("设备[%s]站点信息未维护", cellEquipContext.getEquipmentCode()));
}
return ((IStepService) SpringContextsUtil.getBean(MesExtEnumUtil.STATION_PROCESS_METHOD.valueOfStrategyClass(station.getProcessMethod()))).executeInState(reqBean);
return ((IStepService) SpringContextsUtil.getBean(MesExtEnumUtil.STATION_PROCESS_METHOD.valueOfStrategyClass(station.getProcessMethod()))).executeInState(reqBean);
}
}

@ -36,7 +36,7 @@ public class MesProductionDataSaveStepService extends BaseStepService {
//保存零件条码信息工步
((IStepService) SpringContextsUtil.getBean("mesProductSnSaveStepService")).executeInState(reqBean);
//保存工位队列信息工步
//保存工位队列信息工步 【排序】
if (isSort) ((IStepService) SpringContextsUtil.getBean("mesWorkOrderQueueSaveStepService")).executeInState(reqBean);
//加工异常处理工步
@ -45,8 +45,8 @@ public class MesProductionDataSaveStepService extends BaseStepService {
//生成加工记录工步
((IStepService) SpringContextsUtil.getBean("mesProductionRecordGenerateStepService")).executeInState(reqBean);
//保存装配记录工步
((IStepService) SpringContextsUtil.getBean("mesAssemblySaveStepService")).executeInState(reqBean);
//保存装配记录工步 【非排序】
if (!isSort)((IStepService) SpringContextsUtil.getBean("mesAssemblySaveStepService")).executeInState(reqBean);
//保存工单信息工步
((IStepService) SpringContextsUtil.getBean("mesWorkOrderSaveStepService")).executeInState(reqBean);

@ -83,10 +83,6 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
if (CollectionUtils.isEmpty(productionPsOutContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在产出零件条码信息,请重置工序解决!");
//获取上下文(头道)模具号
MesEquipVariableCollectContext equipVariableCollectContext = productionDispatchContextStepService.getFirstMouldNoContext(reqBean);
if (null == equipVariableCollectContext) equipVariableCollectContext = productionDispatchContextStepService.getMouldNoContext(reqBean);
//从上下文中取出工位当前要使用的设备
MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip();
@ -99,8 +95,10 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
MesWorkCenter workCenter = productionProcessContext.getWorkCenter();
MesWorkCell workCell = productionProcessContext.getWorkCell();
//获取上下文(头道)模具号
String mouldNo = getMouldNo(reqBean, workCenter, prodRuleContextList);
//生成加工记录
String mouldNo = null != equipVariableCollectContext ? equipVariableCollectContext.getEquipVariableValue() : null;
productionPsOutContextList.stream().filter(o -> null != o).forEach(o -> saveProductionRecordData(reqBean, workCenter, mouldNo, prodRuleContextList, productionProcessContext, o, prMap, cellEquipContext, CollectionUtils.isEmpty(psiMap) ? null : psiMap.get(o.getForeignKey())));
//保存上下文产品加工规则信息集合
@ -176,10 +174,15 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
productionRecord.setFid(UUID.randomUUID().toString());
productionRecord.setOneMouldMoreId(UUID.randomUUID().toString());
//排序可能会先赋加工记录ID, 装配件记录前置工步写入时需要写加工记录ID
if (!StringUtils.isEmpty(prodRuleContext.getProductionRecordId())) productionRecord.setId(prodRuleContext.getProductionRecordId());
productionRecord = productionRecordRepository.insert(productionRecord);
if (null != prodRuleContext) prodRuleContextList.stream().filter(o -> (null != o &&
!StringUtils.isEmpty(o.getForeignKey()) && o.getForeignKey().compareTo(productionPsOutContext.getForeignKey()) == 0)).findFirst().get().productionRecordId(productionRecord.getId()).mouldNo(mouldNo);
//判断加工规则有没有赋值加工记录ID或者模具号
if (null != prodRuleContext && (StringUtils.isEmpty(prodRuleContext.getProductionRecordId()) || StringUtils.isEmpty(prodRuleContext.getMouldNo()))) {
prodRuleContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getForeignKey()) && o.getForeignKey().compareTo(productionPsOutContext.getForeignKey()) == 0)).findFirst().get().productionRecordId(productionRecord.getId()).mouldNo(mouldNo);
}
}
@ -200,4 +203,19 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
return (null != optional && optional.isPresent()) ? true : false;
}
//获取模具号
private String getMouldNo(StationRequestBean reqBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
//非排序 先获取头道模具号, 没有再获取模具号
if (workCenter.getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.NOSORT.getValue()) == 0) {
MesEquipVariableCollectContext equipVariableCollectContext = productionDispatchContextStepService.getFirstMouldNoContext(reqBean);
if (null == equipVariableCollectContext) equipVariableCollectContext = productionDispatchContextStepService.getMouldNoContext(reqBean);
return null != equipVariableCollectContext ? equipVariableCollectContext.getEquipVariableValue() : null;
}
//排序, 加工规则上下文中可能已经存了模具号, 装配件前置绑定的时候会写模具号
Optional<MesProdRuleContext> optional = prodRuleContextList.stream().filter(o -> null != o && !StringUtils.isEmpty(o.getMouldNo())).findFirst();
if (null != optional && optional.isPresent()) return optional.get().getMouldNo();
MesEquipVariableCollectContext equipVariableCollectContext = productionDispatchContextStepService.getMouldNoContext(reqBean);
return null != equipVariableCollectContext ? equipVariableCollectContext.getEquipVariableValue() : null;
}
}

@ -279,7 +279,7 @@ public class MesWorkOrderCutProductSnSaveStepService extends BaseStepService {
productionAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
productionAssembly.setIsSkip(CommonEnumUtil.FALSE);
productionAssembly.setAreaCode(reqBean.getWorkCenterCode());
productionAssembly.setAreaCode(reqBean.getAreaCode());
productionAssembly.setWorkCenterCode(reqBean.getWorkCenterCode());
productionAssembly.setWorkCellCode(reqBean.getWorkCellCode());
productionAssembly.setProcessCode(reqBean.getProcessCode());

@ -65,7 +65,7 @@ public class MesWorkOrderCutSaveStepService extends BaseStepService {
productionAssembly.setIsOrigSn(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
productionAssembly.setIsSkip(CommonEnumUtil.FALSE);
productionAssembly.setAreaCode(reqBean.getWorkCenterCode());
productionAssembly.setAreaCode(reqBean.getAreaCode());
productionAssembly.setWorkCenterCode(reqBean.getWorkCenterCode());
productionAssembly.setWorkCellCode(reqBean.getWorkCellCode());
productionAssembly.setProcessCode(reqBean.getProcessCode());

@ -1,15 +1,12 @@
package cn.estsh.i3plus.ext.mes.pcn.pojo.context;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@ -131,6 +131,11 @@ public class MesEquipVariableCollectContext implements Serializable {
return this;
}
public MesEquipVariableCollectContext trimValue() {
if (!StringUtils.isEmpty(this.equipVariableValue)) this.equipVariableValue = this.equipVariableValue.trim();
return this;
}
public MesEquipVariableCollectContext replaceValue(String realEquipVariableValue, String equipVariableValue) {
this.realEquipVariableValue = realEquipVariableValue;
this.equipVariableValue = equipVariableValue;

@ -47,6 +47,9 @@ public class MesProductionAssemblyContext implements Serializable {
@ApiParam("自制件ID")
public Long productSnId;
@ApiParam("数据来源")
public Integer dataSource;
@ApiParam("来源ID")
public Long sourceId;

@ -50,6 +50,8 @@ public class MesProductionAssemblyNosortContext extends MesProductionAssemblyCon
BeanUtils.copyProperties(prodRuleContext, this);
this.dataSource = MesExtEnumUtil.WORK_CENTER_TYPE.NOSORT.getValue();
this.sourceId = assemblyNosortCfg.getId();
this.partNo = prodRuleContext.getOutPartNo();

@ -109,6 +109,18 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
@ApiParam(value = "装配件记录表ID")
public Long id;
@ApiParam("开模记录ID")
private Long mouldRecordId;
@ApiParam("加工记录ID")
private Long productionRecordId;
@ApiParam(value = "工单装配件信息备注")
public String woaRemark;
@ApiParam(value = "装配件记录信息备注")
public String paRemark;
@ApiParam(value = "装配件记录表创建时间")
public String createDatetime;
@ -118,10 +130,16 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
@ApiParam(name = "是否顺序扫描")
private Integer isSeqScan;
@ApiParam(name = "是否保存到DB")
private Integer isSaveDb = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
public MesProductionAssemblySortContext() {}
//前道工位
public MesProductionAssemblySortContext copy(MesWorkOrderAssembly workOrderAssembly) {
this.dataSource = MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue();
if (null != workOrderAssembly) {
BeanUtils.copyProperties(workOrderAssembly, this, MesPcnExtConstWords.BASE_BEAN_FIELDS);
this.sourceId = workOrderAssembly.getId();
@ -130,7 +148,8 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.processSeq)) this.processSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue();
if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0 ||
this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue();
if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue()) == 0 && !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType))
this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue();
@ -138,17 +157,22 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
return this;
}
//末道工位
public MesProductionAssemblySortContext copy(MesWorkOrderAssembly workOrderAssembly, MesProductionAssembly productionAssembly, MesWorkCell workCell) {
if (null != workOrderAssembly) {
BeanUtils.copyProperties(workOrderAssembly, this, MesPcnExtConstWords.BASE_BEAN_FIELDS);
this.sourceId = workOrderAssembly.getId();
this.woaRemark = workOrderAssembly.getRemark();
}
if (null != productionAssembly) {
this.id = productionAssembly.getId();
this.mouldRecordId = productionAssembly.getMouldRecordId();
this.productionRecordId = productionAssembly.getProductionRecordId();
this.createDatetime = productionAssembly.getCreateDatetime();
this.createUser = productionAssembly.getCreateUser();
this.paRemark = productionAssembly.getRemark();
}
if (null != workCell && !StringUtils.isEmpty(workCell.getIsSeqScan())) this.isSeqScan = workCell.getIsSeqScan();
@ -156,7 +180,8 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
if (StringUtils.isEmpty(this.routeSeq)) this.routeSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.processSeq)) this.processSeq = MesPcnExtConstWords.ZERO;
if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue();
if (StringUtils.isEmpty(this.assemblyStatus) || this.assemblyStatus.compareTo(MesPcnExtConstWords.ZERO) == 0 ||
this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_20.getValue()) == 0) this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue();
if (this.assemblyStatus.compareTo(MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue()) != 0 && !MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedScan(this.matchType))
this.assemblyStatus = MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_10.getValue();
@ -203,6 +228,11 @@ public class MesProductionAssemblySortContext extends MesProductionAssemblyConte
return this;
}
public MesProductionAssemblySortContext isSaveDb() {
this.isSaveDb = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue();
return this;
}
public MesProductionAssemblySortContext copy(MesProductionAssembly productionAssembly) {
if (null != productionAssembly) BeanUtils.copyProperties(productionAssembly, this, MesPcnExtConstWords.BASE_BEAN_FIELDS);

@ -0,0 +1,31 @@
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
import io.swagger.annotations.ApiParam;
import lombok.Data;
@Data
public class MesEmergencyLocationModel {
@ApiParam(name = "工厂代码")
private String organizeCode;
@ApiParam(name = "产线代码")
private String workCenterCode;
@ApiParam(name = "库位")
private String location;
@ApiParam(name = "加工单号")
private String workOrderNo;
@ApiParam(name = "库位数")
private Integer locationNumber;
@ApiParam(name = "提醒天数")
private Integer remindDay;
@ApiParam("操作类型")
private Integer type;
@ApiParam("操作人")
private String userName;
}

@ -1,7 +1,5 @@
package cn.estsh.i3plus.ext.mes.pcn.pojo.util;
import io.swagger.annotations.ApiParam;
/**
* @Description :
* @Reference :
@ -139,6 +137,8 @@ public class MesPcnExtConstWords {
public static final String DATD_SOURCE = "dataSource";
// 数据来源ID
public static final String SOURCE_ID = "sourceId";
// 是否跳过
public static final String IS_SKIP = "isSkip";
// 装配件绑定状态
public static final String ASSEMBLY_STATUS = "assemblyStatus";
// 装配件绑定状态
@ -203,6 +203,8 @@ public class MesPcnExtConstWords {
public static final String DATA = "data";
// 开模记录ID
public static final String MOULD_RECORD_ID = "mouldRecordId";
// 加工记录ID
public static final String PRODUCTION_RECORD_ID = "productionRecordId";
// 工步代码
public static final String STEP_CODE = "stepCode";
// 生产顺序号
@ -239,10 +241,14 @@ public class MesPcnExtConstWords {
public static final String ONLINE_TIME = "onlineTime";
//下线时间
public static final String OFFLINE_TIME = "offlineTime";
//BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties)
public static final String[] BASE_BEAN_FIELDS = {ID, IS_DELETED, IS_VALID, CREATE_DATE_TIME, CREATE_USER, MODIFY_DATE_TIME, MODIFY_USER, DESCRIPTION, REMARK, SYSTEM_SYNC_DATE_TIME, SYSTEM_SYNC_STATUS};
//库位
public static final String LOCATION = "location";
//库位序号
public static final String LOCATION_NUMBER = "locationNumber";
//BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties)
public static final String[] BASE_BEAN_FIELDS = {ID, IS_DELETED, IS_VALID, CREATE_DATE_TIME, CREATE_USER, MODIFY_DATE_TIME, MODIFY_USER, DESCRIPTION, REMARK, SYSTEM_SYNC_DATE_TIME, SYSTEM_SYNC_STATUS};
// 客制化条码长度:通用
public static final Integer CUSTOMER_SN_LENGTH_GM = 58;
// 日志类型
@ -527,6 +533,9 @@ public class MesPcnExtConstWords {
//SPS强过配置code
public static final String SPS_STRONGER_PASS = "SPS_STRONGER_PASS";
// JIS跳过码
public static final String JIS_SKIP_CODE = "JIS_SKIP_CODE";
//发运解析条码最大长度
public static final String MAX_SHIPPING_BARCODE_LENGTH = "MAX_SHIPPING_BARCODE_LENGTH";
//裁片工单号

Loading…
Cancel
Save