fix: 原辅料直接入库
This commit is contained in:
@@ -56,7 +56,7 @@ public class PdaCommonController {
|
||||
return new ResponseEntity<>(pdaCommonService.getBagAssembly(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/confirmPalletAssembly")
|
||||
@Log("物料组盘-获取组袋信息")
|
||||
@Log("物料组盘-组盘")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> confirmPalletAssembly(@RequestBody @Valid AssemblyPalletParam param) {
|
||||
return new ResponseEntity<>(pdaCommonService.confirmPalletAssembly(param), HttpStatus.OK);
|
||||
|
||||
@@ -156,7 +156,7 @@ public class PdaCommonServiceImpl implements PdaCommonService {
|
||||
|
||||
@Override
|
||||
public PdaResponse confirmPalletAssembly(AssemblyPalletParam param) {
|
||||
storagevehicleinfoService.getByCode(param.getVehicle_code());
|
||||
// storagevehicleinfoService.getByCode(param.getVehicle_code());
|
||||
List<GroupPlate> groupPlates = param.getGroup_plates();
|
||||
for (GroupPlate groupPlate : groupPlates) {
|
||||
groupPlate.setVehicle_code(param.getVehicle_code());
|
||||
|
||||
@@ -113,13 +113,13 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
||||
Map<String, Object> jsonMst = new HashMap<>();
|
||||
jsonMst.put("point_code", startPoint.getPoint_code());
|
||||
// 组织明细数据
|
||||
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectOne(
|
||||
List<IOStorInvDtl> dtlDao = ioStorInvDtlMapper.selectList(
|
||||
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, invId)
|
||||
);
|
||||
// 查找分配明细
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("iostorinvdtl_id",dtlDao.getIostorinvdtl_id());
|
||||
map.put("iostorinvdtl_id",dtlDao.get(0).getIostorinvdtl_id());
|
||||
List<IOStorInvDisDto> disDtl = rawAssistIStorService.getDisDtl(map);
|
||||
// 类型转换
|
||||
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();
|
||||
@@ -130,8 +130,7 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
||||
|
||||
private Map<String, Object> buildDivStructData(Sectattr sect, String invId) {
|
||||
Map<String, Object> divObj = new HashMap<>();
|
||||
divObj.put("sect_code", sect.getSect_code());
|
||||
divObj.put("stor_code", sect.getStor_id());
|
||||
divObj.put("sect_id", sect.getSect_id());
|
||||
divObj.put("checked", true);
|
||||
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinv_id, invId));
|
||||
@@ -153,16 +152,17 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
||||
res.put("stor_id", "1582991156504039424");
|
||||
res.put("bill_status", "10");
|
||||
res.put("detail_count", rows.size());
|
||||
res.put("bill_type", "0011");
|
||||
res.put("bill_type", "0001");
|
||||
res.put("biz_date", DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, Object> table = new HashMap<>();
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
table.put("group_id", row.getString("group_id"));
|
||||
table.put("storagevehicle_code", row.getString(""));
|
||||
table.put("storagevehicle_code", row.getString("storagevehicle_code"));
|
||||
table.put("material_id", row.getString("material_id"));
|
||||
table.put("pcsn", row.getString("pcsn"));
|
||||
table.put("qty", row.getBigDecimal("qty"));
|
||||
table.put("plan_qty", row.getBigDecimal("qty"));
|
||||
table.put("qty_unit_id", row.getString("qty_unit_id"));
|
||||
table.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
table.put("status", "01");
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
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.ACSTaskTypeEnum;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.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.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 原辅料入库
|
||||
* @Author: lyd
|
||||
* @Date: 2025/11/27
|
||||
*/
|
||||
@Component(value = "RawInTask")
|
||||
@TaskType("RawInTask")
|
||||
public class RawInTask extends AbstractTask {
|
||||
@Resource
|
||||
private ISchBaseTaskService taskService;
|
||||
@Resource
|
||||
private IRawAssistIStorService rawAssistIStorService;
|
||||
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
@Resource
|
||||
private ISchBasePointService pointService;
|
||||
@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.CREATED.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.setIs_wait(json.getString("is_wait"));
|
||||
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.setVehicle_code(taskDao.getVehicle_code());
|
||||
|
||||
acsTaskDto.setVehicle_type(IOSConstant.ONE);
|
||||
acsTaskDto.setIs_wait(IOSConstant.ZERO);
|
||||
acsTaskDto.setTask_type(ACSTaskTypeEnum.CTU_TASK.getCode());
|
||||
|
||||
acsTaskDto.setPriority(IOSConstant.ONE);
|
||||
acsTaskDto.setAgv_system_type(IOSConstant.THREE);
|
||||
acsTaskDto.setIs_get_pause(IOSConstant.ZERO);
|
||||
acsTaskDto.setIs_put_pause(IOSConstant.ZERO);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private 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);
|
||||
}
|
||||
|
||||
private void finishTask(SchBaseTask taskObj) {
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
// 更新起点
|
||||
pointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("空位"))
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskConfirm(String task_code) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,8 @@ public enum IOSEnum {
|
||||
BILL_STATUS(MapOf.of("生成","10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||
|
||||
// 入库业务类型
|
||||
IN_BILL_TYPE(MapOf.of( "手工入库", "0009"
|
||||
IN_BILL_TYPE(MapOf.of( "手工入库", "0009",
|
||||
"原辅料入库", "0001"
|
||||
)),
|
||||
|
||||
// 出库业务类型
|
||||
@@ -45,7 +46,8 @@ public enum IOSEnum {
|
||||
STRATEGY_TYPE(MapOf.of("入库", "1", "出库", "2", "通用", "3")),
|
||||
|
||||
// 入库任务配置类编码
|
||||
IN_CONFIG_CODE(MapOf.of("0009", "HandInTask"
|
||||
IN_CONFIG_CODE(MapOf.of("0009", "HandInTask",
|
||||
"0001", "RawInTask"
|
||||
)),
|
||||
|
||||
// 出库任务配置类编码
|
||||
|
||||
@@ -144,7 +144,8 @@
|
||||
m.material_spec,
|
||||
m.material_model,
|
||||
m.material_type_id,
|
||||
s.supp_name
|
||||
s.supp_name,
|
||||
g.vehicle_code AS storagevehicle_code
|
||||
FROM
|
||||
`md_pb_groupplate` g
|
||||
LEFT JOIN md_me_materialbase m ON m.material_id = g.material_id
|
||||
|
||||
Reference in New Issue
Block a user