重构sps代码

tags/yfai-pcn-ext-v2.3
臧学普 7 months ago
parent e2433f1a78
commit 08b0b58982

@ -28,5 +28,12 @@ public interface IMesPullingOrderInfoService {
List<MesPullingOrderPartInfo> doMesPullingOrderInfoSend(List<MesPullingOrderPartInfo> infoList, String userName);
Map<String,Object> doSPSForEquipment(String assemblyLine, String pullingGroupCode, String organizeCode);
MesPullingOrderInfo doSPSForEquipment100();
String doSPSForEquipmentString100();
MesPullingOrderInfo doSPSForEquipment200();
String doSPSForEquipmentString200();
}

@ -22,6 +22,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.config;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.DcsForEquipmentServer;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.WebServiceServerSPS;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice.WebServiceServerSPS200;
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
@ -59,9 +60,16 @@ public class WebServiceConfig {
}
@Bean
public Endpoint endpointSpsEqu() {
public Endpoint endpointSpsEqu100() {
EndpointImpl endpoint = new EndpointImpl(bus, new WebServiceServerSPS());
endpoint.publish("/mes-service-spsEqu");
endpoint.publish("/mes-service-spsEqu100");
return endpoint;
}
@Bean
public Endpoint endpointSpsEqu200() {
EndpointImpl endpoint = new EndpointImpl(bus, new WebServiceServerSPS200());
endpoint.publish("/mes-service-spsEqu200");
return endpoint;
}
}

@ -19,6 +19,7 @@ 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 com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -59,6 +60,10 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
@Autowired
private IMesPrintedSnLogRepository snLogRao;
@Autowired
private MesConfigRepository configRao;
@Override
public ListPager<MesPullingOrderInfo> queryMesPullingOrderInfoByPager(MesPullingOrderInfo bean, Pager pager) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode());
@ -291,40 +296,96 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
}
@Override
public Map<String,Object> doSPSForEquipment(String assemblyLine, String pullingGroupCode, String organizeCode) {
Map<String,Object> resultMap = new HashMap();
//查询拉动单状态为已扫描=20的 拉动单
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_PULL_ORDER_TYPE.SPS_PULL.getValue(), "pullOrderType", seriesPackBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.JIS_PULL.getValue(), "pullOrderStatus", seriesPackBean);
seriesPackBean.setWhereAppend(seriesPackBean.getWhereAppend() + " order by modifyDatetime desc");
public MesPullingOrderInfo doSPSForEquipment100() {
String organizeCode = "";
String assemblyLine = "";
MesPullingOrderInfo mesPullingOrder = mesPullingOrderInfoRepository.getByProperty(seriesPackBean);
if (StringUtil.isEmpty(mesPullingOrder)) {
resultMap.put("success", false);
String message = "SPS拉动数据已扫描数据为空请检查拉动单数据";
resultMap.put("message", message);
return resultMap;
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean);
List<MesConfig> configList = configRao.findByHqlWhere(packBean);
for (MesConfig mesConfig : configList) {
if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_100)){
assemblyLine = mesConfig.getCfgValue();
}else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){
organizeCode = mesConfig.getCfgValue();
}
}
//更新主表状态 源系统为25配料完成 现在-【已发送设备-30】
mesPullingOrder.setPullOrderStatus(MesExtEnumUtil.PULL_ORDER_STATUS.SPS_PULL.getValue());
ConvertBean.serviceModelUpdate(mesPullingOrder, "WS.SPS");
mesPullingOrderInfoRepository.update(mesPullingOrder);
String message = "更新SPS状态成功已发送SPS信息给设备! id:" + mesPullingOrder.getId() + "Code:" + mesPullingOrder.getPullingOrderNo() + "产线" + assemblyLine + "拉动组" + pullingGroupCode + "";
//查询拉动组明细
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(mesPullingOrder.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(mesPullingOrder.getPullingOrderNo(), "pullingOrderNo", partPackBean);
List<MesPullingOrderPartInfo> pullingOrderPartInfos = mesPullingOrderPartInfoRepository.findByHqlWhere(partPackBean);
if (!org.apache.shiro.util.CollectionUtils.isEmpty(pullingOrderPartInfos)) {
mesPullingOrder.setPartList(pullingOrderPartInfos);
if (organizeCode.isEmpty() || assemblyLine.isEmpty()) {
log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置");
return null;
}
return getPullingOrder(organizeCode, assemblyLine);
}
@Override
public String doSPSForEquipmentString100() {
String organizeCode = "";
String assemblyLine = "";
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean);
List<MesConfig> configList = configRao.findByHqlWhere(packBean);
for (MesConfig mesConfig : configList) {
if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_100)){
assemblyLine = mesConfig.getCfgValue();
}else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){
organizeCode = mesConfig.getCfgValue();
}
}
if (organizeCode.isEmpty() || assemblyLine.isEmpty()) {
log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置");
return null;
}
return JSON.toJSONString(getPullingOrder(organizeCode, assemblyLine));
}
@Override
public MesPullingOrderInfo doSPSForEquipment200() {
String organizeCode = "";
String assemblyLine = "";
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean);
List<MesConfig> configList = configRao.findByHqlWhere(packBean);
for (MesConfig mesConfig : configList) {
if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_200)){
assemblyLine = mesConfig.getCfgValue();
}else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){
organizeCode = mesConfig.getCfgValue();
}
}
if (organizeCode.isEmpty() || assemblyLine.isEmpty()) {
log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置");
return null;
}
resultMap.put("orderInfo", mesPullingOrder);
resultMap.put("success", true);
resultMap.put("message", message);
return getPullingOrder(organizeCode, assemblyLine);
}
return resultMap;
@Override
public String doSPSForEquipmentString200() {
String organizeCode = "";
String assemblyLine = "";
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(MesPcnExtConstWords.WU_HAN_SPS_CFG_CODE,"cfgCode",packBean);
List<MesConfig> configList = configRao.findByHqlWhere(packBean);
for (MesConfig mesConfig : configList) {
if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_WORK_CENTER_CODE_200)){
assemblyLine = mesConfig.getCfgValue();
}else if (mesConfig.getCfgKey().equals(MesPcnExtConstWords.WU_HAN_ORGANIZE_CODE)){
organizeCode = mesConfig.getCfgValue();
}
}
if (organizeCode.isEmpty() || assemblyLine.isEmpty()) {
log.error("没有配置表mes_config,cfg_code为WU_HAN_SPS_CODE,key为WU_HAN_WORK_CENTER_CODE_100 或者 WU_HAN_ORGANIZE_CODE没有配置");
return null;
}
return JSON.toJSONString(getPullingOrder(organizeCode, assemblyLine));
}
// @Override
// public Map<String, Object> doSPSForEquipment() {
// return Collections.emptyMap();
// }
private boolean checkRule(MesPullingOrderPartInfo mesPullingOrderInfo, MesPartPullDetail mesPartPullDetail) {
String rule = mesPartPullDetail.getRuleValidation();
if (mesPullingOrderInfo.getScanValidationType() == MesExtEnumUtil.PART_PULL_DETAIL_SCAN_VALIDATION_TYPE.HOMEMADE_VALIDATE.getValue()) {
@ -378,4 +439,32 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService {
}
return partInfo;
}
private MesPullingOrderInfo getPullingOrder(String organizeCode, String assemblyLine){
//查询拉动单状态为已扫描=20的 拉动单
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_PULL_ORDER_TYPE.SPS_PULL.getValue(), "pullOrderType", seriesPackBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.JIS_PULL.getValue(), "pullOrderStatus", seriesPackBean);
seriesPackBean.setWhereAppend(seriesPackBean.getWhereAppend() + " order by modifyDatetime desc");
MesPullingOrderInfo mesPullingOrder = mesPullingOrderInfoRepository.getByProperty(seriesPackBean);
if (StringUtil.isEmpty(mesPullingOrder)) {
return null;
}
//更新主表状态 源系统为25配料完成 现在-【已发送设备-30】
DdlPackBean pullingOrderPackBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", pullingOrderPackBean);
DdlPreparedPack.getNumEqualPack(mesPullingOrder.getId(),"id", pullingOrderPackBean);
mesPullingOrderInfoRepository.updateByProperties(new String[]{"pullOrderStatus","modifyDatetime"},new Object[]{MesExtEnumUtil.PULL_ORDER_STATUS.SPS_PULL.getValue(),TimeTool.getNowTime(true)},pullingOrderPackBean);
//查询拉动组明细
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(mesPullingOrder.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(mesPullingOrder.getPullingOrderNo(), "pullingOrderNo", partPackBean);
List<MesPullingOrderPartInfo> pullingOrderPartInfos = mesPullingOrderPartInfoRepository.findByHqlWhere(partPackBean);
if (!org.apache.shiro.util.CollectionUtils.isEmpty(pullingOrderPartInfos)) {
mesPullingOrder.setPartList(pullingOrderPartInfos);
}
return mesPullingOrder;
}
}

@ -1,17 +1,13 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesPullingOrderInfoService;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.SpsInfo;
import cn.estsh.i3plus.pojo.base.util.StringUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo;
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;
import java.util.HashMap;
import java.util.Map;
/**
* @Description : soapUI http://10.193.30.22:8300/i3plus-pcn/mes-service-spsEqu?wsdl
@ -26,18 +22,15 @@ public class WebServiceServerSPS {
public static final Logger LOGGER = LoggerFactory.getLogger(WebServiceServerSPS.class);
@WebMethod(action = "SyncSPSForEquipmentService", operationName = "SyncSPSForEquipmentService")
public Map syncSPSForEquipment(@WebParam(name = "info") SpsInfo spsInfo) {
LOGGER.info("syncSPSForEquipment主数据:{}", spsInfo);
public MesPullingOrderInfo syncSPSForEquipment() {
MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService");
return bean.doSPSForEquipment100();
}
@WebMethod(action = "GetCurrentOrderJson", operationName = "GetCurrentOrderJson")
public String syncSPSForEquipmentJson() {
MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService");
if (StringUtil.isEmpty(spsInfo.getOrganizeCode())) {
Map<String,Object> resultMap = new HashMap();
resultMap.put("success", false);
String message = "SPS拉动数据已扫描数据为空请检查拉动单数据";
resultMap.put("message", message);
return resultMap;
}
return bean.doSPSForEquipment("", "", spsInfo.getOrganizeCode());
return bean.doSPSForEquipmentString100();
}
}

@ -0,0 +1,35 @@
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.webservice;
import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesPullingOrderInfoService;
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jws.WebMethod;
import javax.jws.WebService;
/**
* @Description : soapUI http://10.193.30.22:8300/i3plus-pcn/mes-service-spsEqu?wsdl
* @Reference :
* @Author : junsheng.li
* @CreateDate 2024/10/22 9:29
* @Modify:
**/
@WebService(targetNamespace = "http://tempuri.org/services/SyncSPSForEquipmentService")
public class WebServiceServerSPS200 {
public static final Logger LOGGER = LoggerFactory.getLogger(WebServiceServerSPS200.class);
@WebMethod(action = "GetCurrentOrder", operationName = "GetCurrentOrder")
public MesPullingOrderInfo syncSPSForEquipment() {
MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService");
return bean.doSPSForEquipment200();
}
@WebMethod(action = "GetCurrentOrderJson", operationName = "GetCurrentOrderJson")
public String syncSPSForEquipmentJson() {
MesPullingOrderInfoService bean = (MesPullingOrderInfoService) SpringContextsUtil.getBean("mesPullingOrderInfoService");
return bean.doSPSForEquipmentString200();
}
}

@ -8,6 +8,14 @@ package cn.estsh.i3plus.ext.mes.pcn.pojo.util;
* @Modify:
**/
public class MesPcnExtConstWords {
//SPS拉动
public static final String WU_HAN_SPS_CFG_CODE ="WU_HAN_SPS_CODE";
//产线100
public static final String WU_HAN_WORK_CENTER_CODE_100 ="WU_HAN_WORK_CENTER_CODE_100";
//产线200
public static final String WU_HAN_WORK_CENTER_CODE_200 ="WU_HAN_WORK_CENTER_CODE_200";
public static final String WU_HAN_ORGANIZE_CODE ="WU_HAN_ORGANIZE_CODE";
//-----------------COMMON--------------------------
//拼接00时:00分:00秒

Loading…
Cancel
Save