add:无人车卸货
This commit is contained in:
@@ -12,14 +12,19 @@ public class SysParamConstant {
|
||||
*/
|
||||
public final static String IS_CONNECT_ACS = "is_connect_acs";
|
||||
|
||||
/**
|
||||
* 是否连接无人车
|
||||
*/
|
||||
public final static String IS_NOT_CAR = "is_not_car";
|
||||
|
||||
/**
|
||||
* ACS系统IP
|
||||
*/
|
||||
public final static String ACS_URL = "acs_url";
|
||||
|
||||
/**
|
||||
* ERP系统IP
|
||||
* 无人车系统IP
|
||||
*/
|
||||
public final static String ERP_URL = "erp_url";
|
||||
public final static String CAR_URL = "car_url";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.ext.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext.service.NotCarToWmsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 无人车调用WMS 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/wms/car")
|
||||
@Slf4j
|
||||
public class NotCarToWmsController {
|
||||
|
||||
@Autowired
|
||||
private NotCarToWmsService notCarToWmsService;
|
||||
|
||||
@PostMapping("/materialInfo")
|
||||
@Log(value = "无人车给WMS发送物料点位信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> materialInfo(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(notCarToWmsService.materialInfo(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendTask")
|
||||
@Log(value = "无人车给下发WMS搬运任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(notCarToWmsService.sendTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.nl.wms.ext.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.util.BaseResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 无人车调用WMS 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
public interface NotCarToWmsService {
|
||||
|
||||
/**
|
||||
* 无人车给WMS发送物料点位信息
|
||||
* @param whereJson {
|
||||
*
|
||||
* }
|
||||
* @return BaseResponse
|
||||
*/
|
||||
BaseResponse materialInfo(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 无人车给下发WMS搬运任务
|
||||
* @param whereJson {
|
||||
*
|
||||
* }
|
||||
* @return BaseResponse
|
||||
*/
|
||||
BaseResponse sendTask(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.wms.ext.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.util.BaseResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* WMS调用无人车 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
public interface WmsToNotCarService {
|
||||
|
||||
/**
|
||||
* 通知无人车下步指令
|
||||
* @param whereJson {
|
||||
* to_command: 1-等待,2-回库
|
||||
* }
|
||||
* @return BaseResponse
|
||||
*/
|
||||
BaseResponse sendCommand(JSONObject whereJson);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.ext.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.service.NotCarToWmsService;
|
||||
import org.nl.wms.ext.util.BaseResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 无人车调用WMS 实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class NotCarToWmsServiceImpl implements NotCarToWmsService {
|
||||
|
||||
@Override
|
||||
public BaseResponse materialInfo(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse sendTask(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.nl.wms.ext.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.enums.SysParamConstant;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.service.WmsToNotCarService;
|
||||
import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.ext.util.BaseResponse;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* WMS调用无人车 实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WmsToNotCarServiceImpl implements WmsToNotCarService {
|
||||
|
||||
@Override
|
||||
public BaseResponse sendCommand(JSONObject param) {
|
||||
log.info("下发无人车接口sendCommand的输入参数为:-------------------" + param.toString());
|
||||
// 返回参数
|
||||
BaseResponse resultCar;
|
||||
|
||||
// 系统参数类
|
||||
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||
//判断是否连接无人车系统
|
||||
Param isConnectCar = sysParamService.findByCode(SysParamConstant.IS_NOT_CAR);
|
||||
if (ObjectUtil.isEmpty(isConnectCar)) {
|
||||
return BaseResponse.requestError("系统参数表中:" + SysParamConstant.IS_NOT_CAR + "不存在");
|
||||
}
|
||||
if (isConnectCar.getValue().equals(IOSConstant.ONE)) {
|
||||
return BaseResponse.responseOk("下发成功,未连接无人车系统!");
|
||||
}
|
||||
|
||||
//无人车系统地址ip
|
||||
Param acsUrlParam = sysParamService.findByCode(SysParamConstant.CAR_URL);
|
||||
if (ObjectUtil.isEmpty(acsUrlParam)) {
|
||||
return BaseResponse.requestError("系统参数表中:" + SysParamConstant.CAR_URL + "不存在");
|
||||
}
|
||||
|
||||
String url = acsUrlParam.getValue() + "sendCommand";
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.execute().body();
|
||||
// 格式转换
|
||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||
resultCar = JSONObject.toJavaObject(result, AcsResponse.class);
|
||||
log.info("下发无人车接口sendCommand的输出参数为:-------------------" + resultMsg);
|
||||
} catch (Exception e) {
|
||||
//网络不通
|
||||
String msg = e.getMessage();
|
||||
log.error("连接失败:{}", msg);
|
||||
return AcsResponse.requestError("网络不通,操作失败!");
|
||||
}
|
||||
return resultCar;
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,14 @@ public class BaseResponse implements Serializable {
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse requestError(String message) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setStatus(HttpStatus.HTTP_BAD_REQUEST);
|
||||
response.setMessage(message);
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseOk(JSONObject data) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setStatus(HttpStatus.HTTP_OK);
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package org.nl.wms.pda.general_management.controller;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda.general_management.service.NotCarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 无人车对接
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/notCar")
|
||||
@Slf4j
|
||||
public class NotCarController {
|
||||
|
||||
@Autowired
|
||||
private NotCarService notCarService;
|
||||
|
||||
@PostMapping("/queryXhRegion")
|
||||
@Log("无人车卸货 - 查询卸货区下拉框")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryXhRegion() {
|
||||
return new ResponseEntity<>(notCarService.queryXhRegion(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryEndRegion")
|
||||
@Log("无人车卸货 - 查询目的区域下拉框")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryEndRegion() {
|
||||
return new ResponseEntity<>(notCarService.queryEndRegion(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryRegionPoint")
|
||||
@Log("无人车卸货 - 查询区域点位信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryRegionPoint(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(notCarService.queryRegionPoint(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/unload")
|
||||
@Log("无人车卸货 - 卸货")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> unload(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(notCarService.unload(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/waiting")
|
||||
@Log("无人车卸货 - 等待")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> waiting(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(notCarService.waiting(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/back")
|
||||
@Log("无人车卸货 - 回库")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> back(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(notCarService.back(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -77,4 +77,25 @@ public class PdaWarehouseController {
|
||||
public ResponseEntity<Object> directlyOutConfirm(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(pdaWarehouseService.directlyOutConfirm(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/insideCodeInsert")
|
||||
@Log("库内合盘 - 扫码插入")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> insideCodeInsert(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(pdaWarehouseService.insideCodeInsert(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPointVehicle")
|
||||
@Log("库内合盘 - 查询点位或载具")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryPointVehicle(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(pdaWarehouseService.queryPointVehicle(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmInside")
|
||||
@Log("库内合盘 - 确认合盘")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> confirmInside(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(pdaWarehouseService.confirmInside(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.nl.wms.pda.general_management.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 无人车对接 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
public interface NotCarService {
|
||||
|
||||
/**
|
||||
* 无人车卸货 - 查询卸货区下拉框
|
||||
*
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse queryXhRegion();
|
||||
|
||||
/**
|
||||
* 无人车卸货 - 查询目的区域下拉框
|
||||
*
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse queryEndRegion();
|
||||
|
||||
/**
|
||||
* 无人车卸货 - 查询区域点位信息
|
||||
*
|
||||
* @param whereJson {
|
||||
* region_code: 区域编码
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse queryRegionPoint(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 无人车卸货 - 卸货
|
||||
*
|
||||
* @param whereJson {
|
||||
* region_code: 目的区域
|
||||
* rows: 列表明细
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse unload(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 无人车卸货 - 等待
|
||||
*
|
||||
* @param whereJson {
|
||||
* <p>
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse waiting(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 无人车卸货 - 回库
|
||||
*
|
||||
* @param whereJson {
|
||||
* <p>
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse back(JSONObject whereJson);
|
||||
}
|
||||
@@ -66,4 +66,16 @@ public interface PdaBuildParamService {
|
||||
* @param io_type 出入类型
|
||||
*/
|
||||
void createIOS(JSONObject param, String io_type, String bill_type);
|
||||
|
||||
/**
|
||||
* 直接创建移库单 (误无任务)
|
||||
* @param param {
|
||||
* rows: [移出仓位库存]
|
||||
* storagevehicle_code: 移入载具
|
||||
* struct_code: 移入点位
|
||||
* total_qty: 总数量
|
||||
* }
|
||||
* @param bill_type 单据类型
|
||||
*/
|
||||
void createMove(JSONObject param, String bill_type);
|
||||
}
|
||||
|
||||
@@ -61,4 +61,35 @@ public interface PdaWarehouseService {
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse directlyOutConfirm(JSONObject param);
|
||||
|
||||
/**
|
||||
* 库内合盘 - 扫码插入
|
||||
* @param param {
|
||||
* bag_code: 袋码
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse insideCodeInsert(JSONObject param);
|
||||
|
||||
/**
|
||||
* 库内合盘 - 查询点位或载具
|
||||
* @param param {
|
||||
* storagevehicle_code: 移入载具
|
||||
* struct_code: 移入点位
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse queryPointVehicle(JSONObject param);
|
||||
|
||||
/**
|
||||
* 库内合盘 - 确认合盘
|
||||
* @param param {
|
||||
* total_qty: 总数量
|
||||
* storagevehicle_code: 移入载具
|
||||
* struct_code: 移入点位
|
||||
* rows: 明细(袋库存明细)
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
PdaResponse confirmInside(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.pda.general_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.unit.DataUnit;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -15,7 +16,9 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.pda.general_management.service.PdaBuildParamService;
|
||||
import org.nl.wms.pda.general_management.service.PdaCommonService;
|
||||
@@ -23,19 +26,15 @@ import org.nl.wms.pda.general_management.service.dto.AssemblyPalletParam;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl;
|
||||
import org.nl.wms.warehouse_management.service.*;
|
||||
import org.nl.wms.warehouse_management.service.dao.*;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -60,6 +59,24 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
|
||||
@Resource
|
||||
private IOutBillService outBillService;
|
||||
|
||||
/**
|
||||
* 移库主表服务
|
||||
*/
|
||||
@Resource
|
||||
private IStIvtMoveinvService iStIvtMoveinvService;
|
||||
|
||||
/**
|
||||
* 移库明细服务
|
||||
*/
|
||||
@Resource
|
||||
private IStIvtMoveinvdtlService iStIvtMoveinvdtlService;
|
||||
|
||||
/**
|
||||
* 仓位服务
|
||||
*/
|
||||
@Resource
|
||||
private IStructattrService structattrService;
|
||||
|
||||
@Override
|
||||
public void doGroupPallet(JSONObject param, String vehicleCode) {
|
||||
JSONArray rows = param.getJSONArray("rows");
|
||||
@@ -328,4 +345,57 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMove(JSONObject param, String bill_type) {
|
||||
List<JSONObject> rows = param.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
// 查询移入仓位
|
||||
Structattr inAttrDao = structattrService.getByCode(param.getString("struct_code"));
|
||||
|
||||
// 组织主表
|
||||
StIvtMoveinv moveMst = new StIvtMoveinv();
|
||||
moveMst.setMoveinv_id(IdUtil.getStringId());
|
||||
moveMst.setBill_code(CodeUtil.getNewCode("MOVE_STORE_CODE"));
|
||||
moveMst.setBill_type(bill_type);
|
||||
moveMst.setBiz_date(DateUtil.today());
|
||||
moveMst.setStor_id(inAttrDao.getStor_id());
|
||||
moveMst.setTotal_qty(param.getBigDecimal("total_qty"));
|
||||
moveMst.setDetail_count(BigDecimal.valueOf(rows.size()));
|
||||
moveMst.setBill_status(IOSEnum.MOVE_MST_STATUS.code("完成"));
|
||||
moveMst.setCreate_mode(IOSEnum.CREATE_MODE.code("终端产生"));
|
||||
moveMst.setInput_optid(SecurityUtils.getCurrentUserId());
|
||||
moveMst.setInput_optname(SecurityUtils.getCurrentNickName());
|
||||
moveMst.setInput_time(DateUtil.now());
|
||||
moveMst.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
moveMst.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
moveMst.setUpdate_time(DateUtil.now());
|
||||
moveMst.setConfirm_optid(SecurityUtils.getCurrentUserId());
|
||||
moveMst.setConfirm_optname(SecurityUtils.getCurrentNickName());
|
||||
moveMst.setConfirm_time(DateUtil.now());
|
||||
iStIvtMoveinvService.save(moveMst);
|
||||
// 组织明细
|
||||
List<StIvtMoveinvdtl> moveDtlList = new ArrayList<>();
|
||||
for (JSONObject json : rows) {
|
||||
Structattr outAttr = structattrService.getByCode(json.getString("struct_code"));
|
||||
StIvtMoveinvdtl moveDtl = new StIvtMoveinvdtl();
|
||||
|
||||
moveDtl.setMoveinvdtl_id(IdUtil.getStringId());
|
||||
moveDtl.setMoveinv_id(moveMst.getMoveinv_id());
|
||||
moveDtl.setSeq_no(BigDecimal.ONE);
|
||||
moveDtl.setTurnout_sect_code(outAttr.getSect_code());
|
||||
moveDtl.setTurnout_struct_code(outAttr.getStruct_code());
|
||||
moveDtl.setMaterial_code(json.getString("material_code"));
|
||||
moveDtl.setPcsn(json.getString("pcsn"));
|
||||
moveDtl.setQty_unit_id(json.getString("qty_unit_id"));
|
||||
moveDtl.setQty_unit_name(json.getString("qty_unit_name"));
|
||||
moveDtl.setQty(json.getBigDecimal("canuse_qty"));
|
||||
moveDtl.setTurnin_sect_code(inAttrDao.getSect_code());
|
||||
moveDtl.setTurnin_struct_code(inAttrDao.getStruct_code());
|
||||
moveDtl.setWork_status(IOSEnum.MOVE_DTL_STATUS.code("完成"));
|
||||
moveDtl.setStoragevehicle_code(outAttr.getStoragevehicle_code());
|
||||
moveDtl.setStoragevehicle_code2(inAttrDao.getStoragevehicle_code());
|
||||
moveDtlList.add(moveDtl);
|
||||
}
|
||||
iStIvtMoveinvdtlService.saveBatch(moveDtlList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package org.nl.wms.pda.general_management.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.JSONObjectOf;
|
||||
import org.nl.wms.ext.service.WmsToNotCarService;
|
||||
import org.nl.wms.ext.util.BaseResponse;
|
||||
import org.nl.wms.pda.general_management.service.NotCarService;
|
||||
import org.nl.wms.pda.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
|
||||
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.PdaNotCarUnloadTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 无人车对接 实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
@Service
|
||||
public class NotCarServiceImpl implements NotCarService {
|
||||
|
||||
/**
|
||||
* 区域服务
|
||||
*/
|
||||
@Resource
|
||||
private ISchBaseRegionService iSchBaseRegionService;
|
||||
|
||||
/**
|
||||
* 点位mapper
|
||||
*/
|
||||
@Resource
|
||||
private SchBasePointMapper schBasePointMapper;
|
||||
|
||||
/**
|
||||
* 无人车卸货任务类
|
||||
*/
|
||||
@Resource
|
||||
private PdaNotCarUnloadTask pdaNotCarUnloadTask;
|
||||
|
||||
/**
|
||||
* wms调用无人车系统服务
|
||||
*/
|
||||
@Resource
|
||||
private WmsToNotCarService wmsToNotCarService;
|
||||
|
||||
@Override
|
||||
public PdaResponse queryXhRegion() {
|
||||
List<SchBaseRegion> list = iSchBaseRegionService.list(
|
||||
new QueryWrapper<SchBaseRegion>().lambda()
|
||||
.in(SchBaseRegion::getRegion_code, IOSEnum.REGION_CODE.code("无人车对接区(拆包)"),
|
||||
IOSEnum.REGION_CODE.code("无人车对接区(成品)")
|
||||
)
|
||||
);
|
||||
|
||||
return PdaResponse.requestParamOk(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse queryEndRegion() {
|
||||
List<SchBaseRegion> list = iSchBaseRegionService.list(
|
||||
new QueryWrapper<SchBaseRegion>().lambda()
|
||||
.in(SchBaseRegion::getRegion_code, IOSEnum.REGION_CODE.code("无人车卸货缓存区"))
|
||||
);
|
||||
|
||||
return PdaResponse.requestParamOk(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse queryRegionPoint(JSONObject whereJson) {
|
||||
return PdaResponse.requestParamOk(schBasePointMapper.queryRegionPoint(whereJson));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse unload(JSONObject whereJson) {
|
||||
List<JSONObject> rows = whereJson.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
// 查询可用点位
|
||||
List<SchBasePoint> pointList = divPoint(rows.size(), whereJson.getString("region_code"));
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject json = rows.get(i);
|
||||
JSONObject jsonTask = new JSONObject();
|
||||
jsonTask.put("point_code1", json.getString("point_code"));
|
||||
jsonTask.put("point_code2", pointList.get(i).getPoint_code());
|
||||
jsonTask.put("material_id", json.getString("class_code"));
|
||||
pdaNotCarUnloadTask.create(jsonTask);
|
||||
}
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse waiting(JSONObject whereJson) {
|
||||
BaseResponse response = wmsToNotCarService.sendCommand(JSONObjectOf.of("to_command", IOSConstant.ONE));
|
||||
if (response.getStatus() != HttpStatus.HTTP_OK) {
|
||||
throw new BadRequestException(response.getMessage());
|
||||
}
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse back(JSONObject whereJson) {
|
||||
BaseResponse response = wmsToNotCarService.sendCommand(JSONObjectOf.of("to_command", IOSConstant.TWO));
|
||||
if (response.getStatus() != HttpStatus.HTTP_OK) {
|
||||
throw new BadRequestException(response.getMessage());
|
||||
}
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数量找到对应可用点位
|
||||
*
|
||||
* @param size 数量
|
||||
* @param region_code 区域编码
|
||||
* @return List<SchBasePoint>
|
||||
*/
|
||||
private List<SchBasePoint> divPoint(int size, String region_code) {
|
||||
List<SchBasePoint> pointList = schBasePointMapper.selectList(
|
||||
new QueryWrapper<SchBasePoint>().lambda()
|
||||
.eq(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.eq(SchBasePoint::getRegion_code, region_code)
|
||||
.eq(SchBasePoint::getIs_used, IOSConstant.ONE)
|
||||
.and(row -> row.isNull(SchBasePoint::getIng_task_code)
|
||||
.or().eq(SchBasePoint::getIng_task_code,"")
|
||||
)
|
||||
.orderByAsc(SchBasePoint::getPoint_code)
|
||||
);
|
||||
|
||||
if (pointList.size() < size) {
|
||||
throw new BadRequestException("当前区域空位不够,当前区域剩余空位【" + pointList.size() + "】");
|
||||
}
|
||||
return pointList;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.MapOf;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
@@ -36,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -78,6 +80,12 @@ public class PdaWarehouseServiceImpl implements PdaWarehouseService {
|
||||
@Resource
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
/**
|
||||
* 载具扩展信息服务
|
||||
*/
|
||||
@Resource
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
|
||||
@Override
|
||||
public PdaResponse getPalletAssembly(JSONObject param) {
|
||||
String search = param.getString("search");
|
||||
@@ -272,7 +280,7 @@ public class PdaWarehouseServiceImpl implements PdaWarehouseService {
|
||||
ivtDao.setCanuse_qty(BigDecimal.valueOf(new_qty));
|
||||
mdPbStoragevehicleextMapper.updateById(ivtDao);
|
||||
// 减去组盘重量
|
||||
GroupPlate groupDao = groupplateService.getById("group_id");
|
||||
GroupPlate groupDao = groupplateService.getById(json.getString("group_id"));
|
||||
double group_qty = NumberUtil.sub(groupDao.getQty(), json.getBigDecimal("canuse_qty")).doubleValue();
|
||||
if (group_qty == 0) {
|
||||
// 删除组盘信息
|
||||
@@ -294,4 +302,97 @@ public class PdaWarehouseServiceImpl implements PdaWarehouseService {
|
||||
}
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse insideCodeInsert(JSONObject param) {
|
||||
return PdaResponse.requestParamOk(mdPbStoragevehicleextMapper.queryBagIvt(param));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponse queryPointVehicle(JSONObject param) {
|
||||
String storagevehicle_code = param.getString("storagevehicle_code");
|
||||
String struct_code = param.getString("struct_code");
|
||||
|
||||
Structattr attrDao = structattrService.getOne(
|
||||
new QueryWrapper<Structattr>().lambda()
|
||||
.eq(ObjectUtil.isNotEmpty(storagevehicle_code), Structattr::getStoragevehicle_code, storagevehicle_code)
|
||||
.eq(ObjectUtil.isNotEmpty(struct_code), Structattr::getStruct_code, struct_code)
|
||||
.eq(Structattr::getIs_delete, IOSConstant.ZERO)
|
||||
.eq(Structattr::getIs_used, IOSConstant.ONE)
|
||||
.ne(Structattr::getIs_emptyvehicle, IOSConstant.ONE)
|
||||
);
|
||||
|
||||
if (ObjectUtil.isEmpty(attrDao)) {
|
||||
throw new BadRequestException("当前点位/载具不存在!");
|
||||
}
|
||||
return PdaResponse.requestParamOk(attrDao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
@Transactional
|
||||
public PdaResponse confirmInside(JSONObject param) {
|
||||
RLock lock = redissonClient.getLock("lock:confirmInside");
|
||||
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
// 创建移库单据(无任务)
|
||||
defaultPdaBuildParam.createMove(param, IOSEnum.MOVE_BILL_TYPE.code("库内移库"));
|
||||
|
||||
List<JSONObject> rows = param.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
for (JSONObject json : rows) {
|
||||
MdPbStoragevehicleext ivtDao = mdPbStoragevehicleextMapper.selectById(json.getString("storagevehicleext_id"));
|
||||
// 减去数量
|
||||
double new_qty = NumberUtil.sub(ivtDao.getCanuse_qty(), json.getBigDecimal("canuse_qty")).doubleValue();
|
||||
if (new_qty == 0) {
|
||||
// 删除原载具库存信息
|
||||
mdPbStoragevehicleextMapper.deleteById(ivtDao);
|
||||
|
||||
// 判断此载具下是否还有其他库存
|
||||
List<MdPbStoragevehicleext> ivtList = mdPbStoragevehicleextMapper.selectList(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, json.getString("vehicle_code"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ivtList)) {
|
||||
// 变更仓位载具为空载具
|
||||
Structattr attrDao = structattrService.getById(json.getString("struct_id"));
|
||||
attrDao.setIs_emptyvehicle(IOSConstant.ONE);
|
||||
structattrService.updateById(attrDao);
|
||||
}
|
||||
} else {
|
||||
// 更新原载具库存数量
|
||||
ivtDao.setCanuse_qty(BigDecimal.valueOf(new_qty));
|
||||
mdPbStoragevehicleextMapper.updateById(ivtDao);
|
||||
}
|
||||
|
||||
// 新增新载具库存信息
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", param.getString("storagevehicle_code"));
|
||||
jsonIvt.put("bag_code", json.getString("bag_code"));
|
||||
jsonIvt.put("material_id", ivtDao.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ivtDao.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ivtDao.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ivtDao.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", json.getString("canuse_qty"));
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
|
||||
// 更新组盘信息
|
||||
GroupPlate groupDao = groupplateService.getById(json.getString("group_id"));
|
||||
groupDao.setVehicle_code(param.getString("storagevehicle_code"));
|
||||
groupplateService.updateById(groupDao);
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException("当前业务繁忙,稍后再试...");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return PdaResponse.requestOk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,4 +58,13 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
List<JSONObject> getPointDtl(@Param("param") JSONObject whereJson);
|
||||
|
||||
List<SchBasePoint> getCanUsePointByRegion(String regionCode);
|
||||
|
||||
/**
|
||||
* 无人车卸货 - 查询区域点位信息
|
||||
* @param whereJson {
|
||||
* region_code: 区域编码
|
||||
* }
|
||||
* @return PdaResponse
|
||||
*/
|
||||
List<JSONObject> queryRegionPoint(@Param("param") JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -123,4 +123,22 @@
|
||||
AND ( t.point_code1 = p.point_code
|
||||
OR t.point_code2 = p.point_code ))
|
||||
</select>
|
||||
|
||||
<select id="queryRegionPoint" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
point.*,
|
||||
class.class_code,
|
||||
class.class_name
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN md_pb_classstandard class ON point.can_material_type = class.class_code
|
||||
<where>
|
||||
IFNULL(point.can_material_type, '') != ''
|
||||
<if test="param.region_code != null and param.region_code != ''">
|
||||
AND
|
||||
point.region_code = #{param.region_code}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
package org.nl.wms.sch_manage.service.util.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.ACSTaskTypeEnum;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 无人车卸货任务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2026-01-06
|
||||
*/
|
||||
@Component(value = "PdaNotCarUnloadTask")
|
||||
@TaskType("PdaNotCarUnloadTask")
|
||||
public class PdaNotCarUnloadTask extends AbstractTask {
|
||||
|
||||
/**
|
||||
* 任务服务类
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Resource
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
task.setTask_status(TaskStatus.CREATE.getCode());
|
||||
task.setConfig_code(PdaNotCarUnloadTask.class.getSimpleName());
|
||||
task.setPoint_code1(json.getString("point_code1"));
|
||||
task.setPoint_code2(json.getString("point_code2"));
|
||||
task.setVehicle_code(json.getString("vehicle_code"));
|
||||
task.setMaterial_id(json.getString("material_id"));
|
||||
task.setMaterial_qty(json.getBigDecimal("material_qty"));
|
||||
task.setRequest_param(json.toString());
|
||||
task.setPriority(json.getString("Priority"));
|
||||
task.setRemark(json.getString("remark"));
|
||||
task.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
task.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
task.setCreate_time(DateUtil.now());
|
||||
taskService.save(task);
|
||||
|
||||
// 下发任务
|
||||
this.sendTaskOne(task.getTask_id());
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsTaskDto sendAcsParam(String taskId) {
|
||||
SchBaseTask taskDao = taskService.getById(taskId);
|
||||
|
||||
// 组织下发给acs的数据
|
||||
AcsTaskDto acsTaskDto = new AcsTaskDto();
|
||||
acsTaskDto.setExt_task_id(taskDao.getTask_id());
|
||||
acsTaskDto.setTask_code(taskDao.getTask_code());
|
||||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1());
|
||||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
acsTaskDto.setVehicle_code(taskDao.getVehicle_code());
|
||||
|
||||
acsTaskDto.setVehicle_type(IOSConstant.ONE);
|
||||
acsTaskDto.setIs_wait(IOSConstant.ZERO);
|
||||
acsTaskDto.setTask_type(ACSTaskTypeEnum.AGV_TASK.getCode());
|
||||
|
||||
acsTaskDto.setPriority(IOSConstant.ONE);
|
||||
acsTaskDto.setAgv_system_type(IOSConstant.THREE);
|
||||
|
||||
return acsTaskDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
// 校验任务
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
|
||||
throw new BadRequestException("该任务已完成!");
|
||||
}
|
||||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
|
||||
throw new BadRequestException("该任务已取消!");
|
||||
}
|
||||
// 根据传来的类型去对任务进行操作
|
||||
if (status.equals(TaskStatus.EXECUTING)) {
|
||||
// 更新明细状态
|
||||
this.executingTask(taskObj);
|
||||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
|
||||
taskObj.setRemark("执行中");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
if (status.equals(TaskStatus.FINISHED)) {
|
||||
this.finishTask(taskObj);
|
||||
}
|
||||
if (status.equals(TaskStatus.CANCELED)) {
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void cancel(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||
throw new BadRequestException("只能取消生成中的任务!");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskConfirm(String task_code) {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 更新起点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getCan_material_type, "")
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
);
|
||||
// 更新终点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getCan_material_type, taskObj.getMaterial_id())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有箱有料"))
|
||||
);
|
||||
// 更新任务
|
||||
taskObj.setRemark("已完成");
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
// 更新终点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
);
|
||||
// 更新任务
|
||||
taskObj.setRemark("已取消");
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,8 @@ public enum IOSEnum {
|
||||
|
||||
// 区域编码
|
||||
REGION_CODE(MapOf.of("出入库区域", "INOUR01", "AGV对接区", "AGVDJ01", "临时储存区", "LSCC01"
|
||||
, "外包材区域", "WBCZC01", "空托盘堆叠区域", "EMPDD01"
|
||||
, "外包材区域", "WBCZC01", "空托盘堆叠区域", "EMPDD01", "无人车对接区(拆包)", "WRCDJ01"
|
||||
, "无人车对接区(成品)", "WRCDJ02", "无人车卸货缓存区", "WRCXHHC01"
|
||||
)),
|
||||
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user