add:合箱管理
This commit is contained in:
@@ -94,4 +94,12 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getBigScreenIvt();
|
||||
|
||||
/**
|
||||
* 获取可用库存分页查询
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<JSONObject>
|
||||
*/
|
||||
IPage<JSONObject> getCanuseIvtQtyAsc(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
}
|
||||
|
||||
@@ -365,4 +365,68 @@
|
||||
GROUP BY ext.material_id
|
||||
ORDER BY canuse_qty DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getCanuseIvtQtyAsc" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
ext.storagevehicleext_id,
|
||||
ext.storagevehicle_code,
|
||||
ext.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
ext.pcsn,
|
||||
ext.qty_unit_id,
|
||||
ext.qty_unit_name,
|
||||
ext.canuse_qty AS qty,
|
||||
ext.frozen_qty,
|
||||
attr.sect_name AS turnout_sect_name,
|
||||
attr.sect_code AS turnout_sect_code,
|
||||
attr.sect_id,
|
||||
attr.stor_id,
|
||||
attr.struct_id,
|
||||
attr.struct_code AS turnout_struct_code
|
||||
FROM
|
||||
md_pb_storagevehicleext ext
|
||||
INNER JOIN md_me_materialbase material ON material.material_id = ext.material_id
|
||||
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
INNER JOIN md_pb_groupplate late ON ext.storagevehicle_code = late.storagevehicle_code
|
||||
AND late.material_id = ext.material_id AND late.pcsn = ext.pcsn
|
||||
<where>
|
||||
attr.lock_type = '0'
|
||||
AND attr.is_used = "1"
|
||||
AND late.status = "2"
|
||||
AND ext.canuse_qty > 0
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
AND
|
||||
attr.stor_id = #{param.stor_id}
|
||||
</if>
|
||||
|
||||
<if test="param.sect_id != null and param.sect_id != ''">
|
||||
AND
|
||||
attr.sect_id = #{param.sect_id}
|
||||
</if>
|
||||
|
||||
<if test="param.struct_code != null and param.struct_code != ''">
|
||||
AND
|
||||
attr.struct_code LIKE #{param.struct_code}
|
||||
</if>
|
||||
|
||||
<if test="param.material_code != null and param.material_code != ''">
|
||||
AND
|
||||
material.material_code = #{param.material_code}
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
ext.pcsn = #{param.pcsn}
|
||||
</if>
|
||||
|
||||
<if test="param.bake_num != null and param.bake_num != ''">
|
||||
AND
|
||||
late.bake_num = #{param.bake_num}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY ext.canuse_qty
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -216,7 +216,7 @@ public class MdPbStoragevehicleextServiceImpl extends ServiceImpl<MdPbStorageveh
|
||||
moveInsertDto.setTotal_qty(extDao.getCanuse_qty());
|
||||
moveInsertDto.setDetail_count(BigDecimal.ONE);
|
||||
moveInsertDto.setBill_status(IOSEnum.MOVE_MST_STATUS.code("生成"));
|
||||
moveInsertDto.setRemark("由库存状态变更发起!");
|
||||
moveInsertDto.setRemark("由库存状态变更创建!");
|
||||
|
||||
// 组织明细
|
||||
List<JSONObject> dtlList = new ArrayList<>();
|
||||
|
||||
@@ -312,8 +312,10 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
Structattr attrDao = attrList.stream()
|
||||
.filter(row -> row.getStruct_code().equals(json.getString("struct_code")))
|
||||
.findFirst().orElse(null);
|
||||
attrDao.setLock_type(json.getString("lock_type"));
|
||||
this.update(attrDao);
|
||||
if (ObjectUtil.isNotEmpty(attrDao)) {
|
||||
attrDao.setLock_type(json.getString("lock_type"));
|
||||
this.update(attrDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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;
|
||||
@@ -11,7 +12,9 @@ import org.nl.config.IdUtil;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
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.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
@@ -46,6 +49,12 @@ public class BackInTask extends AbstractTask {
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
@@ -146,6 +155,14 @@ public class BackInTask extends AbstractTask {
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
// 更新起点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
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.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
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.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.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCombinedBoxService;
|
||||
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.dao.StIvtCombinedBox;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
|
||||
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 2025-08-22
|
||||
*/
|
||||
@Component(value = "CombinedBoxInTask")
|
||||
@TaskType("CombinedBoxInTask")
|
||||
public class CombinedBoxInTask extends AbstractTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
/**
|
||||
* 入库服务
|
||||
*/
|
||||
@Resource
|
||||
private IRawAssistIStorService rawAssistIStorService;
|
||||
|
||||
/**
|
||||
* 分配明细mapper
|
||||
*/
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
/**
|
||||
* 合箱记录服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtCombinedBoxService iStIvtCombinedBoxService;
|
||||
|
||||
/**
|
||||
* 入库明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
|
||||
@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(CombinedBoxInTask.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.setGroup_id(json.getString("group_id"));
|
||||
task.setRequest_param(json.toString());
|
||||
task.setTask_type(TaskEnum.TASK_TYPE.code("料箱"));
|
||||
task.setPriority(json.getString("Priority"));
|
||||
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.setTask_type("1");
|
||||
|
||||
return acsTaskDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
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)) {
|
||||
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
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
if (!TaskStatus.CREATE.getCode().equals(taskObj.getTask_status())) {
|
||||
throw new BadRequestException("任务状态必须为生成才能取消任务");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
// 更新起点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
|
||||
);
|
||||
this.taskConfirm(taskObj.getTask_code());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
// 取消任务
|
||||
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.set(SchBaseTask::getIs_delete, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(SchBaseTask::getTask_status, TaskStatus.CANCELED.getCode())
|
||||
.set(SchBaseTask::getRemark, "已取消")
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
//分配表清除任务
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getTask_id, null)
|
||||
.set(IOStorInvDis::getPoint_code, null)
|
||||
.set(IOStorInvDis::getIs_issued, 0)
|
||||
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
|
||||
// 更新任务状态
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskConfirm(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
// 查询分配明细
|
||||
IOStorInvDis disDao = ioStorInvDisMapper.selectOne(
|
||||
new QueryWrapper<IOStorInvDis>().lambda()
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
// 查询明细
|
||||
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectById(disDao.getIostorinvdtl_id());
|
||||
// 更新合箱记录状态为完成
|
||||
StIvtCombinedBox boxDao = iStIvtCombinedBoxService.getById(dtlDao.getSource_bill_code());
|
||||
boxDao.setStatus(IOSEnum.COMBINED_BOX_STATUS.code("完成"));
|
||||
iStIvtCombinedBoxService.updateById(boxDao);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
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.query.QueryWrapper;
|
||||
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.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
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.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.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCombinedBoxService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvdtlService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCombinedBox;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 合箱移库任务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
@Component(value = "CombinedBoxMoveTask")
|
||||
@TaskType("CombinedBoxMoveTask")
|
||||
public class CombinedBoxMoveTask extends AbstractTask {
|
||||
|
||||
/**
|
||||
* 任务服务类
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
/**
|
||||
* 移库主表服务类
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoveinvService iStIvtMoveinvService;
|
||||
|
||||
/**
|
||||
* 移库明细服务类
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoveinvdtlService iStIvtMoveinvdtlService;
|
||||
|
||||
/**
|
||||
* 合箱记录服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtCombinedBoxService iStIvtCombinedBoxService;
|
||||
|
||||
/**
|
||||
* 仓位服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
/**
|
||||
* 库存记录服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
|
||||
/**
|
||||
* 组盘记录服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
@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(CombinedBoxMoveTask.class.getSimpleName());
|
||||
task.setPoint_code1(json.getString("point_code1"));
|
||||
task.setPoint_code2(json.getString("point_code2"));
|
||||
task.setVehicle_code(json.getString("vehicle_code"));
|
||||
task.setGroup_id(json.getString("group_id"));
|
||||
task.setRequest_param(json.toString());
|
||||
task.setPriority(json.getString("Priority"));
|
||||
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.setTask_type("1");
|
||||
return acsTaskDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
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)) {
|
||||
// 更新明细状态
|
||||
iStIvtMoveinvService.executing(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
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 完成任务
|
||||
this.taskConfirm(taskObj.getTask_code());
|
||||
// 更新任务状态
|
||||
taskObj.setRemark("已完成");
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
// 删除任务
|
||||
StIvtMoveinvdtl dtlDao = iStIvtMoveinvdtlService.getOne(
|
||||
new QueryWrapper<StIvtMoveinvdtl>().lambda()
|
||||
.eq(StIvtMoveinvdtl::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
iStIvtMoveinvService.cancelTask(dtlDao);
|
||||
// 更新合箱记录状态
|
||||
StIvtCombinedBox boxDao = iStIvtCombinedBoxService.getById(dtlDao.getSource_bill_code());
|
||||
boxDao.setStatus(IOSEnum.COMBINED_BOX_STATUS.code("生成"));
|
||||
boxDao.setMove_id("");
|
||||
iStIvtCombinedBoxService.updateById(boxDao);
|
||||
|
||||
// 更新任务状态
|
||||
taskObj.setRemark("已取消");
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskConfirm(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
StIvtMoveinvdtl dtlDao = iStIvtMoveinvdtlService.getOne(
|
||||
new QueryWrapper<StIvtMoveinvdtl>().lambda()
|
||||
.eq(StIvtMoveinvdtl::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
|
||||
// 更新起点
|
||||
iStructattrService.update(
|
||||
new UpdateWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code1())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.set(Structattr::getStoragevehicle_code, null)
|
||||
);
|
||||
// 更新终点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有箱有料"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
|
||||
|
||||
);
|
||||
|
||||
// 更新移库明细状态
|
||||
dtlDao.setWork_status(IOSEnum.MOVE_DTL_STATUS.code("完成"));
|
||||
iStIvtMoveinvdtlService.updateById(dtlDao);
|
||||
// 更新移库主表状态
|
||||
iStIvtMoveinvService.updateMstStatus(dtlDao.getMoveinv_id());
|
||||
|
||||
// 更新合箱记录状态
|
||||
StIvtCombinedBox boxDao = iStIvtCombinedBoxService.getById(dtlDao.getSource_bill_code());
|
||||
boxDao.setStatus(IOSEnum.COMBINED_BOX_STATUS.code("移库完成"));
|
||||
iStIvtCombinedBoxService.updateById(boxDao);
|
||||
|
||||
// 删除库存记录
|
||||
iMdPbStoragevehicleextService.remove(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, dtlDao.getStoragevehicle_code())
|
||||
.eq(MdPbStoragevehicleext::getPcsn, dtlDao.getPcsn())
|
||||
.eq(MdPbStoragevehicleext::getMaterial_id, boxDao.getMaterial_id())
|
||||
);
|
||||
|
||||
// 更新组盘记录为生成
|
||||
iMdPbGroupplateService.update(
|
||||
new UpdateWrapper<GroupPlate>().lambda()
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
.eq(GroupPlate::getStoragevehicle_code, dtlDao.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getPcsn, dtlDao.getPcsn())
|
||||
.eq(GroupPlate::getMaterial_id, boxDao.getMaterial_id())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,18 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
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.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
@@ -46,6 +50,12 @@ public class DetainInTask extends AbstractTask {
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
@@ -146,6 +156,14 @@ public class DetainInTask extends AbstractTask {
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
// 更新起点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -27,9 +27,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 手持定点任务
|
||||
* @Date: 2025/6/6
|
||||
* <p>
|
||||
* 点对点任务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
@Component(value = "PdaPointTask")
|
||||
@TaskType("PdaPointTask")
|
||||
|
||||
@@ -13,7 +13,9 @@ import org.nl.config.IdUtil;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
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.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
@@ -53,6 +55,12 @@ public class SelectBackInTask extends AbstractTask {
|
||||
@Resource
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
@@ -197,5 +205,13 @@ public class SelectBackInTask extends AbstractTask {
|
||||
.eq(GroupPlate::getPcsn, disDao.getPcsn())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
);
|
||||
// 更新起点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package org.nl.wms.warehouse_management.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCombinedBoxService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCombinedBox;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 合箱管理 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/combinedBox")
|
||||
@Slf4j
|
||||
public class ISIvtCombinedBoxController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtCombinedBoxService iStIvtCombinedBoxService;
|
||||
|
||||
@GetMapping
|
||||
@Log("分页查询")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iStIvtCombinedBoxService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getCanuseIvt")
|
||||
@Log("获取可用库存物料")
|
||||
public ResponseEntity<Object> getCanuseIvt(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iStIvtCombinedBoxService.getCanuseIvt(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增合箱")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody StIvtCombinedBox dto) {
|
||||
iStIvtCombinedBoxService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改合箱")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody StIvtCombinedBox dto) {
|
||||
iStIvtCombinedBoxService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除合箱")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iStIvtCombinedBoxService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendMoveTask")
|
||||
@Log("下发移库任务")
|
||||
public ResponseEntity<Object> sendMoveTask(@RequestBody StIvtCombinedBox dto) {
|
||||
iStIvtCombinedBoxService.sendMoveTask(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/getWeigh")
|
||||
@Log("获取称重重量")
|
||||
public ResponseEntity<Object> getWeigh(@RequestBody StIvtCombinedBox dto) {
|
||||
return new ResponseEntity<>(iStIvtCombinedBoxService.getWeigh(dto), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/saveWeigh")
|
||||
@Log("保存称重重量")
|
||||
public ResponseEntity<Object> saveWeigh(@RequestBody StIvtCombinedBox dto) {
|
||||
iStIvtCombinedBoxService.saveWeigh(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmIn")
|
||||
@Log("入库确认")
|
||||
public ResponseEntity<Object> confirmIn(@RequestBody StIvtCombinedBox dto) {
|
||||
iStIvtCombinedBoxService.confirmIn(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,11 +38,11 @@ public enum IOSEnum {
|
||||
)),
|
||||
|
||||
// 移库业务类型
|
||||
MOVE_BILL_TYPE(MapOf.of("库内移库","2001")),
|
||||
MOVE_BILL_TYPE(MapOf.of("库内移库","2001", "合箱移库","2002")),
|
||||
|
||||
// 入库任务配置类编码
|
||||
IN_CONFIG_CODE(MapOf.of("0001","DetainInTask", "0002", "BackInTask",
|
||||
"0003", "GeBoxInTask", "0004", "PieceBoxInTask", "0005", "SelectBackInTask", "0009", "HandInTask"
|
||||
"0003", "CombinedBoxInTask", "0004", "PieceBoxInTask", "0005", "SelectBackInTask", "0009", "HandInTask"
|
||||
)),
|
||||
|
||||
// 出库任务配置类编码
|
||||
@@ -51,7 +51,7 @@ public enum IOSEnum {
|
||||
)),
|
||||
|
||||
// 移库任务配置类编码
|
||||
MOVE_CONFIG_CODE(MapOf.of("2001","InsideMoveTask", "2002", "2002",
|
||||
MOVE_CONFIG_CODE(MapOf.of("2001","InsideMoveTask", "2002", "CombinedBoxMoveTask",
|
||||
"2003", "2003", "2004", "2004", "2005", "2005"
|
||||
)),
|
||||
|
||||
@@ -61,6 +61,9 @@ public enum IOSEnum {
|
||||
//组盘记录状态
|
||||
GROUP_PLATE_STATUS(MapOf.of( "组盘", "1", "入库", "2", "出库", "3")),
|
||||
|
||||
//合箱记录状态
|
||||
COMBINED_BOX_STATUS(MapOf.of( "生成", "1", "移库中", "2", "移库完成", "3", "入库中", "4", "完成", "5")),
|
||||
|
||||
// 锁类型
|
||||
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2"
|
||||
, "移入锁", "3", "移出锁", "4", "空托盘入库锁", "5", "空托盘出库锁", "6",
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.nl.wms.warehouse_management.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCombinedBox;
|
||||
import org.nl.wms.warehouse_management.service.dto.StIvtCombinedBoxDto;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 合箱记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
public interface IStIvtCombinedBoxService extends IService<StIvtCombinedBox> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<StIvtCombinedBoxDto> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 新增合箱
|
||||
*
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void create(StIvtCombinedBox dto);
|
||||
|
||||
/**
|
||||
* 修改合箱
|
||||
*
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void update(StIvtCombinedBox dto);
|
||||
|
||||
/**
|
||||
* 删除合箱
|
||||
*
|
||||
* @param ids id集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 获取可用库存物料
|
||||
*
|
||||
* @param whereJson : {
|
||||
* 分页参数:page,size
|
||||
* stor_id: 仓库id
|
||||
* struct_code: 货位编码
|
||||
* material_code: 物料编码
|
||||
* pcsn: 批次
|
||||
* bake_num: 烘干次数
|
||||
* }
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 下发移库任务
|
||||
*
|
||||
* @param dto 实体类
|
||||
*/
|
||||
void sendMoveTask(StIvtCombinedBox dto);
|
||||
|
||||
/**
|
||||
* 获取称重重量
|
||||
* @param dto 实体类dto
|
||||
* @return JSONObject {
|
||||
* weigh_qty
|
||||
* }
|
||||
*/
|
||||
JSONObject getWeigh(StIvtCombinedBox dto);
|
||||
|
||||
/**
|
||||
* 保存称重
|
||||
* @param dto 实体类dto
|
||||
*/
|
||||
void saveWeigh(StIvtCombinedBox dto);
|
||||
|
||||
/**
|
||||
* 入库确认
|
||||
* @param dto 实体类dto
|
||||
*/
|
||||
void confirmIn(StIvtCombinedBox dto);
|
||||
}
|
||||
@@ -93,6 +93,12 @@ public interface IStIvtMoveinvService extends IService<StIvtMoveinv> {
|
||||
*/
|
||||
void executing(SchBaseTask taskObj);
|
||||
|
||||
/**
|
||||
* 更新主表状态
|
||||
* @param moveinv_id 移库单id
|
||||
*/
|
||||
void updateMstStatus(String moveinv_id);
|
||||
|
||||
/**
|
||||
* 强制确认
|
||||
* @param dto 新增修改dto实体类
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.nl.wms.warehouse_management.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 合箱记录表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_combinedbox")
|
||||
public class StIvtCombinedBox implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id标识
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 烘干次数
|
||||
*/
|
||||
private Integer hot_num;
|
||||
|
||||
/**
|
||||
* 半满箱载具编码
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 半满箱载具编码
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 半满箱库存数量
|
||||
*/
|
||||
private BigDecimal ivt_qty;
|
||||
|
||||
/**
|
||||
* 移库单明细
|
||||
*/
|
||||
private String move_id;
|
||||
|
||||
/**
|
||||
* 称重重量
|
||||
*/
|
||||
private BigDecimal weight_qty;
|
||||
|
||||
/**
|
||||
* 加料重量
|
||||
*/
|
||||
private BigDecimal material_qty;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人名称
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.warehouse_management.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCombinedBox;
|
||||
import org.nl.wms.warehouse_management.service.dto.StIvtCombinedBoxDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 合箱记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
public interface StIvtCombinedBoxMapper extends BaseMapper<StIvtCombinedBox> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<PdmBomCallMaterialDto>
|
||||
*/
|
||||
IPage<StIvtCombinedBoxDto> queryAllByPage(Page<StIvtCombinedBoxDto> page, @Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.warehouse_management.service.dao.mapper.StIvtCombinedBoxMapper">
|
||||
|
||||
<select id="queryAllByPage" resultType="org.nl.wms.warehouse_management.service.dto.StIvtCombinedBoxDto">
|
||||
SELECT
|
||||
box.*,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec
|
||||
FROM
|
||||
st_ivt_combinedbox box
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = box.material_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.material_code != null and param.material_code != ''">
|
||||
AND
|
||||
(mater.material_code LIKE #{param.material_code} or
|
||||
mater.material_name LIKE #{param.material_code} )
|
||||
</if>
|
||||
|
||||
<if test="param.vehicle_code != null and param.vehicle_code != ''">
|
||||
AND
|
||||
box.vehicle_code LIKE #{param.vehicle_code}
|
||||
</if>
|
||||
|
||||
<if test="param.pcsn != null and param.pcsn != ''">
|
||||
AND
|
||||
box.pcsn LIKE #{param.pcsn}
|
||||
</if>
|
||||
|
||||
<if test="param.status != null and param.status != ''">
|
||||
AND
|
||||
box.status = #{param.status}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY box.create_time Desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.wms.warehouse_management.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCombinedBox;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 合箱dto
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-14
|
||||
*/
|
||||
@Data
|
||||
public class StIvtCombinedBoxDto extends StIvtCombinedBox {
|
||||
|
||||
/**
|
||||
* 物料标批次
|
||||
*/
|
||||
private String material_spec;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
}
|
||||
@@ -214,7 +214,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
||||
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
||||
ioStorInvDtl.put("material_id", row.get("material_id"));
|
||||
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
|
||||
ioStorInvDtl.put("pcsn", row.get("pcsn"));
|
||||
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
ioStorInvDtl.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
|
||||
@@ -0,0 +1,425 @@
|
||||
package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.ext.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.service.util.AcsResponse;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
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.*;
|
||||
import org.nl.wms.warehouse_management.service.dao.*;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtCombinedBoxMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto;
|
||||
import org.nl.wms.warehouse_management.service.dto.StIvtCombinedBoxDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 合箱记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
@Service
|
||||
public class StIvtCombinedBoxServiceImpl extends ServiceImpl<StIvtCombinedBoxMapper, StIvtCombinedBox> implements IStIvtCombinedBoxService {
|
||||
|
||||
/**
|
||||
* 载具扩展属性mapper
|
||||
*/
|
||||
@Resource
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
/**
|
||||
* 仓位服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 物料服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||
|
||||
/**
|
||||
* 计量单位服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
||||
|
||||
/**
|
||||
* 移库单服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoveinvService iStIvtMoveinvService;
|
||||
|
||||
/**
|
||||
* 移库单明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoveinvdtlService iStIvtMoveinvdtlService;
|
||||
|
||||
/**
|
||||
* 点位信息服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
/**
|
||||
* 载具信息服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
|
||||
|
||||
/**
|
||||
* wms调用acs服务
|
||||
*/
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
/**
|
||||
* 入库服务
|
||||
*/
|
||||
@Autowired
|
||||
private IRawAssistIStorService iRawAssistIStorService;
|
||||
|
||||
/**
|
||||
* 库区服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISectattrService iSectattrService;
|
||||
|
||||
/**
|
||||
* 入库明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
|
||||
/**
|
||||
* 组盘记录服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
@Override
|
||||
public IPage<StIvtCombinedBoxDto> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(StIvtCombinedBox dto) {
|
||||
dto.setId(IdUtil.getStringId());
|
||||
dto.setStatus(IOSEnum.COMBINED_BOX_STATUS.code("生成"));
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
this.save(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(StIvtCombinedBox dto) {
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Set<String> ids) {
|
||||
this.removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page) {
|
||||
return mdPbStoragevehicleextMapper.getCanuseIvtQtyAsc(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void sendMoveTask(StIvtCombinedBox dto) {
|
||||
// 组织移库生成单据
|
||||
String movedtl_id = createMoveTask(dto);
|
||||
// 更新单据状态
|
||||
dto.setStatus(IOSEnum.COMBINED_BOX_STATUS.code("移库中"));
|
||||
dto.setMove_id(movedtl_id);
|
||||
this.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getWeigh(StIvtCombinedBox dto) {
|
||||
// 判断当前载具是否是称重位上的载具
|
||||
SchBasePoint pointDao = iSchBasePointService.getById(IOSConstant.CZW_POINT);
|
||||
if (!pointDao.getVehicle_code().equals(dto.getVehicle_code())) {
|
||||
throw new BadRequestException("当前称重位载具与合箱载具不符,当前称重位载具为【" + pointDao.getVehicle_code() + "】");
|
||||
}
|
||||
// 获取载具信息
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(pointDao.getVehicle_code());
|
||||
if (ObjectUtil.isEmpty(vehicleDao.getWeigth())) {
|
||||
throw new BadRequestException("请维护当前载具重量【" + pointDao.getVehicle_code() + "】");
|
||||
}
|
||||
|
||||
// TODO 调用ACS接口获取称重信息
|
||||
AcsResponse weighAcs = wmsToAcsService.getWeighAcs(new JSONObject());
|
||||
JSONObject jsonResult = weighAcs.getResultData();
|
||||
|
||||
// 称重重量
|
||||
double weigh_qty = NumberUtil.round(jsonResult.getDoubleValue("weigh_qty"), 2).doubleValue();
|
||||
// 扣除载具重量
|
||||
double sub_qty = NumberUtil.sub(weigh_qty, vehicleDao.getWeigth().doubleValue());
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("weigh_qty", NumberUtil.round(sub_qty, 2));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveWeigh(StIvtCombinedBox dto) {
|
||||
// 更新合箱记录称重重量、加料重量
|
||||
StIvtCombinedBox boxDao = this.getById(dto.getId());
|
||||
boxDao.setWeight_qty(dto.getWeight_qty());
|
||||
boxDao.setMaterial_qty(dto.getMaterial_qty());
|
||||
this.updateById(dto);
|
||||
|
||||
// 更新组盘重量
|
||||
iMdPbGroupplateService.update(
|
||||
new UpdateWrapper<GroupPlate>().lambda()
|
||||
.set(GroupPlate::getQty, dto.getWeight_qty())
|
||||
.eq(GroupPlate::getStoragevehicle_code, dto.getVehicle_code())
|
||||
.eq(GroupPlate::getPcsn, dto.getPcsn())
|
||||
.eq(GroupPlate::getMaterial_id, boxDao.getMaterial_id())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirmIn(StIvtCombinedBox dto) {
|
||||
// 组织入库数据
|
||||
JSONObject resultJson = createCombineBoxIn(dto);
|
||||
// 调用分配
|
||||
JSONObject resultMap = divCombineBoxIn(resultJson);
|
||||
// 调用下发
|
||||
sendTask(resultMap);
|
||||
// 更新合箱记录为入库中
|
||||
StIvtCombinedBox boxDao = this.getById(dto.getId());
|
||||
boxDao.setStatus(IOSEnum.COMBINED_BOX_STATUS.code("入库中"));
|
||||
this.updateById(boxDao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建移库单并下发任务
|
||||
* @param dto 合箱实体类
|
||||
* @return movedtl_id 明细标识
|
||||
*/
|
||||
private String createMoveTask(StIvtCombinedBox dto) {
|
||||
// 查询移出货位
|
||||
List<Structattr> attrDaoList = iStructattrService.list(
|
||||
new QueryWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.ne(Structattr::getIs_emptyvehicle, IOSConstant.ONE)
|
||||
.eq(Structattr::getStoragevehicle_code, dto.getVehicle_code())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(attrDaoList)) {
|
||||
throw new BadRequestException("当前载具正在执行任务或者载具不在库内!");
|
||||
}
|
||||
if (attrDaoList.size() > 1) {
|
||||
throw new BadRequestException("库内载具【"+dto.getVehicle_code()+"】重复,请检查数据!");
|
||||
}
|
||||
|
||||
// 组织主表
|
||||
MoveInsertDto moveInsertDto = new MoveInsertDto();
|
||||
moveInsertDto.setBill_type(IOSEnum.MOVE_BILL_TYPE.code("合箱移库"));
|
||||
moveInsertDto.setBiz_date(DateUtil.today());
|
||||
moveInsertDto.setStor_id(attrDaoList.get(0).getStor_id());
|
||||
moveInsertDto.setTotal_qty(dto.getIvt_qty());
|
||||
moveInsertDto.setDetail_count(BigDecimal.ONE);
|
||||
moveInsertDto.setBill_status(IOSEnum.MOVE_MST_STATUS.code("生成"));
|
||||
moveInsertDto.setRemark("由合箱单据创建!");
|
||||
|
||||
// 组织明细
|
||||
List<JSONObject> dtlList = new ArrayList<>();
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("turnout_sect_code", attrDaoList.get(0).getSect_code());
|
||||
jsonDtl.put("turnout_struct_code", attrDaoList.get(0).getStruct_code());
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(dto.getMaterial_id());
|
||||
jsonDtl.put("material_code", materDao.getMaterial_code());
|
||||
jsonDtl.put("material_id", materDao.getMaterial_id());
|
||||
jsonDtl.put("pcsn", dto.getPcsn());
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getByCode("KG");
|
||||
jsonDtl.put("qty_unit_id", unitDao.getMeasure_unit_id());
|
||||
jsonDtl.put("qty_unit_name", unitDao.getUnit_name());
|
||||
jsonDtl.put("qty", dto.getIvt_qty());
|
||||
jsonDtl.put("turnin_sect_code", IOSConstant.CZW_POINT);
|
||||
jsonDtl.put("turnin_struct_code", IOSConstant.CZW_POINT);
|
||||
jsonDtl.put("work_status", IOSEnum.MOVE_DTL_STATUS.code("生成"));
|
||||
jsonDtl.put("storagevehicle_code", dto.getVehicle_code());
|
||||
jsonDtl.put("source_bill_code", dto.getId());
|
||||
dtlList.add(jsonDtl);
|
||||
moveInsertDto.setTableData(dtlList);
|
||||
|
||||
// 调用移库单新增
|
||||
String move_id = iStIvtMoveinvService.create(moveInsertDto);
|
||||
// 下发任务
|
||||
StIvtMoveinv moveDao = new StIvtMoveinv();
|
||||
moveDao.setMoveinv_id(move_id);
|
||||
iStIvtMoveinvService.sendTask(moveDao);
|
||||
|
||||
// 查询明细标识
|
||||
StIvtMoveinvdtl dtlDao = iStIvtMoveinvdtlService.getOne(
|
||||
new QueryWrapper<StIvtMoveinvdtl>().lambda()
|
||||
.eq(StIvtMoveinvdtl::getMoveinv_id, move_id)
|
||||
);
|
||||
return dtlDao.getMoveinvdtl_id();
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织入库数据
|
||||
* @param dto 合箱实体类dto
|
||||
* @return JSONObject
|
||||
*/
|
||||
private JSONObject createCombineBoxIn(StIvtCombinedBox dto) {
|
||||
// 查询移库单明细
|
||||
StIvtMoveinvdtl moveDtlDao = iStIvtMoveinvdtlService.getById(dto.getMove_id());
|
||||
// 查询主表
|
||||
StIvtMoveinv moveMstDao = iStIvtMoveinvService.getById(moveDtlDao.getMoveinv_id());
|
||||
// 查询移库仓位
|
||||
Structattr attrDao = iStructattrService.getByCode(moveDtlDao.getTurnout_struct_code());
|
||||
|
||||
// 组织主表数据
|
||||
Map<String, Object> jsonMst = new HashMap<>();
|
||||
jsonMst.put("stor_id", moveMstDao.getStor_id());
|
||||
jsonMst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
jsonMst.put("total_qty", dto.getWeight_qty());
|
||||
jsonMst.put("detail_count", 1);
|
||||
jsonMst.put("bill_type", IOSEnum.IN_BILL_TYPE.code("合箱入库"));
|
||||
jsonMst.put("biz_date", DateUtil.now());
|
||||
|
||||
// 组织明细数据
|
||||
ArrayList<HashMap> tableData = new ArrayList<>();
|
||||
HashMap<String, String> dtl = new HashMap<>();
|
||||
dtl.put("storagevehicle_code", dto.getVehicle_code());
|
||||
dtl.put("pcsn", dto.getPcsn());
|
||||
dtl.put("qty_unit_id", moveDtlDao.getQty_unit_id());
|
||||
dtl.put("qty_unit_name", moveDtlDao.getQty_unit_name());
|
||||
dtl.put("qty", dto.getWeight_qty().toString());
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(dto.getMaterial_id());
|
||||
dtl.put("material_code", materDao.getMaterial_code());
|
||||
dtl.put("material_name", materDao.getMaterial_name());
|
||||
dtl.put("material_id", materDao.getMaterial_id());
|
||||
dtl.put("plan_qty", dto.getWeight_qty().toString());
|
||||
dtl.put("ext_code", dto.getId());
|
||||
// 调用新增
|
||||
tableData.add(dtl);
|
||||
jsonMst.put("tableData", tableData);
|
||||
String iostorinv_id = iRawAssistIStorService.insertDtl(jsonMst);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("sect_id", attrDao.getSect_id());
|
||||
result.put("iostorinv_id", iostorinv_id);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织分配数据
|
||||
*
|
||||
* @param whereJson {
|
||||
* iostorinv_id
|
||||
* sect_id
|
||||
* }
|
||||
* @return JSONObject
|
||||
*/
|
||||
private JSONObject divCombineBoxIn(JSONObject whereJson) {
|
||||
// 查询库区
|
||||
Sectattr sectDao = iSectattrService.getById(whereJson.getString("sect_id"));
|
||||
// 组织主数据
|
||||
Map<String, Object> jsonMst = new HashMap<>();
|
||||
jsonMst.put("checked", true);
|
||||
jsonMst.put("sect_id", sectDao.getSect_id());
|
||||
jsonMst.put("stor_id", sectDao.getStor_id());
|
||||
// 组织明细数据
|
||||
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectOne(
|
||||
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
// 查找分配明细
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("iostorinvdtl_id", dtlDao.getIostorinvdtl_id());
|
||||
List<IOStorInvDisDto> disDtl = iRawAssistIStorService.getDisDtl(map);
|
||||
// 类型转换
|
||||
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();
|
||||
disDtl.forEach(item -> {
|
||||
tableMater.add(JSONObject.parseObject(JSONObject.toJSONString(item), LinkedHashMap.class));
|
||||
});
|
||||
jsonMst.put("tableMater", tableMater);
|
||||
// 调用分配
|
||||
iRawAssistIStorService.divStruct(jsonMst);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("storagevehicle_code", disDtl.get(0).getStoragevehicle_code());
|
||||
result.put("point_code", IOSConstant.CZW_POINT);
|
||||
result.put("sect_id", disDtl.get(0).getSect_id());
|
||||
result.put("iostorinv_id", disDtl.get(0).getIostorinv_id());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发任务
|
||||
*
|
||||
* @param whereJson {
|
||||
* storagevehicle_code:载具编码
|
||||
* point_code:点位编码
|
||||
* sect_id:库区
|
||||
* iostorinv_id: id
|
||||
* }
|
||||
*/
|
||||
private void sendTask(JSONObject whereJson) {
|
||||
// 组织主数据
|
||||
Map<String, Object> jsonMst = new HashMap<>();
|
||||
jsonMst.put("point_code", whereJson.getString("point_code"));
|
||||
// 组织明细数据
|
||||
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectOne(
|
||||
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
// 查找分配明细
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("iostorinvdtl_id", dtlDao.getIostorinvdtl_id());
|
||||
List<IOStorInvDisDto> disDtl = iRawAssistIStorService.getDisDtl(map);
|
||||
// 类型转换
|
||||
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();
|
||||
disDtl.forEach(item -> {
|
||||
tableMater.add(JSONObject.parseObject(JSONObject.toJSONString(item), LinkedHashMap.class));
|
||||
});
|
||||
jsonMst.put("tableMater", tableMater);
|
||||
|
||||
iRawAssistIStorService.divPoint(jsonMst);
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,7 @@ import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
@@ -24,7 +22,6 @@ import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
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.TaskFactory;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.InsideMoveTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService;
|
||||
@@ -37,7 +34,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -141,9 +141,9 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Set<String> ids) {
|
||||
for(String moveinv_id : ids) {
|
||||
for (String moveinv_id : ids) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("moveinv_id",moveinv_id);
|
||||
json.put("moveinv_id", moveinv_id);
|
||||
List<JSONObject> moveDtl = iStIvtMoveinvdtlService.getMoveDtl(json);
|
||||
|
||||
// 组织删除参数
|
||||
@@ -181,7 +181,7 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
delete(idsList);
|
||||
} else {
|
||||
// 删除当前一条明细
|
||||
List<JSONObject> moveDtl = iStIvtMoveinvdtlService.getMoveDtl(JSONObject.parseObject(JSONObject.toJSONString(dtlDao),JSONObject.class));
|
||||
List<JSONObject> moveDtl = iStIvtMoveinvdtlService.getMoveDtl(JSONObject.parseObject(JSONObject.toJSONString(dtlDao), JSONObject.class));
|
||||
// 过滤当前明细
|
||||
List<JSONObject> paramList = moveDtl.stream()
|
||||
.filter(row -> row.getString("moveinvdtl_id").equals(dtlDao.getMoveinvdtl_id()))
|
||||
@@ -297,11 +297,8 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
this.updateById(dao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主表状态
|
||||
* @param moveinv_id 移库单id
|
||||
*/
|
||||
private void updateMstStatus(String moveinv_id) {
|
||||
@Override
|
||||
public void updateMstStatus(String moveinv_id) {
|
||||
StIvtMoveinv mstDao = this.getById(moveinv_id);
|
||||
// 查询所有明细
|
||||
List<StIvtMoveinvdtl> dtlDaoList = iStIvtMoveinvdtlService.list(
|
||||
|
||||
@@ -75,6 +75,7 @@ public class StIvtMoveinvdtlServiceImpl extends ServiceImpl<StIvtMoveinvdtlMappe
|
||||
dtlDao.setWork_status(json.getString("work_status"));
|
||||
dtlDao.setStoragevehicle_code(json.getString("storagevehicle_code"));
|
||||
dtlDao.setStoragevehicle_code2(json.getString("storagevehicle_code2"));
|
||||
dtlDao.setSource_bill_code(json.getString("source_bill_code"));
|
||||
dtlDao.setRemark(json.getString("remark"));
|
||||
moveDtlList.add(dtlDao);
|
||||
// 组织要更新仓位的数据
|
||||
|
||||
Reference in New Issue
Block a user