rev:半成品拼盘

This commit is contained in:
2023-06-27 09:09:12 +08:00
parent 08608e45d8
commit c09c3c926e
10 changed files with 280 additions and 40 deletions

View File

@@ -36,7 +36,8 @@ public enum AcsTaskEnum {
TASK_STRUCT_IN("9","入库-生产入库"), TASK_STRUCT_IN("9","入库-生产入库"),
TASK_STRUCT_OUT("10","出库-生产出库"), TASK_STRUCT_OUT("10","出库-生产出库"),
TASK_STRUCT_CHECK("14","盘点任务"), TASK_STRUCT_CHECK("14","盘点任务"),
TASK_STRUCT_SHUT("15","拼盘任务"), TASK_STRUCT_SHUT("15","拼盘任务"),
TASK_STRUCT_SHUT_IN("16","拼盘任务入"),
TASK_STRUCT_CP_IN("11","入库-成品-生产入库"), TASK_STRUCT_CP_IN("11","入库-成品-生产入库"),
TASK_STRUCT_CP_OUT("12","出库-成品-生产出库"), TASK_STRUCT_CP_OUT("12","出库-成品-生产出库"),
TASK_STRUCT_CP_CHECK("13","成品-盘点"), TASK_STRUCT_CP_CHECK("13","成品-盘点"),

View File

@@ -31,7 +31,7 @@ public enum IOSEnum {
//订单/发货单 状态 //订单/发货单 状态
ORDER_STATUS(MapOf.of("生成", "10", "提交", "20", "发货中", "30", "确认", "99")), ORDER_STATUS(MapOf.of("生成", "10", "提交", "20", "发货中", "30", "确认", "99")),
//锁定类型 //锁定类型
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4","其他锁","99")), LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4","拼盘锁","5","其他锁","99")),
; ;
private Map<String, String> code; private Map<String, String> code;

View File

@@ -36,6 +36,10 @@ public enum TASKEnum implements FunctionStrategy<String, JSONObject> {
IStIvtShutframeinvBcpService bean = SpringContextHolder.getBean(IStIvtShutframeinvBcpService.class); IStIvtShutframeinvBcpService bean = SpringContextHolder.getBean(IStIvtShutframeinvBcpService.class);
bean.taskOperate(form); bean.taskOperate(form);
}), }),
SHUT_TASK_IN(type -> AcsTaskEnum.TASK_STRUCT_SHUT_IN.getCode().equals(type), form -> {
IStIvtShutframeinvBcpService bean = SpringContextHolder.getBean(IStIvtShutframeinvBcpService.class);
bean.taskOperate2(form);
}),
CP_IN_TASK(type -> AcsTaskEnum.TASK_STRUCT_CP_IN.getCode().equals(type), form -> { CP_IN_TASK(type -> AcsTaskEnum.TASK_STRUCT_CP_IN.getCode().equals(type), form -> {
IStIvtIostorinvCpService bean = SpringContextHolder.getBean(IStIvtIostorinvCpService.class); IStIvtIostorinvCpService bean = SpringContextHolder.getBean(IStIvtIostorinvCpService.class);
bean.taskOperate(form); bean.taskOperate(form);

View File

@@ -1,6 +1,7 @@
package org.nl.wms.storage_manage.semimanage.controller.shutFrame; package org.nl.wms.storage_manage.semimanage.controller.shutFrame;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.nl.common.anno.Log; import org.nl.common.anno.Log;
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
*/ */
@RestController @RestController
@RequestMapping("api/shutframe") @RequestMapping("api/shutframe")
@SaIgnore
public class StIvtShutframeinvBcpController { public class StIvtShutframeinvBcpController {
@Autowired @Autowired
@@ -75,11 +77,20 @@ public class StIvtShutframeinvBcpController {
} }
@PostMapping("/confirm") @PostMapping("/confirm")
@Log("拼盘确认") @Log("强制确认")
@ApiOperation("拼盘确认") @ApiOperation("强制确认")
public ResponseEntity<Object> confirm(@RequestBody JSONObject jo) { public ResponseEntity<Object> confirm(@RequestBody JSONObject jo) {
shutframeinvBcpService.confirm(jo); shutframeinvBcpService.confirm(jo);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@PostMapping("/confirmOne")
@Log("一体机拼盘确认")
@ApiOperation("一体机拼盘确认")
@SaIgnore
public ResponseEntity<Object> confirmOne(@RequestBody JSONObject jo) {
shutframeinvBcpService.confirmOne(jo);
return new ResponseEntity<>(HttpStatus.OK);
}
} }

View File

@@ -40,5 +40,7 @@ public interface IStIvtShutframeinvBcpService extends IService<StIvtShutframeinv
void taskOperate(JSONObject jo); void taskOperate(JSONObject jo);
void taskOperate2(JSONObject jo);
void confirmOne(JSONObject jo);
} }

View File

@@ -1,5 +1,6 @@
package org.nl.wms.storage_manage.semimanage.service.shutFrame.dao; package org.nl.wms.storage_manage.semimanage.service.shutFrame.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@@ -25,6 +26,7 @@ public class StIvtShutframedtlBcp implements Serializable {
/** /**
* 拆拼单明细标识 * 拆拼单明细标识
*/ */
@TableId
private String shutframeinvdtl_id; private String shutframeinvdtl_id;
/** /**

View File

@@ -33,5 +33,6 @@
and (mb.material_name = #{query.material_search} OR mb.material_code = #{query.material_search}) and (mb.material_name = #{query.material_search} OR mb.material_code = #{query.material_search})
</if> </if>
</where> </where>
order by mst.create_time DESC
</select> </select>
</mapper> </mapper>

View File

@@ -2,15 +2,18 @@ package org.nl.wms.storage_manage.semimanage.service.shutFrame.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.nl.common.utils.IdUtil; import org.nl.common.utils.IdUtil;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService; import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr; import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.product_manage.service.teamcorrPerson.dao.PdmBiTeamcorrperson;
import org.nl.wms.storage_manage.IOSEnum; import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.SHUTEnum; import org.nl.wms.storage_manage.SHUTEnum;
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdtlYl; import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdtlYl;
@@ -21,7 +24,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* <p> * <p>
@@ -39,6 +45,11 @@ public class StIvtShutframedtlBcpServiceImpl extends ServiceImpl<StIvtShutframed
@Override @Override
public int create(JSONArray rows, String shutframeinv_id) { public int create(JSONArray rows, String shutframeinv_id) {
// 根据数量排序 默认由大到小
List<Object> list = rows.stream()
.sorted(Comparator.comparing(row -> ((JSONObject) row).getString("canuse_qty")).reversed()).collect(Collectors.toList());
rows = JSONArray.parseArray(JSON.toJSONString(list));
StIvtStructattr first_struct = null; StIvtStructattr first_struct = null;
StIvtStructattr last_struct = null; StIvtStructattr last_struct = null;
int total_qty = 1; int total_qty = 1;
@@ -77,7 +88,7 @@ public class StIvtShutframedtlBcpServiceImpl extends ServiceImpl<StIvtShutframed
dtl.setTurnout_struct_id(last_struct.getStruct_id()); dtl.setTurnout_struct_id(last_struct.getStruct_id());
dtl.setTurnout_struct_code(last_struct.getStruct_code()); dtl.setTurnout_struct_code(last_struct.getStruct_code());
dtl.setTurnout_struct_name(last_struct.getStruct_name()); dtl.setTurnout_struct_name(last_struct.getStruct_name());
dtl.setStoragevehicle_code(row.getString("storagevehicle_code")); dtl.setStoragevehicle_code(last_struct.getStoragevehicle_code());
dtl.setMaterial_id(row.getString("material_id")); dtl.setMaterial_id(row.getString("material_id"));
dtl.setPcsn(row.getString("pcsn")); dtl.setPcsn(row.getString("pcsn"));
dtl.setQty_unit_id(row.getString("qty_unit_id")); dtl.setQty_unit_id(row.getString("qty_unit_id"));
@@ -91,11 +102,26 @@ public class StIvtShutframedtlBcpServiceImpl extends ServiceImpl<StIvtShutframed
dtl.setTurnin_struct_id(first_struct.getStruct_id()); dtl.setTurnin_struct_id(first_struct.getStruct_id());
dtl.setTurnin_struct_code(first_struct.getStruct_code()); dtl.setTurnin_struct_code(first_struct.getStruct_code());
dtl.setTurnin_struct_name(first_struct.getStruct_name()); dtl.setTurnin_struct_name(first_struct.getStruct_name());
dtl.setStoragevehicle_code_in(first_struct.getStoragevehicle_code());
dtl.setWork_status(SHUTEnum.WORK_STATUS.code("未生成")); dtl.setWork_status(SHUTEnum.WORK_STATUS.code("未生成"));
dtl.setIs_issued(true); dtl.setIs_issued(true);
this.save(dtl); this.save(dtl);
total_qty++; total_qty++;
// 锁定仓位
structattrService.update(
new UpdateWrapper<StIvtStructattr>().lambda()
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("拼盘锁"))
.eq(StIvtStructattr::getStruct_id, dtl.getTurnin_struct_id())
);
structattrService.update(
new UpdateWrapper<StIvtStructattr>().lambda()
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("拼盘锁"))
.eq(StIvtStructattr::getStruct_id, dtl.getTurnout_struct_id())
);
} }
} }
return total_qty--; return total_qty--;

View File

@@ -2,8 +2,11 @@ package org.nl.wms.storage_manage.semimanage.service.shutFrame.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -24,8 +27,13 @@ import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService; import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr; import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.product_manage.sch.manage.TaskStatusEnum;
import org.nl.wms.product_manage.sch.service.TaskService; import org.nl.wms.product_manage.sch.service.TaskService;
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService; import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint; import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
@@ -46,6 +54,7 @@ import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.StIvtStructivt
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.mapper.StIvtStructivtBcpMapper; import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.mapper.StIvtStructivtBcpMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
@@ -76,6 +85,8 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
private SchBasePointMapper pointMapper; private SchBasePointMapper pointMapper;
@Autowired @Autowired
private ISchBasePointService pointService; private ISchBasePointService pointService;
@Autowired
private IStIvtStructattrService iStIvtStructattrService; // 仓位属性服务
@Override @Override
@@ -88,30 +99,21 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
} }
@Override @Override
@Transactional
public void taskOperate(JSONObject form) { public void taskOperate(JSONObject form) {
String task_id = form.getString("task_id"); String task_id = form.getString("task_id");
String status = form.getString("status"); String status = form.getString("status");
boolean all_finish = false;
//根据任务号查询对应的任务组 //根据任务号查询对应的任务组
SchBaseTask task = taskService.getOne(new QueryWrapper<SchBaseTask>().eq("task_id", task_id)); SchBaseTask task = taskService.getOne(new QueryWrapper<SchBaseTask>().eq("task_id", task_id));
String point_code = task.getPoint_code2(); /* String point_code = task.getPoint_code2();
String vehicle_code = task.getVehicle_code(); String vehicle_code = task.getVehicle_code();
pointService.update(new UpdateWrapper<SchBasePoint>().lambda() pointService.update(new UpdateWrapper<SchBasePoint>().lambda()
.eq(SchBasePoint::getPoint_code, point_code) .eq(SchBasePoint::getPoint_code, point_code)
.set(SchBasePoint::getVehicle_code, vehicle_code)); .set(SchBasePoint::getVehicle_code, vehicle_code));*/
List<SchBaseTask> task_list = taskService.list(new QueryWrapper<SchBaseTask>()
.eq("task_group_id", task.getTask_group_id())
.ne("task_status", StatusEnum.TASK_FINISH)
.eq("is_delete", false));
if (task_list.size() <= 0) {
all_finish = true;
}
List<StIvtShutframedtlBcp> list = shutframedtlBcpService.list(new QueryWrapper<StIvtShutframedtlBcp>().eq("task_id", task.getTask_group_id())); List<StIvtShutframedtlBcp> list = shutframedtlBcpService.list(new QueryWrapper<StIvtShutframedtlBcp>().eq("task_id", task.getTask_group_id()));
StIvtShutframedtlBcp dtl = list.get(0); StIvtShutframedtlBcp dtl = list.get(0);
@@ -123,32 +125,170 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>() shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>()
.eq("task_id", task.getTask_group_id()) .eq("task_id", task.getTask_group_id())
.set("work_status", SHUTEnum.WORK_STATUS.code("移出中"))); .set("work_status", SHUTEnum.WORK_STATUS.code("移出中")));
}
if (work_status.equals(SHUTEnum.WORK_STATUS.code("移出确认")) || work_status.equals(SHUTEnum.WORK_STATUS.code("移回中"))) { // 更新任务为执行中
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>() taskService.update(
.eq("task_id", task.getTask_group_id()) new UpdateWrapper<SchBaseTask>().lambda()
.set("work_status", SHUTEnum.WORK_STATUS.code("移回中"))); .set(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode())
.eq(SchBaseTask::getTask_id, task_id)
);
// 更新主表为执行中
this.update(
new UpdateWrapper<StIvtShutframeinvBcp>().lambda()
.set(StIvtShutframeinvBcp::getBill_status, SHUTEnum.BILL_STATUS.code("执行中"))
.eq(StIvtShutframeinvBcp::getShutframeinv_id, dtl.getShutframeinv_id())
);
} }
} }
if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode()) && all_finish) {
if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode())) {
if (work_status.equals(SHUTEnum.WORK_STATUS.code("移出中"))) { if (work_status.equals(SHUTEnum.WORK_STATUS.code("移出中"))) {
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>() // 更新任务为完成
.eq("task_id", task.getTask_group_id()) taskService.update(
.set("work_status", SHUTEnum.WORK_STATUS.code("移出确认"))); new UpdateWrapper<SchBaseTask>().lambda()
} .set(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
if (work_status.equals(SHUTEnum.WORK_STATUS.code("移回中"))) { .eq(SchBaseTask::getTask_id, task_id)
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>() );
.eq("task_id", task.getTask_group_id())
.set("work_status", SHUTEnum.WORK_STATUS.code("完成"))); // 判断出库任务是否都为完成 都为完成才更新明细状态
JSONObject jo = new JSONObject(); List<SchBaseTask> taskList = taskService.list(
jo.put("shutframeinv_id", dtl.getShutframeinv_id()); new QueryWrapper<SchBaseTask>().lambda()
this.confirm(jo); .eq(SchBaseTask::getTask_group_id, task.getTask_group_id())
.eq(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
);
if (taskList.size() >= 2) {
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>()
.eq("task_id", task.getTask_group_id())
.set("work_status", SHUTEnum.WORK_STATUS.code("移出确认")));
}
} }
} }
} }
@Override @Override
@Transactional
public void taskOperate2(JSONObject form) {
String task_id = form.getString("task_id");
String status = form.getString("status");
//根据任务号查询对应的任务组
SchBaseTask task = taskService.getOne(new QueryWrapper<SchBaseTask>().eq("task_id", task_id));
/* String point_code = task.getPoint_code2();
String vehicle_code = task.getVehicle_code();
pointService.update(new UpdateWrapper<SchBasePoint>().lambda()
.eq(SchBasePoint::getPoint_code, point_code)
.set(SchBasePoint::getVehicle_code, vehicle_code));*/
List<StIvtShutframedtlBcp> list = shutframedtlBcpService.list(new QueryWrapper<StIvtShutframedtlBcp>().eq("task_id", task.getTask_group_id()));
StIvtShutframedtlBcp dtl = list.get(0);
String work_status = dtl.getWork_status();
if (status.equals(AcsTaskEnum.STATUS_START.getCode())) {
if (work_status.equals(SHUTEnum.WORK_STATUS.code("移出确认")) || work_status.equals(SHUTEnum.WORK_STATUS.code("移回中"))) {
// 更新任务为执行中
taskService.update(
new UpdateWrapper<SchBaseTask>().lambda()
.set(SchBaseTask::getTask_status, TaskStatusEnum.EXECUTING.getCode())
.eq(SchBaseTask::getTask_id, task_id)
);
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>()
.eq("task_id", task.getTask_group_id())
.set("work_status", SHUTEnum.WORK_STATUS.code("移回中")));
}
}
if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode())) {
if (work_status.equals(SHUTEnum.WORK_STATUS.code("移回中"))) {
// 更新任务为完成
taskService.update(
new UpdateWrapper<SchBaseTask>().lambda()
.set(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(SchBaseTask::getTask_id, task_id)
);
// 判断出库任务是否都为完成 都为完成才更新明细状态
List<SchBaseTask> taskList = taskService.list(
new QueryWrapper<SchBaseTask>().lambda()
.eq(SchBaseTask::getTask_group_id, task.getTask_group_id())
.eq(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
);
if (taskList.size() >= 2) {
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>()
.eq("task_id", task.getTask_group_id())
.set("work_status", SHUTEnum.WORK_STATUS.code("完成")));
JSONObject jo = new JSONObject();
jo.put("shutframeinv_id", dtl.getShutframeinv_id());
this.confirm(jo);
}
}
}
}
@Override
@Transactional
public void confirmOne(JSONObject jo) {
StIvtShutframeinvBcp mstDao = this.getById(jo.getString("shutframeinv_id"));
// 1.找明细表
List<StIvtShutframedtlBcp> dtlList = shutframedtlBcpService.list(
new QueryWrapper<StIvtShutframedtlBcp>().lambda()
.eq(StIvtShutframedtlBcp::getShutframeinv_id, jo.getString("shutframeinv_id"))
);
// 2.找到移出时的两个完成的任务
List<SchBaseTask> taskList = taskService.list(
new QueryWrapper<SchBaseTask>().lambda()
.eq(SchBaseTask::getTask_group_id, dtlList.get(0).getTask_id())
.eq(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
);
if (taskList.size() != 2) throw new BadRequestException("移出任务异常,请检查");
// 3.创建回库任务
String task_group_id = IdUtil.getStringId();
for (SchBaseTask taskDao : taskList) {
PointEvent event = PointEvent.builder()
.type(AcsTaskEnum.TASK_STRUCT_SHUT_IN.getCode())
.acs_task_type("7")
.point_code1(taskDao.getPoint_code2())
.point_code2(taskDao.getPoint_code1())
.task_group_id(task_group_id)
.vehicle_code(taskDao.getVehicle_code())
.product_area(mstDao.getWorkshop_id())
.build();
BussEventMulticaster.Publish(event);
}
// 4.更新明细任务id为此任务组 task_group_id
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>().lambda()
.set(StIvtShutframedtlBcp::getTask_id, task_group_id)
.eq(StIvtShutframedtlBcp::getShutframeinv_id, mstDao.getShutframeinv_id()));
// 5.下发任务
List<SchBaseTask> taskListIn = taskService.list(
new QueryWrapper<SchBaseTask>().lambda()
.eq(SchBaseTask::getTask_group_id, task_group_id)
);
taskListIn.forEach(this::sendTask);
}
@Override
@Transactional
public void issueTask(JSONObject form) { public void issueTask(JSONObject form) {
Assert.notNull(new Object[]{form, form.get("shutframeinv_id")}, "请求参数不能为空"); Assert.notNull(new Object[]{form, form.get("shutframeinv_id")}, "请求参数不能为空");
@@ -167,6 +307,7 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
String task_group_id = IdUtil.getStringId(); String task_group_id = IdUtil.getStringId();
PointEvent event = PointEvent.builder() PointEvent event = PointEvent.builder()
.type(AcsTaskEnum.TASK_STRUCT_SHUT.getCode()) .type(AcsTaskEnum.TASK_STRUCT_SHUT.getCode())
.acs_task_type("7")
.point_code1(list.get(0).getTurnin_struct_code()) .point_code1(list.get(0).getTurnin_struct_code())
.point_code2((String) point_list.get(0).get("point_code")) .point_code2((String) point_list.get(0).get("point_code"))
.task_group_id(task_group_id) .task_group_id(task_group_id)
@@ -175,9 +316,11 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
.build(); .build();
PointEvent event2 = PointEvent.builder() PointEvent event2 = PointEvent.builder()
.acs_task_type("7")
.type(AcsTaskEnum.TASK_STRUCT_SHUT.getCode()) .type(AcsTaskEnum.TASK_STRUCT_SHUT.getCode())
.point_code1(list.get(0).getTurnout_struct_code()) .point_code1(list.get(0).getTurnout_struct_code())
.point_code2((String) point_list.get(1).get("point_code")) .point_code2((String) point_list.get(1).get("point_code"))
.task_group_id(task_group_id)
.vehicle_code(list.get((0)).getStoragevehicle_code()) .vehicle_code(list.get((0)).getStoragevehicle_code())
.product_area(mst.getWorkshop_id()) .product_area(mst.getWorkshop_id())
.build(); .build();
@@ -186,10 +329,41 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>().lambda() shutframedtlBcpService.update(new UpdateWrapper<StIvtShutframedtlBcp>().lambda()
.set(StIvtShutframedtlBcp::getTask_id, task_group_id) .set(StIvtShutframedtlBcp::getTask_id, task_group_id)
.set(StIvtShutframedtlBcp::getWork_status, SHUTEnum.WORK_STATUS.code("生成"))
.eq(StIvtShutframedtlBcp::getShutframeinv_id, mst.getShutframeinv_id())); .eq(StIvtShutframedtlBcp::getShutframeinv_id, mst.getShutframeinv_id()));
mst.setBill_status(SHUTEnum.BILL_STATUS.code("提交"));
this.updateById(mst);
// 下发任务
List<SchBaseTask> taskList = taskService.list(
new QueryWrapper<SchBaseTask>().lambda()
.eq(SchBaseTask::getTask_group_id, task_group_id)
);
taskList.forEach(this::sendTask);
}
private void sendTask(SchBaseTask taskDao) {
JSONArray param = new JSONArray();
param.add(JSON.parseObject(JSONUtil.toJsonStr(taskDao)));
// 1.下发任务
WmsToAcsService bean = SpringContextHolder.getBean(WmsToAcsService.class);
Map<String, Object> result = bean.issueTaskToAcs3(param);
// 反馈失败报错
if (!ObjectUtil.equal(MapUtil.getStr(result, "status"),"200")) {
throw new BadRequestException("下发失败:"+MapUtil.getStr(result, "message"));
}
// 2.更新任务状态
taskDao.setTask_status(TaskStatusEnum.ISSUE.getCode());
taskService.updateById(taskDao);
} }
@Override @Override
@Transactional
public void confirm(JSONObject form) { public void confirm(JSONObject form) {
Assert.notNull(new Object[]{form, form.get("shutframeinv_id")}, "请求参数不能为空"); Assert.notNull(new Object[]{form, form.get("shutframeinv_id")}, "请求参数不能为空");
@@ -198,7 +372,7 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
String material_id = dtl.getMaterial_id(); String material_id = dtl.getMaterial_id();
String turnin_struct_id = dtl.getTurnin_struct_id(); String turnin_struct_id = dtl.getTurnin_struct_id();
String turnout_struct_id = dtl.getTurnout_struct_id(); String turnout_struct_id = dtl.getTurnout_struct_id();
StIvtStructivtBcp in_ivt = structivtBcpService.getOne(new QueryWrapper<StIvtStructivtBcp>().eq("struct_id", turnin_struct_id).eq("material_id", material_id)); StIvtStructivtBcp in_ivt = structivtBcpService.getOne(new QueryWrapper<StIvtStructivtBcp>().eq("struct_id", turnin_struct_id).eq("material_id", material_id));
if (ObjectUtil.isEmpty(in_ivt)) { if (ObjectUtil.isEmpty(in_ivt)) {
throw new BadRequestException("库存不能为空!"); throw new BadRequestException("库存不能为空!");
} }
@@ -208,6 +382,22 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
dtl.setWork_status(SHUTEnum.WORK_STATUS.code("完成")); dtl.setWork_status(SHUTEnum.WORK_STATUS.code("完成"));
shutframedtlBcpService.updateById(dtl); shutframedtlBcpService.updateById(dtl);
// 解锁仓位 -- 空载具
iStIvtStructattrService.update(
new UpdateWrapper<StIvtStructattr>().lambda()
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
.set(StIvtStructattr::getIs_emptyvehicle, true)
.eq(StIvtStructattr::getStruct_id, dtl.getTurnout_struct_id())
);
// 解锁仓位 -- 有料
iStIvtStructattrService.update(
new UpdateWrapper<StIvtStructattr>().lambda()
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(StIvtStructattr::getStruct_id, dtl.getTurnin_struct_id())
);
}); });
StIvtShutframeinvBcp mst = this.getById(form.getString("shutframeinv_id")); StIvtShutframeinvBcp mst = this.getById(form.getString("shutframeinv_id"));
@@ -215,8 +405,7 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
mst.setConfirm_optname(SecurityUtils.getCurrentNickName()); mst.setConfirm_optname(SecurityUtils.getCurrentNickName());
mst.setConfirm_time(DateUtil.now()); mst.setConfirm_time(DateUtil.now());
mst.setBill_status(SHUTEnum.BILL_STATUS.code("完成")); mst.setBill_status(SHUTEnum.BILL_STATUS.code("完成"));
this.updateById(mst);
} }
@Override @Override
@@ -229,6 +418,7 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
} }
@Override @Override
@Transactional
public void delete(Long[] ids) { public void delete(Long[] ids) {
for (Long id : ids) { for (Long id : ids) {
StIvtShutframeinvBcp dao = this.getOne(new QueryWrapper<StIvtShutframeinvBcp>().eq("shutframeinv_id", id)); StIvtShutframeinvBcp dao = this.getOne(new QueryWrapper<StIvtShutframeinvBcp>().eq("shutframeinv_id", id));
@@ -239,6 +429,7 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
} }
@Override @Override
@Transactional
public void update(JSONObject form) { public void update(JSONObject form) {
Assert.notNull(new Object[]{form, form.get("shutframeinv_id")}, "请求参数不能为空"); Assert.notNull(new Object[]{form, form.get("shutframeinv_id")}, "请求参数不能为空");
StIvtShutframeinvBcp mst = form.toJavaObject(StIvtShutframeinvBcp.class); StIvtShutframeinvBcp mst = form.toJavaObject(StIvtShutframeinvBcp.class);
@@ -256,8 +447,10 @@ public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframei
} }
@Override @Override
@Transactional
public void create(JSONObject form) { public void create(JSONObject form) {
JSONArray rows = form.getJSONArray("tableData"); JSONArray rows = form.getJSONArray("tableData");
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空"); if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
// 调用主表 插入/更新方法 // 调用主表 插入/更新方法

View File

@@ -119,9 +119,9 @@
<el-table-column prop="qty_unit_name" label="重量单位" align="center" /> <el-table-column prop="qty_unit_name" label="重量单位" align="center" />
<el-table-column show-overflow-tooltip prop="turnin_struct_code" label="移入货位" /> <el-table-column show-overflow-tooltip prop="turnin_struct_code" label="移入货位" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code_in" label="移入载具号" width="90" /> <el-table-column show-overflow-tooltip prop="storagevehicle_code_in" label="移入载具号" width="90" />
<el-table-column prop="quality_scode" label="品质类型" align="center" width="110px" :formatter="quality_scodeFormat" /> <!-- <el-table-column prop="quality_scode" label="品质类型" align="center" width="110px" :formatter="quality_scodeFormat" />-->
<el-table-column prop="ivt_level" label="库存等级" align="center" width="100px" :formatter="ivt_levelFormat" /> <!-- <el-table-column prop="ivt_level" label="库存等级" align="center" width="100px" :formatter="ivt_levelFormat" />-->
<el-table-column prop="is_active" label="是否可用" align="center" width="110px" :formatter="is_activeFormat" /> <!-- <el-table-column prop="is_active" label="是否可用" align="center" width="110px" :formatter="is_activeFormat" />-->
</el-table> </el-table>
<el-row v-if="crud.status.cu > 0" :gutter="2"> <el-row v-if="crud.status.cu > 0" :gutter="2">
<el-col :span="12"> <el-col :span="12">