using System; using System.Configuration; using System.Data; using System.Drawing; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using SuperMap.RealEstate.CoreFrameWork; using SuperMap.RealEstate.Web.UI; using SuperMap.RealEstate.Web.UI.WebControls; using SuperMap.RealEstate.HighWay.Storage.Business; using HWSB = SuperMap.RealEstate.HighWay.Storage.Business; using Newtonsoft.Json; using HZQR.Common; using ZXing.Common; using ZXing.QrCode; using ZXing; namespace SuperMap.RealEstate.ExchangeData { /// /// T_MACHINEINFO_ 的WebUserControl /// public partial class MACHINEINFO : UserControl { EncodingOptions options = null; BarcodeWriter writer = null; protected string serverpart_id = ConfigurationManager.AppSettings["UmiformCommodity"].ToString().Split('|')[0]; #region 方法 -> 页面加载 protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; if (Request["type"] != "edit") { if (CREATE_DATE.Text == "") { CREATE_DATE.Text = DateTime.Now.Date.ToShortDateString(); } if (CREATE_DATE2.Text == "") { CREATE_DATE2.Text = DateTime.Now.Date.ToShortDateString(); } if (USERNAME.Text == "") { USERNAME.Text = Page.PassportInfo.Name; } if (USERNAME2.Text == "") { USERNAME2.Text = Page.PassportInfo.Name; } } InitWebControls(); //初始化并加载列表 //GridViewEx1.SelectingWithInit(ObjectDataSource1, null); //if (GridViewEx1.Rows.Count > 0) //{ // ShopInfo.Attributes["style"] = "display:normal"; //} //GridViewEx2.SelectingWithInit(ObjectDataSource2, null); //if (GridViewEx2.Rows.Count > 0) //{ // MacInfo.Attributes["style"] = "display:normal"; //} //GridViewEx3.SelectingWithInit(ObjectDataSource3, null, // DictionaryHelper.GetDictionary(Transaction, "USING_TYPE")); //if (GridViewEx3.Rows.Count > 0) //{ // MachineInfo.Attributes["style"] = "display:normal"; //} Page.SetControlClientAction(BuildQCode, false); } #endregion #region 方法 -> 初始化参数 InitWebControls private void InitWebControls() { int _SERVERPART_ID = 0; SERVERPART_CODE.Clear(); foreach (SERVERPART _SERVERPART in (new SERVERPART(this.Transaction)).GetPassportServerPart(Page.PassportInfo.CityAuthority)) { ListItemEx _ListItemEx = new ListItemEx(); _ListItemEx.Text = _SERVERPART.SERVERPART_NAME; _ListItemEx.Value = _SERVERPART.SERVERPART_ID.ToString() + "&" + _SERVERPART.SERVERPART_CODE; if (CurrObject != null && CurrObject.PropertyObject != null && _SERVERPART.SERVERPART_CODE == CurrObject.SERVERPARTCODE) { _ListItemEx.Selected = true; _SERVERPART_ID = _SERVERPART.SERVERPART_ID.Value; } SERVERPART_CODE.Items.Add(_ListItemEx); } if (_SERVERPART_ID != 0) { //SERVERPARTCODE.Text = SERVERPART_CODE.SelectedValue.Split('&')[1]; SHOPCODE.Items.Clear(); SHOPCODE.Items.Add(new ListItemEx("备机", "000000")); foreach (SERVERPARTSHOP _SERVERPARTSHOP in new SERVERPARTSHOP(this.Transaction).FillCollection( "where SHOPTRADE <> 9032 AND ISVALID > 0 AND SHOPCODE IS NOT NULL AND SERVERPART_ID = '" + _SERVERPART_ID + "' AND NVL(STATISTICS_TYPE,'1') NOT LIKE '%4010%' order by SHOPREGION,SHOPCODE,SHOPNAME")) { ListItemEx _ListItemEx = new ListItemEx(); _ListItemEx.Text = _SERVERPARTSHOP.SHOPNAME; _ListItemEx.Value = _SERVERPARTSHOP.SHOPCODE; if (CurrObject != null && CurrObject.PropertyObject != null && _SERVERPARTSHOP.SHOPCODE == CurrObject.SHOPCODE) { _ListItemEx.Selected = true; } SHOPCODE.Items.Add(_ListItemEx); } } //获取移动支付服务商、主支付通道端口、数据传输端口 if (!string.IsNullOrWhiteSpace(MACHINE_MACADDRESS.Text)) { DataTable dtConfig = new Business.CONFIGURATION(Transaction).FillDataTable( "WHERE MACADDRESS = '" + MACHINE_MACADDRESS.Text + "'"); if (dtConfig.Rows.Count > 0) { if (dtConfig.Select("CONFIGURATION_NAME = 'service_port'").Length > 0) { ServicePort.Text = dtConfig.Select("CONFIGURATION_NAME = 'service_port'")[0]["CONFIGURATION_VALUES"].ToString(); } if (dtConfig.Select("CONFIGURATION_NAME = 'DataServicePort'").Length > 0) { DataServicePort.Text = dtConfig.Select("CONFIGURATION_NAME = 'DataServicePort'")[0]["CONFIGURATION_VALUES"].ToString(); } if (dtConfig.Select("CONFIGURATION_NAME = 'MobilePayOperators'").Length > 0) { MobilePayOperators.SelectedValue = dtConfig.Select( "CONFIGURATION_NAME = 'MobilePayOperators'")[0]["CONFIGURATION_VALUES"].ToString(); } } } //生成随机数 CheckCode.Text = HZQR.Common.Utils.StringAppend("", true, 1, 4, false, 0, 0); } #endregion #region 方法 -> 在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等 public override void InitializeWebControl() { ddlUsingType.Items.Clear(); DictionaryHelper.BindingDropDownList("USING_TYPE", ddlUsingType.Items, this.Transaction); ddlPayState.Items.Clear(); DictionaryHelper.BindingDropDownList("ISYES", ddlPayState.Items, this.Transaction); MobilePayOperators.Items.Clear(); DictionaryHelper.BindingDropDownList("MOBILEPAYOPERATORS", MobilePayOperators.Items, Transaction); } #endregion #region 方法 -> 载入数据 public override bool LoadData() { ADDDATE.Text = DateTime.Now.ToString(); //如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码 if (!String.IsNullOrEmpty(Request["ID"])) { CurrObject.MACHINEINFO_ID_Encrypt = Request["ID"]; return this.Select(); } else if (!String.IsNullOrEmpty(Request["SERVERPARTCODE"]) && //!String.IsNullOrEmpty(Request["SHOPCODE"]) && !String.IsNullOrEmpty(Request["MACHINE_MACADDRESS"])) { CurrObject.AddSearchParameter("SERVERPARTCODE", Request["SERVERPARTCODE"].ToDecrypt()); //CurrObject.AddSearchParameter("SHOPCODE", Request["SHOPCODE"].ToDecrypt()); CurrObject.AddSearchParameter("MACHINE_MACADDRESS", Request["MACHINE_MACADDRESS"].ToDecrypt()); if (CurrObject.Search()) { this.BindObjectToControl(); #region 绑定配置信息 Business.CASHIERCONTROL _CASHIERCONTROL = new Business.CASHIERCONTROL(this.Transaction); if (!string.IsNullOrEmpty(Request["CASHIERCONTROL_ID"].ToDecrypt())) { _CASHIERCONTROL.AddSearchParameter("CASHIERCONTROL_ID", Request["CASHIERCONTROL_ID"].ToDecrypt()); } else { _CASHIERCONTROL.AddSearchParameter("MACHINEINFO_ID", CurrObject.MACHINEINFO_ID); _CASHIERCONTROL.AddSearchParameter("MACHINE_MACADDRESS", CurrObject.MACHINE_MACADDRESS); _CASHIERCONTROL.AddSearchParameter("SERVERPARTCODE", CurrObject.SERVERPARTCODE); } if (_CASHIERCONTROL.Search()) { CASHIERCONTROL_ID.Text = _CASHIERCONTROL.CASHIERCONTROL_ID.ToString(); //结账时间 ENDACCOUNT_DATE.Text = _CASHIERCONTROL.ENDACCOUNT_DATE == null ? "" : _CASHIERCONTROL.ENDACCOUNT_DATE.Value.ToShortDateString(); //结账有效期 ENDACCOUNT_DAY.Text = _CASHIERCONTROL.ENDACCOUNT_DAY == null ? "" : _CASHIERCONTROL.ENDACCOUNT_DAY.Value.ToString(); //机器序列号 if (string.IsNullOrEmpty(MACHINE_SERNO.Text)) MACHINE_SERNO.Text = _CASHIERCONTROL.MACHINE_SERNO; //硬件有效期 WARRANTY_DATE.Text = _CASHIERCONTROL.WARRANTY_DATE == null ? "" : _CASHIERCONTROL.WARRANTY_DATE.Value.ToShortDateString(); //软件有效日期 EXPIRY_DATE.Text = _CASHIERCONTROL.EXPIRY_DATE == null ? "" : _CASHIERCONTROL.EXPIRY_DATE.Value.ToShortDateString(); //安装时间 SETUP_DATE.Text = _CASHIERCONTROL.SETUP_DATE == null ? "" : _CASHIERCONTROL.SETUP_DATE.Value.ToShortDateString(); //日结校验天数 CHECK_DAY.Text = _CASHIERCONTROL.CHECK_DAY == null ? "" : _CASHIERCONTROL.CHECK_DAY.ToString(); //有效期提醒时间 EXPIRY_DAY.Text = _CASHIERCONTROL.EXPIRY_DAY == null ? "" : _CASHIERCONTROL.EXPIRY_DAY.ToString(); //租赁到期时间 RENT_DATE.Text = _CASHIERCONTROL.RENT_DATE == null ? "" : _CASHIERCONTROL.RENT_DATE.Value.ToShortDateString(); VERSION_NUM.Text = _CASHIERCONTROL.VERSION_NUM; RENT_REMIND_DAY.Text = _CASHIERCONTROL.RENT_REMIND_DAY == null ? "" : _CASHIERCONTROL.RENT_REMIND_DAY.ToString(); //付款状态 ddlPayState.SelectedValue = _CASHIERCONTROL.RENTPAY_STATE.ToString() == "" ? "" : _CASHIERCONTROL.RENTPAY_STATE.ToString(); //填表人 USERNAME.Text = _CASHIERCONTROL.USERNAME; //填表时间 CREATE_DATE.Text = _CASHIERCONTROL.CREATE_DATE == null ? "" : _CASHIERCONTROL.CREATE_DATE.Value.ToShortDateString(); USERNAME2.Text = _CASHIERCONTROL.USERNAME; CREATE_DATE2.Text = _CASHIERCONTROL.CREATE_DATE == null ? "" : _CASHIERCONTROL.CREATE_DATE.Value.ToShortDateString(); ddlUsingType.SelectedValue = _CASHIERCONTROL.USING_TYPE == null ? "" : _CASHIERCONTROL.USING_TYPE.ToString(); CASHIERCONTROL_DESC.Text = _CASHIERCONTROL.CASHIERCONTROL_DESC; // ddlUsingType_SelectedValueChanged(this, null); } #endregion return true; } } //默认返回值,工作流组件返回True,功能模块返回False。 return (WorkFlowPage != null); } #endregion #region 方法 -> 服务区下拉框变更事件 protected void SERVERPARTCODE_CallBackSetControl(object sender, ClientSetEventArgs e) { // SERVERPARTCODE.Text = SERVERPART_CODE.SelectedValue.Split('&')[1]; // e.SetValue(SERVERPARTCODE); SHOPCODE.Items.Clear(); SHOPCODE.Items.Add(new ListItemEx("备机", "000000")); foreach (SERVERPARTSHOP _SERVERPARTSHOP in new SERVERPARTSHOP(this.Transaction).FillCollection( "where SHOPTRADE <> 9032 AND ISVALID > 0 AND NVL(STATISTICS_TYPE,'1') NOT LIKE '%4010%' AND SERVERPART_ID = '" + e.Argument.ToString().Split('&')[0] + "' AND SHOPCODE IS NOT NULL order by SHOPREGION,SHOPCODE,SHOPNAME")) { ListItemEx _ListItemEx = new ListItemEx(); _ListItemEx.Text = _SERVERPARTSHOP.SHOPNAME; _ListItemEx.Value = _SERVERPARTSHOP.SHOPCODE; SHOPCODE.Items.Add(_ListItemEx); } e.SetDropDownListEx(SHOPCODE); } #endregion #region 方法 -> 保存参数信息 public Business.CASHIERCONTROL GetSaveModel() { USERNAME.Text = Page.PassportInfo.Name; USERNAME2.Text = Page.PassportInfo.Name; CREATE_DATE.Text = DateTime.Now.ToShortDateString(); CREATE_DATE2.Text = DateTime.Now.ToShortDateString(); Business.CASHIERCONTROL _CASHIERCONTROL = new Business.CASHIERCONTROL(this.Transaction); _CASHIERCONTROL.USERID = Page.PassportInfo.ID; _CASHIERCONTROL.SERVERPARTCODE = SERVERPART_CODE.SelectedValue.Split('&')[1]; _CASHIERCONTROL.MACHINE_MACADDRESS = MACHINE_MACADDRESS.Text; _CASHIERCONTROL.MACHINECODE = MACHINECODE.Text; _CASHIERCONTROL.SHOPCODE = SHOPCODE.SelectedValue; //结账时间 if (!string.IsNullOrEmpty(ENDACCOUNT_DATE.Text)) { _CASHIERCONTROL.ENDACCOUNT_DATE = DateTime.Parse(ENDACCOUNT_DATE.Text); } if (!string.IsNullOrEmpty(ENDACCOUNT_DAY.Text)) { _CASHIERCONTROL.ENDACCOUNT_DAY = int.Parse(ENDACCOUNT_DAY.Text); } if (!string.IsNullOrEmpty(ddlUsingType.SelectedValue)) { _CASHIERCONTROL.USING_TYPE = int.Parse(ddlUsingType.SelectedValue); } //日结校验天数 if (!string.IsNullOrEmpty(CHECK_DAY.Text)) { _CASHIERCONTROL.CHECK_DAY = int.Parse(CHECK_DAY.Text); } //机器序列号 _CASHIERCONTROL.MACHINE_SERNO = MACHINE_SERNO.Text; //安装时间 if (!string.IsNullOrEmpty(SETUP_DATE.Text)) { _CASHIERCONTROL.SETUP_DATE = DateTime.Parse(SETUP_DATE.Text); } if (!string.IsNullOrEmpty(VERSION_NUM.Text.Trim())) { _CASHIERCONTROL.VERSION_NUM = VERSION_NUM.Text.Trim(); } if (!string.IsNullOrEmpty(CASHIERCONTROL_DESC.Text.Trim())) { _CASHIERCONTROL.CASHIERCONTROL_DESC = CASHIERCONTROL_DESC.Text.Trim(); } //购买 if (ddlUsingType.SelectedValue == "1000") { if (!string.IsNullOrEmpty(WARRANTY_DATE.Text)) { //硬件有效期 _CASHIERCONTROL.WARRANTY_DATE = DateTime.Parse(WARRANTY_DATE.Text); } //软件有效日期 if (!string.IsNullOrEmpty(EXPIRY_DATE.Text)) { _CASHIERCONTROL.EXPIRY_DATE = DateTime.Parse(EXPIRY_DATE.Text); } //有效期提醒时间 if (!string.IsNullOrEmpty(EXPIRY_DAY.Text)) { _CASHIERCONTROL.EXPIRY_DAY = int.Parse(EXPIRY_DAY.Text); } //填表人 if (!string.IsNullOrEmpty(USERNAME.Text)) { _CASHIERCONTROL.USERNAME = USERNAME.Text; } //填表时间 if (!string.IsNullOrEmpty(CREATE_DATE.Text)) { _CASHIERCONTROL.CREATE_DATE = DateTime.Parse(CREATE_DATE.Text); } } else { //租赁到期时间 if (!string.IsNullOrEmpty(RENT_DATE.Text)) { _CASHIERCONTROL.RENT_DATE = DateTime.Parse(RENT_DATE.Text); } if (!string.IsNullOrEmpty(RENT_REMIND_DAY.Text)) { _CASHIERCONTROL.RENT_REMIND_DAY = int.Parse(RENT_REMIND_DAY.Text); } //付款状态 _CASHIERCONTROL.RENTPAY_STATE = int.Parse(ddlPayState.SelectedValue); //填表人 if (!string.IsNullOrEmpty(USERNAME2.Text)) { _CASHIERCONTROL.USERNAME = USERNAME2.Text; } //填表时间 if (!string.IsNullOrEmpty(CREATE_DATE2.Text)) { _CASHIERCONTROL.CREATE_DATE = DateTime.Parse(CREATE_DATE2.Text); } } return _CASHIERCONTROL; } #endregion #region 方法 -> 同MAC地址收银机 //查询 protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e) { GridViewEx1.Selecting(ObjectDataSource1, null); //设置UI变化 e.SetValue(GridViewEx1); } //查询SQL设置 protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e) { //且搜索条件 if (!string.IsNullOrEmpty(Request["MACHINE_MACADDRESS"]) || !string.IsNullOrEmpty(MACHINE_MACADDRESS.Text)) { e.AddAndParams("MACHINE_MACADDRESS", Request["MACHINE_MACADDRESS"].ToDecrypt()); } else { e.AddAndParams("1", 2); } //排序 e.AddOrderByParams("POINT_DATE", true); } protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { HWSB.SERVERPART _SERVERPART = new HWSB.SERVERPART(Transaction); _SERVERPART.AddSearchParameter("SERVERPART_CODE", e.Row.Cells[1].Text); if (_SERVERPART.Search()) { e.Row.Cells[1].Text = _SERVERPART.SERVERPART_NAME; HWSB.SERVERPARTSHOP _SERVERPARTSHOP = new HWSB.SERVERPARTSHOP(Transaction); _SERVERPARTSHOP.AddSearchParameter("SERVERPART_ID", _SERVERPART.SERVERPART_ID); _SERVERPARTSHOP.AddSearchParameter("SHOPCODE", e.Row.Cells[2].Text); if (_SERVERPARTSHOP.Search()) { e.Row.Cells[2].Text = _SERVERPARTSHOP.SHOPNAME; } } e.Row.ToolTip = e.Row.Cells[e.Row.Cells.Count - 1].Text.Replace(" ", "").Replace("|", ","); if (e.Row.Cells[e.Row.Cells.Count - 1].Text.Length > 15) { e.Row.Cells[e.Row.Cells.Count - 1].Text = e.Row.Cells[e.Row.Cells.Count - 1].Text.Replace("|", ",").Substring(0, 15) + "..."; } else { e.Row.Cells[e.Row.Cells.Count - 1].Text = e.Row.Cells[e.Row.Cells.Count - 1].Text.Replace("|", ","); } } } #endregion #region 方法 -> 同门店心跳信息 //查询 protected void ButtonSearch2_CallBackClick(object sender, ClientSetEventArgs e) { GridViewEx2.Selecting(ObjectDataSource2, null); //设置UI变化 e.SetValue(GridViewEx2); } //查询SQL设置 protected void GridViewEx2_SelectMethodParameters(object sender, SelectMethodParametersArgs e) { bool Flag = true; //且搜索条件 if (!string.IsNullOrEmpty(Request["SERVERPARTCODE"]) || !string.IsNullOrEmpty(SERVERPARTCODE.Text)) { Flag = false; e.AddAndParams("SERVERPARTCODE", Request["SERVERPARTCODE"].ToDecrypt()); } if (!string.IsNullOrEmpty(Request["SHOPCODE"]) || !string.IsNullOrEmpty(SHOPCODE.SelectedValue)) { Flag = false; e.AddAndParams("SHOPCODE", Request["SHOPCODE"].ToDecrypt()); } if (Flag) { e.AddAndParams("1", 2); } //排序 e.AddOrderByParams("CONNECT_DATE", true); } protected void GridViewEx2_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string _CONTENT = GridViewEx2.DataKeys[e.Row.RowIndex]["CONTENT"].ToString(); //服务区内码 string _SERVERPARTCODE = GridViewEx2.DataKeys[e.Row.RowIndex].Values["SERVERPARTCODE"].ToEncrypt(); string _SHOPCODE = GridViewEx2.DataKeys[e.Row.RowIndex].Values["SHOPCODE"].ToString(); string _MACHINECODE = GridViewEx2.DataKeys[e.Row.RowIndex].Values["MACHINECODE"].ToString(); string _PROVINCE_CODE = ""; string _SERVERPART_ID = ""; if (e.Row.Cells[e.Row.Cells.Count - 2].Text == Request["MACHINE_MACADDRESS"].ToDecrypt()) { e.Row.Cells[e.Row.Cells.Count - 2].Font.Bold = true; } HWSB.COMMODITY _COMMODITY = new HWSB.COMMODITY(this.Transaction); HWSB.SERVERPART _SERVERPART = new HWSB.SERVERPART(Transaction); _SERVERPART.AddSearchParameter("SERVERPART_CODE", e.Row.Cells[3].Text); if (_SERVERPART.Search()) { e.Row.Cells[3].Text = _SERVERPART.SERVERPART_NAME; _SERVERPART_ID = _SERVERPART.SERVERPART_ID.ToString(); _PROVINCE_CODE = _SERVERPART.PROVINCE_CODE.ToString(); HWSB.SERVERPARTSHOP _SERVERPARTSHOP = new HWSB.SERVERPARTSHOP(Transaction); _SERVERPARTSHOP.AddSearchParameter("SERVERPART_ID", _SERVERPART.SERVERPART_ID); _SERVERPARTSHOP.AddSearchParameter("SHOPCODE", e.Row.Cells[4].Text); if (_SERVERPARTSHOP.Search()) { e.Row.Cells[4].Text = _SERVERPARTSHOP.SHOPNAME; } } if (string.IsNullOrEmpty(e.Row.Cells[1].Text.Replace(" ", "")) && _CONTENT.Contains("YSv")) { e.Row.Cells[1].Text = "YSv" + _CONTENT.Split("YSv")[1]; } try { if (new Business.MACHINEPOINT(Transaction).GetCount("WHERE SERVERPARTCODE = '" + _SERVERPARTCODE.ToDecrypt() + "' AND SHOPCODE = '" + _SHOPCODE + "' AND MACHINENAME = '" + e.Row.Cells[7].Text + "'") > 0) { e.Row.Attributes["onclick"] = GridViewEx1.GetOpenPopDialogClientScript( "MACHINEPOINTPage.aspx?SERVERPARTCODE=" + _SERVERPARTCODE + "&SHOPCODE=" + _SHOPCODE.ToEncrypt() + "&MACHINENAME=" + e.Row.Cells[7].Text.ToEncrypt(), 1000, 600); } else { e.Row.Attributes["onclick"] = ""; } } catch { e.Row.Attributes["onclick"] = ""; } string CommCountSqlString = @"select count(1) from HIGHWAY_STORAGE.T_COMMODITY where EXISTS ( SELECT 1 FROM HIGHWAY_STORAGE.T_SERVERPARTSHOP WHERE SERVERPART_ID = " + _SERVERPART_ID + " AND SHOPTRADE LIKE '%' || BUSINESSTYPE || '%' AND SHOPCODE = '" + _SHOPCODE + "') AND SERVERPART_ID IN (" + serverpart_id + "," + _SERVERPART_ID + ") AND PROVINCE_CODE = " + _PROVINCE_CODE + " AND COMMODITY_STATE = 1 AND BUSINESSTYPE IS NOT NULL"; DataTable _DataTable_PassComm = _COMMODITY.ExecuteDataTable(CommCountSqlString); //审批通过商品数量 string PassCommCount = _DataTable_PassComm.Rows[0][0].ToString(); if (e.Row.Cells[6].Text != PassCommCount) { e.Row.Cells[6].ForeColor = System.Drawing.Color.IndianRed; } e.Row.Cells[6].Text = PassCommCount + "/" + e.Row.Cells[6].Text; //状态 try { //回传时间 System.TimeSpan _TimeSpan_Back = System.DateTime.Now - DateTime.Parse(e.Row.Cells[5].Text); if (_TimeSpan_Back.TotalMinutes > 10) { //5分钟无反馈数据 找不到日结 网络断开中。。橙色 //5分钟无反馈数据 具有日结,已经结账下班 灰色 //查询日结 e.Row.Cells[2].Text = "网络未连接"; e.Row.Cells[2].ForeColor = System.Drawing.Color.MediumVioletRed; string EndAccountSql = "select count(1) from HIGHWAY_SELLDATA.T_ENDACCOUNT where SERVERPART_ID = '" + _SERVERPART_ID + "' AND SHOPCODE = '" + _SHOPCODE + "' AND MACHINECODE='" + _MACHINECODE + "' AND TO_DATE('" + e.Row.Cells[5].Text + "','YYYY/MM/DD HH24:MI:SS') - ENDACCOUNT_DATE BETWEEN 0 AND 1/24"; if (int.Parse(_COMMODITY.ExecuteDataTable(EndAccountSql).Rows[0][0].ToString()) > 0) { e.Row.Cells[2].Text = "已经结账下班"; e.Row.Cells[2].ForeColor = System.Drawing.Color.DimGray; try { if (DateTime.Parse(e.Row.Cells[5].Text) < DateTime.Now.Date) { e.Row.Cells[5].ForeColor = System.Drawing.Color.DimGray; } } catch { } } } else { //5分钟之内无客单 等待上班中。。绿色 //5分钟之内有客单 收银状态正常 蓝色 try { System.TimeSpan _TimeSpan_Bill = System.DateTime.Now - DateTime.Parse(_CONTENT.Split('|')[1]); if (_TimeSpan_Bill.TotalMinutes < 10) { //检测到客单 e.Row.Cells[2].Text = "收银状态正常"; e.Row.Cells[2].ForeColor = System.Drawing.Color.DeepSkyBlue; } else { //检测到客单 e.Row.Cells[2].Text = "收银状态正常"; e.Row.Cells[2].ForeColor = System.Drawing.Color.DeepSkyBlue; } } catch { e.Row.Cells[2].Text = "收银状态正常"; e.Row.Cells[2].ForeColor = System.Drawing.Color.DeepSkyBlue; } } //当前时间与最后订单 } catch { e.Row.Cells[2].Text = "网络未连接"; e.Row.Cells[2].ForeColor = System.Drawing.Color.MediumVioletRed; } } } #endregion #region 方法 -> 同门店机器信息 protected void ButtonSearch3_CallBackClick(object sender, ClientSetEventArgs e) { GridViewEx3.Selecting(ObjectDataSource3, null); //设置UI变化 e.SetValue(GridViewEx3); } protected void GridViewEx3_SelectMethodParameters(object sender, SelectMethodParametersArgs e) { bool Flag = true; e.AddAndParams("1", 1); //且搜索条件 if (!string.IsNullOrEmpty(Request["SERVERPARTCODE"]) || !string.IsNullOrEmpty(SERVERPARTCODE.Text)) { Flag = false; e.AddAndParams("SERVERPARTCODE", Request["SERVERPARTCODE"].ToDecrypt()); } if (!string.IsNullOrEmpty(Request["SHOPCODE"]) || !string.IsNullOrEmpty(SHOPCODE.SelectedValue)) { Flag = false; e.AddAndParams("SHOPCODE", Request["SHOPCODE"].ToDecrypt()); } if (Flag) { e.AddAndParams("1", 2); } e.SetOtherUserCustomWhereSqlString = "MACHINE_MACADDRESS <> '" + Request["MACHINE_MACADDRESS"].ToDecrypt() + "'"; //排序 e.AddOrderByParams("ADDDATE", true); } #endregion #region 方法 -> 生成机器二维码 protected void BuildQCode_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(SERVERPART_CODE.SelectedValue) || string.IsNullOrWhiteSpace(SHOPCODE.SelectedValue) || string.IsNullOrWhiteSpace(MobilePayOperators.SelectedValue) || string.IsNullOrWhiteSpace(SERVER_IP.Text) || string.IsNullOrWhiteSpace(ServicePort.Text) || string.IsNullOrWhiteSpace(DataServicePort.Text)) { Page.Alert("请填写服务区、门店、移动支付服务商、主支付通道端口、数据传输端口、服务器IP,再点击生成二维码!"); return; } Models.ConfigurationModel _ConfigurationModel = new Models.ConfigurationModel(); _ConfigurationModel.ServerpartCode = SERVERPART_CODE.SelectedValue.Split('&')[1]; _ConfigurationModel.ServerpartName = HttpUtility.UrlEncode(SERVERPART_CODE.SelectedItem.Text); _ConfigurationModel.ShopCode = SHOPCODE.SelectedValue; _ConfigurationModel.ShopName = HttpUtility.UrlEncode(SHOPCODE.SelectedItem.Text); _ConfigurationModel.MobilePayOperators = MobilePayOperators.SelectedValue; //_ConfigurationModel.MachineCode = MACHINECODE.Text; _ConfigurationModel.ServerIP = SERVER_IP.Text; _ConfigurationModel.ServicePort = ServicePort.Text; _ConfigurationModel.DataServicePort = DataServicePort.Text; _ConfigurationModel.ExpiryDate = ddlUsingType.SelectedValue == "2000" ? RENT_DATE.Text : EXPIRY_DATE.Text; _ConfigurationModel.CheckCode = CheckCode.Text; QrUrl.Text = JsonConvert.SerializeObject(_ConfigurationModel); LoadImage(QrUrl.Text); } private void LoadImage(string Url) { options = new QrCodeEncodingOptions { DisableECI = true, CharacterSet = "UTF-8", Width = 200, Height = 200 }; writer = new BarcodeWriter(); writer.Format = BarcodeFormat.QR_CODE; writer.Options = options; Bitmap bitmap = writer.Write(Url); using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) { bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png); string base64 = Convert.ToBase64String(ms.ToArray()); ImgQr.ImageUrl = "data:image/png;base64," + base64; } } #endregion #region 方法 -> 保存机器参数信息 public void SaveMachineConfig() { using (Business.CONFIGURATION _CONFIGURATION = new Business.CONFIGURATION(Transaction)) { //移动支付服务商 if (!string.IsNullOrWhiteSpace(MobilePayOperators.SelectedValue)) { SaveConfigurationModel(_CONFIGURATION, "MobilePayOperators", MobilePayOperators.SelectedValue); } //主支付通道端口 if (!string.IsNullOrWhiteSpace(ServicePort.Text)) { _CONFIGURATION.ResetProperty(); SaveConfigurationModel(_CONFIGURATION, "ServicePort", ServicePort.Text); } //数据传输端口 if (!string.IsNullOrWhiteSpace(DataServicePort.Text)) { _CONFIGURATION.ResetProperty(); SaveConfigurationModel(_CONFIGURATION, "DataServicePort", DataServicePort.Text); } } } private void SaveConfigurationModel(Business.CONFIGURATION _CONFIGURATION, string _CONFIGURATION_NAME, string _CONFIGURATION_VALUES) { _CONFIGURATION.AddSearchParameter("MACADDRESS", MACHINE_MACADDRESS.Text); _CONFIGURATION.AddSearchParameter("CONFIGURATION_NAME", _CONFIGURATION_NAME); if (_CONFIGURATION.Search()) { _CONFIGURATION.CONFIGURATION_VALUES = _CONFIGURATION_VALUES; _CONFIGURATION.CONFIGURATION_DATE = DateTime.Now; _CONFIGURATION.CONFIGURATION_DESC = Page.PassportInfo.Name; _CONFIGURATION.Update(); } else { _CONFIGURATION.ResetProperty(); _CONFIGURATION.SERVERPART_ID = SERVERPART_CODE.SelectedValue.Split('&')[0].TryParseToInt(); _CONFIGURATION.SERVERPARTCODE = SERVERPART_CODE.SelectedValue.Split('&')[1]; _CONFIGURATION.SHOPCODE = SHOPCODE.SelectedValue; _CONFIGURATION.MACHINECODE = MACHINECODE.Text; _CONFIGURATION.MACADDRESS = MACHINE_MACADDRESS.Text; _CONFIGURATION.CONFIGURATION_NAME = _CONFIGURATION_NAME; _CONFIGURATION.CONFIGURATION_VALUES = _CONFIGURATION_VALUES; _CONFIGURATION.CONFIGURATION_DATE = DateTime.Now; _CONFIGURATION.CONFIGURATION_DESC = Page.PassportInfo.Name; _CONFIGURATION.Insert(); } } #endregion } }