From 7e463e9d24c7ad94f47f5c33b1cb4936dcd35f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=93=B2=E5=A5=87?= <13840175730@139.com> Date: Thu, 5 Jun 2025 14:22:42 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E5=8F=8A=E9=89=B4=E6=9D=83=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 | 46 ++++++++++++++++--- .../com/dsic/gj_erp/bean/zyjh/DmYlInfo.java | 15 ++++-- .../gj_erp/controller/zyjh/YlController.java | 28 +++++------ 3 files changed, 64 insertions(+), 25 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 6237179..1363d75 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 @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.dsic.gj_erp.bean.pgd.PgdTzjh; +import com.dsic.gj_erp.bean.zyjh.DmYlInfo; import com.dsic.gj_erp.exception.ServiceException; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -241,6 +242,22 @@ public class DmYdjh implements Serializable { private String ylbhgg; + //fixme 正式使用时需取消@TableField(exist = false) + @TableField(exist = false) + private String jhsyylbh;//计划使用余料编号 + + @TableField(exist = false) + private String ylCh;//来源余料船号 + + @TableField(exist = false) + private String ylPl;//来源余料批量 + + @TableField(exist = false) + private String ylTh;//来源余料图号 + + @TableField(exist = false) + private String ylbh;//来源余料编号 + private String parentId; private String db; private String cx; @@ -412,8 +429,25 @@ public class DmYdjh implements Serializable { return StrUtil.format("{}_{}_{}_{}",this.dcCh,this.dcPl,this.dcFd,this.tzbh); } + public DmYdjh ofPrintForSl(DmYlInfo item,String date){ + DmYdjh dmYdjh = new DmYdjh(); + dmYdjh.setId(this.id); + dmYdjh.setYlCh(item.get来源船号()); + dmYdjh.setYlPl(item.get来源批量()); + dmYdjh.setYlTh(item.get来源图纸()); + dmYdjh.setYlbh(item.get余料编号()); + dmYdjh.setSllph(item.get炉批号()); + //fixme 不确定是否还需要抛丸,先执行到抛丸反馈 + dmYdjh.setSlfkrq(date); + dmYdjh.setZtForPwfk(); + if ("17".equals(this.kw)){//光电直接切割 + dmYdjh.setZtForHXFK(); + } + return dmYdjh; + } + public boolean 图纸已使用(){ - return false; + return StrUtil.isNotEmpty(this.ylCh); } public void setZtForSl(){ @@ -450,13 +484,13 @@ public class DmYdjh implements Serializable { }else{ ZyjhzxEnum zt = ZyjhzxEnum.getEnumByCode(this.zt); if (zyjhzxEnum==null){ - throw new ServiceException(10001,"作业计划执行内容不存在"); + throw new ServiceException(10001,"作业计划执行状态错误"); } this.zt=zyjhzxEnum.computeCode<=zt.computeCode?zt.code:zyjhzxEnum.code; } - } + @Getter @AllArgsConstructor private enum ZyjhzxEnum{ YXF("2",2), @@ -477,10 +511,8 @@ public class DmYdjh implements Serializable { ,DM("85",85),DMFK("86",86), WC("99",99)//完成 ; - @Getter - public String code; - @Getter - public Integer computeCode; + public final String code; + public final Integer computeCode; public static ZyjhzxEnum getEnumByCode(String code){ for (ZyjhzxEnum em:ZyjhzxEnum.values()){ 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 05130a0..ca0513a 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 @@ -11,6 +11,7 @@ import lombok.Getter; import lombok.Setter; import java.math.BigDecimal; +import java.util.Arrays; @Getter @Setter @@ -64,7 +65,7 @@ public class DmYlInfo { private int 使用状态;//0:未使用;1:已使用;2:已打印;3:已切割 public boolean 指定余料编号的上料匹配(String 余料编号){ - return StrUtil.isNotEmpty(this.余料编号) &&this.余料编号.equals(余料编号); + return StrUtil.isNotEmpty(this.余料编号) && this.余料编号.equals(余料编号); } public boolean 上料匹配(DmYdjh ydjh){ @@ -108,8 +109,8 @@ public class DmYlInfo { dmYlInfo.余料编号=bchxylp.getYlbh(); String _板厚=null; - if(StrUtil.isNotEmpty(ydjh.getWpgg())){ - String[] _split=ydjh.getWpgg().split("\\*"); + if(StrUtil.isNotEmpty(bchxylp.getWpgg())){ + String[] _split=bchxylp.getWpgg().split("\\*"); if (_split.length>=3){ _板厚=_split[0]; } @@ -124,7 +125,7 @@ public class DmYlInfo { if (split.length==2){ if(StrUtil.isNotEmpty(_板厚)){ dmYlInfo.板厚=new BigDecimal(_板厚); - dmYlInfo.规格=_板厚+"\\*"+dmYlInfo.规格; + dmYlInfo.规格=_板厚+"*"+dmYlInfo.规格; } dmYlInfo.板宽=new BigDecimal(split[0]); dmYlInfo.板长=new BigDecimal(split[1]); @@ -153,4 +154,10 @@ public class DmYlInfo { public enum UseStatus{ 未使用,已使用,已打印,已切割 } + + public static void main(String[] args) { + String a="1527*11360"; + System.out.println(a.split("\\*").length); +// System.out.println(a.substring(a.indexOf("*")+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 d7a4f08..3d655a6 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,8 +17,6 @@ import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -38,6 +36,8 @@ public class YlController { ylInfoService.list(Wrappers.lambdaQuery() .eq(DmYlInfo::get来源船号,dto.getDcCh()) .eq(DmYlInfo::get使用状态,dto.getStatus()) + //查询结果使用最小匹配原则为按规格匹配上料提供匹配顺序 + .orderByAsc(DmYlInfo::get板宽,DmYlInfo::get板长) ) ); } @@ -95,23 +95,19 @@ public class YlController { .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); } - List collect = ydjhList.stream().peek(it -> { - //fixme 确定以下方法具体算法 + List collect = ydjhList.stream().map(it -> { + //防止手动编辑错误时的校验 if (it.图纸已使用()){ - String str=StrUtil.format("作业计划船号:{},图号{}已使用,请核对修正后再打印", item.get使用船号(), item.get使用图纸()); + 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(); - } + + return it.ofPrintForSl(item,date); }).collect(Collectors.toList()); updateList.addAll(collect); @@ -125,7 +121,7 @@ public class YlController { } /** - * 根据语料库存数据选择结果匹配作业计划 + * 根据余料库存数据选择结果匹配作业计划 * 匹配成功后返回匹配结果并显示到 */ @PostMapping("sl") @@ -140,14 +136,18 @@ public class YlController { List list = ydjhService.list(Wrappers.lambdaQuery() .eq(DmYdjh::getDcCh, dto.getDcCh()) .eq(DmYdjh::getDcPl, dto.getDcPl()) + .eq(DmYdjh::getYlbs,"Y") + .and(item->item.isNull(DmYdjh::getYlCh).or().eq(DmYdjh::getYlCh,"")) .eq(StrUtil.isNotEmpty(dto.getTzbh()),DmYdjh::getTzbh,dto.getTzbh()) + .orderByDesc(DmYdjh::getWpgg) ); + List 匹配成功的余料信息=new ArrayList<>(); out: for (DmYdjh ydjh:list){ for(DmYlInfo ylInfo:dto.getYlList()){ - if (ylInfo.指定余料编号的上料匹配(ydjh.getYlbhgg())&&ylInfo.上料匹配(ydjh)){//暂时不支持,仅保留分支流程 + if (ylInfo.指定余料编号的上料匹配(ydjh.getYlbhgg())){//暂时不支持,仅保留分支流程 ylInfo.修正上料信息(ydjh); 匹配成功的余料信息.add(ylInfo); continue out;