|  |  |  | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.CombParam; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.MobileAdjustParam; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.OffSaleParam; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.MobileAdjustResult; | 
|---|
|  |  |  | import com.zy.asrs.mapper.ManLocDetlMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.*; | 
|---|
|  |  |  | import com.zy.asrs.utils.OrderInAndOutUtil; | 
|---|
|  |  |  | import com.zy.common.model.WrkDto; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 移动端接口控制器 | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderService orderService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderDetlService orderDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DocTypeService docTypeService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WrkMastService wrkMastService; | 
|---|
|  |  |  | 
|---|
|  |  |  | private PackService packService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ManLocDetlMapper manLocDetlMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WrkDetlLogService wrkDetlLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private StaDescService staDescService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pda/WarehouseOut/v1") | 
|---|
|  |  |  | @ManagerAuth(memo = "并板途中拣料-参考念初") | 
|---|
|  |  |  | public R WarehouseOutV1(@RequestBody CombParam combParam) { | 
|---|
|  |  |  | return mobileService.WarehouseOutV1(combParam, getHostId(), getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pda/WarehouseOutPickMerge/v1") | 
|---|
|  |  |  | @ManagerAuth(memo = "拣料途中并板") | 
|---|
|  |  |  | public R WarehouseOutPickMergeV1(@RequestBody WarehouseOutPickMergeParam param) { | 
|---|
|  |  |  | if (Cools.isEmpty(param,param.getLocNo(),param.getBarcode(),param.getCombMats())) { | 
|---|
|  |  |  | return R.parse("参数不能为空!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return mobileService.WarehouseOutPickMergeV1(param, getHostId(), getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pick/in") | 
|---|
|  |  |  | @ManagerAuth(memo = "并板入库") | 
|---|
|  |  |  | public R pickConfirm(@RequestBody PickConfirmParam param) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(Cools.isEmpty(param,param.getList(),param.getLocNo(),param.getStaNo())) { | 
|---|
|  |  |  | return R.parse("参数不完整"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return mobileService.pickConfirm(param, getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/barcode/list/all") | 
|---|
|  |  |  | @ManagerAuth(memo = "并板入库途中拣料出库获取任务信息") | 
|---|
|  |  |  | public R orderOutListOrder(@RequestParam(required = false) String barcode) { | 
|---|
|  |  |  | return mobileService.orderOutListOrder(barcode, getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/barcode/list/pick") | 
|---|
|  |  |  | @ManagerAuth(memo = "拣料入库途中并板获取任务信息") | 
|---|
|  |  |  | public R orderOutListOrderPick(@RequestParam(required = false) String barcode) { | 
|---|
|  |  |  | return mobileService.orderOutListOrderPick(barcode, getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/loc/f/list") | 
|---|
|  |  |  | @ManagerAuth(memo = "获取在库库位") | 
|---|
|  |  |  | public R locNoF(@RequestParam(required = false) String locNo) { | 
|---|
|  |  |  | Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>() | 
|---|
|  |  |  | .eq("loc_sts", "F"); | 
|---|
|  |  |  | if (!Cools.isEmpty(locNo)) { | 
|---|
|  |  |  | wrapper.like("loc_no", locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<LocMast> list = locMastService.selectList(wrapper); | 
|---|
|  |  |  | return R.ok().add(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pick/sta/list") | 
|---|
|  |  |  | @ManagerAuth(memo = "获取并板站") | 
|---|
|  |  |  | public R pickSta() { | 
|---|
|  |  |  | List<StaDesc> list = staDescService.selectList(new EntityWrapper<StaDesc>() | 
|---|
|  |  |  | .eq("type_no", 104)); | 
|---|
|  |  |  | return R.ok().add(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pick/mat/list") | 
|---|
|  |  |  | @ManagerAuth(memo = "获取并板物料") | 
|---|
|  |  |  | public R pickMats(@RequestParam(required = false) String matnr, @RequestParam(required = false) String orderNo) { | 
|---|
|  |  |  | return mobileService.pickMats(matnr, orderNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 商品上架 | 
|---|
|  |  |  | @RequestMapping("/mat/onSale/auth") | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok("下架成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 组托 ---------------------------------------------------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据单号检索单据数据 | 
|---|
|  |  |  | * http://localhost:8081/jkwms/mobile/order/serach/orderNo/auth?orderNo=123123 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | //    @RequestMapping("/order/search/orderNo/auth") | 
|---|
|  |  |  | //    @ManagerAuth | 
|---|
|  |  |  | //    public R orderSearchByBarcode(@RequestParam String orderNo){ | 
|---|
|  |  |  | //        Order order = orderService.selectByNo(orderNo); | 
|---|
|  |  |  | //        if (order == null) { | 
|---|
|  |  |  | //            return R.ok(); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        DocType docType = docTypeService.selectById(order.getDocType()); | 
|---|
|  |  |  | //        if (docType.getPakin() == null || docType.getPakin() != 1) { | 
|---|
|  |  |  | //            return R.ok(); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        if (order.getSettle() > 2) { | 
|---|
|  |  |  | //            return R.ok(); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); | 
|---|
|  |  |  | //        if (Cools.isEmpty(orderDetls)) { | 
|---|
|  |  |  | //            return R.ok(); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        return R.ok().add(orderDetls); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | @RequestMapping("/order/search/orderNo/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R orderSearchByBarcode(@RequestParam String orderNo){ | 
|---|
|  |  |  | if (Cools.isEmpty(orderNo)){ | 
|---|
|  |  |  | orderNo=null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Order> orders = orderService.selectorderNoL(orderNo); | 
|---|
|  |  |  | //        List<Order> orders = orderService.selectorderNoL(orderNo); | 
|---|
|  |  |  | List<Order> orders = OrderInAndOutUtil.selectOrderNoL(null, orderNo); | 
|---|
|  |  |  | if (Cools.isEmpty(orders)){ | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DocType docType = docTypeService.selectById(order.getDocType()); | 
|---|
|  |  |  | if (docType.getPakin() == null || docType.getPakin() != 1) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (order.getSettle() > 2) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); | 
|---|
|  |  |  | //                List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); | 
|---|
|  |  |  | List<OrderDetl> orderDetls = OrderInAndOutUtil.selectWorkingDetls(order.getPakinPakoutStatus$(), order.getId()); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderDetls)) { | 
|---|
|  |  |  | LinkedList<CombParam.CombMat> combMats = new LinkedList<>(); | 
|---|
|  |  |  | for (OrderDetl orderDetl:orderDetls){ | 
|---|
|  |  |  | CombParam.CombMat combMat = new CombParam.CombMat(); | 
|---|
|  |  |  | combMat.setMatnr(orderDetl.getMatnr()); | 
|---|
|  |  |  | combMat.setBatch(orderDetl.getBatch()); | 
|---|
|  |  |  | combMat.setAnfme(orderDetl.getAnfme()); | 
|---|
|  |  |  | combMat.setAnfme(orderDetl.getAnfme()-orderDetl.getWorkQty()); | 
|---|
|  |  |  | combMat.setMaktx(orderDetl.getMaktx()); | 
|---|
|  |  |  | combMat.setSpecs(orderDetl.getSpecs()); | 
|---|
|  |  |  | combMat.setBrand(orderDetl.getBrand()); | 
|---|
|  |  |  | combMat.setSku(orderDetl.getSku()); | 
|---|
|  |  |  | combMat.setMemo(orderDetl.getMemo()); | 
|---|
|  |  |  | combMat.setBoxType1(orderDetl.getBoxType1()); | 
|---|
|  |  |  | combMat.setBoxType2(orderDetl.getBoxType2()); | 
|---|
|  |  |  | combMat.setBoxType3(orderDetl.getBoxType3()); | 
|---|
|  |  |  | combMat.setStandby1(orderDetl.getStandby1()); | 
|---|
|  |  |  | combMat.setStandby2(orderDetl.getStandby2()); | 
|---|
|  |  |  | combMat.setStandby3(orderDetl.getStandby3()); | 
|---|
|  |  |  | combMats.add(combMat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | combParam.setCombMats(combMats); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | combParam.setOrderNo(order.getOrderNo()); | 
|---|
|  |  |  | combParams.add(combParam); | 
|---|
|  |  |  | return R.ok().add(combParam); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //                combParams.add(combParam); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(combParams); | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/comb/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "组托") | 
|---|
|  |  |  | public R comb(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | //        mobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | mobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | return R.ok("组托成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/combAuto/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "组托") | 
|---|
|  |  |  | public R combAuto(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | //        mobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | mobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | return R.ok("组托成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/combAuto/wcs/auth") | 
|---|
|  |  |  | //    @ManagerAuth(memo = "组托") | 
|---|
|  |  |  | public R combAutoWcs(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | //        mobileService.comb(combParam, getUserId()); | 
|---|
|  |  |  | mobileService.comb(combParam, 7777L); | 
|---|
|  |  |  | return R.ok("组托成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/kitting/query/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "齐套入库查询") | 
|---|
|  |  |  | public R kittingQuery(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | return mobileService.kittingQuery(combParam, getUserId()); | 
|---|
|  |  |  | } catch (Exception e){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //        return R.ok("齐套入库查询成功"); | 
|---|
|  |  |  | return R.error("齐套入库查询失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/kitting/call/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "齐套入库呼叫") | 
|---|
|  |  |  | public R kittingCall(@RequestParam("locNo") String locNo){ | 
|---|
|  |  |  | mobileService.kittingCall(locNo, getUserId()); | 
|---|
|  |  |  | return R.ok("齐套入库呼叫成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/kitting/call/all/auth")//寄  前端改不了一点 | 
|---|
|  |  |  | @ManagerAuth(memo = "齐套入库呼叫") | 
|---|
|  |  |  | public R kittingCall(@RequestBody CombParam combParam){ | 
|---|
|  |  |  | List<CombParam.CombMat> combMats = combParam.getCombMats(); | 
|---|
|  |  |  | for (CombParam.CombMat locDetl : combMats) { | 
|---|
|  |  |  | mobileService.kittingCall(locDetl.getMemo(), getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok("齐套入库呼叫成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @RequestMapping("/loc/origin/query/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "库存查询") | 
|---|
|  |  |  | public R locOriginQuery(@RequestParam("barcode") String barcode){ | 
|---|
|  |  |  | List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("zpallet", barcode)); | 
|---|
|  |  |  | return R.ok("在库标记修改成功").add(locDetlList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @RequestMapping("/loc/origin/in/out/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "在库标记修改") | 
|---|
|  |  |  | public R locOriginInOut(@RequestBody LocDetl locDetl){ | 
|---|
|  |  |  | return mobileService.locOriginInOut(locDetl, getUserId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pack/get/auth") | 
|---|
|  |  |  | 
|---|
|  |  |  | 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())); | 
|---|
|  |  |  | Order order = OrderInAndOutUtil.selectByNo(Boolean.FALSE, combParam.getOrderNo()); | 
|---|
|  |  |  | List<OrderDetl> orderDetlList = OrderInAndOutUtil.selectByOrderId(Boolean.FALSE, order.getId()); | 
|---|
|  |  |  | OrderDetl orderDetl = null; | 
|---|
|  |  |  | for (OrderDetl orderDetl1 : orderDetlList){ | 
|---|
|  |  |  | if (combParam.getMatnr().equals(orderDetl1.getMatnr()) && combParam.getBatch().equals(orderDetl1.getBatch())){ | 
|---|
|  |  |  | orderDetl = orderDetl1; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Cools.isEmpty(orderDetl)){ | 
|---|
|  |  |  | return R.error("未查到数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!orderDetl.getQty$().equals("已完成")){ | 
|---|
|  |  |  | return R.error("任务未完成"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //复核数 | 
|---|
|  |  |  | orderDetl.setSource(1); | 
|---|
|  |  |  | //        orderDetlService.updateById(orderDetl); | 
|---|
|  |  |  | OrderInAndOutUtil.updateOrderDetl(Boolean.FALSE,order,orderDetl); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 根据库位码和商品码搜索商品 | 
|---|
|  |  |  | @RequestMapping("/mat/find/auth") | 
|---|
|  |  |  | public R find(@RequestParam(required = false) String locNo | 
|---|