|
|
@ -1,6 +1,5 @@
|
|
|
|
package com.op.plan.service.impl;
|
|
|
|
package com.op.plan.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -17,15 +16,12 @@ import com.op.plan.domain.*;
|
|
|
|
import com.op.plan.domain.dto.ProOrderDTO;
|
|
|
|
import com.op.plan.domain.dto.ProOrderDTO;
|
|
|
|
import com.op.plan.domain.dto.SplitOrderDTO;
|
|
|
|
import com.op.plan.domain.dto.SplitOrderDTO;
|
|
|
|
import com.op.plan.domain.vo.LineAndShiftVo;
|
|
|
|
import com.op.plan.domain.vo.LineAndShiftVo;
|
|
|
|
import com.op.plan.mapper.ProOrderWorkorderBatchMapper;
|
|
|
|
import com.op.plan.mapper.*;
|
|
|
|
import com.op.plan.mapper.ProOrderWorkorderMapper;
|
|
|
|
|
|
|
|
import com.op.plan.mapper.ProRouteMapper;
|
|
|
|
|
|
|
|
import com.op.system.api.RemoteSapService;
|
|
|
|
import com.op.system.api.RemoteSapService;
|
|
|
|
import com.op.system.api.model.SapProOrder;
|
|
|
|
import com.op.system.api.model.SapProOrder;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import com.op.plan.mapper.ProOrderMapper;
|
|
|
|
|
|
|
|
import com.op.plan.service.IProOrderService;
|
|
|
|
import com.op.plan.service.IProOrderService;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@ -53,6 +49,8 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
|
|
|
|
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ProRouteMapper proRouteMapper;
|
|
|
|
private ProRouteMapper proRouteMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
|
private RemoteSapService remoteSapService;
|
|
|
@ -311,21 +309,41 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
for (int i = 0; i < orderList.size(); i++) {
|
|
|
|
for (int i = 0; i < orderList.size(); i++) {
|
|
|
|
// 当前行操作
|
|
|
|
// 当前行操作
|
|
|
|
boolean checkOnly = false;
|
|
|
|
boolean checkOnly = false;
|
|
|
|
|
|
|
|
boolean checkPlan = false;
|
|
|
|
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> workOrderList = proOrderWorkorderMapper.selectWorkOrderByOrderCode(orderList.get(i).getOrderCode());
|
|
|
|
List<ProOrderWorkorder> workOrderList = proOrderWorkorderMapper.selectWorkOrderByOrderCode(orderList.get(i).getOrderCode());
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历查询工单是否已下达-下达则不允许编辑更新
|
|
|
|
// 遍历查询工单是否已下达-下达则不允许编辑更新
|
|
|
|
for (ProOrderWorkorder workOrder : workOrderList) {
|
|
|
|
for (ProOrderWorkorder workOrder : workOrderList) {
|
|
|
|
|
|
|
|
// 如果工单已经下达
|
|
|
|
if (workOrder.getStatus().equals("w1")) {
|
|
|
|
if (workOrder.getStatus().equals("w1")) {
|
|
|
|
checkEdit = true;
|
|
|
|
checkEdit = true;
|
|
|
|
checkOnly = true;
|
|
|
|
checkOnly = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 如果工单已有湿料计划
|
|
|
|
|
|
|
|
ProWetMaterialPlanDetail detail = proWetMaterialPlanDetailMapper.selectProWetMaterialPlanDetailByWorkId(workOrder.getWorkorderId());
|
|
|
|
|
|
|
|
if (detail != null){
|
|
|
|
|
|
|
|
checkEdit = true;
|
|
|
|
|
|
|
|
checkPlan = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 组装工单已下达反馈信息
|
|
|
|
if (checkOnly) {
|
|
|
|
if (checkOnly) {
|
|
|
|
errMsg.append("第" + (i + 1) + "行:" + "订单号为:" + orderList.get(i).getOrderCode() + ",该订单下工单已下达,不允许更新;" + "<br/>");
|
|
|
|
errMsg.append("第" + (i + 1) + "行:" + "订单号为:" + orderList.get(i).getOrderCode() + ",该订单下工单已下达,不允许更新;" + "<br/>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 组装已有湿料计划反馈信息
|
|
|
|
|
|
|
|
if (checkPlan) {
|
|
|
|
|
|
|
|
errMsg.append("第" + (i + 1) + "行:" + "订单号为:" + orderList.get(i).getOrderCode() + ",该订单下工单已有湿料计划,不允许更新;" + "<br/>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果存在不可编辑信息
|
|
|
|
|
|
|
|
if (checkEdit) {
|
|
|
|
return error(500, errMsg.toString());
|
|
|
|
return error(500, errMsg.toString());
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 正常插入与更新操作
|
|
|
|
// 正常插入与更新操作
|
|
|
|
for (ProOrder order : orderList) {
|
|
|
|
for (ProOrder order : orderList) {
|
|
|
|
// 查询订单是否存在
|
|
|
|
// 查询订单是否存在
|
|
|
@ -364,12 +382,6 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
proOrderMapper.insertProOrder(order);
|
|
|
|
proOrderMapper.insertProOrder(order);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 如果存在不可编辑信息
|
|
|
|
|
|
|
|
if (checkEdit) {
|
|
|
|
|
|
|
|
return error(500, errMsg.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return success("信息导入成功");
|
|
|
|
return success("信息导入成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|