数据源规则修改

highway
zhaoxiaolin 1 year ago
parent 03efbd1db7
commit 1879d18ba9

@ -25,6 +25,24 @@ public class WCSDTO {
private String stationNo;
private String rfidNo;
private String spec;
private String productionState;
private List<WCSDataDTO> stationNos;
public List<WCSDataDTO> getStationNos() {
return stationNos;
}
public void setStationNos(List<WCSDataDTO> stationNos) {
this.stationNos = stationNos;
}
public String getProductionState() {
return productionState;
}
public void setProductionState(String productionState) {
this.productionState = productionState;
}
public String getSpec() {
return spec;

@ -11,6 +11,16 @@ public class WCSDataDTO {
private List<WCSDataItemsDTO> unLoadItems;
private String stationNo;
public String getStationNo() {
return stationNo;
}
public void setStationNo(String stationNo) {
this.stationNo = stationNo;
}
public String getSku() {
return sku;
}

@ -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();
}
}

@ -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

@ -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);
}

@ -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<WCSDataItemsDTO> 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" //对应的湿料的物料编码
* }
* <p>
* 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编号,条码能够区分是白坯料框还是筛盘车
* }
* <p>
* JSON
* {
* <p>
* "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<WCSDataDTO> stationNos = new ArrayList<>();
WCSDataDTO wCSDataDTO = null;
for(String machineCode:machineCodes){
wCSDataDTO = new WCSDataDTO();
if(StringUtils.isNotBlank(machineCode)){
wCSDataDTO.setStationNo(machineCode);
}
}
}
return dto;
}
}

@ -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());
}
}

Loading…
Cancel
Save