拉动单打印 增加 LOCK

master
王杰 6 months ago
parent 1653a62923
commit 9134ed28aa

@ -22,7 +22,7 @@ public interface IMesPullingOrderInfoService {
void doMesPullingOrderInfoScan(MesPullingOrderInfo mesPullingOrderInfo, String userName);
MesPullingOrderPartInfo doMesPullingOrderInfoJisScan(MesPullingOrderPartInfo mesPullingOrderPartInfo, String userName);
List<MesPullingOrderInfo> doMesPullingOrderInfoPrint(MesPullingOrderInfo mesPullingOrderInfo, String userName);
List<MesPullingOrderInfo> doMesPullingOrderInfoPrint(MesPullingOrderInfo mesPullingOrderInfo);
ListPager queryMesPullingOrderPartInfoByPager(MesPullingOrderInfo mesPullingOrderInfo, Pager pager);

@ -150,15 +150,14 @@ public class MesProduceSnPrintController {
ValidatorBean.checkNotNull(printQueue.getPrintQueueType(), "打印队列类型不能为空");
ValidatorBean.checkNotNull(printQueue.getOrganizeCode(), "工厂代码不能为空");
ValidatorBean.checkNotNull(printQueue.getModifyUser(), "操作人不能为空");
if (printQueue.getPrintQueueType() == MesExtEnumUtil.PRINT_QUEUE_TYPE.WORK_ORDER_ASSEMBLY.getValue()) {
if (printQueue.getPrintQueueType() == MesExtEnumUtil.PRINT_QUEUE_TYPE.PRINT_WORK_ORDER_ASSEMBLY.getValue()) {
ValidatorBean.checkNotNull(printQueue.getWorkCenterCodeQuery(), "产线代码不能为空");
ValidatorBean.checkNotNull(printQueue.getPartProdGroupCodeQuery(), "零件生产组代码不能为空");
}
String moduleKey = new StringJoiner(MesPcnExtConstWords.COLON)
.add(printQueue.getOrganizeCode())
.add(MesExtEnumUtil.PRINT_QUEUE_TYPE.class.getSimpleName())
.add(printQueue.getPrintQueueType().toString())
.add(MesExtEnumUtil.PRINT_QUEUE_TYPE.valueOfType(printQueue.getPrintQueueType()).name())
.add(printQueue.getWorkCenterCodeQuery()).add(printQueue.getPartProdGroupCodeQuery()).toString();
synchronized (moduleKey.intern()) {

@ -3,11 +3,13 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPullingOrderInfoService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.base.util.StringUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesLabelTemplate;
import cn.estsh.i3plus.pojo.mes.bean.MesPrintQueue;
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo;
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderPartInfo;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
@ -20,9 +22,11 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.StringJoiner;
/**
*
@ -73,14 +77,36 @@ public class MesPullingOrderInfoController {
@ApiOperation(value = "打印未打印拉动单后修改状态")
public ResultBean doMesPullingOrderInfoPrint(@RequestBody MesPullingOrderInfo mesPullingOrderInfo) {
try {
if (StringUtils.isEmpty(mesPullingOrderInfo.getOrganizeCode())) {
throw new ImppBusiException("工厂不能为空");
}
if (StringUtils.isEmpty(mesPullingOrderInfo.getWorkCenterCode())) {
throw new ImppBusiException("产线不能为空");
}
mesPullingOrderInfo.setOrganizeCode(StringUtil.isEmpty(mesPullingOrderInfo.getOrganizeCode()) ? AuthUtil.getOrganizeCode() : mesPullingOrderInfo.getOrganizeCode());
List<MesPullingOrderInfo> pullingOrderInfos = mesPullingOrderInfoService.doMesPullingOrderInfoPrint(mesPullingOrderInfo, AuthUtil.getSessionUser().getUserName());
return ResultBean.success("拉动单打印成功")
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
.setResultList(pullingOrderInfos);
if (StringUtils.isEmpty(mesPullingOrderInfo.getPullCode())) {
throw new ImppBusiException("拉动组不能为空");
}
if (StringUtils.isEmpty(mesPullingOrderInfo.getModifyUser())) {
throw new ImppBusiException("操作人不能为空");
}
String moduleKey = new StringJoiner(MesPcnExtConstWords.COLON)
.add(mesPullingOrderInfo.getOrganizeCode())
.add("PRINT_PULLING_ORDER_INFO")
.add(mesPullingOrderInfo.getWorkCenterCode()).add(mesPullingOrderInfo.getPullCode()).toString();
synchronized (moduleKey.intern()) {
List<MesPullingOrderInfo> pullingOrderInfos = mesPullingOrderInfoService.doMesPullingOrderInfoPrint(mesPullingOrderInfo);
return ResultBean.success(CollectionUtils.isEmpty(pullingOrderInfos) ? "查询暂无可打印数据!!!" : "打印队列查询成功!!!").setResultList(pullingOrderInfos);
}
} catch (ImppBusiException e) {
return ResultBean.fail(e).build();
} catch (Exception e) {

@ -169,18 +169,22 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
}
@Override
public List<MesPullingOrderInfo> doMesPullingOrderInfoPrint(MesPullingOrderInfo bean, String userName) {
public List<MesPullingOrderInfo> doMesPullingOrderInfoPrint(MesPullingOrderInfo bean) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
//多选
if (!StringUtil.isEmpty(bean.getPullCode())) {
DdlPreparedPack.getInPackList(Arrays.asList(bean.getPullCode().split(",")), "pullCode", packBean);
}
if (!StringUtil.isEmpty(bean.getWorkCenterCode())) {
DdlPreparedPack.getInPackList(Arrays.asList(bean.getWorkCenterCode().split(",")), "workCenterCode", packBean);
}
DdlPreparedPack.getStringEqualPack(bean.getPullingOrderNo(), "pullingOrderNo", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PRINT_STATUS.UNPRINT.getValue(), "printStatus", packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{"custOrderNo"}, packBean);
List<String> pullCodeList = Arrays.asList(bean.getPullCode().split(MesPcnExtConstWords.COMMA));
List<String> workCenterCodeList = Arrays.asList(bean.getWorkCenterCode().split(MesPcnExtConstWords.COMMA));
if (pullCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(pullCodeList.get(0), MesPcnExtConstWords.PULL_CODE, packBean);
else DdlPreparedPack.getInPackList(pullCodeList, MesPcnExtConstWords.PULL_CODE, packBean);
if (workCenterCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(workCenterCodeList.get(0), MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
else DdlPreparedPack.getInPackList(workCenterCodeList, MesPcnExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getStringEqualPack(bean.getPullingOrderNo(), MesPcnExtConstWords.PULLING_ORDER_NO, packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PRINT_STATUS.UNPRINT.getValue(), MesPcnExtConstWords.PRINT_STATUS, packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{MesPcnExtConstWords.CUST_ORDER_NO}, packBean);
List<MesPullingOrderInfo> pullingOrderInfos = mesPullingOrderInfoRepository.findByHqlTopWhere(packBean, MesPcnExtConstWords.THREE);
if (!CollectionUtils.isEmpty(pullingOrderInfos)) {
//根据车型代码查询车型信息
@ -190,7 +194,7 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
for (MesPullingOrderInfo pullingOrderInfo : pullingOrderInfos) {
//查询拉动组明细
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(pullingOrderInfo.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(pullingOrderInfo.getPullingOrderNo(), "pullingOrderNo", partPackBean);
DdlPreparedPack.getStringEqualPack(pullingOrderInfo.getPullingOrderNo(), MesPcnExtConstWords.PULLING_ORDER_NO, partPackBean);
List<MesPullingOrderPartInfo> pullingOrderPartInfos = mesPullingOrderPartInfoRepository.findByHqlWhere(partPackBean);
if (!CollectionUtils.isEmpty(pullingOrderPartInfos)) {
pullingOrderInfo.setPartCount(pullingOrderPartInfos.size());
@ -210,7 +214,7 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
pullingOrderInfo.setPrintTime(TimeTool.getNowTime(true));
pullingOrderInfo.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue());
pullingOrderInfo.setIsPrint(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
ConvertBean.serviceModelUpdate(pullingOrderInfo, userName);
ConvertBean.serviceModelUpdate(pullingOrderInfo, bean.getModifyUser());
//10-12 打印补打拉动单新增log表
MesPrintedSnLog snLog = new MesPrintedSnLog();
@ -219,7 +223,7 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
snLog.setWorkOrderNo(pullingOrderInfo.getWorkOrderNo());
snLog.setPartNo(pullingOrderInfo.getPartNo());
snLog.setPartName(pullingOrderInfo.getPartName());
ConvertBean.serviceModelInitialize(snLog, userName);
ConvertBean.serviceModelInitialize(snLog, bean.getModifyUser());
snLog.setOrganizeCode(bean.getOrganizeCode());
snLogList.add(snLog);

@ -264,7 +264,7 @@ public class WorkOrderAssemblyPrintQueueStrategyService implements IPrintQueueSt
if (workCenterCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(partProdGroupCodeCodeList.get(0), MesPcnExtConstWords.PART_PROD_GROUP_CODE, packBean);
else DdlPreparedPack.getInPackList(partProdGroupCodeCodeList, MesPcnExtConstWords.PART_PROD_GROUP_CODE, packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PRINT_QUEUE_TYPE.WORK_ORDER_ASSEMBLY.getValue(), MesPcnExtConstWords.PRINT_QUEUE_TYPE, packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PRINT_QUEUE_TYPE.PRINT_WORK_ORDER_ASSEMBLY.getValue(), MesPcnExtConstWords.PRINT_QUEUE_TYPE, packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PRINT_STATUS.UNPRINT.getValue(), MesPcnExtConstWords.PRINT_STATUS, packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{MesPcnExtConstWords.CREATE_DATE_TIME}, packBean);
return printQueueRepository.findByHqlTopWhere(packBean, MesPcnExtConstWords.FOUR);

@ -271,6 +271,10 @@ public class MesPcnExtConstWords {
public static final String EFFECT_NUM = "effectNum";
//组件类型
public static final String MODULE_TYPE = "moduleType";
//拉动组代码
public static final String PULL_CODE = "pullCode";
//拉动单号
public static final String PULLING_ORDER_NO = "pullingOrderNo";
//BaseBean字段不包含工厂, 用于对象复制剔除属性BeanUtils.copyProperties(Object source, Object target, String... ignoreProperties)

Loading…
Cancel
Save