|  |  |  | 
|---|
|  |  |  | 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.GDYKConfirmGoodsParam; | 
|---|
|  |  |  | 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.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.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WrkDetlLogService wrkDetlLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static Logger logger = LogManager.getLogger(MobileController.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 商品上架 | 
|---|
|  |  |  | @RequestMapping("/mat/onSale/auth") | 
|---|
|  |  |  | 
|---|
|  |  |  | combMat.setAnfme(orderDetl.getAnfme() - orderDetl.getWorkQty()); | 
|---|
|  |  |  | combMat.setMaktx(orderDetl.getMaktx()); | 
|---|
|  |  |  | combMat.setSpecs(orderDetl.getSpecs()); | 
|---|
|  |  |  | combMat.setDetId(orderDetl.getDetId()); | 
|---|
|  |  |  | combMat.setDetlId(orderDetl.getId()); | 
|---|
|  |  |  | combMats.add(combMat); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | combParam.setCombMats(combMats); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | combParam.setBillNo(order.getOrderNo()); | 
|---|
|  |  |  | combParam.setOrderNo(order.getOrderNo()); | 
|---|
|  |  |  | combParams.add(combParam); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/comb/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "组托") | 
|---|
|  |  |  | 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("/pickIn/auth") | 
|---|
|  |  |  | //    @ManagerAuth(memo="盘点入库") | 
|---|
|  |  |  | public R pickIn(@RequestParam String barcode){ | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastService.selectByBarcode(barcode); | 
|---|
|  |  |  | List<PickInParam> param = wrkDetlService.selectDetByBarcode(barcode); | 
|---|
|  |  |  | for(PickInParam pickInParam : param){ | 
|---|
|  |  |  | pickInParam.setStaNo(wrkMast.getStaNo()); | 
|---|
|  |  |  | pickInParam.setWorkNo(wrkMast.getWrkNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(param); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pack/get/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("/bill/query1/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "根据通知单查询明细") | 
|---|
|  |  |  | public R billQuery1(@RequestParam String billNo, @RequestParam String size) { | 
|---|
|  |  |  | System.out.println("-------------------------"); | 
|---|
|  |  |  | System.out.println(billNo); | 
|---|
|  |  |  | System.out.println(size); | 
|---|
|  |  |  | List<OrderDetl> waitMatins = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", billNo).like("model", size).last("and anfme > work_qty")); | 
|---|
|  |  |  | //        List<WaitMatin> waitMatins = waitMatinService.selectList(new EntityWrapper<WaitMatin>().eq("bill_no", billNo).last("and qty > in_qty")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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")); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(waitMatins)) { | 
|---|
|  |  |  | for (OrderDetl waitMatin : waitMatins) { | 
|---|
|  |  |  | CombBillQueryVo vo = new CombBillQueryVo(); | 
|---|
|  |  |  | vo.setDetlId(waitMatin.getId()); | 
|---|
|  |  |  | vo.setMatnr(waitMatin.getMatnr()); | 
|---|
|  |  |  | vo.setMatName(waitMatin.getMaktx()); | 
|---|
|  |  |  | vo.setQty(waitMatin.getAnfme()); | 
|---|
|  |  |  | 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.getSpecs()); | 
|---|
|  |  |  | vo.setSize(waitMatin.getModel()); | 
|---|
|  |  |  | vo.setColor(waitMatin.getColor()); | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | System.out.println(waitMatin.getAnfme()); | 
|---|
|  |  |  | System.out.println(waitMatin.getWorkQty()); | 
|---|
|  |  |  | System.out.println(vo); | 
|---|
|  |  |  | //                10.0 | 
|---|
|  |  |  | //                0.0 | 
|---|
|  |  |  | //                CombBillQueryVo(billNo=ZJFLC2407280005, seqNo=1, matNo=41011659, matName=弹簧盘, specs=null, size=null, color=null, count=10.0, qty=0.0, unit=Pcs, type=null, itemBatch=, oveFlag=null) | 
|---|
|  |  |  | //                10.0 | 
|---|
|  |  |  | //                0.0 | 
|---|
|  |  |  | //                CombBillQueryVo(billNo=ZJFLC2407280005, seqNo=2, matNo=4103020554, matName=支架, specs=null, size=null, color=null, count=10.0, qty=0.0, unit=Pcs, type=null, itemBatch=, oveFlag=null) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(vos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|