//点击搜索按钮 private void BaseButton_Search_Click(object sender, EventArgs e) { string memberId = skinTextBoxMemberId.Text; if (string.IsNullOrEmpty(memberId)) { GlobalMessageBox.Show("请先输入会员信息,再进行查询!"); return; } this.pagePara = new GetMemberBalanceChangePara() { StartDate = new Date(this.dateTimePicker_Start.Value), EndDate = new Date(this.dateTimePicker_End.Value), MemberID = memberId, }; InteractResult <List <MemberBalanceChange> > memberList = CommonGlobalCache.ServerProxy.GetMemberBalanceChange(this.pagePara); dataGridViewPagingSumCtrl.BindingDataSource <MemberBalanceChange>(DataGridViewUtil.ToDataTable(memberList.Data)); }
private void BuildPara() { string costumeID = string.IsNullOrEmpty(this.CostumeCurrentShopTextBox1.SkinTxt.Text.Trim()) ? null : this.CostumeCurrentShopTextBox1.SkinTxt.Text.Trim(); bool isOnlyShowHaveNegative = this.skinCheckBox1.Checked; string curBrandStr = ValidateUtil.CheckEmptyValue(this.skinComboBox_Brand.SelectedValue); int curBrandID = 0; if (curBrandStr == null) { curBrandID = 0; } curBrandID = Convert.ToInt32(curBrandStr); string curPfCustomerID = ""; if (skinComboBoxSupplier.SelectedValue != null) { curPfCustomerID = ValidateUtil.CheckEmptyValue(skinComboBoxSupplier.SelectedValue); } else { if (skinComboBoxSupplier.Text != "" && skinComboBoxSupplier.Text != "所有") { GlobalMessageBox.Show("请输入正确的客户信息后再进行查询!"); this.skinComboBoxSupplier.Focus(); return; } } this.pagePara = new GetPfCustomerStorePagePara() { CostumeID = costumeID, BrandID = curBrandID, PfCustomerID = curPfCustomerID, PageIndex = 0, PageSize = int.MaxValue,// this.dataGridViewPagingSumCtrl.PageSize, IsOnlyShowNotZero = isOnlyShowHaveNegative, }; }
private void Inbound(AllocateOrder allocateOrder) { if (allocateOrder.State != (byte)AllocateOrderState.Delivery) { GlobalMessageBox.Show("订单状态不是已发货,不能收货!"); return; } if (allocateOrder.DestShopID != CommonGlobalCache.CurrentShopID) { if (CommonGlobalCache.CurrentShopID != CommonGlobalCache.GeneralStoreShopID) { GlobalMessageBox.Show("本店铺不是收货店铺,不能收货!"); return; } } if (this.InboundClick != null) { this.skinSplitContainer1.Panel2Collapsed = false; this.InboundClick(allocateOrder.ID, this, this.skinSplitContainer1.Panel2); } }
private void DoExport() { try { List <CostumeStore> unableStore = new List <CostumeStore>(); List <CostumeStore> stores = new List <CostumeStore>(); List <CostumeStore> dt = DataGridViewUtil.BindingListToList <CostumeStore>(dataGridView1.DataSource); System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); foreach (DataGridViewColumn item in dataGridView1.Columns) { if (IsPos) { if (item.Index == CostPrice.Index || item.Index == SumCostMoney.Index) { continue; } } if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(dt), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void dataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > -1) { DataGridView grid = (DataGridView)sender; grid.Rows[e.RowIndex].ErrorText = ""; //增加了序号 if (e.ColumnIndex > 0 && e.ColumnIndex != Column4.Index && e.ColumnIndex != ColumnSetting.Index && e.ColumnIndex != ColumnSetting2.Index && e.ColumnIndex != Column2.Index) // if (e.ColumnIndex > 1) { Int32 newInteger = 0; if (!int.TryParse(e.FormattedValue.ToString(), out newInteger)) { e.Cancel = true; grid.Rows[e.RowIndex].ErrorText = "请输入整数"; GlobalMessageBox.Show("请输入整数!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } } // } }
private void Removed(PfCustomerRetailOrder item) { if (GlobalMessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { String id = item.ID; InteractResult result = GlobalCache.ServerProxy.DeletePfCustomerRetailOrder(id); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("删除成功!"); this.RefreshPage(); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } }
private void Cancel(AllocateOrder allocateOrder) { try { if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } InteractResult result = CommonGlobalCache.ServerProxy.OverrideAllocateOrder(allocateOrder.ID, CommonGlobalCache.CurrentUserID); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("冲单成功!"); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } this.RefreshPage(); } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void DoEnable(SizeGroup item) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } EnabledSizeGroupPara para = new EnabledSizeGroupPara() { SizeGroupName = item.SizeGroupName, Enabled = item.Enabled }; InteractResult result = CommonGlobalCache.ServerProxy.EnabledSizeGroup(para); switch (result.ExeResult) { case ExeResult.Success: break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); item.Enabled = !item.Enabled; dataGridView1.RefreshEdit(); break; default: break; } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void Removed(SizeGroup item) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } if (GlobalMessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { String sizeGroupName = item.SizeGroupName; InteractResult result = GlobalCache.ServerProxy.DeleteSizeGroup(sizeGroupName); switch (result.ExeResult) { case ExeResult.Success: GlobalCache.DeleteSizeGroup(sizeGroupName); RefreshPage(); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void Refund(ReplenishOrder item) { if (GlobalMessageBox.Show("是否确认拒绝该笔补货申请单?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } InteractResult result = CommonGlobalCache.ServerProxy.RefusedReplenishOrder(item.ID); switch (result.ExeResult) { case ExeResult.Success: item.State = (byte)ReplenishOrderState.Refused; GlobalMessageBox.Show("已拒绝!"); dataGridViewPagingSumCtrl_CurrentPageIndexChanged(pagePara.PageIndex); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } }
private void DoEnable(GiftTicket item) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } EnabledGiftTicketPara para = new EnabledGiftTicketPara() { Enabled = item.Enabled, ID = item.ID }; UpdateResult result = CommonGlobalCache.ServerProxy.EnabledGiftTicket(para); switch (result) { case UpdateResult.Success: break; case UpdateResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void Form_Confirm(MonthTask obj) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } curMonthTask = obj; UpdateMonthTaskResult result = CommonGlobalCache.ServerProxy.UpdateMonthTask(curMonthTask); switch (result) { case UpdateMonthTaskResult.Success: break; case UpdateMonthTaskResult.IsLessCurrentMonth: break; case UpdateMonthTaskResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
public void DoExport(string path, CheckStoreOrder checkStoreOrder) { try { // DataTable listtb1 = (dataGridView1.DataSource as DataTable); List <CheckStoreDetail> list = CommonGlobalCache.ServerProxy.GetCheckStoreDetail(checkStoreOrder.ID); foreach (CheckStoreDetail Sdetail in list) { Sdetail.CostumeName = CommonGlobalCache.GetCostumeName(Sdetail.CostumeID); } // List<BoundDetail> list = CommonGlobalCache.ServerProxy.GetOutboundDetail(curReturnOrder.OutboundOrderID); // System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); int ColNum = 0; foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { if (item.DataPropertyName != "FAtm" && item.DataPropertyName != "SAtm" && item.DataPropertyName != "MAtm" && item.DataPropertyName != "LAtm" && item.DataPropertyName != "XLAtm" && item.DataPropertyName != "XL2Atm" && item.DataPropertyName != "XL3Atm" && item.DataPropertyName != "XL4Atm" && item.DataPropertyName != "XL5Atm" && item.DataPropertyName != "XL6Atm" && item.DataPropertyName != "SumCountAtm" && item.DataPropertyName != "XSAtm" && item.Name != "sumCountDataGridViewTextBoxColumn" && item.DataPropertyName != "Price" && item.DataPropertyName != "SumCountWinLost" && item.DataPropertyName != "SumMoneyWinLost" ) { ColNum++; keys.Add(item.DataPropertyName); if (item.HeaderText == "XL2") { item.HeaderText = "2XL"; } if (item.HeaderText == "XL3") { item.HeaderText = "3XL"; } if (item.HeaderText == "XL4") { item.HeaderText = "4XL"; } if (item.HeaderText == "XL5") { item.HeaderText = "5XL"; } if (item.HeaderText == "XL6") { item.HeaderText = "6XL"; } values.Add(item.HeaderText); } } } foreach (CheckStoreDetail cItem in list) { // cItem.CostumeName = CommonGlobalCache.GetCostumeName(cItem.CostumeID); } List <CellType> cellList = new List <CellType>(); NPOIHelper.hsRowCount = 5; /* CellType curCellOrderTitle = new CellType(); * curCellOrderTitle.RowIndex = 0; * curCellOrderTitle.CellName = ":"; * if (ColNum % 2 == 0) * { * * curCellOrderTitle.CellMergeNum = ColNum / 2 - 1; * } * else * { * curCellOrderTitle.CellMergeNum = ColNum / 2; * } * // curCellOrderTitle.CellMergeNum = 10; * cellList.Add(curCellOrderTitle); */ CellType curCellOrderTitleValue = new CellType(); curCellOrderTitleValue.RowIndex = 0; curCellOrderTitleValue.CellName = "盘点单"; curCellOrderTitleValue.Title = true; curCellOrderTitleValue.CellMergeNum = ColNum; // curCellOrderTitleValue.CellMergeNum = 12; cellList.Add(curCellOrderTitleValue); CellType curCellOrder = new CellType(); curCellOrder.RowIndex = 1; curCellOrder.CellName = "单号:"; curCellOrder.CellMergeNum = 1; cellList.Add(curCellOrder); CellType curCellOrderValue = new CellType(); curCellOrderValue.RowIndex = 1; curCellOrderValue.CellName = checkStoreOrder.ID; curCellOrderValue.CellMergeNum = 2; cellList.Add(curCellOrderValue); CellType curCellCreaterUser = new CellType(); curCellCreaterUser.RowIndex = 1; curCellCreaterUser.CellName = "店铺"; curCellCreaterUser.CellMergeNum = 1; cellList.Add(curCellCreaterUser); CellType curCellCreaterUserValue = new CellType(); curCellCreaterUserValue.RowIndex = 1; curCellCreaterUserValue.CellName = checkStoreOrder.ShopName; curCellCreaterUserValue.CellMergeNum = 2; cellList.Add(curCellCreaterUserValue); CellType curCellTime = new CellType(); curCellTime.RowIndex = 2; curCellTime.CellName = "操作人"; curCellTime.CellMergeNum = 1; cellList.Add(curCellTime); CellType curCellTimeValue = new CellType(); curCellTimeValue.RowIndex = 2; curCellTimeValue.CellName = checkStoreOrder.OperatorUserName; curCellTimeValue.CellMergeNum = 2; cellList.Add(curCellTimeValue); CellType curCellSource = new CellType(); curCellSource.RowIndex = 2; curCellSource.CellName = "审核人:"; curCellSource.CellMergeNum = 1; cellList.Add(curCellSource); CellType curCellSourceValue = new CellType(); curCellSourceValue.RowIndex = 2; curCellSourceValue.CellName = checkStoreOrder.CheckUserName; curCellSourceValue.CellMergeNum = 2; cellList.Add(curCellSourceValue); CellType curCellTarget = new CellType(); curCellTarget.RowIndex = 3; curCellTarget.CellName = "盘点时间:"; curCellTarget.CellMergeNum = 1; cellList.Add(curCellTarget); CellType curCellTargetValue = new CellType(); curCellTargetValue.RowIndex = 3; curCellTargetValue.CellName = checkStoreOrder.CreateTime.GetDateTimeFormats('f')[0].ToString();; curCellTargetValue.CellMergeNum = 2; cellList.Add(curCellTargetValue); CellType curCellTotal = new CellType(); curCellTotal.RowIndex = 3; curCellTotal.CellName = "审核时间:"; curCellTotal.CellMergeNum = 1; cellList.Add(curCellTotal); CellType curCellTotalValue = new CellType(); curCellTotalValue.RowIndex = 3; curCellTotalValue.CellName = checkStoreOrder.CheckTime.GetDateTimeFormats('f')[0].ToString();; curCellTotalValue.CellMergeNum = 2; cellList.Add(curCellTotalValue); CellType curCellRemark = new CellType(); curCellRemark.RowIndex = 4; curCellRemark.CellName = "备注:"; curCellRemark.CellMergeNum = 1; cellList.Add(curCellRemark); CellType curCellRemarkValue = new CellType(); curCellRemarkValue.RowIndex = 4; curCellRemarkValue.CellName = checkStoreOrder.Remarks.ToString(); curCellRemarkValue.CellMergeNum = 8; cellList.Add(curCellRemarkValue); NPOIHelper.CellValues = cellList; NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void btn_Save_Click(object sender, EventArgs e) { try { string MemId = this.skinTextBox_ID.Text; if (string.IsNullOrEmpty(MemId)) { GlobalMessageBox.Show("卡号不能为空!"); return; } //^[0-9A-Za-z_]+$ string matchID = "^[0-9A-Za-z]+$"; bool isMemberID = Regex.IsMatch(MemId, matchID); if (!isMemberID) { GlobalMessageBox.Show("卡号格式不正确,卡号只能含数字或英文字母!"); return; } string phoneNumber = this.txttel.Text; if (string.IsNullOrEmpty(phoneNumber)) { GlobalMessageBox.Show("手机号不能为空!"); return; } string match = "^((1[3,5,8][0-9])|(14[5,7])|(17[0,6,7,8])|(19[7]))\\d{8}$"; bool isPhoneNumber = Regex.IsMatch(phoneNumber, match); if (!isPhoneNumber) { GlobalMessageBox.Show("手机号码格式不正确!"); return; } string name = this.skinTextBox_Name.Text; if (string.IsNullOrEmpty(name)) { GlobalMessageBox.Show("姓名不能为空!"); return; } //if (!isOnline && (String.IsNullOrEmpty(this.guideID) || "-1".Equals(this.guideID))) //{ // GlobalMessageBox.Show("操作人不能为空!"); // return; //} if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } //string cintegration = this.skinTextBox_CurrentIntegration.Text; if (this._member != null) { UpdateMemberResult result = this.UpdateMember(); if (result == UpdateMemberResult.Error) { GlobalMessageBox.Show("内部错误!"); } else if (result == UpdateMemberResult.IsNotExist) { GlobalMessageBox.Show("会员卡号不存在!"); } else if (result == UpdateMemberResult.Success) { TreeModel treeN = new TreeModel(); treeN.ID = _member.PhoneNumber; treeN.Name = _member.Name; CommonGlobalCache.UpdateDistributor(treeN); GlobalMessageBox.Show("修改成功!", "提示", MessageBoxButtons.OK); this.TabPageClose(this.CurrentTabPage, this.SourceCtrlType); } } else { InteractResult result = this.AddMember(); if (result.ExeResult == ExeResult.Success) { //TreeModel treeN = new TreeModel(); //treeN.ID = member.PhoneNumber; //treeN.ParentID = member.IntroducerName; //treeN.Name = member.Name; //CommonGlobalCache.InsertDistributor(treeN); CommonGlobalCache.DistributorList.Clear(); GlobalMessageBox.Show("开卡成功!", "提示", MessageBoxButtons.OK); // member this.TabPageClose(this.CurrentTabPage, this.SourceCtrlType); } else { GlobalMessageBox.Show(result.Msg); } //if (result == RegisterMemberResult.Error) //{ // GlobalMessageBox.Show("内部错误!"); //} //else if (result == RegisterMemberResult.Exist) //{ // GlobalMessageBox.Show("会员卡号已存在!"); //} //else if (result == RegisterMemberResult.Success) //{ // GlobalMessageBox.Show("开卡成功!", "提示", MessageBoxButtons.OK); // this.TabPageClose(this.CurrentTabPage, this); //} } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void BaseButton1_Click(object sender, EventArgs e) { try { if (this.guideComboBox1.Visible && this.guideComboBox1.SelectedIndex == 0) { GlobalMessageBox.Show("操作人不能为空"); return; } if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } DifferenceOrderConfirmedResult result = CommonGlobalCache.ServerProxy.DifferenceOrderConfirmed(new DifferenceOrderConfirmedPara() { DifferenceOrderID = this.curDifferenceOrder.ID, ConfirmUserID = IsPos ? ValidateUtil.CheckEmptyValue(this.guideComboBox1.SelectedValue) : CommonGlobalCache.CurrentUserID }); switch (result) { case DifferenceOrderConfirmedResult.Success: GlobalMessageBox.Show("确认成功!"); if (IsPos) { this.guideComboBox1.Visible = false; this.skinLabel_operator.Text = "操作人:" + ((Guide)this.guideComboBox1.SelectedItem).Name; } else { this.skinLabel_operator.Text = "操作人:" + CommonGlobalCache.GetUserName(CommonGlobalCache.CurrentUser.ID); } this.BaseButtonCancel.Visible = false; this.baseButtonConfirm.Visible = false; WorkDesk_Refresh?.Invoke(false, null); this.RefreshPageAction?.Invoke(this.CurrentTabPage, this.SourceCtrlType); break; case DifferenceOrderConfirmedResult.SourceOrderIDIsError: GlobalMessageBox.Show("不是盘点,补货申请或者调拨!"); break; case DifferenceOrderConfirmedResult.IsConfirmed: GlobalMessageBox.Show("本单已被确认!"); break; case DifferenceOrderConfirmedResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } List <CheckStoreOrder> list = (List <CheckStoreOrder>) this.dataGridView1.DataSource; CheckStoreOrder checkStoreOrder = list[e.RowIndex]; if (e.ColumnIndex == iDDataGridViewTextBoxColumn.Index) { if (currentCheckStoreOrder != checkStoreOrder) { currentCheckStoreOrder = checkStoreOrder; SelectionChanged(checkStoreOrder); } if (checkStoreOrder == null || String.IsNullOrEmpty(checkStoreOrder.ID)) { return; } } else if (e.ColumnIndex == ColumnEdit.Index) { this.UpdateCheckStoreOrderClick?.Invoke(checkStoreOrder, this); } else if (e.ColumnIndex == ColumnDelete.Index) { try { //删除 if (GlobalMessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } DeleteCheckStoreResult result = CommonGlobalCache.ServerProxy.DeleteCheckStore(checkStoreOrder.ID); switch (result) { case DeleteCheckStoreResult.Success: GlobalMessageBox.Show("删除成功!"); //含统计信息,从刷界面 dataGridViewPagingSumCtrl_CurrentPageIndexChanged(this.pagePara.PageIndex); break; case DeleteCheckStoreResult.StateIsPendingReviewOrApproved: GlobalMessageBox.Show("状态是待审核或已审核,不能删除"); break; case DeleteCheckStoreResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } } else if (ColumnCancel.Index == e.ColumnIndex) { this.Cancel(checkStoreOrder); } else if (ColumnRedo.Index == e.ColumnIndex) { this.Redo(checkStoreOrder); } else if (e.ColumnIndex == ColumnPrint.Index) { //打印 if (currentCheckStoreOrder != checkStoreOrder) { currentCheckStoreOrder = checkStoreOrder; SelectionChanged(checkStoreOrder); } if (checkStoreOrder == null || String.IsNullOrEmpty(checkStoreOrder.ID)) { return; } checkStoreDetailCtrl1?.Print(); } else if (e.ColumnIndex == Column1.Index) { //导出 path = CJBasic.Helpers.FileHelper.GetPathToSave("保存文件", "盘点单" + checkStoreOrder.ID + new Date(DateTime.Now).ToDateInteger() + ".xls", Environment.GetFolderPath(Environment.SpecialFolder.Personal)); if (String.IsNullOrEmpty(path)) { return; } // this.CheckStoreDetailExcept?.Invoke(checkStoreOrder, this, path); checkStoreDetailCtrl1?.DoExport(path, checkStoreOrder); } }
//点击入库按钮 private void BaseButton_Inbound_Click(object sender, EventArgs e) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } /* if (this.guideComboBox1.SelectedIndex == 0 && IsPos) * { * GlobalMessageBox.Show("操作人不能为空"); * return; * } */ /* foreach (BoundDetail detail in this.curOutbound.OutboundDetails) * { * // detail.IsConfirmed = true; * if (!detail.IsConfirmed) * { * DialogResult dialogResult= GlobalMessageBox.Show("您有商品未确认完全,是否确认收货?", "提示", MessageBoxButtons.OKCancel); * if (dialogResult != DialogResult.OK) * { * return; * } * break; * } * * }*/ InboundPara inboundPara = this.BuildInboundPara(); if (inboundPara == null || inboundPara.InboundOrder.TotalCount == 0) { GlobalMessageBox.Show("入库单为空,不能入库!"); return; } InboundResult result = CommonGlobalCache.ServerProxy.Inbound(inboundPara); if (result == InboundResult.Error) { GlobalMessageBox.Show("内部错误!"); return; } else if (result == InboundResult.StateIsNotDelivery) { GlobalMessageBox.Show("款号已存在!"); return; } GlobalMessageBox.Show("收货成功!"); // pos端确认后结束,在调拨入库时候 this.BaseButton_Save.Visible = false; this.guideComboBox1.Visible = false; this.skinLabel2.Visible = false; //pos使用 this.SaveSuccess(); } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void BaseButton_OK_Click(object sender, EventArgs e) { RechargeResult result = RechargeResult.Error; try { /* if (this.guideComboBox1.SelectedIndex == 0) * { * GlobalMessageBox.Show("操作人不能为空"); * return; * }*/ if (this.member == null) { GlobalMessageBox.Show("充值会员不能为空!"); return; } //if (this.member.CardType != 1) //{ // GlobalMessageBox.Show("该会员不是充值卡会员!"); // return; //} // int rechargeMoney = int.Parse(this.skinTextBox_RechargeMoney.SkinTxt.Text); int moneyCash = Decimal.ToInt32(this.skinTextBox_MoneyCash.Value); int moneyBankCard = Decimal.ToInt32(this.skinTextBox_MoneyBankCard.Value); int moneyAlipay = Decimal.ToInt32(this.skinTextBox_MoneyAlipay.Value); int moneyWeiXin = Decimal.ToInt32(this.skinTextBox_MoneyWeiXin.Value); int rechargeMoney = moneyCash + moneyBankCard + moneyAlipay + moneyWeiXin; if (rechargeMoney <= 0) { GlobalMessageBox.Show("充值金额应为正整数,充值失败"); return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } int donateMoney = int.Parse(this.skinLabel_GiveMoney.Text); decimal balanceNew = this.member.Balance + donateMoney + rechargeMoney; result = CommonGlobalCache.ServerProxy.Recharge(new RechargeRecord() { ID = IDHelper.GetID(OrderPrefix.RechargeRecordOrder, shop.AutoCode), BalanceOld = this.member.Balance, BalanceNew = balanceNew, DonateMoney = donateMoney, MemberID = this.member.PhoneNumber, GuideID = this.guideID, MoneyAlipay = moneyAlipay, MoneyBankCard = moneyBankCard, MoneyCash = moneyCash, MoneyWeiXin = moneyWeiXin, RechargeMoney = rechargeMoney, CreateTime = DateTime.Now, Remarks = this.skinTextBox_Remark.Text, MemberName = this.member.Name, ShopID = shop.ID } ); UnLockPage(); switch (result) { case RechargeResult.Success: RechargeDialogForm form = new RechargeDialogForm(member, rechargeMoney, donateMoney, balanceNew); if (form.ShowDialog() == DialogResult.OK) { } this.member = CommonGlobalCache.ServerProxy.GetOneMember(this.member.PhoneNumber); this.SetMemberLabel(); this.CleanRechargeTextBox(); //20180616充值完成自动关闭! // if (isClose) { //只给POS端收银充值用 TabPageClose(this.CurrentTabPage, this); break; case RechargeResult.MemberIsNotExist: GlobalMessageBox.Show("会员不存在!"); break; case RechargeResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ee) { WriteLog(ee); } finally { UnLockPage(); } }
private void DoExport() { try { DataTable list = null; List <String> keys = new List <string>(); List <String> values = new List <string>(); if (this.skinTextBox_costumeID.SkinTxt.Text.Trim() != "" && ValidateUtil.CheckEmptyValue(this.skinComboBox_PfCustomer.SelectedValue) == "") { var dt = new DataTable(typeof(PfCustomerInvoicing).Name); foreach (DataGridViewColumn p in view.Columns) { if (!p.DataPropertyName.Contains("PfCustomerID")) { keys.Add(p.DataPropertyName); if (p.DataPropertyName == "Delivery" || p.DataPropertyName == "Retail" || p.DataPropertyName == "PfCustomerStore") { values.Add("小计" + p.HeaderText); } else if ((p.DataPropertyName.Contains("Delivery") && p.DataPropertyName != "Delivery") || (p.DataPropertyName.Contains("Retail") && p.DataPropertyName != "Retail") || p.DataPropertyName.Contains("PfCustomerStore") && p.DataPropertyName != "PfCustomerStore") { /* int CurColumnindex = -1; * if (p.DataPropertyName.Contains("Delivery")) * { * CurColumnindex= p.Index + 1; * }*/ DataTable curdt = p.DataGridView.DataSource as DataTable; string pfcustomerId = curdt.Rows[0]["PfCustomerID" + p.DataPropertyName.Replace("PfCustomerStore", "").Replace("Retail", "").Replace("Delivery", "")].ToString(); if (pfcustomerId == "0") { for (int i = 0; i < curdt.Rows.Count; i++) { if (curdt.Rows[i]["PfCustomerID" + p.DataPropertyName.Replace("PfCustomerStore", "").Replace("Retail", "").Replace("Delivery", "")].ToString() != "0") { pfcustomerId = curdt.Rows[i]["PfCustomerID" + p.DataPropertyName.Replace("PfCustomerStore", "").Replace("Retail", "").Replace("Delivery", "")].ToString(); break; } } } string CName = PfCustomerCache.PfCustomerList.Find(t => t.ID.Equals(pfcustomerId)).Name; values.Add(CName + p.HeaderText); } else { values.Add(p.HeaderText); } } } list = (DataTable)view.DataSource; } else { if (dataGridView1.DataSource != null && dataGridView1.Rows.Count > 0) { list = (DataTable)this.dataGridView1.DataSource; foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } } NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(list, path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void Export(AllocateOrder order) { try { List <BoundDetail> list = CommonGlobalCache.ServerProxy.GetOutboundDetail(order.OutboundOrderID); // System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); int ColNum = 0; foreach (DataGridViewColumn item in dataGridView2.Columns) { if (item.Visible && item.Name != "sumCostDataGridViewTextBoxColumn") { ColNum++; keys.Add(item.DataPropertyName); if (item.HeaderText == "XL2") { item.HeaderText = "2XL"; } if (item.HeaderText == "XL3") { item.HeaderText = "3XL"; } if (item.HeaderText == "XL4") { item.HeaderText = "4XL"; } if (item.HeaderText == "XL5") { item.HeaderText = "5XL"; } if (item.HeaderText == "XL6") { item.HeaderText = "6XL"; } values.Add(item.HeaderText); } } foreach (BoundDetail cItem in list) { cItem.CostumeName = CommonGlobalCache.GetCostumeName(cItem.CostumeID); } List <CellType> cellList = new List <CellType>(); NPOIHelper.hsRowCount = 4; /* CellType curCellI = new CellType(); * curCellI.RowIndex = 0; * curCellI.CellName = ""; * if (ColNum % 2 == 0) * { * * curCellI.CellMergeNum = ColNum / 2 - 1; * } * else * { * curCellI.CellMergeNum = ColNum / 2; * } * cellList.Add(curCellI);*/ CellType curCell = new CellType(); curCell.RowIndex = 0; curCell.CellName = "调拨单"; curCell.Title = true; curCell.CellMergeNum = ColNum; // curCell.CellMergeIndex = 12; cellList.Add(curCell); CellType curCellOrder = new CellType(); curCellOrder.RowIndex = 1; curCellOrder.CellName = "单号:"; curCellOrder.CellMergeNum = 1; cellList.Add(curCellOrder); CellType curCellOrderValue = new CellType(); curCellOrderValue.RowIndex = 1; curCellOrderValue.CellName = order.ID; curCellOrderValue.CellMergeNum = 2; cellList.Add(curCellOrderValue); CellType curCellCreaterUser = new CellType(); curCellCreaterUser.RowIndex = 1; curCellCreaterUser.CellName = "开单员"; curCellCreaterUser.CellMergeNum = 1; cellList.Add(curCellCreaterUser); CellType curCellCreaterUserValue = new CellType(); curCellCreaterUserValue.RowIndex = 1; curCellCreaterUserValue.CellName = order.OperatorName; curCellCreaterUserValue.CellMergeNum = 2; cellList.Add(curCellCreaterUserValue); CellType curCellTime = new CellType(); curCellTime.RowIndex = 1; curCellTime.CellName = "开单时间"; curCellTime.CellMergeNum = 1; cellList.Add(curCellTime); CellType curCellTimeValue = new CellType(); curCellTimeValue.RowIndex = 1; curCellTimeValue.CellName = order.CreateTime.GetDateTimeFormats('f')[0].ToString();; curCellTimeValue.CellMergeNum = 2; cellList.Add(curCellTimeValue); CellType curCellSource = new CellType(); curCellSource.RowIndex = 2; curCellSource.CellName = "发货方:"; curCellSource.CellMergeNum = 1; cellList.Add(curCellSource); CellType curCellSourceValue = new CellType(); curCellSourceValue.RowIndex = 2; curCellSourceValue.CellName = order.SourceShopName; curCellSourceValue.CellMergeNum = 2; cellList.Add(curCellSourceValue); CellType curCellTarget = new CellType(); curCellTarget.RowIndex = 2; curCellTarget.CellName = "收货方:"; curCellTarget.CellMergeNum = 1; cellList.Add(curCellTarget); CellType curCellTargetValue = new CellType(); curCellTargetValue.RowIndex = 2; curCellTargetValue.CellName = order.DestShopName; curCellTargetValue.CellMergeNum = 2; cellList.Add(curCellTargetValue); CellType curCellTotal = new CellType(); curCellTotal.RowIndex = 2; curCellTotal.CellName = "总数量:"; curCellTotal.CellMergeNum = 1; cellList.Add(curCellTotal); CellType curCellTotalValue = new CellType(); curCellTotalValue.RowIndex = 2; curCellTotalValue.CellName = order.TotalCount.ToString(); curCellTotalValue.CellMergeNum = 2; cellList.Add(curCellTotalValue); CellType curCellBalance = new CellType(); curCellBalance.RowIndex = 2; curCellBalance.CellName = "总金额:"; curCellBalance.CellMergeNum = 1; cellList.Add(curCellBalance); CellType curCellBalanceValue = new CellType(); curCellBalanceValue.RowIndex = 2; curCellBalanceValue.CellName = order.TotalPrice.ToString(); curCellBalanceValue.CellMergeNum = 2; cellList.Add(curCellBalanceValue); CellType curCellRemark = new CellType(); curCellRemark.RowIndex = 3; curCellRemark.CellName = "备注:"; curCellRemark.CellMergeNum = 1; cellList.Add(curCellRemark); CellType curCellRemarkValue = new CellType(); curCellRemarkValue.RowIndex = 3; curCellRemarkValue.CellName = order.Remarks; curCellRemarkValue.CellMergeNum = 10; cellList.Add(curCellRemarkValue); NPOIHelper.CellValues = cellList; NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void dataGridView_MonthTask_CellValueChanged(object sender, DataGridViewCellEventArgs e) { DataGridView view = sender as DataGridView; if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } //当前更改的列 DataGridViewCell cell = view.CurrentCell; //当前绑定数据 MonthTaskSearch item = cell.OwningRow.DataBoundItem as MonthTaskSearch; MonthTask task = item.MonthTasks[e.ColumnIndex - 1]; task.ShopID = item.Shop.ID; int monthIndex = e.ColumnIndex; switch (monthIndex) {//增加了序号 case 1: task.MoneyOfSale = Decimal.ToInt32(item.Target1); task.AutoID = item.AutoID1; break; case 2: task.MoneyOfSale = Decimal.ToInt32(item.Target2); task.AutoID = item.AutoID2; break; case 3: task.MoneyOfSale = Decimal.ToInt32(item.Target3); task.AutoID = item.AutoID3; break; case 4: task.MoneyOfSale = Decimal.ToInt32(item.Target4); task.AutoID = item.AutoID4; break; case 5: task.MoneyOfSale = Decimal.ToInt32(item.Target5); task.AutoID = item.AutoID5; break; case 6: task.MoneyOfSale = Decimal.ToInt32(item.Target6); task.AutoID = item.AutoID6; break; case 7: task.MoneyOfSale = Decimal.ToInt32(item.Target7); task.AutoID = item.AutoID7; break; case 8: task.MoneyOfSale = Decimal.ToInt32(item.Target8); task.AutoID = item.AutoID8; break; case 9: task.MoneyOfSale = Decimal.ToInt32(item.Target9); task.AutoID = item.AutoID9; break; case 10: task.MoneyOfSale = Decimal.ToInt32(item.Target10); task.AutoID = item.AutoID10; break; case 11: task.MoneyOfSale = Decimal.ToInt32(item.Target11); task.AutoID = item.AutoID11; break; case 12: task.MoneyOfSale = Decimal.ToInt32(item.Target12); task.AutoID = item.AutoID12; break; default: break; } //if (task.MoneyOfSale == 0) { // GlobalMessageBox.Show(this.FindForm(), "不能设置为0!"); // dataGridView_RefundDetail.CellValueChanged -= dataGridView_RefundDetail_CellValueChanged; // dataGridView_MonthTask.CellValueChanged -= dataGridView_MonthTask_CellValueChanged; // view.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = clickValue; // view.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true; // dataGridView_RefundDetail.CellValueChanged += dataGridView_RefundDetail_CellValueChanged; // dataGridView_MonthTask.CellValueChanged += dataGridView_MonthTask_CellValueChanged; // //view.CancelEdit(); // //view.RefreshEdit(); view.Refresh(); // return; //} task.Month = item.Year * 100 + monthIndex; task.GuideID = ""; UpdateMonthTaskResult result = CommonGlobalCache.ServerProxy.UpdateMonthTask(task); switch (result) { case UpdateMonthTaskResult.Success: //平摊 AvgDetail(task); break; case UpdateMonthTaskResult.IsLessCurrentMonth: view.CancelEdit(); break; case UpdateMonthTaskResult.Error: view.CancelEdit(); GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void Export(RetailOrder retailOrder) { // RefundOrderPrintUtil printHelper = new RefundOrderPrintUtil(); // List<RetailDetail> retailDetailList = CommonGlobalCache.ServerProxy.GetRetailDetailList(retailOrder.ID); //foreach (var item in retailDetailList) //{ // Costume costume = CommonGlobalCache.GetCostume(item.CostumeID); // // 显示自己设置的尺码组和对应的尺码列表 // item.SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(item.SizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName)); //} try { List <RetailDetail> retailDetailList = CommonGlobalCache.ServerProxy.GetRetailDetailList(retailOrder.ID); // System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); keys.Add("BusinessTime"); values.Add("业务日期"); keys.Add("SaleBillID"); values.Add("销售单号"); keys.Add("GuidId"); values.Add("整单导购员"); keys.Add("Shop"); values.Add("店铺"); keys.Add("VIPCard"); values.Add("VIP卡号"); keys.Add("VIPName"); values.Add("VIP姓名"); foreach (DataGridViewColumn item in dataGridView_RetailDetail.Columns) { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } foreach (RetailDetail cItem in retailDetailList) { //cItem.CostumeName = CommonGlobalCache.GetCostumeName(cItem.CostumeID); Costume costume = CommonGlobalCache.GetCostume(cItem.CostumeID); cItem.CostumeName = costume.Name; cItem.SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(cItem.SizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName)); } /* List<CellType> cellList = new List<CellType>(); * NPOIHelper.hsRowCount = 4; * * * CellType curCellI = new CellType(); * curCellI.RowIndex = 0; * curCellI.CellName = ""; * if (ColNum % 2 == 0) * { * * curCellI.CellMergeNum = ColNum / 2 - 1; * } * else * { * curCellI.CellMergeNum = ColNum / 2; * } * cellList.Add(curCellI); * * * * CellType curCell = new CellType(); * curCell.RowIndex = 0; * curCell.CellName = retailOrder.ShopName; * if (ColNum % 2 == 0) * { * curCell.CellMergeNum = ColNum - (ColNum / 2) + 1; * } * else * { * curCell.CellMergeNum = ColNum - (ColNum / 2); * } * // curCell.CellMergeIndex = 12; * cellList.Add(curCell); * * CellType curCellOrder = new CellType(); * curCellOrder.RowIndex = 1; * curCellOrder.CellName = "单号:"; * curCellOrder.CellMergeNum = 1; * cellList.Add(curCellOrder); * * * * CellType curCellOrderValue = new CellType(); * curCellOrderValue.RowIndex = 1; * curCellOrderValue.CellName = retailOrder.ID; * curCellOrderValue.CellMergeNum = 2; * cellList.Add(curCellOrderValue); * * CellType curCellCreaterUser = new CellType(); * curCellCreaterUser.RowIndex = 1; * curCellCreaterUser.CellName = "日期"; * curCellCreaterUser.CellMergeNum = 1; * cellList.Add(curCellCreaterUser); * * CellType curCellCreaterUserValue = new CellType(); * curCellCreaterUserValue.RowIndex = 1; * curCellCreaterUserValue.CellName = retailOrder.CreateTime.GetDateTimeFormats('f')[0].ToString(); * curCellCreaterUserValue.CellMergeNum = 2; * cellList.Add(curCellCreaterUserValue); * * * * CellType curCellTime = new CellType(); * curCellTime.RowIndex = 2; * curCellTime.CellName = "电话"; * curCellTime.CellMergeNum = 1; * cellList.Add(curCellTime); * * CellType curCellTimeValue = new CellType(); * curCellTimeValue.RowIndex =2; * curCellTimeValue.CellName = CommonGlobalCache.CurrentShop?.PhoneNumber; * curCellTimeValue.CellMergeNum = 2; * cellList.Add(curCellTimeValue); * * * * CellType curCellSource = new CellType(); * curCellSource.RowIndex = 2; * curCellSource.CellName = "地址:"; * curCellSource.CellMergeNum = 1; * cellList.Add(curCellSource); * * * * CellType curCellSourceValue = new CellType(); * curCellSourceValue.RowIndex = 2; * curCellSourceValue.CellName = CommonGlobalCache.CurrentShop?.Address; * curCellSourceValue.CellMergeNum = 2; * cellList.Add(curCellSourceValue); * * * CellType curCellTarget = new CellType(); * curCellTarget.RowIndex = 3; * curCellTarget.CellName = "顾问:"; * curCellTarget.CellMergeNum = 1; * cellList.Add(curCellTarget); * * * * CellType curCellTargetValue = new CellType(); * curCellTargetValue.RowIndex = 3; * curCellTargetValue.CellName = CommonGlobalCache.GetUserName(retailOrder.GuideID); * curCellTargetValue.CellMergeNum = 2; * cellList.Add(curCellTargetValue); * * * NPOIHelper.CellValues = cellList;*/ DataTable dt = DataGridViewUtil.ToDataTable(retailDetailList); dt.Columns.Add("BusinessTime"); dt.Columns.Add("SaleBillID"); dt.Columns.Add("GuidId"); dt.Columns.Add("Shop"); dt.Columns.Add("VIPCard"); dt.Columns.Add("VIPName"); foreach (DataRow dr in dt.Rows) { dr["BusinessTime"] = retailOrder.EntryTime.GetDateTimeFormats('f')[0].ToString(); dr["SaleBillID"] = retailOrder.ID; dr["GuidId"] = retailOrder.GuideName; dr["Shop"] = retailOrder.ShopName; dr["VIPCard"] = retailOrder.MemeberID; dr["VIPName"] = retailOrder.MemeberID != null && retailOrder.MemeberID != "" ? CommonGlobalCache.ServerProxy.GetOneMember(retailOrder.MemeberID).Name:""; } List <CellType> cellList = new List <CellType>(); NPOIHelper.bottomHsRowCount = 1; CellType curCellIT = new CellType(); curCellIT.RowIndex = dt.Rows.Count + 1; curCellIT.CellName = "汇总:"; curCellIT.IsCollect = true; curCellIT.CellMergeNum = 1; cellList.Add(curCellIT); for (int k = 0; k < 11; k++) { CellType curCellI = new CellType(); curCellI.RowIndex = dt.Rows.Count + 1; curCellI.CellName = ""; curCellI.CellMergeNum = 1; cellList.Add(curCellI); } CellType curCellTotal = new CellType(); curCellTotal.RowIndex = dt.Rows.Count + 1;//1是要多加一行标题列 curCellTotal.CellName = retailOrder.TotalCount.ToString(); curCellTotal.IsCollect = true; curCellTotal.CellMergeNum = 1; cellList.Add(curCellTotal); CellType curCellTotalPrice = new CellType(); curCellTotalPrice.RowIndex = dt.Rows.Count + 1; curCellTotalPrice.CellName = retailOrder.TotalMoneyReceived.ToString(); curCellTotalPrice.CellMergeNum = 1; curCellTotalPrice.IsCollect = true; cellList.Add(curCellTotalPrice); NPOIHelper.BottomCellValues = cellList; NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(dt, path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
//当单元格中的金额或折扣值发生变化时,对应修改另一项的值 private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > -1) { try { RetailDetail detail = this.retailDetailList[e.RowIndex]; if (e.ColumnIndex == GuideName.Index) { detail.GuideID = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); } switch (this.dataGridView1.Columns[e.ColumnIndex].HeaderText) { case "折扣": if (balanceRound) { detail.SumMoney = detail.RefundCount * Math.Round(detail.Price * detail.Discount * (decimal)0.01, MidpointRounding.AwayFromZero); detail.SumMoneyActual = detail.SumMoney; } else { detail.SumMoney = detail.Price * detail.Discount * detail.RefundCount * (decimal)0.01; detail.SumMoneyActual = detail.SumMoney; } break; case "金额": detail.Discount = (Math.Round((detail.SumMoney * 100) / (detail.Price * detail.RefundCount), 1, MidpointRounding.AwayFromZero)); break; case "数量": if (balanceRound) { detail.SumMoney = detail.RefundCount * Math.Round(detail.Price * detail.Discount * (decimal)0.01, MidpointRounding.AwayFromZero); detail.SumMoneyActual = detail.SumMoney; } else { detail.SumMoney = detail.Price * detail.Discount * detail.RefundCount * (decimal)0.01; detail.SumMoneyActual = detail.SumMoney; } //268 畅滞排行榜:商品退货后,零售金额变成0 detail.SumCost = detail.CostPrice * detail.RefundCount; break; case "使用优惠券": detail.IsUseTickets = (bool)this.dataGridView1[e.ColumnIndex, e.RowIndex].Value; break; } this.dataGridView1.Refresh(); } catch (Exception ex) { GlobalUtil.WriteLog(ex); GlobalMessageBox.Show("内部错误,金额与折扣转化出错!"); } } }
private void BaseButton_OK_Click(object sender, EventArgs e) { // RechargeResult result = RechargeResult.Error; try { /* if (this.guideComboBox1.SelectedIndex == 0) * { * GlobalMessageBox.Show("操作人不能为空"); * return; * }*/ /* if (this.member == null) * { * GlobalMessageBox.Show("充值会员不能为空!"); * return; * }*/ //if (this.member.CardType != 1) //{ // GlobalMessageBox.Show("该会员不是充值卡会员!"); // return; //} // int rechargeMoney = int.Parse(this.skinTextBox_RechargeMoney.SkinTxt.Text); int moneyCash = Decimal.ToInt32(this.skinTextBox_MoneyCash.Value); int moneyBankCard = Decimal.ToInt32(this.skinTextBox_MoneyBankCard.Value); int moneyAlipay = Decimal.ToInt32(this.skinTextBox_MoneyAlipay.Value); int moneyWeiXin = Decimal.ToInt32(this.skinTextBox_MoneyWeiXin.Value); int rechargeMoney = moneyCash + moneyBankCard + moneyAlipay + moneyWeiXin; decimal donateM = Decimal.ToInt32(numericTextBox1.Value); string remarks = this.skinTextBox_Remark.Text; if (rechargeMoney <= 0) { GlobalMessageBox.Show("充值金额应为正整数,充值失败"); return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } int donateMoney = 0; //= int.Parse(this.skinLabel_GiveMoney.Text); // decimal balanceNew = this.member.Balance + donateMoney + rechargeMoney; InteractResult result = CommonGlobalCache.ServerProxy.UpdateRechargeRecord(new UpdateRechargeRecordPara() { ID = curRechargeRecord.ID, DonateMoney = donateM, MoneyAlipay = moneyAlipay, MoneyBankCard = moneyBankCard, MoneyCash = moneyCash, MoneyWeiXin = moneyWeiXin, Remarks = remarks, }); UnLockPage(); switch (result.ExeResult) { case ExeResult.Success: // RechargeDialogForm form = new RechargeDialogForm(member, rechargeMoney, donateMoney, balanceNew); /* if (form.ShowDialog() == DialogResult.OK) * { * * }*/ GlobalMessageBox.Show("修改成功!"); this.DialogResult = DialogResult.OK; // this.ParentForm.Refresh(); // this.Close(); // this.member = CommonGlobalCache.ServerProxy.GetOneMember(this.member.PhoneNumber); /* this.SetMemberLabel(); * this.CleanRechargeTextBox();*/ //20180616充值完成自动关闭! // if (isClose) { //只给POS端收银充值用 /* TabPageClose(this.CurrentTabPage, this);*/ break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } catch (Exception ee) { WriteLog(ee); } finally { UnLockPage(); } }
public void DoExport(string path) { try { // DataTable listtb1 = (dataGridView1.DataSource as DataTable); List <BoundDetail> list = CommonGlobalCache.ServerProxy.GetOutboundDetail(this.curReturnOrder.InboundOrderID); // List<BoundDetail> list = CommonGlobalCache.ServerProxy.GetOutboundDetail(curReturnOrder.OutboundOrderID); // System.Collections.SortedList columns = new System.Collections.SortedList(); List <String> keys = new List <string>(); List <String> values = new List <string>(); int ColNum = 0; foreach (DataGridViewColumn item in dataGridView1.Columns) { if (item.Visible) { ColNum++; keys.Add(item.DataPropertyName); if (item.HeaderText == "XL2") { item.HeaderText = "2XL"; } if (item.HeaderText == "XL3") { item.HeaderText = "3XL"; } if (item.HeaderText == "XL4") { item.HeaderText = "4XL"; } if (item.HeaderText == "XL5") { item.HeaderText = "5XL"; } if (item.HeaderText == "XL6") { item.HeaderText = "6XL"; } values.Add(item.HeaderText); } } foreach (BoundDetail cItem in list) { cItem.CostumeName = CommonGlobalCache.GetCostumeName(cItem.CostumeID); } List <CellType> cellList = new List <CellType>(); NPOIHelper.hsRowCount = 5; /* CellType curCellI = new CellType(); * curCellI.RowIndex = 0; * curCellI.CellName = ""; * if (ColNum % 2 == 0) * { * * curCellI.CellMergeNum = ColNum / 2 - 1; * } * else * { * curCellI.CellMergeNum = ColNum / 2; * } * * cellList.Add(curCellI); */ CellType curCell = new CellType(); curCell.RowIndex = 0; if (curReturnOrder.ID.StartsWith("U")) { curCell.CellName = "采购退货单"; } else if (curReturnOrder.ID.StartsWith("A")) { curCell.CellName = "采购进货单"; } curCell.Title = true; curCell.CellMergeNum = ColNum; // curCell.CellMergeIndex = 12; cellList.Add(curCell); CellType curCellOrder = new CellType(); curCellOrder.RowIndex = 1; curCellOrder.CellName = "单号:"; curCellOrder.CellMergeNum = 1; cellList.Add(curCellOrder); CellType curCellOrderValue = new CellType(); curCellOrderValue.RowIndex = 1; curCellOrderValue.CellName = curReturnOrder.ID; curCellOrderValue.CellMergeNum = 2; cellList.Add(curCellOrderValue); CellType curCellTime = new CellType(); curCellTime.RowIndex = 1; curCellTime.CellName = "开单时间"; curCellTime.CellMergeNum = 1; cellList.Add(curCellTime); CellType curCellTimeValue = new CellType(); curCellTimeValue.RowIndex = 1; curCellTimeValue.CellName = curReturnOrder.CreateTime.GetDateTimeFormats('f')[0].ToString();; curCellTimeValue.CellMergeNum = 2; cellList.Add(curCellTimeValue); CellType curCellSource = new CellType(); curCellSource.RowIndex = 2; curCellSource.CellName = "供应商:"; curCellSource.CellMergeNum = 1; cellList.Add(curCellSource); CellType curCellSourceValue = new CellType(); curCellSourceValue.RowIndex = 2; curCellSourceValue.CellName = curReturnOrder.SupplierName; curCellSourceValue.CellMergeNum = 2; cellList.Add(curCellSourceValue); CellType curCellTarget = new CellType(); curCellTarget.RowIndex = 2; curCellTarget.CellName = "操作人:"; curCellTarget.CellMergeNum = 1; cellList.Add(curCellTarget); CellType curCellTargetValue = new CellType(); curCellTargetValue.RowIndex = 2; curCellTargetValue.CellName = curReturnOrder.UserName; curCellTargetValue.CellMergeNum = 2; cellList.Add(curCellTargetValue); CellType curCellTotal = new CellType(); curCellTotal.RowIndex = 3; curCellTotal.CellName = "总数量:"; curCellTotal.CellMergeNum = 1; cellList.Add(curCellTotal); CellType curCellTotalValue = new CellType(); curCellTotalValue.RowIndex = 3; curCellTotalValue.CellName = curReturnOrder.TotalCount.ToString(); curCellTotalValue.CellMergeNum = 2; cellList.Add(curCellTotalValue); CellType curCellBalanceOld = new CellType(); curCellBalanceOld.RowIndex = 3; curCellBalanceOld.CellName = "总成本:"; curCellBalanceOld.CellMergeNum = 1; cellList.Add(curCellBalanceOld); CellType curCellBalanceValueOld = new CellType(); curCellBalanceValueOld.RowIndex = 3; curCellBalanceValueOld.CellName = curReturnOrder.TotalCost.ToString(); curCellBalanceValueOld.CellMergeNum = 2; cellList.Add(curCellBalanceValueOld); CellType curCellRemark = new CellType(); curCellRemark.RowIndex = 4; curCellRemark.CellName = "备注:"; curCellRemark.CellMergeNum = 1; cellList.Add(curCellRemark); CellType curCellRemarkValue = new CellType(); curCellRemarkValue.RowIndex = 4; curCellRemarkValue.CellName = curReturnOrder.Remarks.ToString(); curCellRemarkValue.CellMergeNum = 8; cellList.Add(curCellRemarkValue); NPOIHelper.CellValues = cellList; NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(DataGridViewUtil.ToDataTable(list), path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void baseButton3_Click(object sender, EventArgs e) { try { if (this.guideComboBox1.SelectedIndex == 0) { GlobalMessageBox.Show("该笔单的导购员不能为空!"); return; } string id = IDHelper.GetID(OrderPrefix.RefundOrder, CommonGlobalCache.GetShop(shopID).AutoCode); bool isNoHasGuidFlag = false; bool isSuperlen = false; if (this.retailDetailList != null && this.retailDetailList.Count > 0) { foreach (RetailDetail detail in this.retailDetailList) { if (detail.GuideID == null || detail.GuideID == "") { isNoHasGuidFlag = true; break; } if (Math.Abs(detail.SumMoney) > 0 && Math.Abs(detail.SumMoney) > Convert.ToDecimal(99999999.99)) { isSuperlen = true; break; } } } if (isNoHasGuidFlag) { GlobalMessageBox.Show("导购员不能为空,请检查列表里所有款号的导购员!"); return; } if (isSuperlen) { GlobalMessageBox.Show("请检查列表里所有款号的金额是否大于99999999.99!"); return; } #region 创建RefundCostume对象 RefundCostume costume = new RefundCostume() { RefundOrder = null, RefundDetailList = new List <RetailDetail>() }; int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; decimal moneyCash = 0; foreach (RetailDetail detail in this. retailDetailList) { if (detail.IsRefund && detail.RefundCount > 0) { detail.Refunded = true; totalCount += detail.RefundCount; totalPrice += detail.RefundCount * detail.Price; totalCost += detail.RefundCount * detail.CostPrice; moneyCash += detail.SumMoney; detail.SalePrice = detail.Price; costume.RefundDetailList.Add(this.RetailDetailToRefundDetail(detail, id)); } } List <String> costumeIds = new List <string>(); foreach (var item in costume.RefundDetailList) { if (!costumeIds.Contains(item.CostumeID)) { costumeIds.Add(item.CostumeID); } } if (costumeIds != null && costumeIds.Count > 0) { //判断是否又禁用的商品,并提示返回 InteractResult interactResult = GlobalCache.ServerProxy.IsCostumeValid(costumeIds); if (interactResult.ExeResult == ExeResult.Error) { GlobalMessageBox.Show(interactResult.Msg); return; } } RetailOrder refundOrder = new RetailOrder() { ID = id, IsRefundOrder = true, OriginOrderID = string.Empty, //GuideID = (string)("-1".Equals(this.guideComboBox2.SelectedValue) ? string.Empty : this.guideComboBox2.SelectedValue), // OperateGuideID = (string)this.guideComboBox1.SelectedValue, GuideID = (string)this.guideComboBox1.SelectedValue, ShopID = shopID, MemeberID = this.memberIDTextBox2.Text, SalesPromotionID = string.Empty, PromotionText = string.Empty, // TotalMoneyReceived = this.currentRetailCostume.RetailOrder.TotalMoneyReceived, // TotalMoneyReceivedActual = this.currentRetailCostume.RetailOrder.TotalMoneyReceivedActual, MoneyBankCard = 0, MoneyWeiXin = 0, MoneyOther = 0, MoneyAlipay = 0, SmallMoneyRemoved = 0, MoneyChange = 0, TotalCount = totalCount * -1, TotalCost = totalCost * -1, TotalPrice = totalPrice * -1, EntryUserID = CommonGlobalCache.CurrentUserID, MoneyDiscounted = 0,//若是全部退款,折扣金额为原始折扣金额,否则为0 Remarks = this.skinTextBox_RefundReason.SkinTxt.Text.Trim(), CreateTime = DateTime.Now, }; costume.RefundOrder = refundOrder; #endregion costume.RefundOrder.MoneyCash = moneyCash * -1; costume.RefundOrder.MoneyCash2 = costume.RefundOrder.MoneyCash; costume.RefundOrder.MoneyIntegration = 0; costume.RefundOrder.MoneyVipCard = 0; costume.RefundOrder.MoneyVipCardMain = 0; costume.RefundOrder.MoneyVipCardDonate = 0; costume.RefundOrder.CreateTime = dateTimePicker_Start.Value; costume.RefundOrder.EntryTime = DateTime.Now; //总计=现金+积分+VIP卡+优惠券 //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券 costume.RefundOrder.TotalMoneyReceived = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyIntegration + costume.RefundOrder.MoneyVipCard; costume.RefundOrder.TotalMoneyReceivedActual = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyVipCardMain; costume.RefundOrder.Benefit = costume.RefundOrder.TotalMoneyReceivedActual - costume.RefundOrder.TotalCost; // this.moneyDiscounted = costume.RefundOrder.to- costume.RefundOrder ; costume.IsNotHaveRetailOrder = true; if (Math.Abs(costume.RefundOrder.TotalCount) < 1) { GlobalMessageBox.Show("退货数量不能小于1"); return; } ConfirmRefundForm confirmRefundForm = new ConfirmRefundForm(costume, shopID, dataGridView1); DialogResult result = confirmRefundForm.ShowDialog(); if (result == DialogResult.Cancel) { return; } this.ResetForm(); } catch (Exception ee) { GlobalUtil.ShowError(ee); } }
private void BaseButton_AddCostume_Click(object sender, EventArgs e) { try { int buyCount = int.Parse(this.skinTextBox_bugCount.SkinTxt.Text); if (buyCount <= 0) { GlobalMessageBox.Show("退货数量必须大于0!"); return; } string selectShopid = ValidateUtil.CheckEmptyValue(this.skinComboBoxShopID.SelectedValue); List <Guide> guideList = CommonGlobalCache.GuideList.FindAll(t => t.State == 0 && t.ShopID == selectShopid); this.GuideName.DataSource = guideList; this.GuideName.DisplayMember = "Name"; this.GuideName.ValueMember = "ID"; string defaultGuid = string.Empty; if (this.guideComboBox1.SelectedIndex > 0) { defaultGuid = ValidateUtil.CheckEmptyValue(this.guideComboBox1.SelectedValue); } RetailDetail detail = new RetailDetail() { Costume = this.currentSelectedItem.Costume, CostumeID = this.currentSelectedItem.Costume.ID, CostumeName = this.currentSelectedItem.Costume.Name, ColorName = this.skinComboBox_Color.Text, SizeName = ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), GuideID = defaultGuid, // 显示自己设置的尺码组和对应的尺码列表 SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), CommonGlobalCache.GetSizeGroup(this.currentSelectedItem.Costume.SizeGroupName)), IsRefund = true, RefundCount = buyCount, BuyCount = buyCount, Price = this.currentSelectedItem.Costume.Price, SumMoney = this.currentSelectedItem.Costume.Price * buyCount, SumMoneyActual = this.currentSelectedItem.Costume.Price * buyCount, BrandName = ValidateUtil.CheckNotNullValue(currentSelectedItem.Costume.BrandName), // SinglePrice = this.currentSelectedItem.Costume.Price, IsUseTickets = false, ///288 收银时,商品的备注显示的是商品的备注 //Remarks = this.currentSelectedItem.Costume.Remarks, Discount = 100, DiscountOrigin = 100, AllowReviseDiscount = true,//this.currentSelectedStore.AllowReviseDiscount, CostPrice = this.currentSelectedItem.Costume.CostPrice, SumCost = this.currentSelectedItem.Costume.CostPrice * buyCount, }; if (!this.AddSelectedCostumeToList(detail)) { return; } dataGridViewPagingSumCtrl.BindingDataSource(DataGridViewUtil.ListToBindingList(this.retailDetailList)); this.skinTextBox_bugCount.SkinTxt.Text = "1"; } catch (Exception ee) { CommonGlobalUtil.WriteLog(ee); GlobalMessageBox.Show("添加失败!"); } }
//点击出库按钮 private void Save(bool isHang) { try { if (skinComboBoxShopID.DataSource == null || (skinComboBoxShopID.DataSource as List <Shop>).Count == 0) { GlobalMessageBox.Show("没有店铺可以调拨"); return; } /* if (this.guideComboBox1.SelectedIndex == 0 && IsPos) * { * GlobalMessageBox.Show("操作人不能为空!"); * return; * }*/ bool isSuperLen = false; foreach (BoundDetail detail in this.curDetailList) { if ((detail.Price > 0 && detail.Price > Convert.ToDecimal(99999999.99)) || (detail.SalePrice > 0 && detail.SalePrice > Convert.ToDecimal(99999999.99)) || (detail.SumMoney > 0 && detail.SumMoney > Convert.ToDecimal(99999999.99))) { isSuperLen = true; break; } } if (isSuperLen) { GlobalMessageBox.Show("列表中吊牌价、售价或每款总金额不能大于99999999.99"); return; } AllocateOutboundPara item = this.Build(); if (item == null || item.OutboundOrder.TotalCount == 0) { GlobalMessageBox.Show("调拨单为空,不能出库!"); return; } if (action == OperationEnum.Send) { item.ReplenishOrderID = order.ID; } else { item.ReplenishOrderID = null; } if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } //检查库存信息 if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } InteractResult result = null; if (isHang) { result = CommonGlobalCache.ServerProxy.HangUpAllocateOrder(item); } else { result = CommonGlobalCache.ServerProxy.AllocateOutbound(item); } switch (result.ExeResult) { case ExeResult.Success: if (isHang) { GlobalMessageBox.Show("挂单成功!"); } else { GlobalMessageBox.Show("调拨成功!"); //增加打印功能,先给后台使用 if (this.skinCheckBoxPrint.Checked) { // AllocateOrderPrinter.ExcelTemplatePrint(item, curDetailList); //Column2.Visible = false; //SumMoney.Visible = false; //Column2.Tag = AllocateOrderPrintUtil.PrinterNoCount; //SumMoney.Tag = AllocateOrderPrintUtil.PrinterNoCount; DataGridView dgv = deepCopyDataGridView(); AllocateOrderPrintUtil.Print(item.AllocateOrder, dgv); //SumMoney.Visible = true; //Column2.Visible = true; } //if (CommonGlobalCache.GetParameter(ParameterConfigKey.AllocateInDirectly)?.ParaValue == "1") //{ // if (InboundConfirmCtrl.AutoInbound(item.AllocateOrder)) // { // } //} } ResetAll(true); if (!IsShowOnePage) { TabPageClose(this.CurrentTabPage, this.SourceCtrlType); } break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } finally { CommonGlobalUtil.UnLockPage(this); } }
private void Cancel(RetailOrder allocateOrder) { try { if (!String.IsNullOrEmpty(allocateOrder.RefundOrderID)) { GlobalMessageBox.Show("销售单已退货,不能冲单!"); return; } String userId = string.Empty; if (IsPos) { SelectGuideForm form = new SelectGuideForm(); if (form.ShowDialog(this.FindForm()) != DialogResult.OK) { return; } else { userId = form.Guide.ID; } } else { if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } userId = CommonGlobalCache.CurrentUserID; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } CancelRetailOrderPara para = new CancelRetailOrderPara() { CancelGuideID = userId, RetailOrderID = allocateOrder.ID }; InteractResult result = null; if (allocateOrder.IsRefundOrder) { result = CommonGlobalCache.ServerProxy.CancelRefundOrder(para); } else { result = CommonGlobalCache.ServerProxy.CancelRetailOrder(para); } switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("冲单成功!"); break; //case ExeResult.IsNotToday: // GlobalMessageBox.Show("不是今天的销售/退货单!"); // break; //case CancelRetailOrderResult.IsRefundOrder: // GlobalMessageBox.Show("不是销售单!"); // break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } this.RefreshPage(); } catch (Exception ee) { ShowError(ee); } finally { UnLockPage(); } }
private void BaseButtonAdd_Click(object sender, EventArgs e) { try { if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } string id = IDHelper.GetID(OrderPrefix.ConfusedStoreAdjustRecord, shop.AutoCode); ConfusedStoreAdjustRecord para = new ConfusedStoreAdjustRecord() { OrderID = id, CostumeID = currentSelectedItem?.Costume?.ID, ColorName1 = ValidateUtil.CheckEmptyValue(skinComboBox_Color.SelectedValue), ColorName2 = ValidateUtil.CheckEmptyValue(skinComboBox_Color1.SelectedValue), SizeName1 = CostumeStoreHelper.GetCostumeSize(ValidateUtil.CheckEmptyValue(skinComboBox_Size.SelectedValue), CommonGlobalCache.DefaultSizeGroup), SizeName2 = CostumeStoreHelper.GetCostumeSize(ValidateUtil.CheckEmptyValue(skinComboBox_Size1.SelectedValue), CommonGlobalCache.DefaultSizeGroup), Remarks = skinTextBox_Remark.Text, CountPre1 = skinLabelStore, CountPre2 = skinLabelStore1, CountNow1 = skinLabelStore - int.Parse(skinTextBox_MoneyCash.Text), CountNow2 = skinLabelStore1 + int.Parse(skinTextBox_MoneyCash1.Text), ShopID = ValidateUtil.CheckEmptyValue(skinComboBoxShopID.SelectedValue), OperatorUserID = userID, }; if (String.IsNullOrEmpty(para.CostumeID)) { GlobalMessageBox.Show("请选择款号!"); return; } if (para.ColorName1 == para.ColorName2 && para.SizeName1 == para.SizeName2) { GlobalMessageBox.Show("请选择不同颜色或者尺码!"); return; } if (para.CountPre1 == 0) { GlobalMessageBox.Show("库存为0,不能向下调整!"); return; } InteractResult result = CommonGlobalCache.ServerProxy.AddConfusedStoreAdjustRecord(para); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("调整成功!"); //重新获取该款库存信息 this.skinTextBox_costumeID.Reload(); //this.TabPageClose(CurrentTabPage, SourceCtrlType); break; case ExeResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }