opt:优化现场问题;
This commit is contained in:
@@ -1650,40 +1650,47 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
|||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
throw new BadRequestException(LangProcess.msg("error_nullPoint"));
|
throw new BadRequestException(LangProcess.msg("error_nullPoint"));
|
||||||
}
|
}
|
||||||
Long currentUserId = Long.valueOf(SecurityUtils.getCurrentUserId());
|
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
// 1.获取上传文件输入流
|
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
try {
|
try {
|
||||||
inputStream = file.getInputStream();
|
inputStream = file.getInputStream();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// WQLObject wo = WQLObject.getWQLObject("acs_device");
|
|
||||||
|
|
||||||
// 调用用 hutool 方法读取数据 默认调用第一个sheet
|
|
||||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||||
// 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
|
||||||
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
||||||
// 循环获取的数据
|
|
||||||
for (int i = 0; i < read.size(); i++) {
|
for (int i = 0; i < read.size(); i++) {
|
||||||
List list = read.get(i);
|
List list = read.get(i);
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
String device_code = list.get(0).toString();
|
String device_code = list.get(0).toString();
|
||||||
String device_name = list.get(1).toString();
|
String device_name = list.get(1).toString();
|
||||||
String device_type = list.get(2).toString();
|
String device_type = list.get(2).toString();
|
||||||
String is_config = list.get(3).toString();
|
String driver_code = list.get(3).toString();
|
||||||
String is_route = list.get(4).toString();
|
String is_config = list.get(5).toString();
|
||||||
String region = list.get(5).toString();
|
String is_route = list.get(6).toString();
|
||||||
|
String region = list.get(7).toString();
|
||||||
|
String address = list.get(4).toString();
|
||||||
if (StrUtil.isEmpty(device_code)) {
|
if (StrUtil.isEmpty(device_code)) {
|
||||||
throw new BadRequestException(LangProcess.msg("error_checkNull", "device_code"));
|
throw new BadRequestException(LangProcess.msg("error_checkNull", "device_code"));
|
||||||
}
|
}
|
||||||
|
//判断数据库记录是否存在,不存在则新增,存在则配置acs_device_extra和acs_storage_cell
|
||||||
|
Device deviceRunpoint = new LambdaQueryChainWrapper<>(deviceMapper)
|
||||||
|
.eq(Device::getDevice_code, device_code)
|
||||||
|
.one();
|
||||||
|
if (ObjectUtil.isNotEmpty(deviceRunpoint)) {
|
||||||
|
addConfig(deviceRunpoint);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (StrUtil.isEmpty(device_name)) {
|
if (StrUtil.isEmpty(device_name)) {
|
||||||
device_name = device_code;
|
device_name = device_code;
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(device_type)) {
|
if (StrUtil.isEmpty(device_type)) {
|
||||||
device_type = "conveyor";
|
device_type = "station";
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(driver_code)) {
|
||||||
|
driver_code = "standard_ordinary_site";
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(is_config)) {
|
if (StrUtil.isEmpty(is_config)) {
|
||||||
is_config = "FALSE";
|
is_config = "FALSE";
|
||||||
@@ -1700,6 +1707,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
|||||||
param.put("device_code", device_code);
|
param.put("device_code", device_code);
|
||||||
param.put("device_name", device_name);
|
param.put("device_name", device_name);
|
||||||
param.put("device_type", device_type);
|
param.put("device_type", device_type);
|
||||||
|
param.put("driver_code", driver_code);
|
||||||
param.put("is_config", is_config);
|
param.put("is_config", is_config);
|
||||||
param.put("is_route", is_route);
|
param.put("is_route", is_route);
|
||||||
param.put("create_by", nickName);
|
param.put("create_by", nickName);
|
||||||
@@ -1707,13 +1715,196 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
|||||||
param.put("update_by", nickName);
|
param.put("update_by", nickName);
|
||||||
param.put("update_time", now);
|
param.put("update_time", now);
|
||||||
param.put("region", region);
|
param.put("region", region);
|
||||||
|
param.put("address", address);
|
||||||
// wo.insert(param);
|
|
||||||
Device entity = ConvertUtil.convert(param, Device.class);
|
Device entity = ConvertUtil.convert(param, Device.class);
|
||||||
deviceMapper.insert(entity);
|
deviceMapper.insert(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void addConfig(Device device) {
|
||||||
|
String device_id = device.getDevice_id();
|
||||||
|
String device_code = device.getDevice_code();
|
||||||
|
String opc_server_id = device.getOpc_plc_id();
|
||||||
|
String opc_plc_id = device.getOpc_plc_id();
|
||||||
|
String address = device.getAddress();
|
||||||
|
String device_type = device.getDevice_type();
|
||||||
|
String driver_code = device.getDriver_code();
|
||||||
|
if (StrUtil.isEmpty(device_id)) {
|
||||||
|
throw new BadRequestException(LangProcess.msg("error_checkNull", "device_id"));
|
||||||
|
}
|
||||||
|
DeviceDto dto = this.findById(device_id);
|
||||||
|
DeviceRunpointDto devrundto = new DeviceRunpointDto();
|
||||||
|
log.info("插入设备扩展表字段信息");
|
||||||
|
//先删除设备扩展表【acs_device_extra】
|
||||||
|
deviceExtraService.deleteAllByDeviceIds(new String[]{device_id});
|
||||||
|
JSONObject form = new JSONObject();
|
||||||
|
form.put("device_id", device_id);
|
||||||
|
form.put("device_code", device_code);
|
||||||
|
form.put("address", address);
|
||||||
|
deviceExtraService.createByDeviceConfig(form, "01");
|
||||||
|
//判断是否存在并开启站点管理
|
||||||
|
// if (form.containsKey("station_manager")) {
|
||||||
|
// if ("true".equals(form.get("station_manager").toString())) {
|
||||||
|
// //判断数据库记录是否存在 不存在则新增 存在则修改
|
||||||
|
// DeviceRunpoint deviceRunpoint = new LambdaQueryChainWrapper<>(deviceRunpointMapper)
|
||||||
|
// .eq(DeviceRunpoint::getDevice_id, device_id)
|
||||||
|
// .one();
|
||||||
|
// if (ObjectUtil.isEmpty(deviceRunpoint)) {
|
||||||
|
// devrundto.setDevice_code(dto.getDevice_code());
|
||||||
|
// devrundto.setDevice_id(dto.getDevice_id());
|
||||||
|
// devrundto.setCreate_by("auto");
|
||||||
|
// devrundto.setCreate_time(DateUtil.now());
|
||||||
|
//
|
||||||
|
// DeviceRunpoint entity = ConvertUtil.convert(devrundto, DeviceRunpoint.class);
|
||||||
|
// deviceRunpointMapper.insert(entity);
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// deviceRunpoint.setContainer(null);
|
||||||
|
// deviceRunpoint.setTaskno("0");
|
||||||
|
// deviceRunpoint.setHasgoods("0");
|
||||||
|
// deviceRunpoint.setRemark(null);
|
||||||
|
// deviceRunpointMapper.updateById(deviceRunpoint);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// LambdaQueryWrapper<DeviceRunpoint> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
// wrapper.eq(DeviceRunpoint::getDevice_id, device_id);
|
||||||
|
// deviceRunpointMapper.delete(wrapper);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//有db
|
||||||
|
// JSONArray data1 = jsonObject.getJSONArray("data1");
|
||||||
|
// if (data1 != null) {
|
||||||
|
// //处理读的DB字段
|
||||||
|
// //设备扩展表【acs_device_extra】
|
||||||
|
// LambdaQueryWrapper<DeviceExtra> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
// wrapper.eq(DeviceExtra::getDevice_id, device_id);
|
||||||
|
// wrapper.eq(DeviceExtra::getFiled_type, "02");
|
||||||
|
// deviceExtraMapper.delete(wrapper);
|
||||||
|
// for (int i = 0; i < data1.size(); i++) {
|
||||||
|
// JSONObject param = new JSONObject();
|
||||||
|
// JSONObject json = data1.getJSONObject(i);
|
||||||
|
// param.put("extra_id", IdUtil.simpleUUID());
|
||||||
|
// //heartbeat
|
||||||
|
// param.put("extra_code", json.getString("code"));
|
||||||
|
// param.put("extra_name", json.getString("db"));
|
||||||
|
// param.put("remark", json.getString("name"));
|
||||||
|
// param.put("order_seq", i + 1);
|
||||||
|
// //DB读
|
||||||
|
// param.put("filed_type", "02");
|
||||||
|
// param.put("device_id", device_id);
|
||||||
|
// param.put("device_code", device_code);
|
||||||
|
// param.put("create_by", SecurityUtils.getCurrentUsername());
|
||||||
|
// param.put("create_time", DateUtil.now());
|
||||||
|
// DeviceExtra entity = ConvertUtil.convert(param, DeviceExtra.class);
|
||||||
|
// deviceExtraMapper.insert(entity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// //处理写
|
||||||
|
// JSONArray data2 = jsonObject.getJSONArray("data2");
|
||||||
|
// if (data2 != null) {
|
||||||
|
// LambdaQueryWrapper<DeviceExtra> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
// wrapper.eq(DeviceExtra::getDevice_id, device_id);
|
||||||
|
// wrapper.eq(DeviceExtra::getFiled_type, "03");
|
||||||
|
// deviceExtraMapper.delete(wrapper);
|
||||||
|
// for (int i = 0; i < data2.size(); i++) {
|
||||||
|
// JSONObject param = new JSONObject();
|
||||||
|
// JSONObject json = data2.getJSONObject(i);
|
||||||
|
// param.put("extra_id", IdUtil.simpleUUID());
|
||||||
|
// //heartbeat
|
||||||
|
// param.put("extra_code", json.getString("code"));
|
||||||
|
// param.put("extra_name", json.getString("db"));
|
||||||
|
// param.put("remark", json.getString("name"));
|
||||||
|
// param.put("order_seq", i + 1);
|
||||||
|
// //DB读
|
||||||
|
// param.put("filed_type", "03");
|
||||||
|
// param.put("device_id", device_id);
|
||||||
|
// param.put("device_code", device_code);
|
||||||
|
// param.put("create_by", SecurityUtils.getCurrentUsername());
|
||||||
|
// param.put("create_time", DateUtil.now());
|
||||||
|
// DeviceExtra entity = ConvertUtil.convert(param, DeviceExtra.class);
|
||||||
|
// deviceExtraMapper.insert(entity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (StrUtil.equals(device_type, "storage")) {
|
||||||
|
int x = form.getInteger("x");
|
||||||
|
int maxY = form.getInteger("maxY");
|
||||||
|
int minY = form.getInteger("minY");
|
||||||
|
int maxZ = form.getInteger("maxZ");
|
||||||
|
int minZ = form.getInteger("minZ");
|
||||||
|
for (int i = minY; i <= maxY; i++) {
|
||||||
|
for (int j = minZ; j <= maxZ; j++) {
|
||||||
|
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
|
||||||
|
.eq(StorageCell::getStorage_code, device_code + "-" + formatNum(i) + "-" + formatNum(j))
|
||||||
|
.one();
|
||||||
|
if (ObjectUtil.isEmpty(storageCell)) {
|
||||||
|
StorageCellDto celldto = new StorageCellDto();
|
||||||
|
celldto.setStorage_id(IdUtil.simpleUUID());
|
||||||
|
celldto.setStorage_code(device_code + "-" + formatNum(i) + "-" + formatNum(j));
|
||||||
|
celldto.setParent_storage_code(device_code + "-" + formatNum(i) + "-" + formatNum(j));
|
||||||
|
celldto.setX(formatNum(x));
|
||||||
|
celldto.setY(formatNum(i));
|
||||||
|
celldto.setZ(formatNum(j));
|
||||||
|
celldto.setCreate_by("init");
|
||||||
|
celldto.setCreate_time(SecurityUtils.getCurrentUsername());
|
||||||
|
StorageCell entity = ConvertUtil.convert(celldto, StorageCell.class);
|
||||||
|
storageCellMapper.insert(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//空盘堆叠驱动 需要按照数量生成
|
||||||
|
if (StrUtil.equals(driver_code, "standard_emptypallet_site") && form.containsKey("max_emptypalletnum")) {
|
||||||
|
int num = form.getInteger("max_emptypalletnum");
|
||||||
|
for (int i = 1; i < num + 1; i++) {
|
||||||
|
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
|
||||||
|
.eq(StorageCell::getStorage_code, device_code + "." + i)
|
||||||
|
.one();
|
||||||
|
if (ObjectUtil.isEmpty(storageCell)) {
|
||||||
|
StorageCellDto celldto = new StorageCellDto();
|
||||||
|
celldto.setStorage_id(IdUtil.simpleUUID());
|
||||||
|
celldto.setStorage_code(device_code + "." + i);
|
||||||
|
celldto.setParent_storage_code(device_code + "." + i);
|
||||||
|
celldto.setX("0");
|
||||||
|
celldto.setY("0");
|
||||||
|
celldto.setZ("0");
|
||||||
|
celldto.setAddress(Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")));
|
||||||
|
celldto.setCreate_by("init");
|
||||||
|
celldto.setCreate_time(SecurityUtils.getCurrentUsername());
|
||||||
|
StorageCell entity = ConvertUtil.convert(celldto, StorageCell.class);
|
||||||
|
storageCellMapper.insert(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//普通站点
|
||||||
|
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
|
||||||
|
.eq(StorageCell::getStorage_code, device_code)
|
||||||
|
.one();
|
||||||
|
if (ObjectUtil.isEmpty(storageCell)) {
|
||||||
|
StorageCellDto celldto = new StorageCellDto();
|
||||||
|
celldto.setStorage_id(IdUtil.simpleUUID());
|
||||||
|
celldto.setStorage_code(device_code);
|
||||||
|
celldto.setParent_storage_code(device_code);
|
||||||
|
celldto.setX("0");
|
||||||
|
celldto.setY("0");
|
||||||
|
celldto.setZ("0");
|
||||||
|
celldto.setAddress(org.apache.commons.lang3.StringUtils.isBlank(address)?Integer.parseInt(CodeUtil.getNewCode("NDCADDRESS_NO")):Integer.parseInt(address));
|
||||||
|
celldto.setCreate_by("init");
|
||||||
|
celldto.setCreate_time(SecurityUtils.getCurrentUsername());
|
||||||
|
StorageCell entity = ConvertUtil.convert(celldto, StorageCell.class);
|
||||||
|
storageCellMapper.insert(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateDevice(device_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Map<String, Object> getValue1(JSONArray wss, int j, Integer dbInterval, int i) {
|
public Map<String, Object> getValue1(JSONArray wss, int j, Integer dbInterval, int i) {
|
||||||
int size = wss.size();
|
int size = wss.size();
|
||||||
Map<String, Object> map = new ListOrderedMap<>();
|
Map<String, Object> map = new ListOrderedMap<>();
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
.eq(Task::getTask_status, task_status)
|
.eq(Task::getTask_status, task_status)
|
||||||
.eq(Task::getIs_delete, "0")
|
.eq(Task::getIs_delete, "0")
|
||||||
.orderByDesc(Task::getPriority)
|
.orderByDesc(Task::getPriority)
|
||||||
.orderByAsc(Task::getCreate_time)
|
.orderByAsc(Task::getTask_code)
|
||||||
.list();
|
.list();
|
||||||
return ConvertUtil.convertList(taskList, TaskDto.class);
|
return ConvertUtil.convertList(taskList, TaskDto.class);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class Structattr implements Serializable {
|
|||||||
private String stor_name;
|
private String stor_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库类型
|
* 仓库类型 =1 ,是专门放超托的托盘;
|
||||||
*/
|
*/
|
||||||
private String stor_type;
|
private String stor_type;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public class Structattr implements Serializable {
|
|||||||
private Integer capacity;
|
private Integer capacity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 宽度
|
* 宽度 width =1 专门放蝴蝶龙托盘,起点是H1开头的;
|
||||||
*/
|
*/
|
||||||
private Integer width;
|
private Integer width;
|
||||||
|
|
||||||
@@ -224,6 +224,8 @@ public class Structattr implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String ext_id;
|
private String ext_id;
|
||||||
|
|
||||||
|
private String placement_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联货位1
|
* 关联货位1
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import org.nl.common.exception.BadRequestException;
|
|||||||
import org.nl.common.utils.IdUtil;
|
import org.nl.common.utils.IdUtil;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||||
|
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
||||||
import org.nl.wms.ext_manage.service.WmsToErpService;
|
import org.nl.wms.ext_manage.service.WmsToErpService;
|
||||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||||
@@ -30,10 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,6 +56,10 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBasePointService iSchBasePointService;
|
private ISchBasePointService iSchBasePointService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IStructattrService iStructattrService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<MdMeMaterialbase> queryAll(Map whereJson, PageQuery page) {
|
public IPage<MdMeMaterialbase> queryAll(Map whereJson, PageQuery page) {
|
||||||
// 查询条件
|
// 查询条件
|
||||||
@@ -174,13 +177,146 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
|||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓位导入(Excel仅需一列仓位编码)
|
||||||
|
* 自动填充规则基于已有 INSERT 数据分析:
|
||||||
|
* - 库区:1BC / 1楼半成品
|
||||||
|
* - 仓库:firstfloorBC / 1楼半成品
|
||||||
|
* - 块:5
|
||||||
|
* - 排/列/层:从编码最后6位解析(前2排,中2列,后2层)
|
||||||
|
* - 其他字段采用固定值或 null
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
try (InputStream inputStream = file.getInputStream()) {
|
||||||
|
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||||
|
List<List<Object>> rows = excelReader.read();
|
||||||
|
if (rows.size() <= 1) {
|
||||||
|
throw new BadRequestException("Excel 数据为空");
|
||||||
|
}
|
||||||
|
List<Structattr> insertList = new ArrayList<>();
|
||||||
|
Set<String> existCodesInFile = new HashSet<>();
|
||||||
|
final String SECT_ID = "1985610807760785408";
|
||||||
|
final String SECT_CODE = "1BC";
|
||||||
|
final String SECT_NAME = "1楼半成品";
|
||||||
|
final String STOR_ID = "1985609997907791872";
|
||||||
|
final String STOR_CODE = "firstfloorBC";
|
||||||
|
final String STOR_NAME = "1楼半成品";
|
||||||
|
final String STOR_TYPE = "1";
|
||||||
|
final int BLOCK_NUM = 5;
|
||||||
|
final String PLACEMENT_TYPE = "01";
|
||||||
|
final String IS_TEMPSTRUCT = "0";
|
||||||
|
final String LOCK_TYPE = "0";
|
||||||
|
final int IS_USED = 0;
|
||||||
|
// ================================================
|
||||||
|
for (int i = 1; i < rows.size(); i++) {
|
||||||
|
List<Object> row = rows.get(i);
|
||||||
|
if (row == null || row.isEmpty()) continue;
|
||||||
|
Object codeObj = row.get(0);
|
||||||
|
if (codeObj == null) continue;
|
||||||
|
String structCode = String.valueOf(codeObj).trim();
|
||||||
|
if (structCode.isEmpty()) continue;
|
||||||
|
|
||||||
|
if (existCodesInFile.contains(structCode)) continue;
|
||||||
|
Structattr exist = iStructattrService.getOne(
|
||||||
|
new QueryWrapper<Structattr>().lambda()
|
||||||
|
.eq(Structattr::getStruct_code, structCode)
|
||||||
|
);
|
||||||
|
if (exist != null) continue;
|
||||||
|
existCodesInFile.add(structCode);
|
||||||
|
if (structCode.length() < 6) {
|
||||||
|
throw new BadRequestException("仓位编码长度不足6位,无法解析:" + structCode);
|
||||||
|
}
|
||||||
|
String suffix = structCode.substring(structCode.length() - 6);
|
||||||
|
if (!suffix.matches("\\d{6}")) {
|
||||||
|
throw new BadRequestException("仓位编码最后6位必须为数字:" + structCode);
|
||||||
|
}
|
||||||
|
int rowNum, colNum, layerNum;
|
||||||
|
try {
|
||||||
|
rowNum = Integer.parseInt(suffix.substring(0, 2));
|
||||||
|
colNum = Integer.parseInt(suffix.substring(2, 4));
|
||||||
|
layerNum = Integer.parseInt(suffix.substring(4, 6));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw new BadRequestException("解析排/列/层数字失败:" + structCode);
|
||||||
|
}
|
||||||
|
String structName = rowNum + "排" + colNum + "列" + layerNum + "层";
|
||||||
|
Structattr dao = new Structattr();
|
||||||
|
dao.setStruct_id(IdUtil.getStringId());
|
||||||
|
dao.setStruct_code(structCode);
|
||||||
|
dao.setStruct_name(structCode);
|
||||||
|
dao.setSimple_name(structName);
|
||||||
|
// 库区
|
||||||
|
dao.setSect_id(SECT_ID);
|
||||||
|
dao.setSect_code(SECT_CODE);
|
||||||
|
dao.setSect_name(SECT_NAME);
|
||||||
|
// 仓库
|
||||||
|
dao.setStor_id(STOR_ID);
|
||||||
|
dao.setStor_code(STOR_CODE);
|
||||||
|
dao.setStor_name(STOR_NAME);
|
||||||
|
dao.setStor_type(STOR_TYPE);
|
||||||
|
// 排、列、层、块
|
||||||
|
dao.setRow_num(rowNum);
|
||||||
|
dao.setCol_num(colNum);
|
||||||
|
dao.setLayer_num(layerNum);
|
||||||
|
dao.setBlock_num(BLOCK_NUM);
|
||||||
|
dao.setPlacement_type(PLACEMENT_TYPE);
|
||||||
|
dao.setIs_tempstruct(IS_TEMPSTRUCT);
|
||||||
|
dao.setLock_type(LOCK_TYPE);
|
||||||
|
dao.setIs_used(true);
|
||||||
|
dao.setCapacity(null);
|
||||||
|
dao.setWidth(null);
|
||||||
|
dao.setHeight(null);
|
||||||
|
dao.setZdepth(null);
|
||||||
|
dao.setWeight(null);
|
||||||
|
dao.setXqty(null);
|
||||||
|
dao.setYqty(null);
|
||||||
|
dao.setZqty(null);
|
||||||
|
dao.setIs_zdepth(null);
|
||||||
|
dao.setStoragevehicle_code(null);
|
||||||
|
dao.setStoragevehicle_type(null);
|
||||||
|
dao.setStoragevehicle_qty(null);
|
||||||
|
dao.setTask_code(null);
|
||||||
|
dao.setInv_type(null);
|
||||||
|
dao.setInv_id(null);
|
||||||
|
dao.setInv_code(null);
|
||||||
|
dao.setExt_id(null);
|
||||||
|
String remark = structCode.substring(2);
|
||||||
|
String prefixForRemark1 = remark.substring(0, remark.length() - 6);
|
||||||
|
int newCol = colNum + 1;
|
||||||
|
if (newCol > 99) {
|
||||||
|
throw new BadRequestException("列号+1后超出范围(>99):" + structCode);
|
||||||
|
}
|
||||||
|
String newSixDigits = String.format("%02d", rowNum) +
|
||||||
|
String.format("%02d", newCol) +
|
||||||
|
String.format("%02d", layerNum);
|
||||||
|
String remark1 = prefixForRemark1 + newSixDigits;
|
||||||
|
dao.setRemark(remark);
|
||||||
|
dao.setRemark1(remark1);
|
||||||
|
dao.setCreate_id("1");
|
||||||
|
dao.setCreate_name("Admin");
|
||||||
|
dao.setCreate_time(DateUtil.now());
|
||||||
|
dao.setUpdate_id(null);
|
||||||
|
dao.setUpdate_name(null);
|
||||||
|
dao.setUpdate_time(null);
|
||||||
|
insertList.add(dao);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!insertList.isEmpty()) {
|
||||||
|
iStructattrService.saveBatch(insertList);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new BadRequestException("导入失败:" + ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点位
|
* 点位
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
public void excelImport1(MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = file.getInputStream();
|
InputStream inputStream = file.getInputStream();
|
||||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -93,21 +94,51 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
|||||||
String layer_num = (String) whereJson.get("layer_num");
|
String layer_num = (String) whereJson.get("layer_num");
|
||||||
String is_used = (String) whereJson.get("is_used");
|
String is_used = (String) whereJson.get("is_used");
|
||||||
String is_have = (String) whereJson.get("is_have");
|
String is_have = (String) whereJson.get("is_have");
|
||||||
|
LambdaQueryWrapper<Structattr> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
return structattrMapper.selectPage(new Page<>(page.getPage() + 1 ,page.getSize()), new LambdaQueryWrapper<Structattr>()
|
if (StrUtil.isNotEmpty(search)) {
|
||||||
.like(StrUtil.isNotEmpty(search),Structattr::getStruct_code, search)
|
if (search.contains("CT")) {
|
||||||
.like(StrUtil.isNotEmpty(search),Structattr::getStruct_name, search)
|
String suffix = search.substring(search.length() - 6);
|
||||||
.eq(StrUtil.isNotEmpty(stor_id),Structattr::getStor_id, stor_id)
|
int rowNum = Integer.parseInt(suffix.substring(0, 2));
|
||||||
.eq(StrUtil.isNotEmpty(sect_id),Structattr::getSect_id, sect_id)
|
int colNum = Integer.parseInt(suffix.substring(2, 4));
|
||||||
.eq(StrUtil.isNotEmpty(sect_code),Structattr::getSect_code, sect_code)
|
int layerNum = Integer.parseInt(suffix.substring(4, 6));
|
||||||
.eq(StrUtil.isNotEmpty(lock_type),Structattr::getLock_type, lock_type)
|
String remark = search.substring(2);
|
||||||
.eq(StrUtil.isNotEmpty(layer_num),Structattr::getLayer_num, layer_num)
|
String prefixForRemark1 = remark.substring(0, remark.length() - 6);
|
||||||
.eq(StrUtil.isNotEmpty(is_used),Structattr::getIs_used, is_used)
|
int newCol = colNum + 1;
|
||||||
.isNull("1".equals(is_have),Structattr::getStoragevehicle_code)
|
if (newCol > 99) {
|
||||||
.isNotNull("2".equals(is_have),Structattr::getStoragevehicle_code)
|
throw new BadRequestException("列号+1后超出范围(>99):" + search);
|
||||||
.orderByAsc(Structattr::getStruct_code)
|
}
|
||||||
);
|
String newSixDigits = String.format("%02d", rowNum) +
|
||||||
|
String.format("%02d", newCol) +
|
||||||
|
String.format("%02d", layerNum);
|
||||||
|
String remark1 = prefixForRemark1 + newSixDigits;
|
||||||
|
queryWrapper.and(wrapper ->
|
||||||
|
wrapper.like(Structattr::getStruct_code, remark)
|
||||||
|
.or()
|
||||||
|
.like(Structattr::getStruct_code, remark1).or()
|
||||||
|
.like(Structattr::getStruct_name, search)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
queryWrapper.and(wrapper ->
|
||||||
|
wrapper.like(Structattr::getStruct_code, search)
|
||||||
|
.or()
|
||||||
|
.like(Structattr::getStruct_code, search).or()
|
||||||
|
.like(Structattr::getStruct_name, search)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
queryWrapper.eq(StrUtil.isNotEmpty(stor_id), Structattr::getStor_id, stor_id)
|
||||||
|
.eq(StrUtil.isNotEmpty(sect_id), Structattr::getSect_id, sect_id)
|
||||||
|
.eq(StrUtil.isNotEmpty(sect_code), Structattr::getSect_code, sect_code)
|
||||||
|
.eq(StrUtil.isNotEmpty(lock_type), Structattr::getLock_type, lock_type)
|
||||||
|
.eq(StrUtil.isNotEmpty(layer_num), Structattr::getLayer_num, layer_num)
|
||||||
|
.eq(StrUtil.isNotEmpty(is_used), Structattr::getIs_used, is_used)
|
||||||
|
.isNull("1".equals(is_have), Structattr::getStoragevehicle_code)
|
||||||
|
.isNotNull("2".equals(is_have), Structattr::getStoragevehicle_code)
|
||||||
|
.orderByAsc(Structattr::getStruct_code);
|
||||||
|
|
||||||
|
|
||||||
|
return structattrMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -171,7 +202,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
|||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
}
|
}
|
||||||
|
LambdaUpdateWrapper<Structattr> lambdaUpdateWrapper = new LambdaUpdateWrapper<Structattr>();
|
||||||
String struct_code = dto.getStruct_code();
|
String struct_code = dto.getStruct_code();
|
||||||
Structattr structattr = this.findByCode(struct_code);
|
Structattr structattr = this.findByCode(struct_code);
|
||||||
if (structattr != null && !dto.getStruct_id().equals(structattr.getStruct_id())) {
|
if (structattr != null && !dto.getStruct_id().equals(structattr.getStruct_id())) {
|
||||||
@@ -185,6 +216,13 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
|||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setUpdate_id(currentUserId);
|
dto.setUpdate_id(currentUserId);
|
||||||
dto.setUpdate_name(nickName);
|
dto.setUpdate_name(nickName);
|
||||||
|
if (ObjectUtil.isEmpty(dto.getWidth())) {
|
||||||
|
lambdaUpdateWrapper.set(Structattr::getWidth, null);
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(dto.getStoragevehicle_code())) {
|
||||||
|
lambdaUpdateWrapper.set(Structattr::getStoragevehicle_code, null);
|
||||||
|
}
|
||||||
|
lambdaUpdateWrapper.eq(Structattr::getStruct_id, dto.getStruct_id());
|
||||||
// Sectattr sectattr = iSectattrService.findById(dto.getSect_id());
|
// Sectattr sectattr = iSectattrService.findById(dto.getSect_id());
|
||||||
// BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
|
// BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
|
||||||
// dto.setSect_code(sectattr.getSect_code());
|
// dto.setSect_code(sectattr.getSect_code());
|
||||||
@@ -192,7 +230,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
|||||||
// dto.setStor_id(bsrealStorattr.getStor_id());
|
// dto.setStor_id(bsrealStorattr.getStor_id());
|
||||||
// dto.setStor_code(bsrealStorattr.getStor_code());
|
// dto.setStor_code(bsrealStorattr.getStor_code());
|
||||||
// dto.setStor_name(bsrealStorattr.getStor_name());
|
// dto.setStor_name(bsrealStorattr.getStor_name());
|
||||||
structattrMapper.updateById(dto);
|
structattrMapper.update(dto, lambdaUpdateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -230,43 +268,37 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateStatusByCode(String operate, JSONObject jsonObject) {
|
public void updateStatusByCode(String operate, JSONObject jsonObject) {
|
||||||
//operate:0生成、1单据确认、2取消分配
|
String structCode = jsonObject.getString("struct_code");
|
||||||
switch (operate){
|
boolean isMultiple = structCode != null && structCode.contains(",");
|
||||||
|
LambdaUpdateWrapper<Structattr> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper.set(Structattr::getInv_id, jsonObject.getString("inv_id"))
|
||||||
|
.set(Structattr::getInv_code, jsonObject.getString("inv_code"))
|
||||||
|
.set(Structattr::getInv_type, jsonObject.getString("inv_type"));
|
||||||
|
|
||||||
|
if (isMultiple) {
|
||||||
|
List<String> structCodes = Arrays.asList(structCode.split(","));
|
||||||
|
wrapper.in(Structattr::getStruct_code, structCodes);
|
||||||
|
} else {
|
||||||
|
wrapper.eq(Structattr::getStruct_code, structCode);
|
||||||
|
}
|
||||||
|
switch (operate) {
|
||||||
case "0":
|
case "0":
|
||||||
//锁定仓位
|
wrapper.set(Structattr::getLock_type, jsonObject.getString("lock_type"));
|
||||||
this.update(new LambdaUpdateWrapper<>(Structattr.class)
|
this.update(wrapper);
|
||||||
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
|
|
||||||
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
|
|
||||||
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
|
|
||||||
.set(Structattr::getLock_type, jsonObject.getString("lock_type"))
|
|
||||||
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
//完成任务,解锁仓位绑定载具号
|
wrapper.set(Structattr::getStoragevehicle_code, jsonObject.getString("storagevehicle_code"))
|
||||||
this.update(new LambdaUpdateWrapper<>(Structattr.class)
|
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||||
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
|
this.update(wrapper);
|
||||||
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
|
|
||||||
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
|
|
||||||
.set(Structattr::getStoragevehicle_code,jsonObject.getString("storagevehicle_code"))
|
|
||||||
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
||||||
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "2":
|
case "2":
|
||||||
//解锁仓位
|
wrapper.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||||
this.update(new LambdaUpdateWrapper<>(Structattr.class)
|
this.update(wrapper);
|
||||||
.set(Structattr::getInv_id,jsonObject.getString("inv_id"))
|
|
||||||
.set(Structattr::getInv_code,jsonObject.getString("inv_code"))
|
|
||||||
.set(Structattr::getInv_type,jsonObject.getString("inv_type"))
|
|
||||||
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
||||||
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLock(List<JSONObject> updateAttrList) {
|
public void updateLock(List<JSONObject> updateAttrList) {
|
||||||
List<Structattr> attrList = this.list(
|
List<Structattr> attrList = this.list(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.nl.wms.ext_manage.controller;
|
|||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaIgnore;
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.checkerframework.checker.units.qual.K;
|
||||||
import org.nl.common.logging.annotation.Log;
|
import org.nl.common.logging.annotation.Log;
|
||||||
import org.nl.wms.ext_manage.service.AcsToWmsService;
|
import org.nl.wms.ext_manage.service.AcsToWmsService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -34,4 +35,6 @@ public class AcsToWmsController {
|
|||||||
return new ResponseEntity<>(acsToWmsService.receiveTaskStatusAcs(string), HttpStatus.OK);
|
return new ResponseEntity<>(acsToWmsService.receiveTaskStatusAcs(string), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,12 @@ public interface AcsToWmsService {
|
|||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
*/
|
*/
|
||||||
Map<String, Object> receiveTaskStatusAcs(String string);
|
Map<String, Object> receiveTaskStatusAcs(String string);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package org.nl.wms.ext_manage.service.impl;
|
|||||||
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.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.wms.ext_manage.enums.ResultAcsStatus;
|
import org.nl.wms.ext_manage.enums.ResultAcsStatus;
|
||||||
import org.nl.wms.ext_manage.service.AcsToWmsService;
|
import org.nl.wms.ext_manage.service.AcsToWmsService;
|
||||||
import org.nl.wms.sch_manage.enums.PointStatusEnum;
|
import org.nl.wms.sch_manage.enums.PointStatusEnum;
|
||||||
|
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||||
@@ -27,6 +29,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -70,6 +75,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SchBasePointMapper schBasePointMapper;
|
private SchBasePointMapper schBasePointMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@@ -80,6 +88,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
String finish_code=null;
|
String finish_code=null;
|
||||||
//返回处理失败的任务
|
//返回处理失败的任务
|
||||||
JSONArray errArr = new JSONArray();
|
JSONArray errArr = new JSONArray();
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("status", HttpStatus.OK.value());
|
||||||
|
result.put("message", "任务状态反馈成功!");
|
||||||
for (int i = 0; i < array.size(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
JSONObject row = array.getJSONObject(i);
|
JSONObject row = array.getJSONObject(i);
|
||||||
String task_id = row.getString("task_id");
|
String task_id = row.getString("task_id");
|
||||||
@@ -88,6 +99,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
try {
|
try {
|
||||||
if (tryLock) {
|
if (tryLock) {
|
||||||
SchBaseTask taskObj = iSchBaseTaskService.getById(task_id);
|
SchBaseTask taskObj = iSchBaseTaskService.getById(task_id);
|
||||||
|
if (taskObj == null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode()) || taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
// acs反馈的任务类型
|
// acs反馈的任务类型
|
||||||
String acs_task_status = row.getString("task_status");
|
String acs_task_status = row.getString("task_status");
|
||||||
TaskStatus status;
|
TaskStatus status;
|
||||||
@@ -147,9 +164,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("status", HttpStatus.OK.value());
|
|
||||||
result.put("message", "任务状态反馈成功!");
|
|
||||||
result.put("data", data);
|
result.put("data", data);
|
||||||
result.put("finish_code",finish_code);
|
result.put("finish_code",finish_code);
|
||||||
result.put("errArr", errArr);
|
result.put("errArr", errArr);
|
||||||
|
|||||||
@@ -633,7 +633,6 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|||||||
.sect_code(param.getString("sect_code"))
|
.sect_code(param.getString("sect_code"))
|
||||||
.stor_code(param.getString("stor_code"))
|
.stor_code(param.getString("stor_code"))
|
||||||
.storagevehicle_code(param.getString("storagevehicle_code"))
|
.storagevehicle_code(param.getString("storagevehicle_code"))
|
||||||
.storagevehicle_type(param.getString("storagevehicle_type"))
|
|
||||||
.suitable_car(suitable_car)
|
.suitable_car(suitable_car)
|
||||||
.strategyMaters(maters)
|
.strategyMaters(maters)
|
||||||
.storagevehicle_type(storagevehicle_stype)
|
.storagevehicle_type(storagevehicle_stype)
|
||||||
@@ -668,7 +667,12 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|||||||
//锁定货位
|
//锁定货位
|
||||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinvId);
|
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinvId);
|
||||||
JSONObject lock_map = new JSONObject();
|
JSONObject lock_map = new JSONObject();
|
||||||
lock_map.put("struct_code", struct_code);
|
String lockStructCode =struct_code;
|
||||||
|
//超托需要更新多个库位
|
||||||
|
if (struct_code.contains("CT")) {
|
||||||
|
lockStructCode = String.join(",",struct_code,struct.getRemark(), struct.getRemark1());
|
||||||
|
}
|
||||||
|
lock_map.put("struct_code", lockStructCode);
|
||||||
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
|
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
|
||||||
lock_map.put("inv_code", ioStorInv.getBill_code());
|
lock_map.put("inv_code", ioStorInv.getBill_code());
|
||||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||||
@@ -973,7 +977,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|||||||
//获取单据编号
|
//获取单据编号
|
||||||
String bill_code = ioStorInv.getBill_code();
|
String bill_code = ioStorInv.getBill_code();
|
||||||
String source_name = ioStorInv.getSource_name();
|
String source_name = ioStorInv.getSource_name();
|
||||||
if (!ResultAcsStatus.EXECUTING.getCode().equals(task.getTask_status())) {
|
//acs完成任务状态为5,PC端完成为0
|
||||||
|
if ("5".equals(task.getTask_status()) || "0".equals(task.getTask_status())) {
|
||||||
//解锁库位
|
//解锁库位
|
||||||
JSONObject finish_map = new JSONObject();
|
JSONObject finish_map = new JSONObject();
|
||||||
finish_map.put("struct_code", structCode);
|
finish_map.put("struct_code", structCode);
|
||||||
@@ -1025,7 +1030,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|||||||
}
|
}
|
||||||
//回传给wms
|
//回传给wms
|
||||||
TOWMSMSG towmsmsg = new TOWMSMSG();
|
TOWMSMSG towmsmsg = new TOWMSMSG();
|
||||||
towmsmsg.setType("0");
|
towmsmsg.setType(task.getConfig_code().contains("In") ? "0" : "1");
|
||||||
towmsmsg.setBill_code(source_name);
|
towmsmsg.setBill_code(source_name);
|
||||||
towmsmsg.setStatus(ResultAcsStatus.EXECUTING.getCode().equals(task.getTask_status()) ? "1" : "200");
|
towmsmsg.setStatus(ResultAcsStatus.EXECUTING.getCode().equals(task.getTask_status()) ? "1" : "200");
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ import org.nl.wms.warehouse_manage.service.dao.mapper.MdPbGroupplateMapper;
|
|||||||
import org.nl.wms.wbwms.service.IWmsToWmsService;
|
import org.nl.wms.wbwms.service.IWmsToWmsService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -1363,30 +1362,40 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
|||||||
}
|
}
|
||||||
// 完成当前任务对应的所有分配明细
|
// 完成当前任务对应的所有分配明细
|
||||||
for (IOStorInvDis ioStorInvDis : disList) {
|
for (IOStorInvDis ioStorInvDis : disList) {
|
||||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
ioStorInvDisMapper.update(ioStorInvDis, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id()));
|
.eq(IOStorInvDis::getIostorinvdis_id, ioStorInvDis.getIostorinvdis_id()));
|
||||||
}
|
}
|
||||||
IOStorInvDis item = disList.get(0);
|
IOStorInvDis item = disList.get(0);
|
||||||
//获取出入库单标识
|
//获取出入库单标识
|
||||||
String iostorinv_id=item.getIostorinv_id();
|
String iostorinv_id = item.getIostorinv_id();
|
||||||
IOStorInv ioStorInv=ioStorInvMapper.selectOne(new LambdaQueryWrapper<IOStorInv>().eq(IOStorInv::getIostorinv_id,iostorinv_id));
|
IOStorInv ioStorInv = ioStorInvMapper.selectOne(new LambdaQueryWrapper<IOStorInv>().eq(IOStorInv::getIostorinv_id, iostorinv_id));
|
||||||
//获取单据编号
|
//获取单据编号
|
||||||
String bill_code=ioStorInv.getBill_code();
|
String bill_code = ioStorInv.getBill_code();
|
||||||
//
|
//
|
||||||
String source_name=ioStorInv.getSource_name();
|
String source_name = ioStorInv.getSource_name();
|
||||||
|
|
||||||
//解锁库位
|
//解锁库位
|
||||||
JSONObject finish_map = new JSONObject();
|
JSONObject finish_map = new JSONObject();
|
||||||
finish_map.put("struct_code", item.getStruct_code());
|
String lockStructCode = item.getStruct_code();
|
||||||
finish_map.put("storagevehicle_code",null);
|
//超托需要更新多个库位
|
||||||
|
if (item.getStruct_code().contains("CT")) {
|
||||||
|
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>().eq(Structattr::getStruct_code, item.getStruct_code()));
|
||||||
|
if (structattr == null) {
|
||||||
|
throw new BadRequestException("未找到库位信息");
|
||||||
|
}
|
||||||
|
lockStructCode = String.join(",",item.getStruct_code(),structattr.getRemark(), structattr.getRemark1());
|
||||||
|
}
|
||||||
|
finish_map.put("struct_code", lockStructCode);
|
||||||
|
finish_map.put("storagevehicle_code", null);
|
||||||
finish_map.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
finish_map.put("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||||
finish_map.put("inv_type", null);
|
finish_map.put("inv_type", null);
|
||||||
finish_map.put("inv_id", null);
|
finish_map.put("inv_id", null);
|
||||||
finish_map.put("inv_code", null);
|
finish_map.put("inv_code", null);
|
||||||
iStructattrService.updateStatusByCode("1",finish_map);
|
iStructattrService.updateStatusByCode("1", finish_map);
|
||||||
//终点修改点位状态
|
//终点修改点位状态
|
||||||
SchBasePoint point_code2=new SchBasePoint();
|
SchBasePoint point_code2 = new SchBasePoint();
|
||||||
point_code2=iSchBasePointService.getByCode(task.getPoint_code2());
|
point_code2 = iSchBasePointService.getByCode(task.getPoint_code2());
|
||||||
point_code2.setVehicle_code(task.getVehicle_code());
|
point_code2.setVehicle_code(task.getVehicle_code());
|
||||||
point_code2.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
point_code2.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||||
point_code2.setLock_up(false);
|
point_code2.setLock_up(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user