package zy.cloud.wms.manager.controller; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.annotations.ManagerAuth; import com.core.common.BaseRes; import com.core.common.Cools; import com.core.common.R; 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 zy.cloud.wms.common.web.BaseController; import zy.cloud.wms.manager.entity.Pakout; import zy.cloud.wms.manager.entity.WrkSts; import zy.cloud.wms.manager.entity.param.StockConfirmParam; import zy.cloud.wms.manager.entity.param.StockInParam; import zy.cloud.wms.manager.entity.param.StockOutParam; import zy.cloud.wms.manager.service.PakoutService; import zy.cloud.wms.manager.service.WorkService; import zy.cloud.wms.manager.service.WrkStsService; import java.util.List; /** * Created by vincent on 2021/2/25 */ @RestController @RequestMapping("/work") public class WorkController extends BaseController { @Autowired private WorkService workService; @Autowired private PakoutService pakoutService; @Autowired private WrkStsService wrkStsService; @RequestMapping("/stock/in") @ManagerAuth(memo = "上架") public R stockIn(@RequestBody StockInParam stockInParam) { return workService.stockIn(stockInParam, getUserId()); } @RequestMapping("/stock/out/check") @ManagerAuth(memo = "库存数量检测") public R stockOutCheck(@RequestParam String number) { return workService.stockOutCheck(number, getUserId()); } @RequestMapping("/stock/out") @ManagerAuth(memo = "捡货") public R stockOut(@RequestBody StockOutParam stockOutParam) { return workService.stockOut(stockOutParam, getUserId()); } @RequestMapping("/stock/out/print") @ManagerAuth(memo = "捡货单打印") public R stockOutPrint(@RequestBody StockOutParam stockOutParam) { return workService.stockOutPrint(stockOutParam, getUserId()); } @RequestMapping("/stock/allot") @ManagerAuth(memo = "库存调拨") public R stockAllot() { return R.ok(); } @RequestMapping("/pakout/get") @ManagerAuth(memo = "获取出库单") public R getPakout(@RequestParam String docNumber) { List pakouts = pakoutService.selectList(new EntityWrapper().eq("doc_num", docNumber).in("wrk_sts", 1,2)); if (Cools.isEmpty(pakouts)) { return R.parse(BaseRes.EMPTY); } Long sts = pakouts.get(0).getWrkSts(); if (sts == 1) { sts =2L; } WrkSts wrkSts = wrkStsService.selectById(sts); return R.ok().add(Cools .add("number", pakouts.get(0).getDocNum()) .add("wrkSts", pakouts.get(0).getWrkSts()) .add("wrkSts$", wrkSts==null?"未知":wrkSts.getStsName()) .add("custName", Cools.isEmpty(pakouts.get(0).getCustName())?"-":pakouts.get(0).getCustName()) .add("pakouts", pakouts) ); } @RequestMapping("/stock/out/confirm") @ManagerAuth(memo = "捡货确认") public R stockOutConfirm(@RequestBody StockConfirmParam param) { return workService.stockOutComplete(param, getUserId()); } }