fix:修复虚拟货位生成只到100的问题
This commit is contained in:
@@ -3,9 +3,11 @@ package org.nl.b_lms.storage_manage.ios.service.iostorInv;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dto.StructAllsetDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -41,5 +43,7 @@ public interface IStIvtIostorinvdisService extends IService<StIvtIostorinvdis> {
|
||||
* @param task_id: 任务标识
|
||||
*/
|
||||
void confirmDisIn(String task_id);
|
||||
|
||||
List<StructAllsetDto> getDisStructSet(String iostorinvId);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@ package org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dto.StructAllsetDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,4 +48,10 @@ public interface StIvtIostorinvdisMapper extends BaseMapper<StIvtIostorinvdis> {
|
||||
*/
|
||||
List<JSONObject> getNotCreateDis(JSONObject whereJson);
|
||||
|
||||
@Select("select st_ivt_structattr.sect_id,st_ivt_structattr.block_num,st_ivt_structattr.row_num,st_ivt_structattr.out_order_seq,st_ivt_structattr.struct_code,st_ivt_structattr.placement_type \n" +
|
||||
"from st_ivt_iostorinvdis \n" +
|
||||
"left join st_ivt_structattr on st_ivt_iostorinvdis.struct_code = st_ivt_structattr.struct_code\n" +
|
||||
"where st_ivt_iostorinvdis.work_status = '00' and st_ivt_iostorinvdis.iostorinv_id = #{iostorinvId}")
|
||||
List<StructAllsetDto> getDisStructSet(String iostorinvId);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdtlServi
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.mapper.StIvtIostorinvdisMapper;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dto.StructAllsetDto;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -148,4 +149,10 @@ public class StIvtIostorinvdisServiceImpl extends ServiceImpl<StIvtIostorinvdisM
|
||||
// 更新主表
|
||||
SpringContextHolder.getBean(StIvtIostorinvServiceImpl.class).updateMstStatus(disDaoList.get(0).getIostorinv_id());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StructAllsetDto> getDisStructSet(String iostorinvId) {
|
||||
List<StructAllsetDto> structSet = this.baseMapper.getDisStructSet(iostorinvId);
|
||||
return structSet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.AcsUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -34,12 +36,19 @@ public abstract class AbstractAcsTask {
|
||||
return addTask();
|
||||
}
|
||||
|
||||
public List<AcsTaskDto> schedule(String taskId) {
|
||||
return addTask(taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加任务进行下发
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract List<AcsTaskDto> addTask();
|
||||
public List<AcsTaskDto> addTask(String taskId){
|
||||
throw new BadRequestException("当前类没有重写addTask(taskId)方法");
|
||||
};
|
||||
|
||||
/**
|
||||
* @param taskObj 代表一条任务对象
|
||||
@@ -111,15 +120,20 @@ public abstract class AbstractAcsTask {
|
||||
*
|
||||
*/
|
||||
public JSONObject immediateNotifyAcs(String task_id) {
|
||||
List<AcsTaskDto> taskList = this.schedule();
|
||||
if (ObjectUtil.isNotEmpty(taskList)) {
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(taskList));
|
||||
if (acsUtil == null){
|
||||
return AcsUtil.notifyAcs("api/wms/task", arr);
|
||||
}else {
|
||||
return acsUtil.notifyAcs3("api/wms/task", arr);
|
||||
}
|
||||
}
|
||||
List<AcsTaskDto> taskList;
|
||||
if (StringUtils.isEmpty(task_id)){
|
||||
taskList = this.schedule();
|
||||
}else {
|
||||
taskList = this.schedule(task_id);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(taskList)) {
|
||||
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(taskList));
|
||||
if (acsUtil == null){
|
||||
return AcsUtil.notifyAcs("api/wms/task", arr);
|
||||
}else {
|
||||
return acsUtil.notifyAcs3("api/wms/task", arr);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +70,46 @@ public class OutTask extends AbstractAcsTask {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask(String taskId) {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
//任务表
|
||||
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
map.put("handle_class", THIS_CLASS);
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task")
|
||||
.query("task_id = '"+taskId+"' and handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
char dtl_type = json.getString("task_type").charAt(json.getString("task_type").length() - 1);
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.class_type(json.getString("task_type"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
|
||||
// 更新任务为下发
|
||||
JSONObject paramMap = new JSONObject();
|
||||
paramMap.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
wo_Task.update(paramMap, "task_id ='" + json.getString("task_id") + "'");
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
|
||||
@@ -167,6 +167,12 @@ public interface CheckOutBillService {
|
||||
*/
|
||||
void allSetPoint(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 出库一件设置:修改事务工具
|
||||
* @param whereJson
|
||||
*/
|
||||
void allSetPointByNoTran(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 查询可分配库存
|
||||
*
|
||||
|
||||
@@ -80,6 +80,60 @@ public class HandMoveStorAcsTask extends AbstractAcsTask {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask(String taskId) {
|
||||
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task")
|
||||
.query("task_id = '" + taskId + "' and handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'")
|
||||
.getResultJSONArray(0);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
//判断该任务所在的块、排存在其他任务
|
||||
/*String point_code2 = json.getString("point_code2");
|
||||
JSONObject struct_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("struct_code = '"+point_code2+"'").uniqueResult(0);
|
||||
String row_num = struct_jo.getString("row_num");
|
||||
String block_num = struct_jo.getString("block_num");
|
||||
JSONObject task_jo = WQLObject.getWQLObject("ST_IVT_StructAttr").query("block_num = '"+block_num+"' AND row_num = '"+row_num+"' AND lock_type in ('3','6')").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(task_jo)){
|
||||
continue;
|
||||
}*/
|
||||
|
||||
char dtl_type = json.getString("task_type").charAt(json.getString("task_type").length() - 1);
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.class_type(json.getString("task_type"))
|
||||
.dtl_type(String.valueOf(dtl_type))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
// 如果是二期转库任务则下发托盘 && 下发路由方案 大托盘托盘号开头A是大B是小
|
||||
if (json.getString("task_type").equals("010709")) {
|
||||
dto.setVehicle_code(json.getString("vehicle_code2"));
|
||||
|
||||
if (json.getString("vehicle_code2").contains("A")) {
|
||||
dto.setRoute_plan_code("two");
|
||||
} else {
|
||||
dto.setRoute_plan_code("normal");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resultList.add(dto);
|
||||
json.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").update(json);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskObj 代表一条任务对象
|
||||
* @param status 代表wcs任务完成状态: //1:执行中,2:完成 ,3:acs取消
|
||||
|
||||
@@ -208,12 +208,11 @@ public class CheckOutBillController {
|
||||
|
||||
@PostMapping("/allSetPoint")
|
||||
@Log("一键设置")
|
||||
|
||||
public ResponseEntity<Object> allSetPoint(@RequestBody JSONObject whereJson) {
|
||||
if (whereJson.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) {
|
||||
iStIvtIostorinvOutService.allSetPoint(whereJson);
|
||||
} else {
|
||||
checkOutBillService.allSetPoint(whereJson);
|
||||
checkOutBillService.allSetPointByNoTran(whereJson);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,17 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdisService;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dto.StructAllsetDto;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -50,6 +56,7 @@ import org.redisson.api.RedissonClient;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
@@ -78,6 +85,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
private final InAndOutReturnService inAndOutReturnService;
|
||||
private final RedissonClient redissonClient;
|
||||
private final ISysUserDeptService iSysUserDeptService;
|
||||
private final IStIvtIostorinvdisService iStIvtIostorinvdisService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -3202,6 +3210,280 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}, new JSONArray());
|
||||
}
|
||||
|
||||
public void allSetPointByNoTran(JSONObject whereJson) {
|
||||
String point_code = whereJson.getString("point_code"); // 终点
|
||||
JSONObject jsonPoint2 = WQLObject.getWQLObject("SCH_BASE_Point").query("lock_type='1' and (vehicle_code='' or vehicle_code IS NULL) and point_code='" + whereJson.getString("point_code") + "'").uniqueResult(0);
|
||||
参数校验:{
|
||||
JSONObject jo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + whereJson.getString("iostorinv_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo_mst)) {
|
||||
throw new BadRequestException("未查到相关出库单");
|
||||
}
|
||||
//如果终点站点被锁定或者有载具号,则不允许设置点位
|
||||
if (ObjectUtil.isEmpty(jsonPoint2)) {
|
||||
throw new BadRequestException("该站点被锁定或者有载具号,不允许设置!");
|
||||
}
|
||||
// 查询此明细的所有未生成的分配明细(根据片区、排 分组)
|
||||
JSONArray allRowArr = WQL.getWO("ST_OUTIVT04")
|
||||
.addParam("flag", "1")
|
||||
.addParam("iostorinvdtl_id", whereJson.getString("iostorinvdtl_id"))
|
||||
.addParam("iostorinv_id", whereJson.getString("iostorinv_id"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(allRowArr)) {
|
||||
throw new BadRequestException("当前没有可设置的分配明细");
|
||||
}
|
||||
// 判断当前排是否有其他任务正在执行
|
||||
for (int i = 0; i < allRowArr.size(); i++) {
|
||||
JSONObject jsonRow = allRowArr.getJSONObject(i);
|
||||
JSONArray structArr = WQLObject.getWQLObject("ST_IVT_StructAttr").query("block_num = '" + jsonRow.getString("block_num")
|
||||
+ "' and row_num = '" + jsonRow.getString("row_num") + "' and is_used = '1' and is_delete = '0' and lock_type not in ('1','6','3')").getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(structArr)) {
|
||||
throw new BadRequestException("有其他任务正在执行中,请稍后在试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 1.判断此条分配明细的 ‘仓位’在此主表下的分配明细是否有相同的 ‘仓位’
|
||||
List<StructAllsetDto> structSet = iStIvtIostorinvdisService.getDisStructSet(whereJson.getString("iostorinv_id"));
|
||||
//同区同排排序:10302-04-01
|
||||
//口口回口回口口口1
|
||||
//口口回回口口口口2
|
||||
Map<String, List<StructAllsetDto>> collect = structSet.stream().distinct().collect(Collectors.groupingBy(struct -> struct.getRow_num()+"_"+struct.getBlock_num()));
|
||||
for (String orderBy : collect.keySet()) {
|
||||
List<StructAllsetDto> needStructs = collect.get(orderBy);
|
||||
//从左到右排序
|
||||
needStructs.sort(Comparator.comparingInt(a->Integer.valueOf(a.getOut_order_seq())));
|
||||
StructAllsetDto left = needStructs.get(0);
|
||||
StructAllsetDto right = needStructs.get(needStructs.size()-1);
|
||||
//确认左/右出库并根据出库顺序获取货位集合
|
||||
List<JSONObject> structs = 左右出库确认(needStructs, left, right);
|
||||
//attr.struct_code,attr.lock_type,attr.storagevehicle_code,attr.inv_code,storagevehicle_code
|
||||
List<String> needStructList = needStructs.stream().map(StructAllsetDto::getStruct_code).collect(Collectors.toList());
|
||||
/**
|
||||
* 1.判断当前仓位:是否有锁定,是否是分配的货位
|
||||
* 锁定:
|
||||
* 直接跳过
|
||||
* 没锁定:
|
||||
* 1.不是分配的货位则移库
|
||||
* 2.是分配的货位则出库:并更新单据
|
||||
*/
|
||||
String taskGroup = org.nl.common.utils.IdUtil.getStringId();
|
||||
for (int i = 0; i < structs.size(); i++) {
|
||||
JSONObject item = structs.get(i);
|
||||
item.put("task_group_id",taskGroup);
|
||||
item.put("seq",i);
|
||||
item.put("point_code",point_code);
|
||||
item.put("point_id",jsonPoint2.getString("point_id"));
|
||||
String structCode = item.getString("struct_code");
|
||||
if (CollectionUtils.isEmpty(needStructs)){
|
||||
break;
|
||||
}
|
||||
if (!item.getString("lock_type").equals(IOSEnum.LOCK_TYPE.code("未锁定"))){
|
||||
continue;
|
||||
}
|
||||
if (needStructList.contains(structCode)){
|
||||
//出库
|
||||
this.createOut(item);
|
||||
needStructList.remove(structCode);
|
||||
}else {
|
||||
//移库
|
||||
this.createMove(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private List<JSONObject> 左右出库确认(List<StructAllsetDto> structs, StructAllsetDto left, StructAllsetDto right) {
|
||||
/**
|
||||
* 1.查询当前排被锁住的货位集合
|
||||
* 2.过滤仓位没有没有被其他单据锁定的货位
|
||||
* 3.如果有其他锁定的货位
|
||||
* 如果是右通,判断左边货位对应右边有锁定的货位则抛异常
|
||||
* 如果是左通,判断右边货位对应左边有锁定的货位则抛异常
|
||||
* 如果是双通,左边没锁则左边出,右边没锁则右边出
|
||||
* 4.如果当前排没有锁定货位
|
||||
* 判断哪边货位少则从哪边出
|
||||
* 5.根据哪边出库查询当前排货位出库顺序
|
||||
*/
|
||||
String placementType = left.getPlacement_type();
|
||||
//查询当前排
|
||||
//lock_type('2','3','6','7')
|
||||
// 查询仓位被锁住的货位
|
||||
HashMap param = MapOf.of("flag", "51", "sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
JSONArray allLock = WQL.getWO("ST_OUTIVT04").addParamMap(param).process().getResultJSONArray(0);
|
||||
List<JSONObject> hasLock = this.isNumList(allLock);
|
||||
String option;
|
||||
//如果货位有锁定则需要判断左右
|
||||
//口回口口回口*口口 <--->
|
||||
if (!ObjectUtil.isEmpty(hasLock)){
|
||||
List<String> rightLock = hasLock.stream().filter(item ->
|
||||
item.getInteger("out_order_seq") >= Integer.valueOf(left.getOut_order_seq()))
|
||||
.map(a->"仓位"+a.getString("struct_code")+"锁定单据"+a.getString("inv_code")).collect(Collectors.toList());
|
||||
List<String> leftLock = hasLock.stream().filter(item ->
|
||||
item.getInteger("out_order_seq") < Integer.valueOf(right.getOut_order_seq()))
|
||||
.map(a->"仓位"+a.getString("struct_code")+"锁定单据"+a.getString("inv_code")).collect(Collectors.toList());
|
||||
//如果锁定货位存在则判断左右通
|
||||
if (StringUtils.equals(placementType,"03")){
|
||||
//右通:获取最左边仓位对应锁定的仓位
|
||||
if (!ObjectUtil.isEmpty(rightLock)){
|
||||
String error = rightLock.stream().collect(Collectors.joining(","));
|
||||
throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
}
|
||||
option = "03";
|
||||
}else if (StringUtils.equals(placementType,"02")){
|
||||
//左通:获取最右边仓位对应锁定的仓位
|
||||
if (!ObjectUtil.isEmpty(leftLock)){
|
||||
String error = leftLock.stream().collect(Collectors.joining(","));
|
||||
throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
}
|
||||
option = "02";
|
||||
}else {
|
||||
//双通
|
||||
String error = hasLock.stream()
|
||||
.map(a -> "仓位" + a.getString("struct_code") + "锁定单据" + a.getString("inv_code"))
|
||||
.collect(Collectors.joining(","));
|
||||
throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
// if (ObjectUtil.isEmpty(rightLock)){
|
||||
// option = "03";
|
||||
// }else if (ObjectUtil.isEmpty(leftLock)){
|
||||
// option = "02";
|
||||
// }else {
|
||||
// rightLock.addAll(leftLock);
|
||||
// String error = rightLock.stream().collect(Collectors.joining(","));
|
||||
// throw new BadRequestException(error + "被锁定且未下发任务,无法生成任务!");
|
||||
// }
|
||||
}
|
||||
}
|
||||
else {
|
||||
//如果没有锁定这确认从左边出还是右边出库
|
||||
if (StringUtils.equals(placementType,"01")){
|
||||
//确认那边少出哪边-
|
||||
//查询当前排最大order
|
||||
HashMap maxParam = MapOf.of("flag", "52", "sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
JSONObject result = WQL.getWO("ST_OUTIVT04").addParamMap(maxParam).process().uniqueResult(0);
|
||||
Integer maxSeq = result.getInteger("maxSeq");
|
||||
Integer minSeq = result.getInteger("minSeq");
|
||||
int leftVe = Integer.valueOf(left.getOut_order_seq()) - minSeq;
|
||||
int rightVe = maxSeq - Integer.valueOf(right.getOut_order_seq());
|
||||
option = leftVe>rightVe?"03":"02";
|
||||
}else {
|
||||
option = placementType;
|
||||
}
|
||||
}
|
||||
//option确认了左边出库还是右边出库03左边,02右边
|
||||
HashMap structParam = MapOf.of("flag", "53", "out_order_seq",option,"sect_id",left.getSect_id(),"block_num", left.getBlock_num(), "row_num", left.getRow_num());
|
||||
return WQL.getWO("ST_OUTIVT04").addParamMap(structParam).process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
}
|
||||
@Transactional
|
||||
public void createMove(JSONObject struct){
|
||||
//attr.struct_code,attr.lock_type,attr.storagevehicle_code,attr.inv_code
|
||||
JSONObject json = WQLObject.getWQLObject("st_ivt_structattr").query("struct_code = '" + struct.getString("struct_code") + "'").uniqueResult(0);
|
||||
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
|
||||
JSONArray table = new JSONArray(); // 明细参数
|
||||
mapParam.put("bill_type", "21");
|
||||
mapParam.put("buss_type", "21");
|
||||
mapParam.put("bill_status", "10");
|
||||
mapParam.put("biz_date", DateUtil.today());
|
||||
mapParam.put("stor_code", "CP01");
|
||||
mapParam.put("stor_id", "1582991156504039424");
|
||||
mapParam.put("stor_name", "成品仓库");
|
||||
mapParam.put("is_task", "1");
|
||||
|
||||
// 查询移入货位
|
||||
JSONObject moveParam = new JSONObject();
|
||||
moveParam.put("box_no", json.getString("storagevehicle_code"));
|
||||
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
|
||||
moveParam.put("layer_num", json.getString("layer_num"));
|
||||
JSONObject jsonMove = rawAssistIStorService.autoDisMove(moveParam);
|
||||
// 查询移出货位的库存物料
|
||||
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
|
||||
.addParam("flag", "6")
|
||||
.addParam("struct_id", json.getString("struct_id"))
|
||||
.process().uniqueResult(0);
|
||||
|
||||
// 移库单明细
|
||||
JSONObject jsonMoveDtl = new JSONObject();
|
||||
jsonMoveDtl.put("is_task", "2");
|
||||
jsonMoveDtl.put("turnout_sect_id", json.getLongValue("sect_id"));
|
||||
jsonMoveDtl.put("turnout_sect_code", json.getString("sect_code"));
|
||||
jsonMoveDtl.put("turnout_sect_name", json.getString("sect_name"));
|
||||
jsonMoveDtl.put("turnout_struct_id", json.getLongValue("struct_id"));
|
||||
jsonMoveDtl.put("turnout_struct_code", json.getString("struct_code"));
|
||||
jsonMoveDtl.put("turnout_struct_name", json.getString("struct_name"));
|
||||
jsonMoveDtl.put("material_id", jsonMoveIvt.getLongValue("material_id"));
|
||||
jsonMoveDtl.put("pcsn", jsonMoveIvt.getString("pcsn"));
|
||||
jsonMoveDtl.put("quality_scode", "01");
|
||||
jsonMoveDtl.put("qty_unit_id", jsonMoveIvt.getLongValue("qty_unit_id"));
|
||||
jsonMoveDtl.put("qty_unit_name", jsonMoveIvt.getString("unit_name"));
|
||||
jsonMoveDtl.put("qty", jsonMoveIvt.getDoubleValue("canuse_qty"));
|
||||
jsonMoveDtl.put("storagevehicle_code", json.getString("storagevehicle_code"));
|
||||
jsonMoveDtl.put("turnin_sect_id", jsonMove.getLongValue("sect_id"));
|
||||
jsonMoveDtl.put("turnin_sect_code", jsonMove.getString("sect_code"));
|
||||
jsonMoveDtl.put("turnin_sect_name", jsonMove.getString("sect_name"));
|
||||
jsonMoveDtl.put("turnin_struct_id", jsonMove.getLongValue("struct_id"));
|
||||
jsonMoveDtl.put("turnin_struct_code", jsonMove.getString("struct_code"));
|
||||
jsonMoveDtl.put("turnin_struct_name", jsonMove.getString("struct_name"));
|
||||
// 生成任务
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("task_type", "010505");
|
||||
form.put("vehicle_code", json.getString("storagevehicle_code"));
|
||||
form.put("point_code1", json.getString("struct_code"));
|
||||
form.put("point_code2", jsonMove.getString("struct_code"));
|
||||
form.put("task_group_id", struct.getLongValue("task_group_id")); // 任务组
|
||||
form.put("sort_seq", struct.getIntValue("seq") + 1); // 任务组顺序号
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||
json.put("task_name", form.getString("task_name"));
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
json.put("point_code2", form.getString("point_code2"));
|
||||
json.put("material_id", form.getString("material_id"));
|
||||
json.put("task_group_id", form.getString("task_group_id"));
|
||||
json.put("sort_seq", form.getString("sort_seq")+1);
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("handle_class", HandMoveStorAcsTask.class.getName());
|
||||
json.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
json.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("acs_task_type", "7");
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").insert(json);
|
||||
// 回显移库明细任务id
|
||||
jsonMoveDtl.put("task_id", json.getString("task_id"));
|
||||
table.add(jsonMoveDtl);
|
||||
mapParam.put("tableData", table);
|
||||
// 调用移库单新增方法
|
||||
handMoveStorService.insertDtl2(mapParam);
|
||||
moveStorAcsTask.immediateNotifyAcs(json.getString("task_id"));
|
||||
}
|
||||
@Transactional
|
||||
public void createOut(JSONObject struct){
|
||||
List<StIvtIostorinvdis> list = iStIvtIostorinvdisService
|
||||
.list(new QueryWrapper<StIvtIostorinvdis>()
|
||||
.eq("box_no", struct.getString("storagevehicle_code")));
|
||||
StIvtIostorinvdis oneDis = list.get(0);
|
||||
// 创建任务
|
||||
//查询对应dis
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("task_type", "010503");
|
||||
param.put("vehicle_code", oneDis.getBox_no());
|
||||
param.put("task_name", "");
|
||||
param.put("point_code1", oneDis.getStruct_code());
|
||||
param.put("point_code2", struct.getString("point_code"));
|
||||
param.put("material_id", oneDis.getMaterial_id());
|
||||
// 更新出库任务:任务组和顺序号
|
||||
param.put("task_group_id", struct.getString("task_group_id")); // 任务组
|
||||
param.put("sort_seq", struct.getString("sort_seq")+1); // 任务组顺序号
|
||||
String create_task_id = outTask.createTask(param);
|
||||
//批量更细分配明细
|
||||
List<Long> disIds = list.stream().map(StIvtIostorinvdis::getIostorinvdis_id).collect(Collectors.toList());
|
||||
iStIvtIostorinvdisService.update(new UpdateWrapper<StIvtIostorinvdis>()
|
||||
.set("work_status","01")
|
||||
.set("task_id",create_task_id)
|
||||
.set("point_id",struct.getString("id"))
|
||||
.eq("work_status","00")
|
||||
.in("iostorinvdis_id",disIds));
|
||||
outTask.immediateNotifyAcs(create_task_id);
|
||||
}
|
||||
public void formeth(Consumer<String> allTransactionConsumer, JSONArray allRowArr, String iostorinv_id, String point_code, boolean checked, String iostorinvdtl_id, JSONObject jsonPoint2) {
|
||||
for (int i = 0; i < allRowArr.size(); i++) {
|
||||
// 调用当前排处理方法
|
||||
@@ -4245,6 +4527,33 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public List<JSONObject> isNumList(JSONArray arr) {
|
||||
StringJoiner joiner = new StringJoiner(",", "(", ")");
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(arr)) {
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
joiner.add("'" + json.getString("struct_code") + "'");
|
||||
}
|
||||
JSONArray task_ja = WQL.getWO("QST_IVT_CHECKOUTBILL").addParam("struct_codes", joiner.toString()).addParam("flag", "14").process().getResultJSONArray(0);
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject jo = arr.getJSONObject(i);
|
||||
String struct_code = jo.getString("struct_code");
|
||||
boolean flag = true;
|
||||
for (int j = 0; j < task_ja.size(); j++) {
|
||||
JSONObject task_jo = task_ja.getJSONObject(j);
|
||||
if (task_jo.getString("point_code1").equals(struct_code)) {
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
result.add(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean is_trueOrFalse(JSONObject json) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
输入.iostorinv_id TYPEAS s_string
|
||||
输入.iostorinvdtl_id TYPEAS s_string
|
||||
输入.block_num TYPEAS s_string
|
||||
输入.sect_id TYPEAS s_string
|
||||
输入.row_num TYPEAS s_string
|
||||
输入.out_order_seq TYPEAS s_string
|
||||
输入.iostorinvdis_id TYPEAS s_string
|
||||
@@ -271,10 +272,58 @@
|
||||
AND attr.row_num = 输入.row_num
|
||||
AND attr.out_order_seq > 输入.out_order_seq
|
||||
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
IF 输入.flag = "51"
|
||||
QUERY
|
||||
SELECT
|
||||
attr.struct_code,attr.lock_type,attr.storagevehicle_code,attr.inv_code
|
||||
FROM
|
||||
st_ivt_structattr attr
|
||||
WHERE
|
||||
attr.lock_type in ('2','3','6','7')
|
||||
AND attr.block_num = 输入.block_num
|
||||
AND attr.row_num = 输入.row_num
|
||||
AND attr.sect_id = 输入.sect_id
|
||||
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
IF 输入.flag = "52"
|
||||
QUERY
|
||||
SELECT
|
||||
MAX(attr.out_order_seq) as maxSeq,MIN(attr.out_order_seq) as minSeq
|
||||
FROM
|
||||
st_ivt_structattr attr
|
||||
WHERE
|
||||
attr.block_num = 输入.block_num
|
||||
AND attr.row_num = 输入.row_num
|
||||
AND attr.sect_id = 输入.sect_id
|
||||
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
IF 输入.flag = "53"
|
||||
QUERY
|
||||
SELECT
|
||||
attr.struct_code,attr.lock_type,attr.storagevehicle_code,attr.inv_code
|
||||
FROM
|
||||
st_ivt_structattr attr
|
||||
WHERE
|
||||
attr.block_num = 输入.block_num
|
||||
AND attr.row_num = 输入.row_num
|
||||
AND attr.sect_id = 输入.sect_id
|
||||
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
|
||||
OPTION 输入.out_order_seq == "03"
|
||||
ORDER BY out_order_seq asc
|
||||
ENDOPTION
|
||||
OPTION 输入.out_order_seq == "02"
|
||||
ORDER BY out_order_seq desc
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "6"
|
||||
QUERY
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TranUtil {
|
||||
.collect(Collectors.toList());
|
||||
commits.removeAll(collect);*/
|
||||
for (TransactionStatus status : commits) {
|
||||
txManager.commit(status);
|
||||
txManager.commit(status);//8小时,180秒
|
||||
}
|
||||
txManager.commit(externalStatus);
|
||||
/* //释放剩余资源
|
||||
|
||||
Reference in New Issue
Block a user