|
|
|
@ -201,7 +201,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<SapCreateOrder> sapList = new ArrayList<>();//回传给sap的工单
|
|
|
|
|
List<SapCreateOrder> sapList = null;//回传给sap的工单
|
|
|
|
|
//如果是白坯生成备料单
|
|
|
|
|
for(String workorderId:workorderIds){
|
|
|
|
|
ProOrderWorkorder whiteOrder = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(workorderId);
|
|
|
|
@ -233,6 +233,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
details.add(detail);
|
|
|
|
|
proOrderWorkorderMapper.createPrepareDetails(details);
|
|
|
|
|
}else if(whiteOrder!=null){//成品的母工单回传sap
|
|
|
|
|
sapList = new ArrayList<>();
|
|
|
|
|
SapCreateOrder sap = new SapCreateOrder();
|
|
|
|
|
sap.setWerks(whiteOrder.getFactoryCode());//工厂编码
|
|
|
|
|
sap.setAufpar(whiteOrder.getProdType());//订单类型
|
|
|
|
@ -241,16 +242,41 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
sap.setDates(DateUtils.parseDateToStr("yyyy-MM-dd",whiteOrder.getProductDate()));//开始时间
|
|
|
|
|
sap.setDatee(DateUtils.parseDateToStr("yyyy-MM-dd",whiteOrder.getProductDate()));//完成时间
|
|
|
|
|
sapList.add(sap);
|
|
|
|
|
R<List<String>> r = remoteSapService.SapCreateOrder(sapList);
|
|
|
|
|
logger.info("sap工单回传:"+r.getMsg());
|
|
|
|
|
if(500==r.getCode()){
|
|
|
|
|
logger.error("sap工单回传:"+r.getMsg());
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
List<String> returnCodes = r.getData();
|
|
|
|
|
if(!CollectionUtils.isEmpty(returnCodes)){
|
|
|
|
|
for(String sapCode:returnCodes){
|
|
|
|
|
ProOrderWorkorder oworkSap = new ProOrderWorkorder();
|
|
|
|
|
oworkSap.setWorkorderCodeSap(sapCode);
|
|
|
|
|
oworkSap.setWorkorderId(workorderId);//工单编码
|
|
|
|
|
oworkSap.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
/**pro_order_workorder**/
|
|
|
|
|
proOrderWorkorderMapper.updateWorkOrderCodeSap(oworkSap);
|
|
|
|
|
|
|
|
|
|
ProOrder order = this.getTopOrder(workorderId);
|
|
|
|
|
ProOrderWorkorder oworkSapParent = new ProOrderWorkorder();
|
|
|
|
|
oworkSapParent.setWorkorderCodeSap(sapCode);
|
|
|
|
|
oworkSapParent.setWorkorderId(order.getOrderCode());//母工单编码
|
|
|
|
|
oworkSapParent.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
proOrderWorkorderMapper.updateWorkOrderCodeSap(oworkSapParent);
|
|
|
|
|
|
|
|
|
|
logger.info("sap工单回传sap虚拟工单号:"+sapCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!CollectionUtils.isEmpty(sapList)){
|
|
|
|
|
R r = remoteSapService.SapCreateOrder(sapList);
|
|
|
|
|
logger.info("sap工单回传:"+r.getMsg());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//下达工单
|
|
|
|
|
return proOrderWorkorderMapper.downProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
|
//return proOrderWorkorderMapper.downProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// //获取最低级材料
|
|
|
|
|
// private void getLastChildren(List<BaseBomComponentDTO> all, List<BaseBomComponentDTO> allChildren , BaseBomComponentDTO bc) {
|
|
|
|
|
// List<BaseBomComponentDTO> cList = all.stream().filter(item -> item.getCumc().equals(bc.getComponent()))
|
|
|
|
@ -290,14 +316,16 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
//
|
|
|
|
|
// return bomdtos;
|
|
|
|
|
// }
|
|
|
|
|
// //根据工单子单获取最顶级订单的母单
|
|
|
|
|
// private ProOrder getTopOrder(String workorderId){
|
|
|
|
|
// ProOrder topOrder = proOrderWorkorderMapper.getOrderCodeById(workorderId);
|
|
|
|
|
// while(!"0".equals(topOrder.getParentOrder())&& com.op.common.core.utils.StringUtils.isNotEmpty(topOrder.getParentOrder())){
|
|
|
|
|
// topOrder = proOrderWorkorderMapper.getOrderCodeBySonCode(topOrder.getParentOrder());
|
|
|
|
|
// }
|
|
|
|
|
// return topOrder;
|
|
|
|
|
// }
|
|
|
|
|
//根据工单子单编码获取最顶级订单的母单
|
|
|
|
|
private ProOrder getTopOrder(String workorderId){
|
|
|
|
|
//pro_order_workorder
|
|
|
|
|
ProOrder topOrder = proOrderWorkorderMapper.getOrderCodeById(workorderId);
|
|
|
|
|
while(!"0".equals(topOrder.getParentOrder())&& StringUtils.isNotEmpty(topOrder.getParentOrder())){
|
|
|
|
|
//pro_order_workorder
|
|
|
|
|
topOrder = proOrderWorkorderMapper.getOrderCodeById(topOrder.getParentOrder());
|
|
|
|
|
}
|
|
|
|
|
return topOrder;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|