| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.entity.param.GDYKConfirmGoodsParam; |
| | | import com.zy.asrs.entity.param.MobileAdjustParam; |
| | | import com.zy.asrs.entity.param.OffSaleParam; |
| | | import com.zy.asrs.entity.result.MobileAdjustResult; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 移动端接口控制器 |
| | |
| | | private PackService packService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @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()).orderBy("modi_time",false) |
| | | ); |
| | | 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())) { |
| | | 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") |
| | | @ManagerAuth |
| | | public R matOnSale(@RequestBody CombParam combParam){ |
| | | mobileService.onSale(combParam); |
| | | mobileService.onSale(combParam, getUserId()); |
| | | return R.ok("上架成功"); |
| | | } |
| | | |
| | | // 商品下架 |
| | | @RequestMapping("/mat/offSale/auth") |
| | | //@ManagerAuth |
| | | public R matOffSale(@RequestBody OffSaleParam offSaleParam){ |
| | | mobileService.offSale(offSaleParam); |
| | | mobileService.offSale(offSaleParam, getUserId()); |
| | | return R.ok("下架成功"); |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 出库确认 - 扫货物 广德宜科版 |
| | | * 1.全板 返回 101 |
| | | * 2.拣料 返回 103 |
| | | */ |
| | | @RequestMapping("/pakout/confirm/goods/auth") //待完善 原因(客户未给出详细信息) |
| | | @ManagerAuth |
| | | public R pakoutQueryByGoods(@RequestBody GDYKConfirmGoodsParam combParam){ |
| | | if (Cools.isEmpty(combParam)) { |
| | | return R.ok(); |
| | | } |
| | | // List<Order> orders = orderService.selectorderNoL(batch); |
| | | OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("matnr", combParam.getMatnr()).eq("batch", combParam.getBatch()).eq("order_no",combParam.getOrderNo())); |
| | | if (Cools.isEmpty(orderDetl)){ |
| | | return R.error("未查到数据"); |
| | | } |
| | | if (!orderDetl.getQty$().equals("已完成")){ |
| | | return R.error("任务未完成"); |
| | | } |
| | | //复核数 |
| | | orderDetl.setSource(1); |
| | | orderDetlService.updateById(orderDetl); |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 根据库位码和商品码搜索商品 |
| | | @RequestMapping("/mat/find/auth") |
| | | public R find(@RequestParam(required = false) String locNo |