|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.Wrapper; | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.BaseRes; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.common.model.WrkDto; | 
|---|
|  |  |  | import com.zy.common.service.CommonService; | 
|---|
|  |  |  | 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.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 移动端接口控制器 | 
|---|
|  |  |  | 
|---|
|  |  |  | private MatBarcodeService matBarcodeService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CommonService commonService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WorkService workService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static Logger logger = LogManager.getLogger(MobileController.class); | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/comb/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "组托") | 
|---|
|  |  |  | public R comb(@RequestBody CombParam combParam) { | 
|---|
|  |  |  | logger.info("组托参数:{}",combParam); | 
|---|
|  |  |  | logger.info("组托参数:{}", combParam); | 
|---|
|  |  |  | if (Cools.isEmpty(combParam.getOrderNo())) { | 
|---|
|  |  |  | combParam.setOrderNo(combParam.getBillNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/pickIn/auth") | 
|---|
|  |  |  | //    @ManagerAuth(memo="盘点入库") | 
|---|
|  |  |  | public R pickIn(@RequestParam String barcode){ | 
|---|
|  |  |  | public R pickIn(@RequestParam String barcode) { | 
|---|
|  |  |  | WrkMast wrkMast = wrkMastService.selectByBarcode(barcode); | 
|---|
|  |  |  | List<PickInParam> param = wrkDetlService.selectDetByBarcode(barcode); | 
|---|
|  |  |  | for(PickInParam pickInParam : param){ | 
|---|
|  |  |  | for (PickInParam pickInParam : param) { | 
|---|
|  |  |  | pickInParam.setStaNo(wrkMast.getStaNo()); | 
|---|
|  |  |  | pickInParam.setWorkNo(wrkMast.getWrkNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ManagerAuth(memo = "PDA呼叫托盘出库") | 
|---|
|  |  |  | public R callBarcode(@RequestBody CombParam combParam) { | 
|---|
|  |  |  | logger.info("PDA呼叫托盘出库"); | 
|---|
|  |  |  | if (combParam == null){ | 
|---|
|  |  |  | if (combParam == null) { | 
|---|
|  |  |  | return R.parse(BaseRes.PARAM); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | combParam.getCombMats().forEach(combMat -> { | 
|---|
|  |  |  | Mat mat = matService.selectByMatnr(combMat.getMatnr()); | 
|---|
|  |  |  | if (mat == null){ | 
|---|
|  |  |  | if (mat == null) { | 
|---|
|  |  |  | throw new CoolException("商品档案不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | MatBarcode matBarcode = matBarcodeService.selectbyMatnr(combMat.getMatnr()); | 
|---|
|  |  |  | if (matBarcode == null){ | 
|---|
|  |  |  | if (matBarcode == null) { | 
|---|
|  |  |  | throw new CoolException("该物料未与托盘绑定"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LocMast locMast=locMastService.selectByBarcode(matBarcode.getZpallet()); | 
|---|
|  |  |  | if (locMast == null){ | 
|---|
|  |  |  | LocMast locMast = locMastService.selectByBarcode(matBarcode.getZpallet()); | 
|---|
|  |  |  | if (locMast == null) { | 
|---|
|  |  |  | throw new CoolException("未找到与该物料绑定的托盘"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int wrkNo=commonService.getWorkNo(0); | 
|---|
|  |  |  | int wrkNo = commonService.getWorkNo(0); | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | //生成工作档 | 
|---|
|  |  |  | WrkMast wrkMast=new WrkMast(); | 
|---|
|  |  |  | WrkMast wrkMast = new WrkMast(); | 
|---|
|  |  |  | wrkMast.setWrkNo(wrkNo); | 
|---|
|  |  |  | wrkMast.setIoTime(new Date()); | 
|---|
|  |  |  | wrkMast.setWrkSts(11L);//工作状态:生成出库ID | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/combMeger/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "并板") | 
|---|
|  |  |  | public synchronized R adjustNewV2(@RequestBody MobileAdjustParam combParam) { | 
|---|
|  |  |  | mobileService.adjustNew(combParam, Boolean.TRUE, getUserId()); | 
|---|
|  |  |  | return R.ok("并板成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/empty/plate/out/start") | 
|---|
|  |  |  | @ManagerAuth(memo = "空板出库") | 
|---|
|  |  |  | public R emptyPlateOutStart(EmptyPlateOutParam param) { | 
|---|
|  |  |  | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").eq("loc_type1", param.getType()).in("row1", 2, 3)); | 
|---|
|  |  |  | if (locMasts == null || locMasts.isEmpty()) { | 
|---|
|  |  |  | locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").eq("loc_type1", param.getType()).in("row1", 1, 4)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (locMasts == null || locMasts.isEmpty()){ | 
|---|
|  |  |  | return R.error("无空板库位"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | param.setOutSite(1103); | 
|---|
|  |  |  | List<String> locNos = param.getLocNos(); | 
|---|
|  |  |  | if (locNos == null){ | 
|---|
|  |  |  | locNos = new ArrayList<>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | locNos.add(locMasts.get(0).getLocNo()); | 
|---|
|  |  |  | param.setLocNos(locNos); | 
|---|
|  |  |  | workService.emptyPlateOut(param, getUserId()); | 
|---|
|  |  |  | return R.ok("出库启动成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|