|
@@ -0,0 +1,108 @@
|
|
|
+package com.ruoyi.web.controller.warewms.pda;
|
|
|
+
|
|
|
+
|
|
|
+import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
|
|
|
+import com.ruoyi.ams.inv.service.IInvLotLocIdService;
|
|
|
+import com.ruoyi.ams.task.domain.WcsTask;
|
|
|
+import com.ruoyi.ams.task.service.IWcsTaskService;
|
|
|
+import com.ruoyi.base.constant.Constant;
|
|
|
+import com.ruoyi.base.domain.BaseLocationInfo;
|
|
|
+import com.ruoyi.base.service.IBaseLocationInfoService;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Api("PDA业务")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/pdatask")
|
|
|
+public class PdaTaskSiShuiController {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IWcsTaskService wcsTaskService;
|
|
|
+ @Autowired
|
|
|
+ private IBaseLocationInfoService baseLocationInfoService;
|
|
|
+ @Autowired
|
|
|
+ private InvLotLocIdMapper invLotLocIdMapper;
|
|
|
+ @Autowired
|
|
|
+ private IInvLotLocIdService invLotLocIdService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除任务
|
|
|
+ */
|
|
|
+ @ApiOperation("删除任务")
|
|
|
+ @PostMapping("/taskCancel")
|
|
|
+ public AjaxResult taskCancel(@RequestBody Map<String, String> map) {
|
|
|
+ WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(map.get("taskNo"));
|
|
|
+ if (wcsTask == null) {
|
|
|
+ AjaxResult.error("任务查询不存在");
|
|
|
+ }
|
|
|
+ wcsTaskService.delTaskByTM(wcsTask);
|
|
|
+ return AjaxResult.success("任务取消指令下发成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 库位锁定/解锁
|
|
|
+ */
|
|
|
+ @ApiOperation("库位锁定/解锁")
|
|
|
+ @PostMapping("/pdaUpdLoction")
|
|
|
+ public AjaxResult pdaUpdLoction(@RequestBody Map<String, String> map) {
|
|
|
+ String locationId = map.get("locationId");
|
|
|
+ String type = map.get("type");
|
|
|
+ String user = map.get("user");
|
|
|
+
|
|
|
+ //判断参数是否为空
|
|
|
+ if(StringUtils.isEmpty(locationId) || StringUtils.isEmpty(type)){ return AjaxResult.error("库位ID和操作类型不能为空!");}
|
|
|
+
|
|
|
+ //获取库位
|
|
|
+ BaseLocationInfo bls = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationId,Constant.WAREHOUSE_ID);
|
|
|
+ if(StringUtils.isNull(bls)){ return AjaxResult.error("未匹配到对应的库位信息!");}
|
|
|
+ if("10".equals(bls.getStockStatus())){ return AjaxResult.error("库位状态需要空闲才可操作!");}
|
|
|
+
|
|
|
+ //操作库位
|
|
|
+ if("1".equals(type)){
|
|
|
+
|
|
|
+ // 清除库存
|
|
|
+ invLotLocIdMapper.deleteInvLotLocIdByLocationId(bls.getId());
|
|
|
+ // 修改库位为空闲无货
|
|
|
+ baseLocationInfoService.updateLocationIdleAndEmpty(bls.getId(), Constant.WAREHOUSE_ID, user);
|
|
|
+ }else{
|
|
|
+
|
|
|
+ BaseLocationInfo locationInfoFromUpdate = new BaseLocationInfo();
|
|
|
+ locationInfoFromUpdate.setId(bls.getId());
|
|
|
+ locationInfoFromUpdate.setStockStatus(Constant.STOCK_STATUS.STOCK80.getValue());
|
|
|
+ locationInfoFromUpdate.setUpdateBy(user);
|
|
|
+ locationInfoFromUpdate.setWarehouseId(Constant.WAREHOUSE_ID);
|
|
|
+ baseLocationInfoService.updateBaseLocationInfo(locationInfoFromUpdate);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("操作成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 空托库存添加
|
|
|
+ */
|
|
|
+ @ApiOperation("空托库存添加")
|
|
|
+ @PostMapping("/addEmpty")
|
|
|
+ public AjaxResult addEmpty(@RequestBody Map<String, String> map) {
|
|
|
+ String locationId = map.get("locationId");
|
|
|
+ String user = map.get("user");
|
|
|
+
|
|
|
+ //判断参数是否为空
|
|
|
+ if(StringUtils.isEmpty(locationId)){ return AjaxResult.error("库位ID不能为空!");}
|
|
|
+
|
|
|
+ //获取库位
|
|
|
+ BaseLocationInfo bls = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationId,Constant.WAREHOUSE_ID);
|
|
|
+ if(StringUtils.isNull(bls)){ return AjaxResult.error("未匹配到对应的库位信息!");}
|
|
|
+ if("10".equals(bls.getStockStatus())){ return AjaxResult.error("库位状态需要空闲才可操作!");}
|
|
|
+
|
|
|
+ return invLotLocIdService.adjAddEmpty(bls.getId().toString(), Constant.WAREHOUSE_ID, user);
|
|
|
+ }
|
|
|
+}
|