| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | |
| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private RgvOneSignService rgvOneSignService; |
| | | @Autowired |
| | | private OrderGiftService orderGiftService; |
| | | @Autowired |
| | | private OrderDetlGiftService orderDetlGiftService; |
| | | |
| | | |
| | | // 商品上架 |
| | |
| | | public R matOffSale(@RequestBody OffSaleParam offSaleParam){ |
| | | mobileService.offSale(offSaleParam); |
| | | return R.ok("下架成功"); |
| | | } |
| | | |
| | | @RequestMapping("/search/sign/auth/v2") |
| | | @ManagerAuth(memo = "拆叠盘模式切换") |
| | | public R orderSearchByBarcodeV2(@RequestParam boolean sign){ |
| | | RgvOneSign rgvOneSign = rgvOneSignService.selectOne(new EntityWrapper<RgvOneSign>().eq("rgv_one_type","oneSign")); |
| | | if (sign){ |
| | | rgvOneSign.setRgvOneSign(1-rgvOneSign.getRgvOneSign()); |
| | | rgvOneSignService.updateById(rgvOneSign); |
| | | } |
| | | return R.ok(rgvOneSign.getRgvOneSign()); |
| | | } |
| | | |
| | | |
| | |
| | | return R.ok().add(combParams); |
| | | } |
| | | |
| | | @RequestMapping("/order/search/orderNo/auth/v2") |
| | | @ManagerAuth(memo = "退库单获取") |
| | | public R orderSearchByBarcodeV2(@RequestParam String orderNo){ |
| | | if (Cools.isEmpty(orderNo)){ |
| | | orderNo=null; |
| | | } |
| | | List<Order> orders = orderService.selectorderNoLT(orderNo); |
| | | 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 (order == null) { |
| | | continue; |
| | | } |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (docType.getPakin() == null || docType.getPakin() != 1 || !docType.getDocName().equals("退货入库单")) { |
| | | continue; |
| | | } |
| | | if (order.getSettle() > 2) { |
| | | continue; |
| | | } |
| | | List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); |
| | | if (!Cools.isEmpty(orderDetls)) { |
| | | LinkedList<CombParam.CombMat> combMats = new LinkedList<>(); |
| | | for (OrderDetl orderDetl:orderDetls){ |
| | | if (orderDetl.getWorkQty()!=0){ |
| | | continue; |
| | | } |
| | | CombParam.CombMat combMat = new CombParam.CombMat(); |
| | | combMat.setMatnr(orderDetl.getMatnr()); |
| | | combMat.setBatch(orderDetl.getBatch()); |
| | | combMat.setAnfme(orderDetl.getAnfme()-orderDetl.getWorkQty()); |
| | | combMat.setMaktx(orderDetl.getMaktx()); |
| | | combMat.setSpecs(orderDetl.getSpecs()); |
| | | combMat.setWeight(orderDetl.getWeight()); |
| | | combMats.add(combMat); |
| | | } |
| | | if (combMats.size()==0){ |
| | | continue; |
| | | } |
| | | combParam.setCombMats(combMats); |
| | | } |
| | | combParam.setOrderNo(order.getOrderNo()); |
| | | combParams.add(combParam); |
| | | } |
| | | } |
| | | return R.ok().add(combParams); |
| | | } |
| | | |
| | | @RequestMapping("/wrkDetl/search/batch/auth") |
| | | @ManagerAuth(memo = "出库确认获取信息") |
| | | public R wrkDetlSearchByBatch(@RequestBody String batch){ |
| | | if (Cools.isEmpty(batch)){ |
| | | return R.error("参数为空"); |
| | | } |
| | | // List<Order> orders = orderService.selectorderNoL(batch); |
| | | WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", batch)); |
| | | if (Cools.isEmpty(wrkDetl)){ |
| | | WrkDetlLog wrkDetlLog = wrkDetlLogService.selectOne(new EntityWrapper<WrkDetlLog>().eq("batch", batch)); |
| | | if (Cools.isEmpty(wrkDetlLog)){ |
| | | return R.error("未查到数据"); |
| | | public R wrkDetlSearchByBatch(@RequestBody OrderGiftParam param){ |
| | | try{ |
| | | String length = param.getLength(); |
| | | String lengthS = length.split(" ")[0]; |
| | | Double price = Double.valueOf(lengthS); |
| | | String grossWeight = param.getGrossWeight(); |
| | | String grossWeightS = grossWeight.split(" ")[0]; |
| | | Double volume = Double.valueOf(grossWeightS); |
| | | String netWeight = param.getNetWeight(); |
| | | String netWeightS = netWeight.split(" ")[0]; |
| | | Double weight = Double.valueOf(netWeightS); |
| | | String splices = param.getSplices(); |
| | | String splicesS = splices.split(" ")[0]; |
| | | List<OrderDetlGift> orderDetlGifts = orderDetlGiftService.selectList(new EntityWrapper<OrderDetlGift>() |
| | | .eq("matnr", param.getSpecs()) |
| | | .eq("batch", param.getBoxNo()) |
| | | .eq("model", param.getRollNo()) |
| | | .eq("price", price) |
| | | .eq("weight", weight) |
| | | .eq("volume", volume) |
| | | .eq("specs", splicesS)); |
| | | if (orderDetlGifts.isEmpty()){ |
| | | return R.error("查询信息异常,未匹配到明细").add("未匹配到明细"); |
| | | } |
| | | wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(wrkDetlLog); |
| | | wrkDetl.setBatch(wrkDetlLog.getBatch()); |
| | | wrkDetl.setBarcode(wrkDetlLog.getBarcode()); |
| | | wrkDetl.setDeadTime(wrkDetlLog.getDeadTime()); |
| | | if (orderDetlGifts.size()>1){ |
| | | return R.error("查询信息异常,存在多条明细").add("存在多条明细"); |
| | | } |
| | | OrderDetlGift orderDetlGift = orderDetlGifts.get(0); |
| | | // orderDetlGift.setSource(1); |
| | | // orderDetlGift.setDeadTime(orderDetlGift.getSource$()); |
| | | // orderDetlGiftService.updateById(orderDetlGift); |
| | | return R.ok("确认成功").add(orderDetlGift); |
| | | } catch (Exception e){ |
| | | return R.error("查询信息异常,未匹配到明细").add("未匹配到明细"); |
| | | } |
| | | if (Cools.isEmpty(wrkDetl)){ |
| | | return R.error("未查到数据"); |
| | | } |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | |
| | | @RequestMapping("/order/search/batch/auth") |
| | | @ManagerAuth(memo = "出库确认") |
| | | public R orderSearchByBatch(@RequestBody String batch){ |
| | | if (Cools.isEmpty(batch)){ |
| | | return R.error("参数为空"); |
| | | } |
| | | String orderNo = ""; |
| | | WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", batch)); |
| | | if (Cools.isEmpty(wrkDetl)) { |
| | | WrkDetlLog wrkDetlLog = wrkDetlLogService.selectOne(new EntityWrapper<WrkDetlLog>().eq("batch", batch)); |
| | | if (Cools.isEmpty(wrkDetlLog)) { |
| | | return R.error("未查到数据"); |
| | | public R orderSearchByBatch(@RequestBody OrderGiftParam param){ |
| | | try{ |
| | | String length = param.getLength(); |
| | | String lengthS = length.split(" ")[0]; |
| | | Double price = Double.valueOf(lengthS); |
| | | String grossWeight = param.getGrossWeight(); |
| | | String grossWeightS = grossWeight.split(" ")[0]; |
| | | Double volume = Double.valueOf(grossWeightS); |
| | | String netWeight = param.getNetWeight(); |
| | | String netWeightS = netWeight.split(" ")[0]; |
| | | Double weight = Double.valueOf(netWeightS); |
| | | String splices = param.getSplices(); |
| | | String splicesS = splices.split(" ")[0]; |
| | | List<OrderDetlGift> orderDetlGifts = orderDetlGiftService.selectList(new EntityWrapper<OrderDetlGift>() |
| | | .eq("matnr", param.getSpecs()) |
| | | .eq("batch", param.getBoxNo()) |
| | | .eq("model", param.getRollNo()) |
| | | .eq("price", price) |
| | | .eq("weight", weight) |
| | | .eq("volume", volume) |
| | | .eq("specs", splicesS)); |
| | | if (orderDetlGifts.isEmpty()){ |
| | | return R.error("查询信息异常,未匹配到明细").add("未匹配到明细"); |
| | | } |
| | | orderNo=wrkDetlLog.getOrderNo(); |
| | | }else { |
| | | orderNo=wrkDetl.getOrderNo(); |
| | | if (orderDetlGifts.size()>1){ |
| | | return R.error("查询信息异常,存在多条明细").add("存在多条明细"); |
| | | } |
| | | OrderDetlGift orderDetlGift = orderDetlGifts.get(0); |
| | | orderDetlGift.setSource(1); |
| | | orderDetlGiftService.updateById(orderDetlGift); |
| | | orderDetlGift.setDeadTime(orderDetlGift.getSource$()); |
| | | return R.ok("确认成功").add(orderDetlGift); |
| | | } catch (Exception e){ |
| | | return R.error("查询信息异常,未匹配到明细").add("未匹配到明细"); |
| | | } |
| | | // List<Order> orders = orderService.selectorderNoL(batch); |
| | | OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("batch", batch).eq("order_no",orderNo)); |
| | | if (Cools.isEmpty(orderDetl)){ |
| | | return R.error("未查到数据"); |
| | | } |
| | | if (!orderDetl.getQty$().equals("已完成")){ |
| | | return R.error("任务未完成"); |
| | | } |
| | | orderDetl.setSource(1); |
| | | orderDetlService.updateById(orderDetl); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/truss/auth") |
| | | @ManagerAuth(memo = "退库,1楼桁架退库") |
| | | public R trussComb(@RequestBody TrussCombParam combParam){ |
| | | mobileService.trussComb(combParam, getUserId()); |
| | | @RequestMapping("/order/search/batch/new/auth") |
| | | @ManagerAuth(memo = "出库确认") |
| | | public R orderSearchByBatchNew(@RequestBody OrderGiftParam param){ |
| | | try{ |
| | | // String length = param.getLength(); |
| | | // String lengthS = length.split(" ")[0]; |
| | | // Double price = Double.valueOf(lengthS); |
| | | // String grossWeight = param.getGrossWeight(); |
| | | // String grossWeightS = grossWeight.split(" ")[0]; |
| | | // Double volume = Double.valueOf(grossWeightS); |
| | | String netWeight = param.getNetWeight(); |
| | | String netWeightS = netWeight.split(" ")[0]; |
| | | Double weight = Double.valueOf(netWeightS); |
| | | // String splices = param.getSplices(); |
| | | // String splicesS = splices.split(" ")[0]; |
| | | List<OrderDetlGift> orderDetlGifts = orderDetlGiftService.selectList(new EntityWrapper<OrderDetlGift>() |
| | | .eq("order_no", param.getOrderNo()) |
| | | // .eq("matnr", param.getSpecs()) |
| | | .eq("batch", param.getBoxNo()) |
| | | // .eq("model", param.getRollNo()) |
| | | // .eq("price", price) |
| | | .eq("weight", weight)); |
| | | // .eq("volume", volume) |
| | | // .eq("specs", splicesS)); |
| | | if (orderDetlGifts.isEmpty()){ |
| | | return R.error("查询信息异常,未匹配到明细").add("未匹配到明细"); |
| | | } |
| | | if (orderDetlGifts.size()>1){ |
| | | return R.error("查询信息异常,存在多条明细").add("存在多条明细"); |
| | | } |
| | | OrderDetlGift orderDetlGift = orderDetlGifts.get(0); |
| | | orderDetlGift.setSource(1); |
| | | orderDetlGiftService.updateById(orderDetlGift); |
| | | orderDetlGift.setDeadTime(orderDetlGift.getSource$()); |
| | | return R.ok("确认成功").add(orderDetlGift); |
| | | } catch (Exception e){ |
| | | return R.error("查询信息异常,未匹配到明细").add("未匹配到明细"); |
| | | } |
| | | } |
| | | |
| | | // @RequestMapping("/wrkDetl/search/batch/auth") |
| | | // @ManagerAuth(memo = "出库确认获取信息") |
| | | // public R wrkDetlSearchByBatch(@RequestBody String batch){ |
| | | // if (Cools.isEmpty(batch)){ |
| | | // return R.error("参数为空"); |
| | | // } |
| | | // String[] batch1 = batch.split("箱号:"); |
| | | // String[] batch2 = batch1[1].split("规格:"); |
| | | // batch = batch2[0].replaceAll(" ", ""); |
| | | //// List<Order> orders = orderService.selectorderNoL(batch); |
| | | // WrkDetl wrkDetl = wrkDetlService.selectWrkDetlByOrderNoNotNull(batch); |
| | | //// WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", batch).and().ne("order_no","").and().isNotNull("order_no").orderBy("io_time",false)); |
| | | // if (Cools.isEmpty(wrkDetl)){ |
| | | // WrkDetlLog wrkDetlLog = wrkDetlLogService.selectWrkDetlLogByOrderNoNotNull(batch); |
| | | //// WrkDetlLog wrkDetlLog = wrkDetlLogService.selectOne(new EntityWrapper<WrkDetlLog>().eq("batch", batch).and().ne("order_no","").and().isNotNull("order_no").orderBy("io_time",false)); |
| | | // if (Cools.isEmpty(wrkDetlLog)){ |
| | | // return R.error("未查到数据"); |
| | | // } |
| | | // wrkDetl = new WrkDetl(); |
| | | // wrkDetl.sync(wrkDetlLog); |
| | | // wrkDetl.setBatch(wrkDetlLog.getBatch()); |
| | | // wrkDetl.setBarcode(wrkDetlLog.getBarcode()); |
| | | // wrkDetl.setDeadTime(wrkDetlLog.getDeadTime()); |
| | | // } |
| | | // if (Cools.isEmpty(wrkDetl)){ |
| | | // return R.error("未查到数据"); |
| | | // } |
| | | // return R.ok().add(wrkDetl); |
| | | // } |
| | | |
| | | |
| | | // @RequestMapping("/order/search/batch/auth") |
| | | // @ManagerAuth(memo = "出库确认") |
| | | // public R orderSearchByBatch(@RequestBody String batch){ |
| | | // try{ |
| | | // if (Cools.isEmpty(batch)){ |
| | | // return R.error("参数为空"); |
| | | // } |
| | | //// String[] batch1 = batch.split("箱号:"); |
| | | //// String[] batch2 = batch1[1].split("规格:"); |
| | | //// batch = batch2[0]; |
| | | // String orderNo = ""; |
| | | //// WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", batch).and().ne("order_no","").and().isNotNull("order_no").orderBy("io_time",false)); |
| | | // WrkDetl wrkDetl = wrkDetlService.selectWrkDetlByOrderNoNotNull(batch); |
| | | // if (Cools.isEmpty(wrkDetl)) { |
| | | //// WrkDetlLog wrkDetlLog = wrkDetlLogService.selectOne(new EntityWrapper<WrkDetlLog>().eq("batch", batch).and().ne("order_no","").and().isNotNull("order_no").orderBy("io_time",false)); |
| | | // WrkDetlLog wrkDetlLog = wrkDetlLogService.selectWrkDetlLogByOrderNoNotNull(batch); |
| | | // if (Cools.isEmpty(wrkDetlLog)) { |
| | | // return R.error("未查到数据:工作明细为空"); |
| | | // } |
| | | // if (wrkDetlLog.getDeadTime().equals("已确认")) { |
| | | // return R.error("当前任务已确认,请重置!"); |
| | | // } |
| | | // wrkDetlLog.setSource(1); |
| | | // wrkDetlLogService.update(wrkDetlLog,new EntityWrapper<WrkDetlLog>().eq("batch",wrkDetlLog.getBatch()).eq("wrk_no",wrkDetlLog.getWrkNo())); |
| | | // orderNo=wrkDetlLog.getOrderNo(); |
| | | // }else { |
| | | // if (wrkDetl.getDeadTime().equals("已确认")) { |
| | | // return R.error("当前任务已确认,请重置!"); |
| | | // } |
| | | // wrkDetl.setSource(1); |
| | | // wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch()).eq("wrk_no",wrkDetl.getWrkNo())); |
| | | // orderNo=wrkDetl.getOrderNo(); |
| | | // } |
| | | //// List<Order> orders = orderService.selectorderNoL(batch); |
| | | // OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("batch", batch).eq("order_no",orderNo)); |
| | | // if (Cools.isEmpty(orderDetl)){ |
| | | // return R.error("未查到数据:订单明细为空"+orderNo); |
| | | // } |
| | | // if (!orderDetl.getQty$().equals("已完成")){ |
| | | // return R.error("任务未完成"); |
| | | // } |
| | | // if (!Cools.isEmpty(orderDetl.getSource()) && orderDetl.getSource()==1){ |
| | | // return R.error("任务已确认,请勿重复确认!!!"); |
| | | // } |
| | | // orderDetl.setSource(1); |
| | | // orderDetlService.updateById(orderDetl); |
| | | // return R.ok(); |
| | | // } catch (Exception e){ |
| | | // return R.error().add(e.getMessage()); |
| | | // } |
| | | // } |
| | | |
| | | // @RequestMapping("/truss/auth") |
| | | // @ManagerAuth(memo = "退库,1楼桁架退库") |
| | | // public R trussComb(@RequestBody TrussCombParam combParam){ |
| | | // mobileService.trussComb(combParam, getUserId()); |
| | | // return R.ok("组托成功"); |
| | | // } |
| | | |
| | | @RequestMapping("/truss/order/auth") |
| | | @ManagerAuth(memo = "退库,1楼桁架退库,退库单退库") |
| | | public R trussCombOrder(@RequestBody TrussCombParam combParam){ |
| | | mobileService.trussCombOrder(combParam, getUserId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/truss/comd/auth") |
| | | @ManagerAuth(memo = "手动入库,2楼无需桁架手动入库") |
| | | public R trussComb2(@RequestBody PalletizingCompleteParam combParam){ |
| | | mobileService.trussComb2(combParam, getUserId()); |
| | | // @ManagerAuth(memo = "手动入库,2楼无需桁架手动入库 wms入库") |
| | | public R PalletizingCompleteTwoFloorParam(@RequestBody PalletizingCompleteTwoFloorParam combParam){ |
| | | mobileService.PalletizingCompleteTwoFloorParam(combParam); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | /** |
| | | * 中控:2楼212叫托盘 |
| | | */ |
| | | @PostMapping("/balcony/complete/car/auth/v1") |
| | | // @AppAuth(memo = "中控:2楼212叫托盘") |
| | | public synchronized R balconyCompleteCar() { |
| | | // mobileService.trussComb2Car(212); |
| | | return R.error("已禁用").add("已禁用"); |
| | | } |
| | | |
| | | /** |
| | | * 中控:获取箱型编号 |
| | | */ |
| | | @PostMapping("/box/type/complete/auth/v1") |
| | | // @AppAuth(memo = "中控:获取箱型编号") |
| | | public synchronized R boxTypeCompleteCar() { |
| | | List<Map<String, Object>> maps = mobileService.boxTypeComb(); |
| | | return R.ok().add(maps); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/comb/auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb(@RequestBody CombParam combParam){ |