|
@@ -523,6 +523,9 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
List<Product> productList = productMapper.selectList(new QueryWrapper<Product>().eq("company_id", companyId));
|
|
|
List<ProdProcedure> allProcedureList = prodProcedureMapper.selectList(new QueryWrapper<ProdProcedure>().eq("company_id", companyId).orderByDesc("id"));
|
|
|
List<Plan> needInsertList=new ArrayList<>();
|
|
|
+ XSSFRow row0 = sheet.getRow(0);
|
|
|
+ XSSFCell cell0 = row0.getCell(0);
|
|
|
+ if (cell0 != null) cell0.setCellType(CellType.STRING);
|
|
|
List<PlanSteelStampNumber> allPlanSteelStampNumberList=new ArrayList<>();
|
|
|
for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
@@ -536,24 +539,28 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
Plan plan=new Plan();
|
|
|
plan.setCompanyId(companyId);
|
|
|
List<PlanSteelStampNumber> planSteelStampNumberList=new ArrayList<>();
|
|
|
- if(planType!=1){
|
|
|
+ if(planType!=2){
|
|
|
+ if(!StringUtils.isEmpty(cell0.getStringCellValue())){
|
|
|
+ if(cell0.getStringCellValue().equals("任务变更通知号")){
|
|
|
+ msg.setError("导入模板为插单计划模板,请重新下载模板");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
plan.setPlanType(0);
|
|
|
//排产工单号 产品名称 钢印号 数量 主工序 工位 开工时间 完工时间 描述
|
|
|
XSSFCell productSchedulingNumCell = row.getCell(0);
|
|
|
XSSFCell productNameCell = row.getCell(1);
|
|
|
XSSFCell steelStampNumberCell = row.getCell(2);
|
|
|
- XSSFCell vehiclSerialNumberCell = row.getCell(3);
|
|
|
- XSSFCell numCell = row.getCell(4);
|
|
|
- XSSFCell mainProcessCell = row.getCell(5);
|
|
|
- XSSFCell stationNameCell = row.getCell(6);
|
|
|
- XSSFCell startDateCell = row.getCell(7);
|
|
|
- XSSFCell endDateCell = row.getCell(8);
|
|
|
- XSSFCell describtionCell = row.getCell(9);
|
|
|
+ XSSFCell numCell = row.getCell(3);
|
|
|
+ XSSFCell mainProcessCell = row.getCell(4);
|
|
|
+ XSSFCell stationNameCell = row.getCell(5);
|
|
|
+ XSSFCell startDateCell = row.getCell(6);
|
|
|
+ XSSFCell endDateCell = row.getCell(7);
|
|
|
+ XSSFCell describtionCell = row.getCell(8);
|
|
|
|
|
|
if (productSchedulingNumCell != null) productSchedulingNumCell.setCellType(CellType.STRING);
|
|
|
if (productNameCell != null) productNameCell.setCellType(CellType.STRING);
|
|
|
if (steelStampNumberCell != null) steelStampNumberCell.setCellType(CellType.STRING);
|
|
|
- if (vehiclSerialNumberCell != null) vehiclSerialNumberCell.setCellType(CellType.STRING);
|
|
|
if (numCell != null) numCell.setCellType(CellType.NUMERIC);
|
|
|
if (mainProcessCell != null) mainProcessCell.setCellType(CellType.STRING);
|
|
|
if (stationNameCell != null) stationNameCell.setCellType(CellType.STRING);
|
|
@@ -575,15 +582,15 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
}
|
|
|
if(steelStampNumberCell!=null){
|
|
|
String stringCellValue = steelStampNumberCell.getStringCellValue();
|
|
|
- String[] split = stringCellValue.split("[|\\,\\,]");
|
|
|
+ String[] split = stringCellValue.split("\\|");
|
|
|
for (String s : split) {
|
|
|
String[] targetSplit = s.split(",");
|
|
|
if(targetSplit.length!=2){
|
|
|
msg.setError("数据["+s+"]钢印号数组及下标错误");
|
|
|
return msg;
|
|
|
}
|
|
|
- String steelStampNum=split[0];
|
|
|
- String indexNum=split[1];
|
|
|
+ String steelStampNum=targetSplit[0];
|
|
|
+ String indexNum=targetSplit[1];
|
|
|
PlanSteelStampNumber p=new PlanSteelStampNumber();
|
|
|
if(steelStampNum.contains("-")){
|
|
|
String[] split1 = steelStampNum.split("-");
|
|
@@ -595,8 +602,9 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
}
|
|
|
if(indexNum.contains("-")){
|
|
|
String[] split2 = indexNum.split("-");
|
|
|
- if(Integer.valueOf(split2[1])>Integer.valueOf(split2[0])){
|
|
|
- msg.setError("钢印号数组["+s+"]下标异常,第二下标不能大于第一下标");
|
|
|
+ if(Integer.valueOf(split2[0])>Integer.valueOf(split2[1])){
|
|
|
+ msg.setError("钢印号数组["+s+"]下标异常,第一下标不能大于第二下标");
|
|
|
+ return msg;
|
|
|
}
|
|
|
p.setRuleIndexStart(Integer.valueOf(split2[0]));
|
|
|
p.setRuleIndexEnd(Integer.valueOf(split2[1]));
|
|
@@ -621,11 +629,6 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
msg.setError("产品名称不能为空");
|
|
|
return msg;
|
|
|
}
|
|
|
- if(vehiclSerialNumberCell!=null){
|
|
|
- String[] split = vehiclSerialNumberCell.getStringCellValue().split("-");
|
|
|
- plan.setVehicleNumStart(Integer.valueOf(split[0]));
|
|
|
- plan.setVehicleNumEnd(split.length>1?Integer.valueOf(split[1]):Integer.valueOf(split[0]));
|
|
|
- }
|
|
|
plan.setNum(numCell==null?0:Double.valueOf(numCell.getNumericCellValue()).intValue());
|
|
|
plan.setMainProcess(mainProcessCell==null?"":mainProcessCell.getStringCellValue());
|
|
|
if(stationNameCell!=null){
|
|
@@ -646,14 +649,22 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
msg.setError("工位不能为空");
|
|
|
return msg;
|
|
|
}
|
|
|
- if(startDateCell!=null){
|
|
|
+ if(startDateCell!=null&&!StringUtils.isEmpty(startDateCell.getDateCellValue())){
|
|
|
+ plan.setStartDate(LocalDate.parse(sdf.format(startDateCell.getDateCellValue()),df));
|
|
|
+ }else {
|
|
|
plan.setStartDate(planType==0?LocalDate.now():LocalDate.now().plusDays(1));
|
|
|
}
|
|
|
- if(endDateCell!=null){
|
|
|
+ if(endDateCell!=null&&!StringUtils.isEmpty(endDateCell.getDateCellValue())){
|
|
|
plan.setEndDate(LocalDate.parse(sdf.format(endDateCell.getDateCellValue()),df));
|
|
|
}
|
|
|
plan.setDescribtion(describtionCell==null?"":describtionCell.getStringCellValue());
|
|
|
}else {
|
|
|
+ if(!StringUtils.isEmpty(cell0.getStringCellValue())){
|
|
|
+ if(cell0.getStringCellValue().equals("排产工单号")){
|
|
|
+ msg.setError("导入模板为排产计划模板,请重新下载模板");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
plan.setPlanType(1);
|
|
|
/*插单计划*/
|
|
|
//任务变更通知号 任务名称 任务类型 计划人数 数量 计划工时 单价 质检类型 工位 开工时间 完工时间 描述
|
|
@@ -745,10 +756,12 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
msg.setError("工位不能为空");
|
|
|
return msg;
|
|
|
}
|
|
|
- if(startDateCell!=null){
|
|
|
+ if(startDateCell!=null&&!StringUtils.isEmpty(startDateCell.getDateCellValue())){
|
|
|
plan.setStartDate(LocalDate.parse(sdf.format(startDateCell.getDateCellValue()),df));
|
|
|
+ }else {
|
|
|
+ plan.setStartDate(LocalDate.now());
|
|
|
}
|
|
|
- if(endDateCell!=null){
|
|
|
+ if(endDateCell!=null&&!StringUtils.isEmpty(endDateCell.getDateCellValue())){
|
|
|
plan.setEndDate(LocalDate.parse(sdf.format(endDateCell.getDateCellValue()),df));
|
|
|
}
|
|
|
plan.setDescribtion(describtionCell==null?"":describtionCell.getStringCellValue());
|