package com.zy.asrs.controller; import com.core.common.R; import com.zy.asrs.entity.AgvBasDevp; import com.zy.asrs.entity.param.CombParam; import com.zy.asrs.service.AgvBasDevpService; import com.zy.asrs.service.AgvMobileService; import com.zy.asrs.service.AgvWorkService; import com.zy.asrs.service.OrderDetlService; import com.zy.common.web.BaseController; import lombok.Synchronized; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * 移动端接口控制器 * Created by vincent on 2020/6/10 */ @RestController @RequestMapping("agvMobile") public class AgvMobileController extends BaseController { @Autowired private AgvMobileService agvMobileService; @Autowired private AgvBasDevpService agvBasDevpService; @Autowired private AgvWorkService workService; @Autowired private OrderDetlService orderDetlService; /* locno?组托+绑定暂存位 : 组托 */ @PostMapping("/comb/auth") public R comb(@RequestBody CombParam combParam){ String message = agvMobileService.comb(combParam, 1l); return R.ok(message); } /* 绑定托盘条码与暂存位 */ @PostMapping("/combBinging/auth") public R combBinding(@RequestBody Map map){ String barcode = map.get("barcode").toString(); String stationCode = map.get("stationCode").toString(); agvMobileService.combBinding(barcode,stationCode); return R.ok("托盘绑定站点成功"); } /* 获取当前已绑定的还没生成工作档的暂存位 */ @PostMapping("/getBasDevp/auth") public R getBasDevpByFloor(@RequestBody Map map){ String floor = map.get("floor").toString(); if("1".equals(floor) || "3".equals(floor)){ return R.ok(agvMobileService.getAgvBasDevpByFloor(Integer.parseInt(floor))); } return R.error("参数错误"); } /* 获取输送线站点 */ @PostMapping("/getBasDevp/noCacheShelves/auth") public R getBasDevpByNoCacheShelves(){ return R.ok(agvBasDevpService.getBasDevpByNoCacheShelves()); } /* 启动入库,生成工作档 */ @PostMapping("/pakin/auth") @Synchronized public R pakin(@RequestBody Map map){ List devNos = (List) map.get("devNo"); List agvBasDevpList = devNos.stream().map(devNo -> { return agvBasDevpService.selectById(devNo); }).collect(Collectors.toList()); workService.createWaitPainWrkMastStart(agvBasDevpList, getUserId(),false); return R.ok("生成工作档成功"); } }