From e3bffd83918a1e9d06f2f46d44ee5391c4491337 Mon Sep 17 00:00:00 2001 From: subin Date: Sat, 20 Jul 2024 18:16:44 +0800 Subject: [PATCH] comit --- .gitignore | 40 + pos/POSV.Core/Global.cs | 7 + pos/POSV.Core/Helper/PrintHelper.cs | 19 +- pos/POSV.Core/HttpApi/SaleClearApi.cs | 109 +- pos/POSV.Core/OtherWaiMai/OtherWaiMaiApi.cs | 113 ++- pos/POSV.Core/ServiceCenter/UploadOrder.cs | 208 +++- pos/POSV.Core/Utils/CardOperateUtils-yaojm.cs | 229 +++++ pos/POSV.Core/Utils/MqttUtils.cs | 5 +- pos/POSV.Core/Utils/SaleClearUtils.cs | 218 +++- pos/POSV.Core/Utils/SplitPayUtils.cs | 17 +- pos/POSV.Proxy/MqttClient/MqttClientUtils.cs | 4 +- .../ThirdPartyOrder/JuWeiAppOrderProxy.cs | 138 ++- pos/POSV.Template/Bill/MCardControl.cs | 1 + .../Component/CouponForm.Designer.cs | 87 +- pos/POSV.Template/OtherWaiMai/MeituanForm.cs | 6 +- pos/POSV.Template/QiMai/QiMaiForm.Designer.cs | 177 ++-- pos/POSV.Template/Shift/ShiftForm.cs | 87 +- pos/Test/Form1.Designer.cs | 953 ++++++++++++++++++ pos/Test/Form1.cs | 424 ++++++++ pos/Test/Form1.resx | 120 +++ pos/Test/Program.cs | 21 + pos/Test/Properties/AssemblyInfo.cs | 36 + pos/Test/Properties/Resources.Designer.cs | 70 ++ pos/Test/Properties/Resources.resx | 117 +++ pos/Test/Properties/Settings.Designer.cs | 29 + pos/Test/Properties/Settings.settings | 7 + pos/Test/Test.csproj | 131 +++ pos/Test/app.config | 19 + pos/Test/packages.config | 9 + 29 files changed, 3082 insertions(+), 319 deletions(-) create mode 100644 pos/POSV.Core/Utils/CardOperateUtils-yaojm.cs create mode 100644 pos/Test/Form1.Designer.cs create mode 100644 pos/Test/Form1.cs create mode 100644 pos/Test/Form1.resx create mode 100644 pos/Test/Program.cs create mode 100644 pos/Test/Properties/AssemblyInfo.cs create mode 100644 pos/Test/Properties/Resources.Designer.cs create mode 100644 pos/Test/Properties/Resources.resx create mode 100644 pos/Test/Properties/Settings.Designer.cs create mode 100644 pos/Test/Properties/Settings.settings create mode 100644 pos/Test/Test.csproj create mode 100644 pos/Test/app.config create mode 100644 pos/Test/packages.config diff --git a/.gitignore b/.gitignore index 76da789..7dd3918 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,43 @@ /pos/POSV.Template/bin/Debug /pos/POSV.Template/obj /pos/UpgradeLog.htm +/pos/JwKdsV/bin +/pos/JwKdsV/obj +/pos/JwKdsV.Core/bin +/pos/JwKdsV.Core/obj +/pos/JwKdsV.Entity/bin +/pos/POSV.Barcode/bin/Release/POSV.Barcode.dll +/pos/POSV.Cef.Client/bin/x86/Release +/pos/POSV.Cef.Client/obj/x86/Release +/pos/POSV.Cef.FastTemplate/bin/x86/Release +/pos/POSV.Common/bin/Release +/pos/POSV.Component/bin/Release +/pos/POSV.Component/obj/Release +/pos/POSV.Core/bin/Release +/pos/POSV.Core/obj/Release +/pos/POSV.DefaultTemplate/bin/Release +/pos/POSV.DefaultTemplate/obj/Release +/pos/POSV.Entity/bin/Release +/pos/POSV.Excel/bin/Release +/pos/POSV.FastTemplate/bin/Release +/pos/POSV.Language/bin/Release +/pos/POSV.Language/obj/Release +/pos/POSV.Mqtt/bin/Release +/pos/POSV.MqttClient/bin/Release +/pos/POSV.Net/bin/Release +/pos/POSV.Payment/bin/Release +/pos/POSV.Payment/obj/Release +/pos/POSV.Printer/bin/Release +/pos/POSV.Proxy/bin/Release +/pos/POSV.QRCoder/bin/Release/net40 +/pos/POSV.Service/bin +/pos/POSV.Service/obj +/pos/POSV.TeaTemplate/bin/Release +/pos/POSV.Template/bin/Release +/pos/POSV.Voice/bin/Release +/pos/POSV.WeightTemplate/bin/Release +/pos/POSV.WindowsService/bin +/pos/POSV.WindowsService/obj +/pos/POSV.WindowsServiceManager/obj +/pos/Test/bin +/pos/Test/obj diff --git a/pos/POSV.Core/Global.cs b/pos/POSV.Core/Global.cs index 550ebe7..0fcf798 100644 --- a/pos/POSV.Core/Global.cs +++ b/pos/POSV.Core/Global.cs @@ -101,6 +101,13 @@ namespace POSV /// public static bool isHandOver = false; + #region 20240309 subin 沽清同步至云平台 + /// + /// 是否通过沽清至云平台 + /// + public static bool isSale2Web = false; + #endregion + public static Global Product { get diff --git a/pos/POSV.Core/Helper/PrintHelper.cs b/pos/POSV.Core/Helper/PrintHelper.cs index 92b1ae8..a4d807c 100644 --- a/pos/POSV.Core/Helper/PrintHelper.cs +++ b/pos/POSV.Core/Helper/PrintHelper.cs @@ -137,6 +137,13 @@ namespace POSV.Helper try { + //20240330 subin 收银小票,打印外带和自提的小票,不打印堂食票 + if (orderObject.BusMode == "堂食" || orderObject.OrderType == OrderType.堂食) + { + logger.Info($"订单类型<{orderObject.OrderType}>,不打印收银小票"); + return true; + } + //构建收银小票模版参数 List vars = null; if (orderObject.OrderType == OrderType.电话外卖) @@ -840,7 +847,7 @@ namespace POSV.Helper if (item.RowState == OrderRowState.套餐明) { - displayName = " " + displayName; + displayName = " " + displayName; } if (item.RowState == OrderRowState.普通 || item.RowState == OrderRowState.套餐主) @@ -958,7 +965,7 @@ namespace POSV.Helper total.Add("@数量@", totalQuantity + ""); total.Add("@单价@", ""); total.Add("@小计@", totalAmount + ""); - total.Add("@优惠@", totalDiscountAmount + ""); + total.Add("@优惠@", totalDiscountAmount + ""); list.Add(total); v.Value = JsonUtils.Serialize(list); @@ -1145,7 +1152,7 @@ namespace POSV.Helper // else if (orderObject.OrderNo[0] == 'D') // data.Add("@营业模式@", "微信外带"); //微信外带 // else - data.Add("@营业模式@", LangProxy.ToLang(orderObject.OrderType.ToString())); + data.Add("@营业模式@", LangProxy.ToLang(orderObject.OrderType.ToString())); if (printer.Length > 0) { @@ -1171,7 +1178,7 @@ namespace POSV.Helper data.Add("@POS编码@", orderObject.PosNo); data.Add("@桌号@", orderObject.TableName); data.Add("@打印时间@", orderObject.FinishDate); - data.Add("@重打标识@", string.Format("{0}", orderObject.RPrint)); + data.Add("@重打标识@", string.Format("{0}", orderObject.RPrint)); data.Add("@方案名称@", orderObject.Ext3); //zhangy 2020-05-09 Add 厨打添加订餐人和手机号 @@ -1388,10 +1395,10 @@ namespace POSV.Helper v.DataType = DataType.Simple; var data = new Dictionary(); - + data.Add("@序号@", orderObject.OrderNo); - //Yao 2023-06-23 增加微信点餐 中的微信堂食和微信外带 + //Yao 2023-06-23 增加微信点餐 中的微信堂食和微信外带 logger.Info("当前序号:{0}", orderObject.OrderNo); //if (orderObject.OrderNo[0] == 'T') diff --git a/pos/POSV.Core/HttpApi/SaleClearApi.cs b/pos/POSV.Core/HttpApi/SaleClearApi.cs index 3fe45a1..59a301a 100644 --- a/pos/POSV.Core/HttpApi/SaleClearApi.cs +++ b/pos/POSV.Core/HttpApi/SaleClearApi.cs @@ -22,7 +22,10 @@ namespace POSV.HttpApi { var uploadObject = BuilderUploadObject(saleClear); string jsonString = JsonUtils.Serialize(uploadObject); - var uploadResult = Uploading(jsonString); + //var list = new List>(); + //list.Add(uploadObject); + //string jsonString = JsonUtils.Serialize(list); + var uploadResult = Uploading("saleclear.business.upload", jsonString); if (uploadResult.Item1) { @@ -39,6 +42,43 @@ namespace POSV.HttpApi return new Tuple(false, "沽清数据上传失败"); } + /// + /// 估清数据修改库存 + /// + /// + /// 购买:add,退货:reduce + /// + public static Tuple UpdateQuantity(SaleClear saleClear, string typeId) + { + try + { + var uploadObject = new Dictionary(); + //门店ID + uploadObject["storeId"] = Global.Instance.Worker.StoreId; + // 数量 + uploadObject["quantity"] = saleClear.SaleQuantity; + // 商品Id + uploadObject["productId"] = saleClear.ProductId; + // 销售/退货 + uploadObject["typeId"] = typeId; + + string jsonString = JsonUtils.Serialize(uploadObject); + var uploadResult = Uploading("saleclear.business.updatekc", jsonString); + + if (uploadResult.Item1) + { + logger.Debug($"沽清更新库存数据上传成功:{jsonString}。"); + return new Tuple(true, "更新沽清库存数据成功"); + } + } + catch (Exception ex) + { + logger.Error(ex, "沽清更新库存数据错误"); + return new Tuple(false, "更新沽清库存数据错误"); + } + + return new Tuple(false, "更新沽清库存数据失败"); + } private static Dictionary BuilderUploadObject(SaleClear saleClear) { @@ -112,16 +152,16 @@ namespace POSV.HttpApi } } - private static Tuple> Uploading(string jsonString) + private static Tuple> Uploading(string method, string jsonString) { Tuple> result = null; try { - logger.Debug("开始上传沽清数据......"); + logger.Debug($"开始上传沽清数据<{method}>......"); OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.Business); SortedList parameters = OpenApiUtils.Instance.NewParameters(api); - parameters.Add("method", "upload.business.splitorder"); + parameters.Add("method", method); parameters.Add("storeId", Global.Instance.Authc.StoreId); parameters.Add("jsonString", jsonString); @@ -155,7 +195,7 @@ namespace POSV.HttpApi { string message = string.Format("<{0}>-{1}-{2}", status.ErrCode, status.ErrMessage, status.Message); - logger.Error(string.Format("调用接口上传出错:{0}", message)); + logger.Error(string.Format("调用接口<{1}>上传出错:{0}", message, method)); result = new Tuple>(false, status); } @@ -182,7 +222,7 @@ namespace POSV.HttpApi } catch (Exception ex) { - string message = string.Format("上传营业分账数据发生异常"); + string message = string.Format($"上传沽清数据<{method}>发生异常"); logger.Error(ex, message); @@ -201,6 +241,63 @@ namespace POSV.HttpApi return result; } + public static Tuple> DownloadSaleClearList() + { + var tips = "saleclear.business.list"; + var saleClearList = new List(); + logger.Info(string.Format("下载{0}......", tips)); + var flg = false; + try + { + OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.Business); + SortedList parameters = OpenApiUtils.Instance.NewParameters(api); + + parameters.Add("method", tips); + parameters.Add("pageNumber", "1"); + parameters.Add("pageSize", "500"); + parameters.Add("storeId", Global.Instance.Authc.StoreId); + + var ignore = new List(); + ignore.Add("pageNumber"); + ignore.Add("pageSize"); + parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignore)); + + string response = HttpClientUtils.PostAsync(api, api.Url, parameters); + if (Constant.IsSuccessful(response)) + { + var result = JsonUtils.Deserialize>(response); + if (result.Status == 1) + { + foreach (var item in result.List) + { + item.StartTime = string.IsNullOrWhiteSpace(item.StartTime) ? "" : DateTimeUtils.GetFormatDateTime(item.StartTime, "yyyy-MM-dd HH:mm:ss"); + item.EndTime = string.IsNullOrWhiteSpace(item.EndTime) ? "" : DateTimeUtils.GetFormatDateTime(item.EndTime, "yyyy-MM-dd HH:mm:ss"); + item.StopTime = string.IsNullOrWhiteSpace(item.StopTime) ? "" : DateTimeUtils.GetFormatDateTime(item.StopTime, "yyyy-MM-dd HH:mm:ss"); + saleClearList.Add(item); + } + + flg = true; + } + else + { + var message = string.Format("<{0}>-{1}", result.ErrCode, result.ErrMessage); + logger.Info(string.Format("{0}下载出错:{1}", tips, message)); + } + } + else + { + var message = string.Format("{0}下载发生异常", tips); + logger.Info(string.Format("{0}下载出错:{1}", tips, message)); + } + } + catch (Exception ex) + { + var message = string.Format("{0}下载发生异常", tips); + logger.Error(ex, message); + } + + return new Tuple>(flg, "", saleClearList); + } } } diff --git a/pos/POSV.Core/OtherWaiMai/OtherWaiMaiApi.cs b/pos/POSV.Core/OtherWaiMai/OtherWaiMaiApi.cs index 1859a5d..0e01d70 100644 --- a/pos/POSV.Core/OtherWaiMai/OtherWaiMaiApi.cs +++ b/pos/POSV.Core/OtherWaiMai/OtherWaiMaiApi.cs @@ -1355,6 +1355,10 @@ namespace POSV.OtherWaiMai /// public static void sendSJWaiMaiMessage(string message) { + if (logger == null) + { + logger = NLog.LogManager.GetCurrentClassLogger(); + } logger.Info(">>>>>>sendSJWaiMaiMessage>>>>>>>>{0}", message); try @@ -1382,9 +1386,14 @@ namespace POSV.OtherWaiMai }); if (orderIds.Length > 0) { - //播放声音 - SoundUtils.PlaySound("meituan_new"); - logger.Info("美团外卖订单播放声音"); + //20240204 subin 改为异步播放 + Task.Factory.StartNew(() => + { + //播放声音 + SoundUtils.PlaySound("meituan_new"); + logger.Info("美团外卖订单播放声音"); + }); + // 是否自动接单 bool openConfirm = Global.Instance.GlobalConfigBoolValue(ConfigConstant.MEITUAN_CONFIRM_PARAMETER, false); if (openConfirm && !Global.isHandOver) @@ -1401,6 +1410,18 @@ namespace POSV.OtherWaiMai var response = OtherWaiMaiUtils.SJ_MeiTuanOrderConfirm(request); logger.Info("美团外卖接单结果:" + JsonUtils.Serialize(response)); + //if (response != null) + //{ + // if (!response.Item1) + // { + // if (response.Item2.Equals("商家美团订单接单异常,本次操作无效")) + // { + // logger.Info("美团外卖第二次订单确认"); + // response = OtherWaiMaiUtils.SJ_MeiTuanOrderConfirm(request); + // } + // } + //} + if (response != null) { logger.Info("美团外卖自动接单:" + response.Item2); @@ -1431,7 +1452,8 @@ namespace POSV.OtherWaiMai logger.Info("美团外卖订单已存在"); return; } - logger.Info($"美团外卖自动接单组装本地数据,data:{JsonUtils.Serialize(response1.Item3.Data)}"); + //logger.Info($"美团外卖自动接单组装本地数据,data:{JsonUtils.Serialize(response1.Item3.Data)}"); + logger.Info("美团外卖自动接单组装本地数据"); //组装本地数据 OrderObject orderObject = OtherWaiMaiApi.getOrderLocalSJMeiTuan(response1.Item3.Data); logger.Info("美团外卖组装本地数据成功"); @@ -1660,37 +1682,42 @@ namespace POSV.OtherWaiMai } } - logger.Info("美团外卖自动接单打印"); - //构建收银小票模版参数打印 - var vars = WaiMaiHelper.SJBuilderMeiTuanVariable(response1.Item3.Data.Wm_poi_name, response1.Item3.Data, false); - Tuple result = WaiMaiHelper.PrinterTicket("美团外卖", vars); - logger.Error(string.Format("{0}", result.Item2)); - //打印标签 - LabelPrintHelper.PrintOrderLabel(orderObject); - logger.Info("美团外卖标签打印成功"); - //执行厨打标签 - ChuDaHelper.KitchenLabelPrinter(orderObject); - logger.Info("美团外卖厨打标签成功"); - //启用外卖商品绑定厨打方案 - var planKit = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_OTHERWAIMAI_PLANKIT, true); - if (planKit) - { - //执行厨打 - ChuDaHelper.KitchenPrinter(orderObject); - logger.Info("美团外卖厨打成功"); - //执行出品 - ChuDaHelper.MadePrinter(orderObject); - logger.Info("美团外卖出品成功"); - } - //启用外卖商品绑定厨显方案 - var planKds = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_OTHERWAIMAI_PLANKDS, true); - if (planKds) + //20240204 subin 改为异步打印 + Task.Factory.StartNew(() => { - //通知厨显 - UploadSCNewOrder.UploadNewOrder2SC4KDS(orderObject); - logger.Info("美团外卖厨显成功"); - } + logger.Info($"美团外卖自动接单打印<{orderObject.TradeNo}>"); + //构建收银小票模版参数打印 + var vars = WaiMaiHelper.SJBuilderMeiTuanVariable(response1.Item3.Data.Wm_poi_name, response1.Item3.Data, false); + Tuple result = WaiMaiHelper.PrinterTicket("美团外卖", vars); + logger.Error(string.Format("{0}", result.Item2)); + //打印标签 + LabelPrintHelper.PrintOrderLabel(orderObject); + logger.Info($"美团外卖标签打印成功<{orderObject.TradeNo}>"); + //执行厨打标签 + ChuDaHelper.KitchenLabelPrinter(orderObject); + logger.Info($"美团外卖厨打标签成功<{orderObject.TradeNo}>"); + + //启用外卖商品绑定厨打方案 + var planKit = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_OTHERWAIMAI_PLANKIT, true); + if (planKit) + { + //执行厨打 + ChuDaHelper.KitchenPrinter(orderObject); + logger.Info($"美团外卖厨打成功<{orderObject.TradeNo}>"); + //执行出品 + ChuDaHelper.MadePrinter(orderObject); + logger.Info($"美团外卖出品成功<{orderObject.TradeNo}>"); + } + //启用外卖商品绑定厨显方案 + var planKds = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_OTHERWAIMAI_PLANKDS, true); + if (planKds) + { + //通知厨显 + UploadSCNewOrder.UploadNewOrder2SC4KDS(orderObject); + logger.Info($"美团外卖厨显成功<{orderObject.TradeNo}>"); + } + }); } } catch (Exception ex) @@ -1716,9 +1743,13 @@ namespace POSV.OtherWaiMai orderMap.Add("orderId" + orderId, orderId); if (DateTimeUtils.ExecDateDiff(DateTime.Now, DateTime.Parse(waiMaiMap["date"])) < 15) { - //播放声音 - SoundUtils.PlaySound("meituan_cancel"); - logger.Info("美团订单被取消播放声音"); + //20240204 subin 改为异步播放 + Task.Factory.StartNew(() => + { + //播放声音 + SoundUtils.PlaySound("meituan_cancel"); + logger.Info("美团订单被取消播放声音"); + }); } //如果本地有订单,将本地订单退单 try @@ -1901,9 +1932,13 @@ namespace POSV.OtherWaiMai orderMap.Add("orderId" + orderId, orderId); if (DateTimeUtils.ExecDateDiff(DateTime.Now, DateTime.Parse(waiMaiMap["date"])) < 15) { - //播放声音 - SoundUtils.PlaySound("meituan_cancel"); - logger.Info("饿了么订单被取消播放声音"); + //20240204 subin 改为异步播放 + Task.Factory.StartNew(() => + { + //播放声音 + SoundUtils.PlaySound("meituan_cancel"); + logger.Info("饿了么订单被取消播放声音"); + }); } //如果本地有订单,将本地订单退单 try diff --git a/pos/POSV.Core/ServiceCenter/UploadOrder.cs b/pos/POSV.Core/ServiceCenter/UploadOrder.cs index 46ec478..a589959 100644 --- a/pos/POSV.Core/ServiceCenter/UploadOrder.cs +++ b/pos/POSV.Core/ServiceCenter/UploadOrder.cs @@ -7,13 +7,55 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Net; +using Newtonsoft.Json; + + +using System.Windows.Forms; +using System.IO; +using System.Runtime.InteropServices; namespace POSV.ServiceCenter { + + public class UploadSCNewOrder { - private static Logger logger = NLog.LogManager.GetCurrentClassLogger(); + //==============================Yao 2023-06-16 读取文件使用 + public static string str; + public static string strOne; + public static int ip_exist = 0; + public static string Open_Use = "0"; + public static string Call_Server_Ip = "192.168.123.1";//kds_wav_posv_server_ip + [DllImport("kernel32")] + private static extern int GetPrivateProfileString( + string lpAppName, + string lpKeyName, + string lpDefault, + StringBuilder lpReturnedString, + int nSize, + string lpFileName); + public static string ContentReader(string area, string key, string def) + { + StringBuilder stringBuilder = new StringBuilder(1024); + GetPrivateProfileString(area, key, def, stringBuilder, 1024, str); + return stringBuilder.ToString(); + } + + [DllImport("kernel32")] + private static extern long WritePrivateProfileString( + string mpAppName, + string mpKeyName, + string mpDefault, + string mpFileName); + + + //============================================================== + + + private static Logger logger = NLog.LogManager.GetCurrentClassLogger(); + string test_screen; /// /// 上传厨显订单 /// @@ -21,6 +63,88 @@ namespace POSV.ServiceCenter public static void UploadNewOrder2SC4KDS(OrderObject orderObject) { } + //===================Yao 2024/02/20 + public class ComplexData + { + public string storename { get; set; } + public string seqnumber { get; set; } + public int totalcount { get; set; } + public string saledate { get; set; } + public MultiSpecie[] multispecies { get; set; } + public int states { get; set; } + } + + // Define a class to represent a person + public class MultiSpecie + { + public string menu { get; set; } + public int number { get; set; } + } + + public static void UploadHttpCallMenu(OrderObject orderObject) + { + logger.Info("订单[{0}]发送至KDS,订单类型:{1},就餐模式:{2},编号:{3}", orderObject.TradeNo, orderObject.OrderType, orderObject.BusMode, orderObject.OrderNo); + if (orderObject.OrderType == OrderType.外带 || orderObject.BusMode == "外带" || orderObject.OrderNo.IndexOf('D') == 0) + { + logger.Info("订单[{0}]发送至自提屏", orderObject.TradeNo); + if (ip_exist == 0) + { + str = Application.StartupPath + "\\cash_ip.ini"; + //此方法也可通过:str = System.AppDomain.CurrentDomain.BaseDirectory + @"ConnectString.ini"; + strOne = System.IO.Path.GetFileNameWithoutExtension(str); + if (File.Exists(str)) + { + ip_exist = 1; + + Open_Use = ContentReader(strOne, "open_use", ""); + Call_Server_Ip = ContentReader(strOne, "call_server_ip", ""); + } + } + if (Open_Use == "1") + { + ComplexData complexData = new ComplexData(); + complexData.storename = orderObject.StoreName; + complexData.seqnumber = orderObject.OrderNo; + complexData.saledate = orderObject.SaleDate; + complexData.totalcount = orderObject.Items.Count; + if (complexData.totalcount > 0) + { + complexData.multispecies = new MultiSpecie[complexData.totalcount]; + for (int i = 0; i < complexData.totalcount; i++) + { + complexData.multispecies[i] = new MultiSpecie(); + complexData.multispecies[i].menu = orderObject.Items[i].DisplayName; + complexData.multispecies[i].number = (int)orderObject.Items[i].Quantity; + } + string postString = JsonConvert.SerializeObject(complexData); + + byte[] postData = Encoding.UTF8.GetBytes(postString); + //string url = "http://localhost:60009/datong/api/call/device/states"; + string url = string.Format("http://{0}:60009/datong/api/call/device/states", Call_Server_Ip); + + WebClient client = new WebClient(); + client.Headers.Add("Content-Type", "application/json;charset=utf-8"); + client.Headers.Add("appID", "YJ1"); + client.Headers.Add("userID", "00000000"); + client.Headers.Add("timestamp", Environment.TickCount.ToString()); + client.Headers.Add("clientID", "000000"); + client.Headers.Add("Sign", "03510000"); + try + { + byte[] resultData = client.UploadData(url, "POST", postData); + string result_new = Encoding.Default.GetString(resultData); + //textBox1.Text = result; + } + catch + { + logger.Info("发送给叫号中心数据错误error"); + } + } + } + } + + } + public static void UploadNewOrder2SC4KDSMORE(OrderObject orderObject) { @@ -30,6 +154,7 @@ namespace POSV.ServiceCenter var enableKds = Global.Instance.GlobalConfigBoolValue(ConfigConstant.DEVICE_KITCHEN_DISPLAY_ENABLE, false); var allowKitchenDisplay = Global.Instance.GlobalConfigBoolValue(ConfigConstant.DEVICE_KITCHEN_DISPLAY_ALLOWCHUXIAN, false); var allowKdsChupin = Global.Instance.GlobalConfigBoolValue(ConfigConstant.DEVICE_KITCHEN_DISPLAY_ALLOWCHUPIN, true); + logger.Info("订单[{0}]发送至KDS", ConfigConstant.DEVICE_ORDERNO_ENABLE); if (enableKds) { var result = BuilderNewOrder(orderObject, allowKitchenDisplay, allowKdsChupin); @@ -37,6 +162,7 @@ namespace POSV.ServiceCenter { WSSE.Instance.Query>(CommandName.NEWORDER, result, SendNewOrderResult); logger.Info("订单[{0}]发送至KDS", orderObject.TradeNo); + UploadHttpCallMenu(orderObject); } else { @@ -166,7 +292,6 @@ namespace POSV.ServiceCenter using (var transaction = db.GetTransaction()) { var items = db.Fetch("where tradeNo = @0", order.TradeNo); - logger.Info("收到服务中心发送的接收订单[{0}]详情:{1}", order.TradeNo, JsonUtils.Serialize(items)); foreach (var kItem in order.Items) { var item = items.Find(x => x.Id == kItem.ItemId); @@ -178,7 +303,6 @@ namespace POSV.ServiceCenter string sql = string.Format("update pos_order_item set chuxianQty = {0} ,kdsChupinQty = {1},modifyDate='{2}' where id ='{3}' ", item.ChuxianQty, item.KdsChupinQty, item.ModifyDate, item.Id); db.Execute(sql); //db.Save(item); - logger.Info("收到服务中心发送的接收订单[{0}],更新详情信息:{1}", order.TradeNo, sql); } } transaction.Complete(); @@ -271,5 +395,83 @@ namespace POSV.ServiceCenter return order; } + + //private static POSV.Common.JsonObject.NewOrder BuilderNewOrder(OrderObject orderObject, bool chuxianFlag, bool kdsChupinFlag) + //{ + // var order = new POSV.Common.JsonObject.NewOrder(); + + // order.OrderId = orderObject.Id; + // order.PosNo = orderObject.PosNo; + // order.TradeNo = orderObject.TradeNo; + // order.OrderType = (int)orderObject.OrderType; + // order.OrderNo = orderObject.OrderNo; + // order.TableNo = orderObject.TableNo; + // order.People = orderObject.People; + // order.SaleDate = orderObject.FinishDate; + // order.TenantId = orderObject.TenantId; + // order.Caution = orderObject.Ext1; + // order.PosName = Global.Instance.GlobalConfigStringValue(ConfigConstant.CASHIER_POSNO, ""); + // order.SaleLastUpdateTime = orderObject.FinishDate; + + // Dictionary kdsDic = new Dictionary(); + // var chuxianParam = Global.Instance.GlobalConfigStringValue(ConfigConstant.DEVICE_KITCHEN_DISPLAY); + + // if (!string.IsNullOrEmpty(chuxianParam)) + // { + // var tempKdsParams = JsonUtils.Deserialize>(chuxianParam); + // var list = tempKdsParams.Values.ToList(); + // kdsDic = list.ToDictionary(x => x.PlanId, x => x.KdsNo); + // } + // else + // { + // //没有配置厨显设备 + // return null; + // } + + // string studyName = string.Empty; + // if (Global.Instance.IsStudyMode()) + // { + // studyName = Constant.STUDYMODE_PRINTSTR; + // } + + // var items = new List(); + // foreach (var o in orderObject.Items) + // { + // var item = new Common.JsonObject.OrderItem(); + // item.ItemId = o.Id; + // item.ProductId = o.ProductId; + // item.ProductName = studyName + o.DisplayName; + // item.MakeDesc = o.FlavorNames; + // item.TypeId = o.TypeId; + // item.TypeName = o.TypeName; + // item.Quantity = o.Quantity; + // item.SaleDate = orderObject.FinishDate; + // item.OrderNo = o.OrderNo; + // item.IsSuit = (int)o.RowState; + + // if (chuxianFlag && o.ChuxianFlag == "1" && !string.IsNullOrEmpty(o.Chuxian) && kdsDic.ContainsKey(o.Chuxian)) + // { + // item.HuacaiDevice = kdsDic[o.Chuxian]; + // //Yao 2023/08/23 增加外带叫号功能 + // if ((Global.screen_exist == 1)&& (Global.posv_screen_open == "1") && (Global.posv_send_times == 1)) + // { + // if (((item.HuacaiDevice == "None")|| (order.OrderType != 0))) + // item.HuacaiDevice = Global.posv_screen_id; + // } + // item.MakeDuration = o.ChuxianTime; + // } + // if (kdsChupinFlag && o.KdsChupinFlag == "1" && !string.IsNullOrEmpty(o.KdsChupin) && kdsDic.ContainsKey(o.KdsChupin)) + // { + // item.ChupinDevice = kdsDic[o.KdsChupin]; + // item.ChupinDuration = o.KdsChupinTime; + // } + + // items.Add(item); + // } + + // order.Items = items; + + // return order; + //} } } diff --git a/pos/POSV.Core/Utils/CardOperateUtils-yaojm.cs b/pos/POSV.Core/Utils/CardOperateUtils-yaojm.cs new file mode 100644 index 0000000..5d894cd --- /dev/null +++ b/pos/POSV.Core/Utils/CardOperateUtils-yaojm.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using POSV.Card; //Yao 2023/11/15 +namespace POSV.Utils +{ + public class CardOperateUtils + { + + private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + + private int _mifare_handle = 0; + + private const int TIMER_INTERVAL = 1000; + + private static CardOperateUtils _instance = null; + + private bool _termination = false; + + private bool _isUsing = false; + + public static CardOperateUtils Instance + { + get + { + if(_instance == null) + { + _instance = new CardOperateUtils(); + } + return _instance; + } + } + + /// + /// 中止 + /// + public void TerminationCardRead() + { + if (_isUsing) + { + _termination = true; + } + } + + public void InitReader() + { + InitReader(0, 9600); + } + + /// + /// 初始化 + /// + /// + public void InitReader(short port, int baud) + { + if(_mifare_handle == 0) + { + _mifare_handle = MifareCardUtils.Init(port, baud); + } + } + + /// + /// 自动初始化单次读卡 + /// + /// + public Tuple ReadCardNo() + { + InitReader(); + return ReadCardNo(true); + } + + public Tuple ReadCardNoContinue() + { + if (_isUsing) + { + return new Tuple(false, "正在读卡,请稍后重试!"); + } + _isUsing = true; + _termination = false; + Tuple result = new Tuple(false, "读卡失败"); + try + { + InitReader(); + if (_mifare_handle > 0) + { + + + var res = ReadCardNo(false); + if (res.Item1) + { + result = res; + } + + + } + else + { + result = new Tuple(false, "读卡器打开失败!"); + } + } + catch(Exception ex) + { + logger.Error(ex, "持续读卡发生异常"); + result = new Tuple(false, "读卡发生异常!"); + } + finally + { + CloseCardReader(); + _termination = false; + _isUsing = false; + } + return result; + } + + /// + /// 单次读卡 初始化读卡器 - 读卡 - 关闭读卡器 + /// + /// + /// + public Tuple ReadCardNo(bool autoClose) + { + try + { + if (_mifare_handle > 0) + { + logger.Info("读卡器连接成功! 开始寻找会员卡!"); + Tuple status = MifareCardUtils.Card(_mifare_handle); + + if (status.Item1 == 0) + { + logger.Info("检测到会员卡"); + //Yao 2024-04-23 added start + string reversedString = ""; + for (int i = status.Item2.Length - 2; i >= 0; i -= 2) + { + reversedString += status.Item2.Substring(i, 2); + } + + long decimalNumber = Convert.ToInt64(reversedString, 16); // 将倒序后的16进制字符串转换为10进制数 + string realCardNo = decimalNumber.ToString(); + //Yao 2024-04-23 added end + + //开始读卡 + Tuple data31 = MifareCardUtils.Read(_mifare_handle, 0, 0, 1); + + //卡号第一部分 + Tuple data1 = MifareCardUtils.Read(_mifare_handle, 0, 1, 0); + //卡号第二部分 + Tuple data2 = MifareCardUtils.Read(_mifare_handle, 0, 1, 1); + + if ((data31.Item1 == 0 && data1.Item1 == 0 && data2.Item1 == 0) || realCardNo != "")//Yao 2024-04-23 modify + { + var cardNo = data1.Item2 + data2.Item2; + logger.Info("读卡成功!卡号为[{0}]", cardNo); + + //是否蜂鸣 + MifareCardUtils.Beep(_mifare_handle, 25); + MifareCardUtils.Halt(_mifare_handle); + return new Tuple(true, realCardNo);//Yao 2024-04-23 modify + //return new Tuple(true, "373301" + realCardNo);//Yao 2024-04-23 modify + //return new Tuple(true, cardNo.Replace("\0", "")); + } + else + { + MifareCardUtils.Halt(_mifare_handle); + return new Tuple(false, "读卡失败,请移开后重试"); + } + } + else + { + + return new Tuple(false, "请将会员卡放置在读卡区"); + } + + } + else + { + return new Tuple(false, "读卡器连接失败!"); + } + } + catch (Exception ex) + { + logger.Error(ex, "读卡发生异常"); + return new Tuple(false, "读卡发生异常"); + } + finally + { + if (autoClose) CloseCardReader(); + } + } + /// + /// 关闭读卡器 + /// + /// + public void CloseCardReader() + { + try + { + logger.Info("关闭读卡器!"); + if (_mifare_handle > 0) + { + int status = MifareCardUtils.Exit(_mifare_handle); + if (status == 0) + { + logger.Info("断开读卡器连接!"); + } + else + { + logger.Info("读卡器连接断开失败:{0}", status); + } + } + else + { + logger.Info("没有连接读卡器"); + } + } + catch(Exception ex) + { + logger.Error(ex, "关闭读卡器发生异常!"); + } + finally + { + _mifare_handle = 0; + } + } + } +} diff --git a/pos/POSV.Core/Utils/MqttUtils.cs b/pos/POSV.Core/Utils/MqttUtils.cs index 847f029..1eb7dde 100644 --- a/pos/POSV.Core/Utils/MqttUtils.cs +++ b/pos/POSV.Core/Utils/MqttUtils.cs @@ -9,6 +9,7 @@ using uPLibrary.Networking.M2Mqtt.Utility; using POSV.Common; using POSV.Common.Transport; using POSV.Entity; +using POSV.HttpApi; namespace POSV.Utils { @@ -149,10 +150,8 @@ namespace POSV.Utils { var transport = JsonUtils.Deserialize>(json); var saleClear = transport.Data; - logger.Info($"收到消息中心通知:<{messageType.ToString()}>,Data:{saleClear}"); + logger.Info($"收到消息中心通知:<{messageType.ToString()}>,Data:{JsonUtils.Serialize(saleClear)}"); SaleClearUtils.Instance.SaveOrUpdateNoChanged(saleClear); - - SaleClearUtils.UploadSaleClear(saleClear); } break; default: diff --git a/pos/POSV.Core/Utils/SaleClearUtils.cs b/pos/POSV.Core/Utils/SaleClearUtils.cs index 6824bec..9486c64 100644 --- a/pos/POSV.Core/Utils/SaleClearUtils.cs +++ b/pos/POSV.Core/Utils/SaleClearUtils.cs @@ -1,7 +1,11 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.IO; using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Windows.Forms; using NLog; using POSV.Common.Transport; using POSV.Common.Util; @@ -20,6 +24,26 @@ namespace POSV.Utils private static SaleClearUtils _instance = null; + #region 20240309 subin 读取文件使用 + private static string configStr = ""; + + [DllImport("kernel32")] + private static extern int GetPrivateProfileString( + string lpAppName, + string lpKeyName, + string lpDefault, + StringBuilder lpReturnedString, + int nSize, + string lpFileName); + + public static string ContentReader(string area, string key, string def) + { + StringBuilder stringBuilder = new StringBuilder(1024); + GetPrivateProfileString(area, key, def, stringBuilder, 1024, configStr); + return stringBuilder.ToString(); + } + #endregion + public static SaleClearUtils Instance { get @@ -30,6 +54,10 @@ namespace POSV.Utils { _instance = new SaleClearUtils(); + #region 20240309 subin 加载沽清配置文件 + _instance.InitSaleClearConfig(); + #endregion + _instance.InitSaleClear(); } } @@ -38,7 +66,39 @@ namespace POSV.Utils } } - private ObservableDictionary _maps = null; + private ObservableDictionary _maps = null; + + #region 20240309 subin 加载沽清配置文件 + private void InitSaleClearConfig() + { + logger.Info("初始化沽清配置"); + configStr = Application.StartupPath + "\\cash_ip.ini"; + if (File.Exists(configStr)) + { + try + { + string strOne = System.IO.Path.GetFileNameWithoutExtension(configStr); + string IsSaleClearWeb = ContentReader(strOne, "is_sale", ""); + if (IsSaleClearWeb == "1") + { + Global.isSale2Web = true; + } + else + { + Global.isSale2Web = false; + } + } + catch (Exception ex) + { + logger.Error(ex, "读取cash_ip.ini错误。"); + } + } + else + { + logger.Info("未能找到配置文件cash_ip.ini"); + } + } + #endregion /// /// 加载今日沽清数据 @@ -47,31 +107,57 @@ namespace POSV.Utils { try { - var data = this.GetAvailableSaleClearList(); + #region subin 20240212 初始化时,从服务器获取沽清数据并同步至服务中心 + + //if (MessageCenterUtils.Instance.IsSaleClear) + //{ + // ////共享沽清模式 + // if (Global.isSale2Web) + // { + // var sdata = SaleClearApi.DownloadSaleClearList(); + // if (sdata.Item1) + // { + // foreach (var saleClear in sdata.Item3) + // { + // var transport = new TransportMessage(); + // transport.MessageType = MessageType.ProxySaleClear; + // transport.Data = saleClear; + + // MqttUtils.Instance.Publish(JsonUtils.Serialize(transport)); + + // logger.Info("同步服务器沽清数据至到消息中心<{0} - {1} = {2}>", saleClear.TotalQuantity, saleClear.SaleQuantity, saleClear.Quantity); + // } + // } + // } + //} + + #endregion + + var data = this.GetAvailableSaleClearList(); List rows = data.Item3; - - this._maps = new ObservableDictionary(); + + this._maps = new ObservableDictionary(); foreach (var row in rows) { row.Frozen = this.IsFrozen(row); this._maps[row.ProductId] = row; } - logger.Info("加载的沽清商品总数量<{0}>" , this._maps.Count); + logger.Info("加载的沽清商品总数量<{0}>", this._maps.Count); this._maps.CollectionChanged += OnCollectionChanged; } catch (Exception ex) { - logger.Error(ex , "加载沽清数据异常"); + logger.Error(ex, "加载沽清数据异常"); } } - + /// /// 加载沽清数据,区分本地数据和共享数据两种 /// - private Tuple> GetAvailableSaleClearList() + private Tuple> GetAvailableSaleClearList() { bool isSuccess = false; string message = string.Empty; @@ -79,13 +165,13 @@ namespace POSV.Utils List rows = new List(); try - { + { //启用全局沽清,服务中心提供数据 if (MessageCenterUtils.Instance.IsSaleClear) { logger.Info("获取服务中心的沽清数据"); - var data = MessageCenterUtils.Instance.GetGlobalAvailableSaleClear(); + var data = MessageCenterUtils.Instance.GetGlobalAvailableSaleClear(); isSuccess = data.Item1; message = data.Item2; rows = data.Item3; @@ -98,7 +184,7 @@ namespace POSV.Utils var startTime = DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); using (var db = Global.Instance.OpenDataBase) { - rows = db.Query("where startTime >=@0 and stopFlag == 0;" , startTime).ToList(); + rows = db.Query("where startTime >=@0 and stopFlag == 0;", startTime).ToList(); } isSuccess = true; @@ -110,35 +196,66 @@ namespace POSV.Utils isSuccess = false; message = "沽清数据异常"; - logger.Error(ex , message); + logger.Error(ex, message); } - return new Tuple>(isSuccess , message , rows); + return new Tuple>(isSuccess, message, rows); } - private void OnCollectionChanged(object sender , CollectionChangedEventArgs e) + private void OnCollectionChanged(object sender, CollectionChangedEventArgs e) { - logger.Info("操作沽清业务: {0}" , e.Action); + logger.Info("操作沽清业务: {0}", e.Action); - if (e.NewItem != null && e.NewItem is KeyValuePair) + if (e.NewItem != null && e.NewItem is KeyValuePair) { - var map = (KeyValuePair)e.NewItem; + var map = (KeyValuePair)e.NewItem; var saleClear = map.Value; - + + if (MessageCenterUtils.Instance.IsSaleClear) + { + if (Global.isSale2Web) + { + logger.Info("同步库存至云平台"); + var quantity = saleClear.Quantity + saleClear.SaleQuantity - saleClear.TotalQuantity; + + var uSaleClear = new SaleClear + { + ProductId = saleClear.ProductId, + SaleQuantity = quantity + }; + if (quantity > 0) + { + logger.Info($"操作沽清业务: {saleClear.ProductName},购{quantity}"); + SaleClearApi.UpdateQuantity(uSaleClear, "add"); + } + else + { + logger.Info($"操作沽清业务: {saleClear.ProductName},退{Math.Abs(quantity)}"); + SaleClearApi.UpdateQuantity(uSaleClear, "reduce"); + } + } + + } + + bool isSuccess = SaveSaleClear(saleClear); if (isSuccess) { //发送沽清变动通知 - MsgEvent.Send(Constant.SALE_CLEAR_CHANGED_NOTIFY , map.Value); + MsgEvent.Send(Constant.SALE_CLEAR_CHANGED_NOTIFY, map.Value); + + #region subin 20240212 收银台操作沽清后,同步至服务器 + //SaleClearApi.UploadSaleClear(saleClear); + #endregion } } else { logger.Warn("沽清业务数据不合法!"); - } + } } /// @@ -166,21 +283,21 @@ namespace POSV.Utils //尚未到沽清开始时间或者已经过期 var frozen = IsFrozen(entity); - + if (entity.Frozen != frozen) { entity.Frozen = frozen; this._maps[key] = entity; - logger.Info("沽清变动<{0}>" , entity.ProductName); + logger.Info("沽清变动<{0}>", entity.ProductName); } } - + } catch (Exception ex) { - logger.Error(ex , "清理过期沽清数据异常"); + logger.Error(ex, "清理过期沽清数据异常"); } } @@ -228,7 +345,7 @@ namespace POSV.Utils MqttUtils.Instance.Publish(JsonUtils.Serialize(transport)); - logger.Info("发布变动到消息中心<{0} - {1} = {2}>" , saleClear.TotalQuantity, saleClear.SaleQuantity,saleClear.Quantity); + logger.Info("发布变动到消息中心<{0} - {1} = {2}>", saleClear.TotalQuantity, saleClear.SaleQuantity, saleClear.Quantity); } else { @@ -255,7 +372,7 @@ namespace POSV.Utils catch (Exception ex) { isSuccess = false; - logger.Error(ex , "本机保存沽清异常"); + logger.Error(ex, "本机保存沽清异常"); } return isSuccess; @@ -265,18 +382,42 @@ namespace POSV.Utils { bool isSuccess = true; - this._maps.SaveOrUpdateNoChanged(saleClear.ProductId,saleClear); + + #region subin 20240309 subin 共享沽清时更新服务器上的沽清数据 + if (Global.isSale2Web) + { + var oldSaleClear = this.Maps.FirstOrDefault(m => m.Key == saleClear.ProductId); + + //取消沽清 + if (saleClear.StopFlag == 1) + { + logger.Info($"取消沽清{saleClear.ProductName}<{saleClear.ProductId}>"); + SaleClearApi.UploadSaleClear(saleClear); + } + else if (saleClear.StopFlag == 0) + { + //if (oldSaleClear.Key == null) + //{ + // SaleClearApi.UploadSaleClear(saleClear); + //} + SaleClearApi.UploadSaleClear(saleClear); + } + } + #endregion + + + this._maps.SaveOrUpdateNoChanged(saleClear.ProductId, saleClear); if (isSuccess) { //发送沽清变动通知 - MsgEvent.Send(Constant.SALE_CLEAR_CHANGED_NOTIFY , saleClear); + MsgEvent.Send(Constant.SALE_CLEAR_CHANGED_NOTIFY, saleClear); } return isSuccess; } - public ObservableDictionary Maps + public ObservableDictionary Maps { get { @@ -289,15 +430,20 @@ namespace POSV.Utils bool isSuccess = true; try { - var uploadObject = BuilderUploadObject(saleClear); - string jsonString = JsonUtils.Serialize(uploadObject); - var uploadResult = Uploading(jsonString); - - if (uploadResult.Item1) + //共享沽清模式 + if (MessageCenterUtils.Instance.IsSaleClear) { - isSuccess = true; - logger.Debug($"沽清数据上传成功:{jsonString}。"); + var uploadObject = BuilderUploadObject(saleClear); + string jsonString = JsonUtils.Serialize(uploadObject); + var uploadResult = Uploading(jsonString); + + if (uploadResult.Item1) + { + isSuccess = true; + logger.Debug($"沽清数据上传成功:{jsonString}。"); + } } + } catch (Exception ex) { diff --git a/pos/POSV.Core/Utils/SplitPayUtils.cs b/pos/POSV.Core/Utils/SplitPayUtils.cs index 4b98465..dd989b9 100644 --- a/pos/POSV.Core/Utils/SplitPayUtils.cs +++ b/pos/POSV.Core/Utils/SplitPayUtils.cs @@ -60,6 +60,13 @@ namespace POSV.Utils { isExist = true; logger.Info($"订单<{orderObject.TradeNo}>的分账信息已存在,不需要分账"); + + if (orderObject.IsSplited == 0) + { + var sql = $"update pos_order set isSplited=1 where id={orderObject.Id};"; + logger.Info($"日订单<{orderObject.TradeNo}>分账信息已存在,更改分账状态isSplited==>1"); + db.Execute(sql); + } } } @@ -395,6 +402,10 @@ namespace POSV.Utils } #endregion } + else + { + trans.Complete(); + } } } logger.Info($"完成保存订单<{orderObject.TradeNo}>的分账信息"); @@ -732,7 +743,11 @@ namespace POSV.Utils count = db.Query($"where isSplited = 0 and finishDate between '{sDate}' and '{eDate}';").Count(); //主单数据 //lists = db.Query("where syncStatus = 0 and uploadErrors < 3000 order by uploadErrors limit @0;", 1).ToList(); - var tmpPress = proMaxValue / 2 / count == 0 ? 1 : proMaxValue / 2 / count; + var tmpPress = 0; + if (count != 0) + { + tmpPress = proMaxValue / 2 / count == 0 ? 1 : proMaxValue / 2 / count; + } var pageCount = count % pageSize != 0 ? (count / pageSize) + 1 : count / pageSize; diff --git a/pos/POSV.Proxy/MqttClient/MqttClientUtils.cs b/pos/POSV.Proxy/MqttClient/MqttClientUtils.cs index 7cd14b1..b733ccd 100644 --- a/pos/POSV.Proxy/MqttClient/MqttClientUtils.cs +++ b/pos/POSV.Proxy/MqttClient/MqttClientUtils.cs @@ -60,8 +60,8 @@ namespace POSV.Proxy.Mqtt //2022-12-13 11:06 zhangy Edit 更换IP地址为域名 - //this.mqttClient = new MqttClient("mqtt.ffcygl.com", 18830, false, null, null, MqttSslProtocols.None); - this.mqttClient = new MqttClient("csmqtt.ffcygl.com", 18830, false, null, null, MqttSslProtocols.None); + this.mqttClient = new MqttClient("mqtt.ffcygl.com", 18830, false, null, null, MqttSslProtocols.None); + //this.mqttClient = new MqttClient("csmqtt.ffcygl.com", 18830, false, null, null, MqttSslProtocols.None); //this.mqttClient = new MqttClient("127.0.0.1", 1883, false, null, null, MqttSslProtocols.None); diff --git a/pos/POSV.Proxy/ThirdPartyOrder/JuWeiAppOrderProxy.cs b/pos/POSV.Proxy/ThirdPartyOrder/JuWeiAppOrderProxy.cs index 21a1d57..ba184d7 100644 --- a/pos/POSV.Proxy/ThirdPartyOrder/JuWeiAppOrderProxy.cs +++ b/pos/POSV.Proxy/ThirdPartyOrder/JuWeiAppOrderProxy.cs @@ -715,6 +715,15 @@ namespace POSV.Proxy.ThirdPartyOrder { LOGGET.Info($"第二次小程序订单查询<{busNo}>"); _data = this.Program_Order_Query_Bybusno(Global.Instance.Authc.StoreId, busNo); + + if (_data != null && _data.Item1 == false) + { + if (_data.Item2.Equals("小程序点餐_订单详情,请检测网络连接")) + { + LOGGET.Info($"第三次小程序订单查询<{busNo}>"); + _data = this.Program_Order_Query_Bybusno(Global.Instance.Authc.StoreId, busNo); + } + } } } @@ -780,6 +789,15 @@ namespace POSV.Proxy.ThirdPartyOrder { LOGGET.Info("第二次修改订单状态:<{0},{1}>", busNo, orderOperationType.ToString()); _data = this.Program_Order_Confirm(orderOperationType, Global.Instance.Authc.StoreId, busNo); + + if (_data != null && _data.Item1 == false) + { + if (_data.Item2.Equals("小程序点餐_订单接单,请检测网络连接")) + { + LOGGET.Info("第三次修改订单状态:<{0},{1}>", busNo, orderOperationType.ToString()); + _data = this.Program_Order_Confirm(orderOperationType, Global.Instance.Authc.StoreId, busNo); + } + } } } @@ -1667,35 +1685,44 @@ namespace POSV.Proxy.ThirdPartyOrder _orderdata.RPrint = true; } - LOGGET.Info("开始打印小程序订单.....<{0}>", _orderdata.TradeNo); - //打印入库 - //构建收银小票模版参数打印 - var vars = WaiMaiHelper.BuilderWeiXinVariable(_orderdata, isRprint); - - //自动切纸 - bool cutPager = Global.Instance.GlobalConfigBoolValue(ConfigConstant.PERIPHERAL_CASHIER_ALLOW_CUT_PAGER, false); - //是否允许打开钱箱 补打单、退单不开钱箱 - bool openCashbox = false; - //票头空白行 - int headerLine = Global.Instance.GlobalConfigIntValue(ConfigConstant.PERIPHERAL_CASHIER_HEADER_EMPTY, 0); - //票尾空白行 - int footerLine = Global.Instance.GlobalConfigIntValue(ConfigConstant.PERIPHERAL_CASHIER_FOOTER_EMPTY, 0); - //打印机 - var pobject = WaiMaiHelper.GetTicketPrinterObject("收银台打印机", cutPager, false); - - var printResult = WaiMaiHelper.PrinterTicket(pobject, "巨为小程序", vars, cutPager, openCashbox, headerLine, footerLine); - - LOGGET.Info("小程序订单打印结果.....<{0}>", printResult.Item2); - - - //打印标签 - LabelPrintHelper.PrintOrderLabel(_orderdata); - //执行厨打 - ChuDaHelper.KitchenPrinter(_orderdata); - //执行厨打标签 - ChuDaHelper.KitchenLabelPrinter(_orderdata); - //执行出品 - ChuDaHelper.MadePrinter(_orderdata); + //20240330 subin 收银小票,打印外带和自提的小票,不打印堂食票 + if (_orderdata.BusMode == "堂食" || _orderdata.OrderType == OrderType.堂食) + { + LOGGET.Info($"订单类型<{_orderdata.OrderType}>,不打印收银小票"); + //return new Tuple(true, "", "堂食不打印收银小票"); + } + else + { + LOGGET.Info("开始打印小程序订单.....<{0}>", _orderdata.TradeNo); + //打印入库 + //构建收银小票模版参数打印 + var vars = WaiMaiHelper.BuilderWeiXinVariable(_orderdata, isRprint); + + //自动切纸 + bool cutPager = Global.Instance.GlobalConfigBoolValue(ConfigConstant.PERIPHERAL_CASHIER_ALLOW_CUT_PAGER, false); + //是否允许打开钱箱 补打单、退单不开钱箱 + bool openCashbox = false; + //票头空白行 + int headerLine = Global.Instance.GlobalConfigIntValue(ConfigConstant.PERIPHERAL_CASHIER_HEADER_EMPTY, 0); + //票尾空白行 + int footerLine = Global.Instance.GlobalConfigIntValue(ConfigConstant.PERIPHERAL_CASHIER_FOOTER_EMPTY, 0); + //打印机 + var pobject = WaiMaiHelper.GetTicketPrinterObject("收银台打印机", cutPager, false); + + var printResult = WaiMaiHelper.PrinterTicket(pobject, "巨为小程序", vars, cutPager, openCashbox, headerLine, footerLine); + + LOGGET.Info("小程序订单打印结果.....<{0}>", printResult.Item2); + + + //打印标签 + LabelPrintHelper.PrintOrderLabel(_orderdata); + //执行厨打 + ChuDaHelper.KitchenPrinter(_orderdata); + //执行厨打标签 + ChuDaHelper.KitchenLabelPrinter(_orderdata); + //执行出品 + ChuDaHelper.MadePrinter(_orderdata); + } //通知厨显 UploadSCNewOrder.UploadNewOrder2SC4KDS(_orderdata); } @@ -1788,13 +1815,13 @@ namespace POSV.Proxy.ThirdPartyOrder { SoundUtils.PlaySound("weixin"); LOGGET.Info($"巨为小程序订单<{item}>播放声音,通知自动接单"); - }); + }); #endregion //请求接口查询订单 LOGGET.Info($"巨为小程序请求接口查询订单<{item}>"); var _order = _juWeiAppOrderProxy.GetOrder(item); - + LOGGET.Info($"巨为小程序请求接口查询订单<{item}>,返回结果:{JsonUtils.Serialize(_order)}"); if (_order == null) { LOGGET.Info("推送的巨为小程序订单号<{0}>在服务器中查询不到!", item); @@ -1843,6 +1870,7 @@ namespace POSV.Proxy.ThirdPartyOrder continue; } + //请求接口修改订单状态 var _status = _juWeiAppOrderProxy.SetOrderStatus(ProgramOrderOperationType.Confirm, item); _len--; @@ -1864,6 +1892,7 @@ namespace POSV.Proxy.ThirdPartyOrder LOGGET.Info("巨为小程序自动接单,开始组装数据....."); var _orderdata = getOrderLocalJuWeiOrder(_order.Item3); + LOGGET.Info($"巨为小程序自动接单,开始组装数据<{item}>,返回结果:{JsonUtils.Serialize(_orderdata)}"); if (_orderdata != null) { LOGGET.Info("巨为小程序自动接单,开始保存数据...."); @@ -1874,11 +1903,12 @@ namespace POSV.Proxy.ThirdPartyOrder LOGGET.Info($"巨为小程序自动接单<{item}>,数据保存成功,开始打印小票...."); //JuWeiAppOrderProxy.PrintOrder(_orderdata); + //20240129 subin 改为异步打印 Task.Factory.StartNew(() => { JuWeiAppOrderProxy.PrintOrder(_orderdata); - }); + }); #endregion #region subin 20230916 订单保存成功后处理分账明细 @@ -1890,6 +1920,50 @@ namespace POSV.Proxy.ThirdPartyOrder // SplitPayUtils.Instance.SaveSplitPayInfo(_orderdata); //}); #endregion + + + #region subin 20240322 沽清 + //处理参与沽清的业务 + var rows = _orderdata.Items; + if (rows.Count > 0) + { + foreach (var row in rows) + { + //套餐明细不处理沽清业务 + if (row.RowState == OrderRowState.套餐明) + { + continue; + } + + //添加沽清业务规则 + SaleClear saleClear = null; + if (SaleClearUtils.Instance.Maps.ContainsKey(row.ProductId)) + { + saleClear = SaleClearUtils.Instance.Maps[row.ProductId]; + } + //是否参与沽清 + bool isSaleClear = SaleClearUtils.Instance.CheckSaleClear(saleClear); + + if (isSaleClear && saleClear.Quantity > 0) + { + saleClear.SaleQuantity += row.Quantity; + + SaleClearUtils.Instance.Maps[row.ProductId] = saleClear; + + LOGGET.Info($"小程序沽清:{JsonUtils.Serialize(saleClear)}"); + } + //参与沽清,已经售完 + else if (isSaleClear && saleClear.Quantity <= 0) + { + LOGGET.Info($"小程序沽清,沽清售完了:{JsonUtils.Serialize(saleClear)}"); + } + } + } + else + { + LOGGET.Info("小程序沽清:没有明细"); + } + #endregion } else { diff --git a/pos/POSV.Template/Bill/MCardControl.cs b/pos/POSV.Template/Bill/MCardControl.cs index 4832d84..fed6772 100644 --- a/pos/POSV.Template/Bill/MCardControl.cs +++ b/pos/POSV.Template/Bill/MCardControl.cs @@ -221,6 +221,7 @@ namespace POSV.Bill if (result.Item1) { if (result.Item2.Length == 16) + //if (result.Item2.Length >= 10)//Yao 2024-04-23 原来是16 { if (!this.IsHandleCreated || this.IsDisposed) return; this.Invoke(new Action(() => diff --git a/pos/POSV.Template/Component/CouponForm.Designer.cs b/pos/POSV.Template/Component/CouponForm.Designer.cs index 192a6fd..68f1d37 100644 --- a/pos/POSV.Template/Component/CouponForm.Designer.cs +++ b/pos/POSV.Template/Component/CouponForm.Designer.cs @@ -31,6 +31,7 @@ namespace POSV.Component private void InitializeComponent() { this.doubleBufferPanelX1 = new POSV.Component.DoubleBufferPanelX(); + this.doubleBufferPanelX4 = new POSV.Component.DoubleBufferPanelX(); this.superTabControl1 = new DevComponents.DotNetBar.SuperTabControl(); this.superTabControlPanel1 = new DevComponents.DotNetBar.SuperTabControlPanel(); this.couponListPanel1 = new POSV.Component.CouponListPanel(); @@ -44,26 +45,20 @@ namespace POSV.Component this.doubleBufferPanelX2 = new POSV.Component.DoubleBufferPanelX(); this.lblUpPager = new POSV.Component.TouchLabelX(); this.lblDownPager = new POSV.Component.TouchLabelX(); - this.touchButtonX1 = new POSV.Component.TouchButtonX(); - this.doubleBufferPanelX4 = new POSV.Component.DoubleBufferPanelX(); this.labelX2 = new DevComponents.DotNetBar.LabelX(); - this.doubleBufferPanelX1.SuspendLayout(); + this.touchButtonX1 = new POSV.Component.TouchButtonX(); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit(); this.superTabControl1.SuspendLayout(); this.superTabControlPanel1.SuspendLayout(); this.superTabControlPanel2.SuspendLayout(); this.doubleBufferPanelX3.SuspendLayout(); this.doubleBufferPanelX2.SuspendLayout(); - this.doubleBufferPanelX4.SuspendLayout(); this.SuspendLayout(); // // doubleBufferPanelX1 // this.doubleBufferPanelX1.CanvasColor = System.Drawing.SystemColors.Control; this.doubleBufferPanelX1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.doubleBufferPanelX1.Controls.Add(this.superTabControl1); - this.doubleBufferPanelX1.Controls.Add(this.doubleBufferPanelX3); - this.doubleBufferPanelX1.Controls.Add(this.doubleBufferPanelX2); this.doubleBufferPanelX1.DisabledBackColor = System.Drawing.Color.Empty; this.doubleBufferPanelX1.Dock = System.Windows.Forms.DockStyle.Fill; this.doubleBufferPanelX1.Location = new System.Drawing.Point(2, 48); @@ -77,6 +72,24 @@ namespace POSV.Component this.doubleBufferPanelX1.Style.GradientAngle = 90; this.doubleBufferPanelX1.TabIndex = 8; // + // doubleBufferPanelX4 + // + this.doubleBufferPanelX4.CanvasColor = System.Drawing.SystemColors.Control; + this.doubleBufferPanelX4.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.doubleBufferPanelX4.DisabledBackColor = System.Drawing.Color.Empty; + this.doubleBufferPanelX4.Dock = System.Windows.Forms.DockStyle.Top; + this.doubleBufferPanelX4.Location = new System.Drawing.Point(2, 2); + this.doubleBufferPanelX4.Name = "doubleBufferPanelX4"; + this.doubleBufferPanelX4.Padding = new System.Windows.Forms.Padding(3); + this.doubleBufferPanelX4.Size = new System.Drawing.Size(442, 46); + this.doubleBufferPanelX4.Style.Alignment = System.Drawing.StringAlignment.Center; + this.doubleBufferPanelX4.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.doubleBufferPanelX4.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.doubleBufferPanelX4.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.doubleBufferPanelX4.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.doubleBufferPanelX4.Style.GradientAngle = 90; + this.doubleBufferPanelX4.TabIndex = 12; + // // superTabControl1 // this.superTabControl1.AutoCloseTabs = false; @@ -261,7 +274,7 @@ namespace POSV.Component // // lblUpPager // - this.lblUpPager.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(233)))), ((int)(((byte)(127)))), ((int)(((byte)(42))))); + this.lblUpPager.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(193)))), ((int)(((byte)(184))))); this.lblUpPager.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(193)))), ((int)(((byte)(184))))); this.lblUpPager.BackColor2 = System.Drawing.Color.Tan; // @@ -283,7 +296,7 @@ namespace POSV.Component // // lblDownPager // - this.lblDownPager.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(233)))), ((int)(((byte)(127)))), ((int)(((byte)(42))))); + this.lblDownPager.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(193)))), ((int)(((byte)(184))))); this.lblDownPager.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), ((int)(((byte)(193)))), ((int)(((byte)(184))))); this.lblDownPager.BackColor2 = System.Drawing.Color.Tan; // @@ -303,6 +316,23 @@ namespace POSV.Component this.lblDownPager.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; this.lblDownPager.Click += new System.EventHandler(this.OnPageDownClick); // + // labelX2 + // + // + // + // + this.labelX2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.labelX2.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelX2.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.labelX2.ForeColor = System.Drawing.Color.Black; + this.labelX2.Location = new System.Drawing.Point(3, 3); + this.labelX2.Name = "labelX2"; + this.labelX2.Size = new System.Drawing.Size(231, 40); + this.labelX2.TabIndex = 17; + this.labelX2.Text = "核销电子优惠券"; + this.labelX2.TextAlignment = System.Drawing.StringAlignment.Center; + this.labelX2.WordWrap = true; + // // touchButtonX1 // this.touchButtonX1.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(98)))), ((int)(((byte)(92)))), ((int)(((byte)(86))))); @@ -341,43 +371,6 @@ namespace POSV.Component this.touchButtonX1.Text = "关闭"; this.touchButtonX1.TouchClick += new POSV.Component.TouchButtonX.EventHandler(this.OnCloseTouchClick); // - // doubleBufferPanelX4 - // - this.doubleBufferPanelX4.CanvasColor = System.Drawing.SystemColors.Control; - this.doubleBufferPanelX4.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.doubleBufferPanelX4.Controls.Add(this.labelX2); - this.doubleBufferPanelX4.Controls.Add(this.touchButtonX1); - this.doubleBufferPanelX4.DisabledBackColor = System.Drawing.Color.Empty; - this.doubleBufferPanelX4.Dock = System.Windows.Forms.DockStyle.Top; - this.doubleBufferPanelX4.Location = new System.Drawing.Point(2, 2); - this.doubleBufferPanelX4.Name = "doubleBufferPanelX4"; - this.doubleBufferPanelX4.Padding = new System.Windows.Forms.Padding(3); - this.doubleBufferPanelX4.Size = new System.Drawing.Size(442, 46); - this.doubleBufferPanelX4.Style.Alignment = System.Drawing.StringAlignment.Center; - this.doubleBufferPanelX4.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.doubleBufferPanelX4.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.doubleBufferPanelX4.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.doubleBufferPanelX4.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.doubleBufferPanelX4.Style.GradientAngle = 90; - this.doubleBufferPanelX4.TabIndex = 12; - // - // labelX2 - // - // - // - // - this.labelX2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX2.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelX2.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.labelX2.ForeColor = System.Drawing.Color.Black; - this.labelX2.Location = new System.Drawing.Point(3, 3); - this.labelX2.Name = "labelX2"; - this.labelX2.Size = new System.Drawing.Size(231, 40); - this.labelX2.TabIndex = 17; - this.labelX2.Text = "核销电子优惠券"; - this.labelX2.TextAlignment = System.Drawing.StringAlignment.Center; - this.labelX2.WordWrap = true; - // // CouponForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -388,14 +381,12 @@ namespace POSV.Component this.Name = "CouponForm"; this.Padding = new System.Windows.Forms.Padding(2); this.Text = "CouponForm"; - this.doubleBufferPanelX1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).EndInit(); this.superTabControl1.ResumeLayout(false); this.superTabControlPanel1.ResumeLayout(false); this.superTabControlPanel2.ResumeLayout(false); this.doubleBufferPanelX3.ResumeLayout(false); this.doubleBufferPanelX2.ResumeLayout(false); - this.doubleBufferPanelX4.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/pos/POSV.Template/OtherWaiMai/MeituanForm.cs b/pos/POSV.Template/OtherWaiMai/MeituanForm.cs index a6a2c94..e70d563 100644 --- a/pos/POSV.Template/OtherWaiMai/MeituanForm.cs +++ b/pos/POSV.Template/OtherWaiMai/MeituanForm.cs @@ -139,7 +139,7 @@ namespace POSV.WaiMai obj.Enabled = true; } - + } /// @@ -422,7 +422,7 @@ namespace POSV.WaiMai //天气 _BackOrderObject.Weather = string.Empty; _BackOrderObject.ObjectId = ObjectId.GenerateNewStringId(); - _BackOrderObject.TradeNo = OrderUtils.Instance.GenerateTicketNo(); + _BackOrderObject.TradeNo = _BackOrderObject.OrderType.ToString() + OrderUtils.Instance.GenerateTicketNo(); _BackOrderObject.FinishDate = finishDate; _BackOrderObject.Amount = 0 - _OrderObject.Amount; _BackOrderObject.DiscountAmount = 0 - _OrderObject.DiscountAmount; @@ -1394,7 +1394,7 @@ namespace POSV.WaiMai { obj.Enabled = true; } - + } private void cbstatus_change_click(object sender, EventArgs e) diff --git a/pos/POSV.Template/QiMai/QiMaiForm.Designer.cs b/pos/POSV.Template/QiMai/QiMaiForm.Designer.cs index 8da2ddf..9be359d 100644 --- a/pos/POSV.Template/QiMai/QiMaiForm.Designer.cs +++ b/pos/POSV.Template/QiMai/QiMaiForm.Designer.cs @@ -29,7 +29,11 @@ private void InitializeComponent() { this.doubleBufferPanelX2 = new POSV.Component.DoubleBufferPanelX(); + this.doubleBufferPanelX5 = new POSV.Component.DoubleBufferPanelX(); this.doubleBufferPanelX3 = new POSV.Component.DoubleBufferPanelX(); + this.doubleBufferPanelX7 = new POSV.Component.DoubleBufferPanelX(); + this.buttonX11 = new DevComponents.DotNetBar.ButtonX(); + this.labelX5 = new DevComponents.DotNetBar.LabelX(); this.superTabControl1 = new DevComponents.DotNetBar.SuperTabControl(); this.superTabControlPanel1 = new DevComponents.DotNetBar.SuperTabControlPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); @@ -52,7 +56,6 @@ this.checkBoxX0 = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.dateInputPicker = new POSV.Component.DatePicker(); this.superTabItem2 = new DevComponents.DotNetBar.SuperTabItem(); - this.doubleBufferPanelX7 = new POSV.Component.DoubleBufferPanelX(); this.touchButtonX2 = new POSV.Component.TouchButtonX(); this.labelX2 = new DevComponents.DotNetBar.LabelX(); this.ButtonClose = new POSV.Component.TouchButtonX(); @@ -67,11 +70,6 @@ this.labelX4 = new DevComponents.DotNetBar.LabelX(); this.StoreNameLabelX = new DevComponents.DotNetBar.LabelX(); this.labelX1 = new DevComponents.DotNetBar.LabelX(); - this.doubleBufferPanelX5 = new POSV.Component.DoubleBufferPanelX(); - this.buttonX11 = new DevComponents.DotNetBar.ButtonX(); - this.labelX5 = new DevComponents.DotNetBar.LabelX(); - this.doubleBufferPanelX2.SuspendLayout(); - this.doubleBufferPanelX3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit(); this.superTabControl1.SuspendLayout(); this.superTabControlPanel1.SuspendLayout(); @@ -79,16 +77,12 @@ this.superTabControlPanel2.SuspendLayout(); this.doubleBufferPanelX6.SuspendLayout(); this.doubleBufferPanelX1.SuspendLayout(); - this.doubleBufferPanelX7.SuspendLayout(); - this.doubleBufferPanelX5.SuspendLayout(); this.SuspendLayout(); // // doubleBufferPanelX2 // this.doubleBufferPanelX2.CanvasColor = System.Drawing.SystemColors.Control; this.doubleBufferPanelX2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.doubleBufferPanelX2.Controls.Add(this.doubleBufferPanelX3); - this.doubleBufferPanelX2.Controls.Add(this.doubleBufferPanelX7); this.doubleBufferPanelX2.DisabledBackColor = System.Drawing.Color.Empty; this.doubleBufferPanelX2.Dock = System.Windows.Forms.DockStyle.Fill; this.doubleBufferPanelX2.Location = new System.Drawing.Point(0, 49); @@ -102,11 +96,28 @@ this.doubleBufferPanelX2.Style.GradientAngle = 90; this.doubleBufferPanelX2.TabIndex = 280; // + // doubleBufferPanelX5 + // + this.doubleBufferPanelX5.CanvasColor = System.Drawing.SystemColors.Control; + this.doubleBufferPanelX5.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.doubleBufferPanelX5.DisabledBackColor = System.Drawing.Color.Empty; + this.doubleBufferPanelX5.Dock = System.Windows.Forms.DockStyle.Top; + this.doubleBufferPanelX5.Location = new System.Drawing.Point(0, 0); + this.doubleBufferPanelX5.Name = "doubleBufferPanelX5"; + this.doubleBufferPanelX5.Size = new System.Drawing.Size(1024, 49); + this.doubleBufferPanelX5.Style.Alignment = System.Drawing.StringAlignment.Center; + this.doubleBufferPanelX5.Style.BackColor1.Color = System.Drawing.Color.Transparent; + this.doubleBufferPanelX5.Style.BackColor2.Color = System.Drawing.Color.White; + this.doubleBufferPanelX5.Style.Border = DevComponents.DotNetBar.eBorderType.DoubleLine; + this.doubleBufferPanelX5.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.doubleBufferPanelX5.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.doubleBufferPanelX5.Style.GradientAngle = 90; + this.doubleBufferPanelX5.TabIndex = 273; + // // doubleBufferPanelX3 // this.doubleBufferPanelX3.CanvasColor = System.Drawing.SystemColors.Control; this.doubleBufferPanelX3.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.doubleBufferPanelX3.Controls.Add(this.superTabControl1); this.doubleBufferPanelX3.DisabledBackColor = System.Drawing.Color.Empty; this.doubleBufferPanelX3.Dock = System.Windows.Forms.DockStyle.Fill; this.doubleBufferPanelX3.Location = new System.Drawing.Point(0, 0); @@ -120,6 +131,58 @@ this.doubleBufferPanelX3.Style.GradientAngle = 90; this.doubleBufferPanelX3.TabIndex = 262; // + // doubleBufferPanelX7 + // + this.doubleBufferPanelX7.CanvasColor = System.Drawing.SystemColors.Control; + this.doubleBufferPanelX7.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.doubleBufferPanelX7.DisabledBackColor = System.Drawing.Color.Empty; + this.doubleBufferPanelX7.Dock = System.Windows.Forms.DockStyle.Right; + this.doubleBufferPanelX7.Location = new System.Drawing.Point(745, 0); + this.doubleBufferPanelX7.Name = "doubleBufferPanelX7"; + this.doubleBufferPanelX7.Size = new System.Drawing.Size(279, 719); + this.doubleBufferPanelX7.Style.Alignment = System.Drawing.StringAlignment.Center; + this.doubleBufferPanelX7.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.doubleBufferPanelX7.Style.BackColor2.Color = System.Drawing.Color.White; + this.doubleBufferPanelX7.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.doubleBufferPanelX7.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.doubleBufferPanelX7.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.doubleBufferPanelX7.Style.GradientAngle = 90; + this.doubleBufferPanelX7.TabIndex = 258; + // + // buttonX11 + // + this.buttonX11.AccessibleRole = System.Windows.Forms.AccessibleRole.RadioButton; + this.buttonX11.BackColor = System.Drawing.Color.Transparent; + this.buttonX11.ColorTable = DevComponents.DotNetBar.eButtonColor.Flat; + this.buttonX11.Cursor = System.Windows.Forms.Cursors.Hand; + this.buttonX11.Dock = System.Windows.Forms.DockStyle.Right; + this.buttonX11.FadeEffect = false; + this.buttonX11.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonX11.HotTrackingStyle = DevComponents.DotNetBar.eHotTrackingStyle.None; + this.buttonX11.Image = global::POSV.Properties.Resources.X; + this.buttonX11.Location = new System.Drawing.Point(975, 0); + this.buttonX11.Name = "buttonX11"; + this.buttonX11.Size = new System.Drawing.Size(49, 49); + this.buttonX11.TabIndex = 239; + this.buttonX11.TextColor = System.Drawing.Color.White; + this.buttonX11.Click += new System.EventHandler(this.OnControlBoxCloseClick); + // + // labelX5 + // + // + // + // + this.labelX5.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.labelX5.Dock = System.Windows.Forms.DockStyle.Fill; + this.labelX5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.labelX5.Location = new System.Drawing.Point(0, 0); + this.labelX5.Name = "labelX5"; + this.labelX5.PaddingLeft = 10; + this.labelX5.Size = new System.Drawing.Size(1024, 49); + this.labelX5.TabIndex = 0; + this.labelX5.Text = "在线订单"; + this.labelX5.TextAlignment = System.Drawing.StringAlignment.Center; + // // superTabControl1 // this.superTabControl1.BackColor = System.Drawing.Color.White; @@ -138,8 +201,8 @@ this.superTabControl1.ControlBox.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { this.superTabControl1.ControlBox.MenuBox, this.superTabControl1.ControlBox.CloseBox}); - this.superTabControl1.Controls.Add(this.superTabControlPanel2); this.superTabControl1.Controls.Add(this.superTabControlPanel1); + this.superTabControl1.Controls.Add(this.superTabControlPanel2); this.superTabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.superTabControl1.Font = new System.Drawing.Font("宋体", 15F); this.superTabControl1.ForeColor = System.Drawing.Color.Black; @@ -585,38 +648,6 @@ this.superTabItem2.Text = "历史订单"; this.superTabItem2.Click += new System.EventHandler(this.TabOnclick); // - // doubleBufferPanelX7 - // - this.doubleBufferPanelX7.CanvasColor = System.Drawing.SystemColors.Control; - this.doubleBufferPanelX7.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.doubleBufferPanelX7.Controls.Add(this.touchButtonX2); - this.doubleBufferPanelX7.Controls.Add(this.labelX2); - this.doubleBufferPanelX7.Controls.Add(this.ButtonClose); - this.doubleBufferPanelX7.Controls.Add(this.touchButtonX1); - this.doubleBufferPanelX7.Controls.Add(this.labelX9); - this.doubleBufferPanelX7.Controls.Add(this.labelX8); - this.doubleBufferPanelX7.Controls.Add(this.openTimeLabelX); - this.doubleBufferPanelX7.Controls.Add(this.radioButtonClose); - this.doubleBufferPanelX7.Controls.Add(this.labelX7); - this.doubleBufferPanelX7.Controls.Add(this.radioButtonOpen); - this.doubleBufferPanelX7.Controls.Add(this.isOpenLabelX); - this.doubleBufferPanelX7.Controls.Add(this.labelX4); - this.doubleBufferPanelX7.Controls.Add(this.StoreNameLabelX); - this.doubleBufferPanelX7.Controls.Add(this.labelX1); - this.doubleBufferPanelX7.DisabledBackColor = System.Drawing.Color.Empty; - this.doubleBufferPanelX7.Dock = System.Windows.Forms.DockStyle.Right; - this.doubleBufferPanelX7.Location = new System.Drawing.Point(745, 0); - this.doubleBufferPanelX7.Name = "doubleBufferPanelX7"; - this.doubleBufferPanelX7.Size = new System.Drawing.Size(279, 719); - this.doubleBufferPanelX7.Style.Alignment = System.Drawing.StringAlignment.Center; - this.doubleBufferPanelX7.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.doubleBufferPanelX7.Style.BackColor2.Color = System.Drawing.Color.White; - this.doubleBufferPanelX7.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.doubleBufferPanelX7.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.doubleBufferPanelX7.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.doubleBufferPanelX7.Style.GradientAngle = 90; - this.doubleBufferPanelX7.TabIndex = 258; - // // touchButtonX2 // this.touchButtonX2.BackColor1 = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(91)))), ((int)(((byte)(99))))); @@ -906,60 +937,6 @@ this.labelX1.Text = "企迈店铺:"; this.labelX1.WordWrap = true; // - // doubleBufferPanelX5 - // - this.doubleBufferPanelX5.CanvasColor = System.Drawing.SystemColors.Control; - this.doubleBufferPanelX5.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.doubleBufferPanelX5.Controls.Add(this.buttonX11); - this.doubleBufferPanelX5.Controls.Add(this.labelX5); - this.doubleBufferPanelX5.DisabledBackColor = System.Drawing.Color.Empty; - this.doubleBufferPanelX5.Dock = System.Windows.Forms.DockStyle.Top; - this.doubleBufferPanelX5.Location = new System.Drawing.Point(0, 0); - this.doubleBufferPanelX5.Name = "doubleBufferPanelX5"; - this.doubleBufferPanelX5.Size = new System.Drawing.Size(1024, 49); - this.doubleBufferPanelX5.Style.Alignment = System.Drawing.StringAlignment.Center; - this.doubleBufferPanelX5.Style.BackColor1.Color = System.Drawing.Color.Transparent; - this.doubleBufferPanelX5.Style.BackColor2.Color = System.Drawing.Color.White; - this.doubleBufferPanelX5.Style.Border = DevComponents.DotNetBar.eBorderType.DoubleLine; - this.doubleBufferPanelX5.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.doubleBufferPanelX5.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.doubleBufferPanelX5.Style.GradientAngle = 90; - this.doubleBufferPanelX5.TabIndex = 273; - // - // buttonX11 - // - this.buttonX11.AccessibleRole = System.Windows.Forms.AccessibleRole.RadioButton; - this.buttonX11.BackColor = System.Drawing.Color.Transparent; - this.buttonX11.ColorTable = DevComponents.DotNetBar.eButtonColor.Flat; - this.buttonX11.Cursor = System.Windows.Forms.Cursors.Hand; - this.buttonX11.Dock = System.Windows.Forms.DockStyle.Right; - this.buttonX11.FadeEffect = false; - this.buttonX11.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.buttonX11.HotTrackingStyle = DevComponents.DotNetBar.eHotTrackingStyle.None; - this.buttonX11.Image = global::POSV.Properties.Resources.X; - this.buttonX11.Location = new System.Drawing.Point(975, 0); - this.buttonX11.Name = "buttonX11"; - this.buttonX11.Size = new System.Drawing.Size(49, 49); - this.buttonX11.TabIndex = 239; - this.buttonX11.TextColor = System.Drawing.Color.White; - this.buttonX11.Click += new System.EventHandler(this.OnControlBoxCloseClick); - // - // labelX5 - // - // - // - // - this.labelX5.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.labelX5.Dock = System.Windows.Forms.DockStyle.Fill; - this.labelX5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.labelX5.Location = new System.Drawing.Point(0, 0); - this.labelX5.Name = "labelX5"; - this.labelX5.PaddingLeft = 10; - this.labelX5.Size = new System.Drawing.Size(1024, 49); - this.labelX5.TabIndex = 0; - this.labelX5.Text = "在线订单"; - this.labelX5.TextAlignment = System.Drawing.StringAlignment.Center; - // // QiMaiForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -970,8 +947,6 @@ this.Name = "QiMaiForm"; this.Text = "QiMaiForm"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; - this.doubleBufferPanelX2.ResumeLayout(false); - this.doubleBufferPanelX3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).EndInit(); this.superTabControl1.ResumeLayout(false); this.superTabControlPanel1.ResumeLayout(false); @@ -979,8 +954,6 @@ this.superTabControlPanel2.ResumeLayout(false); this.doubleBufferPanelX6.ResumeLayout(false); this.doubleBufferPanelX1.ResumeLayout(false); - this.doubleBufferPanelX7.ResumeLayout(false); - this.doubleBufferPanelX5.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/pos/POSV.Template/Shift/ShiftForm.cs b/pos/POSV.Template/Shift/ShiftForm.cs index fc40776..ecf6c58 100644 --- a/pos/POSV.Template/Shift/ShiftForm.cs +++ b/pos/POSV.Template/Shift/ShiftForm.cs @@ -1300,52 +1300,63 @@ namespace POSV.Shift ////交班后重启收银程序 //Global.Instance.Restart = true; //Application.ExitThread(); - while (splitPayFinished || DateTime.Now.Minute > shiftDateTime.AddMinutes(20).Minute) + while (splitPayFinished || DateTime.Now > shiftDateTime) { if (splitPayFinished) { LOGGER.Info("交接班分账,splitPayFinished=true"); + + splitPayFinished = false; + shiftDateTime = shiftDateTime.AddHours(1); + + break; } - else if (DateTime.Now.Minute > shiftDateTime.AddMinutes(20).Minute) + + + if (DateTime.Now > shiftDateTime.AddMinutes(20)) { LOGGER.Info("交接班分账,超出规定分账时长<20>分钟"); - } - splitPayFinished = false; - shiftDateTime = shiftDateTime.AddMinutes(100); - //刷新界面??? - - //交班打印 - this.ShowToastNotify(this, "开始打印"); - //构建收银小票模版参数 - handOverTicket.PrintType = ""; - handOverTicket.handMoney = handsMoney;//手工金额 - handOverTicket.diffMoney = difMoney;//差异金额 - bool ShiftPrint = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_SHIFPRINT, false); - - LOGGER.Info("-------------------构建小票参数------------------------------"); - LOGGER.Info(JsonUtils.Serialize(this.handOverTicket)); - var vars = ShiftHelper.BuilderTicketVariable(handOverTicket, ShiftPrint, false); - LOGGER.Info("-------------------------------------------------"); - //交班开钱箱 - bool openCashbox = false; - if (Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_ISSHIFTOPENCASH)) - { - openCashbox = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_ISSHIFTOPENCASH); - } - Tuple result = ShiftHelper.PrinterTicket("交班汇总", vars, true, openCashbox); - this.ShowToastNotify(this, string.Format("{0}", result.Item2)); - //是否交班 - Global.isHandOver = false; - StoreBusinessUtils.SaveOperationLog("103", "班次:" + handOverTicket.ShiftNo); - //关闭当前秤 - MsgEvent.Send(Constant.CURRENTSTEELYARD_STATUS_CHANGE, "close"); - //两秒退出系统 - System.Threading.Thread.Sleep(2000); - OnCloseTouchClick(sender, e); - //交班后重启收银程序 - Global.Instance.Restart = true; - Application.ExitThread(); + + splitPayFinished = false; + shiftDateTime = shiftDateTime.AddHours(1); + + break; + } + } + + //刷新界面??? + + //交班打印 + this.ShowToastNotify(this, "开始打印"); + //构建收银小票模版参数 + handOverTicket.PrintType = ""; + handOverTicket.handMoney = handsMoney;//手工金额 + handOverTicket.diffMoney = difMoney;//差异金额 + bool ShiftPrint = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_SHIFPRINT, false); + + LOGGER.Info("-------------------构建小票参数------------------------------"); + LOGGER.Info(JsonUtils.Serialize(this.handOverTicket)); + var vars = ShiftHelper.BuilderTicketVariable(handOverTicket, ShiftPrint, false); + LOGGER.Info("-------------------------------------------------"); + //交班开钱箱 + bool openCashbox = false; + if (Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_ISSHIFTOPENCASH)) + { + openCashbox = Global.Instance.GlobalConfigBoolValue(ConfigConstant.CONFIG_CASHIER_ISSHIFTOPENCASH); } + Tuple result = ShiftHelper.PrinterTicket("交班汇总", vars, true, openCashbox); + this.ShowToastNotify(this, string.Format("{0}", result.Item2)); + //是否交班 + Global.isHandOver = false; + StoreBusinessUtils.SaveOperationLog("103", "班次:" + handOverTicket.ShiftNo); + //关闭当前秤 + MsgEvent.Send(Constant.CURRENTSTEELYARD_STATUS_CHANGE, "close"); + //两秒退出系统 + System.Threading.Thread.Sleep(2000); + OnCloseTouchClick(sender, e); + //交班后重启收银程序 + Global.Instance.Restart = true; + Application.ExitThread(); } } catch (Exception ex) diff --git a/pos/Test/Form1.Designer.cs b/pos/Test/Form1.Designer.cs new file mode 100644 index 0000000..dcac703 --- /dev/null +++ b/pos/Test/Form1.Designer.cs @@ -0,0 +1,953 @@ + +namespace POSV +{ + partial class Form1 + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.txtResponseResult = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.txtMethod = new System.Windows.Forms.TextBox(); + this.txtRequest = new System.Windows.Forms.TextBox(); + this.label19 = new System.Windows.Forms.Label(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.textBox6 = new System.Windows.Forms.TextBox(); + this.label27 = new System.Windows.Forms.Label(); + this.button9 = new System.Windows.Forms.Button(); + this.label20 = new System.Windows.Forms.Label(); + this.label21 = new System.Windows.Forms.Label(); + this.txtVerificationCode = new System.Windows.Forms.TextBox(); + this.txtBizUserId2 = new System.Windows.Forms.TextBox(); + this.label26 = new System.Windows.Forms.Label(); + this.button3 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.label22 = new System.Windows.Forms.Label(); + this.label25 = new System.Windows.Forms.Label(); + this.button5 = new System.Windows.Forms.Button(); + this.txtCustomerUserId = new System.Windows.Forms.TextBox(); + this.txtPhone = new System.Windows.Forms.TextBox(); + this.label24 = new System.Windows.Forms.Label(); + this.label23 = new System.Windows.Forms.Label(); + this.button7 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.btnTermInfoManage = new System.Windows.Forms.Button(); + this.cboOperationType = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.comboItem9 = new DevComponents.Editors.ComboItem(); + this.comboItem10 = new DevComponents.Editors.ComboItem(); + this.txtSybappid = new System.Windows.Forms.TextBox(); + this.txtBizUserId = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.btnVspTermidInfoManage = new System.Windows.Forms.Button(); + this.cboTermstate = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.comboItem7 = new DevComponents.Editors.ComboItem(); + this.comboItem8 = new DevComponents.Editors.ComboItem(); + this.cboDevicetype = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.comboItem5 = new DevComponents.Editors.ComboItem(); + this.comboItem6 = new DevComponents.Editors.ComboItem(); + this.cboOperation = new DevComponents.DotNetBar.Controls.ComboBoxEx(); + this.comboItem1 = new DevComponents.Editors.ComboItem(); + this.comboItem2 = new DevComponents.Editors.ComboItem(); + this.comboItem3 = new DevComponents.Editors.ComboItem(); + this.comboItem4 = new DevComponents.Editors.ComboItem(); + this.txtTermsn = new System.Windows.Forms.TextBox(); + this.txtTermaddress = new System.Windows.Forms.TextBox(); + this.label16 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.txtTermno = new System.Windows.Forms.TextBox(); + this.txtVspCusid = new System.Windows.Forms.TextBox(); + this.txtVspMerchantid = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.btnOrder2Split = new System.Windows.Forms.Button(); + this.tabPage4 = new System.Windows.Forms.TabPage(); + this.btnMqttServerStart = new System.Windows.Forms.Button(); + this.btnSimulationOrder = new System.Windows.Forms.Button(); + this.btnMqttInit = new System.Windows.Forms.Button(); + this.btnMqttServerClose = new System.Windows.Forms.Button(); + this.txtMqttLog = new System.Windows.Forms.TextBox(); + this.txtSplitLog = new System.Windows.Forms.TextBox(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.tabPage3.SuspendLayout(); + this.tabPage4.SuspendLayout(); + this.SuspendLayout(); + // + // txtResponseResult + // + this.txtResponseResult.Location = new System.Drawing.Point(390, 354); + this.txtResponseResult.Multiline = true; + this.txtResponseResult.Name = "txtResponseResult"; + this.txtResponseResult.ReadOnly = true; + this.txtResponseResult.Size = new System.Drawing.Size(364, 250); + this.txtResponseResult.TabIndex = 47; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(392, 333); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(65, 12); + this.label7.TabIndex = 45; + this.label7.Text = "消息结果:"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(16, 334); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(53, 12); + this.label8.TabIndex = 38; + this.label8.Text = "方法名:"; + // + // txtMethod + // + this.txtMethod.ForeColor = System.Drawing.Color.Red; + this.txtMethod.Location = new System.Drawing.Point(74, 333); + this.txtMethod.Name = "txtMethod"; + this.txtMethod.ReadOnly = true; + this.txtMethod.Size = new System.Drawing.Size(239, 21); + this.txtMethod.TabIndex = 39; + // + // txtRequest + // + this.txtRequest.Location = new System.Drawing.Point(13, 381); + this.txtRequest.Multiline = true; + this.txtRequest.Name = "txtRequest"; + this.txtRequest.ReadOnly = true; + this.txtRequest.Size = new System.Drawing.Size(364, 222); + this.txtRequest.TabIndex = 47; + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(16, 361); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(65, 12); + this.label19.TabIndex = 45; + this.label19.Text = "请求消息:"; + this.label19.Click += new System.EventHandler(this.label19_Click); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Controls.Add(this.tabPage4); + this.tabControl1.Location = new System.Drawing.Point(6, 6); + this.tabControl1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(725, 285); + this.tabControl1.TabIndex = 51; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.textBox6); + this.tabPage1.Controls.Add(this.label27); + this.tabPage1.Controls.Add(this.button9); + this.tabPage1.Controls.Add(this.label20); + this.tabPage1.Controls.Add(this.label21); + this.tabPage1.Controls.Add(this.txtVerificationCode); + this.tabPage1.Controls.Add(this.txtBizUserId2); + this.tabPage1.Controls.Add(this.label26); + this.tabPage1.Controls.Add(this.button3); + this.tabPage1.Controls.Add(this.button8); + this.tabPage1.Controls.Add(this.label22); + this.tabPage1.Controls.Add(this.label25); + this.tabPage1.Controls.Add(this.button5); + this.tabPage1.Controls.Add(this.txtCustomerUserId); + this.tabPage1.Controls.Add(this.txtPhone); + this.tabPage1.Controls.Add(this.label24); + this.tabPage1.Controls.Add(this.label23); + this.tabPage1.Controls.Add(this.button7); + this.tabPage1.Controls.Add(this.button6); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage1.Size = new System.Drawing.Size(717, 259); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "个人会员注册"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // textBox6 + // + this.textBox6.Location = new System.Drawing.Point(94, 10); + this.textBox6.Name = "textBox6"; + this.textBox6.Size = new System.Drawing.Size(239, 21); + this.textBox6.TabIndex = 35; + // + // label27 + // + this.label27.AutoSize = true; + this.label27.Location = new System.Drawing.Point(10, 14); + this.label27.Name = "label27"; + this.label27.Size = new System.Drawing.Size(77, 12); + this.label27.TabIndex = 32; + this.label27.Text = "收款方编号\t:"; + // + // button9 + // + this.button9.Location = new System.Drawing.Point(411, 150); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(75, 23); + this.button9.TabIndex = 48; + this.button9.Text = "绑定手机"; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.btnBindPhone_Click); + // + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(452, 98); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(227, 12); + this.label20.TabIndex = 33; + this.label20.Text = "注释:通联系统收款方编号(bizUserId)"; + // + // label21 + // + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(10, 102); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(77, 12); + this.label21.TabIndex = 38; + this.label21.Text = "收款方编号:"; + // + // txtVerificationCode + // + this.txtVerificationCode.Location = new System.Drawing.Point(94, 150); + this.txtVerificationCode.Name = "txtVerificationCode"; + this.txtVerificationCode.Size = new System.Drawing.Size(239, 21); + this.txtVerificationCode.TabIndex = 46; + this.txtVerificationCode.Text = "111111"; + // + // txtBizUserId2 + // + this.txtBizUserId2.Location = new System.Drawing.Point(94, 96); + this.txtBizUserId2.Name = "txtBizUserId2"; + this.txtBizUserId2.Size = new System.Drawing.Size(239, 21); + this.txtBizUserId2.TabIndex = 39; + this.txtBizUserId2.Text = "ZHTGR_OUT16890691048742475"; + // + // label26 + // + this.label26.AutoSize = true; + this.label26.Location = new System.Drawing.Point(452, 16); + this.label26.Name = "label26"; + this.label26.Size = new System.Drawing.Size(257, 12); + this.label26.TabIndex = 34; + this.label26.Text = "注释:外部系统收款方编号(customerUserId)"; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(14, 70); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.TabIndex = 37; + this.button3.Text = "开户"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.btnRegister_Click); + // + // button8 + // + this.button8.Location = new System.Drawing.Point(338, 10); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(75, 23); + this.button8.TabIndex = 36; + this.button8.Text = "生成"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(11, 124); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(53, 12); + this.label22.TabIndex = 40; + this.label22.Text = "手机号:"; + // + // label25 + // + this.label25.AutoSize = true; + this.label25.Location = new System.Drawing.Point(11, 153); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(53, 12); + this.label25.TabIndex = 44; + this.label25.Text = "验证码:"; + // + // button5 + // + this.button5.Location = new System.Drawing.Point(338, 40); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(75, 23); + this.button5.TabIndex = 36; + this.button5.Text = "生成"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // txtCustomerUserId + // + this.txtCustomerUserId.Location = new System.Drawing.Point(94, 42); + this.txtCustomerUserId.Name = "txtCustomerUserId"; + this.txtCustomerUserId.Size = new System.Drawing.Size(239, 21); + this.txtCustomerUserId.TabIndex = 35; + // + // txtPhone + // + this.txtPhone.Location = new System.Drawing.Point(94, 121); + this.txtPhone.Name = "txtPhone"; + this.txtPhone.Size = new System.Drawing.Size(239, 21); + this.txtPhone.TabIndex = 41; + this.txtPhone.Text = "13485349169"; + // + // label24 + // + this.label24.AutoSize = true; + this.label24.Location = new System.Drawing.Point(10, 44); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(77, 12); + this.label24.TabIndex = 32; + this.label24.Text = "收款方编号\t:"; + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(452, 46); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(257, 12); + this.label23.TabIndex = 34; + this.label23.Text = "注释:外部系统收款方编号(customerUserId)"; + // + // button7 + // + this.button7.Location = new System.Drawing.Point(548, 121); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(100, 23); + this.button7.TabIndex = 43; + this.button7.Text = "获取解绑验证码"; + this.button7.UseVisualStyleBackColor = true; + // + // button6 + // + this.button6.Location = new System.Drawing.Point(411, 121); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(109, 23); + this.button6.TabIndex = 42; + this.button6.Text = "获取绑定验证码"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.btnSendVerificationCode_Click); + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.groupBox2); + this.tabPage2.Controls.Add(this.groupBox1); + this.tabPage2.Controls.Add(this.label14); + this.tabPage2.Controls.Add(this.txtTermno); + this.tabPage2.Controls.Add(this.txtVspCusid); + this.tabPage2.Controls.Add(this.txtVspMerchantid); + this.tabPage2.Controls.Add(this.label12); + this.tabPage2.Controls.Add(this.label11); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage2.Size = new System.Drawing.Size(717, 259); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "终端备案"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.btnTermInfoManage); + this.groupBox2.Controls.Add(this.cboOperationType); + this.groupBox2.Controls.Add(this.txtSybappid); + this.groupBox2.Controls.Add(this.txtBizUserId); + this.groupBox2.Controls.Add(this.label3); + this.groupBox2.Controls.Add(this.label2); + this.groupBox2.Controls.Add(this.label1); + this.groupBox2.Location = new System.Drawing.Point(8, 70); + this.groupBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox2.Size = new System.Drawing.Size(697, 78); + this.groupBox2.TabIndex = 27; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "终端信息报备【POS】"; + // + // btnTermInfoManage + // + this.btnTermInfoManage.Location = new System.Drawing.Point(568, 49); + this.btnTermInfoManage.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnTermInfoManage.Name = "btnTermInfoManage"; + this.btnTermInfoManage.Size = new System.Drawing.Size(88, 18); + this.btnTermInfoManage.TabIndex = 3; + this.btnTermInfoManage.Text = "绑定"; + this.btnTermInfoManage.UseVisualStyleBackColor = true; + this.btnTermInfoManage.Click += new System.EventHandler(this.btnTermInfoManage_Click); + // + // cboOperationType + // + this.cboOperationType.DisplayMember = "Text"; + this.cboOperationType.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cboOperationType.ForeColor = System.Drawing.Color.Black; + this.cboOperationType.FormattingEnabled = true; + this.cboOperationType.ItemHeight = 29; + this.cboOperationType.Items.AddRange(new object[] { + this.comboItem9, + this.comboItem10}); + this.cboOperationType.Location = new System.Drawing.Point(326, 24); + this.cboOperationType.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.cboOperationType.Name = "cboOperationType"; + this.cboOperationType.Size = new System.Drawing.Size(96, 35); + this.cboOperationType.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cboOperationType.TabIndex = 2; + // + // comboItem9 + // + this.comboItem9.Text = "绑定"; + this.comboItem9.Value = "set"; + // + // comboItem10 + // + this.comboItem10.Text = "查询"; + this.comboItem10.Value = "query"; + // + // txtSybappid + // + this.txtSybappid.Location = new System.Drawing.Point(556, 22); + this.txtSybappid.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtSybappid.Name = "txtSybappid"; + this.txtSybappid.Size = new System.Drawing.Size(124, 21); + this.txtSybappid.TabIndex = 1; + // + // txtBizUserId + // + this.txtBizUserId.Location = new System.Drawing.Point(88, 23); + this.txtBizUserId.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtBizUserId.Name = "txtBizUserId"; + this.txtBizUserId.Size = new System.Drawing.Size(186, 21); + this.txtBizUserId.TabIndex = 1; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(440, 24); + this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(113, 12); + this.label3.TabIndex = 0; + this.label3.Text = "收银宝分配的appid:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(288, 24); + this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(35, 12); + this.label2.TabIndex = 0; + this.label2.Text = "操作:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(8, 23); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(71, 12); + this.label1.TabIndex = 0; + this.label1.Text = "收款方编号:"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.btnVspTermidInfoManage); + this.groupBox1.Controls.Add(this.cboTermstate); + this.groupBox1.Controls.Add(this.cboDevicetype); + this.groupBox1.Controls.Add(this.cboOperation); + this.groupBox1.Controls.Add(this.txtTermsn); + this.groupBox1.Controls.Add(this.txtTermaddress); + this.groupBox1.Controls.Add(this.label16); + this.groupBox1.Controls.Add(this.label18); + this.groupBox1.Controls.Add(this.label15); + this.groupBox1.Controls.Add(this.label17); + this.groupBox1.Controls.Add(this.label13); + this.groupBox1.Location = new System.Drawing.Point(8, 166); + this.groupBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.groupBox1.Size = new System.Drawing.Size(697, 78); + this.groupBox1.TabIndex = 26; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "支付终端信息管理【被扫】"; + // + // btnVspTermidInfoManage + // + this.btnVspTermidInfoManage.Location = new System.Drawing.Point(568, 52); + this.btnVspTermidInfoManage.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnVspTermidInfoManage.Name = "btnVspTermidInfoManage"; + this.btnVspTermidInfoManage.Size = new System.Drawing.Size(88, 18); + this.btnVspTermidInfoManage.TabIndex = 35; + this.btnVspTermidInfoManage.Text = "绑定"; + this.btnVspTermidInfoManage.UseVisualStyleBackColor = true; + // + // cboTermstate + // + this.cboTermstate.DisplayMember = "Text"; + this.cboTermstate.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cboTermstate.ForeColor = System.Drawing.Color.Black; + this.cboTermstate.FormattingEnabled = true; + this.cboTermstate.ItemHeight = 29; + this.cboTermstate.Items.AddRange(new object[] { + this.comboItem7, + this.comboItem8}); + this.cboTermstate.Location = new System.Drawing.Point(82, 52); + this.cboTermstate.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.cboTermstate.Name = "cboTermstate"; + this.cboTermstate.Size = new System.Drawing.Size(94, 35); + this.cboTermstate.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cboTermstate.TabIndex = 34; + // + // comboItem7 + // + this.comboItem7.Text = "启用"; + this.comboItem7.Value = "00"; + // + // comboItem8 + // + this.comboItem8.Text = "注销"; + this.comboItem8.Value = "01"; + // + // cboDevicetype + // + this.cboDevicetype.DisplayMember = "Text"; + this.cboDevicetype.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cboDevicetype.ForeColor = System.Drawing.Color.Black; + this.cboDevicetype.FormattingEnabled = true; + this.cboDevicetype.ItemHeight = 29; + this.cboDevicetype.Items.AddRange(new object[] { + this.comboItem5, + this.comboItem6}); + this.cboDevicetype.Location = new System.Drawing.Point(284, 27); + this.cboDevicetype.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.cboDevicetype.Name = "cboDevicetype"; + this.cboDevicetype.Size = new System.Drawing.Size(148, 35); + this.cboDevicetype.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cboDevicetype.TabIndex = 33; + // + // comboItem5 + // + this.comboItem5.Text = "条码支付受理终端"; + this.comboItem5.Value = "10"; + // + // comboItem6 + // + this.comboItem6.Text = "条码支付辅助受理终端"; + this.comboItem6.Value = "11"; + // + // cboOperation + // + this.cboOperation.DisplayMember = "Text"; + this.cboOperation.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cboOperation.ForeColor = System.Drawing.Color.Black; + this.cboOperation.FormattingEnabled = true; + this.cboOperation.ItemHeight = 29; + this.cboOperation.Items.AddRange(new object[] { + this.comboItem1, + this.comboItem2, + this.comboItem3, + this.comboItem4}); + this.cboOperation.Location = new System.Drawing.Point(82, 23); + this.cboOperation.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.cboOperation.Name = "cboOperation"; + this.cboOperation.Size = new System.Drawing.Size(94, 35); + this.cboOperation.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.cboOperation.TabIndex = 32; + // + // comboItem1 + // + this.comboItem1.Text = "新增"; + this.comboItem1.Value = "00"; + // + // comboItem2 + // + this.comboItem2.Text = "修改"; + this.comboItem2.Value = "02"; + // + // comboItem3 + // + this.comboItem3.Text = "注销"; + this.comboItem3.Value = "02"; + // + // comboItem4 + // + this.comboItem4.Text = "查询"; + this.comboItem4.Value = "03"; + // + // txtTermsn + // + this.txtTermsn.Location = new System.Drawing.Point(568, 27); + this.txtTermsn.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtTermsn.Name = "txtTermsn"; + this.txtTermsn.Size = new System.Drawing.Size(112, 21); + this.txtTermsn.TabIndex = 30; + // + // txtTermaddress + // + this.txtTermaddress.Location = new System.Drawing.Point(284, 52); + this.txtTermaddress.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtTermaddress.Name = "txtTermaddress"; + this.txtTermaddress.Size = new System.Drawing.Size(255, 21); + this.txtTermaddress.TabIndex = 31; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(476, 28); + this.label16.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(77, 12); + this.label16.TabIndex = 25; + this.label16.Text = "终端序列号:"; + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Location = new System.Drawing.Point(216, 52); + this.label18.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(65, 12); + this.label18.TabIndex = 26; + this.label18.Text = "终端地址:"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(216, 28); + this.label15.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(65, 12); + this.label15.TabIndex = 27; + this.label15.Text = "设备类型:"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Location = new System.Drawing.Point(14, 52); + this.label17.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(65, 12); + this.label17.TabIndex = 28; + this.label17.Text = "终端状态:"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.ForeColor = System.Drawing.Color.Red; + this.label13.Location = new System.Drawing.Point(14, 28); + this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(65, 12); + this.label13.TabIndex = 29; + this.label13.Text = "操作类型:"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.ForeColor = System.Drawing.Color.Red; + this.label14.Location = new System.Drawing.Point(489, 14); + this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(53, 12); + this.label14.TabIndex = 25; + this.label14.Text = "终端号:"; + // + // txtTermno + // + this.txtTermno.Location = new System.Drawing.Point(547, 9); + this.txtTermno.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtTermno.Name = "txtTermno"; + this.txtTermno.Size = new System.Drawing.Size(112, 21); + this.txtTermno.TabIndex = 17; + // + // txtVspCusid + // + this.txtVspCusid.Location = new System.Drawing.Point(358, 9); + this.txtVspCusid.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtVspCusid.Name = "txtVspCusid"; + this.txtVspCusid.Size = new System.Drawing.Size(112, 21); + this.txtVspCusid.TabIndex = 19; + // + // txtVspMerchantid + // + this.txtVspMerchantid.Location = new System.Drawing.Point(125, 9); + this.txtVspMerchantid.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.txtVspMerchantid.Name = "txtVspMerchantid"; + this.txtVspMerchantid.Size = new System.Drawing.Size(108, 21); + this.txtVspMerchantid.TabIndex = 20; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.ForeColor = System.Drawing.Color.Red; + this.label12.Location = new System.Drawing.Point(258, 14); + this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(89, 12); + this.label12.TabIndex = 10; + this.label12.Text = "收银宝商户号:"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.ForeColor = System.Drawing.Color.Red; + this.label11.Location = new System.Drawing.Point(9, 14); + this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(113, 12); + this.label11.TabIndex = 9; + this.label11.Text = "收银宝集团商户号:"; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.txtSplitLog); + this.tabPage3.Controls.Add(this.btnOrder2Split); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.tabPage3.Size = new System.Drawing.Size(717, 259); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "分账"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // btnOrder2Split + // + this.btnOrder2Split.Location = new System.Drawing.Point(8, 6); + this.btnOrder2Split.Name = "btnOrder2Split"; + this.btnOrder2Split.Size = new System.Drawing.Size(116, 23); + this.btnOrder2Split.TabIndex = 0; + this.btnOrder2Split.Text = "订单转分账信息"; + this.btnOrder2Split.UseVisualStyleBackColor = true; + this.btnOrder2Split.Click += new System.EventHandler(this.btnOrder2Split_Click); + // + // tabPage4 + // + this.tabPage4.Controls.Add(this.txtMqttLog); + this.tabPage4.Controls.Add(this.btnMqttInit); + this.tabPage4.Controls.Add(this.btnSimulationOrder); + this.tabPage4.Controls.Add(this.btnMqttServerClose); + this.tabPage4.Controls.Add(this.btnMqttServerStart); + this.tabPage4.Location = new System.Drawing.Point(4, 22); + this.tabPage4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.tabPage4.Size = new System.Drawing.Size(717, 259); + this.tabPage4.TabIndex = 3; + this.tabPage4.Text = "MQTTServer"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // btnMqttServerStart + // + this.btnMqttServerStart.Location = new System.Drawing.Point(8, 34); + this.btnMqttServerStart.Name = "btnMqttServerStart"; + this.btnMqttServerStart.Size = new System.Drawing.Size(75, 23); + this.btnMqttServerStart.TabIndex = 0; + this.btnMqttServerStart.Text = "启动服务"; + this.btnMqttServerStart.UseVisualStyleBackColor = true; + this.btnMqttServerStart.Click += new System.EventHandler(this.btnMqttServerStart_Click); + // + // btnSimulationOrder + // + this.btnSimulationOrder.Location = new System.Drawing.Point(8, 92); + this.btnSimulationOrder.Name = "btnSimulationOrder"; + this.btnSimulationOrder.Size = new System.Drawing.Size(75, 23); + this.btnSimulationOrder.TabIndex = 1; + this.btnSimulationOrder.Text = "模拟订单"; + this.btnSimulationOrder.UseVisualStyleBackColor = true; + // + // btnMqttInit + // + this.btnMqttInit.Location = new System.Drawing.Point(8, 5); + this.btnMqttInit.Name = "btnMqttInit"; + this.btnMqttInit.Size = new System.Drawing.Size(75, 23); + this.btnMqttInit.TabIndex = 2; + this.btnMqttInit.Text = "初始化"; + this.btnMqttInit.UseVisualStyleBackColor = true; + this.btnMqttInit.Click += new System.EventHandler(this.btnMqttInit_Click); + // + // btnMqttServerClose + // + this.btnMqttServerClose.Location = new System.Drawing.Point(8, 63); + this.btnMqttServerClose.Name = "btnMqttServerClose"; + this.btnMqttServerClose.Size = new System.Drawing.Size(75, 23); + this.btnMqttServerClose.TabIndex = 0; + this.btnMqttServerClose.Text = "关闭服务"; + this.btnMqttServerClose.UseVisualStyleBackColor = true; + this.btnMqttServerClose.Click += new System.EventHandler(this.btnMqttServerClose_Click); + // + // txtMqttLog + // + this.txtMqttLog.Location = new System.Drawing.Point(89, 7); + this.txtMqttLog.Multiline = true; + this.txtMqttLog.Name = "txtMqttLog"; + this.txtMqttLog.Size = new System.Drawing.Size(611, 247); + this.txtMqttLog.TabIndex = 3; + // + // txtSplitLog + // + this.txtSplitLog.Location = new System.Drawing.Point(141, 7); + this.txtSplitLog.Multiline = true; + this.txtSplitLog.Name = "txtSplitLog"; + this.txtSplitLog.Size = new System.Drawing.Size(559, 246); + this.txtSplitLog.TabIndex = 1; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(722, 440); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.txtRequest); + this.Controls.Add(this.txtResponseResult); + this.Controls.Add(this.label19); + this.Controls.Add(this.label7); + this.Controls.Add(this.txtMethod); + this.Controls.Add(this.label8); + this.Name = "Form1"; + this.Text = "Form1"; + this.Load += new System.EventHandler(this.Form1_Load); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + this.tabPage2.ResumeLayout(false); + this.tabPage2.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.tabPage3.ResumeLayout(false); + this.tabPage3.PerformLayout(); + this.tabPage4.ResumeLayout(false); + this.tabPage4.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.TextBox txtResponseResult; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.TextBox txtMethod; + private System.Windows.Forms.TextBox txtRequest; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TextBox textBox6; + private System.Windows.Forms.Label label27; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.TextBox txtVerificationCode; + private System.Windows.Forms.TextBox txtBizUserId2; + private System.Windows.Forms.Label label26; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.Label label25; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.TextBox txtCustomerUserId; + private System.Windows.Forms.TextBox txtPhone; + private System.Windows.Forms.Label label24; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button btnVspTermidInfoManage; + private DevComponents.DotNetBar.Controls.ComboBoxEx cboTermstate; + private DevComponents.Editors.ComboItem comboItem7; + private DevComponents.Editors.ComboItem comboItem8; + private DevComponents.DotNetBar.Controls.ComboBoxEx cboDevicetype; + private DevComponents.Editors.ComboItem comboItem5; + private DevComponents.Editors.ComboItem comboItem6; + private DevComponents.DotNetBar.Controls.ComboBoxEx cboOperation; + private DevComponents.Editors.ComboItem comboItem1; + private DevComponents.Editors.ComboItem comboItem2; + private DevComponents.Editors.ComboItem comboItem3; + private DevComponents.Editors.ComboItem comboItem4; + private System.Windows.Forms.TextBox txtTermsn; + private System.Windows.Forms.TextBox txtTermaddress; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.TextBox txtTermno; + private System.Windows.Forms.TextBox txtVspCusid; + private System.Windows.Forms.TextBox txtVspMerchantid; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox txtBizUserId; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private DevComponents.DotNetBar.Controls.ComboBoxEx cboOperationType; + private DevComponents.Editors.ComboItem comboItem9; + private DevComponents.Editors.ComboItem comboItem10; + private System.Windows.Forms.TextBox txtSybappid; + private System.Windows.Forms.Button btnTermInfoManage; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.Button btnOrder2Split; + private System.Windows.Forms.TabPage tabPage4; + private System.Windows.Forms.Button btnMqttServerStart; + private System.Windows.Forms.Button btnSimulationOrder; + private System.Windows.Forms.Button btnMqttInit; + private System.Windows.Forms.Button btnMqttServerClose; + private System.Windows.Forms.TextBox txtMqttLog; + private System.Windows.Forms.TextBox txtSplitLog; + } +} + diff --git a/pos/Test/Form1.cs b/pos/Test/Form1.cs new file mode 100644 index 0000000..26d35e9 --- /dev/null +++ b/pos/Test/Form1.cs @@ -0,0 +1,424 @@ +using MQTTnet; +using MQTTnet.Client.Receiving; +using MQTTnet.Server; +using Newtonsoft.Json; +using POSV.Payment.AllinPay; +using POSV.Payment.AllinPay.Models.ParamModels; +using POSV.Payment.AllinPay.Models.ResponseModels; +using POSV.ShoppingCart; +using POSV.Utils; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace POSV +{ + public partial class Form1 : Form + { + IMqttServer server; + + delegate void set_Text(string s); //定义委托 + + set_Text Set_Text; //定义委托 + + public Form1() + { + InitializeComponent(); + + } + + private void btnRegister_Click(object sender, EventArgs e) + { + this.txtResponseResult.Text = ""; + if (string.IsNullOrEmpty(this.txtCustomerUserId.Text)) + { + this.txtResponseResult.Text = "外部系统收款方编号不能为空"; + return; + } + + var model = new RegisterModel + { + customerUserId = this.txtCustomerUserId.Text, + memberType = "3", + source = "2" + }; + + + var param = new RegisterParamInfo + { + + bizContent = JsonConvert.SerializeObject(model) + }; + var _data = AllinpayHelper.RegisterMember(param); + this.txtMethod.Text = param.method; + this.txtResponseResult.Text = JsonConvert.SerializeObject(_data); + + if (_data.IsSuccess) + { + + var result = JsonConvert.DeserializeObject(_data.ResultInfo.data); + + this.txtBizUserId.Text = result.bizUserId; + } + } + + private void btnSendVerificationCode_Click(object sender, EventArgs e) + { + this.txtResponseResult.Text = ""; + if (string.IsNullOrEmpty(this.txtBizUserId2.Text)) + { + this.txtResponseResult.Text = "BizUserId不能为空"; + return; + } + + if (string.IsNullOrEmpty(this.txtPhone.Text)) + { + this.txtResponseResult.Text = "手机号不能为空"; + return; + } + + var model = new SendVerificationCodeModel + { + bizUserId = this.txtBizUserId2.Text, + codeType = "9", + phone = this.txtPhone.Text + }; + + var param = new SendVerificationCodeParamInfo + { + bizContent = JsonConvert.SerializeObject(model) + }; + this.txtMethod.Text = param.method; + var _data = AllinpayHelper.SendVerificationCode(param); + + this.txtResponseResult.Text = JsonConvert.SerializeObject(_data); + + if (_data.IsSuccess) + { + var result = JsonConvert.DeserializeObject(_data.ResultInfo.data); + this.txtVerificationCode.Text = result.phone; + } + } + + private void btnBindPhone_Click(object sender, EventArgs e) + { + this.txtResponseResult.Text = ""; + if (string.IsNullOrEmpty(this.txtBizUserId2.Text)) + { + this.txtResponseResult.Text = "BizUserId不能为空"; + return; + } + + if (string.IsNullOrEmpty(this.txtPhone.Text)) + { + this.txtResponseResult.Text = "手机号不能为空"; + return; + } + + var model = new BindPhoneModel + { + bizUserId = this.txtBizUserId2.Text, + verificationCode = this.txtVerificationCode.Text, + phone = this.txtPhone.Text + }; + + var param = new BindPhoneParamInfo { bizContent = JsonConvert.SerializeObject(model) }; + this.txtMethod.Text = param.method; + var _data = AllinpayHelper.BindPhone(param); + + this.txtResponseResult.Text = JsonConvert.SerializeObject(_data); + } + + + + private void btnVspTermidInfoManage_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(txtVspMerchantid.Text)) + { + this.txtResponseResult.Text = "VspMerchantid不能为空"; + return; + } + if (string.IsNullOrEmpty(this.txtVspCusid.Text)) + { + this.txtResponseResult.Text = "VspCusid不能为空"; + return; + } + + if (string.IsNullOrEmpty(this.txtTermno.Text)) + { + this.txtResponseResult.Text = "Termno不能为空"; + return; + } + + var model = new VspTermidInfoManageModel + { + vspMerchantid = txtVspMerchantid.Text, + vspCusid = txtVspCusid.Text, + termno = txtTermno.Text, + operation = cboOperation.SelectedItem != null ? ((DevComponents.Editors.ComboItem)cboOperation.SelectedItem).Value.ToString() : "", + devicetype = cboDevicetype.SelectedItem != null ? ((DevComponents.Editors.ComboItem)cboDevicetype.SelectedItem).Value.ToString() : "", + termsn = txtTermsn.Text, + termstate = cboTermstate.SelectedItem != null ? ((DevComponents.Editors.ComboItem)cboTermstate.SelectedItem).Value.ToString() : "", + termaddress = txtTermaddress.Text + }; + + var param = new VspTermidInfoManageParamInfo { bizContent = JsonConvert.SerializeObject(model) }; + this.txtMethod.Text = param.method; + + txtRequest.Text = JsonConvert.SerializeObject(param); + + var _data = AllinpayHelper.VspTermidInfoManage(param); + + this.txtResponseResult.Text = JsonConvert.SerializeObject(_data); + } + + private void label19_Click(object sender, EventArgs e) + { + + } + + private void btnTermInfoManage_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(txtVspMerchantid.Text)) + { + this.txtResponseResult.Text = "VspMerchantid不能为空"; + return; + } + if (string.IsNullOrEmpty(this.txtVspCusid.Text)) + { + this.txtResponseResult.Text = "VspCusid不能为空"; + return; + } + if (string.IsNullOrEmpty(this.txtTermno.Text)) + { + this.txtResponseResult.Text = "Termno不能为空"; + return; + } + + if (string.IsNullOrEmpty(this.txtSybappid.Text)) + { + this.txtResponseResult.Text = "appid不能为空"; + return; + } + + var model = new TermInfoManageModel + { + vspMerchantid = txtVspMerchantid.Text, + vspCusId = txtVspCusid.Text, + operationType = cboOperationType.SelectedItem != null ? ((DevComponents.Editors.ComboItem)cboOperationType.SelectedItem).Value.ToString() : "", + vspTermid = txtTermno.Text, + appid = txtSybappid.Text, + bizUserId = txtBizUserId.Text + }; + + var param = new TermInfoManageParamInfo { bizContent = JsonConvert.SerializeObject(model) }; + this.txtMethod.Text = param.method; + + txtRequest.Text = JsonConvert.SerializeObject(param); + + var _data = AllinpayHelper.TermInfoManage(param); + + this.txtResponseResult.Text = JsonConvert.SerializeObject(_data); + } + + private void button5_Click(object sender, EventArgs e) + { + + } + + private void button8_Click(object sender, EventArgs e) + { + + } + + private void btnOrder2Split_Click(object sender, EventArgs e) + { + Global.Instance.Worker = new Entity.Worker(); + Global.Instance.Worker.StoreInfo = new Entity.StoreInfo(); + Global.Instance.Worker.StoreInfo.Ext1 = "{\"payuserid\":\"ZHTGR_OUT16890691048742475\",\"vspCusid\":\"563162058142L1E\",\"vspCusname\":\"大同市平城区云滋快餐店\",\"bizUserId\":\"ZHTQY_OUT16968223767100078\"}"; + lock (Global.Instance.SyncLock) + { + Stopwatch sw = new Stopwatch(); + + sw.Start(); + + var pageSize = 10; + var lists = new List(); + //单据明细 + var items = new List(); + //支付明细 + var pays = new List(); + //支付方式分摊明细 + var itemPays = new List(); + try + { + using (var db = Global.Instance.OpenDataBase) + { + var count = db.Query($"where saleDate between '{DateTime.Now.ToString("yyyy-MM-dd 00:00:00")}' and '{DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00")}'").Count(); + //主单数据 + //lists = db.Query("where syncStatus = 0 and uploadErrors < 3000 order by uploadErrors limit @0;", 1).ToList(); + + var pageCount = count % pageSize != 0 ? count / pageSize + 1 : count / pageSize; + + for (int i = 0; i < pageCount; i++) + { + lists = db.Query($"where saleDate between '{DateTime.Now.ToString("yyyy-MM-dd 00:00:00")}' and '{DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 00:00:00")}' limit ({i * pageSize}), {pageSize}").ToList(); + + var ids = string.Join("','", lists.ConvertAll(x => x.Id).ToArray()); + + var condition = " where orderId in ('" + ids + "');"; + + //单据明细 + items = db.Query(condition).ToList(); + + //支付明细 + pays = db.Query(condition).ToList(); + + itemPays = db.Query(condition).ToList(); + + foreach (var orderObject in lists) + { + orderObject.Items = items.FindAll(x => x.OrderId == orderObject.Id); + + //将支付方式附加到主单 + orderObject.Pays = pays.FindAll(x => x.OrderId == orderObject.Id); + + foreach (var item in orderObject.Items) + { + item.ItemPayList = itemPays.FindAll(x => x.OrderId == orderObject.Id); + } + } + + + if (lists.Count > 0) + { + foreach (var orderObject in lists) + { + SplitPayUtils.Instance.SaveSplitPayInfo(orderObject); + } + } + } + } + } + catch (Exception ex) + { + Console.WriteLine("保存订单的分账信息错误<{0}>", ex.Message); + } + finally + { + sw.Stop(); + + Console.WriteLine("保存订单的分账信息结束<{0}>", sw.ElapsedMilliseconds); + + } + + } + } + + private void btnMqttServerStart_Click(object sender, EventArgs e) + { + StartMqttServer(); + } + + private void MessageReceivedHandler(MqttApplicationMessageReceivedEventArgs obj) + { + //Console.WriteLine("==================================================="); + //Console.WriteLine("收到消息:"); + //Console.WriteLine($"客户端:{obj.ClientId}"); + //Console.WriteLine($"主题:{obj.ApplicationMessage.Topic}"); + //Console.WriteLine($"消息:{Encoding.UTF8.GetString(obj.ApplicationMessage.Payload)}"); + //Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++"); + //Console.WriteLine(); + + txtMqttLog.Invoke(Set_Text, new object[] { "===================================================" }); + txtMqttLog.Invoke(Set_Text, new object[] { "收到消息:" }); + txtMqttLog.Invoke(Set_Text, new object[] { $"客户端:{obj.ClientId}" }); + txtMqttLog.Invoke(Set_Text, new object[] { $"主题:{obj.ApplicationMessage.Topic}" }); + txtMqttLog.Invoke(Set_Text, new object[] { $"消息:{Encoding.UTF8.GetString(obj.ApplicationMessage.Payload)}" }); + txtMqttLog.Invoke(Set_Text, new object[] { "+++++++++++++++++++++++++++++++++++++++++++++++++++" }); + } + + private void ClientDisconnectedHandler(MqttServerClientDisconnectedEventArgs obj) + { + //Console.WriteLine($"断开连接的客户端:{obj.ClientId}"); + //Console.WriteLine($"断开连接类型:{obj.DisconnectType.ToString()}"); + + txtMqttLog.Invoke(Set_Text, new object[] { $"断开连接的客户端:{obj.ClientId}" }); + txtMqttLog.Invoke(Set_Text, new object[] { $"断开连接类型:{obj.DisconnectType.ToString()}" }); + } + + private void ClientConnectedHandler(MqttServerClientConnectedEventArgs obj) + { + //Console.WriteLine($"{obj.ClientId}此客户端已连接至服务器!"); + txtMqttLog.Invoke(Set_Text, new object[] { $"{obj.ClientId}此客户端已连接至服务器!" }); + } + + private void btnMqttInit_Click(object sender, EventArgs e) + { + + server = new MqttFactory().CreateMqttServer(); + // 客户端连接事件 + server.ClientConnectedHandler = new MqttServerClientConnectedHandlerDelegate(ClientConnectedHandler); + //客户端断开连接事件 + server.ClientDisconnectedHandler = new MqttServerClientDisconnectedHandlerDelegate(ClientDisconnectedHandler); + server.ApplicationMessageReceivedHandler = new MqttApplicationMessageReceivedHandlerDelegate(MessageReceivedHandler); + server.UseApplicationMessageReceivedHandler(args => + { + //Console.WriteLine("==================================================="); + //Console.WriteLine("收到消息:"); + //Console.WriteLine($"客户端:{args.ClientId}"); + //Console.WriteLine($"主题:{args.ApplicationMessage.Topic}"); + //Console.WriteLine($"消息:{Encoding.UTF8.GetString(args.ApplicationMessage.Payload)}"); + //Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++"); + //Console.WriteLine(); + + txtMqttLog.Invoke(Set_Text, new object[] { "===================================================" }); + txtMqttLog.Invoke(Set_Text, new object[] { "收到消息:" }); + txtMqttLog.Invoke(Set_Text, new object[] { $"客户端:{args.ClientId}" }); + txtMqttLog.Invoke(Set_Text, new object[] { $"主题:{args.ApplicationMessage.Topic}" }); + txtMqttLog.Invoke(Set_Text, new object[] { $"消息:{Encoding.UTF8.GetString(args.ApplicationMessage.Payload)}" }); + txtMqttLog.Invoke(Set_Text, new object[] { "+++++++++++++++++++++++++++++++++++++++++++++++++++" }); + }); + } + + /// + /// 打开MQTT Server 服务 + /// + /// 端口号:默认为1883 + public async void StartMqttServer(int port = 1883) + { + if (server.IsStarted) + return; + MqttServerOptionsBuilder serverOptions = new MqttServerOptionsBuilder(); + serverOptions.WithDefaultEndpointPort(port); + await server.StartAsync(serverOptions.Build()); + } + + public async void CloseMqttServer(int port = 1883) + { + if (!server.IsStarted) + return; + MqttServerOptionsBuilder serverOptions = new MqttServerOptionsBuilder(); + serverOptions.WithDefaultEndpointPort(port); + await server.StopAsync(); + } + + private void btnMqttServerClose_Click(object sender, EventArgs e) + { + CloseMqttServer(); + } + + private void set_lableText(string s) //主线程调用的函数 + { + txtMqttLog.Text += s + "\r\n"; + } + + private void Form1_Load(object sender, EventArgs e) + { + Set_Text = new set_Text(set_lableText); //实例化 + } + } +} diff --git a/pos/Test/Form1.resx b/pos/Test/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/pos/Test/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/pos/Test/Program.cs b/pos/Test/Program.cs new file mode 100644 index 0000000..e776868 --- /dev/null +++ b/pos/Test/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace POSV +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/pos/Test/Properties/AssemblyInfo.cs b/pos/Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7ed3850 --- /dev/null +++ b/pos/Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Test")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("0dca3e00-021b-4c5f-b126-92267d6cf8f6")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/pos/Test/Properties/Resources.Designer.cs b/pos/Test/Properties/Resources.Designer.cs new file mode 100644 index 0000000..e7668b9 --- /dev/null +++ b/pos/Test/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + + +namespace Test.Properties +{ + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/pos/Test/Properties/Resources.resx b/pos/Test/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/pos/Test/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/pos/Test/Properties/Settings.Designer.cs b/pos/Test/Properties/Settings.Designer.cs new file mode 100644 index 0000000..9e46180 --- /dev/null +++ b/pos/Test/Properties/Settings.Designer.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + + +namespace Test.Properties +{ + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/pos/Test/Properties/Settings.settings b/pos/Test/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/pos/Test/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/pos/Test/Test.csproj b/pos/Test/Test.csproj new file mode 100644 index 0000000..ad24467 --- /dev/null +++ b/pos/Test/Test.csproj @@ -0,0 +1,131 @@ + + + + + Debug + AnyCPU + {0DCA3E00-021B-4C5F-B126-92267D6CF8F6} + WinExe + Test + Test + v4.0 + 512 + true + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + + + ..\packages\MQTTnet40.1.0.0\lib\net40\MQTTnet40.dll + + + ..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll + + + ..\packages\NPoco.3.9.2\lib\net40\NPoco.dll + + + + + + ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.IO.dll + + + + ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.Runtime.dll + + + + + ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.Threading.Tasks.dll + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {af9cc192-ce8e-4655-b316-93a3fd81adce} + POSV.Core + + + {E545EEF9-1A9E-4826-AF69-8B30571150F8} + POSV.Entity + + + {5B9E8917-9246-4024-9AD3-CFAB552FB26B} + POSV.Payment + + + + + + + + + \ No newline at end of file diff --git a/pos/Test/app.config b/pos/Test/app.config new file mode 100644 index 0000000..027998f --- /dev/null +++ b/pos/Test/app.config @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pos/Test/packages.config b/pos/Test/packages.config new file mode 100644 index 0000000..db5c075 --- /dev/null +++ b/pos/Test/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file