add 纸管库、立库接口

This commit is contained in:
USER-20220102CG\noblelift
2023-04-18 21:25:06 +08:00
parent ad64980050
commit 49a0c61938
13 changed files with 146 additions and 15 deletions

View File

@@ -112,6 +112,10 @@ public class ItemProtocol {
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -149,12 +149,16 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行";
mode = "入库";
} else if (this.getMode() == 4) {
mode = "出库中";
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
jo.put("inventory_qty", inventory_qty);
jo.put("out_finish", out_finish);
jo.put("material", material);
return jo;
}

View File

@@ -870,10 +870,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
message = "申请空盘入库任务中...";
if(taskserver.querySameOriginTask(this.device_code) > 0 ){
message = "已存在空盘出库任务不再请求";
return;
}
// if(taskserver.querySameOriginTask(this.device_code) > 0 ){
// message = "已存在空盘出库任务不再请求";
// return;
// }
JSONObject apply = new JSONObject();
apply.put("device_code", device_code);

View File

@@ -0,0 +1,12 @@
package org.nl.acs.ext.wms.liKuData;
import lombok.Data;
/**
* 出库任务库位解锁Data类
* @author: wangs
* @createDate: 2022/11/24
*/
@Data
public class OutConfirmReportResponse extends BaseResponseData {
}

View File

@@ -0,0 +1,14 @@
package org.nl.acs.ext.wms.liKuData;
import lombok.Data;
/**
* 出库库位解锁 请求参数类
*
* @author: wangs by
* @createDate: 2022/11/24
*/
@Data
public class OutConfirmRequest extends BaseStoreRequest {
String outPortNo;
}

View File

@@ -111,4 +111,11 @@ public class AcsToLiKuController {
return new ResponseEntity<>(acsToLiKuService.queryTsjDeviceStatus(requestParam), HttpStatus.OK);
}
@PostMapping("/outConfirm")
@Log(value = "下发解锁出库口",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK)
@ApiOperation("下发解锁出库口")
public ResponseEntity<Object> outConfirm(@RequestBody OutConfirmRequest requestParam) {
return new ResponseEntity<>(acsToLiKuService.outConfirm(requestParam), HttpStatus.OK);
}
}

View File

@@ -39,6 +39,13 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmstoacsService.crateTask(whereJson), HttpStatus.OK);
}
@PostMapping("/unLock")
@Log(value = "解锁立库点位",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
@ApiOperation("解锁立库点位")
public ResponseEntity<Object> unLock(@RequestBody String whereJson) {
return new ResponseEntity<>(wmstoacsService.unLock(whereJson), HttpStatus.OK);
}
@PostMapping("/cancelTask")
@Log(value = "WMS取消任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
@ApiOperation("WMS取消任务")

View File

@@ -88,6 +88,10 @@ public interface AcsToLiKuService {
* @return
*/
public Resp<DeviceStatusResponse> querySsxDeviceStatus(DeviceStatusRequest requestParam);
public Resp<OutConfirmReportResponse> outConfirm(OutConfirmRequest requestParam);
}

View File

@@ -19,6 +19,14 @@ public interface WmsToAcsService {
CreateTaskResponse crateTask(String whereJson);
/**
* 解锁立库点位
*
* @param jsonObject 条件
* @return
*/
Map<String, Object> unLock(String jsonObject);
/**
* 取消任务
*

View File

@@ -204,6 +204,22 @@ public class AcsToLiKuServiceImpl implements AcsToLiKuService {
}
}
@Override
public Resp<OutConfirmReportResponse> outConfirm(OutConfirmRequest requestParam) {
try {
MDC.put(log_file_type, log_type);
log.info("outConfirm-----输入参数{}", JSON.toJSONString(requestParam));
String api = addressService.findByCode("outConfirm").getMethods_url();
String result = AcsUtil.notifyAcs(api, requestParam);
log.info("outConfirm-----输出参数{}", result);
return RespUtil.getResp(result, new OutConfirmRequest());
} finally {
MDC.remove(log_file_type);
}
}
@Override
public Resp sendInst(String type, Instruction dto){
AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class);

View File

@@ -23,6 +23,9 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanne
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDefination;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.ext.wms.data.*;
import org.nl.acs.ext.wms.liKuData.DeviceStatusResponse;
import org.nl.acs.ext.wms.liKuData.OutConfirmReportResponse;
import org.nl.acs.ext.wms.liKuData.OutConfirmRequest;
import org.nl.acs.ext.wms.liKuData.Resp;
import org.nl.acs.ext.wms.service.AcsToLiKuService;
import org.nl.acs.ext.wms.service.WmsToAcsService;
@@ -769,6 +772,35 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
@Override
public Map<String, Object> unLock(String param) {
try {
MDC.put(log_file_type, log_type);
log.info("unLock--------------:输入参数" + param);
JSONObject jo = JSONObject.parseObject(param);
String task_code = String.valueOf(jo.get("task_code"));
String device_code = String.valueOf(jo.get("device_code"));
String vehicle_code = String.valueOf(jo.get("vehicle_code"));
OutConfirmRequest outConfirmRequest = new OutConfirmRequest();
outConfirmRequest.setOutPortNo(device_code);
outConfirmRequest.setPalletCode(vehicle_code);
Resp<OutConfirmReportResponse> resp = acsToLiKuService.outConfirm(outConfirmRequest);
} catch (Exception e) {
e.printStackTrace();
log.info("unLock--------------:输出参数" + e.getMessage());
} finally {
MDC.remove(log_file_type);
}
JSONObject resultJson = new JSONObject();
resultJson.put("status", HttpStatus.OK.value());
resultJson.put("message", "操作成功");
log.info("unLock--------------:输出参数" + resultJson);
return resultJson;
}
@Override
public Map<String, Object> updateTask(String whereJson) {

View File

@@ -12,6 +12,8 @@ import org.openscada.opc.lib.da.ItemState;
import org.openscada.opc.lib.da.Server;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Slf4j
public class DeviceOpcProtocolRunable implements Runnable {
@@ -20,6 +22,8 @@ public class DeviceOpcProtocolRunable implements Runnable {
int error_num;
String message;
private Server server;
boolean flag =false;
public DeviceOpcProtocolRunable() {
this.error_num = 0;
@@ -172,10 +176,30 @@ public class DeviceOpcProtocolRunable implements Runnable {
value = OpcUtl.getValue(item, itemState);
his = accessor_value.getValue(item.getId());
if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
flag = true;
log.warn("opc 值不健康 item: {}, 状态: {},当前读取值:{}, 系统内存值{} ", item.getId(), itemState.getQuality(), value, his);
}
if(flag){
if (this.server != null) {
try {
this.server.disconnect();
} catch (Exception var25) {
log.warn("{} : server disconnect", var25);
}
}
DeviceOpcProtocolRunable runable = new DeviceOpcProtocolRunable();
runable.setProtocols(protocols);
runable.setOpcServer(OpcServer);
ExecutorService executorService = Executors.newCachedThreadPool();
executorService.submit(runable);
log.warn("opc 值不健康 item: {}, 重新创建连接,当前线程名:{}", item.getId(),tag);
break;
}
} while (ObjectUtil.equal(value, his));//如果两次的值相等,不走下面的代码
if(flag){
break;
}
OpcItemDto itemDto = this.getItem(item.getId());
//默认记录日志
if (true) {
@@ -197,7 +221,12 @@ public class DeviceOpcProtocolRunable implements Runnable {
// accessor_value.getHistoryUnifiedData(item.getId());
//设置值
accessor_value.setValue(item.getId(), value);
if(flag){
break;
}
}
if(flag){
break;
}
}
} catch (Exception var30) {