forked from I3-YF/i3plus-mes-pcn-yfai
tags/yfai-pcn-ext-v1.0
parent
ac48c64464
commit
9c3f58cbaf
@ -0,0 +1,12 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi.yf;
|
||||
|
||||
/**
|
||||
* @Author: wangjie
|
||||
* @CreateDate: 2021/01/19 15:06 下午
|
||||
* @Description:
|
||||
**/
|
||||
public interface IYfManyCellMonitorService {
|
||||
|
||||
void doWritePlc(String organizeCode, String plcCode, String value);
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi.yf;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.yf.IYfManyCellMonitorService;
|
||||
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||
import cn.estsh.impp.framework.base.controller.MesPcnBaseController;
|
||||
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 io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: wangjie
|
||||
* @CreateDate: 2021/01/19 15:37
|
||||
* @Description:
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstWords.BASE_URL_MES_PCN)
|
||||
@Api(tags = "延峰多工位监控生产")
|
||||
public class YfManyCellMonitorController extends MesPcnBaseController {
|
||||
|
||||
@Autowired
|
||||
private IYfManyCellMonitorService manyCellMonitorService;
|
||||
|
||||
@GetMapping(value = "/many-cell-monitor/plc-write")
|
||||
@ApiOperation(value = "模拟PLC写值")
|
||||
public ResultBean doWritePlc(String organizeCode, String plcCode, String value) {
|
||||
try {
|
||||
manyCellMonitorService.doWritePlc(organizeCode, plcCode, value);
|
||||
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
|
||||
} catch (ImppBusiException busExcep) {
|
||||
return ResultBean.fail(busExcep);
|
||||
} catch (Exception e) {
|
||||
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.step.yf;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.station.yf.YfManyCellMonitorModuleService;
|
||||
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.base.BaseStepService;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Service("yfManyCellMonitorStepService")
|
||||
public class YfManyCellMonitorStepService extends BaseStepService {
|
||||
|
||||
@Autowired
|
||||
private IFsmCommonService fsmCommonService;
|
||||
|
||||
@Autowired
|
||||
private YfManyCellMonitorModuleService manyCellMonitorModuleService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- YfManyCellMonitorStepService --- START --- ", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode());
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
|
||||
fsmCommonService.checkWcpcMapForDoScan(reqBean);
|
||||
|
||||
String plcCode = reqBean.getWcpcMap().get(MesPcnExtConstWords.PLC_CODE_UC);
|
||||
|
||||
String plcValue = (String) manyCellMonitorModuleService.doHandlePlcData(reqBean, 1, plcCode, null);
|
||||
|
||||
if (StringUtils.isEmpty(plcValue) || !plcValue.equals("true"))
|
||||
return execDynamicsCompleteAndSendMsgReturn(reqBean, resultBean, stepResult, false, MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT, "正在监听PLC信号中...");
|
||||
|
||||
manyCellMonitorModuleService.doHandlePlcData(reqBean, 2, plcCode, "false");
|
||||
|
||||
log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- YfManyCellMonitorStepService --- SUCCESS ---", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode());
|
||||
|
||||
this.sendMessage(reqBean, resultBean, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(), MesPcnEnumUtil.STATION_BUSI_TYPE.ADDITIONAL_TIPS, MesPcnEnumUtil.STATION_DATA_TYPE.CUSTOM);
|
||||
|
||||
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean, stepResult, "已获取到PLC信号!");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.step.yf;
|
||||
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.base.BaseStepService;
|
||||
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.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Service("yfManyCellProdStepService")
|
||||
public class YfManyCellProdStepService extends BaseStepService {
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- YfManyCellProdStepService --- START --- ", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode());
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
|
||||
log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- YfManyCellProdStepService --- SUCCESS ---", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode());
|
||||
|
||||
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean, String.format("产品条码[%s]已进入自动加工!", reqBean.getSerialNumber()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.step.yf;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.station.yf.YfManyCellMonitorModuleService;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.base.BaseStepService;
|
||||
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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Service("yfManyCellScanStepService")
|
||||
public class YfManyCellScanStepService extends BaseStepService {
|
||||
|
||||
@Autowired
|
||||
private YfManyCellMonitorModuleService manyCellMonitorModuleService;
|
||||
|
||||
@Override
|
||||
public StepResult guide(StationRequestBean reqBean) {
|
||||
return execSuccessCompleteAndSendGuideReturn(reqBean, new StationResultBean(), "请扫描产品条码!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- YfManyCellScanStepService --- START --- ", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode());
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
if (StringUtils.isEmpty(reqBean.getScanInfo())) execSendGuideAndThrowEx(reqBean, resultBean, "请扫描产品条码!");
|
||||
|
||||
manyCellMonitorModuleService.addSerialNumber(reqBean, reqBean.getScanInfo());
|
||||
|
||||
reqBean.setSerialNumber(reqBean.getScanInfo());
|
||||
|
||||
log.info("工厂{}生产线{}工位{}: --- STEP EXECUTE --- YfManyCellScanStepService --- SUCCESS ---", reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode());
|
||||
|
||||
return execSuccessCompleteAndSendMsgReturn(reqBean, resultBean, String.format("产品条码[%s]扫描成功! 请进行加工操作!", reqBean.getSerialNumber()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.yf;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.yf.IYfManyCellMonitorService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.station.yf.YfManyCellMonitorModuleService;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author yumingxing
|
||||
* @version 1.0
|
||||
* @date 2021/7/12 9:59
|
||||
**/
|
||||
@Service
|
||||
public class YfManyCellMonitorService implements IYfManyCellMonitorService {
|
||||
|
||||
@Autowired
|
||||
private YfManyCellMonitorModuleService manyCellMonitorModuleService;
|
||||
|
||||
@Override
|
||||
public void doWritePlc(String organizeCode, String plcCode, String value) {
|
||||
StationRequestBean requestBean = new StationRequestBean();
|
||||
requestBean.setOrganizeCode(organizeCode);
|
||||
manyCellMonitorModuleService.doHandlePlcData(requestBean, 2, plcCode, value);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.pojo.model.yf;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description :不良分类MODEL
|
||||
* @Reference :
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2019-06-04
|
||||
* @Modify:
|
||||
**/
|
||||
@Data
|
||||
@Api("MODEL")
|
||||
public class YfManyCellMonitorModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6940726955090728522L;
|
||||
|
||||
private String serialNumber;
|
||||
private String createDatetime;
|
||||
private String userInfo;
|
||||
private String status;
|
||||
|
||||
public YfManyCellMonitorModel() {}
|
||||
|
||||
public YfManyCellMonitorModel(String serialNumber, String createDatetime, String userInfo) {
|
||||
this.serialNumber = serialNumber;
|
||||
this.createDatetime = createDatetime;
|
||||
this.userInfo = userInfo;
|
||||
}
|
||||
|
||||
public YfManyCellMonitorModel status(String status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue