From 1879d18ba96913457139c3a15779ac4a46ccb489 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Tue, 22 Aug 2023 16:36:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E8=A7=84=E5=88=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/domain/dto/WCSDTO.java | 18 ++ .../op/system/api/domain/dto/WCSDataDTO.java | 10 + op-common/op-common-log/op-common-log.iml | 2 +- .../src/main/java/com/op/job/task/RyTask.java | 7 + .../controller/WCSInterfaceController.java | 160 ++++++++-------- .../op/mes/service/IWCSInterfaceService.java | 14 +- .../service/impl/IWCInterfaceServiceImpl.java | 173 ++++-------------- .../impl/SysDatasourceServiceImpl.java | 2 - 8 files changed, 158 insertions(+), 228 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java index 5460fc0a..5ee20623 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDTO.java @@ -25,6 +25,24 @@ public class WCSDTO { private String stationNo; private String rfidNo; private String spec; + private String productionState; + private List stationNos; + + public List getStationNos() { + return stationNos; + } + + public void setStationNos(List stationNos) { + this.stationNos = stationNos; + } + + public String getProductionState() { + return productionState; + } + + public void setProductionState(String productionState) { + this.productionState = productionState; + } public String getSpec() { return spec; diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java index e2d85219..c6f4cc41 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/dto/WCSDataDTO.java @@ -11,6 +11,16 @@ public class WCSDataDTO { private List unLoadItems; + private String stationNo; + + public String getStationNo() { + return stationNo; + } + + public void setStationNo(String stationNo) { + this.stationNo = stationNo; + } + public String getSku() { return sku; } diff --git a/op-common/op-common-log/op-common-log.iml b/op-common/op-common-log/op-common-log.iml index 152684b9..3df02a46 100644 --- a/op-common/op-common-log/op-common-log.iml +++ b/op-common/op-common-log/op-common-log.iml @@ -125,4 +125,4 @@ - + \ No newline at end of file diff --git a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java index e97e5458..b6f841f3 100644 --- a/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java +++ b/op-modules/op-job/src/main/java/com/op/job/task/RyTask.java @@ -50,5 +50,12 @@ public class RyTask { System.out.println("++同步领料单+开始++getMesPrepareTask+++++"); remoteMesService.getMesPrepare(); } + /**每天1点执行 + * 0 0 1 * * ? + */ + public void getRouteTask(){ + System.out.println("++同步工艺+开始++getRouteTask+++++"); + //remoteSapService.getRouteTask(); + } } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java index da12ace2..383b0e2c 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/WCSInterfaceController.java @@ -23,86 +23,86 @@ public class WCSInterfaceController extends BaseController { @Autowired private IWCSInterfaceService WCInterfaceService; - /** - * 接料请求 - * @param - * @return - */ - @Log(title = "请求接料", businessType = BusinessType.WCS_requestMaterialLoadNo) - @PostMapping("/requestMaterialLoadNo") - public WCSDTO requestMaterialLoadNo(@RequestBody WCSDTO wcsdto) { - if(StringUtils.isBlank(wcsdto.getFactory())){ - wcsdto.setCode("1"); - wcsdto.setMessage("factory is not null"); - return wcsdto; - } - return WCInterfaceService.requestMaterialLoadNo(wcsdto); - } - - /** - * 接料完成(用不上) - * @param - * @return - */ - @Log(title = "接料完成", businessType = BusinessType.WCS) - @PostMapping("/loadMaterialCompleted") - public WCSDTO loadMaterialCompleted(@RequestBody WCSDTO wcsdto) { - if(StringUtils.isBlank(wcsdto.getFactory())){ - wcsdto.setCode("1"); - wcsdto.setMessage("factory is not null"); - return wcsdto; - } - return WCInterfaceService.loadMaterialCompleted(wcsdto); - } - - /** - * RGV 请求送料 - * @param - * @return - */ - //TODO; - @Log(title = "请求送料", businessType = BusinessType.WCS) - @PostMapping("/requestMaterialUnLoadNo") - public WCSDTO requestMaterialUnLoadNo(@RequestBody WCSDTO wcsdto) { - if(StringUtils.isBlank(wcsdto.getFactory())){ - wcsdto.setCode("1"); - wcsdto.setMessage("factory is not null"); - return wcsdto; - } - return WCInterfaceService.requestMaterialUnLoadNo(wcsdto); - } - /** - * RGV 送料完成 - * @param - * @return - */ - //TODO; - @Log(title = "送料完成", businessType = BusinessType.WCS) - @PostMapping("/unLoadMaterialCompleted") - public WCSDTO unLoadMaterialCompleted(@RequestBody WCSDTO wcsdto) { - if(StringUtils.isBlank(wcsdto.getFactory())){ - wcsdto.setCode("1"); - wcsdto.setMessage("factory is not null"); - return wcsdto; - } - return WCInterfaceService.requestMaterialUnLoadNo(wcsdto); - } - /** - * 生产机台到位信号 - * •空筛盘车到达成型机吊筛处,筛盘车到达烘房、筛盘车到达收坯吊筛处 - * @param - * @return - */ - @Log(title = "生产机台到位信号", businessType = BusinessType.WCS) - @PostMapping("/stationArrive") - public WCSDTO stationArrive(@RequestBody WCSDTO wcsdto) { - if(StringUtils.isBlank(wcsdto.getFactory())){ - wcsdto.setCode("1"); - wcsdto.setMessage("factory is not null"); - return wcsdto; - } - return WCInterfaceService.stationArrive(wcsdto); - } +// /** +// * 接料请求 +// * @param +// * @return +// */ +// @Log(title = "请求接料", businessType = BusinessType.WCS_requestMaterialLoadNo) +// @PostMapping("/requestMaterialLoadNo") +// public WCSDTO requestMaterialLoadNo(@RequestBody WCSDTO wcsdto) { +// if(StringUtils.isBlank(wcsdto.getFactory())){ +// wcsdto.setCode("1"); +// wcsdto.setMessage("factory is not null"); +// return wcsdto; +// } +// return WCInterfaceService.requestMaterialLoadNo(wcsdto); +// } +// +// /** +// * 接料完成(用不上) +// * @param +// * @return +// */ +// @Log(title = "接料完成", businessType = BusinessType.WCS) +// @PostMapping("/loadMaterialCompleted") +// public WCSDTO loadMaterialCompleted(@RequestBody WCSDTO wcsdto) { +// if(StringUtils.isBlank(wcsdto.getFactory())){ +// wcsdto.setCode("1"); +// wcsdto.setMessage("factory is not null"); +// return wcsdto; +// } +// return WCInterfaceService.loadMaterialCompleted(wcsdto); +// } +// +// /** +// * RGV 请求送料 +// * @param +// * @return +// */ +// //TODO; +// @Log(title = "请求送料", businessType = BusinessType.WCS) +// @PostMapping("/requestMaterialUnLoadNo") +// public WCSDTO requestMaterialUnLoadNo(@RequestBody WCSDTO wcsdto) { +// if(StringUtils.isBlank(wcsdto.getFactory())){ +// wcsdto.setCode("1"); +// wcsdto.setMessage("factory is not null"); +// return wcsdto; +// } +// return WCInterfaceService.requestMaterialUnLoadNo(wcsdto); +// } +// /** +// * RGV 送料完成 +// * @param +// * @return +// */ +// //TODO; +// @Log(title = "送料完成", businessType = BusinessType.WCS) +// @PostMapping("/unLoadMaterialCompleted") +// public WCSDTO unLoadMaterialCompleted(@RequestBody WCSDTO wcsdto) { +// if(StringUtils.isBlank(wcsdto.getFactory())){ +// wcsdto.setCode("1"); +// wcsdto.setMessage("factory is not null"); +// return wcsdto; +// } +// return WCInterfaceService.requestMaterialUnLoadNo(wcsdto); +// } +// /** +// * 生产机台到位信号 +// * •空筛盘车到达成型机吊筛处,筛盘车到达烘房、筛盘车到达收坯吊筛处 +// * @param +// * @return +// */ +// @Log(title = "生产机台到位信号", businessType = BusinessType.WCS) +// @PostMapping("/stationArrive") +// public WCSDTO stationArrive(@RequestBody WCSDTO wcsdto) { +// if(StringUtils.isBlank(wcsdto.getFactory())){ +// wcsdto.setCode("1"); +// wcsdto.setMessage("factory is not null"); +// return wcsdto; +// } +// return WCInterfaceService.stationArrive(wcsdto); +// } /** * 下一工序机台集合获取 * •接口描述:成型机码垛完、暂存区、WCS 请求 MES 获取目的地集合 diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java index 2a762d33..d23feb76 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IWCSInterfaceService.java @@ -13,13 +13,13 @@ import java.util.List; */ public interface IWCSInterfaceService { - WCSDTO requestMaterialLoadNo(WCSDTO wcsdto); - - WCSDTO loadMaterialCompleted(WCSDTO wcsdto); - - WCSDTO requestMaterialUnLoadNo(WCSDTO wcsdto); - - WCSDTO stationArrive(WCSDTO wcsdto); +// WCSDTO requestMaterialLoadNo(WCSDTO wcsdto); +// +// WCSDTO loadMaterialCompleted(WCSDTO wcsdto); +// +// WCSDTO requestMaterialUnLoadNo(WCSDTO wcsdto); +// +// WCSDTO stationArrive(WCSDTO wcsdto); WCSDTO requestDestinationStations(WCSDTO wcsdto); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java index 74e9eb42..c5fe1461 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -8,13 +8,18 @@ import com.op.common.security.utils.SecurityUtils; import com.op.mes.domain.MesStationArrive; import com.op.mes.mapper.MesMapper; import com.op.mes.mapper.MesStationArriveMapper; +import com.op.mes.mapper.ProRfidProcessDetailMapper; import com.op.mes.service.IWCSInterfaceService; import com.op.system.api.domain.dto.WCSDTO; +import com.op.system.api.domain.dto.WCSDataDTO; import com.op.system.api.domain.dto.WCSDataItemsDTO; +import com.op.system.api.domain.mes.ProRfidProcessDetail; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -29,148 +34,17 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { @Autowired private MesMapper mesMapper; @Autowired + private ProRfidProcessDetailMapper proRfidProcessDetailMapper; + @Autowired private MesStationArriveMapper mesStationArriveMapper; - /** - * RGV请求接料 - * { - * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID - * "reqTime": "2023-06-30 21:24:04", //请求时间 - * "sku": "sku01" //物料编码 - * “factory”:"工厂编码" - * } - * 返回 - * { - * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求编号 - * "code": 0, //返回代码 - * "message": "OK", //返回信息 - * "loadItems": [ - * { - * "loadNo": "A1" //上料机台,上料罐 - * }, - * { - * "loadNo": "A2" //上料机台,上料罐 - * } - * ] - * } - * - * @param wcsdto - * @return - */ - @Override - public WCSDTO requestMaterialLoadNo(WCSDTO wcsdto) { - DynamicDataSourceContextHolder.push(wcsdto.getFactory()); - //获取湿料计划 - List loadItems = mesMapper.getWetPlanDetail(wcsdto); - WCSDTO dto = new WCSDTO(); - dto.setLoadItems(loadItems); - dto.setReqCode(wcsdto.getReqCode()); - dto.setCode("0"); - dto.setMessage("OK"); - return dto; - } - - /** - * RGV 接料完成(我不要) - * { - * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0",//请求ID - * "reqTime": "2023-06-30 21:24:04",//请求时间 - * "loadNo": "A1"//接料 - * "factory":工厂编码 - * } - * 返回 - * { - * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0",//请求ID - * "code": 0,//返回代码 - * "message": "OK"//返回信息 - * } - */ - @Override - public WCSDTO loadMaterialCompleted(WCSDTO wcsdto) { - return null; - } - - /** - * RGV 请求送料 - * { - * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID - * "reqTime": "2023-06-30 21:24:04", //请求时间 - * "sku": "sku01" //对应的湿料的物料编码 - * } - *

- * JSON - * { - * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0",//请求ID - * "code": 0,//返回代码 - * "message": "OK",//返回信息 - * "unLoadItems": [ - * { - * "unloadNo": "B1"//送料机台,成型机 - * }, - * { - * "unloadNo": "B2"//送料机台,成型机 - * } - * ] - * } - **/ - @Override - public WCSDTO requestMaterialUnLoadNo(WCSDTO wcsdto) { - //TODO; - return null; - } - - /** - * 生产机台到位信号 - * JSON - * { - * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID - * "reqTime": "2023-06-30 21:24:04", //请求时间 - * "stationType": "1", //机台类型: 1.成型机、2.烘房、3收坯机、4.收坯码垛 - * "stationNo": "S1", //机台编号 - * "rfidNo": "r12345" //rfid编号,条码能够区分是白坯料框还是筛盘车 - * } - *

- * JSON - * { - *

- * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID - * "code": 0, //返回代码 - * "message": "OK", //返回信息 - * "sku": "sku01", //托盘到位信号 - * "spec": "150", //规格 - * } - * - * @param wcsdto - * @return - */ - @Override - public WCSDTO stationArrive(WCSDTO wcsdto) { - DynamicDataSourceContextHolder.push(wcsdto.getFactory()); - - MesStationArrive sa = new MesStationArrive(); - BeanUtils.copyBeanProp(sa, wcsdto); - sa.setRecordId(IdUtils.fastSimpleUUID()); - sa.setCreateTime(DateUtils.getNowDate()); - sa.setCreateBy(SecurityUtils.getUsername()); - sa.setStatus("0");//初始到达 - //保存筛盘车到达记录//mes_station_arrive(设备跟机台绑定) - mesStationArriveMapper.insertMesStationArrive(sa); - - WCSDTO dto = new WCSDTO(); - BeanUtils.copyBeanProp(dto, wcsdto); - dto.setSku("");//TODO; - dto.setSpec("");//TODO; - dto.setCode("0"); - dto.setMessage("OK"); - return dto; - } - /**下一工序机台集合获取 * JSON * { * "reqCode": "eb7f8e9f-d1e8-499e-9bcb-e72d3ac195b0", //请求ID * "reqTime": "2023-06-30 21:24:04", //请求时间, * "rfidNo": "r12345" //rfid编号 + * "factory" * } * * JSON @@ -202,10 +76,33 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { */ @Override public WCSDTO requestDestinationStations(WCSDTO wcsdto) { - DynamicDataSourceContextHolder.push(wcsdto.getFactory()); - //mes_station_arrive(设备跟机台绑定) - //MesStationArrive msa = mesStationArriveMapper.getInfoByRecordId(wcsdto.getRfidNo()); - return null; + DynamicDataSourceContextHolder.push("ds_"+wcsdto.getFactory()); + WCSDTO dto = new WCSDTO();//最终结果 + BeanUtils.copyBeanProp(dto,wcsdto); + //根据rfid跟工单绑定,成型机跟工单绑定,获取对应工艺。 + ProRfidProcessDetail rfidInfo = proRfidProcessDetailMapper.getRfidInfo(wcsdto.getRfidNo()); + //获取设备类型 + if(rfidInfo!=null && StringUtils.isNotBlank(rfidInfo.getMachineCode())){ + String[] machineCodes = rfidInfo.getMachineCode().split(","); + String stationType = proRfidProcessDetailMapper.getStationType(machineCodes[0]); + if(StringUtils.isNotBlank(stationType)){ + dto.setStationType(stationType); + } + dto.setSku(rfidInfo.getProductCode()); + dto.setSpec(rfidInfo.getProductModel()); + dto.setProductionState(rfidInfo.getNowProcessId()); + List stationNos = new ArrayList<>(); + WCSDataDTO wCSDataDTO = null; + for(String machineCode:machineCodes){ + wCSDataDTO = new WCSDataDTO(); + if(StringUtils.isNotBlank(machineCode)){ + wCSDataDTO.setStationNo(machineCode); + } + + } + } + + return dto; } } diff --git a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysDatasourceServiceImpl.java b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysDatasourceServiceImpl.java index 2152e978..f200003d 100644 --- a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysDatasourceServiceImpl.java +++ b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysDatasourceServiceImpl.java @@ -83,8 +83,6 @@ public class SysDatasourceServiceImpl implements ISysDatasourceService { } if(sysDatasource.getDeptId()!=null){ if(StringUtils.isNotEmpty(sysDatasource.getSystemType())){ - sysDatasource.setPoolName(poolNamePrev+"_"+sysDatasource.getSystemType()+"_"+sysDatasource.getDeptId()); - }else{ sysDatasource.setPoolName(poolNamePrev+"_"+sysDatasource.getDeptId()); } }