Merge branch 'dev-wuhan' into dev-wuhan-temp

tags/yfai-pcn-ext-v2.3
王杰 10 months ago
commit 34e0e40256

@ -0,0 +1,48 @@
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
import cn.estsh.i3plus.pojo.mes.bean.MesEarlyWarningKanBan;
import cn.estsh.i3plus.pojo.mes.model.MesEarlyWarningKanBanModel;
import java.util.List;
public interface IMesEarlyWarningService {
/**
* id
* idList 1
*
*
*/
List<MesEarlyWarningKanBan> getEarlyWarningList(String organizeCode);
/**
*
* @param model
*/
void saveEarlyWarning(MesEarlyWarningKanBanModel model);
/**
*
* @param earlyWarning
*/
void updateEarlyWarning(MesEarlyWarningKanBan earlyWarning);
/**
*
*/
void deleteEarlyWarning(Long id, String organizeCode,String userName);
/**
*
* @param id
*/
MesEarlyWarningKanBan getKanbanData(Long id,String organizeCode);
/**
*
* @param id
*/
void getData(Long id,String organizeCode);
}

@ -1,59 +1,59 @@
///**
// * Licensed to the Apache Software Foundation (ASF) under one
// * or more contributor license agreements. See the NOTICE file
// * distributed with this work for additional information
// * regarding copyright ownership. The ASF licenses this file
// * to you under the Apache ImppLicense, Version 2.0 (the
// * "ImppLicense"); you may not use this file except in compliance
// * with the ImppLicense. You may obtain a copy of the ImppLicense at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing,
// * software distributed under the ImppLicense is distributed on an
// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// * KIND, either express or implied. See the ImppLicense for the
// * specific language governing permissions and limitations
// * under the ImppLicense.
// */
//package cn.estsh.i3plus.ext.mes.pcn.apiservice.config;
//
//
//
//import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.DcsForEquipmentServer;
//import org.apache.cxf.Bus;
//import org.apache.cxf.jaxws.EndpointImpl;
//import org.apache.cxf.transport.servlet.CXFServlet;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.web.servlet.ServletRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.xml.ws.Endpoint;
//
///**
// * @Description : WebService Server 服务配置
// * WSDL URL: /block/softswitch/server/web-service?wsdl
// * @Reference :
// * @Author : wei.peng
// * @CreateDate : 2019/9/10 下午3:13
// * @Modify:
// **/
//@Configuration
//public class WebServiceConfig {
//
// @Autowired
// private Bus bus;
//
// @Bean("cxfServletRegistration")
// public ServletRegistrationBean dispatcherServlet() {
// return new ServletRegistrationBean(new CXFServlet(), "/*");
// }
//
// @Bean
// public Endpoint endpoint() {
// EndpointImpl endpoint = new EndpointImpl(bus, new DcsForEquipmentServer());
// endpoint.publish("/DCSForEquipmentService");
// return endpoint;
// }
//}
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache ImppLicense, Version 2.0 (the
* "ImppLicense"); you may not use this file except in compliance
* with the ImppLicense. You may obtain a copy of the ImppLicense at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the ImppLicense is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the ImppLicense for the
* specific language governing permissions and limitations
* under the ImppLicense.
*/
package cn.estsh.i3plus.ext.mes.pcn.apiservice.config;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.DcsForEquipmentServer;
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
/**
* @Description : WebService Server
* WSDL URL: /block/softswitch/server/web-service?wsdl
* @Reference :
* @Author : wei.peng
* @CreateDate : 2019/9/10 3:13
* @Modify:
**/
@Configuration
public class WebServiceConfig {
@Autowired
private Bus bus;
@Bean("cxfServletRegistration")
public ServletRegistrationBean dispatcherServlet() {
return new ServletRegistrationBean(new CXFServlet(), "/i3plus-pcn/*");
}
@Bean
public Endpoint endpoint() {
EndpointImpl endpoint = new EndpointImpl(bus, new DcsForEquipmentServer());
endpoint.publish("/DCSForEquipmentService");
return endpoint;
}
}

@ -0,0 +1,98 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesEarlyWarningServiceImpl;
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
import cn.estsh.i3plus.pojo.mes.bean.MesEarlyWarningKanBan;
import cn.estsh.i3plus.pojo.mes.model.MesEarlyWarningKanBanModel;
import cn.estsh.impp.framework.boot.util.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(MesCommonConstant.MES_YANFEN + "/earlyWarningKanBan")
public class MesEarlyWarningKanBanController {
@Autowired
private MesEarlyWarningServiceImpl mesEarlyWarningService;
/**
* 线
* @param organizeCode
* @return
*/
@GetMapping(path = "/list/{organizeCode}")
public ResultBean getEarlyWarningList(@PathVariable String organizeCode){
List<MesEarlyWarningKanBan> list;
try {
list = mesEarlyWarningService.getEarlyWarningList(organizeCode);
} catch (Exception e) {
return ResultBean.fail(e.getMessage());
}
return ResultBean.success("查询成功").setResultList(list);
}
/**
*
* @param model
* @return
*/
@PostMapping(path = "/save")
public ResultBean saveEarlyWarningList(@RequestBody MesEarlyWarningKanBanModel model){
try {
mesEarlyWarningService.saveEarlyWarning(model);
} catch (Exception e) {
return ResultBean.fail(e.getMessage());
}
return ResultBean.success("查询成功");
}
/**
*
* @param earlyWarning
*/
@PostMapping(path = "/update")
public ResultBean updateEarlyWarning(@RequestBody MesEarlyWarningKanBan earlyWarning){
try {
mesEarlyWarningService.updateEarlyWarning(earlyWarning);
} catch (Exception e) {
return ResultBean.fail(e.getMessage());
}
return ResultBean.success("更新成功");
}
/**
*
*/
@GetMapping(path = "/delete/{id}/{organizeCode}/{userName}")
public ResultBean deleteEarlyWarning(@PathVariable Long id, @PathVariable String organizeCode,@PathVariable String userName){
try {
mesEarlyWarningService.deleteEarlyWarning(id,organizeCode,userName);
} catch (Exception e) {
return ResultBean.fail(e.getMessage());
}
return ResultBean.success("删除成功");
}
/**
*
*/
@GetMapping(path = "/get/{id}/{organizeCode}")
public ResultBean getKanbanData(@PathVariable Long id,@PathVariable String organizeCode){
try {
mesEarlyWarningService.getKanbanData(id,organizeCode);
} catch (Exception e) {
return ResultBean.fail(e.getMessage());
}
return ResultBean.success("删除成功");
}
@GetMapping(path = "/getData/{id}/{organizeCode}")
public ResultBean getData(@PathVariable Long id,@PathVariable String organizeCode){
return null;
}
}

@ -93,15 +93,15 @@ public class MesSortShippingCheckController {
organizeCode = !StringUtils.isEmpty(model.getOrganizeCode()) ? model.getOrganizeCode() : AuthUtil.getOrganize().getOrganizeCode();
userInfo = !StringUtils.isEmpty(model.getUserInfo()) ? model.getUserInfo() : AuthUtil.getSessionUser().getUserName();
//增加单据锁
moduleKey = organizeCode + key + "SHIPPING_CODE:" + model.getShippingCode();
moduleKey = organizeCode + key + "SN:" + model.getSn();
log.info("工厂:{} 排序发运扫描条码 --- {} --- START --- 操作人:{} --- THREAD:{}", organizeCode, moduleKey, userInfo, Thread.currentThread().getName());
log.info("工厂:{} 排序发运扫描条码 --- {} --- START --- 操作人:{} --- THREAD:{}", organizeCode, model.getSn(), userInfo, Thread.currentThread().getName());
//加锁
lockFlg = redisLockUtil.redisLock(moduleKey);
log.info("工厂:{} 排序发运扫描条码 --- {} --- LOCKED --- 操作人:{} --- THREAD:{}", organizeCode, moduleKey, userInfo, Thread.currentThread().getName());
log.info("工厂:{} 排序发运扫描条码 --- {} --- LOCKED --- 操作人:{} --- THREAD:{}", organizeCode, model.getSn(), userInfo, Thread.currentThread().getName());
// 数据校验
ValidatorBean.checkNotNull(model.getShippingCode(), "发运单不能为空");
@ -119,7 +119,7 @@ public class MesSortShippingCheckController {
//解锁
if (lockFlg) {
redisLockUtil.redisUnLock(lockFlg, moduleKey);
log.info("工厂:{} 排序发运扫描条码 --- {} --- UNLOCK --- 操作人:{} --- THREAD:{}", organizeCode, moduleKey, userInfo, Thread.currentThread().getName());
log.info("工厂:{} 排序发运扫描条码 --- {} --- UNLOCK --- 操作人:{} --- THREAD:{}", organizeCode, model.getSn(), userInfo, Thread.currentThread().getName());
}
}
}

@ -138,6 +138,9 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
private IMesWorkOrderExtService workOrderExtService;
@Autowired
private MesWorkOrderRepository workOrderRepository;
@Autowired
private MesProductVersionRepository productVersionRepository;
@Override
public ListPager<MesReworkTask> queryReworkTask(MesReworkTask mesReworkTask, Pager pager) {
String organizeCode = !StringUtils.isEmpty(mesReworkTask.getOrganizeCode())?mesReworkTask.getOrganizeCode():AuthUtil.getOrganizeCode();
@ -292,6 +295,23 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
if (MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue() == mesReworkTask.getType()) {
mesReworkTask.setReworkedQty(requestModel.getReworkedQty());
mesReworkTask.setScrapQty(requestModel.getScrapQty());
// 如果是批次还需要移库
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(requestModel.getPartNo(), "partNo", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
String target = mesConfigService.getCfgValue(requestModel.getOrganizeCode(), "LGORT");
if (version != null) {
target = version.getReceiveInventoryPoint();
}
String workCenterCode = "";
// 获取替换条码信息列表
if (mesPartInspection != null) {
workCenterCode = mesPartInspection.getWorkCenterCode();
}
doCreateReworkMove(requestModel,getDestLocateNo(requestModel.getOrganizeCode(), mesPartInspection.getId()),target,workCenterCode,mesReworkTask.getPartNo(), mesPartInspection.getId());
} else {
//拆解
if(!CollectionUtils.isEmpty(requestModel.getAssemblyModelList())){
@ -796,6 +816,14 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
userName, organizeCode, 1).getResultList().get(0).toString();
}
private String getDestLocateNo(String organizeCode, Long partInspectionId) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(partInspectionId, "partInspectionId", packBean);
DdlPreparedPack.getOrderBy(null, null, packBean);
MesMove mesMove = moveRepository.getByProperty(packBean);
return Objects.isNull(mesMove) ? null : mesMove.getUmlgo();
}
private String getDestLocateNo(String organizeCode, String productSn) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(productSn, "productSn", packBean);
@ -803,8 +831,6 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
MesMove mesMove = moveRepository.getByProperty(packBean);
return Objects.isNull(mesMove) ? null : mesMove.getUmlgo();
}
private MesPartInspection getMesPartInspection(MesReworkTask mesReworkTask) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(mesReworkTask.getSn(), "sn", packBean);
@ -952,4 +978,25 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService {
ConvertBean.serviceModelInitialize(move, requestModel.getUserName());
moveRepository.insert(move);
}
private void doCreateReworkMove(MesReworkTaskRequestModel requestModel,String srcLocate, String destLocate,String workCenterCode,String partNo,Long partInspectionId) {
MesPartSap mesPartSap = mesPartService.getMesPartSapByPartNo(partNo, requestModel.getOrganizeCode());
MesMove move = new MesMove();
move.setMatnr(mesPartSap.getPartNo());
move.setOrganizeCode(requestModel.getOrganizeCode());
move.setFactoryCode(requestModel.getOrganizeCode());
move.setLgort(srcLocate);
move.setUmlgo(destLocate);
move.setPartInspectionId(partInspectionId);
move.setMenge(Double.valueOf(requestModel.getReworkedQty()+""));
move.setMeins(mesPartSap.getUnit());
move.setPostDate(TimeTool.getToday());
move.setPostTime(TimeTool.getTimeShortWithColon());
move.setMoveType(MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE.getValue());
move.setProductSn(requestModel.getSn());
move.setWorkCenter(workCenterCode);
ConvertBean.serviceModelInitialize(move, requestModel.getUserName());
moveRepository.insert(move);
}
}

@ -0,0 +1,71 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEarlyWarningService;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.mes.bean.MesEarlyWarningKanBan;
import cn.estsh.i3plus.pojo.mes.model.MesEarlyWarningKanBanModel;
import cn.estsh.i3plus.pojo.mes.repository.MesEarlyWarningKanBanRepository;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
@Slf4j
@Service
public class MesEarlyWarningServiceImpl implements IMesEarlyWarningService {
@Autowired
private MesEarlyWarningKanBanRepository earlyWarningKanBanRao;
@Override
public List<MesEarlyWarningKanBan> getEarlyWarningList(String organizeCode) {
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(organizeCode);
return earlyWarningKanBanRao.findByHqlWhere(ddlPackBean);
}
@Override
public void saveEarlyWarning(MesEarlyWarningKanBanModel model) {
MesEarlyWarningKanBan kanBan = new MesEarlyWarningKanBan();
try {
BeanUtils.copyProperties(kanBan,model);
} catch (IllegalAccessException | InvocationTargetException e) {
log.error(e.getMessage());
MesPcnException.throwMesBusiException("类型转换出错!"+e.getMessage());
}
ConvertBean.saveOrUpdate(kanBan,model.getCreateUser());
earlyWarningKanBanRao.insert(kanBan);
}
@Override
public void updateEarlyWarning(MesEarlyWarningKanBan earlyWarning) {
ConvertBean.saveOrUpdate(earlyWarning,earlyWarning.getCreateUser());
earlyWarningKanBanRao.insert(earlyWarning);
}
@Override
public void deleteEarlyWarning(Long id, String organizeCode,String userName) {
earlyWarningKanBanRao.deleteWeaklyByProperties(new String[]{"id","organizeCode"},new Object[]{id,organizeCode},userName);
}
@Override
public MesEarlyWarningKanBan getKanbanData(Long id,String organizeCode) {
List<MesEarlyWarningKanBan> list = earlyWarningKanBanRao.findByProperty(new String[]{"id", "organizeCode"}, new Object[]{id, organizeCode});
if (!list.isEmpty()){
return list.get(0);
}
return new MesEarlyWarningKanBan();
}
@Override
public void getData(Long id, String organizeCode) {
}
}

@ -243,11 +243,20 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
//返工单返修完成,需可疑品移正常库
if (model.isTransferFlg() && model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) {
//移库
if (model.getOptType() != 2) {
MesMove move = createMove(model, getDestLocateNo(model, org), configService.getCfgValue(org, "LGORT"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode());
moveRepository.save(move);
//电子化检验
String target = configService.getCfgValue(org, "LGORT");
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
target = version.getReceiveInventoryPoint();
}
MesMove move = createMove(model, getDestLocateNo(model, org), target, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode());
moveRepository.save(move);
}
//判断首次合格还是 多次检验最终为合格品
@ -411,7 +420,8 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
}
}
//查询条码所在库位
srcLocateNo = getDestLocateNo(model, org);
// 20241010不找当前所在库位先找生产版本库位再找2000
// srcLocateNo = getDestLocateNo(model, org);
}
if (Objects.isNull(srcLocateNo)) {
srcLocateNo = configService.getCfgValue(org, "LGORT");
@ -421,7 +431,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
srcLocateNo = version.getShipInventoryPoint();
srcLocateNo = version.getReceiveInventoryPoint();
}
}
if (model.getOptType() != 2) {
@ -495,7 +505,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
srcLocateNo = version.getShipInventoryPoint();
srcLocateNo = version.getReceiveInventoryPoint();
}
MesMove move = createMove(model, srcLocateNo, configService.getCfgValue(org, "UMLGO"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode());
@ -536,9 +546,15 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService
*/
private MesPartInspection getPartInspection(MesProduceSn produceSn,MesPartInspectionInputModel inputModel, String org) {
Integer refundFlag = CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
if (inputModel.getOptType() == 2) {
refundFlag = CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue();
}
//根据条码找最近一条单据
DdlPackBean packBean = DdlPackBean.getDdlPackBean(org);
DdlPreparedPack.getStringEqualPack(produceSn.getProductSn(), "sn", packBean);
DdlPreparedPack.getNumEqualPack(refundFlag, "refundFlag", packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean);
MesPartInspection partInspection = partInspectionRepository.getByProperty(packBean);

@ -357,7 +357,7 @@ public class MesNcProcessingService implements IMesNcProcessingService {
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
source = version.getShipInventoryPoint();
source = version.getReceiveInventoryPoint();
}
}
@ -403,7 +403,7 @@ public class MesNcProcessingService implements IMesNcProcessingService {
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
target = version.getShipInventoryPoint();
target = version.getReceiveInventoryPoint();
}
//移库 转正常、放行8000移至2000
@ -562,8 +562,17 @@ public class MesNcProcessingService implements IMesNcProcessingService {
}
partInspectionRepository.save(model.getPartInspection());
String target = configService.getCfgValue(org, "LGORT");
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(model.getPart().getPartNo(), "partNo", ddlPackBean);
MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean);
if (version != null) {
target = version.getReceiveInventoryPoint();
}
//移库 转正常、放行8000移至2000
MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "LGORT"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE);
MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE);
ConvertBean.serviceModelInitialize(move,model.getUserName());
moveRepository.save(move);

@ -56,6 +56,9 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
@Autowired
private IMesConfigService configService;
@Autowired
private IMesPrintedSnLogRepository snLogRao;
@Override
public ListPager<MesPullingOrderInfo> queryMesPullingOrderInfoByPager(MesPullingOrderInfo bean, Pager pager) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
@ -137,6 +140,7 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(bean.getPullCode(), "pullCode", packBean);
DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean);
DdlPreparedPack.getNumNOEqualPack(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), "isPassCode", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_PULL_ORDER_TYPE.SPS_PULL.getValue(), "pullOrderType", packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.KITTING_PULL.getValue(), "pullOrderStatus", packBean);
@ -176,6 +180,7 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
List<MesPullingOrderInfo> pullingOrderInfos = mesPullingOrderInfoRepository.findByHqlWhere(packBean);
if (!CollectionUtils.isEmpty(pullingOrderInfos)) {
//把查出来的拉动单打印并修改打印状态为已打印
List<MesPrintedSnLog> snLogList = new ArrayList<>();
for (MesPullingOrderInfo pullingOrderInfo : pullingOrderInfos) {
//查询拉动组明细
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(pullingOrderInfo.getOrganizeCode());
@ -188,9 +193,24 @@ 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);
//10-12 打印补打拉动单新增log表
MesPrintedSnLog snLog = new MesPrintedSnLog();
snLog.setBarcode(pullingOrderInfo.getPullingOrderNo());
snLog.setCustPartNo(pullingOrderInfo.getCustPartNo());
snLog.setWorkOrderNo(pullingOrderInfo.getWorkOrderNo());
snLog.setPartNo(pullingOrderInfo.getPartNo());
snLog.setPartName(pullingOrderInfo.getPartName());
ConvertBean.serviceModelInitialize(snLog, userName);
snLog.setOrganizeCode(bean.getOrganizeCode());
snLogList.add(snLog);
}
mesPullingOrderInfoRepository.saveAll(pullingOrderInfos);
//保存打印条码记录
snLogRao.saveAll(snLogList);
}
return pullingOrderInfos;
}
@ -267,7 +287,7 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
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());
if(CollectionUtils.isEmpty(produceSnList)){
if (CollectionUtils.isEmpty(produceSnList)) {
return false;
}
return mesPartPullDetail.getPullPartNo().equals(produceSnList.get(0).getPartNo());

@ -144,18 +144,19 @@ public class MesRawPartChargingServiceImpl implements IMesRawPartChargingService
checkNotNull(mesRawPartChargingModel);
List<MesRawPartCharging> mesRawPartChargingList = findMesRawPartCharging(mesRawPartChargingModel);
if(CollectionUtils.isEmpty(mesRawPartChargingList)){
MesPcnException.throwMesBusiException("料筒条码【%s】未绑定无需初始化", mesRawPartChargingModel.getPackageSn());
}
for (MesRawPartCharging mesRawPartCharging : mesRawPartChargingList) {
//删除绑定信息
mesRawPartCharging.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
ConvertBean.serviceModelUpdate(mesRawPartCharging,mesRawPartChargingModel.getUserName());
mesRawPartChargingRepository.update(mesRawPartCharging);
//保存日志
saveLog(mesRawPartChargingModel, mesRawPartCharging, MesExtEnumUtil.CHARGING_LOG_STATUS.CLEAR);
if(!CollectionUtils.isEmpty(mesRawPartChargingList)){
for (MesRawPartCharging mesRawPartCharging : mesRawPartChargingList) {
//删除绑定信息
mesRawPartCharging.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
ConvertBean.serviceModelUpdate(mesRawPartCharging,mesRawPartChargingModel.getUserName());
mesRawPartChargingRepository.update(mesRawPartCharging);
//保存日志
saveLog(mesRawPartChargingModel, mesRawPartCharging, MesExtEnumUtil.CHARGING_LOG_STATUS.CLEAR);
}
// MesPcnException.throwMesBusiException("料筒条码【%s】未绑定无需初始化", mesRawPartChargingModel.getPackageSn());
}
}
private List<MesRawPackagePart> getMesRawPackagePartList(MesRawPartChargingModel mesRawPartChargingModel, MesRawPackageDetail packageDetail) {

@ -301,6 +301,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
newMesProductOffLine.setSapWorkCenter(oldMesWorkOrder.getErpWorkCenter());
newMesProductOffLine.setOrganizeCode(oldMesWorkOrder.getOrganizeCode());
newMesProductOffLine.setDescription(nowTime);
newMesProductOffLine.setBomTotalSize(mesBoms.size());
ConvertBean.serviceModelInitialize(newMesProductOffLine, userName);
mesProductOffLineList.add(newMesProductOffLine);
}
@ -371,6 +372,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
newMesProductOffLine.setOrganizeCode(organizeCode);
newMesProductOffLine.setDescription(mesProductionRecord.getCompleteDateTime());
newMesProductOffLine.setBomCode(mesBom.getBomCode());
newMesProductOffLine.setBomTotalSize(mesBoms.size());
ConvertBean.serviceModelInitialize(newMesProductOffLine, userName);
mesProductOffLineList.add(newMesProductOffLine);
}
@ -716,6 +718,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
LOGGER.info("条码【{}】报工成功,报工工单【{}】", productionRecord.getProductSn(), oldMesWorkOrder.getWorkOrderNo());
}
List<MesMove> mesMoveList = new ArrayList<>();
private MesProductOffLine getMesProductOffLine(MesProductionRecord productionRecord, String userName, MesWorkOrder oldMesWorkOrder, MesProductVersion mesProductVersion, MesBom mesBom) {
MesProductOffLine newMesProductOffLine = new MesProductOffLine();
@ -1075,7 +1078,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
String nowTime = TimeTool.getNowTime(true);
for (MesBom mesBom : mesBoms) {
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, nowTime));
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, nowTime,mesBoms.size()));
}
mesProductOffLineRDao.saveAll(mesProductOffLineList);
}
@ -1102,7 +1105,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
List<MesProductOffLine> mesProductOffLineList = new ArrayList<>();
String nowTime = TimeTool.getNowTime(true);
for (MesBom mesBom : mesBomList) {
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, nowTime));
mesProductOffLineList.add(creatMesProductOffLine(mesWorkOrder, mesProductVersion, sn, mesBom, nowTime, mesBomList.size()));
}
mesProductOffLineRDao.saveAll(mesProductOffLineList);
}
@ -1411,7 +1414,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
}
private MesProductOffLine creatMesProductOffLine(MesWorkOrder mesWorkOrder, MesProductVersion mesProductVersion,
String sn, MesBom mesBom, String nowTime) {
String sn, MesBom mesBom, String nowTime,Integer bomTotalSize) {
MesProductOffLine newMesProductOffLine;
newMesProductOffLine = new MesProductOffLine();
newMesProductOffLine.setReportPartNo(mesWorkOrder.getPartNo());
@ -1435,6 +1438,7 @@ public class MesWorkOrderService implements IMesWorkOrderService {
newMesProductOffLine.setSapWorkCenter(mesWorkOrder.getErpWorkCenter());
newMesProductOffLine.setOrganizeCode(mesWorkOrder.getOrganizeCode());
newMesProductOffLine.setDescription(nowTime);
newMesProductOffLine.setBomTotalSize(bomTotalSize);
ConvertBean.serviceModelInitialize(newMesProductOffLine, mesWorkOrder.getCreateUser());
return newMesProductOffLine;
}
@ -1673,10 +1677,8 @@ public class MesWorkOrderService implements IMesWorkOrderService {
private MesMove createMove(MesPartSap mesPart, MesProductionRecord record, String source, String target, String erpWorkCenterCode, Double qty, Integer moveType,String userName) {
MesMove move = new MesMove();
move.setMeins(record.getReportPartNo());
if (!Objects.isNull(mesPart)) {
move.setMeins(mesPart.getUnit());
}
move.setMatnr(mesPart.getPartNo());
move.setMeins(mesPart.getUnit());
move.setOrganizeCode(record.getOrganizeCode());
move.setFactoryCode(record.getOrganizeCode());
move.setLgort(source);

@ -67,23 +67,34 @@ public class MesShippingScanSnAndOrderStrategyServiceImpl implements IMesShippin
@Override
public MesSortShippingCheckModel doScan(MesSortShippingCheckModel model, MesShippingOrderManagement orderManagement, MesPartShippingGroup shippingGroup) {
if (!Objects.isNull(model.getLastShippingDetailId())) {
//校验条码
MesProduceSn produceSn = checkSn(model);
//更新单据信息
model.getDetailList().stream().filter(t -> t.getId().equals(model.getLastShippingDetailId())).forEach(detail -> {
detail.setBarcode(model.getSn());
//第一次扫描的是条码
if(StringUtils.isEmpty(detail.getVisualOrderNo())){
detail.setVisualOrderNo(model.getSn());
model.setSn(detail.getBarcode());
}else{
detail.setBarcode(model.getSn());
}
MesProduceSn produceSn = checkSn(model);
updateOrderManagementDetails(orderManagement, detail, getMesWorkOrder(model, produceSn, detail), produceSn, model.getUserInfo());
});
model.setLastShippingDetailId(null);
} else {
//校验目视单
MesWorkOrder workOrder = getWorkOrder(model);
//查询工单
MesWorkOrder workOrder = mesWorkOrderExtService.getWorkOrder(model.getOrganizeCode(), model.getSn());
//扫描的工单或条码对应的零件
String partNo = getPartNo(model, workOrder);
boolean scanFlg = false;
for (MesShippingOrderManagementDetail detail : model.getDetailList()) {
if (detail.getPartNo().equals(workOrder.getPartNo()) && StringUtils.isEmpty(detail.getBarcode()) && !Objects.equals(detail.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)) {
if (detail.getPartNo().equals(partNo) && StringUtils.isEmpty(detail.getBarcode()) && !Objects.equals(detail.getIsScanFlg(), MesCommonConstant.TRUE_INTEGER)) {
//校验发运明细
checkShippingDetails(model, orderManagement, shippingGroup, workOrder.getPartNo(), detail);
detail.setVisualOrderNo(model.getSn());
checkShippingDetails(model, orderManagement, shippingGroup, partNo, detail);
detail.setBarcode(model.getSn());
//如果第一次扫描的是目视单,先缓存数据用于第二次校验
if(!Objects.isNull(workOrder)){
detail.setVisualOrderNo(model.getSn());
}
//校验通过的明细ID
model.setLastShippingDetailId(detail.getId());
scanFlg = true;
@ -91,25 +102,42 @@ public class MesShippingScanSnAndOrderStrategyServiceImpl implements IMesShippin
}
}
if (!scanFlg) {
throw new ImppBusiException(String.format("【%s】此目视单对应的【%s】物料号与发运单中物料号不匹配请检查数据", model.getSn(), workOrder.getPartNo()));
throw new ImppBusiException(String.format("【%s】此目视单对应的【%s】物料号与发运单中物料号不匹配请检查数据", model.getSn(), partNo));
}
}
return model;
}
private String getPartNo(MesSortShippingCheckModel model, MesWorkOrder workOrder) {
//校验目视单是否已经扫描
if (model.getDetailList().stream().anyMatch(t -> !StringUtils.isEmpty(t.getVisualOrderNo()) && t.getVisualOrderNo().contains(model.getSn()))) {
throw new ImppBusiException(String.format("【%s】此目视单已经扫描过请检查数据", model.getSn()));
}
if (Objects.isNull(workOrder)) {
//如果扫描的是条码,校验条码
return checkSn(model).getPartNo();
}else{
//校验目视单状态
if (MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue() != workOrder.getWorkOrderStatus() || MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue() != workOrder.getQcStatus()) {
throw new ImppBusiException(String.format("目视单【%s】状态为【%s】质量状态为【%s】不允许发运", model.getSn(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()), MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(workOrder.getQcStatus())));
}
return workOrder.getPartNo();
}
}
private MesWorkOrder getMesWorkOrder(MesSortShippingCheckModel model, MesProduceSn produceSn, MesShippingOrderManagementDetail detail) {
MesWorkOrder workOrder = mesWorkOrderExtService.getWorkOrder(model.getOrganizeCode(), detail.getVisualOrderNo());
if (Objects.isNull(workOrder)) {
throw new ImppBusiException(String.format("目视单【%s】不存在请检查数据", model.getSn()));
throw new ImppBusiException(String.format("目视单【%s】不存在请检查数据", detail.getVisualOrderNo()));
}
//校验目视单状态
if (MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue() != workOrder.getWorkOrderStatus() || MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue() != workOrder.getQcStatus()) {
throw new ImppBusiException(String.format("目视单【%s】状态为【%s】质量状态为【%s】不允许发运", model.getSn(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()), MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(workOrder.getQcStatus())));
throw new ImppBusiException(String.format("目视单【%s】状态为【%s】质量状态为【%s】不允许发运", detail.getVisualOrderNo(), MesExtEnumUtil.ORDER_STATUS.valueOfDescription(workOrder.getWorkOrderStatus()), MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(workOrder.getQcStatus())));
}
//校验条码是否匹配
if (!Objects.equals(produceSn.getCustSn(), workOrder.getCustSn())) {
throw new ImppBusiException(String.format("目视单【%s】条码【%s】与扫描条码【%s】不匹配", detail.getVisualOrderNo(), workOrder.getCustSn(), model.getSn()));
throw new ImppBusiException(String.format("目视单【%s】条码【%s】与扫描条码【%s】不匹配", detail.getVisualOrderNo(), workOrder.getCustSn(), produceSn.getCustSn()));
}
//校验零件是否匹配
if (!Objects.equals(produceSn.getPartNo(), workOrder.getPartNo())) {
@ -165,7 +193,7 @@ public class MesShippingScanSnAndOrderStrategyServiceImpl implements IMesShippin
private MesProduceSn checkSn(MesSortShippingCheckModel model) {
//校验条码是否重复扫描
Optional<MesShippingOrderManagementDetail> optional = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getBarcode()) && k.getBarcode().equals(model.getSn())).findFirst();
Optional<MesShippingOrderManagementDetail> optional = model.getDetailList().stream().filter(k -> !StringUtils.isEmpty(k.getBarcode()) && k.getBarcode().contains(model.getSn())).findFirst();
if (optional.isPresent()) {
throw new ImppBusiException(String.format("【%s】此条码已经扫描过请检查数据", model.getSn()));
}

@ -136,8 +136,8 @@ public class AionPrintStrategy implements IPrintTemplateStrategyService {
if (StringUtils.isEmpty(part.getProductMatchRule())) MesPcnException.throwMesBusiException("物料[%s]未维护零件条码匹配规则", part.getPartNo());
MesNumberRule numberRule = numberRuleRepository.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.RULE_CODE},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProcessMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProcessMatchRule());
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProductMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProductMatchRule());
return numberRule;
}

@ -151,8 +151,8 @@ public class GqxnyPrintStrategy implements IPrintTemplateStrategyService {
if (StringUtils.isEmpty(part.getProductMatchRule())) MesPcnException.throwMesBusiException("物料[%s]未维护零件条码匹配规则", part.getPartNo());
MesNumberRule numberRule = numberRuleRepository.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.RULE_CODE},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProcessMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProcessMatchRule());
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProductMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProductMatchRule());
return numberRule;
}

@ -123,8 +123,8 @@ public class XiaoPengNewPrintStrategy implements IPrintTemplateStrategyService {
if (StringUtils.isEmpty(part.getProductMatchRule())) MesPcnException.throwMesBusiException("物料[%s]未维护零件条码匹配规则", part.getPartNo());
MesNumberRule numberRule = numberRuleRepository.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.RULE_CODE},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProcessMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProcessMatchRule());
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProductMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProductMatchRule());
return numberRule;
}

@ -125,8 +125,8 @@ public class XiaoPengPrintStrategy implements IPrintTemplateStrategyService {
if (StringUtils.isEmpty(part.getProductMatchRule())) MesPcnException.throwMesBusiException("物料[%s]未维护零件条码匹配规则", part.getPartNo());
MesNumberRule numberRule = numberRuleRepository.getByProperty(
new String[]{MesPcnExtConstWords.ORGANIZE_CODE, MesPcnExtConstWords.IS_DELETED, MesPcnExtConstWords.IS_VALID, MesPcnExtConstWords.RULE_CODE},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProcessMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProcessMatchRule());
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), part.getProductMatchRule()});
if (null == numberRule) MesPcnException.throwMesBusiException("物料[%s]维护的零件条码匹配规则[%s]信息不存在", part.getPartNo(), part.getProductMatchRule());
return numberRule;
}

@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
import cn.estsh.i3plus.ext.mes.pcn.api.busi.*;
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.actor.shipping.dispatch.IFsmCommonService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.util.PojoAttrUtil;
import cn.estsh.i3plus.mes.pcn.util.StringUtil;
@ -54,6 +55,9 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
@Autowired
private IMesWorkOrderExtService workOrderExtService;
@Autowired
private IFsmCommonService fsmCommonService;
@Override
public StepResult execute(StationRequestBean reqBean) {
@ -433,16 +437,18 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
//显示装配件信息
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
Boolean isNeedShowMatchRule = checkIsNeedShowMatchRule(reqBean);
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
//封装匹配当前设备的装配件信息
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter));
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule);
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
//装配件清单列表标题
List<AttrBean> attrBeanList = dataAttrList(prodRuleContext.getWorkOrderNo());
List<AttrBean> attrBeanList = dataAttrList(prodRuleContext.getWorkOrderNo(), isNeedShowMatchRule);
//封装多表格
resultBean.addStationResultBeans(new StationResultBean().dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()).dataAttrList(attrBeanList).resultList(assemblyShowContextList));
@ -458,18 +464,24 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
}
//未知腔数配置【工位参数】
private Boolean checkIsNeedShowMatchRule(StationRequestBean reqBean) {
String assemblyShowMrCfg = fsmCommonService.handleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.ASSEMBLY_SHOW_MR_CFG);
return (!StringUtils.isEmpty(assemblyShowMrCfg) && assemblyShowMrCfg.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) ? true : false;
}
private String getWorkOrderNo(Map<Integer, MesProductionPartContext> productionPartMap, Integer foreignKey) {
return (!CollectionUtils.isEmpty(productionPartMap) && productionPartMap.containsKey(foreignKey)) ? productionPartMap.get(foreignKey).getWorkOrderNo() : null;
}
//封装匹配当前设备的装配件信息
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList) {
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList, Boolean isNeedShowMatchRule) {
if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null;
List<MesAssemblyShowContext> assemblyShowContextList = new ArrayList<>();
for (MesProductionAssemblyContext item : productionAssemblyContextList) {
//不显示且不扫描/仅目视的不显示出来
if (null == item || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue;
assemblyShowContextList.add(assemblyShowContext(item));
assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule));
}
assemblyShowContextList = assemblyShowContextList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesAssemblyShowContext::getRouteSeq)).collect(Collectors.toList());
@ -481,30 +493,31 @@ public class MesAssemblyShowNosortStepService extends BaseStepService {
}
//封装装配件信息
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) {
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule) {
MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext();
BeanUtils.copyProperties(o, assemblyShowContext);
if (!MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedShowMatchRule(assemblyShowContext.getMatchType())) {
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()));
} else {
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()) + "【" + assemblyShowContext.getMatchRule() + "】");
}
BeanUtils.copyProperties(productionAssemblyContext, assemblyShowContext);
if (isNeedShowMatchRule) assemblyShowContext.setMatchTypeName(showMatchRule(assemblyShowContext));
assemblyShowContext.setAssemblyStatusName(MesExtEnumUtil.ASSEMBLY_STATUS.valueOfDescription(assemblyShowContext.getAssemblyStatus()));
if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() != assemblyShowContext.getAssemblyStatus())
assemblyShowContext.setColor(StringUtils.isEmpty(assemblyShowContext.getShowColor()) ? MesExtEnumUtil.COLOR.GREEN.getValue() : assemblyShowContext.getShowColor());
return assemblyShowContext;
}
private String showMatchRule(MesAssemblyShowContext assemblyShowContext) {
if (!MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedShowMatchRule(assemblyShowContext.getMatchType())) return MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType());
return MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()) + "【" + assemblyShowContext.getMatchRule() + "】";
}
//装配件清单列表标题
private List<AttrBean> dataAttrList(String workOrderNo) {
private List<AttrBean> dataAttrList(String workOrderNo, Boolean isNeedShowMatchRule) {
List<AttrBean> attrBeanList = new ArrayList<>();
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
if (isNeedShowMatchRule) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
if (!StringUtils.isEmpty(workOrderNo)) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "零件编码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, "原料编码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, "原料名称");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, "原料条码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "产成零件编码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, "零件编码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, "零件名称");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, "零件条码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_STATUS_NAME, "装配状态");
return attrBeanList;
}

@ -5,11 +5,14 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPsInContext;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
@ -33,4 +36,8 @@ public class MesAssemblyShowSortPreCraftStepService extends MesAssemblyShowSortS
return prodRuleCfgExtService.getProdRuleSortPreCraftContext(prodRuleContext, workCellMap, reqBean.getWorkCellCode());
}
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
return showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, true);
}
}

@ -5,6 +5,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepSer
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
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.actor.shipping.dispatch.IFsmCommonService;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.util.PojoAttrUtil;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
@ -46,6 +47,9 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
@Autowired
public IMesProdRuleCfgExtService prodRuleCfgExtService;
@Autowired
private IFsmCommonService fsmCommonService;
@Override
public StepResult execute(StationRequestBean reqBean) {
@ -95,7 +99,7 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
//显示装配件信息
if (!showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, false))
if (!showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList))
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "当前未查询到相关的装配件清单");
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "显示装配件扫描项成功!");
@ -110,16 +114,18 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
//装配件清单列表标题
private List<AttrBean> dataAttrList(List<MesProdRuleContext> prodRuleContextList, Boolean isNeedShowCell) {
private List<AttrBean> dataAttrList(List<MesProdRuleContext> prodRuleContextList, Boolean isNeedShowCell, Boolean isNeedShowMatchRule) {
List<AttrBean> attrBeanList = new ArrayList<>();
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.INDEX, "序号");
if (isNeedShowCell) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_CELL_CODE, "工位代码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
if (prodRuleContextList.size() > 1) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "零件编码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, "原料编码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, "原料名称");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, "原料条码");
if (isNeedShowMatchRule) PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.MATCH_TYPE_NAME, "装配方式");
if (prodRuleContextList.size() > 1) {
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.WORK_ORDER_NO, "生产工单编号");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.PART_NO, "产成零件编码");
}
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NO, "零件编码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_PART_NAME, "零件名称");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_SN, "零件条码");
PojoAttrUtil.loadPojoAttrs(attrBeanList, MesPcnExtConstWords.ASSEMBLY_STATUS_NAME, "装配状态");
return attrBeanList;
}
@ -157,22 +163,28 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
return showProductionAssembly(reqBean, resultBean, workCenter, prodRuleContextList, false);
}
public Boolean showProductionAssembly(StationRequestBean reqBean, StationResultBean resultBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList, Boolean isNeedShowCell) {
List<AttrBean> attrBeanList = null;
if (isNeedShowCell) isNeedShowCell = checkIsNeedShowCell(reqBean, workCenter, prodRuleContextList);
if (isNeedShowCell) isNeedShowCell = checkIsNeedShowCell(reqBean, prodRuleContextList);
Boolean isNeedShowMatchRule = checkIsNeedShowMatchRule(reqBean);
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
//封装匹配当前设备的装配件信息
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter));
List<MesAssemblyShowContext> assemblyShowContextList = getAssemblyShowContextList(prodRuleContext.getAssemblyDataContext(workCenter), isNeedShowMatchRule);
if (CollectionUtils.isEmpty(assemblyShowContextList)) continue;
//装配件清单列表标题
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList(prodRuleContextList, isNeedShowCell);
if (CollectionUtils.isEmpty(attrBeanList)) attrBeanList = dataAttrList(prodRuleContextList, isNeedShowCell, isNeedShowMatchRule);
//封装多表格
resultBean.addStationResultBeans(new StationResultBean().dataType(MesPcnEnumUtil.STATION_DATA_TYPE.TABLE.getValue()).dataAttrList(attrBeanList).resultList(assemblyShowContextList));
@ -189,22 +201,28 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
//验证是否需要演示工位代码列
private Boolean checkIsNeedShowCell(StationRequestBean reqBean, MesWorkCenter workCenter, List<MesProdRuleContext> prodRuleContextList) {
private Boolean checkIsNeedShowCell(StationRequestBean reqBean, List<MesProdRuleContext> prodRuleContextList) {
for (MesProdRuleContext prodRuleContext : prodRuleContextList) {
if (null == prodRuleContext || StringUtils.isEmpty(prodRuleContext.getAssemblyDataJson())) continue;
if (!prodRuleContext.getAssemblyDataContext(workCenter).get(0).getWorkCellCode().equals(reqBean.getWorkCellCode())) return true;
if (!prodRuleContext.getSortAssemblyDataContext().get(0).getWorkCellCode().equals(reqBean.getWorkCellCode())) return true;
}
return false;
}
//未知腔数配置【工位参数】
private Boolean checkIsNeedShowMatchRule(StationRequestBean reqBean) {
String assemblyShowMrCfg = fsmCommonService.handleFsmWcpcMapDataForDoScan(reqBean).get(MesPcnExtConstWords.ASSEMBLY_SHOW_MR_CFG);
return (!StringUtils.isEmpty(assemblyShowMrCfg) && assemblyShowMrCfg.equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) ? true : false;
}
//封装匹配当前设备的装配件信息
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList) {
private List<MesAssemblyShowContext> getAssemblyShowContextList(List<MesProductionAssemblyContext> productionAssemblyContextList, Boolean isNeedShowMatchRule) {
if (CollectionUtils.isEmpty(productionAssemblyContextList)) return null;
List<MesAssemblyShowContext> assemblyShowContextList = new ArrayList<>();
for (MesProductionAssemblyContext item : productionAssemblyContextList) {
//不显示且不扫描/仅目视的不显示出来
if (null == item || MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNoShow(item.getMatchType())) continue;
assemblyShowContextList.add(assemblyShowContext(item));
assemblyShowContextList.add(assemblyShowContext(item, isNeedShowMatchRule));
}
assemblyShowContextList = sortAssemblyShowContextList(assemblyShowContextList);
@ -216,18 +234,19 @@ public class MesAssemblyShowSortStepService extends BaseStepService {
}
//封装装配件信息
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext o) {
private MesAssemblyShowContext assemblyShowContext(MesProductionAssemblyContext productionAssemblyContext, Boolean isNeedShowMatchRule) {
MesAssemblyShowContext assemblyShowContext = new MesAssemblyShowContext();
BeanUtils.copyProperties(o, assemblyShowContext);
if (!MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedShowMatchRule(assemblyShowContext.getMatchType())) {
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()));
} else {
assemblyShowContext.setMatchTypeName(MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()) + "【" + assemblyShowContext.getMatchRule() + "】");
}
assemblyShowContext.setAssemblyStatusName(MesExtEnumUtil.ASSEMBLY_STATUS.valueOfDescription(o.getAssemblyStatus()));
BeanUtils.copyProperties(productionAssemblyContext, assemblyShowContext);
if (isNeedShowMatchRule) assemblyShowContext.setMatchTypeName(showMatchRule(assemblyShowContext));
assemblyShowContext.setAssemblyStatusName(MesExtEnumUtil.ASSEMBLY_STATUS.valueOfDescription(assemblyShowContext.getAssemblyStatus()));
if (MesExtEnumUtil.ASSEMBLY_STATUS.ASSEMBLY_STATUS_30.getValue() != assemblyShowContext.getAssemblyStatus())
assemblyShowContext.setColor(StringUtils.isEmpty(assemblyShowContext.getShowColor()) ? MesExtEnumUtil.COLOR.GREEN.getValue() : assemblyShowContext.getShowColor());
return assemblyShowContext;
}
private String showMatchRule(MesAssemblyShowContext assemblyShowContext) {
if (!MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.checkIsNeedShowMatchRule(assemblyShowContext.getMatchType())) return MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType());
return MesExtEnumUtil.ASSEMBLY_MATCH_TYPE.valueOfDescription(assemblyShowContext.getMatchType()) + "【" + assemblyShowContext.getMatchRule() + "】";
}
}

@ -7,6 +7,7 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesEquipVariableCfgCollectContex
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService;
import cn.estsh.i3plus.mes.pcn.util.StringUtil;
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariableCfg;
@ -229,7 +230,7 @@ public class MesProductResultReadStepService extends BaseStepService {
Integer equipVariableValue = StringUtils.isEmpty(shotCounterList.get(0).getEquipVariableCollectContextList().get(0).getEquipVariableValue()) ? MesPcnExtConstWords.ZERO : Integer.valueOf(shotCounterList.get(0).getEquipVariableCollectContextList().get(0).getEquipVariableValue());
if (shotCounterCached.compareTo(equipVariableValue) != 0) {
productionCustomContextStepService.dispatchShortCounter(reqBean, equipVariableValue);
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- mesProductResultReadStepService EXEC --- shotCounterCached:{} --- UPDATE:{}", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), shotCounterCached, equipVariableValue);
log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- shotCounterCached:{} --- UPDATE:{}", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), shotCounterCached, equipVariableValue);
}
if (shotCounterCached.compareTo(equipVariableValue) >= 0) return false;
return true;

@ -26,10 +26,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -173,6 +171,7 @@ public class MesProductionRecordGenerateStepService extends BaseStepService {
productionRecord.setOrganizeCode(reqBean.getOrganizeCode());
ConvertBean.serviceModelInitialize(productionRecord, reqBean.getUserInfo());
productionRecord.setCompleteDateTime(productionRecord.getModifyDatetime());
productionRecord.setCreateDatetime((new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()));
productionRecord.setFid(UUID.randomUUID().toString());
productionRecord.setOneMouldMoreId(UUID.randomUUID().toString());

@ -308,6 +308,8 @@ public class MesPcnExtConstWords {
// 非排序需要验证主条码是否是自制件[工步参数]
public static final String NEED_CHECK_IS_PS = "NEED_CHECK_IS_PS";
// 装配件显示规则配置[工位参数]
public static final String ASSEMBLY_SHOW_MR_CFG = "ASSEMBLY_SHOW_MR_CFG";
// 非排序是否支持顺序强过,前道强过[工位参数]
public static final String IS_ALLOW_JUMP = "IS_ALLOW_JUMP";
// 未知腔数[工位参数]

Loading…
Cancel
Save