|
|
|
@ -28,7 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -411,6 +414,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
ProOrderWorkorder workOrder = proOrderWorkorderMapper.selectProOrderWorkorderByWorkorderId(proOrderWorkorder.getWorkorderId());
|
|
|
|
|
formatProOrderWorkorder(workOrder);
|
|
|
|
|
|
|
|
|
|
//查湿料计划,看看用的什么料
|
|
|
|
|
ProWetMaterialPlanDetail wetInfo = proWetMaterialPlanDetailMapper.getWetInfoByWorkId(proOrderWorkorder.getWorkorderId());
|
|
|
|
|
workOrder.setMaterialCode(wetInfo.getMaterialCode());
|
|
|
|
|
workOrder.setMaterialName(wetInfo.getMaterialName());
|
|
|
|
|
|
|
|
|
|
Map orderAndWork = new HashMap();
|
|
|
|
|
orderAndWork.put("order", proOrder);
|
|
|
|
@ -650,6 +657,35 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
// System.out.println("这里是拆分数量----------->"+workBatch.getBatchQuantity());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成湿料计划------------------------------开始
|
|
|
|
|
List<ProWetMaterialPlanDetail> wetDetails = new ArrayList<>();
|
|
|
|
|
//设备-根据工单获取实际规划设备路线
|
|
|
|
|
String[][] lineCodes = splitOrderDTO.getProdLineCodeArray();//proRfidProcessDetailMapper.getActuaEquips(rfidInfo);
|
|
|
|
|
ProWetMaterialPlanDetail wetDetail = null;
|
|
|
|
|
for(int c1= 0;c1<lineCodes.length;c1++){
|
|
|
|
|
if(lineCodes[c1][1].startsWith("L")){//L1-8湿料罐
|
|
|
|
|
wetDetail = new ProWetMaterialPlanDetail();
|
|
|
|
|
wetDetail.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
wetDetail.setWorkorderId(proOrderWorkorder.getWorkorderId());
|
|
|
|
|
wetDetail.setBucketCode(lineCodes[c1][1]);
|
|
|
|
|
wetDetail.setMaterialCode(splitOrderDTO.getMaterialCode());
|
|
|
|
|
wetDetail.setMaterialName(splitOrderDTO.getMaterialName());
|
|
|
|
|
wetDetail.setShiftId(Long.parseLong(proWorkOrder.getShiftId()));
|
|
|
|
|
wetDetail.setPlanTime(splitOrderDTO.getProductDate());
|
|
|
|
|
wetDetail.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
wetDetail.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
//获取当前所选工厂
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
wetDetail.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
|
|
|
|
|
wetDetails.add(wetDetail);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!CollectionUtils.isEmpty(wetDetails)){
|
|
|
|
|
proWetMaterialPlanDetailMapper.batchAddWetDetails(wetDetails);
|
|
|
|
|
}
|
|
|
|
|
//生成湿料计划------------------------------结束
|
|
|
|
|
|
|
|
|
|
return success("变更成功");
|
|
|
|
|
} else {
|
|
|
|
|
// 删除所有工单s下的批次信息
|
|
|
|
@ -767,13 +803,13 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
if (!(proOrderWorkorder.getStatus().equals("w0") || proOrderWorkorder.getStatus().equals("w1"))) {
|
|
|
|
|
return error("工单已生产,不可变更!");
|
|
|
|
|
}
|
|
|
|
|
// 白坯工单所在湿料计划下发不允许变更
|
|
|
|
|
if (proOrderWorkorder.getProdType().equals("white")) {
|
|
|
|
|
ProWetMaterialPlan plan = proWetMaterialPlanMapper.selectProWetMaterialPlanByWorkId(proOrderWorkorder.getWorkorderId());
|
|
|
|
|
if (plan != null) {
|
|
|
|
|
return error("工单所在湿料计划已下发,不允许变更!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// // 白坯工单所在湿料计划下发不允许变更
|
|
|
|
|
// if (proOrderWorkorder.getProdType().equals("white")) {
|
|
|
|
|
// ProWetMaterialPlan plan = proWetMaterialPlanMapper.selectProWetMaterialPlanByWorkId(proOrderWorkorder.getWorkorderId());
|
|
|
|
|
// if (plan != null) {
|
|
|
|
|
// return error("工单所在湿料计划已下发,不允许变更!");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -845,7 +881,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
|
|
|
|
|
ProWetMaterialPlan plan = proWetMaterialPlanMapper.selectProWetMaterialPlanByWorkId(data.getWorkorderId());
|
|
|
|
|
if (plan != null) {
|
|
|
|
|
if (plan.getSyncFlag().equals("Y")) {
|
|
|
|
|
throw new RuntimeException("工单下湿料计划已下发,不允许删除!");
|
|
|
|
|
throw new RuntimeException("白坯工单湿料计划已同步wcs,不允许删除!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|