JIS物料拉动PCN页面1

tags/yfai-pcn-ext-v2.3
gsz 8 months ago
parent c658a8a5b8
commit 932f06d023

@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo;
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderPartInfo;
import io.swagger.annotations.ApiOperation;
import java.util.List;
@ -19,6 +20,11 @@ public interface IMesPullingOrderInfoService {
ListPager queryMesPullingOrderInfoByPager(MesPullingOrderInfo mesPullingOrderInfo, Pager pager);
void doMesPullingOrderInfoScan(MesPullingOrderInfo mesPullingOrderInfo, String userName);
MesPullingOrderPartInfo doMesPullingOrderInfoJisScan(MesPullingOrderPartInfo mesPullingOrderPartInfo, String userName);
List<MesPullingOrderInfo> doMesPullingOrderInfoPrint(MesPullingOrderInfo mesPullingOrderInfo, String userName);
ListPager queryMesPullingOrderPartInfoByPager(MesPullingOrderInfo mesPullingOrderInfo, Pager pager);
List<MesPullingOrderPartInfo> doMesPullingOrderInfoSend(List<MesPullingOrderPartInfo> infoList, String userName);
}

@ -6,7 +6,9 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
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.*;
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
@ -35,10 +37,10 @@ public class MesPullingOrderInfoController {
private IMesTemplateService mesTemplateService;
@GetMapping(value = "/query-pager")
@ApiOperation(value = "查询拉动单")
public ResultBean queryMesProdShiftRecord(MesPullingOrderInfo mesPullingOrderInfo, Pager pager) {
public ResultBean queryMesPullingOrderInfoByPager(MesPullingOrderInfo mesPullingOrderInfo, Pager pager) {
try {
mesPullingOrderInfo.setOrganizeCode(mesPullingOrderInfo.getOrganizeCode());
ListPager<MesProdShiftRecord> partInspectionListPager = mesPullingOrderInfoService.queryMesPullingOrderInfoByPager(mesPullingOrderInfo, pager);
ListPager<MesPullingOrderInfo> partInspectionListPager = mesPullingOrderInfoService.queryMesPullingOrderInfoByPager(mesPullingOrderInfo, pager);
return ResultBean.success("查询成功").setListPager(partInspectionListPager);
} catch (ImppBusiException e) {
@ -94,4 +96,53 @@ public class MesPullingOrderInfoController {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@GetMapping(value = "/jis-part-info/query-pager")
@ApiOperation(value = "查询JIS拉动单明细")
public ResultBean queryMesPullingOrderPartInfoByPager(MesPullingOrderInfo mesPullingOrderInfo, Pager pager) {
try {
ValidatorBean.checkNotNull(mesPullingOrderInfo.getOrganizeCode(), "工厂代码不能为空");
ValidatorBean.checkNotNull(mesPullingOrderInfo.getWorkCenterCode(), "产线不能为空");
ValidatorBean.checkNotNull(mesPullingOrderInfo.getPullCode(), "拉动组代码不能为空");
ListPager<MesPullingOrderPartInfo> partInspectionListPager = mesPullingOrderInfoService.queryMesPullingOrderPartInfoByPager(mesPullingOrderInfo, pager);
return ResultBean.success("查询成功").setListPager(partInspectionListPager);
} catch (ImppBusiException e) {
return ResultBean.fail(e).build();
} catch (Exception e) {
return ResultBean.fail(e);
}
}
@PostMapping(value = "/doJisScan")
@ApiOperation(value = "JIS物料拉动-校验条码")
public ResultBean doMesPullingOrderInfoJisScan(@RequestBody MesPullingOrderPartInfo info) {
try {
if (StringUtil.isEmpty(info.getStatus())||info.getStatus()!= MesExtEnumUtil.PULL_ORDER_PART_STATUS.UN_SENTED.getValue()) {
throw new ImppBusiException("拉动单明细状态不为未送料状态!");
}
MesPullingOrderPartInfo pullingOrderInfo = mesPullingOrderInfoService.doMesPullingOrderInfoJisScan(info, AuthUtil.getSessionUser().getUserName());
return ResultBean.success("拉动单打印成功")
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
.setResultObject(pullingOrderInfo);
} catch (ImppBusiException e) {
return ResultBean.fail(e).build();
} catch (Exception e) {
return ResultBean.fail(e);
}
}
@PostMapping(value = "/doSend")
@ApiOperation(value = "JIS物料拉动-送料按钮")
public ResultBean doMesPullingOrderInfoSend(@RequestBody List<MesPullingOrderPartInfo> infoList) {
try {
List<MesPullingOrderPartInfo> pullingOrderInfos = mesPullingOrderInfoService.doMesPullingOrderInfoSend(infoList, AuthUtil.getSessionUser().getUserName());
return ResultBean.success("拉动单打印成功")
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
.setResultList(pullingOrderInfos);
} catch (ImppBusiException e) {
return ResultBean.fail(e).build();
} catch (Exception e) {
return ResultBean.fail(e);
}
}
}

@ -1,7 +1,10 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNumberRuleMatchDispatchService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPullingOrderInfoService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
@ -13,6 +16,7 @@ import cn.estsh.i3plus.pojo.base.util.StringUtil;
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 lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -44,6 +48,9 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
@Autowired
private MesPullingOrderExtendsRepository mesPullingOrderExtendsRepository;
@Autowired
private IMesProduceSnExtService mesProduceSnExtService;
@Override
public ListPager<MesPullingOrderInfo> queryMesPullingOrderInfoByPager(MesPullingOrderInfo bean, Pager pager) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
@ -138,10 +145,10 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
public List<MesPullingOrderInfo> doMesPullingOrderInfoPrint(MesPullingOrderInfo bean, String userName) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
//多选
if(!StringUtil.isEmpty(bean.getPullCode())){
if (!StringUtil.isEmpty(bean.getPullCode())) {
DdlPreparedPack.getInPackList(Arrays.asList(bean.getPullCode().split(",")), "pullCode", packBean);
}
if(!StringUtil.isEmpty(bean.getWorkCenterCode())){
if (!StringUtil.isEmpty(bean.getWorkCenterCode())) {
DdlPreparedPack.getInPackList(Arrays.asList(bean.getWorkCenterCode().split(",")), "workCenterCode", packBean);
}
DdlPreparedPack.getStringEqualPack(bean.getPullingOrderNo(), "pullingOrderNo", packBean);
@ -167,4 +174,120 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
}
return pullingOrderInfos;
}
@Override
public ListPager queryMesPullingOrderPartInfoByPager(MesPullingOrderInfo bean, Pager pager) {
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);
}
//查询拉动单主表是JIS拉动且拉动状态为10
String append = packBean.getWhereAppend() +
" AND EXISTS (select 1 from MesPullingOrderInfo po where po.pullingOrderNo = model.pullingOrderNo and po.pullOrderType=20 and po.pullOrderStatus =10 " ;
packBean.setWhereAppend(append+ " )");
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue(), CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"status", "createDatetime"}, packBean);
pager = PagerHelper.getPager(pager, mesPullingOrderPartInfoRepository.findByHqlWhereCount(packBean));
List<MesPullingOrderPartInfo> resultList = mesPullingOrderPartInfoRepository.findByHqlWherePage(packBean, pager);
if (!CollectionUtils.isEmpty(resultList)) {
//查拉动单明细对应的拉动组规则
DdlPackBean packBeanDetail = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
DdlPreparedPack.getInPackList(resultList.stream().map(MesPullingOrderPartInfo::getPullCode).collect(Collectors.toList()), "pullCode", packBeanDetail);
List<MesPartPullDetail> mesPartPullDetails = mesPartPullDetailRDao.findByHqlWhere(packBeanDetail);
if (!CollectionUtils.isEmpty(mesPartPullDetails)) {
Map<String, List<MesPartPullDetail>> pullCodePartMap = mesPartPullDetails.stream().collect(Collectors.groupingBy(a -> a.getPullCode() + "=" + a.getPartNo()));
for (MesPullingOrderPartInfo partInfo : resultList) {
if (!CollectionUtils.isEmpty(pullCodePartMap.get(partInfo.getPullCode() + "=" + partInfo.getPartNo()))) {
MesPartPullDetail mesPartPullDetail = pullCodePartMap.get(partInfo.getPullCode() + "=" + partInfo.getPartNo()).get(0);
partInfo.setScanValidationType(StringUtil.isEmpty(mesPartPullDetail.getScanValidationType()) ? 10 : mesPartPullDetail.getScanValidationType());
partInfo.setRuleValidation(StringUtil.isEmpty(mesPartPullDetail.getRuleValidation()) ? "" : mesPartPullDetail.getRuleValidation());
if (partInfo.getScanValidationType() == 10) {
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode());
} else {
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.RED.getCode());
}
}else {
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.WHITE.getCode());
}
}
}
}
return new ListPager<>(resultList, pager);
}
@Override
public MesPullingOrderPartInfo doMesPullingOrderInfoJisScan(MesPullingOrderPartInfo mesPullingOrderInfo, String userName) {
MesPullingOrderPartInfo partInfo = mesPullingOrderPartInfoRepository.getById(mesPullingOrderInfo.getId());
if (!StringUtil.isEmpty(partInfo)) {
//查拉动单明细对应的拉动组规则
DdlPackBean packBeanDetail = DdlPackBean.getDdlPackBean(partInfo.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(partInfo.getPullCode(), "pullCode", packBeanDetail);
DdlPreparedPack.getStringEqualPack(partInfo.getPartNo(), "partNo", packBeanDetail);
MesPartPullDetail mesPartPullDetail = mesPartPullDetailRDao.getByProperty(packBeanDetail);
if (StringUtil.isEmpty(mesPartPullDetail)){
MesPcnException.throwMesBusiException("工单【%s】拉动组数据为空", mesPullingOrderInfo.getWorkOrderNo());
}
//校验规则
if (checkRule(mesPullingOrderInfo,mesPartPullDetail)){
//校验成功修改颜色为黄色2
partInfo.setColor(MesExtEnumUtil.PART_PULL_DETAIL_COLOR.YELLOW.getCode());
ConvertBean.serviceModelUpdate(partInfo, userName);
mesPullingOrderPartInfoRepository.update(partInfo);
}else {
MesPcnException.throwMesBusiException("工单拉动组明细【%s】数据为空", mesPullingOrderInfo.getWorkOrderNo());
}
}else {
MesPcnException.throwMesBusiException("工单拉动组明细【%s】数据为空", mesPullingOrderInfo.getWorkOrderNo());
}
return partInfo;
}
private boolean checkRule(MesPullingOrderPartInfo mesPullingOrderInfo, MesPartPullDetail mesPartPullDetail) {
String rule=mesPartPullDetail.getRuleValidation();
if (mesPullingOrderInfo.getScanValidationType()==MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.HOMEMADE_VALIDATE.getValue()){
List<MesProduceSn> produceSnList = mesProduceSnExtService.getProduceSnList(mesPullingOrderInfo.getOrganizeCode(), mesPullingOrderInfo.getProductSn());
return mesPartPullDetail.getPullPartNo().equals(produceSnList.get(0).getPartNo());
}else if (mesPullingOrderInfo.getScanValidationType()==MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.COOPERATION_VALIDATE.getValue()){
return (Boolean) ((IMesNumberRuleMatchDispatchService) SpringContextsUtil.getBean(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.MATCH_TYPE_20.getStrategyClass()))
.matchNumberRule(mesPullingOrderInfo.getOrganizeCode(), mesPullingOrderInfo.getProductSn(), rule, rule)
.get(MesPcnExtConstWords.RESULT);
}else {
return true;
}
}
@Override
public List<MesPullingOrderPartInfo> doMesPullingOrderInfoSend(List<MesPullingOrderPartInfo> infoList, String userName) {
List<MesPullingOrderPartInfo> result = new ArrayList<>();
for (MesPullingOrderPartInfo mesPullingOrderPartInfo : infoList) {
//查询拉动组明细
// DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(mesPullingOrderPartInfo.getOrganizeCode());
// DdlPreparedPack.getStringEqualPack(mesPullingOrderPartInfo.getPullingOrderNo(), "pullingOrderNo", partPackBean);
// DdlPreparedPack.getStringEqualPack(mesPullingOrderPartInfo.getPartNo(), "partNo", partPackBean);
MesPullingOrderPartInfo partInfo = mesPullingOrderPartInfoRepository.getById(mesPullingOrderPartInfo.getId());
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);
}
}
return result;
}
}

Loading…
Cancel
Save