|
|
@ -64,8 +64,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ProOrderMapper proOrderMapper;
|
|
|
|
private ProOrderMapper proOrderMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ProWorkorderProcessDetailMapper proWorkorderProcessDetailMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper;
|
|
|
|
private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
@ -140,6 +138,71 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
return workorderList;
|
|
|
|
return workorderList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
|
|
|
public List<ProOrderWorkorder> getWorkorderLevel0List(ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.getLevelWorkOrderList(proOrderWorkorder);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (ProOrderWorkorder workorder : workorderList) {
|
|
|
|
|
|
|
|
// List<ProOrderWorkorder> childrens = new ArrayList<>();
|
|
|
|
|
|
|
|
// ProOrderWorkorder child = new ProOrderWorkorder();
|
|
|
|
|
|
|
|
// child.setWorkorderCode("test");
|
|
|
|
|
|
|
|
// childrens.add(child);
|
|
|
|
|
|
|
|
// workorder.setChildren(childrens);
|
|
|
|
|
|
|
|
workorder.setHasChildren(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String prodLineName = "";
|
|
|
|
|
|
|
|
String equipCods = "'";
|
|
|
|
|
|
|
|
JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode());
|
|
|
|
|
|
|
|
for (int c = 0; c < codeArray.size(); c++) {
|
|
|
|
|
|
|
|
equipCods += codeArray.getJSONArray(c).getString(1) + "','";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
|
|
|
|
|
|
|
|
for (int c = 0; c < codeArray.size(); c++) {
|
|
|
|
|
|
|
|
String equipCode = codeArray.getJSONArray(c).getString(1);
|
|
|
|
|
|
|
|
CascaderDTO eInfo = equipMap.get(equipCode);
|
|
|
|
|
|
|
|
if (eInfo != null) {
|
|
|
|
|
|
|
|
prodLineName += eInfo.getLabel() + ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
workorder.setProdLineName(prodLineName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 通过工艺编码code查询出机型名称
|
|
|
|
|
|
|
|
workorder.setRouteName(proOrderWorkorderMapper.selectRouteNameByRouteCode(workorder.getRouteCode()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return workorderList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
|
|
|
public List<ProOrderWorkorder> getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.getLevelWorkOrderList(proOrderWorkorder);
|
|
|
|
|
|
|
|
for (ProOrderWorkorder workorder : workorderList) {
|
|
|
|
|
|
|
|
String prodLineName = "";
|
|
|
|
|
|
|
|
String equipCods = "'";
|
|
|
|
|
|
|
|
JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode());
|
|
|
|
|
|
|
|
for (int c = 0; c < codeArray.size(); c++) {
|
|
|
|
|
|
|
|
equipCods += codeArray.getJSONArray(c).getString(1) + "','";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, CascaderDTO> equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典
|
|
|
|
|
|
|
|
for (int c = 0; c < codeArray.size(); c++) {
|
|
|
|
|
|
|
|
String equipCode = codeArray.getJSONArray(c).getString(1);
|
|
|
|
|
|
|
|
CascaderDTO eInfo = equipMap.get(equipCode);
|
|
|
|
|
|
|
|
if (eInfo != null) {
|
|
|
|
|
|
|
|
prodLineName += eInfo.getLabel() + ",";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
workorder.setProdLineName(prodLineName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 通过工艺编码code查询出机型名称
|
|
|
|
|
|
|
|
workorder.setRouteName(proOrderWorkorderMapper.selectRouteNameByRouteCode(workorder.getRouteCode()));
|
|
|
|
|
|
|
|
workorder.setHasChildren(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return workorderList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 新增生产工单
|
|
|
|
* 新增生产工单
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -290,26 +353,30 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
wids.add(whiteOrder.getWorkorderId());
|
|
|
|
wids.add(whiteOrder.getWorkorderId());
|
|
|
|
wcodes.add(whiteOrder.getWorkorderCode());
|
|
|
|
wcodes.add(whiteOrder.getWorkorderCode());
|
|
|
|
ordercodes.add(whiteOrder.getOrderCode());
|
|
|
|
ordercodes.add(whiteOrder.getOrderCode());
|
|
|
|
Boolean isTop = true;
|
|
|
|
Boolean isNotTop = true;
|
|
|
|
//成品的母工单//查上一级工单
|
|
|
|
//成品的母工单//查下一级工单
|
|
|
|
while (isTop) {
|
|
|
|
while (isNotTop) {
|
|
|
|
//查上一级工单
|
|
|
|
if(!"0".equals(whiteOrder.getParentOrder())){
|
|
|
|
whiteOrder.setWorkorderCode(whiteOrder.getParentOrder());
|
|
|
|
//查上一级工单
|
|
|
|
ProOrderWorkorder pWorkOrder = proOrderWorkorderMapper.getPWorkOrder(whiteOrder);
|
|
|
|
whiteOrder.setWorkorderCode(whiteOrder.getParentOrder());
|
|
|
|
if (pWorkOrder != null) {
|
|
|
|
ProOrderWorkorder sWorkOrder = proOrderWorkorderMapper.getSonWorkOrder(whiteOrder);
|
|
|
|
wids.add(pWorkOrder.getWorkorderId());
|
|
|
|
if (sWorkOrder != null) {
|
|
|
|
wcodes.add(pWorkOrder.getWorkorderCode());
|
|
|
|
wids.add(sWorkOrder.getWorkorderId());
|
|
|
|
ordercodes.add(pWorkOrder.getOrderCode());
|
|
|
|
wcodes.add(sWorkOrder.getWorkorderCode());
|
|
|
|
}
|
|
|
|
ordercodes.add(sWorkOrder.getOrderCode());
|
|
|
|
if ("0".equals(pWorkOrder.getParentOrder())) {
|
|
|
|
}
|
|
|
|
BeanUtils.copyProperties(pWorkOrder, whiteOrder);
|
|
|
|
if ("0".equals(sWorkOrder.getParentOrder())) {
|
|
|
|
isTop = false;
|
|
|
|
BeanUtils.copyProperties(sWorkOrder, whiteOrder);
|
|
|
|
|
|
|
|
isNotTop = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
isNotTop = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//顺序母子
|
|
|
|
//顺序子母->母子
|
|
|
|
Collections.reverse(wids);
|
|
|
|
// Collections.reverse(wids);
|
|
|
|
Collections.reverse(wcodes);
|
|
|
|
// Collections.reverse(wcodes);
|
|
|
|
Collections.reverse(ordercodes);
|
|
|
|
// Collections.reverse(ordercodes);
|
|
|
|
|
|
|
|
|
|
|
|
sapList = new ArrayList<>();
|
|
|
|
sapList = new ArrayList<>();
|
|
|
|
SapCreateOrder sap = new SapCreateOrder();
|
|
|
|
SapCreateOrder sap = new SapCreateOrder();
|
|
|
@ -356,11 +423,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
|
|
|
|
|
|
|
//关闭母子订单//订单的订单编码(关闭订单暂时隐藏)
|
|
|
|
//关闭母子订单//订单的订单编码(关闭订单暂时隐藏)
|
|
|
|
SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery();
|
|
|
|
SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery();
|
|
|
|
sapCloseOrderQuery.setLeadOrder(ordercodes.get(0));
|
|
|
|
sapCloseOrderQuery.setOrderCodes(ordercodes);
|
|
|
|
sapCloseOrderQuery.setOrder(ordercodes.get(1));
|
|
|
|
|
|
|
|
R closeR= remoteSapService.sapCloseOrder(sapCloseOrderQuery);
|
|
|
|
R closeR= remoteSapService.sapCloseOrder(sapCloseOrderQuery);
|
|
|
|
logger.info(whiteOrder.getWorkorderCode()+"下发工单后关闭母订单"+sapCloseOrderQuery.getLeadOrder()+":"+
|
|
|
|
logger.info(whiteOrder.getWorkorderCode()+"下发工单后关闭老订单"+
|
|
|
|
sapCloseOrderQuery.getOrder()+":"+
|
|
|
|
JSONObject.toJSONString(sapCloseOrderQuery)+
|
|
|
|
closeR.getCode()+","+
|
|
|
|
closeR.getCode()+","+
|
|
|
|
closeR.getMsg()+","+
|
|
|
|
closeR.getMsg()+","+
|
|
|
|
closeR.getData());
|
|
|
|
closeR.getData());
|
|
|
@ -488,16 +554,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
|
|
|
|
|
|
|
return success(orderAndWork);
|
|
|
|
return success(orderAndWork);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
boolean run = true;
|
|
|
|
|
|
|
|
while (run) {
|
|
|
|
|
|
|
|
ProOrderWorkorder fatherWorkOrder = proOrderWorkorderMapper.selectWorkOrderByCode(proOrderWorkorder.getParentOrder());
|
|
|
|
|
|
|
|
// 如果存在父工单
|
|
|
|
|
|
|
|
if (fatherWorkOrder != null) {
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(fatherWorkOrder, proOrderWorkorder);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
run = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 通过母订单id查询母订单详情
|
|
|
|
// 通过母订单id查询母订单详情
|
|
|
|
ProOrder proOrder = proOrderMapper.selectProOrderById(proOrderWorkorder.getOrderId());
|
|
|
|
ProOrder proOrder = proOrderMapper.selectProOrderById(proOrderWorkorder.getOrderId());
|
|
|
|
if (proOrder != null) {
|
|
|
|
if (proOrder != null) {
|
|
|
@ -894,7 +950,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 通过子工单code查询并返回所有级联工单
|
|
|
|
* 通过母工单code查询并返回所有级联工单
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param code
|
|
|
|
* @param code
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
@ -905,34 +961,24 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
// 创建返回工单列表
|
|
|
|
// 创建返回工单列表
|
|
|
|
List<ProOrderWorkorder> proOrderWorkorderList = new ArrayList<ProOrderWorkorder>();
|
|
|
|
List<ProOrderWorkorder> proOrderWorkorderList = new ArrayList<ProOrderWorkorder>();
|
|
|
|
// 查询该工单信息
|
|
|
|
// 查询该工单信息
|
|
|
|
ProOrderWorkorder proOrderWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code);
|
|
|
|
ProOrderWorkorder pWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code);
|
|
|
|
formatProOrderWorkorder(proOrderWorkorder);
|
|
|
|
formatProOrderWorkorder(pWorkorder);
|
|
|
|
proOrderWorkorderList.add(proOrderWorkorder);
|
|
|
|
proOrderWorkorderList.add(pWorkorder);
|
|
|
|
boolean flag = true;
|
|
|
|
boolean flag = true;
|
|
|
|
|
|
|
|
String parentOrder = pWorkorder.getWorkorderCode();
|
|
|
|
// 临时存放parentCode
|
|
|
|
//母查子遍历
|
|
|
|
StringBuilder tempCode = new StringBuilder();
|
|
|
|
|
|
|
|
tempCode.append(proOrderWorkorder.getParentOrder());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (flag) {
|
|
|
|
while (flag) {
|
|
|
|
ProOrderWorkorder workorder = proOrderWorkorderMapper.selectWorkOrderByCode(tempCode.toString());
|
|
|
|
ProOrderWorkorder workorder = proOrderWorkorderMapper.selectSonWorkOrder(parentOrder);
|
|
|
|
if (workorder != null) {
|
|
|
|
if (workorder != null) {
|
|
|
|
formatProOrderWorkorder(workorder);
|
|
|
|
formatProOrderWorkorder(workorder);
|
|
|
|
proOrderWorkorderList.add(workorder);
|
|
|
|
proOrderWorkorderList.add(workorder);
|
|
|
|
tempCode.setLength(0);
|
|
|
|
parentOrder = workorder.getWorkorderCode();
|
|
|
|
tempCode.append(workorder.getParentOrder());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
flag = false;
|
|
|
|
flag = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 反转list
|
|
|
|
return success(proOrderWorkorderList);
|
|
|
|
List<ProOrderWorkorder> reversalWorkOrderList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (int i = proOrderWorkorderList.size() - 1; i >= 0; i--) {
|
|
|
|
|
|
|
|
reversalWorkOrderList.add(proOrderWorkorderList.get(i));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return success(reversalWorkOrderList);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -1033,6 +1079,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
proOrderWorkorder.setShiftDesc(shiftDesc);
|
|
|
|
proOrderWorkorder.setShiftDesc(shiftDesc);
|
|
|
|
proOrderWorkorder.setBatchCodeList(batchCodes);
|
|
|
|
proOrderWorkorder.setBatchCodeList(batchCodes);
|
|
|
|
proOrderWorkorder.setBatchNumList(batchNums);
|
|
|
|
proOrderWorkorder.setBatchNumList(batchNums);
|
|
|
|
|
|
|
|
proOrderWorkorder.setHasChildren(null);//会直接导致树结构不展示
|
|
|
|
// 通过母工单workorder_id查询子工单
|
|
|
|
// 通过母工单workorder_id查询子工单
|
|
|
|
List<ProOrderWorkorder> childWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorder.getWorkorderCode());
|
|
|
|
List<ProOrderWorkorder> childWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorder.getWorkorderCode());
|
|
|
|
if (!childWorkorders.isEmpty()) {
|
|
|
|
if (!childWorkorders.isEmpty()) {
|
|
|
|