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