| package com.zy.asrs.controller; | 
|   | 
| import com.core.annotations.ManagerAuth; | 
| import com.core.common.R; | 
| import com.zy.asrs.entity.WaitPakin; | 
| import com.zy.asrs.entity.param.EmptyPlateOutParam; | 
| import com.zy.asrs.entity.param.FullStoreParam; | 
| import com.zy.asrs.entity.param.LocDetlAdjustParam; | 
| import com.zy.asrs.entity.param.StockOutParam; | 
| import com.zy.asrs.service.BasDevpService; | 
| import com.zy.asrs.service.WorkService; | 
| import com.zy.asrs.service.WrkMastService; | 
| import com.zy.common.model.StartupDto; | 
| import com.zy.common.web.BaseController; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.RequestBody; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.RequestParam; | 
| import org.springframework.web.bind.annotation.RestController; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.HashMap; | 
| import java.util.List; | 
| import java.util.Map; | 
|   | 
| /** | 
|  * 工作流接口控制器 | 
|  * Created by vincent on 2020/6/10 | 
|  */ | 
| @RestController | 
| public class WorkController extends BaseController { | 
|   | 
|     @Autowired | 
|     private WorkService workService; | 
|     @Autowired | 
|     private BasDevpService basDevpService; | 
|     @Autowired | 
|     private WrkMastService wrkMastService; | 
|   | 
|     @RequestMapping("/available/put/site") | 
|     @ManagerAuth() | 
|     public R availablePutSite(){ | 
|         return R.ok().add(basDevpService.getAvailableInSite()); | 
|     } | 
|   | 
|     @RequestMapping("/available/empty/put/site") | 
|     @ManagerAuth() | 
|     public R availableEmptyPutSite(){ | 
|         return R.ok().add(basDevpService.getAvailableEmptyInSite()); | 
|     } | 
|   | 
|     @RequestMapping("/available/take/site") | 
|     @ManagerAuth() | 
|     public R availableTakeSite(){ | 
|         List<Map<String, Object>> result = new ArrayList<>(); | 
|         List<Integer> outSite = basDevpService.getAvailableOutSite(101); | 
|         for (Integer siteId : outSite) { | 
|             Map<String, Object> map = new HashMap<>(); | 
|             map.put("siteId", siteId); | 
|             map.put("desc", siteId + "(全板出库口)"); | 
|             result.add(map); | 
|         } | 
|         List<Integer> pickOutSite = basDevpService.getAvailableOutSite(103); | 
|         for (Integer siteId : pickOutSite) { | 
|             Map<String, Object> map = new HashMap<>(); | 
|             map.put("siteId", siteId); | 
|             map.put("desc", siteId + "(拣料出库口)"); | 
|             result.add(map); | 
|         } | 
|         return R.ok().add(result); | 
|     } | 
|   | 
|     @RequestMapping("/available/take/check/site") | 
|     @ManagerAuth() | 
|     public R availableTakeCheckSite(){ | 
|         return R.ok().add(basDevpService.getAvailableOutSite(107)); | 
|     } | 
|   | 
|     @RequestMapping("/available/empty/take/site") | 
|     @ManagerAuth() | 
|     public R availableEmptyTakeSite(){ | 
|         return R.ok().add(basDevpService.getAvailableEmptyOutSite()); | 
|     } | 
|   | 
|     @RequestMapping("/full/store/put/start") | 
|     @ManagerAuth(memo = "全板入库") | 
|     public R fullStorePutStart(@RequestBody FullStoreParam fullStoreParam) { | 
|         return R.ok("入库启动成功").add(workService.startupFullPutStore(fullStoreParam,getUserId())); | 
|     } | 
|   | 
|     @RequestMapping("/plate/out/start") | 
|     @ManagerAuth(memo = "出库作业") | 
|     public R fullStoreTakeStart(@RequestBody StockOutParam param) { | 
|         workService.startupFullTakeStore(param, getUserId()); | 
|         return R.ok("出库启动成功"); | 
|     } | 
|   | 
|     @RequestMapping("/empty/plate/in/start") | 
|     @ManagerAuth(memo = "空板入库") | 
|     public R emptyPlateInStart(@RequestParam Integer sourceStaNo) { | 
|         return R.ok("入库启动成功").add(workService.emptyPlateIn(sourceStaNo, getUserId())); | 
|     } | 
|   | 
|     @RequestMapping("/empty/plate/out/start") | 
|     @ManagerAuth(memo = "空板出库") | 
|     public R emptyPlateOutStart(EmptyPlateOutParam param) { | 
|         workService.emptyPlateOut(param, getUserId()); | 
|         return R.ok("出库启动成功"); | 
|     } | 
|   | 
|     @RequestMapping("/locCheck/out/start") | 
|     @ManagerAuth(memo = "盘点出库") | 
|     public R locCheckOutStart(@RequestBody StockOutParam param) { | 
|         workService.locCheckOut(param, getUserId()); | 
|         return R.ok("出库启动成功"); | 
|     } | 
|   | 
|     @RequestMapping("/loc/move/start") | 
|     @ManagerAuth(memo = "库位移转") | 
|     public R locMoveStart(@RequestParam String sourceLocNo, | 
|                           @RequestParam String targetLocNo) { | 
|         workService.locMove(sourceLocNo, targetLocNo, getUserId()); | 
|         return R.ok("移库启动成功"); | 
|     } | 
|   | 
|     @RequestMapping("/locDdetl/adjust/start") | 
|     @ManagerAuth(memo = "库存调整") | 
|     public R locDetlAdjustStart(@RequestBody LocDetlAdjustParam param) { | 
|         workService.adjustLocDetl(param, getUserId()); | 
|         return R.ok("库存调整成功"); | 
|     } | 
|   | 
|     @RequestMapping("/hand/control/wrkMast") | 
|     @ManagerAuth(memo = "手动处理工作档") | 
|     public R handControlWrkMast(@RequestParam String workNo, | 
|                                 @RequestParam Integer type){ | 
|         if (type == 1) { | 
|             workService.completeWrkMast(workNo, getUserId()); | 
|             return R.ok("工作档已完成"); | 
|         } else if (type == 2) { | 
|             workService.cancelWrkMast(workNo, getUserId()); | 
|             return R.ok("工作档已取消"); | 
|         } else if (type == 3) { | 
|             workService.pickWrkMast(workNo, getUserId()); | 
|             return R.ok("工作档已拣料"); | 
|         } | 
|         return R.ok(); | 
|     } | 
|   | 
|     @RequestMapping("/create/waitPain/wrkMast/start") | 
|     @ManagerAuth(memo = "生成任务") | 
|     public R createWaitPainWrkMastStart(@RequestBody List<WaitPakin> list) { | 
|         StartupDto startupDto = workService.createWaitPainWrkMastStart(list, getUserId()); | 
|         return R.ok("任务号:" + startupDto.getWorkNo() + ";目标库位:" + startupDto.getLocNo()); | 
|     } | 
|   | 
|     @RequestMapping("/deal/preHave/start") | 
|     @ManagerAuth(memo = "先入品处理") | 
|     public R dealPreHave(@RequestParam Integer wrkNo) { | 
|         String locNo = workService.dealPreHaveStart(wrkNo, getUserId()); | 
|         return R.ok("任务重新入库,目标库位:" + locNo); | 
|     } | 
|   | 
|     @RequestMapping("/deal/steNo/empty") | 
|     @ManagerAuth(memo = "清除小车") | 
|     public R dealSteNoEmpty(@RequestParam Integer wrkNo) { | 
|         return wrkMastService.setSteEmpty(wrkNo)?R.ok():R.error(); | 
|     } | 
|   | 
| } |