fix 大屏手持窑后流程更新
This commit is contained in:
@@ -86,4 +86,14 @@ public class AgvDto implements Serializable {
|
||||
*/
|
||||
private String type = "AGV";
|
||||
|
||||
/**
|
||||
* 1号车当日完成任务数量
|
||||
*/
|
||||
private Integer finishnumber1 = 0;
|
||||
|
||||
/**
|
||||
* 2号车当日完成任务数量
|
||||
*/
|
||||
private Integer finishnumber2 = 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package org.nl.acs.device_driver.basedriver.standard_inspect_site;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -14,6 +16,7 @@ import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
@@ -31,6 +34,7 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -57,6 +61,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
@@ -136,12 +142,10 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
String message = null;
|
||||
try {
|
||||
device_code = this.getDeviceCode();
|
||||
|
||||
mode = this.itemProtocol.getMode();
|
||||
move = this.itemProtocol.getMove();
|
||||
error = this.itemProtocol.getError();
|
||||
task = this.itemProtocol.getTask();
|
||||
|
||||
if (mode != last_mode) {
|
||||
// this.setRequireSucess(false);
|
||||
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
|
||||
@@ -164,6 +168,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
return;
|
||||
}
|
||||
|
||||
//未在线无心跳
|
||||
if (!this.itemProtocol.getIsonline()) {
|
||||
this.setIsonline(false);
|
||||
this.setIserror(true);
|
||||
@@ -183,13 +188,15 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
case 5:
|
||||
// 优先出窑位任务
|
||||
if (!requireSucess && task != 0) {
|
||||
this.outKilnyx();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +262,42 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
server.disconnect();
|
||||
|
||||
}
|
||||
/**
|
||||
* 优先出窑位申请任务
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean outKilnyx() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code",device_code);
|
||||
param.put("vehicle_code", task);
|
||||
HttpResponse result = acsToWmsService.outKiln(param);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
Boolean isPackage = jsonObject.getBoolean("data");
|
||||
if (isPackage == null) {
|
||||
this.writing(24);
|
||||
} else {
|
||||
// this.writing(isPackage ? 22 : 23);
|
||||
//全部都是优先出窑
|
||||
this.writing(22);
|
||||
}
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void executing(Server server, Map<String, Object> itemMap) {
|
||||
ReadUtil.write(itemMap, server, 0);
|
||||
|
||||
@@ -265,6 +265,7 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
this.instruction_require_time = date;
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code",device_code);
|
||||
param.put("vehicle_code", outKiln_barcode);
|
||||
param.put("cool_number", cool_number);
|
||||
HttpResponse result = acsToWmsService.outKiln(param);
|
||||
@@ -276,7 +277,9 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
if (isPackage == null) {
|
||||
this.writing(24);
|
||||
} else {
|
||||
this.writing(isPackage ? 22 : 23);
|
||||
// this.writing(isPackage ? 22 : 23);
|
||||
//全部都是优先出窑
|
||||
this.writing(22);
|
||||
}
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
|
||||
@@ -685,8 +685,8 @@ public class ItemProtocol {
|
||||
list.add(new ItemDto(item_unqualified_qty, "不合格数量", "DB3.W70"));
|
||||
|
||||
list.add(new ItemDto(item_product_code, "产品编号", "DB3.W72"));
|
||||
list.add(new ItemDto(item_AlongSide, "A长边", "DB3.W74"));
|
||||
list.add(new ItemDto(item_BshortSide, "B短边", "DB3.W76"));
|
||||
list.add(new ItemDto(item_AlongSide, "单重", "DB3.W74"));
|
||||
list.add(new ItemDto(item_BshortSide, "今天完成托数", "DB3.W76"));
|
||||
list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB3.W78"));
|
||||
list.add(new ItemDto(item_Wthickness, "W厚度", "DB3.W80"));
|
||||
list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB3.W82"));
|
||||
|
||||
@@ -986,7 +986,8 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
|
||||
json.put("type", "1");
|
||||
json.put("material_code", material);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("qty", encoder_qty);
|
||||
int encoder_qty1=encoder_qty-1;
|
||||
json.put("qty", encoder_qty1);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
|
||||
@@ -498,8 +498,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
status.put("weight", driver.getWeight());
|
||||
status.put("material", driver.getMaterial());
|
||||
status.put("barcode", driver.getBarcode());
|
||||
status.put("unqualified_qty", driver.getUnqualified_qty());
|
||||
status.put("encoder_qty", driver.getEncoder_qty());
|
||||
status.put("qty", driver.getEncoder_qty()-1);
|
||||
if(driver.getAlongSide()!=0) {
|
||||
Integer dz=driver.getAlongSide();
|
||||
double weight=dz/1000.00;
|
||||
String weight1 = String.format("%.2f", weight);
|
||||
status.put("AlongSide", weight1);
|
||||
}else{
|
||||
status.put("AlongSide",0);
|
||||
}
|
||||
status.put("BshortSide", driver.getBshortSide());
|
||||
} else if (deviceDriver instanceof LnshKilnTrussDeviceDriver) {
|
||||
LnshKilnTrussDeviceDriver driver = (LnshKilnTrussDeviceDriver) deviceDriver;
|
||||
status.put("mode", driver.getMode());
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.modules.system.service.ParamService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -984,8 +985,30 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
//电量
|
||||
else if (phase == 0x73) {
|
||||
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
||||
agv.setEnergyLevel(String.valueOf(ikey));
|
||||
try {
|
||||
int carno1 = 0;
|
||||
int carno2 = 0;
|
||||
JSONArray taskfinish = WQLObject.getWQLObject("acs_instruction").query("instruction_status = '2' AND TO_DAYS (create_time) = TO_DAYS (NOW())").getResultJSONArray(0);
|
||||
if(!taskfinish.isEmpty()) {
|
||||
for (int i = 0; i < taskfinish.size(); i++) {
|
||||
JSONObject instruction = taskfinish.getJSONObject(i);
|
||||
if (!StrUtil.isBlank(instruction.getString("carno"))) {
|
||||
String carnotoday = instruction.getString("carno");
|
||||
if (carnotoday.equals("1")) {
|
||||
carno1 = carno1 + 1;
|
||||
} else if (carnotoday.equals("2")) {
|
||||
carno2 = carno2 + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
||||
agv.setEnergyLevel(String.valueOf(ikey));
|
||||
agv.setFinishnumber1(carno1);
|
||||
agv.setFinishnumber2(carno2);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("记录每日车辆工作量出错!", e);
|
||||
}
|
||||
} else if (phase == 0x74) {
|
||||
// 状态
|
||||
AgvDto agv = ndcAGVService.findByCarNumber(String.valueOf(arr[18] * 256 + arr[19]));
|
||||
|
||||
Reference in New Issue
Block a user