/// <summary> /// 点击事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listBox1_Click(object sender, EventArgs e) { if (SIString.TryStr(listBox1.SelectedItem).Length > 0) { ShowMember(SIString.TryStr(listBox1.SelectedItem)); } }
/// <summary> /// 打印充值信息 /// </summary> /// <param name="branchNo">门店信息</param> /// <param name="cardId">会员卡号</param> /// <param name="accAmt">充值金额</param> /// <param name="sendAmt">赠送金额</param> /// <param name="remAmt">卡内余额</param> private void Print(string branchNo, string cardId, decimal accAmt, decimal sendAmt, decimal remAmt) { List <string> list = new List <string>(); list.Add("储值卡充值"); string text = "分店: " + branchNo; string item = "会员编号: " + cardId.ToString(); string item2 = "充值金额: " + accAmt.ToString(Gattr.PosSaleAmtPoint); string item3 = "赠送余额: " + sendAmt.ToString(Gattr.PosSaleAmtPoint); string item4 = "卡内余额: " + remAmt.ToString(Gattr.PosSaleAmtPoint); string item5 = "充值付款方式: " + SIString.TryStr(this.comboBox1.SelectedItem.ToString()); list.Add(text); list.Add(item); list.Add(item2); list.Add(item3); list.Add(item4); list.Add(item5); Gattr.PosPrinter.OpenPrinter(Gattr.PosModel, Gattr.PosPort); Gfunc.PrintHeader(); List <PrintString> print = new List <PrintString>(); foreach (String str in list) { print.Add(new PrintString(str)); } Gfunc.PrintOut(print); Gfunc.SendToAPIPrint(); }
private void SelectBranch() { if ((this.dgvBranch.SelectedRows.Count > 0) && (this.dgvBranch.SelectedRows[0] != null)) { this.BranchNO = SIString.TryStr(this.dgvBranch.SelectedRows[0].Cells["branch_no"].Value); base.Close(); } }
//public string SetPwd() //{ // PosServices service = new PosServices(); // try // { // service.Url = Gattr.WebPosServicePath; // // return service.vippasswordchange("15020364165", "8f92b9ac87ccc718dea786477e46e1c4"); // } // catch (Exception exception) // { // throw exception; // } // finally // { // service.Dispose(); // } // return ""; //} //public string GetHellWorld() //{ // //if (this.TestConnection()) // //{ // //PosServices service = new PosServices(); // //try // //{ // // service.Url = this.GetWebUrl(Gattr.WebPosServicePath); // // return "";// service.GetData("sss"); // //} // //catch (Exception exception) // //{ // // throw exception; // //} // //finally // //{ // // service.Dispose(); // //} // //} // //return ""; //} /// <summary> /// URL /// </summary> /// <param name="webPath"></param> /// <returns></returns> public string GetWebUrl(string webPath) { if (SIString.TryStr(this._serverUrl).Trim() == string.Empty) { throw new Exception("服务器地址不能为空!"); } return(SIString.TryStr(this._serverUrl + webPath).Trim()); }
/// <summary> /// 根据不同的方法参数执行不同的方法参数 /// </summary> /// <param name="mark"></param> void InvokeMethod(String mark, String branch_no) { //if (this.txtServerUrl.Text.Trim().Length == 0 && mark != "GetPosStatusList") //{ // MessageBox.Show("服务器地址不能为空", Gattr.AppTitle); //} //else //{ bool isok = true; //this.ServerUrl = this.txtServerUrl.Text.Trim(); object obj = null; DataTable table = null; try { //obj = BaseInfoService.Instance.InvokeService(this.txtServerUrl.Text.Trim(), Gattr.WebPosServicePath, mark, ref isok, parameter); branch_no = branch_no == string.Empty ? Gattr.BranchNo : branch_no; obj = PosDownServiceProvider.Instance.InvokeService(Gattr.CONNECT_STRING, mark, ref isok, branch_no, "", 0, ""); if (isok) { table = (DataTable)obj; if (mark == "GetBranchList") { cbbBranch.Items.Clear(); foreach (DataRow dr in table.Rows) { ListItem item = new ListItem(SIString.TryStr(dr["branch_no"]), "[" + SIString.TryStr(dr["branch_no"]) + "]" + SIString.TryStr(dr["branch_name"])); cbbBranch.Items.Add(item); } cbbBranch.SelectedIndex = 0; ListItem item1 = cbbBranch.SelectedItem as ListItem; String selectedItem = SIString.TryStr(item1.Key); InvokeMethod("GetPosStatus", selectedItem); MessageBox.Show("连接成功", Gattr.AppTitle); btnOk.Enabled = true; } else { cbbPOS.Items.Clear(); if (table != null && table.Rows.Count > 0) { foreach (DataRow dr in table.Rows) { ListItem item = new ListItem(SIString.TryStr(dr["posid"]), "[" + SIString.TryStr(dr["posid"]) + "]" + SIString.TryStr(dr["posid"])); cbbPOS.Items.Add(item); } cbbPOS.SelectedIndex = 0; } } } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", ex.ToString(), LogEnum.ExceptionLog); } // } }
private void dgItem_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { string itemNo = SIString.TryStr(this.dgItem.Rows[this.dgItem.CurrentRow.Index].Cells["item_no"].Value.ToString().Trim()); string str2 = SIString.TryStr(this.dgItem.Rows[this.dgItem.CurrentRow.Index].Cells["branch_no"].Value.ToString().Trim()); if (!string.IsNullOrEmpty(str2)) { if (Gattr.BranchNo == this.txtBranchNO.Text.Trim()) { MessageBox.Show("发货门店和收货门店不能相同", Gattr.AppTitle); } else { DataTable table = new DataTable(); table.Columns.Add(new DataColumn("item_no")); table.Columns.Add(new DataColumn("stock_qty")); table.Columns.Add(new DataColumn("item_name")); table.Columns.Add(new DataColumn("item_size")); table.Columns.Add(new DataColumn("item_clsname")); table.Columns.Add(new DataColumn("code_name")); table.Columns.Add(new DataColumn("unit_no")); foreach (DataGridViewRow dgvr in this.dgItem.SelectedRows) { DataRow dr = table.NewRow(); dr["item_no"] = ExtendUtility.Instance.ParseToString(dgvr.Cells["item_no"].Value); dr["item_name"] = ExtendUtility.Instance.ParseToString(dgvr.Cells["item_name"].Value); dr["item_size"] = ExtendUtility.Instance.ParseToString(dgvr.Cells["item_size"].Value); dr["item_clsname"] = ExtendUtility.Instance.ParseToString(dgvr.Cells["item_clsname"].Value); dr["code_name"] = ExtendUtility.Instance.ParseToString(dgvr.Cells["code_name"].Value); dr["unit_no"] = ExtendUtility.Instance.ParseToString(dgvr.Cells["unit_no"].Value); dr["stock_qty"] = ExtendUtility.Instance.ParseToString(dgvr.Cells["stock_qty"].Value); table.Rows.Add(dr); } string branch_no = this.txtBranchNO.Text.Trim(); if (_detail == null) { FrmDmSheetDetail detail = new FrmDmSheetDetail(branch_no, table); detail.ShowDialog(); } else { DialogResult = System.Windows.Forms.DialogResult.OK; if (SetStock != null) { SetStock(table); } } } //using (FrmDmSheetDetail detail = new FrmDmSheetDetail(str2, itemNo)) //{ // detail.ShowDialog(); //} } }
/// <summary> /// 连接测试按钮事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTest_Click(object sender, EventArgs e) { if (sender != null) { ButtonEx btn = sender as ButtonEx; switch (btn.Tag.ToString()) { case "ok": //完成按钮事件逻辑 btnOk.Enabled = false; //TODO:完成 ListItem item1 = cbbBranch.SelectedItem as ListItem; String selectedItem = SIString.TryStr(item1.Key); String branch_no = StringUtility.Instance.StringTrim(selectedItem); ListItem item2 = cbbPOS.SelectedItem as ListItem; String selectedItem2 = SIString.TryStr(item2.Key); String pos_no = StringUtility.Instance.StringTrim(selectedItem2); if (ValidatePos(branch_no, pos_no)) { String path = Application.StartupPath + @"\" + Gattr.ApplicationXml; Dictionary <String, Object> _dic = new Dictionary <string, Object>(); ServerUrl = this.txtServerUrl.Text.Trim(); _dic.Add("ServerUrl", ServerUrl); _dic.Add("BranchNo", branch_no); _dic.Add("PosId", pos_no); XMLUtility.Instance.WriteXmlFile(path, _dic, "applicationConfig"); DialogResult = DialogResult.OK; } else { btnOk.Enabled = true; } break; case "ca": //取消按钮事件逻辑 DialogResult = DialogResult.Cancel; break; default: //连接按钮事件逻辑 Gattr.serverUrl = this.txtServerUrl.Text.Trim(); btnOk.Enabled = false; cbbBranch.Items.Clear(); cbbPOS.Items.Clear(); //InvokeMethod("GetBranchList", string.Empty); GetBranchInfo(); break; } } }
void GetBranchInfo() { try { Dictionary <string, object> _dic = Gfunc.GetServiceParameter(); string errorMessage = string.Empty; bool isok = true; string json = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/Getbrninfo", _dic, ref isok, ref errorMessage); if (isok) { if (!string.IsNullOrEmpty(json)) { if (json != "-10" && json != "-20") { DataTable table = JsonUtility.Instance.JsonToDataTable(json); if (table != null && table.Rows.Count > 0) { cbbBranch.Items.Clear(); foreach (DataRow dr in table.Rows) { string property = ExtendUtility.Instance.ParseToString(dr["property"]); if (property == "0") { ListItem item = new ListItem(SIString.TryStr(dr["branch_no"]), "[" + SIString.TryStr(dr["branch_no"]) + "]" + SIString.TryStr(dr["branch_name"])); cbbBranch.Items.Add(item); } } cbbBranch.SelectedIndex = 0; ListItem item1 = cbbBranch.SelectedItem as ListItem; String selectedItem = SIString.TryStr(item1.Key); GetPosStatus(selectedItem); MessageBox.Show("连接成功", Gattr.AppTitle); btnOk.Enabled = true; } } } } else { MessageBox.Show(errorMessage, Gattr.AppTitle); } } catch (Exception ex) { MessageBox.Show("连接失败", Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", ex.ToString(), LogEnum.ExceptionLog); } }
private void dgvSheet_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { string str = SIString.TryStr(this.dgvSheet.Rows[e.RowIndex].Cells["sheet_no"].Value); if (!string.IsNullOrEmpty(str)) { object obj = this.dgvSheet.Rows[e.RowIndex].DataBoundItem; //t_ using (FrmDmSheetDetail detail = new FrmDmSheetDetail(obj)) { detail.ShowDialog(); } } } }
/// <summary> /// 构造函数,需要把卡号和需要支付的金额传递过来 /// </summary> /// <param name="cardNo">会员卡/储值卡卡号</param> /// <param name="payAmt">需要支付的金额</param> public FrmPaySavCard(t_member_info memberInfo, Decimal payAmt) { InitializeComponent(); ActiveControl = tbxCardNo; tbxCardNo.Focus(); if (memberInfo != null && SIString.TryStr(memberInfo.mem_no).Length > 0) { tbxCardNo.Text = memberInfo.mem_no; lbName.Text = memberInfo.username; lbRemain.Text = memberInfo.balance.ToString(); tbxCardNo.Enabled = false; ActiveControl = tbxPass; tbxPass.Focus(); } tbxAmt.Text = payAmt.ToString(Gattr.PosSaleAmtPoint); lbMaxAmt.Text = payAmt.ToString(Gattr.PosSaleAmtPoint); }
/// <summary> /// 键按下事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listBox1_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.F2: ShowMember("查询会员卡信息 (F2)"); break; case Keys.F3: //MessageBox.Show("暂未开通", Gattr.AppTitle); ShowMember("会 员 充 值 (F3)"); break; case Keys.Enter: ShowMember(SIString.TryStr(listBox1.SelectedItem)); break; } }
private void btnOpen_Click(object sender, EventArgs e) { if (this.dgvSheet.CurrentRow != null) { string str = SIString.TryStr(this.dgvSheet.Rows[this.dgvSheet.CurrentRow.Index].Cells["sheet_no"].Value.ToString().Trim()); if (!string.IsNullOrEmpty(str)) { object dataRow = this.dgvSheet.CurrentRow.DataBoundItem; using (FrmDmSheetDetail detail = new FrmDmSheetDetail(dataRow)) { detail.ShowDialog(); } } } else { MessageBox.Show("请先选中一行再进行操作!", Gattr.AppTitle); } }
void GetPosStatus(String branch_no) { try { Dictionary <string, object> _dic = Gfunc.GetServiceParameter(); _dic.Add("branch_no", branch_no); string errorMessage = string.Empty; bool isok = true; string json = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/Getposstatus", _dic, ref isok, ref errorMessage); if (isok) { if (!string.IsNullOrEmpty(json)) { if (json != "-10" && json != "-20") { DataTable table = JsonUtility.Instance.JsonToDataTable(json); if (table != null && table.Rows.Count > 0) { cbbPOS.Items.Clear(); if (table != null && table.Rows.Count > 0) { foreach (DataRow dr in table.Rows) { ListItem item = new ListItem(SIString.TryStr(dr["posid"]), "[" + SIString.TryStr(dr["posid"]) + "]" + SIString.TryStr(dr["posid"])); cbbPOS.Items.Add(item); } cbbPOS.SelectedIndex = 0; } } } } } else { MessageBox.Show(errorMessage, Gattr.AppTitle); } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", ex.ToString(), LogEnum.ExceptionLog); } }
/// <summary> /// 删除商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonEx1_Click(object sender, EventArgs e) { if (!this.dgvItemList.ReadOnly) { if (this.dgvItemList.CurrentRow != null) { string str = SIString.TryStr(this.dgvItemList.Rows[this.dgvItemList.CurrentRow.Index].Cells["item_no"].Value); DataRow[] rowArray = this.dt.Select(string.Format(" item_no='{0}' ", str)); if (rowArray.Length > 0) { this.dt.Rows.Remove(rowArray[0]); this.dgvItemList.DataSource = this.dt; } } } else { MessageBox.Show("请先选中需要删除的商品,再进行操作!", Gattr.AppTitle); } }
/// <summary> /// 使用会员卡金额付款 /// </summary> /// <param name="mem_no">会员卡号</param> /// <param name="money">扣减金额</param> /// <param name="ordername">关联订单号</param> /// <param name="memo">备注</param> /// <returns></returns> public t_member_info UseMemberCardPay(String mem_no, String money, String ordername, String memo) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("money", SIString.TryStr(money)); _dic.Add("ordername", ordername); _dic.Add("else", memo); t = InvokeMemberService("deduction", _dic); if (t.code == "1") { t = AddMemberScore(mem_no, money, ordername); if (t.code == "1") { t = GetMemberInfoByMemNo(mem_no); } } return(t); }
private void dgvItemList_KeyDown(object sender, KeyEventArgs e) { if (!this.dgvItemList.ReadOnly) { if ((e.KeyCode == Keys.Delete) && (this.dgvItemList.CurrentRow != null)) { string str = SIString.TryStr(this.dgvItemList.Rows[this.dgvItemList.CurrentRow.Index].Cells["item_no"].Value); DataRow[] rowArray = this.dt.Select(string.Format(" item_no='{0}' ", str)); if (rowArray.Length > 0) { this.dt.Rows.Remove(rowArray[0]); this.dgvItemList.DataSource = this.dt; } } } else if (e.KeyCode == Keys.Delete) { this.buttonEx1_Click(sender, e); } }
/// <summary> /// 使用会员卡金额付款 /// </summary> /// <param name="mem_no">会员卡号</param> /// <param name="money">扣减金额</param> /// <param name="ordername">关联订单号</param> /// <param name="memo">备注</param> /// <returns></returns> public t_member_info UseMemberCardPayNew(String mem_no, String money, String ordername, String vercode, String memo) { Dictionary <String, String> _dic = new Dictionary <string, string>(); t_member_info t = null; _dic.Add("mem_no", mem_no); _dic.Add("money", SIString.TryStr(money)); _dic.Add("ordername", ordername); _dic.Add("else", System.Web.HttpUtility.UrlEncode(memo).ToUpper()); _dic.Add("vercode", vercode); t = InvokeMemberService("deduction", _dic); if (t.code == "1") { //t = AddMemberScore(mem_no, money, ordername); if (t.code == "1") { t = GetMemberInfoByMemNo(mem_no); } } return(t); }
/// <summary> /// 查询按钮事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, System.EventArgs e) { lbMemberBalance.Text = string.Empty; lbMemberCons.Text = string.Empty; lbMemberEmail.Text = string.Empty; lbMemberId.Text = string.Empty; lbMemberLevel.Text = string.Empty; lbMemberName.Text = string.Empty; lbMemberNo.Text = string.Empty; lbMemberScore.Text = string.Empty; lbMemberType.Text = string.Empty; lbMemberMobile.Text = string.Empty; if (tbMem_no.Text.Trim().Length == 0) { MessageBox.Show("请输入要查询的会员账号或手机号", Gattr.AppTitle); tbMem_no.Focus(); return; } t_member_info memberinfo = MemberService.Instance.GetMemberInfoByMemNo(tbMem_no.Text.Trim()); if (memberinfo.code == "1") { lbMemberBalance.Text = SIString.TryStr(ExtendUtility.Instance.ParseToDecimal(memberinfo.balance).ToString(Gattr.PosSalePrcPoint)); lbMemberCons.Text = SIString.TryStr(ExtendUtility.Instance.ParseToDecimal(memberinfo.total_consu).ToString(Gattr.PosSalePrcPoint)); lbMemberEmail.Text = SIString.TryStr(memberinfo.email); lbMemberId.Text = SIString.TryStr(memberinfo.mem_id); lbMemberLevel.Text = SIString.TryStr(memberinfo.Level); lbMemberName.Text = SIString.TryStr(memberinfo.username); lbMemberNo.Text = SIString.TryStr(memberinfo.mem_no); lbMemberScore.Text = SIString.TryStr(ExtendUtility.Instance.ParseToDecimal(memberinfo.score).ToString(Gattr.PosSalePrcPoint)); lbMemberType.Text = SIString.TryStr(memberinfo.regtype); lbMemberMobile.Text = SIString.TryStr(memberinfo.mobile); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); tbMem_no.Focus(); } }
/// <summary> /// 设置会员信息 /// </summary> void SetMemberInfo() { if (tbMemberNo.Text.Trim().Length == 0) { MessageBox.Show("请输入会员卡号", Gattr.AppTitle); tbMemberNo.Focus(); return; } lbMemberNo.Text = string.Empty; lbMemberBalance.Text = string.Empty; t_member_info memberinfo = MemberService.Instance.GetMemberInfoByMemNo(this.tbMemberNo.Text.Trim()); if (memberinfo.code == "1") { lbMemberNo.Text = memberinfo.username; lbMemberBalance.Text = SIString.TryStr(memberinfo.balance); } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); tbMemberNo.Focus(); } }
/// <summary> /// 确定按钮事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { tbPayAmount2.Text = "0.00"; bool isok = true; if (lbMemberNo.Text.Length == 0) { MessageBox.Show("请输入会员卡号", Gattr.AppTitle); tbMemberNo.Focus(); isok = false; } else { if (tbPayAmount.Text.Trim().Length == 0) { MessageBox.Show("请输入充值金额", Gattr.AppTitle); tbPayAmount.Focus(); isok = false; } else { if (tbPayAmount.Text.Trim() != tbPayAmount1.Text.Trim()) { MessageBox.Show("充值金额和已付金额必须相等", Gattr.AppTitle); tbPayAmount1.Focus(); isok = false; } else { if (this.comboBox1.SelectedIndex < 0) { MessageBox.Show("请选择支付方式", Gattr.AppTitle); comboBox1.Focus(); isok = false; } } } } if (isok) { String payway = SIString.TryStr(this.comboBox1.SelectedItem); if (payway == "银行卡") { payway = "CRD"; } else { payway = "RMB"; } TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); String ordername = Convert.ToInt64(ts.TotalSeconds).ToString(); if (MessageBox.Show("确定要充值?", Gattr.AppTitle, MessageBoxButtons.YesNo) == DialogResult.Yes) { t_member_info memberinfo = MemberService.Instance.RechargeMoney(tbMemberNo.Text.Trim(), tbPayAmount.Text.Trim(), ordername, payway); if (memberinfo.code == "1") { t_member_info memberinfo1 = MemberService.Instance.RechargeMoneyFinsh(tbMemberNo.Text.Trim(), ordername); if (memberinfo1.code == "1") { MessageBox.Show("充值成功,卡号:[" + tbMemberNo.Text.Trim() + "]充值金额[" + tbPayAmount.Text.Trim() + "]", Gattr.AppTitle); DialogResult = DialogResult.OK; //TODO:打印充值小票 Print(Gattr.BranchNo, tbMemberNo.Text.Trim(), SIString.TryDec(this.tbPayAmount.Text.Trim()), 0, SIString.TryDec(this.tbPayAmount.Text.Trim()) + SIString.TryDec(lbMemberBalance.Text.Trim())); LoggerHelper.Log("MsmkLogger", System.DateTime.Now.ToString() + "【" + Gattr.OperId + "】进行会员账户充值!充值成功,卡号:[" + tbMemberNo.Text.Trim() + "]充值金额[" + tbPayAmount.Text.Trim() + "]", LogEnum.SysLog); } else { MessageBox.Show(memberinfo1.info, Gattr.AppTitle); } } else { MessageBox.Show(memberinfo.info, Gattr.AppTitle); } } } }
/// <summary> /// 加载支付信息 /// </summary> void LoadData() { String operate = "="; if (tbox_No.Text == string.Empty) { MessageBox.Show("请输入订单号!", Gattr.AppTitle); return; } else { _flowno = tbox_No.Text; } DataTable table = Gattr.Bll.GetMaxPayFlowInfo(Gattr.BranchNo, Gattr.PosId, _flowno, operate); dgvPay.AutoGenerateColumns = false; dgvPay.DataSource = table; if (table != null && table.Rows.Count > 0) { string saleway = SIString.TryStr(table.Rows[0]["sale_way"]); tbox_No.Text = SIString.TryStr(table.Rows[0]["flow_no"]); _pay.flow_id = ExtendUtility.Instance.ParseToInt32(table.Rows[0]["flow_id"]); _pay.flow_no = ExtendUtility.Instance.ParseToString(table.Rows[0]["flow_no"]); saleAmount = ExtendUtility.Instance.ParseToDecimal(table.Rows[0]["sale_amount"]); _pay.oper_id = ExtendUtility.Instance.ParseToString(table.Rows[0]["oper_id"]); _pay.oper_date = ExtendUtility.Instance.ParseToDateTime(table.Rows[0]["oper_date"]).ToString("s"); _pay.pos_id = ExtendUtility.Instance.ParseToString(table.Rows[0]["pos_id"]); _pay.branch_no = ExtendUtility.Instance.ParseToString(table.Rows[0]["branch_no"]); _pay.sale_amount = saleAmount; if (saleway == "A" || saleway == "D") { _pay.sale_way = "A"; } else { if (!isArrearage) { MessageBox.Show(tbox_No.Text + "不是有效的销售订单", Gattr.AppTitle); return; } } DataTable tablePayWay = Gattr.Bll.GetPayFlowInfoDataTableByFlowNo(tbox_No.Text); //判断是不是赠送的订单,单个商品一个订单 赠送 sale_way A , pay_amount 0 if (tablePayWay.Rows.Count == 1 && ExtendUtility.Instance.ParseToDecimal(table.Rows[0]["pay_amount"]) == 0) { MessageBox.Show(tbox_No.Text + "不是有效的销售订单", Gattr.AppTitle); } else { for (int i = 0; i < tablePayWay.Rows.Count; i++) { //移除GZ的挂账记录,仅获取此单回款记录 if (ExtendUtility.Instance.ParseToString(tablePayWay.Rows[i]["pay_way"]) == "GZ") { tablePayWay.Rows.Remove(tablePayWay.Rows[i]); } } btn_Add.Enabled = true; btn_Alter.Enabled = true; dgvPayWay.AutoGenerateColumns = false; dgvPayWay.DataSource = tablePayWay; } } else { if (tbox_No.Text.Trim().Length > 0) { MessageBox.Show("没有找到流水号[" + tbox_No.Text + "]的订单", Gattr.AppTitle); } } }
/// <summary> /// 加载支付信息 /// </summary> void LoadData(int mark) { String operate = "="; if (mark == -1) { operate = "<"; } else if (mark == 1) { operate = ">"; } DataTable table = Gattr.Bll.GetMaxPayFlowInfo(Gattr.BranchNo, Gattr.PosId, txtInput.Text, operate); table.Columns.Add("sale_way_name"); for (int i = 0; i < table.Rows.Count; i++) { switch (table.Rows[i]["sale_way"].ToString()) { case "A": table.Rows[i]["sale_way_name"] = "销售"; break; case "B": table.Rows[i]["sale_way_name"] = "退货"; break; case "C": table.Rows[i]["sale_way_name"] = "赠送"; break; default: table.Rows[i]["sale_way_name"] = "挂账"; break; } } dgvPay.AutoGenerateColumns = false; dgvPay.DataSource = table; dgvSale.DataSource = null; bool isLoadDetails = true; if (table != null && table.Rows.Count > 0) { txtInput.Text = SIString.TryStr(table.Rows[0]["flow_no"]); } else { if (txtInput.Text.Trim().Length > 0) { if (mark == 0) { MessageBox.Show("没有找到流水号[" + txtInput.Text + "]的订单", Gattr.AppTitle); } else { MessageBox.Show("已是最后一条", Gattr.AppTitle); isLoadDetails = false; } } } if (isLoadDetails) { LoadDetails(txtInput.Text); } }
private void txtSearchKey_KeyDown(object sender, KeyEventArgs e) { this.dgItem.Focus(); this.txtSearchKey.Text = this.txtSearchKey.Text.Replace(this.TxtTitle, ""); this.txtSearchKey.ForeColor = Color.Black; switch (e.KeyCode) { //case Keys.Up: // if (this.dgItem.Rows.Count > 0) // { // if (this.dgItem.CurrentRow == null) // { // //this.dgItem.CurrentCell = this.dgItem[1, 1]; // this.dgItem.CurrentCell = this.dgItem.Rows[0].Cells["item_no"]; // } // else if (this.dgItem.CurrentRow.Index != 0) // { // this.dgItem.CurrentCell = this.dgItem.Rows[this.dgItem.CurrentRow.Index - 1].Cells["item_no"]; // //this.dgItem.CurrentCell = this.dgItem[1, this.dgItem.CurrentRow.Index - 1]; // e.Handled = true; // } // return; // } // return; //case Keys.Down: // if (this.dgItem.Rows.Count > 0) // { // if (this.dgItem.CurrentRow == null) // { // //this.dgItem.CurrentCell = this.dgItem[1, 1]; // this.dgItem.CurrentCell = this.dgItem.Rows[0].Cells["item_no"]; // } // else if (this.dgItem.Rows.Count != (this.dgItem.CurrentRow.Index + 1)) // { // this.dgItem.CurrentCell = this.dgItem.Rows[this.dgItem.CurrentRow.Index + 1].Cells["item_no"]; // //this.dgItem.CurrentCell = this.dgItem[1, this.dgItem.CurrentRow.Index + 1]; // e.Handled = true; // } // return; // } // return; case Keys.F5: this.itemF5 = string.Empty; if ((this.dgItem.SelectedRows.Count > 0) && (this.dgItem.SelectedRows[0] != null)) { this.itemF5 = this.dgItem.SelectedRows[0].Cells["item_no"].Value.ToString().ToUpper(); } if (this.IsClose) { base.Close(); } else { this.frmDmSheetDetail.AddItem(this.itemF5); } return; case Keys.Return: if ((e.KeyCode == Keys.Delete) && (this.dgItem.CurrentRow != null)) { string str = SIString.TryStr(this.dgItem.Rows[this.dgItem.CurrentRow.Index].Cells["item_no"].Value); if (!string.IsNullOrEmpty(str)) { this.itemF5 = str; base.Close(); } } else { this.btnSerch_Click(sender, e); } return; case Keys.Escape: base.Close(); return; } this.txtSearchKey.Focus(); }
private void btnDel_Click(object sender, EventArgs e) { //string cashierNo = Gattr.CashierNo; //string msg = ""; //if (Gfunc.PosCheckGrant(ref cashierNo, PosGrant.UpdateDmSheet, ref msg)) //{ if (this.dgvSheet.CurrentRow != null) { string sheetNO = SIString.TryStr(this.dgvSheet.Rows[this.dgvSheet.CurrentRow.Index].Cells["sheet_no"].Value.ToString().Trim()); string str4 = SIString.TryStr(this.dgvSheet.Rows[this.dgvSheet.CurrentRow.Index].Cells["approve_name"].Value.ToString().Trim()); string strStatus = SIString.TryStr(this.dgvSheet.Rows[this.dgvSheet.CurrentRow.Index].Cells["order_status"].Value.ToString().Trim()); if ((sheetNO != "") && (str4 != "已审核")) { DialogResult dialogResult = new DialogResult(); if (strStatus == "t") { dialogResult = MessageBox.Show("当前选中单据为[" + sheetNO + "],是否删除?", Gattr.AppTitle, MessageBoxButtons.YesNo); } else { dialogResult = MessageBox.Show("当前选中单据[" + sheetNO + "]已经提交审核,是否删除?", Gattr.AppTitle, MessageBoxButtons.YesNo); } if (dialogResult == DialogResult.Yes) { Dictionary <string, object> _dic = Gfunc.GetServiceParameter(); _dic.Add("sheet_no", sheetNO); bool isok = true; string errorMessage = string.Empty; string result = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/Delpsheet", _dic, ref isok, ref errorMessage); if (isok && result != "") { switch (result) { case "1": MessageBox.Show("删除成功!", Gattr.AppTitle); btnSearch_Click(sender, e); break; case "0": MessageBox.Show("删除失败,请重试!", Gattr.AppTitle); break; case "-1": MessageBox.Show("记录不存在!", Gattr.AppTitle); break; case "-2": MessageBox.Show("返回异常!", Gattr.AppTitle); break; case "-3": MessageBox.Show("业务错误!-3", Gattr.AppTitle); break; default: MessageBox.Show("未知错误!", Gattr.AppTitle); break; } } //string transNO = sheetNO.Contains("DY") ? "DY" : "AP"; //string transNO = "YH"; //if (RetailGlobal.ServerBll.DelSheet(transNO, sheetNO) > 0) //{ // MessageBox.Show("单据[" + sheetNO + "]删除成功!", Gattr.AppTitle); // this.btnSearch_Click(sender, e); //} //else //{ // MessageBox.Show("单据[" + sheetNO + "]删除失败,请检查是否为已审核单据!", Gattr.AppTitle); // this.btnSearch_Click(sender, e); //} LoggerHelper.Log("MsmkLogger", System.DateTime.Now.ToString() + "【" + Gattr.OperId + "】进行删除要货单!", LogEnum.SysLog); } } else { MessageBox.Show("单据[" + sheetNO + "]状态为已审核,不能删除!", Gattr.AppTitle); } } else { MessageBox.Show("请先选中一行再进行操作!", Gattr.AppTitle); } //} }