|  |  | 
 |  |  | package com.zy.asrs.task.handler; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
 |  |  | import com.core.common.Cools; | 
 |  |  | import com.core.exception.CoolException; | 
 |  |  | 
 |  |  | import com.zy.asrs.utils.MathUtils; | 
 |  |  | import com.zy.asrs.utils.OrderInAndOutUtil; | 
 |  |  | import com.zy.common.model.DetlDto; | 
 |  |  | import com.zy.nc.entity.NccSaleDbddWms; | 
 |  |  | import com.zy.nc.entity.NccSaleXsfhmxWms; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.jdbc.core.JdbcTemplate; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | import java.math.BigDecimal; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | 
 |  |  |                 //先按照批次匹配,再按照无批次号批次,因为销售发货,批次号可能带,有可能不携带,所以就会有问题;而且考虑到一条订单里如果相同物料,一条带批次,一条不带批次,情况 | 
 |  |  |                 for (OrderDetl xxx : old) { | 
 |  |  |                     if (xxx.beSimilar(wrkDetl)) { | 
 |  |  |                         orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                         if(Cools.isEmpty(orderDetl.getRemark())) { | 
 |  |  |                             orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                         }else { | 
 |  |  |                             NccSaleXsfhmxWms currentData = JSONObject.parseObject(orderDetl.getRemark(), NccSaleXsfhmxWms.class); | 
 |  |  |                             if (currentData == null) { | 
 |  |  |                                 continue; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             NccSaleXsfhmxWms nextData = JSONObject.parseObject(xxx.getRemark(), NccSaleXsfhmxWms.class); | 
 |  |  |                             if (nextData == null) { | 
 |  |  |                                 continue; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             BigDecimal currentFslDecimal = currentData.getNastnum(); | 
 |  |  |                             BigDecimal nextFslDecimal = nextData.getNastnum(); | 
 |  |  |                             if(currentFslDecimal.doubleValue() < nextFslDecimal.doubleValue()) { | 
 |  |  |                                 orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 if (Cools.isEmpty(orderDetl.getRemark())) { | 
 |  |  |                     for (OrderDetl xxx : old) { | 
 |  |  |                         if (xxx.beSimilarByWrkDetl(wrkDetl)) { | 
 |  |  |                             orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                             if(Cools.isEmpty(orderDetl.getRemark())) { | 
 |  |  |                                 orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                             }else { | 
 |  |  |                                 NccSaleXsfhmxWms currentData = JSONObject.parseObject(orderDetl.getRemark(), NccSaleXsfhmxWms.class); | 
 |  |  |                                 if (currentData == null) { | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  |  | 
 |  |  |                                 NccSaleXsfhmxWms nextData = JSONObject.parseObject(xxx.getRemark(), NccSaleXsfhmxWms.class); | 
 |  |  |                                 if (nextData == null) { | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  |  | 
 |  |  |                                 BigDecimal currentFslDecimal = currentData.getNastnum(); | 
 |  |  |                                 BigDecimal nextFslDecimal = nextData.getNastnum(); | 
 |  |  |                                 if(currentFslDecimal.doubleValue() < nextFslDecimal.doubleValue()) { | 
 |  |  |                                     orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                 //先按照批次匹配,再按照无批次号批次,因为销售发货,批次号可能带,有可能不携带,所以就会有问题;而且考虑到一条订单里如果相同物料,一条带批次,一条不带批次,情况 | 
 |  |  |                 for (OrderDetl xxx : old) { | 
 |  |  |                     if (xxx.beSimilar(wrkDetl)) { | 
 |  |  |                         orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                         if(Cools.isEmpty(orderDetl.getRemark())) { | 
 |  |  |                             orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                         }else { | 
 |  |  |                             NccSaleDbddWms currentData = JSONObject.parseObject(orderDetl.getRemark(), NccSaleDbddWms.class); | 
 |  |  |                             if (currentData == null) { | 
 |  |  |                                 continue; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             NccSaleDbddWms nextData = JSONObject.parseObject(xxx.getRemark(), NccSaleDbddWms.class); | 
 |  |  |                             if (nextData == null) { | 
 |  |  |                                 continue; | 
 |  |  |                             } | 
 |  |  |  | 
 |  |  |                             BigDecimal currentFslDecimal = currentData.getFsl(); | 
 |  |  |                             BigDecimal nextFslDecimal = nextData.getFsl(); | 
 |  |  |                             if(currentFslDecimal.doubleValue() < nextFslDecimal.doubleValue()) { | 
 |  |  |                                 orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 if (Cools.isEmpty(orderDetl.getRemark())) { | 
 |  |  |                     for (OrderDetl xxx : old) { | 
 |  |  |                         if (xxx.beSimilarByWrkDetl(wrkDetl)) { | 
 |  |  |                             orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                             if(Cools.isEmpty(orderDetl.getRemark())) { | 
 |  |  |                                 orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                             }else { | 
 |  |  |                                 NccSaleDbddWms currentData = JSONObject.parseObject(orderDetl.getRemark(), NccSaleDbddWms.class); | 
 |  |  |                                 if (currentData == null) { | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  |  | 
 |  |  |                                 NccSaleDbddWms nextData = JSONObject.parseObject(xxx.getRemark(), NccSaleDbddWms.class); | 
 |  |  |                                 if (nextData == null) { | 
 |  |  |                                     continue; | 
 |  |  |                                 } | 
 |  |  |  | 
 |  |  |                                 BigDecimal currentFslDecimal = currentData.getFsl(); | 
 |  |  |                                 BigDecimal nextFslDecimal = nextData.getFsl(); | 
 |  |  |                                 if(currentFslDecimal.doubleValue() < nextFslDecimal.doubleValue()) { | 
 |  |  |                                     orderDetl.setRemark(xxx.getRemark()); | 
 |  |  |                                 } | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } |