From 6f9d3a7214ac144093904a802f440078a7f4d9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=93=B2=E5=A5=87?= <13840175730@139.com> Date: Tue, 20 May 2025 10:00:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=99=E6=96=99=E7=AE=A1=E7=90=86,=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=80=80=E5=9B=9E=E5=8A=9F=E8=83=BD=E5=92=8C=E6=89=8B?= =?UTF-8?q?=E5=B7=A5=E4=B8=8A=E6=96=99=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dsic/gj_erp/bean/jhgk/DmYdjh.java | 3 + .../com/dsic/gj_erp/bean/zyjh/DmYlInfo.java | 28 +++++++ .../gj_erp/controller/zyjh/YlController.java | 78 ++++++++++++++----- 3 files changed, 90 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java b/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java index d411251..6237179 100644 --- a/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java +++ b/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java @@ -412,6 +412,9 @@ public class DmYdjh implements Serializable { return StrUtil.format("{}_{}_{}_{}",this.dcCh,this.dcPl,this.dcFd,this.tzbh); } + public boolean 图纸已使用(){ + return false; + } public void setZtForSl(){ this.zt=ZyjhzxEnum.SLFK.code; diff --git a/src/main/java/com/dsic/gj_erp/bean/zyjh/DmYlInfo.java b/src/main/java/com/dsic/gj_erp/bean/zyjh/DmYlInfo.java index 4e257c4..05130a0 100644 --- a/src/main/java/com/dsic/gj_erp/bean/zyjh/DmYlInfo.java +++ b/src/main/java/com/dsic/gj_erp/bean/zyjh/DmYlInfo.java @@ -94,13 +94,41 @@ public class DmYlInfo { 使用状态=UseStatus.已使用.ordinal(); } + public void 修正退回信息(){ + 使用船号=""; + 使用批量=""; + 使用分段=""; + 使用图纸=""; + 使用日期=""; + 使用状态=UseStatus.未使用.ordinal(); + } + public static DmYlInfo of(DmBchxylp bchxylp, DmYdjh ydjh){ DmYlInfo dmYlInfo = new DmYlInfo(); dmYlInfo.余料编号=bchxylp.getYlbh(); + + String _板厚=null; + if(StrUtil.isNotEmpty(ydjh.getWpgg())){ + String[] _split=ydjh.getWpgg().split("\\*"); + if (_split.length>=3){ + _板厚=_split[0]; + } + + } + dmYlInfo.规格=bchxylp.getYlgg(); + //兼容余料规格两种模式:带板厚和不带板厚 if (dmYlInfo.规格!=null){ String[] split = dmYlInfo.规格.split("\\*"); + if (split.length==2){ + if(StrUtil.isNotEmpty(_板厚)){ + dmYlInfo.板厚=new BigDecimal(_板厚); + dmYlInfo.规格=_板厚+"\\*"+dmYlInfo.规格; + } + dmYlInfo.板宽=new BigDecimal(split[0]); + dmYlInfo.板长=new BigDecimal(split[1]); + } if (split.length>=3){ dmYlInfo.板厚=new BigDecimal(split[0]); dmYlInfo.板宽=new BigDecimal(split[1]); diff --git a/src/main/java/com/dsic/gj_erp/controller/zyjh/YlController.java b/src/main/java/com/dsic/gj_erp/controller/zyjh/YlController.java index e7f7e89..d7a4f08 100644 --- a/src/main/java/com/dsic/gj_erp/controller/zyjh/YlController.java +++ b/src/main/java/com/dsic/gj_erp/controller/zyjh/YlController.java @@ -17,7 +17,8 @@ import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; -import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -45,11 +46,39 @@ public class YlController { * 保存功能 */ @PostMapping("edit") + @Transactional(rollbackFor = Exception.class) public ResultBean edit(@RequestBody List list){ ylInfoService.updateBatchById(list); return new ResultBean<>(); } + /** + * 退回 + */ + @PostMapping("rollback") + @Transactional(rollbackFor = Exception.class) + public ResultBean rollback(@RequestBody List list){ + List updateList=new ArrayList<>(); + list.stream() + .filter(item->item.get使用状态()<=2) + .forEach(item->{ + DmYdjh one = ydjhService.getOne(Wrappers.lambdaQuery() + .eq(DmYdjh::getDcCh, item.get使用船号()) + .eq(DmYdjh::getTzbh, item.get使用图纸()) + ); + //退回作业计划 + //fixme 修正作业计划,余料上料相关属性 + if (ObjectUtil.isNotEmpty(one)){ + + } + //退回余料库存信息 + item.修正退回信息(); + }); + ydjhService.updateBatchById(updateList); + this.edit(list); + return new ResultBean<>(); + } + /** * 打印 */ @@ -58,27 +87,40 @@ public class YlController { public ResultBean print(@RequestBody List list){ ArrayList updateList = new ArrayList<>(); list.forEach(item->{ - String date = DateUtil.date().toString("yyyy/MM/dd"); - item.set使用日期(date); - item.set使用状态(2);//已打印 - List ydjhList = ydjhService.list(Wrappers.lambdaQuery() - .eq(DmYdjh::getDcCh, item.get使用船号()) - .eq(DmYdjh::getTzbh,item.get使用图纸()) - ); - List collect = ydjhList.stream().peek(it -> { - it.setSllph(item.get炉批号()); - it.setSlfkrq(date); - //fixme 不确定是否还需要抛丸,先执行到上料 - it.setZtForPwfk(); - if ("17".equals(it.getKw())){//光电直接切割 - it.setZtForHXFK(); + if (StrUtil.isAllNotEmpty(item.get使用船号(),item.get使用船号())){ + String date = DateUtil.date().toString("yyyy/MM/dd"); + item.set使用日期(date); + item.set使用状态(2);//已打印 + List ydjhList = ydjhService.list(Wrappers.lambdaQuery() + .eq(DmYdjh::getDcCh, item.get使用船号()) + .eq(DmYdjh::getTzbh,item.get使用图纸()) + ); + if (ObjectUtil.isEmpty(ydjhList)){ + String str=StrUtil.format("使用船号:{},使用图号{}错误,请核对修正后再打印", item.get使用船号(), item.get使用图纸()); + throw new ServiceException(99999,str); } - }).collect(Collectors.toList()); + List collect = ydjhList.stream().peek(it -> { + //fixme 确定以下方法具体算法 + if (it.图纸已使用()){ + String str=StrUtil.format("作业计划船号:{},图号{}已使用,请核对修正后再打印", item.get使用船号(), item.get使用图纸()); + throw new ServiceException(99999,str); + } + it.setSllph(item.get炉批号()); + it.setSlfkrq(date); + //fixme 不确定是否还需要抛丸,先执行到上料 + it.setZtForPwfk(); + if ("17".equals(it.getKw())){//光电直接切割 + it.setZtForHXFK(); + } + }).collect(Collectors.toList()); - updateList.addAll(collect); + updateList.addAll(collect); + } }); + ydjhService.updateBatchById(updateList); ylInfoService.updateBatchById(list); + return new ResultBean<>(); } @@ -120,8 +162,6 @@ public class YlController { } } - - return new ResultBean<>(匹配成功的余料信息); } }