diff --git a/src/main/java/com/dsic/gj_erp/pc/dto/data/Bom.java b/src/main/java/com/dsic/gj_erp/pc/dto/data/Bom.java index 5b769ab..e132b4d 100644 --- a/src/main/java/com/dsic/gj_erp/pc/dto/data/Bom.java +++ b/src/main/java/com/dsic/gj_erp/pc/dto/data/Bom.java @@ -69,6 +69,26 @@ public class Bom { this.errors.add(ErrorType.需求日期按照中日程计算); } + public void 缺少中日程(){ + this.errors.add(ErrorType.缺少中日程); + this.errors.add(ErrorType.按照中日程计划上料日期失败); + } + + public void 中日期无小组需求期(){ + this.errors.add(ErrorType.中日期无小组需求期); + this.errors.add(ErrorType.按照中日程计划上料日期失败); + } + + public void 中日程无大组需求期(){ + this.errors.add(ErrorType.中日程无大组需求期); + this.errors.add(ErrorType.按照中日程计划上料日期失败); + } + + public void 缺少大组需求期使用小组需求替代(){ + this.errors.add(ErrorType.缺少大组需求期使用小组需求替代); + } + + public void 超出工序产能(Constant.工序 _工序){ switch (_工序) { case 上料: @@ -108,6 +128,11 @@ public class Bom { } private enum ErrorType{ + 缺少大组需求期使用小组需求替代, + 缺少中日程, + 中日期无小组需求期, + 中日程无大组需求期, + 按照中日程计划上料日期失败, 坡口结束日期不满足大组需求期, 没有订货, 订货计划到齐日期格式错误, diff --git a/src/main/java/com/dsic/gj_erp/pc/dto/tlt/三跨平铁.java b/src/main/java/com/dsic/gj_erp/pc/dto/tlt/三跨平铁.java index 19efcfd..aa58cb1 100644 --- a/src/main/java/com/dsic/gj_erp/pc/dto/tlt/三跨平铁.java +++ b/src/main/java/com/dsic/gj_erp/pc/dto/tlt/三跨平铁.java @@ -18,7 +18,6 @@ public class 三跨平铁 extends 套料图工序 { .add(Constant.工序.理料) .add(Constant.工序.划线) .add(Constant.工序.切割) - .add(Constant.工序.切割) .add(Constant.工序.打磨) .add(Constant.工序.曲型) .build(); @@ -36,7 +35,6 @@ public class 三跨平铁 extends 套料图工序 { .add(Constant.工序.理料) .add(Constant.工序.划线) .add(Constant.工序.切割) - .add(Constant.工序.切割) .add(Constant.工序.打磨) .add(Constant.工序.曲型) .build(); @@ -54,7 +52,6 @@ public class 三跨平铁 extends 套料图工序 { .add(Constant.工序.理料) .add(Constant.工序.划线) .add(Constant.工序.切割) - .add(Constant.工序.切割) .add(Constant.工序.打磨) .build(); return this; diff --git a/src/main/java/com/dsic/gj_erp/pc/dto/套料图工序.java b/src/main/java/com/dsic/gj_erp/pc/dto/套料图工序.java index 83775dd..22a0522 100644 --- a/src/main/java/com/dsic/gj_erp/pc/dto/套料图工序.java +++ b/src/main/java/com/dsic/gj_erp/pc/dto/套料图工序.java @@ -43,22 +43,33 @@ public abstract class 套料图工序 implements 套料图工序接口 { public void run(){ fail=new AtomicBoolean(false); - 基础设置(); - this.run(fail); + if (基础设置()){ + this.run(fail); + } } - protected void 基础设置(){ - if (this.zlType==ZlType.小组){ + protected boolean 基础设置(){ + if (this.zlType==ZlType.小组||this.zlType==ZlType.焊接机器人肘板){ this.set需求日期(this.xzglxq); } if (this.zlType==ZlType.大组){ - this.set需求日期(this.dzglxq); + if (this.dzglxq==null){ + this.set需求日期(this.xzglxq); + this.bom.缺少大组需求期使用小组需求替代(); + }else { + this.set需求日期(this.dzglxq); + } } if (this.zlType==ZlType.大组&&this.工序.contains(Constant.工序.曲型)){ //大组需求有曲外板,需要按照大组需求期计算 - this.set需求日期(dzglxq); + if (this.dzglxq==null){ + this.set需求日期(this.xzglxq); + this.bom.缺少大组需求期使用小组需求替代(); + }else { + this.set需求日期(this.dzglxq); + } //曲外板批量名称设置 this.bom.set_pl(this.bom.getPl()+"Q"); } @@ -71,25 +82,39 @@ public abstract class 套料图工序 implements 套料图工序接口 { } if (ObjUtil.isEmpty(this.bom)||StrUtil.isEmpty(this.bom.getTzbh())){ - return; + return false; } this._需求日期 = DateUtil.parse(this.需求日期, "yyyy/MM/dd"); Map> _订货计划=DataFactory.获取订货计划(); this.订货计划s = _订货计划.get(bom.getDcch()); + return true; } public void run(AtomicBoolean atomicBoolean) { - if (!this.是否订货()){ + if (!this.订货()){ + System.out.println(String.format("船号:%s,批量:%s,未订货",this.bom.getDcch(),this.bom.getPl())); bom.没有订货(); } this.工序.forEach(_工序 -> { 资源 _资源 = this.占用资源2(_工序, 需求数量); - if (_工序==Constant.工序.上料&&!this.能否到货(_资源)){ + if (_工序==Constant.工序.上料&&!this.到货(_资源)){ this.bom.上料之前无法到货(); //使用中日程定义需求日期 + if (this.中日程==null){ + this.bom.缺少中日程(); + return; + } + if (this.zlType==ZlType.小组&&this.中日程.getGjjsXz()==null){ + this.bom.中日期无小组需求期(); + return; + } + if (this.zlType==ZlType.大组&&this.中日程.getGjjsDz()==null){ + this.bom.中日程无大组需求期(); + return; + } this._需求日期=this.zlType==ZlType.小组?DateUtil.parse(this.中日程.getGjjsXz()):DateUtil.parse(this.中日程.getGjjsDz()); //再次计算上料日期 this.占用资源2(_工序, 需求数量); @@ -114,23 +139,22 @@ public abstract class 套料图工序 implements 套料图工序接口 { } } - protected boolean 是否订货(){ + protected boolean 订货(){ AtomicBoolean 是否订货=new AtomicBoolean(false); if (ObjUtil.isEmpty(订货计划s)){ return 是否订货.get(); } - if (ObjUtil.isNotEmpty(订货计划s)){ - 订货计划s.forEach(item->{ - if (item.getPlList().contains(bom.getPl())){ - 是否订货.set(true); - } - }); - } + 订货计划s.forEach(item->{ + if (item.getPlList().contains(bom.getPl())){ + 是否订货.set(true); + } + }); + return 是否订货.get(); } - protected boolean 能否到货(资源 _资源){ + protected boolean 到货(资源 _资源){ AtomicBoolean 能否到货=new AtomicBoolean(false); if (ObjUtil.isNotEmpty(订货计划s)){ 订货计划s.forEach(item->{ diff --git a/src/main/java/com/dsic/gj_erp/pc/订货计划.java b/src/main/java/com/dsic/gj_erp/pc/订货计划.java index cc22281..fdc3e3a 100644 --- a/src/main/java/com/dsic/gj_erp/pc/订货计划.java +++ b/src/main/java/com/dsic/gj_erp/pc/订货计划.java @@ -1,6 +1,5 @@ package com.dsic.gj_erp.pc; -import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import lombok.Getter; import lombok.Setter; @@ -29,6 +28,47 @@ public class 订货计划 { if (this.plList!=null){ return this.plList; } + this.plList=new ArrayList<>(); + if (this.pls.contains("/")){ + this.plsHandler3(this.pls); + return this.plList; + } + + if (this.pls.contains("、")){ + this.plsHandler2(this.pls); + return this.plList; + } + if (this.pls.contains("-")){ + this.plsHandler1(pls); + return this.plList; + } + this.plList.add(this.formatPl(this.pls)); + return this.plList; + } + + private void plsHandler3(String pls){ + String[] _pls = this.pls.split("/"); + for (String tmp:_pls){ + if (tmp.contains("、")){ + this.plsHandler2(this.pls); + continue; + } + this.plList.add(this.formatPl(tmp)); + } + } + + private void plsHandler2(String pls){ + String[] _pls = this.pls.split("、"); + for (String tmp:_pls){ + if (tmp.indexOf("-")>0){ + this.plsHandler1(tmp); + continue; + } + this.plList.add(this.formatPl(tmp)); + } + } + + private void plsHandler1(String pls){ List split = StrUtil.split(pls, "-"); String logMsg=StrUtil.format("订货计划--船号:{},批量范围格式错误:{}",dcch,pls); if (split.size()!=2){ @@ -38,14 +78,16 @@ public class 订货计划 { try { int start=Integer.parseInt(split.get(0)); int end=Integer.parseInt(split.get(1)); - this.plList=new ArrayList<>(); for (int i=start;i<=end;i++){ - this.plList.add(i+""); + this.plList.add(this.formatPl(i+"")); } - return this.plList; }catch (Exception e){ log.error(logMsg); throw new RuntimeException(logMsg); } } + + private String formatPl(String pl){ + return String.format("%03d",Integer.parseInt(pl)); + } } diff --git a/src/main/resources/mappers/jhgk/DmSygdxqMapper.xml b/src/main/resources/mappers/jhgk/DmSygdxqMapper.xml index 0433812..123796c 100644 --- a/src/main/resources/mappers/jhgk/DmSygdxqMapper.xml +++ b/src/main/resources/mappers/jhgk/DmSygdxqMapper.xml @@ -35,7 +35,7 @@ xq.dc_pl, xq.dc_fd, xq.xzglxq, - xq.daglxq, + xq.dzglxq, bom.id as bom_id, bom.dcch as bom_dcch, bom.mbch as bom_mbch,