|
@@ -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,7 +539,13 @@ 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);
|
|
@@ -575,15 +584,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 +604,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]));
|
|
@@ -646,14 +656,20 @@ 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(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 +761,10 @@ 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));
|
|
|
}
|
|
|
- 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());
|