opt: 1.出库管理完善。 2.出入库管理任务完成、取消。
This commit is contained in:
@@ -116,6 +116,8 @@
|
||||
LEFT JOIN st_ivt_structattr st on ex.storagevehicle_code = st.storagevehicle_code
|
||||
<where>
|
||||
ex.material_id = #{material_id}
|
||||
AND
|
||||
st.lock_type = 0
|
||||
<if test="pcsn!= null and pcsn!= ''">
|
||||
AND
|
||||
ex.pcsn = #{pcsn}
|
||||
@@ -128,6 +130,10 @@
|
||||
FROM md_pb_storagevehicleext ex LEFT JOIN st_ivt_structattr st on ex.storagevehicle_code = st.storagevehicle_code
|
||||
<where>
|
||||
material_id = #{material_id}
|
||||
AND
|
||||
ex.canuse_qty > 0
|
||||
AND
|
||||
st.lock_type = 0
|
||||
<if test="pcsn!= null and pcsn!= ''">
|
||||
AND
|
||||
pcsn = #{pcsn}
|
||||
|
||||
@@ -3,19 +3,28 @@ 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.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.TaskStatus;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 入库任务类
|
||||
@@ -27,6 +36,12 @@ public class StInTask extends AbstractTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
@Resource
|
||||
private IRawAssistIStorService rawAssistIStorService;
|
||||
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
@@ -83,11 +98,12 @@ public class StInTask extends AbstractTask {
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
if (status.equals(TaskStatus.FINISHED)) {
|
||||
// this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS);
|
||||
this.finishTask(taskObj);
|
||||
}
|
||||
if (status.equals(TaskStatus.CANCELED)) {
|
||||
// this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS);
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,7 +112,10 @@ public class StInTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
// this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("完成");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +124,11 @@ public class StInTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
// this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
|
||||
if (!TaskStatus.CREATE.getCode().equals(taskObj.getTask_status())) {
|
||||
throw new BadRequestException("任务状态必须为生成才能取消任务");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,9 +138,33 @@ public class StInTask extends AbstractTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 任务完成
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("完成");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
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 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.TaskStatus;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 入库任务类
|
||||
* @Date: 2025/5/25
|
||||
*/
|
||||
@Component(value = "STOutTask")
|
||||
@TaskType("STOutTask")
|
||||
public class StOutTask extends AbstractTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
@Resource
|
||||
private IOutBillService outBillService;
|
||||
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
@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(json.getString("task_type"));
|
||||
task.setPoint_code1(json.getString("PickingLocation"));
|
||||
task.setPoint_code2(json.getString("PlacedLocation"));
|
||||
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);
|
||||
return task.getTask_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsTaskDto sendAcsParam(String taskId) {
|
||||
SchBaseTask taskDao = taskService.getById(taskId);
|
||||
|
||||
// 组织下发给acs的数据
|
||||
AcsTaskDto acsTaskDto = new AcsTaskDto();
|
||||
acsTaskDto.setExt_task_uuid(taskDao.getTask_id());
|
||||
acsTaskDto.setTask_code(taskDao.getTask_code());
|
||||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1());
|
||||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
|
||||
if (taskDao.getPoint_code2().contains("-")) {
|
||||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2().replace('-', '_'));
|
||||
}
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backMes(String task_code) {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 任务完成
|
||||
outBillService.taskFinish(taskObj);
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("完成");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,20 @@ public class OutBillController {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iOutBillService.getCanuseIvt(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改出库单")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除出库单")
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
iOutBillService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
@Log("新增出库单")
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody JSONObject whereJson) {
|
||||
@@ -119,4 +133,11 @@ public class OutBillController {
|
||||
iOutBillService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/getOutBillTask")
|
||||
@Log("出库单详情作业明细查询")
|
||||
public ResponseEntity<Object> getOutBillTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iOutBillService.getOutBillTask(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class RawAssistIStorController {
|
||||
|
||||
@Log("删除出入库单")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
iRawAssistIStorService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public enum IOSEnum {
|
||||
BILL_TYPE(MapOf.of("生产入库","0001", "手工入库", "0009")),
|
||||
|
||||
//入库分配明细状态
|
||||
INBILL_DIS_STATUS(MapOf.of("生成", "00", "执行中", "01", "完成", "99")),
|
||||
INBILL_DIS_STATUS(MapOf.of("未生成", "00", "生成", "01", "执行中", "02", "完成", "99")),
|
||||
|
||||
//组盘记录状态
|
||||
GROUP_PLATE_STATUS(MapOf.of("生成", "00", "组盘", "01", "入库", "02", "出库", "03")),
|
||||
|
||||
@@ -6,11 +6,16 @@ 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.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDtlDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -45,6 +50,21 @@ public interface IOutBillService extends IService<IOStorInv> {
|
||||
*/
|
||||
IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 修改出库单
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 删除出库单
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 新增出库单
|
||||
*
|
||||
@@ -131,4 +151,16 @@ public interface IOutBillService extends IService<IOStorInv> {
|
||||
*/
|
||||
void confirm(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 出库单作业明细查询
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
List<IOStorInvDisDto> getOutBillTask(Map whereJson);
|
||||
|
||||
/**
|
||||
* 出库任务完成
|
||||
* @param task
|
||||
*/
|
||||
void taskFinish(SchBaseTask task);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ 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.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_management.service.dto.GroupPlateDto;
|
||||
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||
@@ -33,7 +34,7 @@ public interface IRawAssistIStorService extends IService<IOStorInv> {
|
||||
|
||||
String insertDtl(Map whereJson);
|
||||
|
||||
void deleteAll(Long[] ids);
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
void update(Map whereJson);
|
||||
|
||||
@@ -47,6 +48,8 @@ public interface IRawAssistIStorService extends IService<IOStorInv> {
|
||||
|
||||
void confirm(Map whereJson);
|
||||
|
||||
void taskFinish(SchBaseTask task);
|
||||
|
||||
List<IOStorInvDisDto> getDisDtl(Map whereJson);
|
||||
|
||||
Structattr autoDis(JSONObject whereJson);
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IOStorInvDisMapper extends BaseMapper<IOStorInvDis> {
|
||||
|
||||
List<IOStorInvDisDto> queryInBillDisDtlByIosId(@Param("iostorinvdtl_id")String iostorinvdtl_id);
|
||||
|
||||
List<IOStorInvDisDto> getInBillTaskDtl(@Param("iostorinvdtl_id")String iostorinvdtl_id);
|
||||
List<IOStorInvDisDto> getBillTaskDtl(@Param("iostorinvdtl_id")String iostorinvdtl_id);
|
||||
|
||||
//查询未出库单分配
|
||||
List<IOStorInvDisDto> queryOutBillDisDtl(@Param("params") Map whereJson);
|
||||
|
||||
@@ -18,12 +18,13 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getInBillTaskDtl" resultType="org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto">
|
||||
<select id="getBillTaskDtl" resultType="org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto">
|
||||
SELECT
|
||||
dis.*,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
task.task_code
|
||||
task.task_code,
|
||||
task.task_status
|
||||
FROM
|
||||
st_ivt_iostorinvdis dis
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getGroupPlate" resultType="org.nl.wms.warehouse_management.service.dto.GroupPlateDto">
|
||||
SELECT MAX(group_id),storagevehicle_code,gp.material_id,pcsn,MAX(gp.qty_unit_id) as qty_unit_id,MAX(gp.qty_unit_name) as qty_unit_name,SUM(qty) as qty,SUM(qty) as plan_qty,MAX(remark),MAX(`status`),mtl.material_code, mtl.material_name
|
||||
SELECT MAX(group_id) as group_id,storagevehicle_code,gp.material_id,pcsn,MAX(gp.qty_unit_id) as qty_unit_id,MAX(gp.qty_unit_name) as qty_unit_name,SUM(qty) as qty,SUM(qty) as plan_qty,MAX(remark),MAX(`status`),MAX(ext_code) as ext_code,MAX(ext_type) as ext_type,mtl.material_code, mtl.material_name
|
||||
FROM md_pb_groupplate gp
|
||||
LEFT JOIN md_me_materialbase mtl ON gp.material_id = mtl.material_id
|
||||
<where>
|
||||
|
||||
@@ -25,6 +25,11 @@ public class IOStorInvDisDto extends IOStorInvDis {
|
||||
*/
|
||||
private String task_code;
|
||||
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String task_status;
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
*/
|
||||
|
||||
@@ -24,11 +24,14 @@ import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
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.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StOutTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IOutBillService;
|
||||
@@ -162,6 +165,81 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(JSONObject whereJson) {
|
||||
String iostorinv_id = (String) whereJson.get("iostorinv_id");
|
||||
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||
|
||||
if (!IOSEnum.BILL_STATUS.code("生成").equals(ioStorInv.getBill_status())) {
|
||||
throw new BadRequestException("主表状态必须为生成!");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
JSONObject iostorinv_json = new JSONObject();
|
||||
iostorinv_json.put("iostorinv_id",iostorinv_id);
|
||||
iostorinv_json.put("stor_id",whereJson.get("stor_id"));
|
||||
iostorinv_json.put("stor_code",whereJson.get("stor_code"));
|
||||
iostorinv_json.put("stor_name",whereJson.get("stor_name"));
|
||||
iostorinv_json.put("total_qty",whereJson.get("total_qty"));
|
||||
iostorinv_json.put("detail_count",whereJson.get("detail_count"));
|
||||
iostorinv_json.put("biz_date",whereJson.get("biz_date"));
|
||||
iostorinv_json.put("bill_type",whereJson.get("bill_type"));
|
||||
iostorinv_json.put("remark",whereJson.get("remark"));
|
||||
iostorinv_json.put("update_optid",currentUserId);
|
||||
iostorinv_json.put("update_optname",nickName);
|
||||
iostorinv_json.put("update_time",now);
|
||||
|
||||
ioStorInvMapper.updateById(iostorinv_json.toJavaObject(IOStorInv.class));
|
||||
|
||||
//先删除该单据下的所有明细
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id,iostorinv_id));
|
||||
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id,iostorinv_id));
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
HashMap<String, Object> row = rows.get(i);
|
||||
JSONObject ioStorInvDtl = new JSONObject();
|
||||
ioStorInvDtl.putAll(row);
|
||||
ioStorInvDtl.put("iostorinvdtl_id", org.nl.common.utils.IdUtil.getStringId());
|
||||
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("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"));
|
||||
ioStorInvDtl.put("assign_qty", 0);
|
||||
ioStorInvDtl.put("plan_qty", row.get("plan_qty"));
|
||||
ioStorInvDtl.put("unassign_qty", row.get("plan_qty"));
|
||||
|
||||
ioStorInvDtlMapper.insert(ioStorInvDtl.toJavaObject(IOStorInvDtl.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(String[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
for (String id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iostorinv_id", id);
|
||||
param.put("is_delete", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
|
||||
//暂时只软删除出入库单主表
|
||||
ioStorInvMapper.updateById(param.toJavaObject(IOStorInv.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String insertDtl(JSONObject map) {
|
||||
@@ -323,7 +401,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
|
||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
@@ -406,7 +484,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
);
|
||||
@@ -538,7 +616,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
|
||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
@@ -620,7 +698,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,whereJson.getString("iostorinvdtl_id"))
|
||||
@@ -750,7 +828,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
|
||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
||||
@@ -834,7 +912,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.le(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.eq(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinv_id)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,whereJson.getString("iostorinvdis_id"))
|
||||
@@ -875,7 +953,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
double unassign_qty = ioStorInvDtl.getUnassign_qty().doubleValue() + (ioStorInvDtl.getPlan_qty().doubleValue()-assign_qty);
|
||||
ioStorInvDtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
|
||||
ioStorInvDtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
if (assign_qty == 0){
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
}else if (unassign_qty == 0){
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
}else {
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("分配中"));
|
||||
}
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
|
||||
//删除出入库单分配表
|
||||
@@ -929,20 +1013,20 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
|
||||
//创建任务
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "STInTask");
|
||||
task_form.put("task_type", "STOutTask");
|
||||
task_form.put("TaskCode",CodeUtil.getNewCode("TASK_CODE"));
|
||||
task_form.put("PickingLocation", point_code);
|
||||
task_form.put("PlacedLocation", ioStorInvDis.getStruct_code());
|
||||
task_form.put("PickingLocation", ioStorInvDis.getStruct_code());
|
||||
task_form.put("PlacedLocation", point_code);
|
||||
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
|
||||
StInTask stInTask = SpringContextHolder.getBean("STInTask");
|
||||
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
|
||||
|
||||
String task_id = stInTask.create(task_form);
|
||||
String task_id = stOutTask.create(task_form);
|
||||
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(ioStorInvDis.getIostorinvdis_id());
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("执行中"));
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(point_code);
|
||||
@@ -974,6 +1058,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
.eq(IOStorInvDis::getIostorinv_id,whereJson.get("iostorinv_id"))
|
||||
);
|
||||
|
||||
//需要更新的出入库单明细
|
||||
Set<String> dtlSet = new HashSet<>();
|
||||
|
||||
for (IOStorInvDis ioStorInvDis: storInvDisList){
|
||||
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())){
|
||||
//解绑仓位
|
||||
@@ -995,7 +1082,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
//修改库存 减冻结加可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
|
||||
//判断分配明细是否分配了出库点位和任务号 分配则恢复库存等待手持减扣 没分配则减扣库存
|
||||
if (StrUtil.isNotBlank(ioStorInvDis.getPoint_code()) && StrUtil.isNotBlank(ioStorInvDis.getTask_id())){
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
}else {
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN);
|
||||
}
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
@@ -1006,20 +1099,16 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
}
|
||||
|
||||
//更新详情数据
|
||||
//更新分配明细数据
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.set(IOStorInvDis::getReal_qty,BigDecimal.ZERO)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
//添加需要更新的明细标识
|
||||
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
|
||||
|
||||
//更新组盘记录表
|
||||
groupPlateMapper.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
@@ -1030,6 +1119,15 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
);
|
||||
}
|
||||
|
||||
//更新出库明细单状态
|
||||
for (String dtlId:dtlSet){
|
||||
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
||||
.set(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInvDtl::getReal_qty,BigDecimal.ZERO)
|
||||
.eq(IOStorInvDtl::getIostorinvdtl_id,dtlId)
|
||||
);
|
||||
}
|
||||
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(ioStorInv,new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
@@ -1040,4 +1138,107 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IOStorInvDisDto> getOutBillTask(Map whereJson) {
|
||||
String iostorinvdtl_id = (String) whereJson.get("iostorinvdtl_id");
|
||||
return ioStorInvDisMapper.getBillTaskDtl(iostorinvdtl_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id,task.getTask_id())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
//解锁库位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",null);
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
|
||||
//修改库存 恢复库存 手持进行减扣
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
|
||||
//库存绑定到出库点。
|
||||
schBasePointMapper.update(new SchBasePoint(),new LambdaUpdateWrapper<>(SchBasePoint.class)
|
||||
.set(SchBasePoint::getVehicle_code,ioStorInvDis.getStoragevehicle_code())
|
||||
.set(SchBasePoint::getIos_id,ioStorInvDis.getIostorinvdis_id())
|
||||
.eq(SchBasePoint::getPoint_code,ioStorInvDis.getPoint_code())
|
||||
);
|
||||
|
||||
//更新组盘记录表
|
||||
groupPlateMapper.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
|
||||
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
||||
);
|
||||
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.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){
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setReal_qty(ioStorInvDis.getPlan_qty());
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
// 如果明细全部完成则更新主表状态
|
||||
if (countDtl == 0){
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(new IOStorInv(),new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid,currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname,nickName)
|
||||
.set(IOStorInv::getConfirm_time,now)
|
||||
.eq(IOStorInv::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleinfoMapper;
|
||||
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.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
@@ -209,7 +210,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("pcsn", row.get("pcsn"));
|
||||
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
dis.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
dis.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
@@ -223,14 +224,14 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Long[] ids) {
|
||||
public void deleteAll(String[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
for (Long id : ids) {
|
||||
for (String id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iostorinv_id", String.valueOf(id));
|
||||
param.put("iostorinv_id", id);
|
||||
param.put("is_delete", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
@@ -290,8 +291,9 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
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"));
|
||||
ioStorInvDtl.put("assign_qty",row.get("qty"));
|
||||
ioStorInvDtl.put("assign_qty",0);
|
||||
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
||||
ioStorInvDtl.put("unassign_qty",row.get("qty"));
|
||||
|
||||
//判断该载具编号是否已经存在库内
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
||||
@@ -309,7 +311,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
dis.put("material_id", row.get("material_id"));
|
||||
dis.put("pcsn", row.get("pcsn"));
|
||||
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
dis.put("qty_unit_id", row.get("qty_unit_id"));
|
||||
dis.put("qty_unit_name", row.get("qty_unit_name"));
|
||||
@@ -531,7 +533,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
//分配明细表更新任务相关数据
|
||||
IOStorInvDis dis = new IOStorInvDis();
|
||||
dis.setIostorinvdis_id(map.get("iostorinvdis_id"));
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("执行中"));
|
||||
dis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(point_code);
|
||||
@@ -618,6 +620,96 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id,task.getTask_id())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
//解锁库位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",ioStorInvDis.getStoragevehicle_code());
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
|
||||
//修改库存
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
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::getMaterial_id,ioStorInvDis.getMaterial_id())
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
||||
);
|
||||
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.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){
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setReal_qty(ioStorInvDis.getPlan_qty());
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
|
||||
// 如果明细全部完成则更新主表状态
|
||||
if (countDtl == 0){
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(new IOStorInv(),new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid,currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname,nickName)
|
||||
.set(IOStorInv::getConfirm_time,now)
|
||||
.eq(IOStorInv::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IOStorInvDisDto> getDisDtl(Map whereJson) {
|
||||
//查询该明细下的所有入库分配载具明细
|
||||
@@ -661,6 +753,6 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
||||
@Override
|
||||
public List<IOStorInvDisDto> getInBillTaskDtl(Map whereJson) {
|
||||
String iostorinvdtl_id = (String) whereJson.get("iostorinvdtl_id");
|
||||
return ioStorInvDisMapper.getInBillTaskDtl(iostorinvdtl_id);
|
||||
return ioStorInvDisMapper.getBillTaskDtl(iostorinvdtl_id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user