/// <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(); //} } }
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); } }
/// <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; } } }
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> /// 返回URL的访问地址 /// </summary> /// <param name="uri">服务的地址或者IP</param> /// <param name="path">服务地址</param> /// <returns>address字符串</returns> private String GetWebRequestAddress(String uri, String path) { String address = String.Empty; if (!SIString.IsNullOrEmptyOrDBNull(uri) && !SIString.IsNullOrEmptyOrDBNull(path)) { if (uri.EndsWith(@"/")) { address = string.Format(@"{0}{1}", uri, path); } else { address = string.Format(@"{0}/{1}", uri, path); } } return(address); }
/// <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="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="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 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="mark"></param> /// <param name="isAll"></param> /// <returns></returns> bool InvokeServices(String mark, bool isAll) { bool result = false; //1、调用方法获取数据 //2、将数据导入到表 //bool isok = true; DataTable table = null; object obj; try { t_handle _t_handle = Gattr.Bll.SelectHandleData(); //obj = PosServiceProvider.Instance.InvokeService(Gattr.HttpAddress, Gattr.WebPosServicePath, mark, ref isok, Gattr.BranchNo); //obj = PosDownServiceProvider.Instance.InvokeService(Gattr.CONNECT_STRING, mark, ref isok, Gattr.BranchNo, "", 0, ""); Dictionary <string, object> _dic = Gfunc.GetServiceParameter(); _dic.Add("branch_no", Gattr.BranchNo); switch (mark) { case "Getiteminfo": string last_time = WindowsAPIUtility.GetLocalSysParam("download", "t_product_food", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH); _dic.Add("rid", _t_handle.t_product_food); _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time).ToString()); break; case "Getbrastock": string last_time1 = WindowsAPIUtility.GetLocalSysParam("download", "t_pos_branch_stock", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH); _dic.Add("rid", _t_handle.t_product_food_kc); _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time1).ToString()); break; case "Getbraprc": string last_time2 = WindowsAPIUtility.GetLocalSysParam("download", "t_pos_branch_price", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH); _dic.Add("rid", _t_handle.t_product_food_jg); _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time2).ToString()); break; case "Getbarcode": string last_time3 = WindowsAPIUtility.GetLocalSysParam("download", "barcode", Gattr.LAST_UPDATE_TIME, Gattr.INI_FILE_PATH); _dic.Add("rid", _t_handle.t_product_food_barcode); _dic.Add("last_time", ExtendUtility.Instance.ParseToDateTime(last_time3).ToString()); break; case "Getitemcls": //_dic.Add("rid", _t_handle.t_product_food_type); _dic.Add("rid", -1); break; case "Getbasecode": _dic.Add("rid", _t_handle.t_base_code_type); break; case "Getbase": _dic.Add("rid", _t_handle.t_base_code); break; case "Getoper": _dic.Add("rid", _t_handle.t_operator); break; case "Getpmaster": _dic.Add("rid", _t_handle.t_rm_plan_master); break; case "Getcomb": _dic.Add("rid", _t_handle.t_bd_item_combsplit); break; case "Getpdetail": _dic.Add("rid", _t_handle.t_rm_plan_detail); break; } string errorMessage = string.Empty; bool isok1 = true; obj = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/" + mark, _dic, ref isok1, ref errorMessage); if (isok1) { //if (isok) //{ // //获取数据 // //插入数据 // if (mark != "GetPosSet") // { string result1 = ExtendUtility.Instance.ParseToString(obj); //if (!string.IsNullOrEmpty(result1)) { if (result1 != "-10" && result1 != "-20") { table = JsonUtility.Instance.JsonToDataTable(result1); if (!SIString.IsNullOrEmptyDataTable(table)) { decimal rid = 0M; switch (mark) { case "Getitemcls": result = Gattr.Bll.InsertItemClsData(table, _t_handle.t_product_food_type, ref rid); if (result) { _t_handle.t_product_food_type = rid; } break; case "Getbarcode": result = Gattr.Bll.InsertBarcodeData(table, _t_handle.t_product_food_barcode, ref rid); if (result) { _t_handle.t_product_food_barcode = rid; } break; case "Getiteminfo": result = Gattr.Bll.InsertItemData(table, _t_handle.t_product_food, ref rid); if (result) { _t_handle.t_product_food = rid; } break; case "Getoper": result = Gattr.Bll.InsertCashierData(table, _t_handle.t_operator, ref rid); if (result) { _t_handle.t_operator = rid; } break; case "Getbasecode": result = Gattr.Bll.InsertBaseTypeData(table, _t_handle.t_base_code_type, ref rid); if (result) { _t_handle.t_base_code_type = rid; } break; case "Getbase": result = Gattr.Bll.InsertBaseData(table, _t_handle.t_base_code, ref rid); if (result) { _t_handle.t_base_code = rid; } break; case "Getpayinfo": result = Gattr.Bll.InsertPaymentInfo(table); break; case "Getkey": result = Gattr.Bll.InsertFunction(table); break; case "Getbrninfo": result = Gattr.Bll.InsertBrancheList(table); break; case "Getbraprc": result = Gattr.Bll.UpdateItemPrice(table, ref rid); if (result) { _t_handle.t_product_food_jg = rid; } break; case "Getbrastock": result = Gattr.Bll.UpdateItemStock(table, ref rid); if (result) { _t_handle.t_product_food_kc = rid; } break; case "Getprule": result = Gattr.Bll.InsertPlanRule(table); break; case "Getpmaster": result = Gattr.Bll.InsertPlanMaster(table, _t_handle.t_rm_plan_master, ref rid); if (result) { _t_handle.t_rm_plan_master = rid; } break; case "Getpdetail": result = Gattr.Bll.InsertPlanDetail(table, _t_handle.t_rm_plan_detail, ref rid); if (result) { _t_handle.t_rm_plan_detail = rid; } break; case "Getcomb": result = Gattr.Bll.InsertItemComb(table, _t_handle.t_bd_item_combsplit, ref rid); if (result) { _t_handle.t_bd_item_combsplit = rid; } break; case "Getsup": result = Gattr.Bll.InsertSupinfo(table); break; default: break; } //如果数据更新成功则更新标识信息 if (result) { Gattr.Bll.UpdateHandleData(_t_handle); } } else { result = true; } } } // } // else // { // // List<t_sys_pos_set> sets = JsonUtility.Instance.JsonToObject<List<t_sys_pos_set>>(obj.ToString()); // // result = Gattr.Bll.InsertPosSysSet(sets); // } //} //else //{ // MessageBox.Show(SIString.TryStr(obj), Gattr.AppTitle); //} } else { MessageBox.Show(errorMessage, Gattr.AppTitle); } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", ex.ToString(), LogEnum.ExceptionLog); } return(result); }
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); } //} }
/// <summary> /// 初始化门店调用服务信息、门店、POS信息 /// </summary> /// <returns></returns> public static long InitEnvironment() { try { //门店POS配置文件 String xmlpath = Application.StartupPath + @"\" + Gattr.ApplicationXml; //流水号文件 Gattr.FlowNoFile = Application.StartupPath + @"\flowno.isf"; //是否启动双屏模块 //Gattr.IsDoubleModule = false; CheckSysInfo(); InitSysIni(); string[] nodePaths = new string[1]; nodePaths[0] = "//applicationConfig/BranchNo"; Dictionary <String, String> dic = XMLUtility.Instance.GetNodesText(xmlpath, nodePaths); LoggerHelper.Log("MsmkLogger", "开始检测是否需要更新配置信息", LogEnum.InitLog); if (dic == null || SIString.IsNullOrEmptyOrDBNull(dic[nodePaths[0]])) { LoggerHelper.Log("MsmkLogger", "更新配置信息开始Start", LogEnum.InitLog); FrmInitData frmInitData = new FrmInitData(); if (frmInitData.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { LoggerHelper.Log("MsmkLogger", "取消配置信息Cancel", LogEnum.InitLog); return(-1); } //if (frmInitData.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) LoggerHelper.Log("MsmkLogger", "更新配置信息完成End", LogEnum.InitLog); } //if (SIString.IsNullOrEmptyOrDBNull(dic[nodePaths[0]])) LoggerHelper.Log("MsmkLogger", "读取配置信息开始Start", LogEnum.InitLog); nodePaths = new string[3]; nodePaths[0] = "//applicationConfig/ServerUrl"; nodePaths[1] = "//applicationConfig/BranchNo"; nodePaths[2] = "//applicationConfig/PosId"; dic = XMLUtility.Instance.GetNodesText(xmlpath, nodePaths); //Gattr.HttpAddress = dic[nodePaths[0]]; Gattr.serverUrl = dic[nodePaths[0]]; Gattr.BranchNo = dic[nodePaths[1]]; Gattr.PosId = dic[nodePaths[2]]; string err = string.Empty; //获取二维码支付html Gattr.PayHtml = FileUtility.Instance.GetFileContent(Application.StartupPath + @"\pay.htm", ref err); LoggerHelper.Log("MsmkLogger", "读取配置信息完成End", LogEnum.InitLog); string errorMessage1 = string.Empty; if (!PosServericeBll.Instance.ValidatePos(Gattr.BranchNo, Gattr.PosId, ref errorMessage1)) { MessageBox.Show(errorMessage1, Gattr.AppTitle); return(-3); } //if (!ValidatePos(Gattr.BranchNo, Gattr.PosId)) //{ // return -3; //} bool isok = true; string errorMessage = string.Empty; Dictionary <string, object> _dicParameters = GetServiceParameter(); _dicParameters.Add("branch_no", Gattr.BranchNo); _dicParameters.Add("posid", Gattr.PosId); string result = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/Getadurl", _dicParameters, ref isok, ref errorMessage); if (isok) { if (result != "-10" && result != "-20" && result != "404") { Gattr.adUrl = result; } } else { LoggerHelper.Log("MsmkLogger", "读取门店广告信息错误:" + errorMessage, LogEnum.InitLog); } //Gattr.adUrl } catch (Exception) { return(-2); } return(1); }
/// <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(); }
/// <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> /// <param name="storeNo"></param> /// <param name="posId"></param> /// <param name="cashierId"></param> /// <param name="cashierName"></param> /// <param name="dtFrom"></param> /// <param name="dtTo"></param> /// <param name="intPrintLen"></param> /// <returns></returns> public List <string> ItemAccountStatement(string storeNo, string posId, string cashierId, string cashierName, DateTime dtFrom, DateTime dtTo, int intPrintLen) { int QtyLen = 6; //数量长度 int PrcLen = 6; //单价长度 int ItemLen = 15; //商品号 int CntLen = 6; // List <string> list2; List <string> list = new List <string>(); try { string str = ""; DataTable table = new DataTable(); table = base._dal.ItemAccountStatement(storeNo, cashierId, dtFrom, dtTo); if ((table == null) || (table.Rows.Count == 0)) { list.Add(str.PadLeft((intPrintLen < 0) ? 0 : intPrintLen, '-')); list.Add(Gfunc.PrintStrAlign("商品对帐 ", intPrintLen, TextAlign.Center)); str = ""; list.Add(str.PadLeft((intPrintLen < 0) ? 0 : intPrintLen, '-')); list.Add("收银员(" + cashierId + ")今天无收付款记录. "); return(list); } List <t_operator> cashierInfo = base._dal.GetOperatorInfo(cashierId, Gattr.BranchNo); list.Add(""); list.Add(Gfunc.PrintStrAlign(" 商品对帐单 ", intPrintLen, TextAlign.Center)); list.Add(Gfunc.PrintStrAlign("================", intPrintLen, TextAlign.Center)); str = ""; list.Add(str.PadLeft((intPrintLen < 0) ? 0 : intPrintLen, '-')); list.Add(" 机构: " + base._dal.GetBranchName(storeNo)); //list.Add(" 仓库: " + base._dal.GetBranchName(storeNo)); list.Add(" 收银机号: " + posId); list.Add(" 收 银 员:[" + cashierId + "]" + cashierInfo[0].oper_name.Trim()); list.Add(" 对账日期: " + DateTime.Today.ToString("yyyy-MM-dd")); str = ""; list.Add(str.PadLeft((intPrintLen < 0) ? 0 : intPrintLen, '-')); string item = (Gfunc.PrintStrAlign("品名", ItemLen, TextAlign.Left) + Gfunc.PrintStrAlign("售价", PrcLen, TextAlign.Right)) + Gfunc.PrintStrAlign("数量", QtyLen, TextAlign.Center) + Gfunc.PrintStrAlign("金额", CntLen, TextAlign.Right); list.Add(item); decimal num = 0M; decimal num2 = 0M; foreach (DataRow row in table.Rows) { decimal num6; string s = row["item_name"].ToString().Trim(); if (ItemLen < Encoding.Default.GetByteCount(s)) { s = SIString.SubChar(s, ItemLen); } string str4 = Gfunc.PrintStrAlign(s, ItemLen, TextAlign.Left); decimal num3 = SIString.TryDec(row["sale_price"]); string str5 = Gfunc.PrintStrAlign(num3.ToString(Gattr.PosSaleAmtPoint), PrcLen, TextAlign.Right); decimal num4 = SIString.TryDec(row["sale_qnty"]); num += (row["sale_way"].ToString() == "B") ? (num4 * -1M) : num4; string str6 = Gfunc.PrintStrAlign((row["sale_way"].ToString() == "B") ? (num6 = num4 * -1M).ToString("N0") : num4.ToString("N0"), QtyLen, TextAlign.Center); decimal num5 = num3 * num4; num2 += (row["sale_way"].ToString() == "B") ? (num5 * -1M) : num5; list.Add(str4 + str5 + str6 + Gfunc.PrintStrAlign((row["sale_way"].ToString() == "B") ? (num6 = num5 * -1M).ToString(Gattr.PosSaleAmtPoint) : num5.ToString(Gattr.PosSaleAmtPoint), CntLen, TextAlign.Right)); } list.Add(str.PadLeft((Gattr.PrtLen < 0) ? 0 : Gattr.PrtLen, '-')); string str8 = (Gfunc.PrintStrAlign("合计:", ItemLen, TextAlign.Left) + Gfunc.PrintStrAlign("", PrcLen, TextAlign.Right)) + Gfunc.PrintStrAlign(num.ToString("N0"), QtyLen, TextAlign.Center) + Gfunc.PrintStrAlign(num2.ToString(Gattr.PosSaleAmtPoint), CntLen, TextAlign.Right); list.Add(str8); list.Add(Gfunc.PrintStrAlign("==完==", Gattr.PrtLen, TextAlign.Center)); list2 = list; } catch (Exception exception) { throw exception; } return(list2); }