From 8633a0b6e52d9899fda4f3ec2decc1c39b960e5f Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期二, 27 五月 2025 14:42:00 +0800 Subject: [PATCH] 恢复拍照模块,优化任务号生成机制 --- device/SnapManager.cs | 26 +- device/SnapDevice.cs | 240 +++++++++++++++--------------- Program.cs | 2 /dev/null | 0 api/ApiHelper.cs | 2 process/TaskProcess.cs | 158 ++++++++++--------- 6 files changed, 221 insertions(+), 207 deletions(-) diff --git a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/.gitignore b/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/.gitignore deleted file mode 100644 index 72f6969..0000000 --- a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -锘� 榛樿蹇界暐鐨勬枃浠�-/shelf/ -/workspace.xml -# Rider 蹇界暐鐨勬枃浠�-/modules.xml -/projectSettingsUpdater.xml -/contentModel.xml -/.idea.HH.WCS.Mobox3.AnGang.iml -# 鍩轰簬缂栬緫鍣ㄧ殑 HTTP 瀹㈡埛绔姹�-/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/.name b/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/.name deleted file mode 100644 index a36a6db..0000000 --- a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -HH.WCS.Mobox3.AnGang \ No newline at end of file diff --git a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/encodings.xml b/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/encodings.xml deleted file mode 100644 index df87cf9..0000000 --- a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" /> -</project> \ No newline at end of file diff --git a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/indexLayout.xml b/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="UserContentModel"> - <attachedFolders /> - <explicitIncludes /> - <explicitExcludes /> - </component> -</project> \ No newline at end of file diff --git a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/vcs.xml b/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/.idea.HH.WCS.Mobox3.AnGang/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="" vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/231ebe09-1be5-4df5-9128-8244b1b888a7.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/231ebe09-1be5-4df5-9128-8244b1b888a7.vsidx deleted file mode 100644 index 3936964..0000000 --- a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/231ebe09-1be5-4df5-9128-8244b1b888a7.vsidx +++ /dev/null Binary files differ diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/530fbb96-4d54-44a7-b144-9b0bd20dba28.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/530fbb96-4d54-44a7-b144-9b0bd20dba28.vsidx deleted file mode 100644 index 0b35cb6..0000000 --- a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/530fbb96-4d54-44a7-b144-9b0bd20dba28.vsidx +++ /dev/null Binary files differ diff --git a/Program.cs b/Program.cs index 02bf3c6..daf7415 100644 --- a/Program.cs +++ b/Program.cs @@ -15,7 +15,7 @@ namespace HH.WCS.Mobox3.AnGang { internal class Program { - //[STAThread] // TODO SNAP + //[STAThread] // SNAP 娉ㄩ噴璇ヨ淇濈暀鍏朵粬琛屽悗锛岀▼搴忔甯歌繍琛� static void Main(string[] args) { //鍩虹璁剧疆淇℃伅鍒濆鍖�diff --git a/api/ApiHelper.cs b/api/ApiHelper.cs index 19d79e6..8fe1e34 100644 --- a/api/ApiHelper.cs +++ b/api/ApiHelper.cs @@ -556,7 +556,7 @@ var id = SYSHelper.GetSerialNumber(snType, prefix); var date = DateTime.Now.ToString("yyMMdd"); - return $"{prefix}{date}{id.ToString().PadLeft(4, '0')}"; + return $"{prefix}{date}-{id.ToString().PadLeft(5, '0')}"; // 褰㈠锛欳N250525-00011 } /// <summary> diff --git a/device/SnapDevice.cs b/device/SnapDevice.cs index c465b81..216bc0e 100644 --- a/device/SnapDevice.cs +++ b/device/SnapDevice.cs @@ -7,14 +7,14 @@ using System.Text; using System.Threading.Tasks; -//using NetSDKCS; // TODO SNAP +using NetSDKCS; // SNAP namespace HH.WCS.Mobox3.AnGang.device { public class SnapDevice { private IntPtr _LoginID = IntPtr.Zero; private IntPtr _PlayID = IntPtr.Zero; //private fSnapRevCallBack _SnapRevCallBack; - //private NET_DEVICEINFO_Ex _DeviceInfo = new NET_DEVICEINFO_Ex(); // TODO SNAP + private NET_DEVICEINFO_Ex _DeviceInfo = new NET_DEVICEINFO_Ex(); // SNAP private bool _IsSpanCapture = false; //private List<int> _channalList = new List<int>(); @@ -23,7 +23,7 @@ public SnapDevice() { try { //_SnapRevCallBack = new fSnapRevCallBack(SnapRevCallBack); - //NETClient.Init(null, IntPtr.Zero, null); // TODO SNAP + NETClient.Init(null, IntPtr.Zero, null); // SNAP //NETClient.SetSnapRevCallBack(_SnapRevCallBack, IntPtr.Zero); } catch (Exception ex) { @@ -32,134 +32,134 @@ } ~SnapDevice() { - //NETClient.Cleanup(); // TODO SNAP + NETClient.Cleanup(); // SNAP } - //public void LoadInfo(Config.Snap snap) { - // LoadInfo(snap.Ip, snap.Port, snap.Name, snap.Pwd); - //} - - // TODO SNAP + // SNAP - //public void LoadInfo(string ip, int port, string name, string pwd) { - // if (IntPtr.Zero == _LoginID) { - // ushort uPort = 0; - // try { - // uPort = Convert.ToUInt16(port); - // } - // catch { - // LogHelper.Info("鍔犺浇Snap锛氱鍙e彿鏍煎紡閿欒"); - // return; - // } - // _LoginID = NETClient.LoginWithHighLevelSecurity(ip, uPort, name, pwd, EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref _DeviceInfo); - // if (IntPtr.Zero == _LoginID) { - // LogHelper.Info("鐩告満鍒濆鍖栭敊璇細" + NETClient.GetLastError()); - // return; - // } - // //_channalList.Clear(); - // //for (int i = 0; i < _DeviceInfo.nChanNum; i++) { - // // _channalList.Add(i + 1); - // //} - // _channalMax = _DeviceInfo.nChanNum; - // } - // else { - // NETClient.Logout(_LoginID); - // _LoginID = IntPtr.Zero; - // if (_IsSpanCapture) { - // _IsSpanCapture = false; - - // } - // } - //} + public void LoadInfo(Config.Snap snap) { + LoadInfo(snap.Ip, snap.Port, snap.Name, snap.Pwd); + } - //public bool SnapPictureToFileOK(ref string filePath, int channelIndex = 0) { - // if (channelIndex >= _channalMax) { - // LogHelper.Info($"閫氶亾鏁�'{channelIndex}' 瓒呭嚭閫氶亾鎬绘暟 '{_channalMax}'"); - // //filePath = string.Empty; - // return false; - // } + public void LoadInfo(string ip, int port, string name, string pwd) { + if (IntPtr.Zero == _LoginID) { + ushort uPort = 0; + try { + uPort = Convert.ToUInt16(port); + } + catch { + LogHelper.Info("鍔犺浇Snap锛氱鍙e彿鏍煎紡閿欒"); + return; + } + _LoginID = NETClient.LoginWithHighLevelSecurity(ip, uPort, name, pwd, EM_LOGIN_SPAC_CAP_TYPE.TCP, IntPtr.Zero, ref _DeviceInfo); + if (IntPtr.Zero == _LoginID) { + LogHelper.Info("鐩告満鍒濆鍖栭敊璇細" + NETClient.GetLastError()); + return; + } + //_channalList.Clear(); + //for (int i = 0; i < _DeviceInfo.nChanNum; i++) { + // _channalList.Add(i + 1); + //} + _channalMax = _DeviceInfo.nChanNum; + } + else { + NETClient.Logout(_LoginID); + _LoginID = IntPtr.Zero; + if (_IsSpanCapture) { + _IsSpanCapture = false; - // //DateTime now = DateTime.Now; - // //string path = AppDomain.CurrentDomain.BaseDirectory + "image"; - // //string fileName = string.Format("{0}{1}{2}{3}{4}{5}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second) + ".jpg"; - // //filePath = path + "\\" + fileName; + } + } + } - // NET_SNAP_PARAMS asyncSnap = new NET_SNAP_PARAMS(); - // //asyncSnap.Channel = (uint)this._channalList[channelIndex]; - // asyncSnap.Channel = (uint)channelIndex; - // asyncSnap.Quality = 6; - // asyncSnap.ImageSize = 2; - // asyncSnap.mode = 0; - // asyncSnap.InterSnap = 0; + public bool SnapPictureToFileOK(ref string filePath, int channelIndex = 0) { + if (channelIndex >= _channalMax) { + LogHelper.Info($"閫氶亾鏁�'{channelIndex}' 瓒呭嚭閫氶亾鎬绘暟 '{_channalMax}'"); + //filePath = string.Empty; + return false; + } - // NET_IN_SNAP_PIC_TO_FILE_PARAM inParam = new NET_IN_SNAP_PIC_TO_FILE_PARAM { - // dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_SNAP_PIC_TO_FILE_PARAM)), - // stuParam = asyncSnap, - // szFilePath = filePath, - // }; + //DateTime now = DateTime.Now; + //string path = AppDomain.CurrentDomain.BaseDirectory + "image"; + //string fileName = string.Format("{0}{1}{2}{3}{4}{5}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second) + ".jpg"; + //filePath = path + "\\" + fileName; - // NET_OUT_SNAP_PIC_TO_FILE_PARAM outParam = new NET_OUT_SNAP_PIC_TO_FILE_PARAM() { - // dwSize = (uint)Marshal.SizeOf(typeof(NET_OUT_SNAP_PIC_TO_FILE_PARAM)), - // dwPicBufLen = 1024000, - // szPicBuf = Marshal.AllocHGlobal(1024000), - // }; + NET_SNAP_PARAMS asyncSnap = new NET_SNAP_PARAMS(); + //asyncSnap.Channel = (uint)this._channalList[channelIndex]; + asyncSnap.Channel = (uint)channelIndex; + asyncSnap.Quality = 6; + asyncSnap.ImageSize = 2; + asyncSnap.mode = 0; + asyncSnap.InterSnap = 0; - // bool ret = NETClient.SnapPictureToFile(_LoginID, ref inParam, ref outParam, 1000); - // if (!ret) { - // LogHelper.Info("鎶撳浘澶辫触"); - // } - // return ret; - //} + NET_IN_SNAP_PIC_TO_FILE_PARAM inParam = new NET_IN_SNAP_PIC_TO_FILE_PARAM { + dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_SNAP_PIC_TO_FILE_PARAM)), + stuParam = asyncSnap, + szFilePath = filePath, + }; - //public bool SnapPictureOk(int channelIndex = 0) { - // if (channelIndex >= _channalMax) { - // LogHelper.Info($"閫氶亾鏁�'{channelIndex}' 瓒呭嚭閫氶亾鎬绘暟 '{_channalMax}'"); - // return false; - // } + NET_OUT_SNAP_PIC_TO_FILE_PARAM outParam = new NET_OUT_SNAP_PIC_TO_FILE_PARAM() { + dwSize = (uint)Marshal.SizeOf(typeof(NET_OUT_SNAP_PIC_TO_FILE_PARAM)), + dwPicBufLen = 1024000, + szPicBuf = Marshal.AllocHGlobal(1024000), + }; - // NET_SNAP_PARAMS asyncSnap = new NET_SNAP_PARAMS(); - // //asyncSnap.Channel = (uint)this._channalList[channelIndex]; - // asyncSnap.Channel = (uint)channelIndex; - // asyncSnap.Quality = 6; - // asyncSnap.ImageSize = 2; - // asyncSnap.mode = 0; - // asyncSnap.InterSnap = 0; - // bool ret = NETClient.SnapPictureEx(_LoginID, asyncSnap, IntPtr.Zero); - // if (!ret) { - // LogHelper.Info(NETClient.GetLastError()); - // return false; - // } - // return true; - //} + bool ret = NETClient.SnapPictureToFile(_LoginID, ref inParam, ref outParam, 1000); + if (!ret) { + LogHelper.Info("鎶撳浘澶辫触"); + } + return ret; + } - //private void SnapRevCallBack(IntPtr lLoginID, IntPtr pBuf, uint RevLen, uint EncodeType, uint CmdSerial, IntPtr dwUser) { - // string path = AppDomain.CurrentDomain.BaseDirectory + "image"; - // if (!Directory.Exists(path)) { - // Directory.CreateDirectory(path); - // } - // if (EncodeType == 10) //.jpg - // { - // DateTime now = DateTime.Now; - // string fileName = string.Format("{0}-{1}-{2}-{3}-{4}-{5}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second) + ".jpg"; - // string filePath = path + "\\" + fileName; - // byte[] data = new byte[RevLen]; - // Marshal.Copy(pBuf, data, 0, (int)RevLen); - // try { - // //when the file is operate by local capture will throw expection. - // using (FileStream stream = new FileStream(filePath, FileMode.OpenOrCreate)) { - // stream.Write(data, 0, (int)RevLen); - // stream.Flush(); - // stream.Dispose(); - // } - // } - // catch (Exception ex) { - // LogHelper.Info($"鍙戠敓浜嗗紓甯革細{ex.Message}"); - // return; - // } - // // 鏇夸唬Demo绋嬪簭鐨凢rame鍥剧墖灞曠ず - // LogHelper.Info($"淇濆瓨鍥剧墖鍒帮細{filePath}"); - // Process.Start(filePath); - // } - //} + public bool SnapPictureOk(int channelIndex = 0) { + if (channelIndex >= _channalMax) { + LogHelper.Info($"閫氶亾鏁�'{channelIndex}' 瓒呭嚭閫氶亾鎬绘暟 '{_channalMax}'"); + return false; + } + + NET_SNAP_PARAMS asyncSnap = new NET_SNAP_PARAMS(); + //asyncSnap.Channel = (uint)this._channalList[channelIndex]; + asyncSnap.Channel = (uint)channelIndex; + asyncSnap.Quality = 6; + asyncSnap.ImageSize = 2; + asyncSnap.mode = 0; + asyncSnap.InterSnap = 0; + bool ret = NETClient.SnapPictureEx(_LoginID, asyncSnap, IntPtr.Zero); + if (!ret) { + LogHelper.Info(NETClient.GetLastError()); + return false; + } + return true; + } + + private void SnapRevCallBack(IntPtr lLoginID, IntPtr pBuf, uint RevLen, uint EncodeType, uint CmdSerial, IntPtr dwUser) { + string path = AppDomain.CurrentDomain.BaseDirectory + "image"; + if (!Directory.Exists(path)) { + Directory.CreateDirectory(path); + } + if (EncodeType == 10) //.jpg + { + DateTime now = DateTime.Now; + string fileName = string.Format("{0}-{1}-{2}-{3}-{4}-{5}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second) + ".jpg"; + string filePath = path + "\\" + fileName; + byte[] data = new byte[RevLen]; + Marshal.Copy(pBuf, data, 0, (int)RevLen); + try { + //when the file is operate by local capture will throw expection. + using (FileStream stream = new FileStream(filePath, FileMode.OpenOrCreate)) { + stream.Write(data, 0, (int)RevLen); + stream.Flush(); + stream.Dispose(); + } + } + catch (Exception ex) { + LogHelper.Info($"鍙戠敓浜嗗紓甯革細{ex.Message}"); + return; + } + // 鏇夸唬Demo绋嬪簭鐨凢rame鍥剧墖灞曠ず + LogHelper.Info($"淇濆瓨鍥剧墖鍒帮細{filePath}"); + Process.Start(filePath); + } + } } } diff --git a/device/SnapManager.cs b/device/SnapManager.cs index fd494b6..625a39b 100644 --- a/device/SnapManager.cs +++ b/device/SnapManager.cs @@ -11,24 +11,24 @@ if (_snapDevice == null) { _snapDevice = new SnapDevice(); } - //_snapDevice.LoadInfo(snap); // TODO SNAP + _snapDevice.LoadInfo(snap); // SNAP } public static string GetCapturePicturePath() { - //DateTime now = DateTime.Now; - //string path = Settings.CaptureUrl; - //string fileName = string.Format("{0}{1}{2}{3}{4}{5}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second) + ".jpg"; - //string filePath = path + "\\" + fileName; + //return string.Empty; + // SNAP - //if (_snapDevice.SnapPictureToFileOK(ref filePath)) { - // return filePath; - //} - //else { - // return string.Empty; - //} + DateTime now = DateTime.Now; + string path = Settings.CaptureUrl; + string fileName = string.Format("{0}{1}{2}{3}{4}{5}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second) + ".jpg"; + string filePath = path + "\\" + fileName; - // TODO SNAP - return string.Empty; + if (_snapDevice.SnapPictureToFileOK(ref filePath)) { + return filePath; + } + else { + return string.Empty; + } } } } diff --git a/process/TaskProcess.cs b/process/TaskProcess.cs index 9925ec0..96dd8df 100644 --- a/process/TaskProcess.cs +++ b/process/TaskProcess.cs @@ -111,81 +111,95 @@ var start = "0"; var end = "0"; var taskType = mst.S_TYPE.Trim(); if (mst.N_B_STATE == 0) { - if (mst.N_SCHEDULE_TYPE == 1)//閫氳繃NDC锛宧osttoagv璋冨害璁惧 - { - start = LocationHelper.GetAgvSite(mst.S_START_LOC); - end = LocationHelper.GetAgvSite(mst.S_END_LOC); - //if (mst.S_TYPE == "绌烘墭涓嬬嚎鍫嗗彔") { - // end = LocationHelper.GetAgvSite(mst.S_END_LOC, true); - //} - - LogHelper.Info($"NDC鎺ㄩ�浠诲姟 {mst.S_CODE};" + "start=" + start + "end= " + end); - var startLoc = LocationHelper.GetLoc(mst.S_START_LOC); - var endLoc = LocationHelper.GetLoc(mst.S_END_LOC); - var dic = new List<param>(); - dic.Add(new param() { name = "IKey", value = "IKey" }); - dic.Add(new param() { name = "From", value = start.ToString() }); - dic.Add(new param() { name = "To", value = end.ToString() }); - dic.Add(new param() { name = "FUNC", value = startLoc.N_LAYER.ToString() }); - - dic.Add(new param() { name = "Ctype", value = "0" }); - - - //if (mst.S_TYPE == "浣欐枡涓嬬嚎鍏ュ簱" || mst.S_TYPE == "浜哄伐鎷嗙洏鍏ュ簱") { - // dic.Add(new param() { name = "DATA", value = "1024" }); - //} - //else { - // dic.Add(new param() { name = "DATA", value = "0" }); - //} - - var res = NDCApi.AddOrderNew(1, 1, mst.S_CODE, dic);//娣诲姞鏂板懡浠�- if (res != null && (res.err_code == 0 || res.err_code == 50009)) { - //鎺ㄩ�鎴愬姛锛屼慨鏀逛换鍔′紭鍏堢骇 - mst.N_B_STATE = 1; - mst.S_B_STATE = TN_Task.GetStateStr(1); - WCSHelper.UpdateStatus(mst);//鏇存柊浠诲姟鐘舵� - result = true; - LogHelper.Info($"NDC鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE}start= {mst.S_START_LOC} + end = {mst.S_END_LOC}"); - } - else { - LogHelper.Info($"NDC鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};Res:" + JsonConvert.SerializeObject(res)); - } + var code = GZRobot.CreateOrder(mst.S_CODE, mst.N_PRIORITY, JsonConvert.SerializeObject(new { src = mst.S_START_LOC, dst = mst.S_END_LOC }), "p2p"); + if (code > 0) { + //鏇存柊浠诲姟鐘舵� + mst.N_B_STATE = 1; + mst.S_EQ_TASK_CODE = code.ToString(); + WCSHelper.UpdateStatus(mst); + WCSHelper.UpdateEQNo(mst); + LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE};" + "start=" + mst.S_START_LOC + "end= " + mst.S_END_LOC); } - else if (mst.N_SCHEDULE_TYPE == 5)//閫氳繃鏉ゥ璋冨害璁惧 - { - //璋冪涓夋柟鎺ュ彛 - var model = new HanAo.TaskInfoModel { - requestPk = mst.S_CODE, - frmPos = mst.S_START_LOC, - toPos = mst.S_END_LOC, - trkType = mst.S_OP_NAME == "鍏ュ簱" ? "1" : "2", - contNo = mst.S_CNTR_CODE - }; - if (HanAo.CreateOrder(model)) { - mst.N_B_STATE = 1; - WCSHelper.UpdateStatus(mst); - LogHelper.Info($"鏉ゥ鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE};" + "start=" + model.frmPos + "end= " + model.toPos); - } - else { - LogHelper.Info($"鏉ゥ鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};" + JsonConvert.SerializeObject(model)); - } + else { + LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};" + JsonConvert.SerializeObject(mst)); } - else if (mst.N_SCHEDULE_TYPE == 3) //閫氳繃鍥借嚜璋冨害璁惧 - { - var code = GZRobot.CreateOrder(mst.S_CODE, mst.N_PRIORITY, JsonConvert.SerializeObject(new { src = mst.S_START_LOC, dst = mst.S_END_LOC }), "p2p"); - if (code > 0) { - //鏇存柊浠诲姟鐘舵� - mst.N_B_STATE = 1; - mst.S_EQ_TASK_CODE = code.ToString(); - WCSHelper.UpdateStatus(mst); - WCSHelper.UpdateEQNo(mst); - LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE};" + "start=" + mst.S_START_LOC + "end= " + mst.S_END_LOC); - } - else { - LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};" + JsonConvert.SerializeObject(mst)); - } - } + + //if (mst.N_SCHEDULE_TYPE == 1)//閫氳繃NDC锛宧osttoagv璋冨害璁惧 + //{ + // start = LocationHelper.GetAgvSite(mst.S_START_LOC); + // end = LocationHelper.GetAgvSite(mst.S_END_LOC); + + // //if (mst.S_TYPE == "绌烘墭涓嬬嚎鍫嗗彔") { + // // end = LocationHelper.GetAgvSite(mst.S_END_LOC, true); + // //} + + // LogHelper.Info($"NDC鎺ㄩ�浠诲姟 {mst.S_CODE};" + "start=" + start + "end= " + end); + // var startLoc = LocationHelper.GetLoc(mst.S_START_LOC); + // var endLoc = LocationHelper.GetLoc(mst.S_END_LOC); + // var dic = new List<param>(); + // dic.Add(new param() { name = "IKey", value = "IKey" }); + // dic.Add(new param() { name = "From", value = start.ToString() }); + // dic.Add(new param() { name = "To", value = end.ToString() }); + // dic.Add(new param() { name = "FUNC", value = startLoc.N_LAYER.ToString() }); + + // dic.Add(new param() { name = "Ctype", value = "0" }); + + + // //if (mst.S_TYPE == "浣欐枡涓嬬嚎鍏ュ簱" || mst.S_TYPE == "浜哄伐鎷嗙洏鍏ュ簱") { + // // dic.Add(new param() { name = "DATA", value = "1024" }); + // //} + // //else { + // // dic.Add(new param() { name = "DATA", value = "0" }); + // //} + + // var res = NDCApi.AddOrderNew(1, 1, mst.S_CODE, dic);//娣诲姞鏂板懡浠�+ // if (res != null && (res.err_code == 0 || res.err_code == 50009)) { + // //鎺ㄩ�鎴愬姛锛屼慨鏀逛换鍔′紭鍏堢骇 + // mst.N_B_STATE = 1; + // mst.S_B_STATE = TN_Task.GetStateStr(1); + // WCSHelper.UpdateStatus(mst);//鏇存柊浠诲姟鐘舵� + // result = true; + // LogHelper.Info($"NDC鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE}start= {mst.S_START_LOC} + end = {mst.S_END_LOC}"); + // } + // else { + // LogHelper.Info($"NDC鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};Res:" + JsonConvert.SerializeObject(res)); + // } + //} + //else if (mst.N_SCHEDULE_TYPE == 5)//閫氳繃鏉ゥ璋冨害璁惧 + //{ + // //璋冪涓夋柟鎺ュ彛 + // var model = new HanAo.TaskInfoModel { + // requestPk = mst.S_CODE, + // frmPos = mst.S_START_LOC, + // toPos = mst.S_END_LOC, + // trkType = mst.S_OP_NAME == "鍏ュ簱" ? "1" : "2", + // contNo = mst.S_CNTR_CODE + // }; + // if (HanAo.CreateOrder(model)) { + // mst.N_B_STATE = 1; + // WCSHelper.UpdateStatus(mst); + // LogHelper.Info($"鏉ゥ鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE};" + "start=" + model.frmPos + "end= " + model.toPos); + // } + // else { + // LogHelper.Info($"鏉ゥ鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};" + JsonConvert.SerializeObject(model)); + // } + //} + //else if (mst.N_SCHEDULE_TYPE == 3) //閫氳繃鍥借嚜璋冨害璁惧 + //{ + // var code = GZRobot.CreateOrder(mst.S_CODE, mst.N_PRIORITY, JsonConvert.SerializeObject(new { src = mst.S_START_LOC, dst = mst.S_END_LOC }), "p2p"); + // if (code > 0) { + // //鏇存柊浠诲姟鐘舵� + // mst.N_B_STATE = 1; + // mst.S_EQ_TASK_CODE = code.ToString(); + // WCSHelper.UpdateStatus(mst); + // WCSHelper.UpdateEQNo(mst); + // LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟鎴愬姛 {mst.S_CODE};" + "start=" + mst.S_START_LOC + "end= " + mst.S_END_LOC); + // } + // else { + // LogHelper.Info($"鍥借嚜鎺ㄩ�浠诲姟澶辫触 {mst.S_CODE};" + JsonConvert.SerializeObject(mst)); + // } + //} } return result; -- Gitblit v1.9.1