add:增加7月份的一些新增需求实现;
This commit is contained in:
@@ -33,6 +33,7 @@ public class SameBlockNumRuleHandler extends Decisioner<Structattr, JSONObject>
|
||||
* @return List<Structattr> :仓位集合
|
||||
*/
|
||||
@Override
|
||||
|
||||
public List<Structattr> handler(List<Structattr> list, JSONObject param) {
|
||||
// 判断仓位是否为空
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
|
||||
@@ -21,4 +21,9 @@ public class EXTConstant {
|
||||
* ACS下发任务接口地址
|
||||
*/
|
||||
public final static String SEND_TASK_ACS_API = "api/wms/task";
|
||||
|
||||
/**
|
||||
* ACS查询超时异常任务接口地址
|
||||
*/
|
||||
public final static String QUERY_TIMEOUT_TASK_ACS_API = "api/task/queryTimeoutTask";
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
public Map<String, Object> receiveTaskStatusAcs(String string) {
|
||||
log.info("acs向lms反馈任务状态,请求参数:--------------------------------------" + string);
|
||||
@@ -116,7 +116,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else if (ResultAcsStatus.FINISHED.getCode().equals(acs_task_status)) {
|
||||
// 完成
|
||||
status = TaskStatus.FINISHED;
|
||||
iSchBaseTaskService.updateById(taskObj);
|
||||
// iSchBaseTaskService.updateById(taskObj);
|
||||
} else if(ResultAcsStatus.MOVEFINISH.getCode().equals(acs_task_status)){
|
||||
if(!taskObj.getPoint_code2().equals("CKFPW")){
|
||||
log.info("任务号{}已经申请二次分配",taskObj.getTask_code());
|
||||
@@ -143,7 +143,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
schBasePoint.setLock_up(true);
|
||||
iSchBasePointService.update(schBasePoint);
|
||||
taskObj.setPoint_code2(finish_code);
|
||||
taskObj.setTask_status(TaskStatus.APPLY.getCode());
|
||||
taskObj.setTask_status(TaskStatus.APPLY.getCode());
|
||||
iSchBaseTaskService.update(taskObj);
|
||||
}
|
||||
status = TaskStatus.APPLY;
|
||||
@@ -156,7 +156,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 根据配置编码执行相关配置内的方法
|
||||
AbstractTask task = taskFactory.getTask(taskObj.getConfig_code());
|
||||
task.updateTaskStatus(taskObj.getTask_code(),status);
|
||||
|
||||
} else {
|
||||
throw new BadRequestException("任务标识为:" + task_id + "的任务正在操作中!");
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class StInTask extends AbstractTask {
|
||||
public void backMes(String task_code) {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -143,7 +143,7 @@ public class StOutTask extends AbstractTask {
|
||||
public void backMes(String task_code) {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.wms.system_manage.controller.monitor;
|
||||
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.wms.system_manage.service.monitor.MonitorService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2020-05-02
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/api/monitor")
|
||||
public class MonitorController {
|
||||
|
||||
private final MonitorService serverService;
|
||||
|
||||
@GetMapping
|
||||
//("查询服务监控")
|
||||
// //SaCheckPermission("monitor:list")
|
||||
public ResponseEntity<Object> query() {
|
||||
return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.wms.system_manage.service.monitor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2020-05-02
|
||||
*/
|
||||
public interface MonitorService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> getServers();
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.nl.wms.system_manage.service.monitor.impl;
|
||||
|
||||
import cn.hutool.core.date.BetweenFormatter;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.nl.common.utils.FileUtil;
|
||||
import org.nl.common.utils.IPUtil;
|
||||
import org.nl.wms.system_manage.service.monitor.MonitorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.CentralProcessor;
|
||||
import oshi.hardware.GlobalMemory;
|
||||
import oshi.hardware.HardwareAbstractionLayer;
|
||||
import oshi.hardware.VirtualMemory;
|
||||
import oshi.software.os.FileSystem;
|
||||
import oshi.software.os.OSFileStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.FormatUtil;
|
||||
import oshi.util.Util;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2020-05-02
|
||||
*/
|
||||
@Service
|
||||
public class MonitorServiceImpl implements MonitorService {
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("0.00");
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getServers(){
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>(8);
|
||||
try {
|
||||
SystemInfo si = new SystemInfo();
|
||||
OperatingSystem os = si.getOperatingSystem();
|
||||
HardwareAbstractionLayer hal = si.getHardware();
|
||||
// 系统信息
|
||||
resultMap.put("sys", getSystemInfo(os));
|
||||
// cpu 信息
|
||||
resultMap.put("cpu", getCpuInfo(hal.getProcessor()));
|
||||
// 内存信息
|
||||
resultMap.put("memory", getMemoryInfo(hal.getMemory()));
|
||||
// 交换区信息
|
||||
resultMap.put("swap", getSwapInfo(hal.getMemory()));
|
||||
// 磁盘
|
||||
resultMap.put("disk", getDiskInfo(os));
|
||||
resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取磁盘信息
|
||||
* @return /
|
||||
*/
|
||||
private Map<String,Object> getDiskInfo(OperatingSystem os) {
|
||||
Map<String,Object> diskInfo = new LinkedHashMap<>();
|
||||
FileSystem fileSystem = os.getFileSystem();
|
||||
List<OSFileStore> fsArray = fileSystem.getFileStores();
|
||||
String osName = System.getProperty("os.name");
|
||||
long available = 0, total = 0;
|
||||
for (OSFileStore fs : fsArray){
|
||||
// windows 需要将所有磁盘分区累加,linux 和 mac 直接累加会出现磁盘重复的问题,待修复
|
||||
if(osName.toLowerCase().startsWith("win")) {
|
||||
available += fs.getUsableSpace();
|
||||
total += fs.getTotalSpace();
|
||||
} else {
|
||||
available = fs.getUsableSpace();
|
||||
total = fs.getTotalSpace();
|
||||
break;
|
||||
}
|
||||
}
|
||||
long used = total - available;
|
||||
diskInfo.put("total", total > 0 ? FileUtil.getSize(total) : "?");
|
||||
diskInfo.put("available", FileUtil.getSize(available));
|
||||
diskInfo.put("used", FileUtil.getSize(used));
|
||||
diskInfo.put("usageRate", df.format(used/(double)total * 100));
|
||||
return diskInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取交换区信息
|
||||
* @param memory /
|
||||
* @return /
|
||||
*/
|
||||
private Map<String,Object> getSwapInfo(GlobalMemory memory) {
|
||||
Map<String,Object> swapInfo = new LinkedHashMap<>();
|
||||
VirtualMemory virtualMemory = memory.getVirtualMemory();
|
||||
long total = virtualMemory.getSwapTotal();
|
||||
long used = virtualMemory.getSwapUsed();
|
||||
swapInfo.put("total", FormatUtil.formatBytes(total));
|
||||
swapInfo.put("used", FormatUtil.formatBytes(used));
|
||||
swapInfo.put("available", FormatUtil.formatBytes(total - used));
|
||||
if(used == 0){
|
||||
swapInfo.put("usageRate", 0);
|
||||
} else {
|
||||
swapInfo.put("usageRate", df.format(used/(double)total * 100));
|
||||
}
|
||||
return swapInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取内存信息
|
||||
* @param memory /
|
||||
* @return /
|
||||
*/
|
||||
private Map<String,Object> getMemoryInfo(GlobalMemory memory) {
|
||||
Map<String,Object> memoryInfo = new LinkedHashMap<>();
|
||||
memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal()));
|
||||
memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable()));
|
||||
memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable()));
|
||||
memoryInfo.put("usageRate", df.format((memory.getTotal() - memory.getAvailable())/(double)memory.getTotal() * 100));
|
||||
return memoryInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Cpu相关信息
|
||||
* @param processor /
|
||||
* @return /
|
||||
*/
|
||||
private Map<String,Object> getCpuInfo(CentralProcessor processor) {
|
||||
Map<String,Object> cpuInfo = new LinkedHashMap<>();
|
||||
cpuInfo.put("name", processor.getProcessorIdentifier().getName());
|
||||
cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU");
|
||||
cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心");
|
||||
cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount());
|
||||
cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU");
|
||||
// CPU信息
|
||||
long[] prevTicks = processor.getSystemCpuLoadTicks();
|
||||
// 等待1秒...
|
||||
Util.sleep(1000);
|
||||
long[] ticks = processor.getSystemCpuLoadTicks();
|
||||
long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];
|
||||
long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
|
||||
long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
|
||||
long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
|
||||
long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
|
||||
long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
|
||||
long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
|
||||
long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
|
||||
long totalCpu = user + nice + sys + idle + iowait + irq + softirq + steal;
|
||||
cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu));
|
||||
cpuInfo.put("idle", df.format(100d * idle / totalCpu));
|
||||
return cpuInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统相关信息,系统、运行天数、系统IP
|
||||
* @param os /
|
||||
* @return /
|
||||
*/
|
||||
private Map<String,Object> getSystemInfo(OperatingSystem os){
|
||||
Map<String,Object> systemInfo = new LinkedHashMap<>();
|
||||
// jvm 运行时间
|
||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
Date date = new Date(time);
|
||||
// 计算项目运行时间 5.4.3:BetweenFormater, 5.7.14改名为BetweenFormatter
|
||||
String formatBetween = DateUtil.formatBetween(date, new Date(), BetweenFormatter.Level.HOUR);
|
||||
// 系统信息
|
||||
systemInfo.put("os", os.toString());
|
||||
systemInfo.put("day", formatBetween);
|
||||
systemInfo.put("ip", IPUtil.getLocalIp());
|
||||
return systemInfo;
|
||||
}
|
||||
}
|
||||
@@ -966,7 +966,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
//@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
List<GroupPlate> groupPlateList = mdPbGroupplateMapper.selectList(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code()).orderByDesc(GroupPlate::getCreate_name));
|
||||
@@ -993,6 +993,24 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
//获取出入库单标识
|
||||
String iostorinv_id = item1.getIostorinv_id();
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectOne(new LambdaQueryWrapper<IOStorInv>().eq(IOStorInv::getIostorinv_id, iostorinv_id));
|
||||
//回传给wms
|
||||
String source_name = ioStorInv.getSource_name();
|
||||
TOWMSMSG towmsmsg = new TOWMSMSG();
|
||||
towmsmsg.setType(task.getConfig_code().contains("In") ? "0" : "1");
|
||||
towmsmsg.setBill_code(source_name);
|
||||
towmsmsg.setStatus(ResultAcsStatus.EXECUTING.getCode().equals(task.getTask_status()) ? "1" : "200");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("storagevehicle_code", task.getVehicle_code());
|
||||
jo.put("struct_name", task.getPoint_code2());
|
||||
jo.put("struct_code", task.getPoint_code2());
|
||||
jo.put("material_name", MdMeMaterialbaseList.get(0).getMaterial_name());
|
||||
jo.put("material_code", MdMeMaterialbaseList.get(0).getMaterial_code());
|
||||
jo.put("qty", groupPlateList.get(0).getQty());
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
tableData.add(jo);
|
||||
towmsmsg.setTableData(tableData);
|
||||
//iWmsToWmsService.FinishOutTask(towmsmsg);
|
||||
notifyWmsAsync(towmsmsg);
|
||||
//acs完成任务状态为5,PC端完成为0
|
||||
if (!"1".equals(task.getTask_status())) {
|
||||
//转库解锁原库位
|
||||
@@ -1056,24 +1074,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
);
|
||||
}
|
||||
}
|
||||
//回传给wms
|
||||
String source_name = ioStorInv.getSource_name();
|
||||
TOWMSMSG towmsmsg = new TOWMSMSG();
|
||||
towmsmsg.setType(task.getConfig_code().contains("In") ? "0" : "1");
|
||||
towmsmsg.setBill_code(source_name);
|
||||
towmsmsg.setStatus(ResultAcsStatus.EXECUTING.getCode().equals(task.getTask_status()) ? "1" : "200");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("storagevehicle_code", task.getVehicle_code());
|
||||
jo.put("struct_name", task.getPoint_code2());
|
||||
jo.put("struct_code", task.getPoint_code2());
|
||||
jo.put("material_name", MdMeMaterialbaseList.get(0).getMaterial_name());
|
||||
jo.put("material_code", MdMeMaterialbaseList.get(0).getMaterial_code());
|
||||
jo.put("qty", groupPlateList.get(0).getQty());
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
tableData.add(jo);
|
||||
towmsmsg.setTableData(tableData);
|
||||
//iWmsToWmsService.FinishOutTask(towmsmsg);
|
||||
notifyWmsAsync(towmsmsg);
|
||||
throw new BadRequestException("未找到库位信息");
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -1177,9 +1178,9 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
return one;
|
||||
}
|
||||
/**
|
||||
* 异步回传WMS
|
||||
* 异步回传WMSp
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
//@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
public void notifyWmsAsync(TOWMSMSG task) {
|
||||
// 调用WMS接口
|
||||
iWmsToWmsService.FinishOutTask(task);
|
||||
|
||||
@@ -1416,7 +1416,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
* 4.更新所有出库单明细及主表
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
List<GroupPlate> groupPlateList = mdPbGroupplateMapper.selectList(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code()).orderByDesc(GroupPlate::getCreate_name));
|
||||
@@ -1427,6 +1427,27 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
if (ObjectUtils.isEmpty(MdMeMaterialbaseList)) {
|
||||
throw new BadRequestException("未找到该托盘的物料信息,检查一下该托盘是否已出库或在操作日志中查询该物料是否被删除!");
|
||||
}
|
||||
//终点修改点位状态
|
||||
SchBasePoint point_code2 = new SchBasePoint();
|
||||
point_code2 = iSchBasePointService.getByCode(task.getPoint_code2());
|
||||
point_code2.setVehicle_code(task.getVehicle_code());
|
||||
point_code2.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
point_code2.setLock_up(false);
|
||||
iSchBasePointService.update(point_code2);
|
||||
log.info("任务号:{}完成,解锁库位:{}", task.getTask_code(), point_code2);
|
||||
//日志记录
|
||||
SysLog logDto = new SysLog();
|
||||
logDto.setRequest_ip("localhost");
|
||||
logDto.setAddress("localhost");
|
||||
logDto.setMethod("taskFinish");
|
||||
logDto.setUsername("");
|
||||
logDto.setDescription("操作成功!");
|
||||
logDto.setBrowser("browser");
|
||||
logDto.setLog_id(cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
logDto.setCreate_time(DateUtil.now());
|
||||
logDto.setLog_type("INFO");
|
||||
logDto.setParams("任务完成:" + task.getTask_code() + ",解锁库位成功:-------------------" + point_code2);
|
||||
logMapper.insert(logDto);
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
@@ -1449,27 +1470,23 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
//获取单据编号
|
||||
String bill_code = ioStorInv.getBill_code();
|
||||
String source_name = ioStorInv.getSource_name();
|
||||
//终点修改点位状态
|
||||
SchBasePoint point_code2 = new SchBasePoint();
|
||||
point_code2 = iSchBasePointService.getByCode(task.getPoint_code2());
|
||||
point_code2.setVehicle_code(task.getVehicle_code());
|
||||
point_code2.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
point_code2.setLock_up(false);
|
||||
iSchBasePointService.update(point_code2);
|
||||
log.info("任务号:{}完成,解锁库位:{}", task.getTask_code(), point_code2);
|
||||
//日志记录
|
||||
SysLog logDto = new SysLog();
|
||||
logDto.setRequest_ip("localhost");
|
||||
logDto.setAddress("localhost");
|
||||
logDto.setMethod("taskFinish");
|
||||
logDto.setUsername("");
|
||||
logDto.setDescription("操作成功!");
|
||||
logDto.setBrowser("browser");
|
||||
logDto.setLog_id(cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
logDto.setCreate_time(DateUtil.now());
|
||||
logDto.setLog_type("INFO");
|
||||
logDto.setParams("任务完成:" + task.getTask_code() + ",解锁库位成功:-------------------" + point_code2);
|
||||
logMapper.insert(logDto);
|
||||
//回传给wms
|
||||
TOWMSMSG towmsmsg = new TOWMSMSG();
|
||||
towmsmsg.setType("1");
|
||||
towmsmsg.setBill_code(source_name);
|
||||
towmsmsg.setStatus("200");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("storagevehicle_code", task.getVehicle_code());
|
||||
jo.put("struct_name", task.getPoint_code2());
|
||||
jo.put("struct_code", task.getPoint_code2());
|
||||
jo.put("material_name", MdMeMaterialbaseList.get(0).getMaterial_name());
|
||||
jo.put("material_code", MdMeMaterialbaseList.get(0).getMaterial_code());
|
||||
jo.put("qty", groupPlateList.get(0).getQty());
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
tableData.add(jo);
|
||||
towmsmsg.setTableData(tableData);
|
||||
// iWmsToWmsService.FinishOutTask(towmsmsg);
|
||||
notifyWmsAsync(towmsmsg);
|
||||
//解锁库位
|
||||
String cTStructCode = item.getStruct_code();
|
||||
//超托需要更新多个库位
|
||||
@@ -1518,23 +1535,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
);
|
||||
}
|
||||
}
|
||||
//回传给wms
|
||||
TOWMSMSG towmsmsg = new TOWMSMSG();
|
||||
towmsmsg.setType("1");
|
||||
towmsmsg.setBill_code(source_name);
|
||||
towmsmsg.setStatus("200");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("storagevehicle_code", task.getVehicle_code());
|
||||
jo.put("struct_name", task.getPoint_code2());
|
||||
jo.put("struct_code", task.getPoint_code2());
|
||||
jo.put("material_name", MdMeMaterialbaseList.get(0).getMaterial_name());
|
||||
jo.put("material_code", MdMeMaterialbaseList.get(0).getMaterial_code());
|
||||
jo.put("qty", groupPlateList.get(0).getQty());
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
tableData.add(jo);
|
||||
towmsmsg.setTableData(tableData);
|
||||
// iWmsToWmsService.FinishOutTask(towmsmsg);
|
||||
notifyWmsAsync(towmsmsg);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1582,12 +1583,13 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
towmsmsg.setTableData(tableData);
|
||||
// iWmsToWmsService.FinishOutTask(towmsmsg);
|
||||
notifyWmsAsync(towmsmsg);
|
||||
throw new BadRequestException("未找到该托盘的物料信息,检查一下该托盘是否已出库或在操作日志中查询该物料是否被删除!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步回传WMS
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
// @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
||||
public void notifyWmsAsync(TOWMSMSG task) {
|
||||
// 调用WMS接口
|
||||
iWmsToWmsService.FinishOutTask(task);
|
||||
|
||||
@@ -2,6 +2,9 @@ package org.nl.wms.wbwms.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -11,8 +14,14 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||
import org.nl.wms.ext_manage.service.util.AcsResponse;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.wbwms.service.WmsToIWmsService;
|
||||
import org.nl.wms.wbwms.service.dto.WmstoIWmsResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -159,4 +168,41 @@ public class WmsToIWmscontroller {
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryTimeoutTask")
|
||||
@Log("查询ACS超时异常任务")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> queryTimeoutTask(@RequestBody JSONObject param) {
|
||||
// 系统参数类
|
||||
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||
// ACS地址
|
||||
Param acsUrlParam = sysParamService.findByCode(SysParamConstant.ACS_URL);
|
||||
if (ObjectUtil.isEmpty(acsUrlParam)) {
|
||||
return new ResponseEntity<>(AcsResponse.requestError("系统参数表中:" + SysParamConstant.ACS_URL + "不存在"), HttpStatus.OK);
|
||||
}
|
||||
String url = acsUrlParam.getValue() + EXTConstant.QUERY_TIMEOUT_TASK_ACS_API;
|
||||
log.info("调用ACS超时异常任务查询接口:{}", url);
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
log.info("ACS超时异常任务查询结果:{}", resultMsg);
|
||||
// 格式转换:兼容 ACS 返回 JSONObject 或 JSONArray 两种情况
|
||||
AcsResponse acsResponse;
|
||||
String trimmedMsg = resultMsg.trim();
|
||||
if (trimmedMsg.startsWith("[")) {
|
||||
// 返回的是数组,直接赋值到 data 字段
|
||||
JSONArray jsonArray = JSONArray.parseArray(resultMsg);
|
||||
acsResponse = AcsResponse.requestOk();
|
||||
acsResponse.setData(jsonArray);
|
||||
} else {
|
||||
// 返回的是对象
|
||||
acsResponse = JSON.parseObject(resultMsg, AcsResponse.class);
|
||||
}
|
||||
return new ResponseEntity<>(acsResponse, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
log.error("调用ACS超时异常任务查询接口失败:{}", e.getMessage());
|
||||
return new ResponseEntity<>(AcsResponse.requestError("返回结果异常,原因:" + e.getMessage()), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
# active: dev
|
||||
# active: prod
|
||||
jackson:
|
||||
|
||||
Reference in New Issue
Block a user