From 7658be06a4f6ed1ed24c41d7c5a2f0602ffbe660 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期六, 21 十二月 2024 14:59:14 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/model/DetlDto.java |  189 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 188 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/common/model/DetlDto.java b/src/main/java/com/zy/common/model/DetlDto.java
index 0729be7..580927b 100644
--- a/src/main/java/com/zy/common/model/DetlDto.java
+++ b/src/main/java/com/zy/common/model/DetlDto.java
@@ -1,6 +1,13 @@
 package com.zy.common.model;
 
+import com.core.common.Cools;
+import com.zy.asrs.entity.OrderDetl;
+import com.zy.asrs.entity.OrderDetlPakin;
+import com.zy.asrs.entity.OrderDetlPakout;
 import lombok.Data;
+
+import java.util.List;
+import java.util.Set;
 
 /**
  * Created by vincent on 2022/3/25
@@ -12,15 +19,71 @@
 
     private String matnr;
 
-    private String batch;
+    private String batch = "";
+    private String brand = "";
+    private String standby1 = "";
+    private String standby2 = "";
+    private String standby3 = "";
+    private Long lineNumber = 1L;
 
     private Double anfme;
 
     public DetlDto() {
     }
 
+    public DetlDto(String matnr, String batch, String brand, String standby1, String standby2, String standby3, Long lineNumber, Double anfme) {
+        this.matnr = matnr;
+        this.batch = batch;
+        this.brand = brand;
+        this.standby1 = standby1;
+        this.standby2 = standby2;
+        this.standby3 = standby3;
+        this.lineNumber = lineNumber;
+        this.anfme = anfme;
+    }
+
+    public DetlDto(String matnr, String batch, String brand, String standby1, String standby2, String standby3, Double anfme) {
+        this.matnr = matnr;
+        this.batch = batch;
+        this.brand = brand;
+        this.standby1 = standby1;
+        this.standby2 = standby2;
+        this.standby3 = standby3;
+        this.anfme = anfme;
+    }
+
+    public DetlDto(String matnr, String batch, String brand, String standby1, String standby2, String standby3, Long lineNumber) {
+        this.matnr = matnr;
+        this.batch = batch;
+        this.brand = brand;
+        this.standby1 = standby1;
+        this.standby2 = standby2;
+        this.standby3 = standby3;
+        this.lineNumber = lineNumber;
+    }
+
+    public DetlDto(String matnr, String batch, String brand, String standby1, String standby2, String standby3) {
+        this.matnr = matnr;
+        this.batch = batch;
+        this.brand = brand;
+        this.standby1 = standby1;
+        this.standby2 = standby2;
+        this.standby3 = standby3;
+    }
+
     public DetlDto(String matnr, Double anfme) {
         this.matnr = matnr;
+        this.anfme = anfme;
+    }
+
+    public DetlDto(String matnr, String batch) {
+        this.matnr = matnr;
+        this.batch = batch;
+    }
+
+    public DetlDto(String matnr, String batch, Double anfme) {
+        this.matnr = matnr;
+        this.batch = batch;
         this.anfme = anfme;
     }
 
@@ -30,4 +93,128 @@
         this.batch = batch;
         this.anfme = anfme;
     }
+
+    public static boolean hasList(Set<DetlDto> detlDtos, OrderDetl orderDetl) {
+        for (DetlDto dto : detlDtos) {
+//            if (Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(orderDetl.getBatch())) {
+//                if (dto.getMatnr().equals(orderDetl.getMatnr())) {
+//                    return true;
+//                }
+//            } else
+//            {
+//                if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(orderDetl.getBatch())) {
+//                    if (dto.getMatnr().equals(orderDetl.getMatnr()) && dto.getBatch().equals(orderDetl.getBatch())) {
+//                        return true;
+//                    }
+            if (dto.getMatnr().equals(orderDetl.getMatnr()) && Cools.eq(dto.getBatch(), orderDetl.getBatch())
+                    && Cools.eq(dto.getBrand(), orderDetl.getBrand()) && Cools.eq(dto.getStandby1(), orderDetl.getStandby1())
+                    && Cools.eq(dto.getStandby2(), orderDetl.getStandby2()) && Cools.eq(dto.getStandby3(), orderDetl.getStandby3())) {
+                return true;
+            }
+//                }
+//            }
+        }
+        return false;
+    }
+
+    public static boolean hasListLineNumber(Set<DetlDto> detlDtos, OrderDetl orderDetl) {
+        for (DetlDto dto : detlDtos) {
+//            if (Cools.isEmpty(dto.getBatch()) && Cools.isEmpty(orderDetl.getBatch())) {
+//                if (dto.getMatnr().equals(orderDetl.getMatnr())) {
+//                    return true;
+//                }
+//            } else
+//            {
+//                if (!Cools.isEmpty(dto.getBatch()) && !Cools.isEmpty(orderDetl.getBatch())) {
+//                    if (dto.getMatnr().equals(orderDetl.getMatnr()) && dto.getBatch().equals(orderDetl.getBatch())) {
+//                        return true;
+//                    }
+            if (dto.getMatnr().equals(orderDetl.getMatnr()) && Cools.eq(dto.getBatch(), orderDetl.getBatch())
+                    && Cools.eq(dto.getBrand(), orderDetl.getBrand()) && Cools.eq(dto.getStandby1(), orderDetl.getStandby1())
+                    && Cools.eq(dto.getStandby2(), orderDetl.getStandby2()) && Cools.eq(dto.getStandby3(), orderDetl.getStandby3())
+                    && dto.getLineNumber().equals(orderDetl.getLineNumber())) {
+                return true;
+            }
+//                }
+//            }
+        }
+        return false;
+    }
+
+    public static boolean hasList(Set<DetlDto> detlDtos, OrderDetlPakin orderDetl) {
+        for (DetlDto dto : detlDtos) {
+            if (dto.getMatnr().equals(orderDetl.getMatnr()) && Cools.eq(dto.getBatch(), orderDetl.getBatch())
+                    && Cools.eq(dto.getBrand(), orderDetl.getBrand()) && Cools.eq(dto.getStandby1(), orderDetl.getStandby1())
+                    && Cools.eq(dto.getStandby2(), orderDetl.getStandby2()) && Cools.eq(dto.getStandby3(), orderDetl.getStandby3())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean hasList(Set<DetlDto> detlDtos, OrderDetlPakout orderDetl) {
+        for (DetlDto dto : detlDtos) {
+            if (dto.getMatnr().equals(orderDetl.getMatnr()) && Cools.eq(dto.getBatch(), orderDetl.getBatch())
+                    && Cools.eq(dto.getBrand(), orderDetl.getBrand()) && Cools.eq(dto.getStandby1(), orderDetl.getStandby1())
+                    && Cools.eq(dto.getStandby2(), orderDetl.getStandby2()) && Cools.eq(dto.getStandby3(), orderDetl.getStandby3())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean has(List<DetlDto> detlDtos, DetlDto detlDto) {
+        for (DetlDto dto : detlDtos) {
+            if (dto.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(dto.getBatch(), detlDto.getBatch())
+                    && Cools.eq(dto.getBrand(), detlDto.getBrand()) && Cools.eq(dto.getStandby1(), detlDto.getStandby1())
+                    && Cools.eq(dto.getStandby2(), detlDto.getStandby2()) && Cools.eq(dto.getStandby3(), detlDto.getStandby3())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static DetlDto find(List<DetlDto> detlDtos, String matnr, String batch, String brand, String standby1, String standby2, String standby3) {
+        if (Cools.isEmpty(matnr)) {
+            return null;
+        }
+        for (DetlDto detlDto : detlDtos) {
+            if (matnr.equals(detlDto.getMatnr()) && Cools.eq(batch, detlDto.getBatch())
+                    && brand.equals(detlDto.getBrand()) && standby1.equals(detlDto.getStandby1())
+                    && standby2.equals(detlDto.getStandby2()) && standby3.equals(detlDto.getStandby3())) {
+                return detlDto;
+            }
+        }
+        return null;
+    }
+
+    public static DetlDto findLineNumber(List<DetlDto> detlDtos, String matnr, String batch, String brand, String standby1, String standby2, String standby3,Long lineNumber) {
+        if (Cools.isEmpty(matnr)) {
+            return null;
+        }
+        for (DetlDto detlDto : detlDtos) {
+            if (matnr.equals(detlDto.getMatnr()) && Cools.eq(batch, detlDto.getBatch())
+                    && brand.equals(detlDto.getBrand()) && standby1.equals(detlDto.getStandby1())
+                    && standby2.equals(detlDto.getStandby2()) && standby3.equals(detlDto.getStandby3())
+                    && lineNumber.equals(detlDto.getLineNumber())) {
+                return detlDto;
+            }
+        }
+        return null;
+    }
+
+    public static DetlDto findDto(List<DetlDto> detlDtos,DetlDto detlDtoB) {
+        if (Cools.isEmpty(detlDtoB)) {
+            return null;
+        }
+        for (DetlDto detlDto : detlDtos) {
+            if (detlDtoB.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(detlDtoB.getBatch(), detlDto.getBatch())
+                    && detlDtoB.getBrand().equals(detlDto.getBrand()) && detlDtoB.getStandby1().equals(detlDto.getStandby1())
+                    && detlDtoB.getStandby2().equals(detlDto.getStandby2()) && detlDtoB.getStandby3().equals(detlDto.getStandby3())) {
+                return detlDto;
+            }
+        }
+        return null;
+    }
+
 }

--
Gitblit v1.9.1