| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class AutoReplenishmentHandler extends AbstractHandler<String> { |
| | |
| | | public ReturnT<String> create(Mat mat, double anfme) { |
| | | //创建一个新的自动补货单据 |
| | | Order order = createOrder(); |
| | | orderService.insert(order); |
| | | OrderDetl orderDetl = createOrderDetl(order); |
| | | orderDetl.setMatnr(mat.getMatnr()); |
| | | orderDetl.setMaktx(mat.getMaktx()); |
| | |
| | | orderDetl.setAnfme(anfme); |
| | | orderDetl.setQty(0.0); |
| | | |
| | | orderService.insert(order); |
| | | |
| | | orderDetlService.insert(orderDetl); |
| | | |
| | | return SUCCESS; |
| | |
| | | //List<String> locNosSearch = locDetlService.selectLocNo(matnr); |
| | | Set<String> locNosSearch = locDetlService.selectLocNos(matnr); |
| | | |
| | | //重新排序 并且检测该库位是否含没有料箱码的物料,如有有则不允许出库 |
| | | //过滤库位货物为高货物 |
| | | locNosSearch = locNosSearch.stream().filter(locNo -> { |
| | | LocMast locMast = locMastService.selectByLoc(locNo); |
| | | if(locMast.getLocType1() == 3){ |
| | | return false; |
| | | }else { |
| | | //且检测该库位是否含没有料箱码的物料,如有有则不允许出库 |
| | | // LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locNo) |
| | | // .andNew().eq("supp_code", "").or().isNull("supp_code")); |
| | | |
| | | if(Cools.isEmpty(locDetlService.selectByLocWithoutContainer(locNo))){ |
| | | return true; |
| | | }else { |
| | | return false; |
| | | } |
| | | } |
| | | }).collect(Collectors.toSet()); |
| | | |
| | | //重新排序 |
| | | Set<String> resort = resort(locNosSearch); |
| | | |
| | | for(String locNo : resort){ |