fix:1.新增大屏手动选择仓位出库功能。2.增加语音盘点指令,修改语音响应参数。
This commit is contained in:
@@ -51,4 +51,17 @@ public class BigScreenController {
|
||||
return new ResponseEntity<>(TableDataInfo.build(data), HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 大屏选仓出库:指定仓位下发出库任务(深货位对应浅货位有货时提示)
|
||||
*
|
||||
* @param whereJson {structCode, materialCode, qty?}
|
||||
* @return {taskId, taskCode, locations[]}
|
||||
*/
|
||||
@PostMapping("/outboundByLocation")
|
||||
@Log("大屏选仓出库")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> outboundByLocation(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(bigScreenService.outboundByLocation(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,4 +21,13 @@ public interface BigScreenService {
|
||||
* @return PdaResponse
|
||||
*/
|
||||
List<JSONObject> getData(List<String> stors);
|
||||
|
||||
/**
|
||||
* 大屏选仓出库:指定仓位下发出库任务
|
||||
* 深货位校验:对应浅货位有货则提示阻断
|
||||
*
|
||||
* @param whereJson {structCode: 仓位编码, materialCode: 物料编码, qty: 出库数量(可选,默认仓位全部)}
|
||||
* @return {taskId, taskCode, locations}
|
||||
*/
|
||||
JSONObject outboundByLocation(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,12 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
@@ -28,6 +31,9 @@ import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_manage.service.dao.mapper.MdPbGroupplateMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -35,6 +41,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
@@ -59,6 +66,12 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 组盘服务类(大屏选仓出库/深浅位校验)
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
@Resource
|
||||
private IOutBillService iOutBillService;
|
||||
|
||||
@@ -718,4 +731,157 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
}
|
||||
return finished ? "盘点完成" : "盘点中";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject outboundByLocation(JSONObject whereJson) {
|
||||
String structCode = whereJson.getString("structCode");
|
||||
String materialCode = whereJson.getString("materialCode");
|
||||
if (ObjectUtil.isEmpty(structCode) || ObjectUtil.isEmpty(materialCode)) {
|
||||
throw new BadRequestException("仓位编码和物料编码不能为空");
|
||||
}
|
||||
Structattr struct = iStructattrService.getByCode(structCode);
|
||||
if (ObjectUtil.isEmpty(struct)) {
|
||||
throw new BadRequestException("仓位不存在:" + structCode);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(struct.getStoragevehicle_code())) {
|
||||
throw new BadRequestException("仓位 " + structCode + " 无货");
|
||||
}
|
||||
// 深货位校验:对应浅货位有货则提示阻断
|
||||
this.checkDeepBlocked(struct);
|
||||
// 仓位载具上该物料可出库存(组盘表统一存物料编码)
|
||||
List<GroupPlate> plates = iMdPbGroupplateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, struct.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getMaterial_id, materialCode)
|
||||
.gt(GroupPlate::getQty, BigDecimal.ZERO));
|
||||
if (CollectionUtils.isEmpty(plates)) {
|
||||
throw new BadRequestException("仓位 " + structCode + " 上没有物料 " + materialCode + " 的库存");
|
||||
}
|
||||
BigDecimal canuseQty = plates.stream()
|
||||
.map(GroupPlate::getQty)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal qty = whereJson.getBigDecimal("qty") == null ? canuseQty : whereJson.getBigDecimal("qty");
|
||||
if (qty.compareTo(canuseQty) > 0) {
|
||||
throw new BadRequestException("仓位库存不足:可出 " + canuseQty + ",请求出 " + qty);
|
||||
}
|
||||
MdMeMaterialbase mater = iMdMeMaterialbaseService.getByCode(materialCode);
|
||||
if (ObjectUtil.isEmpty(mater)) {
|
||||
throw new BadRequestException("物料不存在:" + materialCode);
|
||||
}
|
||||
// 创建出库单+明细
|
||||
JSONObject bill = new JSONObject();
|
||||
bill.put("stor_id", struct.getStor_id());
|
||||
bill.put("bill_type", "0002");
|
||||
bill.put("biz_date", DateUtil.today());
|
||||
bill.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
bill.put("remark", "大屏选仓出库");
|
||||
JSONArray tableData = new JSONArray();
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("material_id", mater.getMaterial_id());
|
||||
row.put("material_code", materialCode);
|
||||
row.put("pcsn", plates.get(0).getPcsn());
|
||||
row.put("qty", qty);
|
||||
row.put("qty_unit_id", mater.getQty_unit_id());
|
||||
row.put("qty_unit_name", mater.getQty_unit_name());
|
||||
tableData.add(row);
|
||||
bill.put("tableData", tableData);
|
||||
String iostorinvId = iOutBillService.insertDtl(bill);
|
||||
// 指定货位分配(manualDiv:锁定仓位/生成分配明细/冻结库存)
|
||||
String iostorinvdtlId = this.getFirstDtlId(iostorinvId);
|
||||
JSONObject manual = new JSONObject();
|
||||
JSONObject rowJson = new JSONObject();
|
||||
rowJson.put("iostorinv_id", iostorinvId);
|
||||
rowJson.put("iostorinvdtl_id", iostorinvdtlId);
|
||||
manual.put("row", rowJson);
|
||||
JSONObject rowsJson = new JSONObject();
|
||||
rowsJson.put("struct_id", struct.getStruct_id());
|
||||
rowsJson.put("struct_code", struct.getStruct_code());
|
||||
rowsJson.put("struct_name", struct.getStruct_name());
|
||||
rowsJson.put("sect_id", struct.getSect_id());
|
||||
rowsJson.put("sect_code", struct.getSect_code());
|
||||
rowsJson.put("sect_name", struct.getSect_name());
|
||||
rowsJson.put("storagevehicle_code", struct.getStoragevehicle_code());
|
||||
rowsJson.put("pcsn", plates.get(0).getPcsn());
|
||||
rowsJson.put("qty", qty);
|
||||
JSONArray rows = new JSONArray();
|
||||
rows.add(rowsJson);
|
||||
manual.put("rows", rows);
|
||||
iOutBillService.manualDiv(manual);
|
||||
// 设置出库点并创建出库任务 STOutTask
|
||||
JSONObject pointParam = new JSONObject();
|
||||
pointParam.put("iostorinv_id", iostorinvId);
|
||||
pointParam.put("region_code", "CKQ");
|
||||
pointParam.put("point_code", "CKDJW01");
|
||||
iOutBillService.allSetPoint(pointParam);
|
||||
// 组装响应:分配仓位数据
|
||||
JSONObject queryDis = new JSONObject();
|
||||
queryDis.put("iostorinv_id", iostorinvId);
|
||||
List<IOStorInvDisDto> disList = iOutBillService.getOutBillDis(queryDis);
|
||||
JSONArray locations = new JSONArray();
|
||||
String taskId = null;
|
||||
String taskCode = null;
|
||||
for (IOStorInvDisDto dis : disList) {
|
||||
JSONObject loc = new JSONObject();
|
||||
loc.put("structCode", dis.getStruct_code());
|
||||
loc.put("structName", dis.getStruct_name());
|
||||
loc.put("vehicleCode", dis.getStoragevehicle_code());
|
||||
loc.put("materialCode", dis.getMaterial_code());
|
||||
loc.put("materialName", dis.getMaterial_name());
|
||||
loc.put("qty", dis.getPlan_qty());
|
||||
locations.add(loc);
|
||||
if (taskId == null) {
|
||||
taskId = dis.getTask_id();
|
||||
taskCode = dis.getTask_code();
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("taskId", taskId);
|
||||
result.put("taskCode", taskCode);
|
||||
result.put("locations", locations);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 深货位校验:深货位(row 1/4)对应浅货位(同列同层, row 1↔2 / 4↔3)有货则提示阻断
|
||||
*
|
||||
* @param struct 出库仓位
|
||||
*/
|
||||
private void checkDeepBlocked(Structattr struct) {
|
||||
Integer rowNum = struct.getRow_num();
|
||||
if (rowNum == null || (rowNum != 1 && rowNum != 4)) {
|
||||
return;
|
||||
}
|
||||
int shallowRow = rowNum == 1 ? 2 : 3;
|
||||
Structattr shallow = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getSect_id, struct.getSect_id())
|
||||
.eq(Structattr::getRow_num, shallowRow)
|
||||
.eq(Structattr::getCol_num, struct.getCol_num())
|
||||
.eq(Structattr::getLayer_num, struct.getLayer_num())
|
||||
.last("limit 1"));
|
||||
if (ObjectUtil.isEmpty(shallow)) {
|
||||
return;
|
||||
}
|
||||
// 浅位有载具即挡路(占用通道)
|
||||
if (ObjectUtil.isNotEmpty(shallow.getStoragevehicle_code())) {
|
||||
throw new BadRequestException("深货位[" + struct.getStruct_code() + "]对应浅货位["
|
||||
+ shallow.getStruct_code() + "]有载具遮挡,无法直接出库,请先处理该浅货位");
|
||||
}
|
||||
// 浅位被锁定(有任务占用)也挡路
|
||||
if (!IOSEnum.LOCK_TYPE.code("未锁定").equals(shallow.getLock_type())) {
|
||||
throw new BadRequestException("深货位[" + struct.getStruct_code() + "]对应浅货位["
|
||||
+ shallow.getStruct_code() + "]处于锁定状态(有任务占用),无法直接出库");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出库单第一条明细id
|
||||
*/
|
||||
private String getFirstDtlId(String iostorinvId) {
|
||||
JSONObject query = new JSONObject();
|
||||
query.put("iostorinv_id", iostorinvId);
|
||||
List<IOStorInvDtlDto> dtls = iOutBillService.getOutBillDtl(query);
|
||||
if (CollectionUtils.isEmpty(dtls)) {
|
||||
throw new BadRequestException("未找到出库单明细");
|
||||
}
|
||||
return dtls.get(0).getIostorinvdtl_id();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ public class VoiceCallbackController {
|
||||
OutboundTaskRequest outboundRequest = JSON.toJavaObject(commandParam, OutboundTaskRequest.class);
|
||||
result = voiceCallbackService.handleOutboundTask(outboundRequest);
|
||||
break;
|
||||
case "inventorycount":
|
||||
result = voiceCallbackService.handleInventoryTask();
|
||||
break;
|
||||
default:
|
||||
throw new BadRequestException("未知的指令类型: " + commandType);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,9 @@ import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
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.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.VehicleOutTask;
|
||||
@@ -48,6 +50,7 @@ import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.IStIvtMoveinvService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
@@ -96,20 +99,22 @@ public class VoiceCallbackService {
|
||||
private IOutBillService iOutBillService;
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
@Resource
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
|
||||
|
||||
@Transactional
|
||||
public JSONObject handleInboundTask(InboundTaskRequest inboundTaskRequest){
|
||||
public JSONObject handleInboundTask(InboundTaskRequest inboundTaskRequest) {
|
||||
// 校验目标货位(语音指定入到哪个货位)
|
||||
Structattr targetStruct = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStruct_code, inboundTaskRequest.getLocationFrom()));
|
||||
if (targetStruct == null){
|
||||
if (targetStruct == null) {
|
||||
throw new BadRequestException(inboundTaskRequest.getLocationFrom() + "货位不存在");
|
||||
}
|
||||
if (!targetStruct.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))){
|
||||
if (!targetStruct.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))) {
|
||||
throw new BadRequestException("当前货位已锁定");
|
||||
}
|
||||
if (!StringUtils.isEmpty(targetStruct.getStoragevehicle_code())){
|
||||
if (!StringUtils.isEmpty(targetStruct.getStoragevehicle_code())) {
|
||||
throw new BadRequestException("当前仓位已占用");
|
||||
}
|
||||
// 入库站台点(语音入库起点)
|
||||
@@ -186,10 +191,29 @@ public class VoiceCallbackService {
|
||||
tableMater.add(disRow);
|
||||
divParam.put("tableMater", tableMater);
|
||||
iInBillService.divPoint(divParam);
|
||||
return null;
|
||||
};
|
||||
// 返回任务信息(divPoint 已把任务关联到分配明细)
|
||||
IOStorInvDis disAfter = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinvdis_id, dis.getIostorinvdis_id())
|
||||
.last("limit 1"));
|
||||
String taskId = disAfter == null ? null : disAfter.getTask_id();
|
||||
String taskCode = null;
|
||||
if (taskId != null) {
|
||||
SchBaseTask task = iSchBaseTaskService.getById(taskId);
|
||||
if (task != null) {
|
||||
taskCode = task.getTask_code();
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("taskId", taskId);
|
||||
result.put("taskCode", taskCode);
|
||||
result.put("structCode", targetStruct.getStruct_code());
|
||||
return result;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Transactional
|
||||
public JSONObject handleOutboundTask(OutboundTaskRequest outboundTaskRequest){
|
||||
public JSONObject handleOutboundTask(OutboundTaskRequest outboundTaskRequest) {
|
||||
MdMeMaterialbase meMaterialbase = iMdMeMaterialbaseService.getByCode(outboundTaskRequest.getMaterial());
|
||||
if (ObjectUtil.isEmpty(meMaterialbase)) {
|
||||
throw new BadRequestException("物料不存在:" + outboundTaskRequest.getMaterial() + ",请确认物料编码是否正确");
|
||||
@@ -224,8 +248,35 @@ public class VoiceCallbackService {
|
||||
// 绑定下发任务时的语音会话,任务完成只向该会话播报(无在线会话则不绑定)
|
||||
pointParam.put("voiceSessionId", SysSpeechWebSocketEndpoint.getRecentSessionId());
|
||||
iOutBillService.allSetPoint(pointParam);
|
||||
return null;
|
||||
};
|
||||
// 返回分配到的具体仓位数据(与页面分配明细口径一致)
|
||||
JSONObject queryDis = new JSONObject();
|
||||
queryDis.put("iostorinv_id", iostorinvId);
|
||||
List<IOStorInvDisDto> disList = iOutBillService.getOutBillDis(queryDis);
|
||||
JSONArray locations = new JSONArray();
|
||||
String taskId = null;
|
||||
String taskCode = null;
|
||||
for (IOStorInvDisDto dis : disList) {
|
||||
JSONObject loc = new JSONObject();
|
||||
loc.put("structCode", dis.getStruct_code());
|
||||
loc.put("structName", dis.getStruct_name());
|
||||
loc.put("vehicleCode", dis.getStoragevehicle_code());
|
||||
loc.put("materialCode", dis.getMaterial_code());
|
||||
loc.put("materialName", dis.getMaterial_name());
|
||||
loc.put("qty", dis.getPlan_qty());
|
||||
locations.add(loc);
|
||||
if (taskId == null) {
|
||||
taskId = dis.getTask_id();
|
||||
taskCode = dis.getTask_code();
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("taskId", taskId);
|
||||
result.put("taskCode", taskCode);
|
||||
result.put("locations", locations);
|
||||
return result;
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 语音场景仓库(与现有语音逻辑保持一致,使用 LW 冶炼库)
|
||||
@@ -238,7 +289,8 @@ public class VoiceCallbackService {
|
||||
}
|
||||
return storattr.getStor_id();
|
||||
}
|
||||
public JSONObject handleMoveTask(MoveTaskRequest moveTaskRequest){
|
||||
|
||||
public JSONObject handleMoveTask(MoveTaskRequest moveTaskRequest) {
|
||||
Structattr attrDao = iStructattrService.findByCode(moveTaskRequest.getLocationFrom());
|
||||
JSONObject taskForm = new JSONObject();
|
||||
taskForm.put("point_code1", moveTaskRequest.getLocationFrom());
|
||||
@@ -247,34 +299,107 @@ public class VoiceCallbackService {
|
||||
taskForm.put("vehicle_code", attrDao.getStoragevehicle_code());
|
||||
String taskId = applyTaskMap.get("MoveTask").create((JSONObject) JSONObject.toJSON(taskForm));
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
public JSONObject handleQueryTask(QueryBoundRequest queryBoundRequest){
|
||||
List<StructattrVechielDto> structCode = iStructattrService.collectVechicle(MapOf.of("struct_code", queryBoundRequest.getLocation(), "search", queryBoundRequest.getMaterial()));
|
||||
Map<String, BigDecimal> collect = structCode.stream()
|
||||
.collect(Collectors.groupingBy(StructattrVechielDto::getMaterial_code,
|
||||
Collectors.reducing(BigDecimal.ZERO, StructattrVechielDto::getQty, BigDecimal::add)));
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("当前仓库物料有物料");
|
||||
collect.entrySet().forEach(r -> {
|
||||
stringBuffer.append(r.getKey()).append("共计")
|
||||
.append(r.getValue())
|
||||
.append("个");
|
||||
});
|
||||
// for (StructattrVechielDto vechielDtos : structCode) {
|
||||
// stringBuffer.append(vechielDtos.getMaterial_name()).append("共计")
|
||||
// .append(vechielDtos.getQty())
|
||||
// .append("个");
|
||||
// }
|
||||
String text = stringBuffer.toString();
|
||||
try {
|
||||
// voiceService.speechTts(text);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
;
|
||||
|
||||
public JSONObject handleQueryTask(QueryBoundRequest queryBoundRequest) {
|
||||
String location = queryBoundRequest.getLocation();
|
||||
String material = queryBoundRequest.getMaterial();
|
||||
if (StringUtils.isEmpty(location) && StringUtils.isEmpty(material)) {
|
||||
throw new BadRequestException("查询参数缺失:material 或 location 至少传一个");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(location)) {
|
||||
// 场景B:查询具体仓位库存,返回仓位编码 + 仓位上的物料名称和数量(空仓位返回空数组)
|
||||
List<StructattrVechielDto> locationIvt = iStructattrService.collectVechicle(
|
||||
MapOf.of("struct_code", location));
|
||||
JSONArray materials = new JSONArray();
|
||||
for (StructattrVechielDto ivt : locationIvt) {
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("materialCode", ivt.getMaterial_code());
|
||||
item.put("materialName", ivt.getMaterial_name());
|
||||
item.put("qty", ivt.getQty());
|
||||
materials.add(item);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("location", location);
|
||||
result.put("materials", materials);
|
||||
return result;
|
||||
}
|
||||
// 场景A:只传material,查询该物料全仓库存汇总,返回物料名称和数量
|
||||
MdMeMaterialbase mater = iMdMeMaterialbaseService.getByCode(material);
|
||||
if (ObjectUtil.isEmpty(mater)) {
|
||||
throw new BadRequestException("物料不存在:" + material);
|
||||
}
|
||||
List<StructattrVechielDto> materIvt = iStructattrService.collectVechicle(
|
||||
MapOf.of("search", material));
|
||||
BigDecimal totalQty = materIvt.stream()
|
||||
.map(StructattrVechielDto::getQty)
|
||||
.filter(ObjectUtil::isNotEmpty)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("materialCode", mater.getMaterial_code());
|
||||
result.put("materialName", mater.getMaterial_name());
|
||||
result.put("qty", totalQty);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音盘点任务:程序写死盘点全部有货浅货位(row 2/3、已绑载具、未锁定、组盘有库存),
|
||||
* 逐仓创建盘点任务并锁定盘点锁,不返回仓位明细
|
||||
*
|
||||
* @return {count: 任务数, taskCodes: [任务编码]}
|
||||
*/
|
||||
public JSONObject handleInventoryTask() {
|
||||
// 浅货位(row 2/3)且有载具、未锁定、启用
|
||||
List<Structattr> shallowList = iStructattrService.list(new LambdaQueryWrapper<Structattr>()
|
||||
.in(Structattr::getRow_num, 2, 3)
|
||||
.eq(Structattr::getIs_used, true)
|
||||
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.isNotNull(Structattr::getStoragevehicle_code));
|
||||
if (CollectionUtils.isEmpty(shallowList)) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("count", 0);
|
||||
result.put("taskCodes", new JSONArray());
|
||||
return result;
|
||||
}
|
||||
// 组盘有库存的载具集合
|
||||
Set<String> stockVehicles = iMdPbGroupplateService.list(
|
||||
new LambdaQueryWrapper<GroupPlate>().gt(GroupPlate::getQty, BigDecimal.ZERO))
|
||||
.stream()
|
||||
.map(GroupPlate::getStoragevehicle_code)
|
||||
.filter(ObjectUtil::isNotEmpty)
|
||||
.collect(Collectors.toSet());
|
||||
JSONArray taskCodes = new JSONArray();
|
||||
List<JSONObject> lockList = new ArrayList<>();
|
||||
for (Structattr shallow : shallowList) {
|
||||
if (!stockVehicles.contains(shallow.getStoragevehicle_code())) {
|
||||
continue;
|
||||
}
|
||||
// 创建盘点任务:起点终点一致(都是被盘点仓位)
|
||||
JSONObject taskForm = new JSONObject();
|
||||
taskForm.put("config_code", "InventoryCountTask");
|
||||
taskForm.put("point_code1", shallow.getStruct_code());
|
||||
taskForm.put("vehicle_code", shallow.getStoragevehicle_code());
|
||||
String taskId = applyTaskMap.get("InventoryCountTask").create(taskForm);
|
||||
SchBaseTask task = iSchBaseTaskService.getById(taskId);
|
||||
if (task != null) {
|
||||
taskCodes.add(task.getTask_code());
|
||||
}
|
||||
// 组织锁定盘点锁数据
|
||||
JSONObject jsonAttr = new JSONObject();
|
||||
jsonAttr.put("struct_code", shallow.getStruct_code());
|
||||
jsonAttr.put("lock_type", IOSEnum.LOCK_TYPE.code("盘点锁"));
|
||||
lockList.add(jsonAttr);
|
||||
}
|
||||
// 批量锁定盘点锁
|
||||
if (CollectionUtils.isNotEmpty(lockList)) {
|
||||
iStructattrService.updateLock(lockList);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("has",text);
|
||||
return result ;
|
||||
};
|
||||
result.put("count", taskCodes.size());
|
||||
result.put("taskCodes", taskCodes);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@
|
||||
and ext.pcsn = dis.pcsn
|
||||
where
|
||||
1=1
|
||||
<if test="params.iostorinv_id != null and params.iostorinv_id != ''">
|
||||
AND
|
||||
dis.iostorinv_id = #{params.iostorinv_id}
|
||||
</if>
|
||||
<if test="params.iostorinvdtl_id != null">
|
||||
AND
|
||||
dis.iostorinvdtl_id = #{params.iostorinvdtl_id}
|
||||
|
||||
Reference in New Issue
Block a user