add:退货出库/烘干出库

This commit is contained in:
2025-08-22 17:57:38 +08:00
parent df6ab03d4b
commit d6c6e48736
24 changed files with 1218 additions and 52 deletions

View File

@@ -44,7 +44,7 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
* @param material_id
* @return
*/
BigDecimal queryCanuseSum(@Param("pcsn") String pcsn,@Param("material_id") String material_id);
BigDecimal queryCanuseSum(@Param("pcsn") String pcsn, @Param("material_id") String material_id, @Param("sect_code") String sect_code);
/**
* 分页查询
@@ -71,7 +71,7 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
* @param material_id
* @return
*/
List<MdPbStoragevehicleextDto> queryOutAllocation(@Param("pcsn") String pcsn,@Param("material_id") String material_id);
List<MdPbStoragevehicleextDto> queryOutAllocation(@Param("pcsn") String pcsn,@Param("material_id") String material_id,@Param("sect_code") String sect_code);
/**
* 手持出库确认查询明细

View File

@@ -187,12 +187,15 @@
ex.material_id = #{material_id}
AND
st.lock_type = 0
AND
st.sect_code = 'HG01'
<if test="pcsn!= null and pcsn!= ''">
AND
ex.pcsn = #{pcsn}
</if>
<if test="sect_code!= null and sect_code!= ''">
AND
st.sect_code = #{sect_code}
</if>
</where>
</select>
@@ -217,11 +220,13 @@
ex.canuse_qty > 0
AND
st.lock_type = 0
AND
st.sect_code = 'HG01'
<if test="pcsn!= null and pcsn!= ''">
AND
pcsn = #{pcsn}
ex.pcsn = #{pcsn}
</if>
<if test="sect_code!= null and sect_code!= ''">
AND
st.sect_code = #{sect_code}
</if>
</where>
ORDER BY quality_day,ex.insert_time,ex.canuse_qty

View File

@@ -61,4 +61,11 @@ public class BomCallMaterialController {
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/confirm")
@Log("强制确认叫料单")
public ResponseEntity<Object> confirm(@RequestBody PdmBomCallMaterial dao) {
iPdmBomCallMaterialService.confirm(dao);
return new ResponseEntity<>(HttpStatus.CREATED);
}
}

View File

@@ -60,4 +60,10 @@ public interface IPdmBomCallMaterialService extends IService<PdmBomCallMaterial>
* @param bom_id 叫料单标识
*/
void updateStatus(String bom_id);
/**
* 强制确认叫料单
* @param dao 叫料单实体类
*/
void confirm(PdmBomCallMaterial dao);
}

View File

@@ -2,6 +2,7 @@ package org.nl.wms.pdm_manage.service.impl;
import cn.hutool.core.date.DateUtil;
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;
@@ -112,4 +113,20 @@ public class PdmBomCallMaterialServiceImpl extends ServiceImpl<PdmBomCallMateria
bomDao.setBom_status(is_confirm ? BomEnum.CALL_BOM_STATUS.code("完成") : BomEnum.CALL_BOM_STATUS.code("退料中"));
this.updateById(bomDao);
}
@Override
@Transactional
public void confirm(PdmBomCallMaterial dao) {
// 更新主表为完成
dao.setBom_status(BomEnum.CALL_BOM_STATUS.code("完成"));
dao.setReal_weigh_qty(dao.getReal_qty());
this.updateById(dao);
// 更新明细为完成
iPdmBomCallMaterialDtlService.update(
new UpdateWrapper<PdmBomCallMaterialDtl>().lambda()
.set(PdmBomCallMaterialDtl::getBom_status, BomEnum.CALL_BOM_DTL_STATUS.code("完成"))
.eq(PdmBomCallMaterialDtl::getBom_id, dao.getBom_id())
);
}
}

View File

@@ -124,6 +124,8 @@ public class SchBaseTask implements Serializable {
private String task_type;
private String contact_task;
@TableField(exist = false)
private String config_name;

View File

@@ -0,0 +1,236 @@
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.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.nl.common.exception.BadRequestException;
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.IOSConstant;
import org.nl.wms.warehouse_management.enums.IOSEnum;
import org.nl.wms.warehouse_management.service.IOutBillService;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
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 = "BackOutTask")
@TaskType("BackOutTask")
public class BackOutTask extends AbstractTask {
/**
* 任务服务
*/
@Autowired
private ISchBaseTaskService taskService;
/**
* 出库服务
*/
@Resource
private IOutBillService outBillService;
/**
* 分配明细mapper
*/
@Resource
private IOStorInvDisMapper ioStorInvDisMapper;
/**
* 点位服务
*/
@Resource
private ISchBasePointService iSchBasePointService;
/**
* 点对点任务类服务
*/
@Resource
private PdaPointTask pdaPointTask;
@Override
public String create(JSONObject json) {
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(json.getString("TaskCode"));
task.setTask_status(TaskStatus.CREATE.getCode());
task.setConfig_code(BackOutTask.class.getSimpleName());
task.setPoint_code1(json.getString("point_code1"));
// 判断终点是否是称重位
if (!json.getString("point_code2").equals(IOSConstant.CZW_POINT)) {
task.setPoint_code2(IOSConstant.CZW_POINT);
task.setPoint_code3(json.getString("point_code2"));
} else {
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.setPriority(json.getString("Priority"));
task.setTask_type(TaskEnum.TASK_TYPE.code("料箱"));
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) {
// 更新终点
iSchBasePointService.update(
new UpdateWrapper<SchBasePoint>().lambda()
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有箱有料"))
);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(taskObj);
outBillService.taskFinish(taskObj);
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);
// 判断point_code3是否有值; 有值需要生成点位点任务到库外站点
if (ObjectUtil.isNotEmpty(taskObj.getPoint_code3())) {
createAgvTask(taskObj);
}
}
/**
* 生成点位点任务:称重位至库外站点
*
* @param taskObj 任务实体类
*/
private void createAgvTask(SchBaseTask taskObj) {
JSONObject jsonTask = new JSONObject();
jsonTask.put("point_code1", IOSConstant.CZW_POINT);
jsonTask.put("point_code2", taskObj.getPoint_code3());
jsonTask.put("vehicle_code", taskObj.getVehicle_code());
jsonTask.put("task_type", TaskEnum.TASK_TYPE.code("料箱"));
jsonTask.put("material_id", taskObj.getMaterial_id());
jsonTask.put("material_qty", taskObj.getMaterial_qty());
jsonTask.put("contact_task", taskObj.getTask_id());
pdaPointTask.create(jsonTask);
}
}

View File

@@ -252,7 +252,7 @@ public class CombinedBoxMoveTask extends AbstractTask {
.eq(MdPbStoragevehicleext::getMaterial_id, boxDao.getMaterial_id())
);
// 更新组盘记录为生成
// 更新组盘记录为组盘
iMdPbGroupplateService.update(
new UpdateWrapper<GroupPlate>().lambda()
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))

View File

@@ -0,0 +1,195 @@
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.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.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
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-20
*/
@Component(value = "HandInTask")
@TaskType("HandInTask")
public class HandInTask extends AbstractTask {
@Autowired
private ISchBaseTaskService taskService;
@Resource
private IRawAssistIStorService rawAssistIStorService;
@Resource
private IOStorInvDisMapper ioStorInvDisMapper;
/**
* 点位服务
*/
@Autowired
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(HandInTask.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("该任务不存在");
}
rawAssistIStorService.taskFinish(taskObj);
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(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())
);
}
@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) {
}
}

View File

@@ -0,0 +1,201 @@
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.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.nl.common.exception.BadRequestException;
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.IOutBillService;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
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 = "HandOutTask")
@TaskType("HandOutTask")
public class HandOutTask extends AbstractTask {
/**
* 任务服务
*/
@Autowired
private ISchBaseTaskService taskService;
/**
* 出库服务
*/
@Resource
private IOutBillService outBillService;
/**
* 分配明细mapper
*/
@Resource
private IOStorInvDisMapper ioStorInvDisMapper;
/**
* 点位服务
*/
@Resource
private ISchBasePointService iSchBasePointService;
@Override
public String create(JSONObject json) {
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(json.getString("TaskCode"));
task.setTask_status(TaskStatus.CREATE.getCode());
task.setConfig_code(HandOutTask.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.setPriority(json.getString("Priority"));
task.setTask_type(TaskEnum.TASK_TYPE.code("料箱"));
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) {
// 更新终点
iSchBasePointService.update(
new UpdateWrapper<SchBasePoint>().lambda()
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有箱有料"))
);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(taskObj);
outBillService.taskFinish(taskObj);
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) {
}
}

View File

@@ -0,0 +1,201 @@
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.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.nl.common.exception.BadRequestException;
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.IOutBillService;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
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 = "HotOutTask")
@TaskType("HotOutTask")
public class HotOutTask extends AbstractTask {
/**
* 任务服务
*/
@Autowired
private ISchBaseTaskService taskService;
/**
* 出库服务
*/
@Resource
private IOutBillService outBillService;
/**
* 分配明细mapper
*/
@Resource
private IOStorInvDisMapper ioStorInvDisMapper;
/**
* 点位服务
*/
@Resource
private ISchBasePointService iSchBasePointService;
@Override
public String create(JSONObject json) {
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(json.getString("TaskCode"));
task.setTask_status(TaskStatus.CREATE.getCode());
task.setConfig_code(HotOutTask.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.setPriority(json.getString("Priority"));
task.setTask_type(TaskEnum.TASK_TYPE.code("料箱"));
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) {
// 更新终点
iSchBasePointService.update(
new UpdateWrapper<SchBasePoint>().lambda()
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有箱有料"))
);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(taskObj);
outBillService.taskFinish(taskObj);
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) {
}
}

View File

@@ -72,6 +72,7 @@ public class PdaPointTask extends AbstractTask {
task.setExt_group_data(json.getString("ext_group_data"));
task.setRequest_param(json.toString());
task.setPriority(json.getString("Priority"));
task.setContact_task(json.getString("contact_task"));
task.setCreate_id(SecurityUtils.getCurrentUserId());
task.setCreate_name(SecurityUtils.getCurrentNickName());
task.setCreate_time(DateUtil.now());

View File

@@ -0,0 +1,201 @@
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.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.nl.common.exception.BadRequestException;
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.IOutBillService;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
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 = "QualityOutTask")
@TaskType("QualityOutTask")
public class QualityOutTask extends AbstractTask {
/**
* 任务服务
*/
@Autowired
private ISchBaseTaskService taskService;
/**
* 出库服务
*/
@Resource
private IOutBillService outBillService;
/**
* 分配明细mapper
*/
@Resource
private IOStorInvDisMapper ioStorInvDisMapper;
/**
* 点位服务
*/
@Resource
private ISchBasePointService iSchBasePointService;
@Override
public String create(JSONObject json) {
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(json.getString("TaskCode"));
task.setTask_status(TaskStatus.CREATE.getCode());
task.setConfig_code(QualityOutTask.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.setPriority(json.getString("Priority"));
task.setTask_type(TaskEnum.TASK_TYPE.code("料箱"));
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) {
// 更新终点
iSchBasePointService.update(
new UpdateWrapper<SchBasePoint>().lambda()
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2())
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有箱有料"))
);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(taskObj);
outBillService.taskFinish(taskObj);
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) {
}
}

View File

@@ -203,6 +203,7 @@ public class SelectBackInTask extends AbstractTask {
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getStoragevehicle_code, disDao.getStoragevehicle_code())
.eq(GroupPlate::getPcsn, disDao.getPcsn())
.eq(GroupPlate::getMaterial_id, disDao.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
);
// 更新起点

View File

@@ -87,8 +87,6 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
// 校验此载具是否已经组盘
List<GroupPlate> groupList = this.list(
new QueryWrapper<GroupPlate>().lambda()
.in(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"),
IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getStoragevehicle_code, dto.getStoragevehicle_code())
);
if (ObjectUtil.isNotEmpty(groupList)) {
@@ -96,7 +94,6 @@ public class MdPbGroupplateServiceImpl extends ServiceImpl<MdPbGroupplateMapper,
}
dto.setGroup_id(IdUtil.getStringId());
dto.setPcsn(CodeUtil.getNewCode("GROUP_PCSN_CODE"));
// 计量单位默认重量KG
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getByCode("KG");
dto.setQty_unit_id(unitDao.getMeasure_unit_id());

View File

@@ -407,8 +407,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
String pcsn = dtl.getPcsn();
String material_id = dtl.getMaterial_id();
// 根据物料和批次号查询库存可用
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn, material_id);
// 根据物料和批次号查询库存可用 如果是领料出库则查合格区
String sect_code = "";
if (ioStorInv.getBill_type().equals(IOSEnum.OUT_BILL_TYPE.code("领料出库"))) {
sect_code = IOSEnum.SECT_CODE.code("合格区");
}
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn, material_id, sect_code);
if (ObjectUtil.isEmpty(canuseSum) || canuseSum.doubleValue() < unassign_qty) {
throw new BadRequestException("物料编号:" + dtl.getMaterial_code() + "出库分配数量不满足");
@@ -422,7 +427,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
*/
//出库分配查询货位信息
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn, material_id);
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn, material_id,sect_code);
int seq_no = 1;
double allocation_canuse_qty = 0;
@@ -629,7 +634,11 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
String material_id = dtl.getMaterial_id();
// 根据物料和批次号查询库存可用
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn, material_id);
String sect_code = "";
if (ioStorInv.getBill_type().equals(IOSEnum.OUT_BILL_TYPE.code("领料出库"))) {
sect_code = IOSEnum.SECT_CODE.code("合格区");
}
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn, material_id, sect_code);
if (canuseSum.doubleValue() < unassign_qty) {
throw new BadRequestException("物料编号:" + dtl.getMaterial_code() + "出库分配数量不满足");
@@ -642,7 +651,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
*/
//出库分配查询货位信息
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn, material_id);
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn, material_id,sect_code);
int seq_no = 1;
double allocation_canuse_qty = 0;
@@ -1148,7 +1157,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
//需要更新的出出库单明细
Set<String> dtlSet = new HashSet<>();
for (IOStorInvDis ioStorInvDis : storInvDisList) {
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())) {
//解绑仓位
@@ -1191,13 +1199,29 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
//添加需要更新的明细标识
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
//更新组盘记录表
groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
//查询明细信息
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
// 如果单据类型为:质检出库、领料出库、烘干出库则更新为出库,否则删除组盘记录
if (ioStorInvDtl.getIs_check().equals(IOSConstant.ONE)) {
groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
} else {
// 删除组盘信息
groupPlateMapper.delete(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
}
}
//更新出库明细单状态
@@ -1228,7 +1252,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
@Override
@Transactional(rollbackFor = Exception.class)
public void taskFinish(SchBaseTask task) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
@@ -1240,6 +1263,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
throw new BadRequestException("未找到任务对应的分配明细");
}
//查询明细信息
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
if (ObjectUtil.isEmpty(ioStorInvDtl)) {
throw new BadRequestException("未找到明细");
}
ioStorInvDisMapper.update(ioStorInvDis, new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
.set(IOStorInvDis::getReal_qty, task.getMaterial_qty())
@@ -1268,13 +1297,25 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
updateIvtList.add(jsonIvt);
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
//更新组盘记录
groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
// 如果单据类型为:质检出库、领料出库、烘干出库则更新为出库,否则删除组盘记录
if (ioStorInvDtl.getIs_check().equals(IOSConstant.ONE)) {
groupPlateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
} else {
// 删除组盘信息
groupPlateMapper.delete(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
}
// 查询该明细下是否还有未完成的分配明细
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
@@ -1282,11 +1323,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
);
// 明细
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
if (ObjectUtil.isEmpty(ioStorInvDtl)) {
throw new BadRequestException("未找到明细");
}
// 如果分配明细全部完成则更新明细表状态
if (countDis == 0) {
// 更新明细表状态

View File

@@ -622,6 +622,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
);
// 更新任务完成
@@ -692,6 +693,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
);

View File

@@ -25,8 +25,10 @@ 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.IMdPbGroupplateService;
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
import org.nl.wms.warehouse_management.service.SelectOutService;
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;
@@ -105,6 +107,13 @@ public class SelectOutServiceImpl extends ServiceImpl<IOStorInvDtlMapper, IOStor
@Autowired
private IPdmBomCallMaterialDtlService iPdmBomCallMaterialDtlService;
/**
* 组盘信息服务
*/
@Autowired
private IMdPbGroupplateService iMdPbGroupplateService;
@Override
public IPage<SelectOutDto> queryAll(Map whereJson, PageQuery page) {
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
@@ -194,6 +203,28 @@ public class SelectOutServiceImpl extends ServiceImpl<IOStorInvDtlMapper, IOStor
.eq(IOStorInvDis::getStoragevehicle_code, dto.getSelect_vehicle())
.eq(IOStorInvDis::getPcsn, dto.getSelect_pcsn())
);
// 删除其他组盘信息
List<IOStorInvDis> deleteGroupDisList = ioStorInvDisMapper.selectList(
new QueryWrapper<IOStorInvDis>().lambda()
.eq(IOStorInvDis::getIostorinvdtl_id, dto.getIostorinvdtl_id())
.ne(IOStorInvDis::getIostorinvdis_id, disDao.getIostorinvdis_id())
);
// 需删除的组盘信息
Set<String> deleteGroupSet = new HashSet<>();
for (IOStorInvDis deleteDisGroup : deleteGroupDisList) {
GroupPlate groupDao = iMdPbGroupplateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, deleteDisGroup.getStoragevehicle_code())
.eq(GroupPlate::getMaterial_id, deleteDisGroup.getMaterial_id())
.eq(GroupPlate::getPcsn, deleteDisGroup.getPcsn())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
);
deleteGroupSet.add(groupDao.getGroup_id());
}
if (ObjectUtil.isNotEmpty(deleteGroupSet)) {
iMdPbGroupplateService.delete(deleteGroupSet);
}
// 组织主表数据
Map<String, Object> jsonMst = new HashMap<>();

View File

@@ -108,7 +108,7 @@
<el-col :span="8">
<el-form-item label="焊材批号" prop="pcsn">
<el-input v-model="form.pcsn" disabled placeholder="由系统自动生成" style="width: 200px;" />
<el-input v-model="form.pcsn" style="width: 200px;" />
</el-form-item>
</el-col>
@@ -335,6 +335,9 @@ export default {
storagevehicle_code: [
{ required: true, message: '载具不能为空', trigger: 'blur' }
],
pcsn: [
{ required: true, message: '批次不能为空', trigger: 'blur' }
],
supp_code: [
{ required: true, message: '供应商不能为空', trigger: 'blur' }
],

View File

@@ -24,4 +24,12 @@ export function edit(data) {
})
}
export default { add, edit, del }
export function confirm(data) {
return request({
url: 'api/bomCallMaterial/confirm',
method: 'post',
data
})
}
export default { add, edit, del, confirm }

View File

@@ -59,7 +59,19 @@
</div>
<rrOperation />
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
:disabled="crud.selections.length !== 1"
@click="confirm"
>
强制确认
</el-button>
</crudOperation>
<el-dialog
:close-on-click-modal="false"
:before-close="crud.cancelCU"
@@ -117,6 +129,7 @@
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="bom_code" width="150" label="叫料单号">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bom_code }}</el-link>
@@ -248,6 +261,17 @@ export default {
toView(index, row) {
this.openParam = row
this.ViewDialog = true
},
confirm() {
const data = this.$refs.table.selection[0]
if (data.bom_status < '3') {
this.crud.notify('当前状态不允许强制确认!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
crudCallMaterial.confirm(data).then(res => {
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
}
}
}

View File

@@ -262,15 +262,6 @@ export default {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.bill_type !== '1004') {
this.form.out_stor_id = ''
}
if (this.form.bill_type === '1004') {
if (!this.form.out_stor_id) {
this.crud.notify('移入仓库不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
},
[CRUD.HOOK.afterToEdit]() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {

View File

@@ -155,7 +155,7 @@ export default {
this.$emit('update:dialogShow', false)
},
open() {
crudSectout.getSelectDis({}).then(res => {
crudSectout.getSelectDis({ 'iostorinvdtl_id': this.formMst.iostorinvdtl_id }).then(res => {
this.tabledis = res
})
}

View File

@@ -204,8 +204,8 @@ export default {
this.crud.notify('拣选批次不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.formMst.weigh_qty = '51'
this.formMst.select_qty = '30'
this.formMst.weigh_qty = '40'
this.formMst.select_qty = '10'
/* crudSectout.getWeigh(this.current).then(res => {
this.formMst.weigh_qty = res.weigh_qty
this.formMst.select_qty = res.select_qty