forked from I3-YF/i3plus-mes-pcn-yfai
自动化线接口
parent
8b7f9d3b00
commit
39922d0bd2
@ -0,0 +1,7 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.api.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceModel;
|
||||
|
||||
public interface IMesEquipmentProductionResultService {
|
||||
void doCreateEquipmentProductionResult(MesAutoLineInterfaceModel info);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentProductionResultService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceDetailModel;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceModel;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.IShippingDispatchService;
|
||||
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
||||
import cn.estsh.i3plus.platform.common.util.MesPcnConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.MesPcnEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesConfig;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentProductionResult;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentProductionResultDetail;
|
||||
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesConfigRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentProductionResultDetailRepository;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentProductionResultRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class MesEquipmentProductionResultServiceImpl implements IMesEquipmentProductionResultService {
|
||||
public static final Logger log = LoggerFactory.getLogger(MesEquipmentProductionResultServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private IShippingDispatchService shippingDispatchService;
|
||||
@Autowired
|
||||
private MesConfigRepository configRao;
|
||||
@Autowired
|
||||
private MesEquipmentProductionResultRepository resultRDao;
|
||||
@Autowired
|
||||
private MesEquipmentProductionResultDetailRepository resultDetailRDao;
|
||||
|
||||
@Override
|
||||
public void doCreateEquipmentProductionResult(MesAutoLineInterfaceModel info) {
|
||||
String organizeCode = "";
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
|
||||
DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.CHANG_SHU_AUTO_LINE_INTERFACE,"cfgCode",packBean);
|
||||
List<MesConfig> configList = configRao.findByHqlWhere(packBean);
|
||||
for (MesConfig mesConfig : configList) {
|
||||
if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.CHANG_SHU_ORGANIZE_CODE)){
|
||||
organizeCode = mesConfig.getCfgValue();
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(organizeCode)) {
|
||||
log.error("没有配置表mes_config,cfg_code为CHANG_SHU_AUTO_LINE_INTERFACE,key为CHANG_SHU_ORGANIZE_CODE没有配置");
|
||||
return;
|
||||
}
|
||||
StationRequestBean reqBean = new StationRequestBean(organizeCode, info.getWorkCenterCode(), info.getWorkCellCode(), "webservices");
|
||||
reqBean.setBusiType(MesPcnEnumUtil.ACTOR_RECEIVE_STRATEGY.WS_CMD_DO_SCAN.getCode());
|
||||
reqBean.setInterfaceType(MesPcnConstWords.SHIPPING);
|
||||
reqBean.setScanInfo(info.getProductSn());
|
||||
shippingDispatchService.sendScanQueueNextExec(reqBean);
|
||||
|
||||
MesEquipmentProductionResult result = new MesEquipmentProductionResult();
|
||||
result.setOrganizeCode(organizeCode);
|
||||
result.setWorkCenterCode(info.getWorkCenterCode());
|
||||
result.setWorkCellCode(info.getWorkCellCode());
|
||||
result.setProductSn(info.getProductSn());
|
||||
result.setQty(info.getQty());
|
||||
result.setResult(info.getResult());
|
||||
ConvertBean.serviceModelInitialize(result, "webservices");
|
||||
resultRDao.insert(result);
|
||||
|
||||
if (!CollectionUtils.isEmpty(info.getDetails())) {
|
||||
for (MesAutoLineInterfaceDetailModel detailModel : info.getDetails()) {
|
||||
MesEquipmentProductionResultDetail detail = new MesEquipmentProductionResultDetail();
|
||||
detail.setOrganizeCode(organizeCode);
|
||||
detail.setResultId(result.getId());
|
||||
detail.setBarCode(detailModel.getBarCode());
|
||||
detail.setWorkCellCode(detailModel.getWorkCellCode());
|
||||
detail.setType(detailModel.getType());
|
||||
detail.setParamName(detailModel.getParamName());
|
||||
detail.setParamValue(detailModel.getParamValue());
|
||||
ConvertBean.serviceModelInitialize(detail, "webservices");
|
||||
resultDetailRDao.insert(detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.step;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionProcessContext;
|
||||
import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.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;
|
||||
|
||||
/**
|
||||
* @Description : 自动化线接口获取生产数据
|
||||
* @Author : jason.niu
|
||||
**/
|
||||
@Slf4j
|
||||
@Service("mesEquipmentLProductionResultStepService")
|
||||
public class MesEquipmentLProductionResultStepService extends BaseStepService {
|
||||
@Autowired
|
||||
private IMesProductionProcessContextStepService productionProcessContextStepService;
|
||||
|
||||
@Autowired
|
||||
private IMesProductionDispatchContextStepService productionDispatchContextStepService;
|
||||
|
||||
@Override
|
||||
public StepResult execute(StationRequestBean reqBean) {
|
||||
|
||||
StationResultBean resultBean = new StationResultBean();
|
||||
|
||||
StepResult stepResult = StepResult.getSuccessComplete();
|
||||
final String organizeCode = reqBean.getOrganizeCode();
|
||||
|
||||
//获取工位当前设备信息
|
||||
MesProductionProcessContext productionProcessContext = productionProcessContextStepService.dispatchCurCellEquipment(reqBean);
|
||||
|
||||
//配置错误 抛出异常
|
||||
if (!productionProcessContext.getSuccess()) {
|
||||
stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), productionProcessContext.getMessage());
|
||||
}
|
||||
|
||||
return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, "收集自动化线生产结果成功!");
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipmentProductionResultService;
|
||||
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesAutoLineInterfaceModel;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
|
||||
@WebService(targetNamespace = "http://tempuri.org/services/SyncSPSForEquipmentService")
|
||||
public class WebServiceServerAutoLineInterface {
|
||||
public static final Logger log = LoggerFactory.getLogger(WebServiceServerAutoLineInterface.class);
|
||||
|
||||
@WebMethod(action = "sendMessage", operationName = "sendMessage")
|
||||
public void sendMessage(@WebParam(name = "info") MesAutoLineInterfaceModel info) {
|
||||
IMesEquipmentProductionResultService service = SpringContextsUtil.getBean(IMesEquipmentProductionResultService.class);
|
||||
service.doCreateEquipmentProductionResult(info);
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.estsh.i3plus.ext.mes.pcn.pojo.model;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
//@Getter
|
||||
//@Setter
|
||||
//@NoArgsConstructor // 显式生成无参构造函数(关键)
|
||||
//@AllArgsConstructor // 同时保留带参构造函数
|
||||
public class MesAutoLineInterfaceDetailModel {
|
||||
@ApiParam("类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiParam(value = "工位代码")
|
||||
private String workCellCode;
|
||||
|
||||
@ApiParam(value = "条码")
|
||||
private String barCode;
|
||||
|
||||
@ApiParam(value = "参数值")
|
||||
private String paramValue;
|
||||
|
||||
@ApiParam(value = "参数名")
|
||||
private String paramName;
|
||||
|
||||
@XmlElement(name = "Type")
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Location")
|
||||
public String getWorkCellCode() {
|
||||
return workCellCode;
|
||||
}
|
||||
|
||||
public void setWorkCellCode(String workCellCode) {
|
||||
this.workCellCode = workCellCode;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Barcode")
|
||||
public String getBarCode() {
|
||||
return barCode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barCode = barCode;
|
||||
}
|
||||
|
||||
@XmlElement(name = "ParamValue")
|
||||
public String getParamValue() {
|
||||
return paramValue;
|
||||
}
|
||||
|
||||
public void setParamValue(String paramValue) {
|
||||
this.paramValue = paramValue;
|
||||
}
|
||||
|
||||
@XmlElement(name = "ParamName")
|
||||
public String getParamName() {
|
||||
return paramName;
|
||||
}
|
||||
|
||||
public void setParamName(String paramName) {
|
||||
this.paramName = paramName;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue