add 纸管库接口

This commit is contained in:
USER-20220102CG\noblelift
2023-04-29 19:58:31 +08:00
parent 6b5d0b4473
commit f13875ace8
5 changed files with 109 additions and 4 deletions

View File

@@ -105,7 +105,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_inventory_qty, "库存数量", "DB101.W4"));
list.add(new ItemDto(item_out_finish, "出库完成 ", "DB101.W6"));
list.add(new ItemDto(item_material, "物料", "DB101.STRING8.50"));
list.add(new ItemDto(item_error, "error ", "DB101.W58"));
list.add(new ItemDto(item_error, "error", "DB101.W58"));
return list;
}

View File

@@ -66,6 +66,8 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
int inventory_qty =0;
int out_finish =0;
int error =0;
int to_command =0;
int to_target =0;
String material = null;
Boolean isonline = true;
@@ -102,7 +104,8 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
out_finish =this.itemProtocol.getOut_finish();
material = this.itemProtocol.getMaterial();
error = this.itemProtocol.getError();
to_command = this.itemProtocol.getTo_command();
to_target = this.itemProtocol.getTotarget();
if (mode != last_mode) {
this.setRequireSucess(false);
@@ -118,6 +121,12 @@ public class PaperTubeConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
logServer.deviceExecuteLog(this.device_code, "", "", "信号inventory_qty" + last_inventory_qty + "->" + inventory_qty);
}
if (out_finish != last_out_finish) {
if(out_finish == 1){
this.writing(0);
this.writing("to_target","0");
this.writing("to_out_qty","0");
}
logServer.deviceExecuteLog(this.device_code, "", "", "信号out_finish" + last_out_finish + "->" + out_finish);
}
if (!StrUtil.equals(material,last_material)) {

View File

@@ -143,4 +143,12 @@ public class WmsToAcsController {
public ResponseEntity<Object> realTimefaultInfo(@RequestBody JSONObject param){
return new ResponseEntity<>(wmstoacsService.realTimefaultInfo(param), HttpStatus.OK);
}
@PostMapping("/paperTubeAction")
@Log(value = "下发纸管库动作",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
@ApiOperation("下发纸管库动作")
@SaIgnore
public ResponseEntity<Object> paperTubeAction(@RequestBody JSONObject param){
return new ResponseEntity<>(wmstoacsService.paperTubeAction(param), HttpStatus.OK);
}
}

View File

@@ -107,4 +107,7 @@ public interface WmsToAcsService {
Map<String, Object> syncfaultInfo();
Map<String, Object> realTimefaultInfo(JSONObject param);
Map<String, Object> paperTubeAction(JSONObject param);
}

View File

@@ -24,6 +24,7 @@ import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.Empty
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver;
import org.nl.acs.device_driver.basedriver.paper_tube_device.PaperTubeConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
@@ -225,7 +226,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
//货梯对接线-带扫码器
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
//纸管库
PaperTubeConveyorDeviceDriver paperTubeConveyorDeviceDriver;
if (datas.size() == 0) {
throw new BadRequestException("缺少输入参数!");
}
@@ -272,7 +274,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("move", standardCoveyorControlWithScannerDeviceDriver.getMove());
jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction());
jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError());
} else {
} else if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) {
paperTubeConveyorDeviceDriver = (PaperTubeConveyorDeviceDriver) device.getDeviceDriver();
jo.put("device_code", parent_device_code);
jo.put("qty", paperTubeConveyorDeviceDriver.getInventory_qty());
jo.put("mode", paperTubeConveyorDeviceDriver.getMode());
jo.put("error", paperTubeConveyorDeviceDriver.getError());
jo.put("material_code", ObjectUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial())? "":paperTubeConveyorDeviceDriver.getMaterial() );
jo.put("out_finish", paperTubeConveyorDeviceDriver.getOut_finish());
}else {
jo.put("device_code", parent_device_code);
}
backja.add(jo);
@@ -1000,4 +1012,77 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return resp;
}
@Override
public Map<String, Object> paperTubeAction(JSONObject param) {
log.info("paperTubeAction--------------:输入参数" + param.toString());
JSONObject resp = new JSONObject();
String device_code = param.getString("device_code");
String type = param.getString("type");
String material_code = param.getString("material_code");
String qty = param.getString("qty");
if (StrUtil.isNotEmpty(device_code)) {
Device device = deviceAppService.findDeviceByCode(device_code);
if (device == null) {
resp.put("status", 400);
resp.put("message", "未找到对应设备");
log.info("paperTubeAction--------------:输出参数" + resp.toString());
return resp;
}
if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) {
PaperTubeConveyorDeviceDriver paperTubeConveyorDeviceDriver = (PaperTubeConveyorDeviceDriver) device.getDeviceDriver();
if(paperTubeConveyorDeviceDriver.getMode() != 2){
resp.put("status", 400);
resp.put("message", "设备:"+ device_code +"未待机,无法下发信号");
log.info("paperTubeAction--------------:输出参数" + resp.toString());
return resp;
}
if(StrUtil.equals(type,"1")){
if(paperTubeConveyorDeviceDriver.getInventory_qty() > 0){
resp.put("status", 400);
resp.put("message", "设备:"+ device_code +"当前数量为"+paperTubeConveyorDeviceDriver.getInventory_qty() +"无法设置物料");
log.info("paperTubeAction--------------:输出参数" + resp.toString());
return resp;
}
paperTubeConveyorDeviceDriver.writing("to_material",material_code);
} else if (StrUtil.equals(type,"2")) {
if(paperTubeConveyorDeviceDriver.getInventory_qty() < Integer.parseInt(qty)){
resp.put("status", 400);
resp.put("message", "设备:"+ device_code +"当前数量为"+paperTubeConveyorDeviceDriver.getInventory_qty() +"小于出库数量"+qty);
log.info("paperTubeAction--------------:输出参数" + resp.toString());
return resp;
}
if(StrUtil.isEmpty(paperTubeConveyorDeviceDriver.getMaterial())){
resp.put("status", 400);
resp.put("message", "设备:"+ device_code +"设备上报物料为空无法出库");
log.info("paperTubeAction--------------:输出参数" + resp.toString());
return resp;
} else {
if(!StrUtil.equals(paperTubeConveyorDeviceDriver.getMaterial(),material_code)){
resp.put("status", 400);
resp.put("message", "设备:"+ device_code +"设备上报物料为"+paperTubeConveyorDeviceDriver.getMaterial() +"与出库物料"+material_code+"不匹配");
log.info("paperTubeAction--------------:输出参数" + resp.toString());
return resp;
}
}
if(paperTubeConveyorDeviceDriver.getTo_command() != 0 || paperTubeConveyorDeviceDriver.getTo_target() != 0 ){
resp.put("status", 400);
resp.put("message", "设备:"+ device_code +"下发命令信号值为"+paperTubeConveyorDeviceDriver.getTo_command() + ",下发目标站:" + paperTubeConveyorDeviceDriver.getTo_target() +",已存在待执行的任务");
log.info("paperTubeAction--------------:输出参数" + resp.toString());
return resp;
}
paperTubeConveyorDeviceDriver.writing("to_out_qty",qty);
paperTubeConveyorDeviceDriver.writing("to_target",device.getAddress());
paperTubeConveyorDeviceDriver.writing("to_command","2");
}
}
}
resp.put("status", 200);
resp.put("message", "操作成功");
return resp;
}
}