From 6d3ea08855337c0cfcc60df2903d3431611c7097 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 13 十二月 2025 17:36:56 +0800
Subject: [PATCH] 优化程序,输送线入库按钮对接
---
项目代码/WCSServices/WIDESEAWCS_Tasks/一期线体/ConveyorLineJob1.cs | 91 +++++++++++++++++++++++++++++++++++++++++----
1 files changed, 83 insertions(+), 8 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
index 35a4301..ba907c7 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Components.Routing;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Quartz;
using System;
using System.Collections.Generic;
@@ -9,6 +10,7 @@
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
+using System.Text.Unicode;
using System.Threading.Tasks;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.Helper;
@@ -42,7 +44,8 @@
private readonly IRouterRepository _routerRepository;
private readonly IRouterService _routerService;
private readonly IRouterExtension _routerExtension;
-
+ private static string BarCode1 = "";
+ private static string BarCode2 = "";
public ConveyorLineJob1(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension)
{
_cacheService = cacheService;
@@ -54,7 +57,16 @@
_routerService = routerService;
_routerExtension = routerExtension;
}
-
+ /*
+ 1鍙蜂綅鍑哄簱鍙e厑璁告斁绠� 0
+ 1鍙蜂綅鏀剧瀹屾垚淇″彿 21
+ 6鍙蜂綅鎷i�変綅鏂欑鍒拌揪 1
+ 6鍙蜂綅鎷i�変綅鏂欑鏉$爜 2
+ 6鍙蜂綅鎷i�変綅鏂欑娴佸姩 22
+ 8鍙蜂綅鍏ュ簱鍙e厑璁稿彇绠� 11
+ 8鍙蜂綅鍏ュ簱鍙f枡绠辨潯鐮� 12
+ 8鍙蜂綅鏈哄櫒浜哄彇绠卞畬鎴� 23
+ */
public Task Execute(IJobExecutionContext context)
{
try
@@ -65,13 +77,76 @@
OtherDevice device = (OtherDevice)value;
List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
- foreach (var item in stationMangers)
+ foreach (var station in stationMangers)
{
- byte[] bytesPut = device.Communicator.Read("22", 1);
- ;
- device.Communicator.Write("22", new byte[] { 2, 0 });
- byte[] bytesPuted = device.Communicator.Read("22",1);
- device.Communicator.Write("22", new byte[] { 0, 0 });
+ if (station.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt())
+ {
+
+ //鎷i�夌敵璇�
+ short pickArrived = device.Communicator.Read<short>("1");
+ if (pickArrived == 256)
+ {
+ byte[] bytesPick = device.Communicator.Read("2", 5);
+ string pickBarCode = Encoding.UTF8.GetString(bytesPick).Replace("\0", "").Replace("\\0", "");
+ //涓婃姤WMS鏂欑鍒拌揪
+ if (pickBarCode.IsNotEmptyOrNull())
+ {
+ if (device.DeviceCode == "CL1" && BarCode1!= pickBarCode)
+ {
+ WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, pickBarCode);
+ if (content.Status)
+ {
+ WriteInfo(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶ユ垚鍔焮pickBarCode}");
+ }
+ else
+ {
+ WriteError(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶MS閿欒{pickBarCode}锛屼俊鎭瘂content.Message}");
+ }
+ BarCode1 = pickBarCode;
+ }
+ if (device.DeviceCode == "CL2" && BarCode1 != pickBarCode)
+ {
+ WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, pickBarCode);
+ if (content.Status)
+ {
+ WriteInfo(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶ユ垚鍔焮pickBarCode}");
+ }
+ else
+ {
+ WriteError(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶MS閿欒{pickBarCode}锛屼俊鎭瘂content.Message}");
+ }
+ BarCode2 = pickBarCode;
+ }
+ }
+ else
+ {
+ WriteError(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂负{pickArrived}鏉$爜涓虹┖鍊�");
+ }
+ }
+ }
+ else
+ {
+ //鍏ュ簱鐢宠
+ short InTake = device.Communicator.Read<short>("11");
+ byte[] bytesIn = device.Communicator.Read("12", 5);
+ string InBarCode = Encoding.UTF8.GetString(bytesIn).Replace("\0", "").Replace("\\0", "");
+ if (InTake==256 && InBarCode.IsNotEmptyOrNull())
+ {
+ //鐢宠鍏ュ簱浠诲姟
+ Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == InBarCode && x.TaskType == TaskTypeEnum.Inbound.ObjToInt() && x.TaskState != TaskStatusEnum.CL_Executing.ObjToInt() && x.DeviceCode==device.DeviceCode);
+ if (task != null) continue;
+
+ WebResponseContent content = _taskService.RequestInTask(station.StationCode, InBarCode);
+ if (content.Status)
+ {
+ WriteInfo(device.DeviceCode, $"绔欏彴{station.StationCode}鏂欑{InBarCode}鐢宠鍏ュ簱鎴愬姛");
+ }
+ else
+ {
+ WriteError(device.DeviceCode, $"绔欏彴{station.StationCode}鏂欑{InBarCode}鐢宠鍏ュ簱浠诲姟閿欒锛屼俊鎭瘂content.Message}");
+ }
+ }
+ }
}
}
}
--
Gitblit v1.9.3