From a4f400159ed24749577c55c886329d9f9a3e03c3 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, 24 Jun 2025 11:17:06 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=9D=90=E8=B4=A8=E8=AF=81=E4=BB=B6=E8=B7=9F?= =?UTF-8?q?=E8=B8=AA=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=AD=A3=E5=8A=9F=E8=83=BD?= =?UTF-8?q?,=E9=98=B2=E6=AD=A2=E6=9C=AA=E5=AF=BC=E5=85=A5=E9=9B=B6?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E5=A5=97=E8=A1=A8=E6=97=B6=E6=8A=A5=E5=B7=A5?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=9D=90=E8=B4=A8=E8=AF=81=E4=BB=B6=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98=202.=E8=B0=83=E6=95=B4=E5=88=87?= =?UTF-8?q?=E5=89=B2=E6=8A=A5=E5=B7=A5=E9=9B=B6=E4=BB=B6=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=85=BC=E5=AE=B9=E5=90=8E=E7=BB=AD=E9=9B=B6?= =?UTF-8?q?=E4=BB=B6=E4=BD=9C=E4=B8=9A=E6=8A=A5=E5=B7=A5=E7=8A=B6=E6=80=81?= =?UTF-8?q?,=E9=98=B2=E6=AD=A2=E7=9B=B4=E6=8E=A5=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=8A=A5=E5=B7=A5=E4=BF=A1=E6=81=AF=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dsic/gj_erp/bean/jhgk/DmYdjhLj.java | 21 ++++++-- .../controller/zyjh/ZyjhController.java | 50 ++++++++++++------- .../dsic/gj_erp/service/zyjh/ZyjhService.java | 29 ++++++++--- 3 files changed, 71 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjhLj.java b/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjhLj.java index 971273f..b7d9dda 100644 --- a/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjhLj.java +++ b/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjhLj.java @@ -350,11 +350,24 @@ public class DmYdjhLj implements Serializable { return !"03".equals(this.pkZt)||!"03".equals(this.qjgZt)||!"03".equals(this.dmZt); } + //报工检测 + public boolean checkZtBg(){ + return "03".equals(this.pkZt)||"03".equals(this.qjgZt)||"03".equals(this.dmZt); + } + public void updateZtWithDb(DmYdjhLj dbLj){ + this.setId(dbLj.getId()); + this.setDmZt(dbLj.getDmZt()); + this.setPkZt(dbLj.getPkZt()); + this.setQjgZt(dbLj.getQjgZt()); + this.setPpzt(dbLj.getPpzt()); + } - - - - + public boolean tmpEq(DmYdjhLj lj){ + return lj.getCzbh().equals(this.czbh) + &&lj.getPl().equals(this.pl) + &&lj.getTlth().equals(this.tlth) + &&lj.getLjbh().equals(this.ljbh); + } } diff --git a/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java b/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java index e7930e2..20f5056 100644 --- a/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java +++ b/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java @@ -291,6 +291,36 @@ public class ZyjhController { return new ResultBean<>(); } + @PostMapping("sdtbczzj") + public ResultBean sdTbCzzj(@RequestBody List list){ + ArrayList mpDhsjSaveList = new ArrayList<>(); + list.forEach(item-> zlgzCreate(item,mpDhsjSaveList)); + mpDhsjServcie.saveBatch(mpDhsjSaveList); + return new ResultBean<>(); + } + + private void zlgzCreate(DmYdjh item,ArrayList mpDhsjSaveList){ + List ljList = zyjhService.createLj(item.getDcCh(), item.getDcPl(), item.getTzbh()); + Map mpsycljljbp = zyjhService.getMPSYCLJLJBP(item.getDcCh(), item.getTzbh()); + //质量跟踪数据 + List collect = new ArrayList<>(); + String date = DateUtil.date().toString("yyyy/MM/dd"); + String mpDhsjDhh = zyjhService.getMpDhsjDhh(); + for (int j = 0; j < ljList.size(); j++) { + DmYdjhLj item2 = ljList.get(j); + if (StrUtil.isNotEmpty(item.getSllph())){//兼容没有炉批号的老数据用 + MpDhsj mpDhsj = MpDhsj.of(item2, date, item.getSllph()); + String xh = StrUtil.padPre(j + 1 + "", 3, "0"); + mpDhsj.setDhh(mpDhsjDhh+"-"+xh); + if (ObjUtil.isNotEmpty(mpsycljljbp)) { + mpDhsj.setGysbh("BZGY-"+mpsycljljbp.get("gzzx3")); + } + collect.add(mpDhsj); + mpDhsjSaveList.add(mpDhsj); + } + } + } + /** * 作业计划执行,派工&反馈 */ @@ -365,8 +395,6 @@ public class ZyjhController { updateYlList.add(dmYlInfo); } } - //生成零件信息 - List ljList = zyjhService.createLj(item.getDcCh(), item.getDcPl(), item.getTzbh()); //临时使用异常捕获,防止生产未更新余料库存表导致无法正常切割报工 try { @@ -396,24 +424,8 @@ public class ZyjhController { continue; } - Map mpsycljljbp = zyjhService.getMPSYCLJLJBP(item.getDcCh(), item.getTzbh()); //质量跟踪数据 - List collect = new ArrayList<>(); - String date = DateUtil.date().toString("yyyy/MM/dd"); - String mpDhsjDhh = zyjhService.getMpDhsjDhh(); - for (int j = 0; j < ljList.size(); j++) { - DmYdjhLj item2 = ljList.get(j); - if (StrUtil.isNotEmpty(item.getSllph())){//兼容没有炉批号的老数据用 - MpDhsj mpDhsj = MpDhsj.of(item2, date, item.getSllph()); - String xh = StrUtil.padPre(j + 1 + "", 3, "0"); - mpDhsj.setDhh(mpDhsjDhh+"-"+xh); - if (ObjUtil.isNotEmpty(mpsycljljbp)) { - mpDhsj.setGysbh("BZGY-"+mpsycljljbp.get("gzzx3")); - } - collect.add(mpDhsj); - MpDhsjSaveList.add(mpDhsj); - } - } + zlgzCreate(item,MpDhsjSaveList); } mpDhsjServcie.saveBatch(MpDhsjSaveList); diff --git a/src/main/java/com/dsic/gj_erp/service/zyjh/ZyjhService.java b/src/main/java/com/dsic/gj_erp/service/zyjh/ZyjhService.java index 5dda61d..d8430fa 100644 --- a/src/main/java/com/dsic/gj_erp/service/zyjh/ZyjhService.java +++ b/src/main/java/com/dsic/gj_erp/service/zyjh/ZyjhService.java @@ -33,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional; import java.io.File; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; import java.util.stream.Collectors; @Service @@ -175,12 +174,30 @@ public class ZyjhService extends ServiceImpl { } }); - ljService.remove(Wrappers.lambdaQuery() - .eq(DmYdjhLj::getCzbh,dcCh) - .eq(DmYdjhLj::getPl,dcPl) - .eq(DmYdjhLj::getTlth,tzbh) + //如果零件已报工,不可以删除,取消整图删除零件,改为修正 + List list = ljService.list(Wrappers.lambdaQuery() + .eq(DmYdjhLj::getCzbh, dcCh) + .eq(DmYdjhLj::getPl, dcPl) + .eq(DmYdjhLj::getTlth, tzbh) ); - ljService.saveBatch(ljInfo); + if (!list.isEmpty()){ + list.forEach(item->{ + ljInfo.forEach(lj->{ + if (lj.tmpEq(item)){ + //修正零件状态信息 + lj.updateZtWithDb(item); + } + }); + }); + ljService.saveOrUpdateBatch(ljInfo); + }else{ + ljService.remove(Wrappers.lambdaQuery() + .eq(DmYdjhLj::getCzbh,dcCh) + .eq(DmYdjhLj::getPl,dcPl) + .eq(DmYdjhLj::getTlth,tzbh) + ); + ljService.saveBatch(ljInfo); + } return ljInfo; }