rev 大屏首页需求数据
This commit is contained in:
@@ -120,6 +120,9 @@ public class LnshFoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implem
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!open_time.equals(last_open_time)) {
|
if (!open_time.equals(last_open_time)) {
|
||||||
logServer.deviceItemValue(this.device_code, "open_time", open_time);
|
logServer.deviceItemValue(this.device_code, "open_time", open_time);
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import org.nl.acs.device_driver.DeviceDriver;
|
|||||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||||
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
|
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||||
@@ -41,6 +43,7 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||||
|
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||||
|
|
||||||
String device_code;
|
String device_code;
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
@@ -109,6 +112,9 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!open_time.equals(last_open_time)) {
|
if (!open_time.equals(last_open_time)) {
|
||||||
logServer.deviceItemValue(this.device_code, "open_time", open_time);
|
logServer.deviceItemValue(this.device_code, "open_time", open_time);
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ public class LnshKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implement
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (kiln_number != last_kiln_number) {
|
if (kiln_number != last_kiln_number) {
|
||||||
logServer.deviceItemValue(this.device_code, "kiln_number", String.valueOf(kiln_number));
|
logServer.deviceItemValue(this.device_code, "kiln_number", String.valueOf(kiln_number));
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!open_time.equals(last_open_time)) {
|
if (!open_time.equals(last_open_time)) {
|
||||||
logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));
|
logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));
|
||||||
|
|||||||
@@ -135,6 +135,9 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!open_time.equals(last_open_time)) {
|
if (!open_time.equals(last_open_time)) {
|
||||||
logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));
|
logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time));
|
||||||
|
|||||||
@@ -163,6 +163,9 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (error != last_error) {
|
if (error != last_error) {
|
||||||
logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error));
|
logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error));
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (action != last_action) {
|
if (action != last_action) {
|
||||||
logServer.deviceItemValue(this.device_code,"action" ,String.valueOf(action));
|
logServer.deviceItemValue(this.device_code,"action" ,String.valueOf(action));
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De
|
|||||||
if (status != last_status) {
|
if (status != last_status) {
|
||||||
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
logServer.deviceItemValue(this.device_code, "status", String.valueOf(status));
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + " -> " + status);
|
||||||
|
if (status == 3) {
|
||||||
|
acsToWmsService.equipmentFailure(device_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!open_time.equals(last_open_time)) {
|
if (!open_time.equals(last_open_time)) {
|
||||||
logServer.deviceItemValue(this.device_code, "open_time", String.valueOf(open_time));
|
logServer.deviceItemValue(this.device_code, "open_time", String.valueOf(open_time));
|
||||||
|
|||||||
@@ -182,4 +182,6 @@ public interface AcsToWmsService {
|
|||||||
HttpResponse fjCallEmpty(JSONObject param);
|
HttpResponse fjCallEmpty(JSONObject param);
|
||||||
|
|
||||||
HttpResponse fjNeed(JSONObject param);
|
HttpResponse fjNeed(JSONObject param);
|
||||||
|
|
||||||
|
void equipmentFailure(String deviceCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1157,4 +1157,30 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
MDC.remove(log_file_type);
|
MDC.remove(log_file_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void equipmentFailure(String deviceCode) {
|
||||||
|
try {
|
||||||
|
MDC.put(log_file_type, log_type);
|
||||||
|
String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue();
|
||||||
|
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("device_code", deviceCode);
|
||||||
|
log.info("equipmentFailure - 请求参数 {}", param);
|
||||||
|
AddressDto addressDto = addressService.findByCode("equipmentFailure");
|
||||||
|
String methods_url = addressDto.getMethods_url();
|
||||||
|
try {
|
||||||
|
HttpResponse response = HttpRequest
|
||||||
|
.post(wmsurl + methods_url)
|
||||||
|
.timeout(2000)
|
||||||
|
.body(param.toJSONString())
|
||||||
|
.execute();
|
||||||
|
log.info("equipmentFailure - 响应参数 {}", response.body());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("equipmentFailure - 请求错误!", e);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
MDC.remove(log_file_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,19 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.config.AcsConfig;
|
import org.nl.acs.config.AcsConfig;
|
||||||
import org.nl.acs.device.service.DeviceService;
|
import org.nl.acs.device.service.DeviceService;
|
||||||
|
import org.nl.acs.device_driver.DeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_kiln_lane.LnshKilnLaneDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_kiln_lane.LnshKilnLaneDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_kiln_truss.LnshKilnTrussDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_kiln_truss.LnshKilnTrussDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss.LnshOutKilnTrussDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_out_kiln_truss.LnshOutKilnTrussDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_package_line.LnshPackageLineDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator.LnshPackagePalletManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator.LnshPackagePalletManipulatorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_package_site.LnshPackageSiteDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_package_site.LnshPackageSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator.LnshPalletizingManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator.LnshPalletizingManipulatorDeviceDriver;
|
||||||
|
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_press.LnshPressDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_press.LnshPressDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_rgv.LnshRGVDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.LnshSplitManipulatorDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.LnshSplitManipulatorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
|
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
import org.nl.acs.ext.wms.service.WmsToAcsService;
|
||||||
@@ -415,111 +417,156 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String device_code = status.getString("device_code");
|
String deviceCode = status.getString("device_code");
|
||||||
if (StrUtil.isBlank(device_code)) {
|
if (StrUtil.isBlank(deviceCode)) {
|
||||||
continue;
|
continue;
|
||||||
|
} else if (deviceCode.startsWith("HLJ") && !deviceCode.contains("XL")) {
|
||||||
|
deviceCode = "HLJ";
|
||||||
}
|
}
|
||||||
|
|
||||||
Device device = DeviceAppService.findDeviceByCode(device_code);
|
Device device = DeviceAppService.findDeviceByCode(deviceCode);
|
||||||
if (ObjectUtil.isEmpty(device)) {
|
if (ObjectUtil.isEmpty(device)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver) {
|
DeviceDriver deviceDriver = device.getDeviceDriver();
|
||||||
LnshMixingMillDeviceDriver driver = (LnshMixingMillDeviceDriver) device.getDeviceDriver();
|
if (deviceDriver instanceof LnshMixingMillDeviceDriver) {
|
||||||
|
LnshMixingMillDeviceDriver driver = (LnshMixingMillDeviceDriver) deviceDriver;
|
||||||
status.put("device_status", driver.getStatus());
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
status.put("error", driver.getError());
|
status.put("error", driver.getError());
|
||||||
status.put("open_time", driver.getOpen_time());
|
status.put("open_time", driver.getOpen_time());
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
status.put("standby_time", driver.getStandby_time());
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
status.put("production_time", driver.getProduction_time());
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
status.put("error_time", driver.getError_time());
|
||||||
status.put("real_qty", driver.getWeight());
|
status.put("weight", driver.getWeight());
|
||||||
status.put("mix_num", driver.getMix_num());
|
status.put("mix_num", driver.getMix_num());
|
||||||
} else if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) {
|
status.put("material", driver.getMaterial());
|
||||||
LnshPressDeviceDriver driver = (LnshPressDeviceDriver) device.getDeviceDriver();
|
} else if (deviceDriver instanceof LnshStationDeviceDriver) {
|
||||||
|
LnshStationDeviceDriver driver = (LnshStationDeviceDriver) deviceDriver;
|
||||||
status.put("device_status", driver.getStatus());
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("move", driver.getMove());
|
||||||
|
status.put("action", driver.getAction());
|
||||||
|
status.put("ioaction", driver.getIo_action());
|
||||||
|
status.put("error", driver.getError());
|
||||||
|
status.put("task", driver.getTask());
|
||||||
|
status.put("weight", driver.getWeight());
|
||||||
|
status.put("material", driver.getMaterial());
|
||||||
|
status.put("barcode", driver.getBarcode());
|
||||||
|
} else if (deviceDriver instanceof StandardInspectSiteDeviceDriver) {
|
||||||
|
StandardInspectSiteDeviceDriver driver = (StandardInspectSiteDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("move", driver.getMove());
|
||||||
|
status.put("error", driver.getError());
|
||||||
|
status.put("task", driver.getTask());
|
||||||
|
} else if (deviceDriver instanceof LnshPressDeviceDriver) {
|
||||||
|
LnshPressDeviceDriver driver = (LnshPressDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
status.put("error", driver.getError());
|
status.put("error", driver.getError());
|
||||||
status.put("open_time", driver.getOpen_time());
|
status.put("open_time", driver.getOpen_time());
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
status.put("standby_time", driver.getStandby_time());
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
status.put("production_time", driver.getProduction_time());
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
status.put("error_time", driver.getError_time());
|
||||||
status.put("real_qty", driver.getQty());
|
status.put("material", driver.getMaterial());
|
||||||
status.put("current_weight", driver.getWeight());
|
status.put("qty", driver.getQty());
|
||||||
} else if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) {
|
status.put("weight", driver.getWeight());
|
||||||
LnshPackagePalletManipulatorDeviceDriver driver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver();
|
status.put("qualified", driver.getQualified());
|
||||||
|
status.put("unqualified", driver.getUnqualified());
|
||||||
status.put("device_status", driver.getStatus());
|
status.put("order_No", driver.getOrder_No());
|
||||||
|
status.put("avg_piece_weight", driver.getAvg_piece_weight());
|
||||||
|
} else if (deviceDriver instanceof LnshPalletizingManipulatorDeviceDriver) {
|
||||||
|
LnshPalletizingManipulatorDeviceDriver driver = (LnshPalletizingManipulatorDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
|
status.put("action", driver.getAction());
|
||||||
status.put("error", driver.getError());
|
status.put("error", driver.getError());
|
||||||
status.put("open_time", driver.getOpen_time());
|
status.put("open_time", driver.getOpen_time());
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
status.put("standby_time", driver.getStandby_time());
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
status.put("production_time", driver.getProduction_time());
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
status.put("error_time", driver.getError_time());
|
||||||
status.put("real_qty", driver.getQty());
|
} else if (deviceDriver instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
|
||||||
} else if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) {
|
LnshPalletizingManipulatorSiteDeviceDriver driver = (LnshPalletizingManipulatorSiteDeviceDriver) deviceDriver;
|
||||||
LnshPalletizingManipulatorDeviceDriver driver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver();
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("move", driver.getMove());
|
||||||
status.put("device_status", driver.getStatus());
|
status.put("action", driver.getAction());
|
||||||
|
status.put("ioaction", driver.getIo_action());
|
||||||
status.put("error", driver.getError());
|
status.put("error", driver.getError());
|
||||||
|
status.put("task", driver.getTask());
|
||||||
|
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());
|
||||||
|
} else if (deviceDriver instanceof LnshKilnTrussDeviceDriver) {
|
||||||
|
LnshKilnTrussDeviceDriver driver = (LnshKilnTrussDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
status.put("open_time", driver.getOpen_time());
|
status.put("open_time", driver.getOpen_time());
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
status.put("standby_time", driver.getStandby_time());
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
status.put("production_time", driver.getProduction_time());
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
status.put("error_time", driver.getError_time());
|
||||||
} else if (device.getDeviceDriver() instanceof LnshKilnTrussDeviceDriver) {
|
status.put("kiln_number", driver.getKiln_number());
|
||||||
LnshKilnTrussDeviceDriver driver = (LnshKilnTrussDeviceDriver) device.getDeviceDriver();
|
status.put("barcode", driver.getBarcode());
|
||||||
|
} else if (deviceDriver instanceof LnshKilnLaneDeviceDriver) {
|
||||||
status.put("device_status", driver.getStatus());
|
LnshKilnLaneDeviceDriver driver = (LnshKilnLaneDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
|
status.put("open_time", driver.getOpen_time());
|
||||||
|
status.put("standby_time", driver.getStandby_time());
|
||||||
|
status.put("production_time", driver.getProduction_time());
|
||||||
|
status.put("error_time", driver.getError_time());
|
||||||
|
status.put("car_sum", driver.getCar_sum());
|
||||||
|
status.put("nullCar_qty", driver.getNullCar_qty());
|
||||||
|
status.put("burning_car_qty", driver.getBurning_car_qty());
|
||||||
|
} else if (deviceDriver instanceof LnshOutKilnTrussDeviceDriver) {
|
||||||
|
LnshOutKilnTrussDeviceDriver driver = (LnshOutKilnTrussDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
|
status.put("outKiln_move", driver.getOutKiln_move());
|
||||||
|
status.put("outKiln_barcode", driver.getOutKiln_barcode());
|
||||||
|
status.put("outKiln_device", driver.getOutKiln_device());
|
||||||
|
status.put("open_time", driver.getOpen_time());
|
||||||
|
status.put("standby_time", driver.getStandby_time());
|
||||||
|
status.put("production_time", driver.getProduction_time());
|
||||||
|
status.put("error_time", driver.getError_time());
|
||||||
|
status.put("cool_number", driver.getCool_number());
|
||||||
|
} else if (deviceDriver instanceof LnshPackagePalletManipulatorDeviceDriver) {
|
||||||
|
LnshPackagePalletManipulatorDeviceDriver driver = (LnshPackagePalletManipulatorDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
status.put("error", driver.getError());
|
status.put("error", driver.getError());
|
||||||
|
status.put("putStation", driver.getPut_station());
|
||||||
|
status.put("material", driver.getMaterial());
|
||||||
|
status.put("qty", driver.getQty());
|
||||||
|
status.put("order_qty", driver.getOrder_qty());
|
||||||
status.put("open_time", driver.getOpen_time());
|
status.put("open_time", driver.getOpen_time());
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
status.put("standby_time", driver.getStandby_time());
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
status.put("production_time", driver.getProduction_time());
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
status.put("error_time", driver.getError_time());
|
||||||
} else if (device.getDeviceDriver() instanceof LnshKilnLaneDeviceDriver) {
|
status.put("order_No", driver.getOrder_No());
|
||||||
LnshKilnLaneDeviceDriver driver = (LnshKilnLaneDeviceDriver) device.getDeviceDriver();
|
status.put("product_code", driver.getProduct_code());
|
||||||
|
status.put("AlongSide", driver.getAlongSide());
|
||||||
status.put("device_status", driver.getStatus());
|
status.put("BshortSide", driver.getBshortSide());
|
||||||
|
status.put("Htrapezoidal", driver.getHtrapezoidal());
|
||||||
|
status.put("Wthickness", driver.getWthickness());
|
||||||
|
} else if (deviceDriver instanceof LnshLaminatingMachineDeviceDriver) {
|
||||||
|
LnshLaminatingMachineDeviceDriver driver = (LnshLaminatingMachineDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("move", driver.getMove());
|
||||||
|
status.put("container_type", driver.getContainer_type());
|
||||||
status.put("error", driver.getError());
|
status.put("error", driver.getError());
|
||||||
|
status.put("task", driver.getTask());
|
||||||
|
} else if (deviceDriver instanceof LnshFoldDiscSiteDeviceDriver) {
|
||||||
|
LnshFoldDiscSiteDeviceDriver driver = (LnshFoldDiscSiteDeviceDriver) deviceDriver;
|
||||||
|
status.put("mode", driver.getMode());
|
||||||
|
status.put("status", driver.getStatus());
|
||||||
status.put("open_time", driver.getOpen_time());
|
status.put("open_time", driver.getOpen_time());
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
status.put("close_time", driver.getClose_time());
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
status.put("standby_time", driver.getStandby_time());
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
status.put("production_time", driver.getProduction_time());
|
||||||
} else if (device.getDeviceDriver() instanceof LnshOutKilnTrussDeviceDriver) {
|
status.put("error_time", driver.getError_time());
|
||||||
LnshOutKilnTrussDeviceDriver driver = (LnshOutKilnTrussDeviceDriver) device.getDeviceDriver();
|
status.put("container_qty", driver.getContainer_qty());
|
||||||
|
|
||||||
status.put("device_status", driver.getStatus());
|
|
||||||
status.put("error", driver.getError());
|
|
||||||
status.put("open_time", driver.getOpen_time());
|
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
|
||||||
} else if (device.getDeviceDriver() instanceof LnshRGVDeviceDriver) {
|
|
||||||
LnshRGVDeviceDriver driver = (LnshRGVDeviceDriver) device.getDeviceDriver();
|
|
||||||
|
|
||||||
status.put("device_status", driver.getStatus());
|
|
||||||
status.put("error", driver.getError());
|
|
||||||
status.put("open_time", driver.getOpen_time());
|
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
|
||||||
} else if (device.getDeviceDriver() instanceof LnshPackageLineDeviceDriver) {
|
|
||||||
LnshPackageLineDeviceDriver driver = (LnshPackageLineDeviceDriver) device.getDeviceDriver();
|
|
||||||
|
|
||||||
status.put("device_status", driver.getStatus());
|
|
||||||
status.put("error", driver.getError());
|
|
||||||
status.put("open_time", driver.getOpen_time());
|
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
|
||||||
} else if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
|
|
||||||
LnshFoldDiscSiteDeviceDriver driver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
|
|
||||||
|
|
||||||
status.put("device_status", driver.getStatus());
|
|
||||||
status.put("error", driver.getError());
|
|
||||||
status.put("open_time", driver.getOpen_time());
|
|
||||||
status.put("stand_time", driver.getStandby_time() / 3600);
|
|
||||||
status.put("work_time", driver.getProduction_time() / 3600);
|
|
||||||
status.put("error_time", driver.getError_time() / 3600);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,15 +10,17 @@ import org.nl.acs.device_driver.DeviceDriver;
|
|||||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||||
import org.nl.acs.device_driver.LinewayDeviceDriver;
|
import org.nl.acs.device_driver.LinewayDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
|
import org.nl.acs.device_driver.driver.OpcDeviceDriver;
|
||||||
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoInitial {
|
public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoInitial {
|
||||||
private List<Device> devices = new ArrayList();
|
private List<Device> devices = new ArrayList<>();
|
||||||
private List<String> code_indexs = new ArrayList();
|
private List<String> code_indexs = new ArrayList();
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceManageService deviceManageService;
|
private DeviceManageService deviceManageService;
|
||||||
@@ -36,18 +38,12 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator var2 = this.findAllDevice().iterator();
|
List<Device> list = this.devices.stream().filter(d -> device_code.equals(d.getDevice_code())).collect(Collectors.toList());
|
||||||
|
if (list.isEmpty()) {
|
||||||
Device device;
|
return null;
|
||||||
do {
|
} else {
|
||||||
if (!var2.hasNext()) {
|
return list.get(0);
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
device = (Device) var2.next();
|
|
||||||
} while (!StrUtil.equals(device.getDevice_code(), device_code));
|
|
||||||
|
|
||||||
return device;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Device findDeviceByAddress(String address) {
|
public Device findDeviceByAddress(String address) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -71,3 +71,86 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "3"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
p.point_code AS device_code,
|
||||||
|
p.point_name,
|
||||||
|
p.point_status,
|
||||||
|
p.region_code,
|
||||||
|
p.point_type,
|
||||||
|
p.vehicle_type,
|
||||||
|
p.vehicle_code,
|
||||||
|
p.sort_seq,
|
||||||
|
vd.qty,
|
||||||
|
vd.weight,
|
||||||
|
vd.stand_status,
|
||||||
|
vd.create_time,
|
||||||
|
mb.material_number,
|
||||||
|
mb.material_name,
|
||||||
|
d.device_name,
|
||||||
|
vd.in_kiln_time,
|
||||||
|
vd.out_kiln_time
|
||||||
|
FROM
|
||||||
|
sch_base_point p
|
||||||
|
LEFT JOIN st_ivt_vehicle_detail vd ON p.vd_id = vd.vd_id
|
||||||
|
LEFT JOIN md_me_materialbase mb ON vd.material_id = mb.material_id
|
||||||
|
LEFT JOIN pdm_bi_device d ON vd.kiln_number = d.device_code
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "4"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
wo.device_code,
|
||||||
|
mb.material_number
|
||||||
|
FROM
|
||||||
|
pdm_bd_workorder wo
|
||||||
|
LEFT JOIN md_me_materialbase mb ON wo.material_id = mb.material_id
|
||||||
|
WHERE
|
||||||
|
wo.is_delete = '0'
|
||||||
|
AND wo.order_status = '3'
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "5"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
wo.device_code,
|
||||||
|
mb.material_name,
|
||||||
|
wo.kh,
|
||||||
|
SUM(wod.weight) AS weight,
|
||||||
|
SUM(wod.qty) AS qty
|
||||||
|
FROM
|
||||||
|
pdm_bd_work_order_daily wod
|
||||||
|
LEFT JOIN pdm_bd_workorder wo ON wod.workorder_id = wo.workorder_id
|
||||||
|
LEFT JOIN md_me_materialbase mb ON wo.material_id = mb.material_id
|
||||||
|
WHERE
|
||||||
|
TO_DAYS(wod.date) = TO_DAYS(NOW())
|
||||||
|
GROUP BY
|
||||||
|
wod.workorder_id, TO_DAYS(wod.date)
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "6"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
vd.qty,
|
||||||
|
mb.material_name,
|
||||||
|
wo.kh,
|
||||||
|
wo.device_code
|
||||||
|
FROM
|
||||||
|
st_ivt_vehicle_detail vd
|
||||||
|
LEFT JOIN md_me_materialbase mb ON vd.material_id = mb.material_id
|
||||||
|
LEFT JOIN pdm_bd_workorder wo ON vd.workorder_id = wo.workorder_id
|
||||||
|
WHERE
|
||||||
|
vd.is_delete = '0'
|
||||||
|
AND vd.vehicle_type = '2'
|
||||||
|
AND TO_DAYS(vd.out_kiln_time) = TO_DAYS(NOW())
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
@@ -221,4 +221,12 @@ public class AcsToWmsController {
|
|||||||
public ResponseEntity<JSONObject> fjNeed(@RequestBody JSONObject param) {
|
public ResponseEntity<JSONObject> fjNeed(@RequestBody JSONObject param) {
|
||||||
return ResponseEntity.ok(acsToWmsService.fjNeed(param));
|
return ResponseEntity.ok(acsToWmsService.fjNeed(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/equipmentFailure")
|
||||||
|
@Log("设备故障")
|
||||||
|
@ApiOperation("设备故障")
|
||||||
|
@SaIgnore
|
||||||
|
public void equipmentFailure(@RequestBody JSONObject param) {
|
||||||
|
acsToWmsService.equipmentFailure(param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,4 +116,6 @@ public interface AcsToWmsService {
|
|||||||
JSONObject fjCallEmpty(JSONObject param);
|
JSONObject fjCallEmpty(JSONObject param);
|
||||||
|
|
||||||
JSONObject fjNeed(JSONObject param);
|
JSONObject fjNeed(JSONObject param);
|
||||||
|
|
||||||
|
void equipmentFailure(JSONObject param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1098,9 +1098,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||||
regionIn.put("dDate", DateUtil.now());
|
regionIn.put("dDate", DateUtil.now());
|
||||||
regionIn.put("cVouchType", RegionInType.BCPRK.label());
|
regionIn.put("cVouchType", RegionInType.WGRK.label());
|
||||||
regionIn.put("cMocode", dd);
|
regionIn.put("cMocode", dd);
|
||||||
regionIn.put("cInvCode", detail.getString("material_number"));
|
String materialNumber = detail.getString("material_number");
|
||||||
|
if (materialNumber.startsWith("W")) {
|
||||||
|
materialNumber = "F" + materialNumber.substring(1);
|
||||||
|
}
|
||||||
|
regionIn.put("cInvCode", materialNumber);
|
||||||
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight") / 1000));
|
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight") / 1000));
|
||||||
regionIn.put("iNum", detail.getIntValue("qty"));
|
regionIn.put("iNum", detail.getIntValue("qty"));
|
||||||
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
||||||
@@ -1177,9 +1181,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
regionIn.put("id", IdUtil.getSnowflake(1L, 1L).nextId());
|
||||||
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
regionIn.put("cCode", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||||
regionIn.put("dDate", DateUtil.now());
|
regionIn.put("dDate", DateUtil.now());
|
||||||
regionIn.put("cVouchType", RegionInType.BCPRK.label());
|
regionIn.put("cVouchType", RegionInType.WGRK.label());
|
||||||
regionIn.put("cMocode", dd);
|
regionIn.put("cMocode", dd);
|
||||||
regionIn.put("cInvCode", detail.getString("material_number"));
|
String materialNumber = detail.getString("material_number");
|
||||||
|
if (materialNumber.startsWith("W")) {
|
||||||
|
materialNumber = "F" + materialNumber.substring(1);
|
||||||
|
}
|
||||||
|
regionIn.put("cInvCode", materialNumber);
|
||||||
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight2") / 1000));
|
regionIn.put("iQuantity", String.format("%.3f", detail.getDoubleValue("weight2") / 1000));
|
||||||
regionIn.put("iNum", detail.getIntValue("qty2"));
|
regionIn.put("iNum", detail.getIntValue("qty2"));
|
||||||
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
regionIn.put("iinvexchrate", String.format("%.5f", detail.getDoubleValue("dz") / 1000));
|
||||||
@@ -1256,4 +1264,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
result.put("message", "反馈成功!");
|
result.put("message", "反馈成功!");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void equipmentFailure(JSONObject param) {
|
||||||
|
String deviceCode = param.getString("device_code");
|
||||||
|
if (StrUtil.isNotBlank(deviceCode)) {
|
||||||
|
JSONObject dn = new JSONObject();
|
||||||
|
dn.put("data_id", IdUtil.getSnowflake().nextId());
|
||||||
|
dn.put("device_code", deviceCode);
|
||||||
|
dn.put("failure_time", DateUtil.now());
|
||||||
|
WQLObject.getWQLObject("das_device_number").insert(dn);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,13 +89,7 @@ public class PdaController {
|
|||||||
throw new BadRequestException("载具编码不能为空!");
|
throw new BadRequestException("载具编码不能为空!");
|
||||||
}
|
}
|
||||||
int qty = param.getIntValue("qty");
|
int qty = param.getIntValue("qty");
|
||||||
if (qty == 0) {
|
|
||||||
throw new BadRequestException("数量不能为零!");
|
|
||||||
}
|
|
||||||
double weight = param.getDoubleValue("weight");
|
double weight = param.getDoubleValue("weight");
|
||||||
if (weight == 0) {
|
|
||||||
throw new BadRequestException("重量不能为零!");
|
|
||||||
}
|
|
||||||
|
|
||||||
pdaService.sendMaterial(point_code, vehicle_code, qty, weight, param.toJSONString());
|
pdaService.sendMaterial(point_code, vehicle_code, qty, weight, param.toJSONString());
|
||||||
return PdaUtils.buildSuccessResultJSON(null);
|
return PdaUtils.buildSuccessResultJSON(null);
|
||||||
|
|||||||
@@ -696,10 +696,10 @@ public class WorkorderServiceImpl implements WorkordeService {
|
|||||||
workOrder.put("qualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qualified_qty")).sum());
|
workOrder.put("qualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qualified_qty")).sum());
|
||||||
workOrder.put("unqualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("unqualified_qty")).sum());
|
workOrder.put("unqualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("unqualified_qty")).sum());
|
||||||
workOrder.put("avg_piece_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("avg_piece_weight")).sum() / workOrderDailyList.size());
|
workOrder.put("avg_piece_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("avg_piece_weight")).sum() / workOrderDailyList.size());
|
||||||
workOrder.put("order_status", WorkOrderEnum.ORDER_STATUS_STOP.value());
|
|
||||||
TaskUtils.addACSUpdateColum(workOrder);
|
|
||||||
workOrderTable.update(workOrder);
|
|
||||||
}
|
}
|
||||||
|
workOrder.put("order_status", WorkOrderEnum.ORDER_STATUS_STOP.value());
|
||||||
|
TaskUtils.addACSUpdateColum(workOrder);
|
||||||
|
workOrderTable.update(workOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -722,9 +722,9 @@ public class WorkorderServiceImpl implements WorkordeService {
|
|||||||
workOrder.put("qualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qualified_qty")).sum());
|
workOrder.put("qualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("qualified_qty")).sum());
|
||||||
workOrder.put("unqualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("unqualified_qty")).sum());
|
workOrder.put("unqualified_qty", workOrderDailyList.stream().mapToInt(o -> ((JSONObject) o).getIntValue("unqualified_qty")).sum());
|
||||||
workOrder.put("avg_piece_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("avg_piece_weight")).sum() / workOrderDailyList.size());
|
workOrder.put("avg_piece_weight", workOrderDailyList.stream().mapToDouble(o -> ((JSONObject) o).getDoubleValue("avg_piece_weight")).sum() / workOrderDailyList.size());
|
||||||
workOrder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value());
|
|
||||||
TaskUtils.addACSUpdateColum(workOrder);
|
|
||||||
workOrderTable.update(workOrder);
|
|
||||||
}
|
}
|
||||||
|
workOrder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value());
|
||||||
|
TaskUtils.addACSUpdateColum(workOrder);
|
||||||
|
workOrderTable.update(workOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package org.nl.wms.sch.manage;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
|
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||||
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||||
|
import org.nl.wms.sch.task.util.TaskUtils;
|
||||||
|
import org.redisson.api.RLock;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangjiangwei
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Component("autoUpdateWorkOrder")
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class AutoUpdateWorkOrder {
|
||||||
|
|
||||||
|
private final WmsToAcsService wmsToAcsService;
|
||||||
|
|
||||||
|
private final RedissonClient redissonClient;
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public void run() {
|
||||||
|
RLock lock = redissonClient.getFairLock("autoUpdateWorkOrder");
|
||||||
|
boolean tryLock = false;
|
||||||
|
try {
|
||||||
|
tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
if (tryLock) {
|
||||||
|
|
||||||
|
JSONArray wo = WQL.getWO("MANAGE_QUERY").addParam("flag", "3").process().getResultJSONArray(0);
|
||||||
|
|
||||||
|
JSONObject responseBody = wmsToAcsService.getDeviceStatus(wo);
|
||||||
|
if ("200".equals(responseBody.getString("status"))) {
|
||||||
|
JSONArray data = responseBody.getJSONArray("data");
|
||||||
|
if (ObjectUtil.isNotEmpty(data)) {
|
||||||
|
WQLObject wodTable = WQLObject.getWQLObject("pdm_bd_work_order_daily");
|
||||||
|
String today = DateUtil.today();
|
||||||
|
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
JSONObject datum = data.getJSONObject(i);
|
||||||
|
|
||||||
|
long workOrderId = datum.getLongValue("workorder_id");
|
||||||
|
JSONObject wod = wodTable.query("workorder_id = " + workOrderId + " AND date = '" + today + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(wod)) {
|
||||||
|
wod = new JSONObject();
|
||||||
|
wod.put("id", IdUtil.getSnowflake().nextId());
|
||||||
|
wod.put("date", today);
|
||||||
|
wod.put("workorder_id", workOrderId);
|
||||||
|
wod.put("qty", datum.getIntValue("qty"));
|
||||||
|
wod.put("qualified_qty", datum.getIntValue("qualified_qty"));
|
||||||
|
wod.put("unqualified_qty", datum.getIntValue("unqualified_qty"));
|
||||||
|
wod.put("weight", datum.getDoubleValue("weight"));
|
||||||
|
wod.put("avg_piece_weight", datum.getDoubleValue("avg_piece_weight") / 1000);
|
||||||
|
TaskUtils.addAutoCreateColum(wod);
|
||||||
|
wodTable.insert(wod);
|
||||||
|
} else {
|
||||||
|
if (TrueOrFalse.TRUE.value().equals(wod.getString("is_report"))) {
|
||||||
|
wod.put("qty", datum.getIntValue("qty") + wod.getIntValue("qty"));
|
||||||
|
wod.put("qualified_qty", datum.getIntValue("qualified_qty") + wod.getIntValue("qualified_qty"));
|
||||||
|
wod.put("unqualified_qty", datum.getIntValue("unqualified_qty") + wod.getIntValue("unqualified_qty"));
|
||||||
|
wod.put("weight", datum.getDoubleValue("weight") + wod.getIntValue("weight"));
|
||||||
|
wod.put("avg_piece_weight", datum.getDoubleValue("avg_piece_weight") / 1000);
|
||||||
|
TaskUtils.addAutoUpdateColum(wod);
|
||||||
|
wodTable.update(wod);
|
||||||
|
} else {
|
||||||
|
wod.put("qty", datum.getIntValue("qty"));
|
||||||
|
wod.put("qualified_qty", datum.getIntValue("qualified_qty"));
|
||||||
|
wod.put("unqualified_qty", datum.getIntValue("unqualified_qty"));
|
||||||
|
wod.put("weight", datum.getDoubleValue("weight"));
|
||||||
|
wod.put("avg_piece_weight", datum.getDoubleValue("avg_piece_weight") / 1000);
|
||||||
|
TaskUtils.addAutoUpdateColum(wod);
|
||||||
|
wodTable.update(wod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("auto update work order error !", e);
|
||||||
|
} finally {
|
||||||
|
if (tryLock) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package org.nl.wms.sch.manage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zhangjiangwei
|
|
||||||
*/
|
|
||||||
public class AutoUpdateWorkOrderDaily {
|
|
||||||
}
|
|
||||||
@@ -69,3 +69,19 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "3"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
wo.workorder_id,
|
||||||
|
d.device_code
|
||||||
|
FROM
|
||||||
|
pdm_bd_workorder wo
|
||||||
|
LEFT JOIN pdm_bi_device d ON wo.device_id = d.device_id
|
||||||
|
WHERE
|
||||||
|
wo.is_delete = '0'
|
||||||
|
AND wo.order_status = '3'
|
||||||
|
AND d.region_code IN ('YZ', 'FJ')
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
@@ -164,4 +164,10 @@ public class TaskUtils {
|
|||||||
row.put("create_name", SecurityUtils.getCurrentNickName());
|
row.put("create_name", SecurityUtils.getCurrentNickName());
|
||||||
row.put("create_time", DateUtil.now());
|
row.put("create_time", DateUtil.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addAutoCreateColum(JSONObject row) {
|
||||||
|
row.put("create_id", AutoCreate.id);
|
||||||
|
row.put("create_name", AutoCreate.nick_name);
|
||||||
|
row.put("create_time", DateUtil.now());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ spring:
|
|||||||
freemarker:
|
freemarker:
|
||||||
check-template-location: false
|
check-template-location: false
|
||||||
profiles:
|
profiles:
|
||||||
active: prod
|
active: dev
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
data:
|
data:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.nl.test;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -9,6 +10,9 @@ import org.nl.modules.wql.core.bean.WQLObject;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangjiangwei
|
* @author zhangjiangwei
|
||||||
* @date 2023/03/02 16:54
|
* @date 2023/03/02 16:54
|
||||||
@@ -19,26 +23,13 @@ public class PointTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01() {
|
public void test01() {
|
||||||
JSONObject point = new JSONObject();
|
JSONArray jsonArray = WQLObject.getWQLObject("sch_base_point").query("region_code = 'YHHJ'").getResultJSONArray(0);
|
||||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
List<Object> list = jsonArray.stream().sorted((o1, o2) -> Integer.compare(((JSONObject) o1).getIntValue("sort_seq"), ((JSONObject) o2).getIntValue("sort_seq"))).collect(Collectors.toList());
|
||||||
String now = DateUtil.now();
|
JSONArray a1 = new JSONArray();
|
||||||
for (int i = 1; i <= 9; i++) {
|
for (Object o : list) {
|
||||||
if (i == 7) {
|
a1.add(o);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
point.put("point_id", IdUtil.getSnowflake(1L, 1L).nextId());
|
|
||||||
point.put("point_code", "YJ" + String.format("%02d", i) + "SL01");
|
|
||||||
point.put("point_name", "压机" + i + "上料位");
|
|
||||||
point.put("point_type", "2");
|
|
||||||
point.put("region_id", 1695713335233875968L);
|
|
||||||
point.put("region_code", "YZ");
|
|
||||||
point.put("region_name", "压制区");
|
|
||||||
point.put("device_code", "YJ" + String.format("%02d", i));
|
|
||||||
point.put("lock_type", "1");
|
|
||||||
point.put("create_id", 1);
|
|
||||||
point.put("create_name", "管理员");
|
|
||||||
point.put("create_time", now);
|
|
||||||
point_table.insert(point);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(a1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,9 +70,6 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="设备产能">
|
|
||||||
<el-input v-model="form.productivity" type="number" style="width: 300px" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否工单设备" prop="is_workorder">
|
<el-form-item label="是否工单设备" prop="is_workorder">
|
||||||
<el-radio v-model="form.is_workorder" label="1">是</el-radio>
|
<el-radio v-model="form.is_workorder" label="1">是</el-radio>
|
||||||
<el-radio v-model="form.is_workorder" label="0">否</el-radio>
|
<el-radio v-model="form.is_workorder" label="0">否</el-radio>
|
||||||
@@ -123,11 +120,6 @@
|
|||||||
{{ dict.label.pdm_device_type[scope.row.device_model] }}
|
{{ dict.label.pdm_device_type[scope.row.device_model] }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
|
||||||
prop="productivity"
|
|
||||||
label="设备产能"
|
|
||||||
:min-width="flexWidth('productivity',crud.data,'设备产能')"
|
|
||||||
/>
|
|
||||||
<el-table-column prop="is_workorder" label="是否工单设备" :min-width="flexWidth('is_workorder',crud.data,'是否工单设备')">
|
<el-table-column prop="is_workorder" label="是否工单设备" :min-width="flexWidth('is_workorder',crud.data,'是否工单设备')">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ dict.label.true_or_false[scope.row.is_workorder] }}
|
{{ dict.label.true_or_false[scope.row.is_workorder] }}
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ export default {
|
|||||||
return CRUD({
|
return CRUD({
|
||||||
title: '工单', url: 'api/workorder', idField: 'workorder_id', sort: 'workorder_id,desc',
|
title: '工单', url: 'api/workorder', idField: 'workorder_id', sort: 'workorder_id,desc',
|
||||||
optShow: {
|
optShow: {
|
||||||
add: false,
|
add: true,
|
||||||
edit: false,
|
edit: false,
|
||||||
del: false,
|
del: false,
|
||||||
download: false,
|
download: false,
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ export default {
|
|||||||
return CRUD({
|
return CRUD({
|
||||||
title: '工单', url: 'api/workorder', idField: 'workorder_id', sort: 'workorder_id,desc',
|
title: '工单', url: 'api/workorder', idField: 'workorder_id', sort: 'workorder_id,desc',
|
||||||
optShow: {
|
optShow: {
|
||||||
add: false,
|
add: true,
|
||||||
edit: false,
|
edit: false,
|
||||||
del: false,
|
del: false,
|
||||||
download: false,
|
download: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user