This commit is contained in:
USER-20220102CG\noblelift
2022-12-19 21:31:10 +08:00
parent 1c49eb87bb
commit 3d7ce5cfeb
18 changed files with 319 additions and 38 deletions

View File

@@ -63,7 +63,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
int last_status = 0;
int last_error = 0;
@LokiLog(type = LokiLogType.ACA_TO_LMS)
@LokiLog(type = LokiLogType.ACS_TO_LMS)
public synchronized void processSocket(int[] arr) throws Exception {
device_code = this.getDeviceCode();
byte[] data = null;

View File

@@ -50,7 +50,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
int phase = 0;
int region = 0;
@LokiLog(type = LokiLogType.ACA_TO_LMS)
@LokiLog(type = LokiLogType.ACS_TO_LMS)
public synchronized void processSocket(int[] arr) throws Exception {
device_code = this.getDeviceCode();
byte[] data = null;

View File

@@ -375,9 +375,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
if (!StrUtil.equals(type, "0")) {
return false;
}
// if (!StrUtil.equals(type, "0")) {
// return false;
// }
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {
@@ -479,9 +479,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
String path = routeLineDto.getPath();
String type = routeLineDto.getType();
String[] str = path.split("->");
if (!StrUtil.equals(type, "0")) {
return false;
}
// if (!StrUtil.equals(type, "0")) {
// return false;
// }
List<String> pathlist = Arrays.asList(str);
int index = 0;
for (int m = 0; m < pathlist.size(); m++) {

View File

@@ -3,18 +3,29 @@ package org.nl.acs.ext.wms;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
/**
* ACS连接外部系统工具类:
*/
@Slf4j
public class AcsUtil {
@LokiLog(type = LokiLogType.ACS_TO_LK)
public static <W> String notifyAcs(String api, W requestParam) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);;
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class);
//判断是否连接立库WCS系统
String isConnect = paramService.findByCode("is_connect_liKu_Wcs").getValue();
@@ -23,16 +34,21 @@ public class AcsUtil {
}
String liKu_wcs_url = paramService.findByCode("liKu_wcs_url").getValue();
try {
return HttpRequest
logServer.extLog(LokiLogType.ACS_TO_LK.name(),"下发立库任务请求参数:{}"+JSON.toJSONString(requestParam) );
log.info("下发立库任务请求参数:{}", JSON.toJSONString(requestParam));
String body = HttpRequest
.post(liKu_wcs_url + api)
.body(JSON.toJSONString(requestParam))
.execute()
.body();
log.info("下发立库任务返回参数:{}", body);
return body;
} catch (Exception e) {
JSONObject result = new JSONObject();
result.put("result", "false");
result.put("code", "");
result.put("comment", e.getMessage());
log.info("下发立库任务异常返回参数:{}", String.valueOf(result));
return String.valueOf(result);
}
}

View File

@@ -37,5 +37,5 @@ public class BaseStoreReportRequest {
* 出库任务上报 1已接收任务2开始执行3执行完成
* 移库任务上报 1 已接收 2开始执行3 执行完成 4 起点库位有货被阻挡 5目的点库位无货被阻挡
*/
public int state;
public String state;
}

View File

@@ -10,4 +10,5 @@ import lombok.Data;
*/
@Data
public class InStoreReportResponse extends BaseResponseData {
}

View File

@@ -83,21 +83,21 @@ public class AcsToLiKuController {
}
@PostMapping("/inStoreReport")
@Log("向立库下发入库任务上报")
@Log("入库任务上报")
@ApiOperation("向立库下发入库任务上报")
public ResponseEntity<Object> inStoreReport(@RequestBody InStoreReportRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.inStoreReport(requestParam), HttpStatus.OK);
}
@PostMapping("/outStoreReport")
@Log("向立库下发出库任务上报")
@Log("出库任务上报")
@ApiOperation("向立库下发出库任务上报")
public ResponseEntity<Object> outStoreReport(@RequestBody OutStoreReportRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.outStoreReport(requestParam), HttpStatus.OK);
}
@PostMapping("/moveStoreReport")
@Log("向立库下发移库任务上报")
@Log("移库任务上报")
@ApiOperation("向立库下发移库任务上报")
public ResponseEntity<Object> moveStoreReport(@RequestBody MoveStoreReportRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.moveStoreReport(requestParam), HttpStatus.OK);

View File

@@ -0,0 +1,54 @@
package org.nl.acs.ext.wms.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.ext.wms.liKuData.*;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.ext.wms.service.LiKuToAcsService;
import org.nl.modules.logging.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author wangs
* @date 2021-07-21
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "立库接口")
@RequestMapping("/api/likuToACS")
@Slf4j
public class LiKuToACSController {
private final LiKuToAcsService liKuToAcsService;
@PostMapping("/inStoreReport")
@Log("入库任务上报")
@ApiOperation("向立库下发入库任务上报")
public ResponseEntity<Object> inStoreReport(@RequestBody InStoreReportRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.inStoreReport(requestParam), HttpStatus.OK);
}
@PostMapping("/outStoreReport")
@Log("出库任务上报")
@ApiOperation("向立库下发出库任务上报")
public ResponseEntity<Object> outStoreReport(@RequestBody OutStoreReportRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.outStoreReport(requestParam), HttpStatus.OK);
}
@PostMapping("/moveStoreReport")
@Log("移库任务上报")
@ApiOperation("向立库下发移库任务上报")
public ResponseEntity<Object> moveStoreReport(@RequestBody MoveStoreReportRequest requestParam) throws Exception {
return new ResponseEntity<>(liKuToAcsService.moveStoreReport(requestParam), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,32 @@
package org.nl.acs.ext.wms.service;
import org.nl.acs.ext.wms.liKuData.*;
/**
* @author: wangs
* @createDate: 2022/11/24
*/
public interface LiKuToAcsService {
/**
* 入库任务上报
* @param requestParam
* @return
*/
public Resp<InStoreReportResponse> inStoreReport(InStoreReportRequest requestParam) throws Exception;
/**
* 出库任务上报
* @param requestParam
* @return
*/
public Resp<OutStoreReportResponse> outStoreReport(OutStoreReportRequest requestParam) throws Exception;
/**
* 移库任务上报
* @param requestParam
* @return
*/
public Resp<MoveStoreReportResponse> moveStoreReport(MoveStoreReportRequest requestParam) throws Exception;
}

View File

@@ -0,0 +1,116 @@
package org.nl.acs.ext.wms.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.address.service.AddressService;
import org.nl.acs.ext.wms.AcsUtil;
import org.nl.acs.ext.wms.RespUtil;
import org.nl.acs.ext.wms.liKuData.*;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.ext.wms.service.LiKuToAcsService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.task.service.TaskService;
import org.springframework.stereotype.Service;
/**
* 立库WCS接口
*
* @author: wangs
* @createDate: 2022/11/24
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class LiKuToAcsServiceImpl implements LiKuToAcsService {
private final AddressService addressService;
private final TaskService taskService;
private final InstructionService instructionService;
@Override
public Resp<InStoreReportResponse> inStoreReport(InStoreReportRequest requestParam) throws Exception {
String inst_code = requestParam.getOrderId();
String status = requestParam.getState();
Instruction inst = instructionService.findByCodeFromCache(inst_code);
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
inst.setInstruction_status("1");
} else if(StrUtil.equals(status,"3")){
inst.setInstruction_status("2");
instructionService.finish(inst.getInstruction_id());
} else {
}
InStoreReportResponse inStoreReportResponse = new InStoreReportResponse();
inStoreReportResponse.setOrderId(inst_code);
JSONObject result = new JSONObject();
result.put("result", "true");
result.put("code", "0");
result.put("comment", "");
result.put("data", inStoreReportResponse );
return RespUtil.getResp(result.toString(), new InStoreReportResponse());
}
@Override
public Resp<OutStoreReportResponse> outStoreReport(OutStoreReportRequest requestParam) throws Exception {
String inst_code = requestParam.getOrderId();
String status = requestParam.getState();
Instruction inst = instructionService.findByCodeFromCache(inst_code);
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
inst.setInstruction_status("1");
} else if(StrUtil.equals(status,"3")){
inst.setInstruction_status("2");
instructionService.finish(inst.getInstruction_id());
} else {
}
OutStoreReportResponse outStoreReportResponse = new OutStoreReportResponse();
outStoreReportResponse.setOrderId(inst_code);
JSONObject result = new JSONObject();
result.put("result", "true");
result.put("code", "0");
result.put("comment", "");
result.put("data", outStoreReportResponse );
return RespUtil.getResp(result.toString(), new OutStoreReportResponse());
}
@Override
public Resp<MoveStoreReportResponse> moveStoreReport(MoveStoreReportRequest requestParam) throws Exception {
String inst_code = requestParam.getOrderId();
String status = requestParam.getState();
Instruction inst = instructionService.findByCodeFromCache(inst_code);
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
inst.setInstruction_status("1");
} else if(StrUtil.equals(status,"3")){
inst.setInstruction_status("2");
instructionService.finish(inst.getInstruction_id());
} else {
}
MoveStoreReportResponse moveStoreReportResponse = new MoveStoreReportResponse();
moveStoreReportResponse.setOrderId(inst_code);
JSONObject result = new JSONObject();
result.put("result", "true");
result.put("code", "0");
result.put("comment", "");
result.put("data", moveStoreReportResponse );
return RespUtil.getResp(result.toString(), new MoveStoreReportResponse());
}
}

View File

@@ -179,13 +179,15 @@ public interface InstructionService {
void cancelNOSendAgv(String id) throws Exception;
/**
* 根据编码缓存查询
* 根据指令编号缓存查询
*
* @param code code
* @return Instruction
*/
Instruction findByCodeFromCache(String code);
List<Instruction> findByLinkNum(String code);
/**

View File

@@ -22,7 +22,7 @@ import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDev
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.ext.wms.liKuData.InStoreRequest;
import org.nl.acs.ext.wms.liKuData.*;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
@@ -339,38 +339,76 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
if (StrUtil.equals(shortPathsList.get(0).getType(), "1")){
// 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统
if (!StrUtil.equals(task.getAgv_system_type(), "0")) {
if (!StrUtil.equals(task.getAgv_system_type(), "0") && ObjectUtil.isNotEmpty(task.getAgv_system_type())) {
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto);
} else {
//入库
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class);
Resp resp = null;
if(StrUtil.equals(task.getStorage_task_type(),"1")){
InStoreRequest request = new InStoreRequest();
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
acsToLiKuService.inStore(request);
request.setType(1);
request.setOrderId(dto.getInstruction_code());
request.setSrcLocation(dto.getStart_point_code());
request.setDestLocation(dto.getNext_point_code());
resp = acsToLiKuService.inStore(request);
//空托入库
} else if (StrUtil.equals(task.getStorage_task_type(),"2")){
InStoreRequest request = new InStoreRequest();
request.setFloorNo(Integer.parseInt(dto.getTo_z()));
request.setType(2);
request.setOrderId(dto.getInstruction_code());
request.setSrcLocation(dto.getStart_point_code());
request.setDestLocation(dto.getNext_point_code());
resp = acsToLiKuService.inStore(request);
//出库
} else if (StrUtil.equals(task.getStorage_task_type(),"3")){
OutStoreRequest outStore = new OutStoreRequest();
BaseStoreRequest baseReq = new BaseStoreRequest();
List<BaseStoreRequest> list = new ArrayList();
baseReq.setOrderId(dto.getInstruction_code());
baseReq.setSrcLocation(dto.getStart_point_code());
baseReq.setDestLocation(dto.getNext_point_code());
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
baseReq.setPalletCode(dto.getVehicle_code());
list.add(baseReq);
outStore.setOrderInfos(list);
outStore.setGroupId(dto.getInstruction_code());
resp = acsToLiKuService.outStore(outStore);
//空托出库
} else if (StrUtil.equals(task.getStorage_task_type(),"4")) {
EmptyVehicleOutStoreRequest emptyVehicleOutStoreRequest = new EmptyVehicleOutStoreRequest();
emptyVehicleOutStoreRequest.setOrderId(dto.getInstruction_code());
emptyVehicleOutStoreRequest.setFloorNo(Integer.parseInt(dto.getFrom_z()));
emptyVehicleOutStoreRequest.setSrcLocation(dto.getStart_point_code());
emptyVehicleOutStoreRequest.setDestLocation(dto.getNext_point_code());
emptyVehicleOutStoreRequest.setPalletCode(dto.getVehicle_code());
resp = acsToLiKuService.emptyVehicleOutStore(emptyVehicleOutStoreRequest);
//转库
} else if (StrUtil.equals(task.getStorage_task_type(),"5")) {
MoveStoreRequest moveStoreRequest = new MoveStoreRequest();
BaseStoreRequest baseReq = new BaseStoreRequest();
List<BaseStoreRequest> list = new ArrayList();
baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z()));
baseReq.setPalletCode(dto.getVehicle_code());
baseReq.setOrderId(dto.getInstruction_code());
baseReq.setSrcLocation(dto.getStart_point_code());
baseReq.setDestLocation(dto.getNext_point_code());
list.add(baseReq);
resp = acsToLiKuService.moveStore(moveStoreRequest);
}
if(ObjectUtil.isNotEmpty(resp)){
if(StrUtil.equals(resp.getResult(),"true")){
dto.setSend_status("1");
} else {
dto.setSend_status("2");
dto.setRemark(resp.getData().toString());
}
}
}
}
} catch (Exception e) {
dto.setSend_status("2");
@@ -971,6 +1009,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
return null;
}
@Override
public Instruction findByBarcodeFromCache(String barcode) {
for (int i = 0; i < this.instructions.size(); i++) {

View File

@@ -8,7 +8,8 @@ package org.nl.acs.log;
public enum LokiLogType {
DEFAULT("默认"),
AGV("AGV接口日志"),
ACA_TO_LMS("ACS请求LMS");
ACS_TO_LMS("ACS请求LMS"),
ACS_TO_LK("ACS请求立库");
private String desc;

View File

@@ -20,4 +20,14 @@ public interface DeviceExecuteLogService {
* @param message 日志信息
*/
void deviceExecuteLog(String device_code, String vehicle_code, String inst_code, String message);
/**
* 设备执行日志,会保留历史记录
*
* @param name 日志名称
* @param message 日志信息
*/
void extLog(String name, String message);
}

View File

@@ -36,6 +36,16 @@ public class DeviceExecuteLogServiceImpl implements DeviceExecuteLogService {
MDC.remove("device_code_log");
}
}
@Override
public void extLog(String name, String message) {
try {
MDC.put(name, name);
log.info("{}", message);
} finally {
MDC.remove(name);
}
}
}

View File

@@ -110,7 +110,7 @@
<el-table-column v-if="false" prop="instruction_id" label="指令标识" />
<el-table-column prop="instruction_code" label="指令编号" />
<el-table-column prop="instruction_type" label="指令类型" />
<el-table-column prop="link_num" label="关联编号" />
<!-- <el-table-column prop="link_num" label="关联编号" />-->
<el-table-column prop="task_code" label="任务号" />
<el-table-column prop="vehicle_code" label="载具号" />
<el-table-column prop="instruction_status" label="指令状态">
@@ -133,13 +133,13 @@
<el-table-column prop="start_point_code2" label="取货点2" />
<el-table-column prop="next_point_code2" label="放货点2" />
<el-table-column prop="carno" label="车号" />
<el-table-column prop="compound_inst" label="复合指令">
<template slot-scope="scope">
<span v-if="scope.row.compound_inst==='0' ">否</span>
<span v-if="scope.row.compound_inst==='1' ">是</span>
</template>
</el-table-column>
<el-table-column prop="compound_inst_data" width="200" label="复合路线" />
<!-- <el-table-column prop="compound_inst" label="复合指令">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.compound_inst==='0' ">否</span>-->
<!-- <span v-if="scope.row.compound_inst==='1' ">是</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="compound_inst_data" width="200" label="复合路线" />-->
<el-table-column prop="matarial" label="物料" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="描述" />

View File

@@ -379,7 +379,7 @@ import { getDicts } from '@/api/system/dict'
export default {
name: 'Task',
components: { pagination, crudOperation },
dicts: ['task_status', 'task_type', 'agv_system_type'],
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type'],
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({ title: '任务', url: 'api/task', idField: 'task_id', sort: 'task_id,desc',