| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.WrkDto; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.system.entity.license.AbstractServerInfos; |
| | | import org.apache.logging.log4j.LogManager; |
| | | import org.apache.logging.log4j.Logger; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("mobile") |
| | | public class MobileController extends BaseController { |
| | | public class MobileController extends BaseController { |
| | | |
| | | @Autowired |
| | | private MobileService mobileService; |
| | |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | |
| | | |
| | | private static Logger logger = LogManager.getLogger(MobileController.class); |
| | | |
| | | // 商品上架 |
| | | @RequestMapping("/mat/onSale/auth") |
| | | @ManagerAuth |
| | | public R matOnSale(@RequestBody CombParam combParam){ |
| | | public R matOnSale(@RequestBody CombParam combParam) { |
| | | mobileService.onSale(combParam); |
| | | return R.ok("上架成功"); |
| | | } |
| | | |
| | | // 商品下架 |
| | | @RequestMapping("/mat/offSale/auth") |
| | | //@ManagerAuth |
| | | public R matOffSale(@RequestBody OffSaleParam offSaleParam){ |
| | | public R matOffSale(@RequestBody OffSaleParam offSaleParam) { |
| | | mobileService.offSale(offSaleParam); |
| | | return R.ok("下架成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | // 组托 ---------------------------------------------------------------------------------------------------- |
| | |
| | | // } |
| | | @RequestMapping("/order/search/orderNo/auth") |
| | | @ManagerAuth |
| | | public R orderSearchByBarcode(@RequestParam String orderNo){ |
| | | if (Cools.isEmpty(orderNo)){ |
| | | orderNo=null; |
| | | public R orderSearchByBarcode(@RequestParam String orderNo) { |
| | | if (Cools.isEmpty(orderNo)) { |
| | | orderNo = null; |
| | | } |
| | | List<Order> orders = orderService.selectorderNoL(orderNo); |
| | | if (Cools.isEmpty(orders)){ |
| | | if (Cools.isEmpty(orders)) { |
| | | return R.ok(); |
| | | } |
| | | LinkedList<CombParam> combParams = new LinkedList<>(); |
| | | if (!Cools.isEmpty(orders)){ |
| | | for (Order order:orders){ |
| | | CombParam combParam=new CombParam(); |
| | | if (!Cools.isEmpty(orders)) { |
| | | for (Order order : orders) { |
| | | CombParam combParam = new CombParam(); |
| | | if (order == null) { |
| | | continue; |
| | | } |
| | |
| | | List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); |
| | | if (!Cools.isEmpty(orderDetls)) { |
| | | LinkedList<CombParam.CombMat> combMats = new LinkedList<>(); |
| | | for (OrderDetl orderDetl:orderDetls){ |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | CombParam.CombMat combMat = new CombParam.CombMat(); |
| | | combMat.setMatnr(orderDetl.getMatnr()); |
| | | combMat.setBatch(orderDetl.getBatch()); |
| | | combMat.setAnfme(orderDetl.getAnfme()-orderDetl.getWorkQty()); |
| | | combMat.setAnfme(orderDetl.getAnfme() - orderDetl.getWorkQty()); |
| | | combMat.setMaktx(orderDetl.getMaktx()); |
| | | combMat.setSpecs(orderDetl.getSpecs()); |
| | | combMats.add(combMat); |
| | |
| | | |
| | | @RequestMapping("/comb/auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb(@RequestBody CombParam combParam){ |
| | | public R comb(@RequestBody CombParam combParam) { |
| | | logger.info("组托参数:{}",combParam); |
| | | if (Cools.isEmpty(combParam.getOrderNo())) { |
| | | combParam.setOrderNo(combParam.getBillNo()); |
| | | } |
| | | List<CombParam.CombMat> combMats = combParam.getCombMats(); |
| | | combMats.forEach(elem -> { |
| | | if (Cools.isEmpty(elem.getBatch())) { |
| | | elem.setBatch(elem.getItemBatch()); |
| | | } |
| | | }); |
| | | mobileService.comb(combParam, getUserId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/pack/get/auth") |
| | | @ManagerAuth |
| | | public R packGet(@RequestParam String barcode){ |
| | | public R packGet(@RequestParam String barcode) { |
| | | Pack pack = packService.selectByBarcode(barcode); |
| | | if (pack == null) { |
| | | return R.ok(); |
| | |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/pack/comb/auth") |
| | | @ManagerAuth(memo = "下线组托") |
| | | public R packComb(@RequestBody CombParam combParam){ |
| | | mobileService.packComb(combParam, getUserId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | // @RequestMapping("/pack/comb/auth") |
| | | // @ManagerAuth(memo = "下线组托") |
| | | // public R packComb(@RequestBody CombParam combParam) { |
| | | // mobileService.packComb(combParam, getUserId()); |
| | | // return R.ok("组托成功"); |
| | | // } |
| | | |
| | | |
| | | // 出库 --------------------------------------------------------------------------------------------------- |
| | |
| | | @RequestMapping("/pakout/query/auth") |
| | | @ManagerAuth |
| | | @Deprecated |
| | | public R pakoutQuery(@RequestParam(required = false) String barcode, |
| | | @RequestParam(required = false) Integer staNo, |
| | | @RequestParam(required = false) String matnr){ |
| | | if (Cools.isEmpty(barcode) && Cools.isEmpty(matnr)) { |
| | | public R pakoutQuery(@RequestParam String barcode) { |
| | | if (Cools.isEmpty(barcode)) { |
| | | return R.ok(); |
| | | } |
| | | if (!Cools.isEmpty(barcode)) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("zpallet", barcode)); |
| | | return R.ok().add(wrkDetls); |
| | | } |
| | | if (!Cools.isEmpty(matnr)) { |
| | | if (!Cools.isEmpty(staNo)) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectPakoutQuery(staNo, matnr); |
| | | return R.ok().add(wrkDetls); |
| | | } |
| | | } |
| | | // if (!Cools.isEmpty(matnr)) { |
| | | // if (!Cools.isEmpty(staNo)) { |
| | | // List<WrkDetl> wrkDetls = wrkDetlService.selectPakoutQuery(staNo, matnr); |
| | | // return R.ok().add(wrkDetls); |
| | | // } |
| | | // } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/pakout/confirm/barcode/auth") |
| | | @ManagerAuth |
| | | public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode){ |
| | | public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode) { |
| | | if (Cools.isEmpty(barcode)) { |
| | | return R.ok(); |
| | | } |
| | |
| | | */ |
| | | @RequestMapping("/pakout/confirm/goods/auth") //待完善 原因(客户未给出详细信息) |
| | | @ManagerAuth |
| | | public R pakoutQueryByGoods(@RequestBody GDYKConfirmGoodsParam combParam){ |
| | | 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)){ |
| | | 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("已完成")){ |
| | | if (!orderDetl.getQty$().equals("已完成")) { |
| | | return R.error("任务未完成"); |
| | | } |
| | | //复核数 |
| | |
| | | // 根据库位码和商品码搜索商品 |
| | | @RequestMapping("/mat/find/auth") |
| | | public R find(@RequestParam(required = false) String locNo |
| | | , @RequestParam(required = false) String matnr){ |
| | | , @RequestParam(required = false) String matnr) { |
| | | //List<ManLocDetl> manLocDetls = manLocDetlMapper.selectItem0(locNo, matnr); |
| | | ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(locNo, matnr); |
| | | return R.ok(manLocDetl); |
| | |
| | | @RequestMapping("/pakout/confirm/pick/auth") |
| | | @ManagerAuth |
| | | public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo |
| | | , @RequestParam(required = false) String matnr){ |
| | | , @RequestParam(required = false) String matnr) { |
| | | if (Cools.isEmpty(wrkNo)) { |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | @RequestMapping("/adjust/auth") |
| | | @ManagerAuth(memo = "盘点") |
| | | public R adjust(@RequestBody MobileAdjustParam combParam){ |
| | | public R adjust(@RequestBody MobileAdjustParam combParam) { |
| | | mobileService.adjust(combParam, getUserId()); |
| | | return R.ok("盘点成功"); |
| | | } |
| | |
| | | @PostMapping("/order/out/pakout/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakoutByOrder(@RequestBody JSONObject param) { |
| | | if(!param.containsKey("staNo") || !param.containsKey("orderNo")){ |
| | | if (!param.containsKey("staNo") || !param.containsKey("orderNo")) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | mobileService.pakoutByOrder(param,getUserId()); |
| | | mobileService.pakoutByOrder(param, getUserId()); |
| | | return R.ok("出库成功"); |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/bill/query1/auth") |
| | | @ManagerAuth(memo = "根据通知单查询明细") |
| | | public R billQuery1(@RequestParam String billNo, @RequestParam String size){ |
| | | List<WaitMatin> waitMatins = waitMatinService.selectList(new EntityWrapper<WaitMatin>().eq("bill_no", billNo).like("size", size).last("and qty > in_qty")); |
| | | // List<WaitMatin> waitMatins = waitMatinService.selectList(new EntityWrapper<WaitMatin>().eq("bill_no", billNo).last("and qty > in_qty")); |
| | | |
| | | //如果通知单单号为空,则查询调拨单号 |
| | | if(Cools.isEmpty(waitMatins) || waitMatins.size()<=0){ |
| | | waitMatins = waitMatinService.selectList(new EntityWrapper<WaitMatin>().eq("temp1", billNo).like("size", size).last("and qty > in_qty")); |
| | | public R billQuery1(@RequestParam String billNo, @RequestParam String size) { |
| | | Order temp1 = orderService.selectOne(new EntityWrapper<Order>().eq("temp1", billNo)); |
| | | if (temp1 == null) { |
| | | throw new CoolException("该订单不存在"); |
| | | } |
| | | List<OrderDetl> waitMatins = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", temp1.getOrderNo()).last("and anfme > work_qty")); |
| | | if (waitMatins == null || waitMatins.isEmpty()) { |
| | | throw new CoolException("该订单项不存在"); |
| | | } |
| | | //如果通知单单号为空,则查询调拨单号 |
| | | // if (Cools.isEmpty(waitMatins) || waitMatins.size() <= 0) { |
| | | // waitMatins = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("temp1", billNo).like("size", size).last("and anfme > work_qty")); |
| | | // } |
| | | |
| | | List<CombBillQueryVo> vos = new ArrayList<>(); |
| | | if (!Cools.isEmpty(waitMatins)) { |
| | | for (WaitMatin waitMatin : waitMatins) { |
| | | for (OrderDetl waitMatin : waitMatins) { |
| | | CombBillQueryVo vo = new CombBillQueryVo(); |
| | | vo.setMatNo(waitMatin.getMatNo()); |
| | | vo.setMatName(waitMatin.getMatName()); |
| | | vo.setCount(waitMatin.getQty()-waitMatin.getInQty()); |
| | | vo.setQty(waitMatin.getQty()-waitMatin.getInQty()); |
| | | vo.setBillNo(waitMatin.getBillNo()); |
| | | vo.setSeqNo(waitMatin.getSeqNo()); |
| | | vo.setDetlId(waitMatin.getId()); |
| | | vo.setMatnr(waitMatin.getMatnr()); |
| | | vo.setMatName(waitMatin.getMaktx()); |
| | | vo.setQty(waitMatin.getAnfme() - waitMatin.getWorkQty()); |
| | | vo.setCount(waitMatin.getAnfme() - waitMatin.getWorkQty()); |
| | | vo.setBillNo(waitMatin.getOrderNo()); |
| | | vo.setSeqNo(waitMatin.getINo()); |
| | | vo.setUnit(waitMatin.getUnit()); |
| | | vo.setSpecs(waitMatin.getSpecs()); |
| | | vo.setSize(waitMatin.getSize()); |
| | | vo.setSize(waitMatin.getModel()); |
| | | vo.setColor(waitMatin.getColor()); |
| | | vo.setItemBatch(waitMatin.getItemBatch()); |
| | | vo.setOveFlag(waitMatin.getOveFlag()); |
| | | vo.setItemBatch(waitMatin.getBatch()); |
| | | vo.setLuHao(waitMatin.getLuHao()); |
| | | vo.setOutOrderNo(waitMatin.getOutOrderNo()); |
| | | vo.setSPgNO(waitMatin.getSPgNO()); |
| | | vo.setProType(waitMatin.getProType()); |
| | | vo.setPacking(waitMatin.getPacking()); |
| | | //vo.setOveFlag(waitMatin.getOveFlag()); |
| | | vos.add(vo); |
| | | } |
| | | } |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | |
| | | } |