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