| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.common.model.LocDto; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 用户物料信息比对,判断是否为同一物料 |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 比较两个集合的类的属性,相同则抵消,最后判断两个集合是否完全抵消 |
| | | */ |
| | | public static boolean compareAndCheckCancellation(List<LocDetl> list1, List<OrderDetl> list2) { |
| | | if (list1.size() != list2.size()) { |
| | | return false; // If lists are not of the same size, cancellation is not possible |
| | | } |
| | | |
| | | List<OrderDetl> remainingList2 = new ArrayList<>(list2); |
| | | |
| | | // Compare and cancel out elements |
| | | for (LocDetl p1 : list1) { |
| | | boolean cancelled = false; |
| | | for (OrderDetl p2 : remainingList2) { |
| | | if (Objects.equals(p1.getMatnr(),p2.getMatnr()) && Objects.equals(p1.getBatch(),p2.getBatch()) && Objects.equals(p1.getOutOrderNo(),p2.getOutOrderNo()) && |
| | | Objects.equals(p1.getLuHao(),p2.getLuHao()) && Objects.equals(p1.getPacking(),p2.getPacking()) && Objects.equals(p1.getSPgNO(),p2.getSPgNO()) && |
| | | Objects.equals(p1.getProType(),p2.getProType()) && Objects.equals(p1.getColor(),p2.getColor())) { |
| | | remainingList2.remove(p2); |
| | | cancelled = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!cancelled) { |
| | | return false; // If any element in list1 cannot be cancelled, return false |
| | | } |
| | | } |
| | | |
| | | return remainingList2.isEmpty(); // Return true if all elements in list1 were cancelled out |
| | | } |
| | | |
| | | private static boolean isSame(Object fieldValue1, Object fieldValue2) { |
| | | if (Cools.isEmpty(fieldValue1)) { |
| | | fieldValue1 = ""; |