From d2cef0150abe6d14cbfa60c8845795b91a1f5f97 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 20 四月 2024 19:50:53 +0800
Subject: [PATCH] 添加入库触发条件,修改上料区任务逻辑
---
代码管理/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs | 59 +++++++++
代码管理/PCS/WCS_Client/src/api/http.js | 2
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs | 79 +++++++++++++
代码管理/PCS/WCS_Server/WIDESEA_WCS/WCSClient/DBExtension.cs | 47 +++++++
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs | 5
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs | 23 ---
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs | 8 -
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs | 78 +-----------
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 12 +
代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs | 44 ------
代码管理/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json | 2
11 files changed, 208 insertions(+), 151 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js"
index f6b7a14..8ecd457 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Client/src/api/http.js"
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
- axios.defaults.baseURL = 'http://192.168.12.101:8099/';
+ axios.defaults.baseURL = 'http://127.0.0.1:8099/';
}
else if (process.env.NODE_ENV == 'debug') {
axios.defaults.baseURL = 'http://192.168.12.101:8099/';
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs"
new file mode 100644
index 0000000..eeab48c
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/PLCDBItem/StackerReadDBItem.cs"
@@ -0,0 +1,59 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm.PLCDBItem
+{
+ /// <summary>
+ /// 杈婇亾淇℃伅
+ /// </summary>
+ public class StackerReadDBItem
+ {
+ public event Action<string, StackerReadDBItem> OnReadStackerSignal;
+
+ /// <summary>
+ /// 杈婇亾缂栧彿
+ /// </summary>
+ public string StackerNo { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆SN鍙�
+ /// </summary>
+ public string R_wheel_SN { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆绫诲瀷
+ /// </summary>
+ public Int16 R_wheel_type { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆闆朵欢鐘舵��
+ /// </summary>
+ public byte R_part_status { get; set; }
+
+ /// <summary>
+ /// 杞﹁疆闆朵欢宸ヨ壓
+ /// </summary>
+ public byte R_part_process { get; set; }
+
+ /// <summary>
+ /// 杈婇亾machine_nr
+ /// </summary>
+ public bool R_machine_nr { get; set; }
+
+ /// <summary>
+ /// 璇诲彇杈婇亾direction
+ /// </summary>
+ public byte R_direction { get; set; }
+
+ public void ReadSignal(string signalType, StackerReadDBItem dBItem)
+ {
+ Task.Run(() =>
+ {
+ OnReadStackerSignal?.Invoke(signalType, dBItem);
+ });
+ }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
index 3efdf48..65f8cb7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
@@ -695,15 +695,19 @@
if (Stationinfo != null)
{
+
+ #region 鎹㈢被鍨嬬洿鎺ュ叆搴�
+ var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault();
+ if (stationinfo1 != null)
+ agvtask(stationinfoRepository, stationinfo1, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
+ #endregion
+
#region 鎵樼洏杞﹁疆鍫嗗灈绗洓涓椂涓嬪彂鍙﹀涓�涓倝鍙风殑鍏ュ簱浠诲姟
if (Stationinfo.quantity + 1 >= 4)
{
var stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
- //foreach (var stationinfo in stationinfos)
- //{
if (stationinfo != null)
agvtask(stationinfoRepository, stationinfo, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
- //}
}
#endregion
@@ -836,7 +840,7 @@
agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound");
continue;
}
-
+
#endregion
Stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
index 4a65288..231a254 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
@@ -23,7 +23,6 @@
try
{
ExecuteJob(context, DoAction);
-
}
catch { }
return Task.CompletedTask;
@@ -31,15 +30,8 @@
private void DoAction(IJobExecutionContext context)
{
- //throw new NotImplementedException();
- //Creation.PLCinfodetail();
- //ReplaceTray.a();
- //EmptyTrayTask.InEmptyTrayTask(); //搴撳唴绌烘墭浠诲姟
- //EmptyTrayTask.task();
-
StationTask.CreateTask();
OutboundTask.CreateOutboundTask();//浼樺寲鍚庡嚭搴撻�昏緫
- //OutboundTask_a.CreateOutboundTask();
ReplaceTray.ReplaceTrayTask();
RestockHCJ.HCJGetBarcode();
EmptyTrayTask.CreateEmptyTrayTask();
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
index 3f299ad..eed63b1 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/PipelineJob.cs"
@@ -79,12 +79,6 @@
///鏌ユ壘涓婃枡鍖虹殑璐т綅
var Stations = stationinfoRepository.Find(x => x.area == area_code(number)).OrderBy(x => x.lastUpdateTime);//鏍规嵁鏃堕棿鍏堝悗鎺掑簭
- //缂撳瓨鏋舵湭鍚敤绂佹妗佹灦杩涘叆
- //foreach (var station in Stations)
- //{
- // if (!station.enable || station.location_state != LocationStateEnum.Stroge.ToString())
- // Gantry_client.WriteByOrder("W_RequestUnload", false, number);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
- //}
var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).FirstOrDefault();
if (Station != null)
@@ -107,7 +101,6 @@
WriteDBLog.Error("涓婃枡鍖�", $"鍐欏叆妗佹灦淇℃伅锛歕nW_RequestUnload锛歠alse\n\n{Station.stationCode}杞﹁疆鏁伴噺涓嶴N鍙锋暟閲忎笉涓�鑷�", "PCS");
#endregion
return;
- //throw new Exception("涓婃枡浣嶈溅杞暟閲忎笌SN鍙锋暟閲忎笉涓�鑷达紝涓婃枡浣嶇紪鍙凤細" + Station.stationCode);
}
var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == Station.stationCode).ToList();
var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
@@ -150,7 +143,6 @@
Station.location_state = LocationStateEnum.Abnormal.ToString();
Station.remark = $"鏈煡璇㈠埌SN鍙凤細{SNS[SNS.Length - 1]}鐨勮鍗�";
stationinfoRepository.Update(Station, true);
- //throw new Exception($"鏈煡璇㈠埌SN鍙凤細{SNS[SNS.Length - 1]}鐨勮鍗曪紝涓婃枡浣嶇紪鍙凤細{Station.stationCode}");
WriteDBLog.Error("涓婃枡鍖轰俊鎭煡璇�", $"鍐欏叆妗佹灦淇℃伅锛歕nW_RequestUnload锛歠alse\n\n{Station.stationCode}鏈煡璇㈠埌SN鍙凤細{SNS[SNS.Length - 1]}鐨勮鍗�", "PCS");
return;
}
@@ -168,7 +160,6 @@
if (Station.quantity <= 0)
{
Station.stationType = string.Empty;
- //Station.location_state = LocationStateEnum.Empty.ToString();
Station.Number = string.Empty;
Station.heatNumber = string.Empty;
Station.tray_status = "EmptyTray";
@@ -177,7 +168,6 @@
if (count < 1)
{
WriteDBLog.Error("鍙栨枡瀹屾垚", $"涓婃枡浣嶄俊鎭洿鏂板け璐ワ紒涓婃枡浣嶇紪鍙凤細{Station.stationCode}", "PCS");
- //throw new Exception($"涓婃枡浣嶄俊鎭洿鏂板け璐ワ紒涓婃枡浣嶇紪鍙凤細{Station.stationCode}");
return;
}
@@ -186,7 +176,6 @@
Gantry_client.WriteByOrder("W_IndexNr", (Int16)0, number);//鎵樼洏涓婄殑绗嚑涓溅杞�
Gantry_client.WriteByOrder("W_Storage_Type", (Int16)0, number); //鎵樼洏绫诲瀷1-妯斁;2-绔栨斁
Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)0, number);//杞﹁疆绫诲瀷
- //Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//杞﹁疆SN鍙�
#endregion
Gantry_client.WriteByOrder("W_Storage_update", true, number);//璐т綅鐘舵�佹洿鏂�
@@ -220,7 +209,6 @@
catch (Exception ex)
{
WriteDBLog.Error("涓婃枡鍖�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
- //WritePCSLog.LogAdd(requestin.AreaNr.ToString(), respone.success == 1 ? "鎴愬姛 " : "澶辫触", "WMS", "AGV", json, JsonConvert.SerializeObject(respone), remark, "妫�娴嬬嚎涓婃枡鍖�", ex.Message);
}
}
/// <summary>
@@ -240,13 +228,13 @@
List<string> stationCodes = new List<string>() { "S01001001", "S01001002", "W01001001", "W01001002", "W01001003" };
foreach (var stationCode in stationCodes)
{
- if (agvtaskService.Find(x => x.agv_fromaddress == stationCode || x.agv_toaddress == stationCode).Any())
+ if (agvtaskService.Find(x => x.agv_fromaddress == stationCode /*|| x.agv_toaddress == stationCode*/).Any())
continue;
+ var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault();
+ if (station == null) continue;
var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == stationCode).ToList();
var PalletSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
var MaterialSignal = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), client);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
- var station = stationinfoRepository.Find(x => x.stationCode == stationCode && x.enable).FirstOrDefault();
- if (station == null) continue;
if (PalletSignal == 1 && MaterialSignal == 2 && (station.stationCode.Contains("S0100100") ? station.tray_status == "EmptyTray" : true))
{
var area = station.tray_type == "SmallTray" ? "11" : "10";
@@ -275,32 +263,6 @@
if (EmptyStation == null)//鏌ユ壘搴撳唴绌烘墭鐩�
EmptyStation = GetStation.EmptyPalletStation(area);
- #region 鏌ユ壘搴撳尯涓�绌烘墭鐩樼┖璐т綅
- // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.location_state != LocationStateEnum.Busy.ToString() && x.enable)
- //.OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鏌ユ壘娌℃湁浠诲姟鐨勭┖鎵樼洏璐т綅
-
- // if (EmptyStation != null)
- // {
- // if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.location_state.Contains("Busy")).Any())
- // {
- // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") && x.column != EmptyStation.column && x.location_state != LocationStateEnum.Busy.ToString() && x.enable).OrderBy(x => x.column).ThenByDescending(x => x.line).FirstOrDefault();//鎺掗櫎褰撳垪瀛樺湪浠诲姟鐨勮揣浣�
- // }
- // if (EmptyStation != null && EmptyStation.line == 2)//濡傛灉浠诲姟瀛樺湪绗簩琛�,鎺掓煡绗竴琛屾槸鍚︽湁璐�
- // {
- // if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.stationCode.Contains("A") && x.column == EmptyStation.column && x.line == 1 && x.location_state != LocationStateEnum.Empty.ToString()).Any()) EmptyStation = null;
- // }
- // }
-
- // if (EmptyStation == null)
- // {
- // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Busy.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鏈�鍚庝竴涓揣浣嶆湁浠诲姟鍒欎笉鑳界敓鎴愬叆搴撲换鍔�
- // if (EmptyStation != null) continue;
- // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Stroge.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();//鎵炬渶澶栭潰娌″爢婊�5涓殑璐т綅
- // if (EmptyStation == null)
- // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
- // }
-
- #endregion
if (EmptyStation != null)
{
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs"
new file mode 100644
index 0000000..9023d59
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/equipment/VK4Job.cs"
@@ -0,0 +1,79 @@
+锘縰sing OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm.PLCDBItem;
+using WIDESEA_Core.Extensions;
+using WIDESEA_WCS.Jobs;
+using WIDESEA_WCS.WCSClient;
+using static Dapper.SqlMapper;
+
+namespace WIDESEA_WCS
+{
+ [DisallowConcurrentExecution]
+ public class VK4Job : JobBase, IJob
+ {
+ public Task Execute(IJobExecutionContext context)
+ {
+ try
+ {
+ ExecuteJob(context, DoAction);
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return Task.CompletedTask;
+ }
+
+ public static StackerReadDBItem StackerDBItem;
+ private void DoAction(IJobExecutionContext context)
+ {
+ var client = context.JobDetail.JobDataMap.Get("JobParams") as PLCClient;
+ //鑷姩閲嶈繛
+ if (!client.IsConnected)
+ {
+ client.Connect();
+ return;
+ }
+ PropertyInfo[] propertyInfos = typeof(StackerReadDBItem).GetProperties();
+ if (StackerDBItem == null)
+ {
+ StackerDBItem = new();
+ //StackerDBItem.OnReadStackerSignal += HandleReadStackerSignal;
+ }
+ List<StackerReadDBItem> StackerReadDBItems = new List<StackerReadDBItem>();
+ var groups = client.itemGroups.OrderBy(x => x.Methods).ThenBy(x=>x.name).GroupBy(x => x.Methods);
+ foreach (var key in groups)
+ {
+ //foreach (var item in key)
+ //{
+ for (int i = 0; i < propertyInfos.Length; i++)
+ {
+ if (i == 0)
+ {
+ StackerDBItem.StackerNo = key.First(x=>true).Methods;
+ }
+ else
+ {
+ DBItemGroup group = key.FirstOrDefault(x => x.name == propertyInfos[i].Name);
+ if (group != null)
+ {
+ object readData = DBExtension.Read(group, client);
+ object obj = propertyInfos[i].GetValue(StackerDBItem);
+ if (obj != readData)
+ propertyInfos[i].SetValue(StackerDBItem, readData);
+ }
+ }
+ }
+ StackerReadDBItems.Add(StackerDBItem);
+ //}
+ }
+
+ }
+ }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
index 63ce234..55d93e2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
@@ -17,6 +17,7 @@
using WIDESEA_WMS.IServices;
using WIDESEA_WMS.Repositories;
using static FreeSql.Internal.GlobalFilter;
+using static System.Collections.Specialized.BitVector32;
namespace WIDESEA_WCS.JobsPart.Common
{
@@ -38,7 +39,7 @@
{
if (task.agv_tasktype == "TaskType_EmptyPallet")//绌烘墭浠诲姟
{
- if (task.agv_fromaddress == "" && DateTime.Now - task.agv_createtime >= TimeSpan.FromMinutes(1))
+ if (task.agv_fromaddress == "" && DateTime.Now - task.agv_createtime >= TimeSpan.FromMinutes(10))
{
if (task.agv_tasknum.Contains("_"))
{
@@ -127,7 +128,7 @@
{
if (task.agv_toaddress == "")
{
- var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.location_state == "Empty" && x.enable).ToList();
+ var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.tray_status == "EmptyTray" /*x.location_state == "Empty"*/ && x.enable).ToList();
foreach (var EmptyStation in EmptyStations)
{
if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
index 45889b7..dffe3ee 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs"
@@ -54,7 +54,7 @@
//鏍规嵁涓嬫枡鍙g殑缁戝畾淇℃伅鏌ヨ瀵瑰簲宸ュ崟锛屾娴嬫宸ュ崟鏄惁宸插畬鎴� 瀹屾垚鍗冲彲灏嗗叾閫佸叆搴�
- var work = workinfoRepository.Find(x => x.workOrder == item.Number && x.drawingNo == x.drawingNo && x.heatID == item.heatNumber).FirstOrDefault();
+ var work = workinfoRepository.Find(x => x.workOrder == item.Number && x.drawingNo == x.drawingNo && x.heatID == item.heatNumber && x.processCode == "17").FirstOrDefault();
if (work == null)
{
item.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟淇℃伅锛�";
@@ -63,29 +63,13 @@
continue;
}
- //dt_mes_head mesinfo = mes_HeadRepository.Find(x => x.workOrder == item.Number).FirstOrDefault();
- //if (mesinfo == null)
- //{
- // item.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟澶磋〃锛�";
- // item.location_state = LocationStateEnum.Abnormal.ToString();
- // stationinfoRepository.Update(item, true);
- // continue;
- // //throw new Exception("鏈壘鍒板伐鍗曞ご琛紒宸ュ崟鍙凤細" + item.Number);
- //}
- //var dt_Geometry_Data = PipelineJob.QueryMateriel(mesinfo.drawingNo);
- //var dt_Geometry_Data1 = PipelineJob.QueryMateriel1(mesinfo.drawingNo);
-
- //int CompeletedNum = Convert.ToInt32(mesinfo.quantity) - Convert.ToInt32(mesinfo.finishNum);
-
-
-
dt_stationinfo TargetLocation = null;
string tasktype = "";
- if (item.quantity == 5 /*|| CompeletedNum == 0*/) //寰幆璇诲彇杞﹁疆鏁颁负5鎴栬�呰鍗曞凡瀹屾垚鏁伴噺鐨勪笅鏂欏彛 鈫掑伐鍗曚汉宸ュ叧闂殑宸ュ崟
+ if (item.quantity == 5 /*|| CompeletedNum == 0*/)
{
- if (/*(mesinfo.quantity <= 50 &&*/ !string.IsNullOrEmpty(work.area) || item.stationCode.Contains("3")) //灏忎簬50浠剁洿鎺ュ嚭搴�
+ if (/*(mesinfo.quantity <= 50 &&*/ !string.IsNullOrEmpty(work.area) || item.stationCode.Contains("3"))
{
//todo 瀵绘壘鍙斁璐у鍗忔斁璐у彴
tasktype = "TaskType_OutsourceInbound";
@@ -97,7 +81,6 @@
//todo: 璋冪敤WMS鎺ュ彛鍒涘缓浠诲姟
tasktype = "TaskType_Inbound";
TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, work, item);
- //TargetLocation = GetEmptyLocation(stationinfoRepository, mesinfo, item, CompeletedNum, dt_Geometry_Data == null ? dt_Geometry_Data1.e : dt_Geometry_Data.e);
}
if (TargetLocation != null)
{
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
index 9365f38..b2b886f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
@@ -31,35 +31,14 @@
try
{
VOLContext context = new VOLContext();
- //Idt_mes_detailRepository mes_DetailRepository = new dt_mes_detailRepository(context);
Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
- //var detail = mes_DetailRepository.Find(x => x.jobID == mesinfo.jobID).FirstOrDefault();
- //if (detail == null)
- //{
- // stationinfo.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟瀛愯〃锛�";
- // stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
- // stationinfoRepository.Update(stationinfo, true);
- // return null;
- //}
string area1 = "";
if (stationinfo.tray_type == "LargeTray")
area1 = "4";
#region 鏌ユ壘搴撳瓨
dt_inventory inventory = null;
- inventory = inventoryRepository.Find(x => x.FigureNumber == mesinfo.drawingNo).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
-
- #region 鏍规嵁鏉′欢鏌ヨ搴撳瓨
- //if (mesinfo.heatID != null)
- //{
- // inventory = inventoryRepository.Find(x => x.HeatNumber == mesinfo.heatID && x.FigureNumber == mesinfo.drawingNo && x.jobID == mesinfo.workOrder).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
- //}
- //else
- //{
- // inventory = inventoryRepository.Find(x => x.FigureNumber == mesinfo.drawingNo && x.jobID == mesinfo.workOrder).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
- //}
- #endregion
-
+ inventory = inventoryRepository.Find(x => x.FigureNumber == stationinfo.stationType).OrderByDescending(x => x.OnlineTime).FirstOrDefault();
#endregion
dt_stationinfo TargetLocation = null;
@@ -74,55 +53,27 @@
TargetLocation = stationinfoRepository.Find(x => x.stationType == stationinfo.stationType && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault();
if (TargetLocation != null)
{
- //if (TargetLocation.area == "1")
- //{
- // //TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault();
-
- // TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();//鎸夎瀛樻斁
-
- // if (TargetLocation != null)
- // {
- // if (!stationinfoRepository.Find(x => x.column == TargetLocation.column && x.area == TargetLocation.area /*&& x.enable*/ && x.location_state == LocationStateEnum.OutBusy.ToString()).Any())
- // return TargetLocation;
- // }
- //}
- //else
- //{
- TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();
- if (TargetLocation != null)
- {
- if (!stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any())
- return TargetLocation;
- }
- //}
+ TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();
+ if (TargetLocation != null)
+ {
+ if (!stationinfoRepository.Find(x => x.line == TargetLocation.line && x.area == TargetLocation.area && x.location_state == LocationStateEnum.OutBusy.ToString()).Any())
+ return TargetLocation;
+ }
}
#endregion
#region 瀵绘壘绌鸿揣浣�
- var TargetLocations1 = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == area1).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
+ var TargetLocations1 = stationinfoRepository.Find(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == area1).OrderBy(x => x.line).ThenBy(x => x.column).ToList();
foreach (var Location in TargetLocations1)
{
- //if (Location.area == "1")
- //{
- // if (stationinfoRepository.Find(x => x.column == Location.column && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
- //}
- //else
- //{
- if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
- //}
+ if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
}
- //if (TargetLocation != null)
- //{
- // if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.column == 1 && x.stationType == stationinfo.stationType).Any()) return TargetLocation;
- //}
#endregion
}
if (station.area == "1")
{
- //TargetLocation = stationinfoRepository.Find(x => x.column == station.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == inventory.area).OrderByDescending(x => x.line).FirstOrDefault();
-
TargetLocation = stationinfoRepository.Find(x => x.line == station.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == station.area).OrderBy(x => x.column).FirstOrDefault();//鎸夎瀛樻斁
if (TargetLocation != null)
@@ -140,7 +91,6 @@
return TargetLocation;
}
}
- //if (TargetLocation != null) return TargetLocation;
}
#endregion
@@ -150,8 +100,6 @@
{
if (TargetLocation.area == "1")
{
- //TargetLocation = stationinfoRepository.Find(x => x.column == TargetLocation.column && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderByDescending(x => x.line).FirstOrDefault();
-
TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();//鎸夎瀛樻斁
if (TargetLocation != null)
@@ -185,15 +133,9 @@
if (stationinfoRepository.Find(x => x.line == Location.line && x.area == Location.area && x.stationType == stationinfo.stationType && x.location_state != LocationStateEnum.OutBusy.ToString()).Any()) return Location;
}
}
- //if (TargetLocation != null)
- //{
- // if (stationinfoRepository.Find(x => x.line == TargetLocation.line && x.column == 1 && x.stationType == stationinfo.stationType).Any()) return TargetLocation;
- //}
#endregion
#region 鏈壘鍒板簱瀛樻垨褰撳墠搴撳瓨琛屽凡婊�,瀵绘壘鏂扮殑涓�琛�
- //var area1 = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, e) : mesinfo.area;(area == "2" ? 1 : 10)
- //var area = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, stationinfo.tray_type) : mesinfo.area;
var area = GetArea(mesinfo.quantity, stationinfo.tray_type);
TargetLocation = stationinfoRepository.Find(x => x.column == 1 && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
if (TargetLocation == null && area != "4")
@@ -297,12 +239,10 @@
return TargetLocation;
}
}
- //if (TargetLocation != null) return TargetLocation;
}
#endregion
#region 鏈壘鍒板簱瀛樻垨褰撳墠搴撳瓨琛屽凡婊�,瀵绘壘鏂扮殑涓�琛�
- //var area1 = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, e) : mesinfo.area;
var area = string.IsNullOrEmpty(mesinfo.area) ? GetArea(mesinfo.quantity, stationinfo.tray_type) : mesinfo.area;
TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 10) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
if (TargetLocation == null)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/DBExtension.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/DBExtension.cs"
index bec587e..6da6b16 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/DBExtension.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/WCSClient/DBExtension.cs"
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Entity.DomainModels;
@@ -65,15 +66,51 @@
/// <param name="client"></param>
/// <param name="value"></param>
/// <returns></returns>
- public static object Write(dt_plcinfodetail detail, PLCClient client, object value)
+ public static object Read(DBItemGroup itemGroup, PLCClient client)
{
- try
+ //PLCClient client = PLCClient.Clients.Where(x => x.PLCName == itemGroup.name).FirstOrDefault();
+ if (client == null)
{
- return (client.Write(detail.plcdetail_db + "." + detail.plcdetail_value, value));
+ throw new Exception($"鏈壘鍒皗itemGroup.name}杩炴帴瀵硅薄");
}
- catch (Exception ex)
+ else
{
- throw;
+ if (itemGroup.dataType == typeof(int).Name.ToLower())//4瀛楄妭,鏈夌鍙风被鍨�
+ {
+ return (client.Read<int>(itemGroup.dbAddress));
+ }
+ else if (itemGroup.dataType == typeof(uint).Name.ToLower())//4瀛楄妭,鏃犵鍙风被鍨�
+ {
+ return (client.Read<uint>(itemGroup.dbAddress));
+ }
+ else if (itemGroup.dataType == typeof(short).Name.ToLower())//2瀛楄妭,鏈夌鍙风被鍨�,鏈�甯哥敤
+ {
+ return (client.Read<short>(itemGroup.dbAddress));
+ }
+ else if (itemGroup.dataType == typeof(ushort).Name.ToLower())//2瀛楄妭,鏃犵鍙风被鍨�
+ {
+ return (client.Read<ushort>(itemGroup.dbAddress));
+ }
+ else if (itemGroup.dataType == typeof(float).Name.ToLower())//娴偣鍨�
+ {
+ return (client.Read<float>(itemGroup.dbAddress));
+ }
+ else if (itemGroup.dataType == typeof(bool).Name.ToLower())
+ {
+ return (client.Read<bool>(itemGroup.dbAddress));
+ }
+ else if (itemGroup.dataType == typeof(byte).Name.ToLower())//瀛楄妭
+ {
+ return (client.Read<byte>(itemGroup.dbAddress));
+ }
+ else if (itemGroup.dataType == typeof(string).Name.ToLower())//瀛楃涓�
+ {
+ return (client.Read<string>(itemGroup.dbAddress, itemGroup.dataLen.GetValueOrDefault()));
+ }
+ else
+ {
+ throw new Exception($"銆恵itemGroup.name}銆�,DB鍦板潃{itemGroup.dbAddress},鏈畾涔夋暟鎹被鍨媨itemGroup.dataType}");
+ }
}
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
index 2acacfb..7899d68 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
@@ -16,7 +16,7 @@
"Connection": {
"DBType": "MsSql", //MySql/MsSql/PgSql //鏁版嵁搴撶被鍨嬶紝濡傛灉浣跨敤鐨勬槸sqlserver姝ゅ搴旇缃负MsSql
//sqlserver杩炴帴瀛楃涓睵@ssw0rd
- "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
+ "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
//mysql杩炴帴瀛楃涓�(鍗囩骇EFCore3.1鍒版椂宸插皢mysql杩炴帴瀛楃涓蹭慨鏀�,2019-12-20)
// "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;",
--
Gitblit v1.9.3