| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 移动端接口控制器 |
| | |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | |
| | | @PostMapping("/pda/OutOrder") |
| | | @ManagerAuth(memo = "获得出库单") |
| | | @Transactional |
| | | public R OutOrder(@RequestParam String orderNo) { |
| | | List<Order> orders=new ArrayList<Order>(); |
| | | List<Order> OrderList=new ArrayList<Order>(); |
| | | if(Cools.isEmpty(orderNo)){ |
| | | orders= orderService.selectList(new EntityWrapper<Order>() |
| | | .in("settle",1,2) |
| | | ); |
| | | }else{ |
| | | orders= orderService.selectList(new EntityWrapper<Order>() |
| | | .like("order_no",orderNo) |
| | | .in("settle",1,2) |
| | | ); |
| | | } |
| | | if(Cools.isEmpty(orders)){ |
| | | return R.parse("无数据"); |
| | | } |
| | | for (Order o:orders |
| | | ) { |
| | | DocType docType=docTypeService.selectOne(new EntityWrapper<DocType>() |
| | | .eq("doc_id",o.getDocType())); |
| | | if(docType.getPakout()==1){ |
| | | OrderList.add(o); |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.ok(OrderList); |
| | | } |
| | | |
| | | @PostMapping("/pda/OutLocNo") |
| | | @ManagerAuth(memo = "获得平库出库的对应库位号") |
| | | @Transactional |
| | | public R OutLocNo(@RequestParam Long orderId) { |
| | | List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>() |
| | | .eq("order_id", orderId) |
| | | ); |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | return R.error("订单明细不存在"); |
| | | } |
| | | List<String> list = new ArrayList<>(); |
| | | for (OrderDetl o : orderDetls |
| | | ) { |
| | | if (o.getAnfme() <= o.getWorkQty()) { |
| | | continue; |
| | | } else { |
| | | //查看库位明细中有的物料 |
| | | List<ManLocDetl> locDetls = manLocDetlMapper.selectList(new EntityWrapper<ManLocDetl>() |
| | | .eq("matnr", o.getMatnr()).eq("batch",o.getBatch()) |
| | | ); |
| | | if (Cools.isEmpty(locDetls)) { |
| | | continue; |
| | | } else { |
| | | for (ManLocDetl l : locDetls |
| | | ) { |
| | | String s = l.getLocNo().substring(0, 2); |
| | | if (Integer.parseInt(s) > 8) { |
| | | list.add(l.getLocNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<String> myList = list.stream().distinct().collect(Collectors.toList()); |
| | | return R.ok(myList); |
| | | } |
| | | |
| | | @PostMapping("/pda/OrderDetlContrastLocDetl") |
| | | @ManagerAuth(memo = "获得订单明细对应的库存明细") |
| | | @Transactional |
| | | public R OrderDetlContrastLocDetl(@RequestParam Long orderId, @RequestParam String locNo) { |
| | | List<ManLocDetl> locDetlList = new ArrayList<ManLocDetl>(); |
| | | List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>() |
| | | .eq("order_id", orderId) |
| | | ); |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | return R.error("订单明细不存在"); |
| | | } |
| | | List<ManLocDetl> locDetls = manLocDetlMapper.selectList(new EntityWrapper<ManLocDetl>() |
| | | .eq("loc_no", locNo)); |
| | | if (Cools.isEmpty(locDetls)) { |
| | | return R.error("库位为空"); |
| | | } |
| | | for (OrderDetl o : orderDetls |
| | | ) { |
| | | if(o.getAnfme().equals(o.getQty())){ |
| | | continue; |
| | | } |
| | | for (ManLocDetl l : locDetls |
| | | ) { |
| | | if (o.getMatnr().equals(l.getMatnr()) && o.getBatch().equals(l.getBatch())) { |
| | | if (o.getAnfme() - o.getWorkQty() >= l.getAnfme()) { |
| | | |
| | | } else { |
| | | l.setAnfme(o.getAnfme() - o.getWorkQty()); |
| | | } |
| | | locDetlList.add(l); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return R.ok(locDetlList); |
| | | } |
| | | |
| | | /** |
| | | * 平庫下架 |
| | | */ |
| | | @RequestMapping("/pda/WarehouseOut") |
| | | @ManagerAuth |
| | | public R WarehouseOut(@RequestBody CombParam combParam) { |
| | | return mobileService.WarehouseOut(combParam, getUserId()); |
| | | } |
| | | |
| | | /** |
| | | * 平庫上架 |
| | | */ |
| | | @RequestMapping("/pda/WarehouseIn") |
| | | @ManagerAuth |
| | | public R WarehouseIn(@RequestParam String locNo, @RequestParam String barcode) { |
| | | return mobileService.WarehouseIn(locNo, barcode, getUserId()); |
| | | } |
| | | |
| | | // 商品上架 |
| | | @RequestMapping("/mat/onSale/auth") |