opt:优化二楼扫码单据出库查询,任务申请失败返回400;

This commit is contained in:
2025-03-20 19:10:01 +08:00
parent 9cecbf1be5
commit 1f5cf5da0b
6 changed files with 55 additions and 32 deletions

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.enums.StatusEnum;
@@ -29,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
/**
@@ -59,32 +61,32 @@ public class GroupDickInStorageTask extends AbstractTask {
public JSONObject createTask(JSONObject data) {
for (String vehicle_code : data.keySet()) {
String point_code1 = data.getString(vehicle_code);
if (StringUtils.isEmpty(point_code1)){
if (StringUtils.isEmpty(point_code1)) {
throw new BadRequestException("申请任务失败:请求参数数据异常");
}
List<MdPbVehicleMaterVo> item = iMdPbVehicleMaterService.getVehicleMaters(vehicle_code);
if (CollectionUtils.isEmpty(item)){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"载具物料信息信息不存在");
if (CollectionUtils.isEmpty(item)) {
throw new BadRequestException("申请任务失败:载具" + vehicle_code + "载具物料信息信息不存在");
}
String groupId = item.get(0).getGroup_id();
MdGruopDick mst = iMdGruopDickService.getById(groupId);
SchBaseTask schBaseTask = iSchBaseTaskService.getOne(new QueryWrapper<SchBaseTask>()
.eq("vehicle_code", vehicle_code).select("task_code")
.lt("status",StatusEnum.FORM_STATUS.code("完成")));
if (schBaseTask!=null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"已经存任务"+schBaseTask.getTask_code());
.lt("status", StatusEnum.FORM_STATUS.code("完成")));
if (schBaseTask != null) {
throw new BadRequestException("申请任务失败:载具" + vehicle_code + "已经存任务" + schBaseTask.getTask_code());
}
JSONObject mstJ = (JSONObject) JSONObject.toJSON(mst);
MdPbVehicleMaterVo vehicleMater = item.get(0);
mstJ.put("stor_code", vehicleMater.getStor_code());
//更新载具proc_inst_id
String currentInstId = vehicleMater.getProc_inst_id();
if (StringUtils.isNotEmpty(currentInstId)){
System.out.println("载具"+vehicle_code+"任务流程信息不存在"+currentInstId);
if (StringUtils.isNotEmpty(currentInstId)) {
System.out.println("载具" + vehicle_code + "任务流程信息不存在" + currentInstId);
ActRuExecution execution = iActRuExecutionService.getById(currentInstId);
if (execution == null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"任务流程信息不存在"+currentInstId);
if (execution == null) {
throw new BadRequestException("申请任务失败:载具" + vehicle_code + "任务流程信息不存在" + currentInstId);
}
FlowContinueEvent continueEvent = new FlowContinueEvent(currentInstId, null, new JSONObject(MapOf.of("start_point", point_code1)));
BussEventMulticaster.Publish(continueEvent);
@@ -96,17 +98,29 @@ public class GroupDickInStorageTask extends AbstractTask {
}else {
BussEventMulticaster.Publish(
new FlowStartEvent("md_group",
(proc_inst_id,empPlace) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
.set("proc_inst_id",proc_inst_id)
.eq("vehicle_code",vehicle_code)
.eq("is_delete",false))
,new JSONObject(MapOf.of("start_point", point_code1)))
.build("md_group_dick",mst.getId(),mst.getSource_form_type(),mst.getSource_form_id(), mstJ)
.build("md_pb_vehicleMater",item)
(proc_inst_id, empPlace) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
.set("proc_inst_id", proc_inst_id)
.eq("vehicle_code", vehicle_code)
.eq("is_delete", false))
, new JSONObject(MapOf.of("start_point", point_code1)))
.build("md_group_dick", mst.getId(), mst.getSource_form_type(), mst.getSource_form_id(), mstJ)
.build("md_pb_vehicleMater", item)
);
}
}
return null;
List<SchBaseTask> list = iSchBaseTaskService.list(new QueryWrapper<SchBaseTask>().in("vehicle_code", data.keySet())
.lt("status", StatusEnum.FORM_STATUS.code("完成")));
JSONObject jsonObject = new JSONObject();
if (ObjectUtils.isNotEmpty(list)) {
if (list.size() == data.keySet().size()) {
jsonObject.put("task_code", list.size() > 1 ? list.stream().map(SchBaseTask::getTask_code).collect(Collectors.joining(",")) : list.get(0).getTask_code());
return jsonObject;
} else {
return null;
}
} else {
return null;
}
}
@Override

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.enums.StatusEnum;
@@ -59,7 +60,7 @@ public class PalletInStorageTask extends AbstractTask {
@Override
public JSONObject createTask(JSONObject data) {
// :{"start_point":"1120","vehicle_code":"T00000199","height":0}
// :{"start_point":"1120","vehicle_code":"T00000199","height":0}
String point_code1 = data.getString("start_point");
String vehicle_code = data.getString("vehicle_code");
String h = data.getString("height");
@@ -123,16 +124,24 @@ public class PalletInStorageTask extends AbstractTask {
mstJ.put("stor_code", vehicleMater.getStor_code());
BussEventMulticaster.Publish(
new FlowStartEvent("md_group",
(proc_inst_id,empPlace) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
.set("proc_inst_id",proc_inst_id)
.eq("vehicle_code",vehicle_code)
.eq("is_delete",false))
,new JSONObject(MapOf.of("start_point", point_code1)))
.build("md_group_dick",mst.getId(),mst.getSource_form_type(),mst.getSource_form_id(), mstJ)
.build("md_pb_vehicleMater",item)
(proc_inst_id, empPlace) -> iMdPbVehicleMaterService.update(new UpdateWrapper<MdPbVehicleMater>()
.set("proc_inst_id", proc_inst_id)
.eq("vehicle_code", vehicle_code)
.eq("is_delete", false))
, new JSONObject(MapOf.of("start_point", point_code1)))
.build("md_group_dick", mst.getId(), mst.getSource_form_type(), mst.getSource_form_id(), mstJ)
.build("md_pb_vehicleMater", item)
);
}
return null;
List<SchBaseTask> list = iSchBaseTaskService.list(new QueryWrapper<SchBaseTask>().eq("vehicle_code", vehicle_code)
.lt("status", StatusEnum.FORM_STATUS.code("完成")));
if (ObjectUtils.isNotEmpty(list)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", list.get(0).getTask_code());
return jsonObject;
} else {
return null;
}
}
@Override

View File

@@ -74,7 +74,7 @@ public class CockpitServiceImpl implements CockpitService {
*/
@Override
public List<SchBasePoint> queryPickingPoint() {
return schBasePointServiceImpl.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, "PICK01").eq(SchBasePoint::getIs_used, true));
return schBasePointServiceImpl.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, "PICK01"));
}
@@ -456,6 +456,7 @@ public class CockpitServiceImpl implements CockpitService {
*/
@Override
public List<TaskInfo> pickingInfo(String code) {
// List<SchBasePoint> pointList = schBasePointServiceImpl.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getRegion_code, "PICK01"));
List<TaskInfo> taskList = cockpitMapper.getPickingTask(code);
taskList.forEach(r -> {
if (StringUtils.isNotBlank(r.getForm_data())) {

View File

@@ -96,8 +96,7 @@ public class PmFormDataController {
iPmFormDataService.update(
new LambdaUpdateWrapper<PmFormData>()
.set(PmFormData::getStatus, StatusEnum.FORM_STATUS.code("完成"))
.in(PmFormData::getId, ids)
);
.in(PmFormData::getId, ids));
}
return new ResponseEntity<>(HttpStatus.OK);
}

View File

@@ -166,6 +166,7 @@
left join md_me_materialbase material on vm.material_id = material.material_id
<where>
struct.vehicle_code is not null
AND (struct.stor_code != 'HStockId' and struct.stor_code != 'CStockId' )
and vm.is_delete = false
<if test="query.search != null and query.search != ''">
and (struct.struct_code LIKE '%${query.search}%'

View File

@@ -426,9 +426,8 @@ export default {
return
}
const ids = this.currentRow.map(row => row.id)
// 构造参数
const param = {
data: ids // 将提取的 id 数组赋值给 param.data
data: ids
}
crudFormData.confirm(param).then(res => {
this.crud.notify('单据处理成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)