|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.wms.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.CodeRes; | 
|---|
|  |  |  | import com.zy.asrs.common.domain.enums.LoginSystemType; | 
|---|
|  |  |  | import com.zy.asrs.framework.annotations.ManagerAuth; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import com.zy.asrs.framework.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.CacheSite; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.Loc; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.WaitPakin; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.dto.OrderInfoDto; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.dto.PickSheetDetlDto; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.dto.ShippingOrderDetlDto; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.enums.OrderType; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.param.BatchMergeOrdersParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.param.PageRequest; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.entity.param.PakinOnShelvesParams; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.MobileService; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.OrderService; | 
|---|
|  |  |  | import com.zy.asrs.wms.asrs.service.WaitPakinService; | 
|---|
|  |  |  | import com.zy.asrs.wms.common.domain.BaseParam; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.controller.BaseController; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.entity.Host; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.entity.User; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.entity.UserLogin; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.service.HostService; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.service.UserLoginService; | 
|---|
|  |  |  | import com.zy.asrs.wms.system.service.UserService; | 
|---|
|  |  |  | import io.jsonwebtoken.lang.Collections; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import sun.nio.ch.IOStatus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping("/mat/auth") | 
|---|
|  |  |  | public R getProductForBarcode(@RequestBody Map<String, String> barcode) { | 
|---|
|  |  |  | if (Objects.isNull(barcode)) { | 
|---|
|  |  |  | return  R.error("参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (StringUtil.isNullOrEmpty(barcode.get("barcode"))) { | 
|---|
|  |  |  | return  R.error("条码不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Order order =  orderService.selectByBarcode(barcode.get("barcode")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (Objects.isNull(order)) { | 
|---|
|  |  |  | return R.error("订单不存在!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<OrderInfoDto> orders = orderService.getDetlForOrderId(order.getId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if (StringUtil.isNullOrEmpty(code)) { | 
|---|
|  |  |  | return R.error("托盘码不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String str = code.trim(); | 
|---|
|  |  |  | // CUT库条码T开头,截取后10位 | 
|---|
|  |  |  | if (str.charAt(0) == 'T') { | 
|---|
|  |  |  | code = str.substring(str.length() - 10); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, code)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok(waitPakins); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.parse(CodeRes.USER_10003); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String system = null;//登陆系统 | 
|---|
|  |  |  | if (wms) { | 
|---|
|  |  |  | if (Objects.isNull(wms) || wms) { | 
|---|
|  |  |  | system = String.valueOf(LoginSystemType.WMS); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | system = String.valueOf(LoginSystemType.WCS); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author Ryan | 
|---|
|  |  |  | * @date 2025/6/25 | 
|---|
|  |  |  | * @description: 组托 | 
|---|
|  |  |  | * @version 1.0 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @PostMapping("/comb/auth") | 
|---|
|  |  |  | public  R combMats(@RequestBody BatchMergeOrdersParam ordersParam) { | 
|---|
|  |  |  | if (StringUtil.isNullOrEmpty(ordersParam.getOrderNo())) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.error("订单明细不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String str = ordersParam.getMergeNo().trim(); | 
|---|
|  |  |  | // CTU库条码T开头,截取后10位 | 
|---|
|  |  |  | if (str.charAt(0) == 'T') { | 
|---|
|  |  |  | ordersParam.setMergeNo(str.substring(str.length() - 10)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (str.startsWith("PK")) { | 
|---|
|  |  |  | ordersParam.setInType(OrderType.PK_IN_ORDER.id); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | ordersParam.setInType(OrderType.UTC_OUT_ORDER.id); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | boolean result = mobileService.batchMergeOrders(ordersParam); | 
|---|
|  |  |  | if (result) { | 
|---|
|  |  |  | return R.ok("组托成功!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new CoolException("请求参数不能为空!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Objects.isNull(param.get("barcode"))) { | 
|---|
|  |  |  | throw new CoolException("容器编码不能为空"); | 
|---|
|  |  |  | throw new CoolException("播种墙容器编码不能为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Objects.isNull(param.get("orderNo"))) { | 
|---|
|  |  |  | throw new CoolException("订单编号不能为空!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | return mobileService.selectShippingDetl(params); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author Ryan | 
|---|
|  |  |  | * @date 2025/6/28 | 
|---|
|  |  |  | * @description: 获取推荐库位 | 
|---|
|  |  |  | * @version 1.0 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping("/recommend/locs") | 
|---|
|  |  |  | public R getRecommend() { | 
|---|
|  |  |  | return  mobileService.getRecommendLocs(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author Ryan | 
|---|
|  |  |  | * @date 2025/6/28 | 
|---|
|  |  |  | * @description: 查询物料信息 | 
|---|
|  |  |  | * @version 1.0 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping("/mats/search/{matnr}") | 
|---|
|  |  |  | public R getMats(@PathVariable String matnr) { | 
|---|
|  |  |  | return mobileService.getMatsByCode(matnr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 确认发货单明细 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return mobileService.confirmShippingDetl(params); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|