package com.zy.common.model; import com.core.common.Cools; import com.zy.asrs.entity.OrderDetl; import lombok.Data; import java.util.List; import java.util.Set; /** * Created by vincent on 2022/3/25 */ @Data public class DetlDto { private String orderNo; //料想码 private String containerCode; private String matnr; private String batch; private Double anfme; //销售订单号 private String csocode; //销售订单行号 private String isoseq; private String cFree1; // 库位类型: 1、代包装成品,2、原材料,3、箱壳 private Integer locType; // 工序状态 1:待加工,2:已加工,3:无需加工 private Integer processSts; public DetlDto() { } public DetlDto(String matnr, Double anfme) { this.matnr = matnr; this.anfme = anfme; } public DetlDto(String matnr, Double anfme,Integer processSts) { this.matnr = matnr; this.anfme = anfme; this.processSts = processSts; } 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; } public DetlDto(String matnr, String batch, Double anfme, String csocode, String isoseq, String containerCode) { this.matnr = matnr; this.batch = batch; this.anfme = anfme; this.csocode = csocode; this.isoseq = isoseq; this.containerCode = containerCode; } public DetlDto(String matnr, String batch, Double anfme, String csocode, String isoseq, String containerCode, Integer locType) { this.matnr = matnr; this.batch = batch; this.anfme = anfme; this.csocode = csocode; this.isoseq = isoseq; this.containerCode = containerCode; this.locType = locType; } public DetlDto(String matnr, String batch, Double anfme, String csocode, String isoseq, String containerCode, Integer locType, Integer processSts) { this.matnr = matnr; this.batch = batch; this.anfme = anfme; this.csocode = csocode; this.isoseq = isoseq; this.containerCode = containerCode; this.locType = locType; this.processSts = processSts; } public DetlDto(String orderNo, String matnr, String batch, Double anfme, String csocode, String isoseq) { this.orderNo = orderNo; this.matnr = matnr; this.batch = batch; this.anfme = anfme; this.csocode = csocode; this.isoseq = isoseq; } public static boolean hasList(Set 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; } } } } return false; } public static boolean has(List detlDtos, DetlDto detlDto) { for (DetlDto dto : detlDtos) { if (dto.getMatnr().equals(detlDto.getMatnr()) && Cools.eq(dto.getContainerCode(), detlDto.getContainerCode()) && Cools.eq(dto.getBatch(), detlDto.getBatch()) && Cools.eq(dto.getCsocode(),detlDto.getCsocode()) && Cools.eq(dto.getIsoseq(),detlDto.getIsoseq())) { return true; } } return false; } public static DetlDto find(List detlDtos, String matnr, String batch, String csocode, String isoseq, String containerCode) { if (Cools.isEmpty(matnr)) { return null; } for (DetlDto detlDto : detlDtos) { if (matnr.equals(detlDto.getMatnr()) && Cools.eq(containerCode, detlDto.getContainerCode()) && Cools.eq(batch, detlDto.getBatch()) && Cools.eq(csocode,detlDto.getCsocode()) && Cools.eq(isoseq,detlDto.getIsoseq())) { return detlDto; } } return null; } public static void main(String[] args) { boolean a = Cools.eq("a", null); System.out.println(a); } }