|
|
@ -9,13 +9,11 @@ import com.op.common.core.utils.DateUtils;
|
|
|
|
import com.op.common.core.utils.bean.BeanUtils;
|
|
|
|
import com.op.common.core.utils.bean.BeanUtils;
|
|
|
|
import com.op.common.core.utils.http.HttpUtils;
|
|
|
|
import com.op.common.core.utils.http.HttpUtils;
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
import com.op.mes.domain.BufferInfoParam;
|
|
|
|
import com.op.mes.domain.*;
|
|
|
|
import com.op.mes.domain.MesReportWork;
|
|
|
|
|
|
|
|
import com.op.mes.domain.MesShift;
|
|
|
|
|
|
|
|
import com.op.mes.domain.ProOrderWorkorder;
|
|
|
|
|
|
|
|
import com.op.mes.domain.buffer.JsonRootBean;
|
|
|
|
import com.op.mes.domain.buffer.JsonRootBean;
|
|
|
|
import com.op.mes.domain.dto.LGInfoDto;
|
|
|
|
import com.op.mes.domain.dto.LGInfoDto;
|
|
|
|
import com.op.mes.mapper.MesMapper;
|
|
|
|
import com.op.mes.mapper.MesMapper;
|
|
|
|
|
|
|
|
import com.op.mes.mapper.MesReportWorkConsumeMapper;
|
|
|
|
import com.op.mes.mapper.MesReportWorkMapper;
|
|
|
|
import com.op.mes.mapper.MesReportWorkMapper;
|
|
|
|
import com.op.mes.mapper.ProRfidProcessDetailMapper;
|
|
|
|
import com.op.mes.mapper.ProRfidProcessDetailMapper;
|
|
|
|
import com.op.mes.service.IWCSInterfaceService;
|
|
|
|
import com.op.mes.service.IWCSInterfaceService;
|
|
|
@ -28,6 +26,7 @@ import com.op.system.api.domain.dto.BoardDTO;
|
|
|
|
import com.op.system.api.domain.dto.WCSDTO;
|
|
|
|
import com.op.system.api.domain.dto.WCSDTO;
|
|
|
|
import com.op.system.api.domain.dto.WCSDataDTO;
|
|
|
|
import com.op.system.api.domain.dto.WCSDataDTO;
|
|
|
|
import com.op.system.api.domain.mes.ProRfidProcessDetail;
|
|
|
|
import com.op.system.api.domain.mes.ProRfidProcessDetail;
|
|
|
|
|
|
|
|
import com.op.system.api.domain.sap.SapCloseOrderQuery;
|
|
|
|
import com.op.system.api.domain.sap.SapRFW;
|
|
|
|
import com.op.system.api.domain.sap.SapRFW;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
@ -69,6 +68,9 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesReportWorkConsumeMapper mesReportWorkConsumeMapper;
|
|
|
|
|
|
|
|
|
|
|
|
/**下一工序机台集合获取
|
|
|
|
/**下一工序机台集合获取
|
|
|
|
* JSON
|
|
|
|
* JSON
|
|
|
|
* {
|
|
|
|
* {
|
|
|
@ -305,21 +307,27 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
ltgs.setConf_activity6(work.getSac6());
|
|
|
|
ltgs.setConf_activity6(work.getSac6());
|
|
|
|
sapRFW.setLt_gs(ltgs);
|
|
|
|
sapRFW.setLt_gs(ltgs);
|
|
|
|
List<SapRFW.lt_hw> lt_hwList =new ArrayList<>();
|
|
|
|
List<SapRFW.lt_hw> lt_hwList =new ArrayList<>();
|
|
|
|
SapRFW.lt_hw lthw = sapRFW.new lt_hw();//MES生产订单报工货物移动修改
|
|
|
|
logger.info(work.getWorkorderCodeSap()+"母sap工单报工:报工数量"+sapRFW.getGamng());
|
|
|
|
lthw.setEntry_qnt(work.getQuantityFeedback().toString());//TODO;
|
|
|
|
MesReportWorkConsume consumeqo = new MesReportWorkConsume();
|
|
|
|
lthw.setMaterial(work.getProcessCode());
|
|
|
|
consumeqo.setWorkorderCode(work.getWorkorderCode());
|
|
|
|
lt_hwList.add(lthw);
|
|
|
|
List<MesReportWorkConsume> consumes = mesReportWorkConsumeMapper.selectMesReportWorkConsumeList(consumeqo);
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(consumes)){
|
|
|
|
|
|
|
|
for(MesReportWorkConsume consume:consumes){
|
|
|
|
|
|
|
|
logger.info(work.getWorkorderCodeSap()+"母sap工单报工:【原料损耗】"+
|
|
|
|
|
|
|
|
consume.getMaterialCode()+"|"+consume.getQuantity());
|
|
|
|
|
|
|
|
SapRFW.lt_hw lthw = sapRFW.new lt_hw();//MES生产订单报工货物移动修改
|
|
|
|
|
|
|
|
lthw.setEntry_qnt(consume.getQuantity()+"");//数量
|
|
|
|
|
|
|
|
lthw.setMaterial(consume.getMaterialCode());//物料编码
|
|
|
|
|
|
|
|
lt_hwList.add(lthw);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
logger.info(work.getWorkorderCodeSap()+"母sap工单报工:工单"+work.getWorkorderCode()+"mes_report_work_consume没有数据");
|
|
|
|
|
|
|
|
return R.fail("mes_report_work_consume没有数据");
|
|
|
|
|
|
|
|
}
|
|
|
|
sapRFW.setLt_hwList(lt_hwList);
|
|
|
|
sapRFW.setLt_hwList(lt_hwList);
|
|
|
|
//添加调用sap日志
|
|
|
|
|
|
|
|
SysSapLog sysSapLog = new SysSapLog();
|
|
|
|
|
|
|
|
sysSapLog.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
|
|
|
sysSapLog.setMesssge(sapRFW.toString());
|
|
|
|
|
|
|
|
sysSapLog.setMethod("reportWork");
|
|
|
|
|
|
|
|
sysSapLog.setReqcode("请求");
|
|
|
|
|
|
|
|
sysSapLog.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
|
|
|
mesMapper.addSapLog(sysSapLog);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
R r = remoteSapService.sapRFWOrder(sapRFW);
|
|
|
|
R r = remoteSapService.sapRFWOrder(sapRFW);
|
|
|
|
|
|
|
|
logger.info(work.getWorkorderCodeSap()+"母sap工单报工结果:"+r.getCode()+","+r.getData()+","+r.getMsg());
|
|
|
|
//上传成功,更改mes_report_work状态
|
|
|
|
//上传成功,更改mes_report_work状态
|
|
|
|
if (r.getCode() == 200) {
|
|
|
|
if (r.getCode() == 200) {
|
|
|
|
work.setUploadStatus("1");
|
|
|
|
work.setUploadStatus("1");
|
|
|
@ -339,10 +347,16 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
logger.info("工单请求关闭:调用remoteSapService.sapCloseOrder,参数:"+work.getWorkorderCodeSap());
|
|
|
|
logger.info("工单请求关闭:调用remoteSapService.sapCloseOrder,参数:"+work.getWorkorderCodeSap());
|
|
|
|
//工单完成,关闭工单
|
|
|
|
//工单完成,关闭工单
|
|
|
|
List<String> sapWorkOrders = mesReportWorkMapper.getSapWorkOrder(work.getWorkorderCode());//根据belong_work_order找到所有要关闭的虚拟工单
|
|
|
|
List<String> sapWorkOrders = mesReportWorkMapper.getSapWorkOrder(work.getWorkorderCode());//根据belong_work_order找到所有要关闭的虚拟工单
|
|
|
|
for(String sapWorkOrder:sapWorkOrders){
|
|
|
|
//关闭母子订单//订单的订单编码
|
|
|
|
R r2= remoteSapService.sapCloseOrder(sapWorkOrder);
|
|
|
|
SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery();
|
|
|
|
logger.info("工单"+work.getWorkorderCode()+",sapworkorder:"+sapWorkOrder+",sap关闭"+r.getCode()+",返回信息:"+r.getMsg());
|
|
|
|
sapCloseOrderQuery.setLeadOrder(sapWorkOrders.get(0));
|
|
|
|
}
|
|
|
|
sapCloseOrderQuery.setOrder(sapWorkOrders.get(1));
|
|
|
|
|
|
|
|
R closeR = remoteSapService.sapCloseOrder(sapCloseOrderQuery);
|
|
|
|
|
|
|
|
logger.info(work.getWorkorderCodeSap()+"报工后关闭母子工单"+sapCloseOrderQuery.getLeadOrder()+":"+
|
|
|
|
|
|
|
|
sapCloseOrderQuery.getOrder()+":"+
|
|
|
|
|
|
|
|
closeR.getCode()+","+
|
|
|
|
|
|
|
|
closeR.getMsg()+","+
|
|
|
|
|
|
|
|
closeR.getData());
|
|
|
|
|
|
|
|
|
|
|
|
work.setStatus("w3");
|
|
|
|
work.setStatus("w3");
|
|
|
|
work.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
work.setUpdateTime(DateUtils.getNowDate());
|
|
|
|