private void DoExport() { try { if (dataGridView1.DataSource != null && dataGridView1.Rows.Count > 0) { List <CostumeStore> list = 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 (item.Visible) { if (item.Name != "Column1" && item.Name != "Column2") { keys.Add(item.DataPropertyName); values.Add(item.HeaderText); } } } /* List<CostumeStore> ExportList = new List<CostumeStore>(); * foreach (CostumeStore cItem in list) * { * CostumeStore curBrand = new CostumeStore(); * curBrand.CostumeID = cItem.CostumeID; * curBrand.CostumeName = cItem.CostumeName; * curBrand.ColorName = cItem.ColorName; * curBrand.Price = cItem.Price; * curBrand.CostPrice = cItem.CostPrice; * curBrand.SalePrice = cItem.SalePrice; * curBrand.EmOnlinePrice = cItem.EmOnlinePrice; * curBrand.PfOnlinePrice = cItem.PfOnlinePrice; * curBrand.BrandName = cItem.BrandName; * curBrand.SupplierName = cItem.SupplierName; * curBrand.Year = cItem.Year; * curBrand.Season = cItem.Season; * curBrand.BigClass = cItem.BigClass; * curBrand.SmallClass = cItem.SmallClass; * curBrand.SubSmallClass = cItem.SubSmallClass; * curBrand.SizeGroupShowName = cItem.SizeGroupShowName; * curBrand.F = cItem.F; * curBrand.S = cItem.S; * curBrand.XS = cItem.XS; * curBrand.XL = cItem.XL; * curBrand.XL2 = cItem.XL2; * curBrand.XL3 = cItem.XL3; * curBrand.XL4 = cItem.XL4; * curBrand.XL5 = cItem.XL5; * curBrand.XL6 = cItem.XL6; * curBrand.M = cItem.M; * curBrand.L = cItem.L; * ExportList.Add(curBrand); * }*/ 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 dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (GlobalUtil.EngineUnconnectioned(this)) { return; } List <AdminUser> list = (List <AdminUser>) this.dataGridView1.DataSource; AdminUser item = (AdminUser)list[e.RowIndex]; //switch (this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value) //{ // case "编辑": if (e.ColumnIndex == Column1.Index) { this.SaveClick(item, this); } //break; // case "设置密码": else if (e.ColumnIndex == Column3.Index) { this.EditPasswordClick(item, this, false); } else if (e.ColumnIndex == Column2.Index) { if (item.ID == SystemDefault.DefaultAdmin) { GlobalMessageBox.Show("默认管理员不能删除"); return; } if (GlobalMessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { DeleteAdminUserResult result = GlobalCache.AdminUser_OnRemove(item.ID); if (result == DeleteAdminUserResult.Error) { GlobalMessageBox.Show("内部错误!"); return; } else if (result == DeleteAdminUserResult.DefaultAdminIsNoDelete) { GlobalMessageBox.Show("不能删除超级管理员!"); return; } else { GlobalMessageBox.Show("删除成功!"); RefreshPage(); } } } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private bool Validate(Costume item) { bool success = true; if (String.IsNullOrEmpty(item.ID)) { this.skinTextBox_ID.Focus(); success = false; GlobalMessageBox.Show("请输入款号!"); } else if (item.ID.Contains("#")) { this.skinTextBox_ID.Focus(); success = false; GlobalMessageBox.Show("款号不能使用“#”!"); } else if (String.IsNullOrEmpty(item.Name)) { skinTextBox_Name.Focus(); success = false; GlobalMessageBox.Show("请输入名称!"); } else if (item.Price == 0) { numericUpDown_Price.Focus(); success = false; GlobalMessageBox.Show("价格不能为0!"); } else if (item.Price > 0 && item.Price > Convert.ToDecimal(99999999.99)) { numericUpDown_Price.Focus(); success = false; GlobalMessageBox.Show("价格不能大于99999999.99!"); } else if (item.CostPrice == 0) { numericUpDownCostPrice.Focus(); success = false; GlobalMessageBox.Show("进货价不能为0!"); } else if (item.CostPrice > 0 && item.CostPrice > Convert.ToDecimal(99999999.99)) { numericUpDownCostPrice.Focus(); success = false; GlobalMessageBox.Show("进货价不能大于99999999.99!"); } else if (item.SalePrice > 0 && item.SalePrice > Convert.ToDecimal(99999999.99)) { numericTextBoxSalePrice.Focus(); success = false; GlobalMessageBox.Show("售价不能大于99999999.99!"); } else if (this.skinComboBox_Year.SelectedValue == null) { skinComboBox_Year.Focus(); success = false; GlobalMessageBox.Show("请选择年份!"); } else if (String.IsNullOrEmpty(this.skinComboBox_Season.skinComboBox.SelectedValue?.ToString())) { skinComboBox_Season.skinComboBox.Focus(); success = false; GlobalMessageBox.Show("请选择季节!"); } else if (this.skinComboBoxBigClass.SelectedValue.ClassID == -1) { skinComboBoxBigClass.Focus(); success = false; GlobalMessageBox.Show("请选择类别!"); } else if (String.IsNullOrEmpty(this.skinComboBox_SupplierID.SelectedValue?.ToString())) { skinComboBox_SupplierID.Focus(); success = false; GlobalMessageBox.Show("请选择供应商!"); } else if (this.colorComboBox1.SelectedItem != null && String.IsNullOrEmpty(this.colorComboBox1.SelectedValue.ToString())) { colorComboBox1.Focus(); success = false; GlobalMessageBox.Show("请选择颜色!"); } else if (String.IsNullOrEmpty(this.skinComboBox_Brand.skinComboBox.SelectedValue?.ToString())) { skinComboBox_Brand.skinComboBox.Focus(); success = false; GlobalMessageBox.Show("请选择品牌!"); } return(success); }
private void selectPrintInfo() { InteractResult <PrintTemplateInfo> result = GlobalCache.ServerProxy.GetPrintTemplateInfo(PrintTemplateType.DayReport); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: PrintTemplateInfo PTempInfo = result.Data; /* if (PTempInfo.PrintColumnInfos.Count > 0) * { * // List<PrintColumnsInfo> list = GlobalUtilOfPrint.getPurchaseStockColumnsInfo(); * * List<PrintColumnsInfo> source = (List<PrintColumnsInfo>)this.dataGridViewColumns.DataSource; * //lastPrintColumnsInfo.Clear(); * List<PrintColumnsInfo> columnsSelect = new List<PrintColumnsInfo>(); * foreach (PrintColumnsInfo cInfo in source) * { * foreach (PrintColumnInfo item in PTempInfo.PrintColumnInfos) * { * * if (cInfo.name == item.Name) * { * cInfo.ischeck = true; * * columnsSelect.Add(cInfo); * break; * } * else * { * cInfo.ischeck = false; * } * } * } * setColumnsHeaderInfo(columnsSelect); * this.dataGridViewColumns.DataSource = source; * * }*/ if (PTempInfo.SystemVariables.Count > 0) { List <PrintSysInfo> list = (List <PrintSysInfo>) this.dataGridViewSys.DataSource; // lastPrintSysInfo.Clear(); List <PrintSysInfo> columnsSysfirst = new List <PrintSysInfo>(); List <PrintSysInfo> columnsSysSecnod = new List <PrintSysInfo>(); List <PrintSysInfo> columnsSysthirdth = new List <PrintSysInfo>(); List <PrintSysInfo> columnsSysfourth = new List <PrintSysInfo>(); List <PrintSysInfo> columnsSysfiveth = new List <PrintSysInfo>(); List <PrintSysInfo> columnsSyssixth = new List <PrintSysInfo>(); foreach (PrintSysInfo pSys in list) { foreach (string sysInfo in PTempInfo.SystemVariables) { string[] sArray = sysInfo.Split('#'); if (pSys.name == sArray[0] && pSys.type.ToString() == sArray[1]) { pSys.ischeck = true; if (pSys.name == "日结时间" || pSys.name == "日结日期" || pSys.name == "店铺名称") { columnsSysfirst.Add(pSys); } else if (pSys.name == "期初库存" || pSys.name == "采购进货" || pSys.name == "采购退货" || pSys.name == "调拨入库" || pSys.name == "调拨" || pSys.name == "报损出库" || pSys.name == "盘盈数" || pSys.name == "盘亏数" || pSys.name == "批发发货" || pSys.name == "批发退货" || pSys.name == "当日销售" || pSys.name == "顾客退货" || pSys.name == "差异调整" || pSys.name == "期末库存" ) { columnsSysSecnod.Add(pSys); } else if ((pSys.name == "现金" && pSys.type == 0 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "银联卡" && pSys.type == 0 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "微信" && pSys.type == 0 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "支付宝" && pSys.type == 0 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "VIP卡余额" && pSys.type == 0 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "VIP卡积分返现" && pSys.type == 0 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "优惠券金额" && pSys.type == 0 && Convert.ToInt32(sArray[1]) == pSys.type)) { columnsSysthirdth.Add(pSys); } else if ((pSys.name == "现金" && pSys.type == 1 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "银联卡" && pSys.type == 1 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "微信" && pSys.type == 1 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "支付宝" && pSys.type == 1 && Convert.ToInt32(sArray[1]) == pSys.type) || (pSys.name == "其他" && pSys.type == 1 && Convert.ToInt32(sArray[1]) == pSys.type)) { columnsSysfourth.Add(pSys); } else if (pSys.name == "零售单数" || pSys.name == "营收金额" || pSys.name == "当日现金结余") { columnsSysfiveth.Add(pSys); } else if (pSys.name == "营业员签名" || pSys.name == "财务签名") { columnsSyssixth.Add(pSys); } // columnsSys.Add(pSys); break; } else { pSys.ischeck = false; } } } loadList.AddRange(columnsSysfirst); loadList.AddRange(columnsSysSecnod); loadList.AddRange(columnsSysthirdth); loadList.AddRange(columnsSysfourth); loadList.AddRange(columnsSysfiveth); loadList.AddRange(columnsSyssixth); setLblValue(columnsSysfirst, columnsSysSecnod, columnsSysthirdth, columnsSysfourth, columnsSysfiveth, columnsSyssixth); this.dataGridViewSys.DataSource = list; lastPrintSysInfo = list; } else { List <PrintSysInfo> list = (List <PrintSysInfo>) this.dataGridViewSys.DataSource; foreach (PrintSysInfo item in list) { item.ischeck = false; } } if (PTempInfo.OrderName != null && PTempInfo.OrderName != "") { this.lblCurDataName.Text = PTempInfo.OrderName; this.txtDataName.Text = PTempInfo.OrderName; } if (PTempInfo.PrintCount > 0) { this.numericTxtCount.Text = PTempInfo.PrintCount.ToString(); } // lastPrintColumnsInfo=result.Data. // listColumns = result.Data.PrintColumnInfos; break; default: break; } }
private void baseButtonSave_Click(object sender, EventArgs e) { int gWidth = this.dataGridView3.Width; // 打印模板 //GetPrintTemplateInfo //SavePrintTemplateInfo List <PrintColumnInfo> listOfColumns = new List <PrintColumnInfo>(); // PrintColumnInfo p = new PrintColumnInfo(); List <string> listSys = new List <string>(); if (!flag) { lastPrintSysInfo = loadList; } foreach (PrintSysInfo pSysInfo in lastPrintSysInfo) { listSys.Add(pSysInfo.name); } foreach (PrintColumnsInfo cColumnInfo in lastPrintColumnsInfo) { for (int i = 0; i < this.dataGridView3.Columns.Count; i++) { if (this.dataGridView3.Columns[i].HeaderText == cColumnInfo.name) { PrintColumnInfo sCol = new PrintColumnInfo(); sCol.Name = cColumnInfo.name; sCol.Rate = Math.Round(Convert.ToDecimal(this.dataGridView3.Columns[i].Width) / Convert.ToDecimal(this.dataGridView3.Width) * 100, 2); // ShowMessage(sCol.Name+"=" + sCol.Rate); listOfColumns.Add(sCol); } } } try { InteractResult result = GlobalCache.ServerProxy.SavePrintTemplateInfo(new PrintTemplateInfo() { Type = PrintTemplateType.ReplenishOrder, OrderName = lblCurDataName.Text, PrintCount = Convert.ToInt32(numericTxtCount.Text), PrintColumnInfos = listOfColumns, SystemVariables = listSys, }); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: GlobalMessageBox.Show("保存成功!"); // ReflectionHelper.CopyProperty(role, user); // dataGridViewSys.Refresh(); break; default: break; } } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } }
/// <summary> /// 导入数据 /// </summary> private void DoImport() { try { List <Costume> emptyStore = new List <Costume>(); List <Costume> stores = new List <Costume>(); List <Costume> repeatItems = new List <Costume>(); DataTable dt = NPOIHelper.FormatToDatatable(path, 0); List <int> NoNullRows = new List <int>(); //必填项不为空集合 List <int> IDRepeatRows = new List <int>(); //款号重复集合 List <int> ErrorSizeRows = new List <int>(); //尺码格式不正确 List <int> ErrorGroupNameRows = new List <int>(); //尺码组名称不存在 List <int> ErrorIdOrName = new List <int>(); //款号或名称长度不正确 List <EmCostumePhoto> listPhoto = ExcelToImage(path, GlobalUtil.EmallDir); #region //数据处理 for (int i = 1; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; int index = 0; Costume store = new Costume(); try { if (!ImportValidate(row)) { //款号 商品名称 颜色名称(使用逗号分隔) 吊牌价 成本价 售价 品牌 供应商名称 年份 季节 类别编码 尺码组名称 含有的尺码(使用逗号分隔) 备注 store.ID = CommonGlobalUtil.ConvertToString(row[index++]); store.Name = CommonGlobalUtil.ConvertToString(row[index++]); store.Colors = CommonGlobalUtil.ConvertToString(row[index++]); store.Price = CommonGlobalUtil.ConvertToDecimal(row[index++]); store.CostPrice = CommonGlobalUtil.ConvertToDecimal(row[index++]); store.SalePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]); store.EmOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]); store.PfOnlinePrice = CommonGlobalUtil.ConvertToDecimal(row[index++]); store.BrandName = CommonGlobalUtil.ConvertToString(row[index++]); store.SupplierName = CommonGlobalUtil.ConvertToString(row[index++]); store.Year = CommonGlobalUtil.ConvertToInt32(row[index++]); store.Season = CommonGlobalUtil.ConvertToString(row[index++]); // Image image =(Image) row[index++]; // store.ClassCode = CommonGlobalUtil.ConvertToString(row[index++]); store.BigClass = CommonGlobalUtil.ConvertToString(row[index++]); store.SmallClass = CommonGlobalUtil.ConvertToString(row[index++]); store.SubSmallClass = CommonGlobalUtil.ConvertToString(row[index++]); store.SizeGroupName = CommonGlobalUtil.ConvertToString(row[index++]); store.SizeNames = CommonGlobalUtil.ConvertToString(row[index++]); store.Remarks = CommonGlobalUtil.ConvertToString(row[index++]); //图片放最后面 index++; int curRow = i + 2; if (String.IsNullOrEmpty(store.ID) || String.IsNullOrEmpty(store.Name) || String.IsNullOrEmpty(store.Colors) || String.IsNullOrEmpty(store.SizeGroupName) || String.IsNullOrEmpty(store.SizeNames)) { //必填项为空 // emptyStore.Add(store); NoNullRows.Add(curRow); continue; } else { /* if (store.ID.Length > 50 || store.Name.Length > 50) * { * ErrorIdOrName.Add(curRow); * continue; * }*/ //判断尺码组以及尺码是否格式正确 CommonGlobalCache.SizeGroupList List <SizeGroup> SizeGroupList = CommonGlobalCache.SizeGroupList; int isNoGName = 0; foreach (var sGroup in SizeGroupList) { if (sGroup.ShowName == store.SizeGroupName) //尺码组名称存在 { //判断尺码格式是否正确 M,S,XL //sGroup.NameOfF String[] tempSizeList = store.SizeNames.Split(','); if (tempSizeList != null) { bool isRight = true; //当前尺码是否格式完全正确 for (int t = 0; t < tempSizeList.Length; t++) { if (tempSizeList[t] == sGroup.NameOfF || tempSizeList[t] == sGroup.NameOfL || tempSizeList[t] == sGroup.NameOfM || tempSizeList[t] == sGroup.NameOfS || tempSizeList[t] == sGroup.NameOfXL || tempSizeList[t] == sGroup.NameOfXL2 || tempSizeList[t] == sGroup.NameOfXL3 || tempSizeList[t] == sGroup.NameOfXL4 || tempSizeList[t] == sGroup.NameOfXL5 || tempSizeList[t] == sGroup.NameOfXL6 || tempSizeList[t] == sGroup.NameOfXS) { //逗号分隔后当前尺码跟数据库尺码匹配 } else { isRight = false; //当前含有的尺码有错误的格式 ErrorSizeRows.Add(curRow); continue; } } if (isRight == false) { continue; //跳出循环,正确的尺码组没有正确的尺码 } } else { ErrorSizeRows.Add(curRow); //格式不正确,没有尺码 } } else { isNoGName++; if (isNoGName == SizeGroupList.Count) { ErrorGroupNameRows.Add(curRow); //尺码组不存在,格式不正确 } } } //判断是否重复款号 if (stores.Find(t => t.ID == store.ID) != null) { IDRepeatRows.Add(curRow); continue; } stores.Add(store); } } } //catch (IOException ex) //{ // ShowMessage(ex.Message); //} catch (Exception ex) { } } #endregion #region //数据检验 if (NoNullRows.Count > 0) { String str = string.Empty; foreach (var item in NoNullRows) { str += "第" + item + "行\r\n"; } ShowError("必填项没有填写,请补充完整!\r\n" + str); return; } if (ErrorIdOrName.Count > 0) { String str = string.Empty; foreach (var item in ErrorGroupNameRows) { str += "第" + item + "行" + "\r\n"; } ShowError("款号超过50个字符或商品名称超过50个汉字,请检查列表信息!\r\n" + str); return; } if (IDRepeatRows.Count > 0) { String str = string.Empty; foreach (var item in IDRepeatRows) { str += "第" + item + "行" + "\r\n"; } ShowError("重复的款号,系统已过滤,详见错误报告!\r\n" + str); // return; } if (ErrorGroupNameRows.Count > 0) { String str = string.Empty; foreach (var item in ErrorGroupNameRows) { str += "第" + item + "行" + "\r\n"; } ShowError("尺码组不存在,请检查列表信息!\r\n" + str); return; } if (ErrorSizeRows.Count > 0) { String str = string.Empty; foreach (var item in ErrorSizeRows) { str += "第" + item + "行" + "\r\n"; } ShowError("尺码不存在或尺码格式错误,请检查列表信息!\r\n" + str); return; } if (stores != null && stores.Count > 0) { if (stores.Count == listPhoto.Count) { } else { if (GlobalMessageBox.Show("导入的数据和图片不对应,如果导入会影响到导入的图片与款号不对应,是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } } } else { ShowMessage("没有数据可以导入,请检查列表信息!"); return; } #endregion path = null; #region //数据录入 InteractResult result = GlobalCache.ServerProxy.ImportCostumes(stores); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: foreach (var item in stores) { Costume costume = CommonGlobalCache.GetCostume(item.ID); if (costume != null) { //重新给商品名称 //ShowMessage(item.ID); item.Name = costume.Name; } } for (int i = 0; i < stores.Count; i++) { if (listPhoto.Count > 0 && listPhoto.Count > i) { listPhoto[i].CostumeID = stores[i].ID; //这里还是要给新图片名称,下面取回来对应过去。才有LINKADDRESS PhotoData para = new PhotoData() { Datas = listPhoto[i].Bytes, EmCostumePhoto = listPhoto[i], Name = listPhoto[i].PhotoName, }; GlobalCache.ServerProxy.UploadPhotoToCos(para); /* GlobalCache.ServerProxy.UploadCostumePhoto(new UploadCostumePhotoPara() * { * * ID = stores[i].ID, * Photo = listPhoto[i].Photo, * * });*/ } } // AddItems4Display(stores); ShowMessage("导入成功!"); break; default: break; } #endregion } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void DoImport() { try { List <Supplier> emptyStore = new List <Supplier>(); List <Supplier> stores = new List <Supplier>(); List <Supplier> repeatItems = new List <Supplier>(); DataTable dt = NPOIHelper.FormatToDatatable(path, 0); for (int i = 1; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; int index = 0; Supplier store = new Supplier(); try { if (!CommonGlobalUtil.ImportValidate(row, 10)) { // 名称 进货折扣 联系人 联系电话 银行账户信息 应付款结余(正数表示欠供应商) 最后一次记账时间 创建时间 序号 备注 store.ID = "" + (i + 2); store.Name = CommonGlobalUtil.ConvertToString(row[index++]); store.SupplyDiscount = CommonGlobalUtil.ConvertToDecimal(row[index++]); store.Contact = CommonGlobalUtil.ConvertToString(row[index++]); store.ContactPhone = CommonGlobalUtil.ConvertToString(row[index++]); store.BankInfo = CommonGlobalUtil.ConvertToString(row[index++]); store.PaymentBalance = CommonGlobalUtil.ConvertToDecimal(row[index++]); store.LastAccountTime = DateTimeUtil.ConvertToDateTime(CommonGlobalUtil.ConvertToString(row[index++])); store.CreateTime = DateTimeUtil.ConvertToDateTime(CommonGlobalUtil.ConvertToString(row[index++])); store.OrderNo = CommonGlobalUtil.ConvertToInt32(row[index++]); store.Remarks = CommonGlobalUtil.ConvertToString(row[index++]); if (String.IsNullOrEmpty(store.Name)) { //必填项为空 emptyStore.Add(store); continue; } else { //判断是否重复款号/颜色 if (stores.Find(t => t.Name == store.Name) != null) { repeatItems.Add(store); continue; } stores.Add(store); } } } catch (Exception ex) { } } if (emptyStore.Count > 0) { String str = string.Empty; foreach (var item in emptyStore) { str += "第" + item.ID + "行\r\n"; } ShowError("必填项没有填写,请补充完整!\r\n" + str); return; } if (repeatItems.Count > 0) { String str = string.Empty; foreach (var item in repeatItems) { str += "第" + item.ID + "行" + "\r\n"; } ShowError("名称重复,系统已过滤,详见错误报告!\r\n" + str); // return; } if (stores != null && stores.Count > 0) { } else { ShowMessage("没有数据可以导入,请检查列表信息!"); return; } path = null; //檢查結果 InteractResult result = GlobalCache.ServerProxy.ImportSupplier(stores); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: RefreshPage(); ShowMessage("导入成功!"); break; default: break; } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void baseButtonSave_Click(object sender, EventArgs e) { try { string tempName = skinTextBoxID.SkinTxt.Text; if (string.IsNullOrEmpty(tempName)) { ShowMessage("模板名称不能为空!"); this.skinTextBoxID.Focus(); return; } if (!CheckValidate()) { return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } CommissionTemplate comTemp = new CommissionTemplate(); comTemp.Name = this.skinTextBoxID.SkinTxt.Text; comTemp.FirstRate = this.numericTxtFirstScale.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtFirstScale.SkinTxt.Text.Trim()); comTemp.Rate1 = this.numericTxtBoxOne.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxOne.SkinTxt.Text.Trim()); comTemp.Rate2 = this.numericTxtBoxTwo.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTwo.SkinTxt.Text.Trim()); comTemp.Rate3 = this.numericTxtBoxThree.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxThree.SkinTxt.Text.Trim()); comTemp.Rate4 = this.numericTxtBoxFour.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFour.SkinTxt.Text.Trim()); comTemp.Rate5 = this.numericTxtBoxFive.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFive.SkinTxt.Text.Trim()); comTemp.Rate6 = this.numericTxtBoxSix.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSix.SkinTxt.Text.Trim()); comTemp.Rate7 = this.numericTxtBoxSeven.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSeven.SkinTxt.Text.Trim()); comTemp.Rate8 = this.numericTxtBoxEight.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxEight.SkinTxt.Text.Trim()); comTemp.Rate9 = this.numericTxtBoxNine.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxNine.SkinTxt.Text.Trim()); comTemp.Rate10 = this.numericTxtBoxTen.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTen.SkinTxt.Text.Trim()); comTemp.IsDefault = skinIsDefault.Checked; /* DistributionInfo distributionInfo = new DistributionInfo(); * distributionInfo.CommissionRate1 = this.numericTxtBoxOne.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxOne.SkinTxt.Text.Trim()); * distributionInfo.CommissionRate2 = this.numericTxtBoxTwo.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTwo.SkinTxt.Text.Trim()); * distributionInfo.CommissionRate3 = this.numericTxtBoxThree.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxThree.SkinTxt.Text.Trim()); * distributionInfo.CommissionRate4 = this.numericTxtBoxFour.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFour.SkinTxt.Text.Trim()); * * distributionInfo.CommissionRate5 = this.numericTxtBoxFive.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxFive.SkinTxt.Text.Trim()); * * * distributionInfo.CommissionRate6 = this.numericTxtBoxSix.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSix.SkinTxt.Text.Trim()); * * distributionInfo.CommissionRate7 = this.numericTxtBoxSeven.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxSeven.SkinTxt.Text.Trim()); * * distributionInfo.CommissionRate8 = this.numericTxtBoxEight.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxEight.SkinTxt.Text.Trim()); * distributionInfo.CommissionRate9 = this.numericTxtBoxNine.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxNine.SkinTxt.Text.Trim()); * distributionInfo.CommissionRate10 = this.numericTxtBoxTen.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtBoxTen.SkinTxt.Text.Trim()); * distributionInfo.CommissionFirstRate = this.numericTxtFirstScale.SkinTxt.Text.Trim() == "" ? 0 : Convert.ToDecimal(this.numericTxtFirstScale.SkinTxt.Text.Trim()); * * InteractResult interactR = CommonGlobalCache.ServerProxy.UpdateDistributionInfo(new DistributionInfo() * { * // Level = (int)this.skinComboBox_Level.SelectedValue, * CommissionRate1 = distributionInfo.CommissionRate1, * CommissionRate2 = distributionInfo.CommissionRate2, * CommissionRate3 = distributionInfo.CommissionRate3, * CommissionRate4 = distributionInfo.CommissionRate4, * CommissionRate5 = distributionInfo.CommissionRate5, * CommissionRate6 = distributionInfo.CommissionRate6, * CommissionRate7 = distributionInfo.CommissionRate7, * CommissionRate8 = distributionInfo.CommissionRate8, * CommissionRate9 = distributionInfo.CommissionRate9, * CommissionRate10 = distributionInfo.CommissionRate10, * CommissionFirstRate = distributionInfo.CommissionFirstRate * * });*/ if (action == OperationEnum.Add) { if (skinIsDefault.Checked) { InteractResult <bool> result = CommonGlobalCache.ServerProxy.IsCommissionTemplateHaveDefault(); if (result.Data) { if (GlobalMessageBox.Show("默认模板已存在,是否覆盖?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { comTemp.IsDefault = true; } else { comTemp.IsDefault = false; this.skinIsDefault.Checked = false; } //ShowMessage("分销佣金模板已被设置"); } } else { comTemp.IsDefault = false; } InteractResult interactR = CommonGlobalCache.ServerProxy.InsertCommissionTemplate(comTemp); switch (interactR.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("新增成功!"); this.DialogResult = DialogResult.OK; break; case ExeResult.Error: GlobalMessageBox.Show(interactR.Msg); break; default: break; } } else if (action == OperationEnum.Edit) { comTemp.AutoID = item.AutoID; if (skinIsDefault.Checked) { InteractResult <bool> result = CommonGlobalCache.ServerProxy.IsCommissionTemplateHaveDefault(); if (result.Data && isDefaultRecord == false) { if (GlobalMessageBox.Show("默认模板已存在,是否覆盖?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { comTemp.IsDefault = true; } else { comTemp.IsDefault = false; this.skinIsDefault.Checked = false; } //ShowMessage("分销佣金模板已被设置"); } } else { comTemp.IsDefault = false; } InteractResult interactR = CommonGlobalCache.ServerProxy.UpdateCommissionTemplate(comTemp); switch (interactR.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("保存成功!"); this.DialogResult = DialogResult.OK; break; case ExeResult.Error: GlobalMessageBox.Show(interactR.Msg); break; default: break; } } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void BaseButtonSave_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(skinTextBoxTitle.Text)) { GlobalMessageBox.Show("请输入模板名称!"); skinTextBoxTitle.Focus(); return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } //最后记得跟resultList对比下,判断是否省份所有城市都选中了 Core.Dev.InteractEntity.CarriageCost para = new Core.Dev.InteractEntity.CarriageCost(); para.CarriageCostTemplate = new EmCarriageCostTemplate() { CreateTime = DateTime.Now, DeliveryTime = (int)this.skinComboBoxDeliveryTime.SelectedValue, DefaultCarriageCost = numericTextBoxDefaultCarriageCost.Value, GoodsAddress = skinComboBoxProvince.SelectedValue + "-" + skinComboBoxCity.SelectedValue + "-" + skinComboBoxCityArea.SelectedValue, IsValid = skinCheckBox_State.Checked, LastEditTime = DateTime.Now, LastOperatorUserID = GlobalCache.CurrentUserID, Name = skinTextBoxTitle.Text }; List <CarriageCost> costs = this.dataGridView1.DataSource as List <CarriageCost>; //周一实现 para.CarriageCostDetails = CarriageCostUtil.GetEmCarriageCostDetails(costs); if (curTemp != null) { para.CarriageCostTemplate.AutoID = curTemp.AutoID; para.CarriageCostTemplate.CreateTime = curTemp.CreateTime; foreach (var item in para.CarriageCostDetails) { item.TemplateID = curTemp.AutoID; } UpdateResult result = GlobalCache.EMallServerProxy.UpdateCarriageCost(para); switch (result) { case UpdateResult.Success: GlobalMessageBox.Show("保存成功!"); //TabPage_Close.Invoke(this.CurrentTabPage, this.SourceCtrlType); break; case UpdateResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } else { InsertResult result = GlobalCache.EMallServerProxy.InsertCarriageCost(para); switch (result) { case InsertResult.Success: GlobalMessageBox.Show("保存成功!"); TabPage_Close.Invoke(this.CurrentTabPage, this.SourceCtrlType); break; case InsertResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void Btn_Save_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(this.skinTextBox_ID.SkinTxt.Text.Trim())) { this.skinTextBox_ID.Focus(); return; } else if (String.IsNullOrEmpty(this.skinTextBox_Name.SkinTxt.Text.Trim())) { this.skinTextBox_Name.Focus(); return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } if (curAdminUser == null) { AdminUser adminUser = new AdminUser() { RoleIDs = GetRoles(), ID = this.skinTextBox_ID.SkinTxt.Text.ToLower().Trim(), Remarks = skinTextBox_Remarks.SkinTxt.Text.Trim(), Name = this.skinTextBox_Name.SkinTxt.Text.Trim(), Password = SecurityHelper.MD5String2("888888"), State = (byte)(this.skinCheckBox_State.Checked ? 0 : 1), CreateTime = DateTime.Now, }; if (String.IsNullOrEmpty(adminUser.ID)) { this.skinTextBox_ID.Focus(); return; } else if (String.IsNullOrEmpty(adminUser.Name)) { this.skinTextBox_Name.Focus(); return; } // curAdminUser = AdminUser; InteractResult result = GlobalCache.AdminUser_OnInsert(adminUser); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: GlobalMessageBox.Show("添加成功!"); base.TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType); break; } } else { AdminUser adminUser = new AdminUser() { }; ReflectionHelper.CopyProperty(curAdminUser, adminUser); adminUser.Name = this.skinTextBox_Name.SkinTxt.Text.ToLower().Trim(); adminUser.State = (byte)(this.skinCheckBox_State.Checked ? 0 : 1); adminUser.Remarks = skinTextBox_Remarks.SkinTxt.Text.Trim(); adminUser.RoleIDs = GetRoles(); InteractResult result = GlobalCache.AdminUser_OnUpdate(adminUser); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: GlobalMessageBox.Show("保存成功!"); base.TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType); break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void baseButton1_Click(object sender, EventArgs e) { try { if (GlobalMessageBox.Show("确认拒绝退款?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } //if (GlobalUtil.EngineUnconnectioned(this)) //{ // return; //} EmOrderRefundReasonForm form = new EmOrderRefundReasonForm(); if (form.ShowDialog() == DialogResult.OK) { String refundReason = form.result; RefusedRefundPara para = new RefusedRefundPara() { EmRefundOrderID = Order.EmRefundOrderID, OperateID = CommonGlobalCache.CurrentUserID, RejectCauese = refundReason }; RefundResult result = GlobalCache.EMallServerProxy.RefusedRefund(para); switch (result) { case RefundResult.Success: GlobalMessageBox.Show("已拒绝退款!"); Display(EmRetailOrder.GetRefundState(RefundStateEnum.Refused)); break; case RefundResult.StateIsError: GlobalMessageBox.Show("退款申请状态不符合要求!"); break; case RefundResult.IsRefund: GlobalMessageBox.Show("已经退过货!"); break; case RefundResult.MemberIsNotExist: GlobalMessageBox.Show("会员不存在!"); break; case RefundResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } this.DialogResult = DialogResult.OK; } } catch (Exception ee) { GlobalUtil.ShowError(ee); } //finally //{ // GlobalUtil.UnLockPage(this); //} }
private void BaseButton_Add_Click(object sender, EventArgs e) { try { if (this.curSelectedCostumeStoreList == null || this.curSelectedCostumeStoreList.Count == 0) { return; } if (pfCustomer == null) { GlobalMessageBox.Show("客户不存在,请重新选择!"); skinComboBox_PfCustomer.Focus(); return; } /* if (this.textBoxAmount.Value <= 0) * { * GlobalMessageBox.Show("批发价不能为零!"); * textBoxAmount.Focus(); * return; * }*/ /* if (textBoxAmount.Value == 0) * { * GlobalMessageBox.Show("请输入批发价!"); * textBoxAmount.Focus(); * return; * }*/ if (GlobalUtil.EngineUnconnectioned(this)) { return; } // List<CostumeStore> costumeStoreList = this.curSelectedCostumeStoreList; List <CostumeStore> costumeStoreList = this.curSelectedCostumeStoreList.FindAll((x) => x.Title == "发货"); foreach (CostumeStore store in costumeStoreList) { if (store.SumCount == 0) { continue; } if (store.Remarks == null) { store.Remarks = ""; } PfOrderDetail detail = this.CostumeStoreConvertToInboundDetail(store); detail.CustomerName = pfCustomer.Name; // ShowMessage(CommonGlobalCache.GetCostume(detail.CostumeID).Price.ToString()); detail.Price = CommonGlobalCache.GetCostume(detail.CostumeID).Price; detail.PfPrice = this.textBoxAmount.Value; this.InboundDetailListAddItem(detail); // } } textBoxAmount.Text = string.Empty; skinLabelPrice.Text = string.Empty; //清空dataGirdView1的绑定源 this.dataGridView1.DataSource = null; this.costumeFromSupplierTextBox1.Text = string.Empty; this.curSelectedCostumeStoreList = null; this.BindingInboundDetailSource(); this.costumeFromSupplierTextBox1.Focus(); } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { GlobalUtil.UnLockPage(this); } }
//点击出库按钮 private void Save(bool isHang) { try { bool pfPriceEmpty = false; bool pfPriceSuperLen = false; bool pfMoneySuperLen = false; foreach (var detail in curInboundDetailList) { if (detail.PfPrice == 0) { pfPriceEmpty = true; break; } if (detail.PfPrice > 0 && detail.PfPrice > Convert.ToDecimal(99999999.99)) { // SumPfMoney pfPriceSuperLen = true; break; } if (detail.SumPfMoney > 0 && detail.SumPfMoney > Convert.ToDecimal(99999999.99)) { // SumPfMoney pfMoneySuperLen = true; break; } } if (pfPriceSuperLen) { GlobalMessageBox.Show("批发价不能大于99999999.99!"); return; } if (pfMoneySuperLen) { GlobalMessageBox.Show("列表中批发每款商品总额不能大于99999999.99!"); return; } /* if (pfPriceEmpty) { * GlobalMessageBox.Show("批发价不能为0,请重新输入!"); * return; * }*/ PfInfo item = this.Build(); if (item == null || item.PfOrder.TotalCount == 0 || item.PfOrderDetails.Count == 0) { GlobalMessageBox.Show("发货单为空,不能发货!"); return; } //if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) //{ // return; //} //弹窗录入付款方式 //int payType= ShowPayTypeForm(item); //if (payType == -1) //{ // return; //} item.PfOrder.PayMoney = numericTextBoxMoney.Value; item.PfOrder.PayType = (byte)GetPayType(); if (GlobalUtil.EngineUnconnectioned(this)) { return; } InteractResult result; if (isHang) { result = GlobalCache.ServerProxy.HangUpPfDelivery(item); } else { result = GlobalCache.ServerProxy.PfDelivery(item); } switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: if (isHang) { GlobalMessageBox.Show("挂单成功!"); } else { GlobalMessageBox.Show("发货成功!"); if (skinCheckBoxPrint.Checked) { //Column3.Visible = false; //Column3.Tag = WholesaleDeliveryPrinter.PrinterNoCount; //Column2.Visible = false; //Column2.Tag = WholesaleDeliveryPrinter.PrinterNoCount; //priceDataGridViewTextBoxColumn.Visible = false; //priceDataGridViewTextBoxColumn.Tag = WholesaleDeliveryPrinter.PrinterNoCount; //BoundDetailBrandIDDataGridViewTextBoxColumn.Visible = false; //BoundDetailBrandIDDataGridViewTextBoxColumn.Tag = WholesaleDeliveryPrinter.PrinterNoCount; DataGridView dgv = deepCopyDataGridView(); InteractResult <PfOrder> pfResult = GlobalCache.ServerProxy.GetOnePfOrder(item.PfOrder.ID); decimal BalanceAllOld = 0; decimal BalanceAll = 0; decimal totalPrice = 0; if (pfResult.Data != null) { BalanceAllOld = pfResult.Data.PaymentBalanceOld; BalanceAll = pfResult.Data.PaymentBalance; totalPrice = pfResult.Data.TotalPfPrice; } item.PfOrder.PaymentBalanceOld = BalanceAllOld; item.PfOrder.PaymentBalance = BalanceAll; item.PfOrder.TotalPfPrice = totalPrice; WholesaleDeliveryPrinter.Print(item.PfOrder, dgv, 2); //Column3.Visible = true; //Column2.Visible = true; //priceDataGridViewTextBoxColumn.Visible = true; //BoundDetailBrandIDDataGridViewTextBoxColumn.Visible = true; } } // UpdatePayType(payType,item); ResetAll(true); if (!IsShowOnePage) { TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType); } break; } } catch (Exception ex) { GlobalUtil.ShowError(ex); GlobalMessageBox.Show("发货失败!"); } finally { GlobalUtil.UnLockPage(this); } }
private void BaseButton1_Click(object sender, EventArgs e) { try { GiftTicketTemplateCostumeSelectForm form = new GiftTicketTemplateCostumeSelectForm(tempItem); if (form.ShowDialog(this) == DialogResult.OK) { if (GlobalMessageBox.Show("保存设置吗?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } costumeResult = form.Result; if (costumeResult.Value != null) { SetLabel(costumeResult.Value.Count, costumeResult.Key); } else { if (costumeResult.Key) { this.skinLabelCostume.Text = "所有商品不可使用优惠券"; } else { this.skinLabelCostume.Text = "默认所有商品可使用优惠券"; } } if (tempItem == null) { tempItem = new CostumeGiftTicketInfo(); } List <String> costumeIds = new List <string>(); if (costumeResult.Value != null && costumeResult.Value.Count > 0) { costumeResult.Value.ForEach(t => costumeIds.Add(t.ID)); } tempItem = new CostumeGiftTicketInfo() { IsUse = costumeResult.Key, CostumeIDs = costumeIds }; UpdateResult result = GlobalCache.ServerProxy.UpdateCostumeGiftTicket(tempItem); switch (result) { case UpdateResult.Success: GlobalMessageBox.Show("保存成功!"); GlobalCache.CostumeGiftTicketInfo_OnChange(tempItem); break; case UpdateResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } }
private void BaseButton_OK_Click(object sender, EventArgs e) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } if (this.refundCostume.RefundOrder.TotalCount == 0) { GlobalMessageBox.Show("退货数量为0,不能退货"); return; } if (Math.Abs(skinLabel_TotalMoney.Value) != (skinLabel_RefundIntegration.Value + skinLabel_RefundStoredCard.Value + skinLabel_RefundCash.Value + this.numericTextBoxBankCard.Value + this.numericTextBoxWeixin.Value + this.numericTextBoxAlipay.Value + this.numericTextBoxElse.Value )) { GlobalMessageBox.Show("退款总额必须与总计相等!"); return; } this.refundCostume.RefundOrder.MoneyIntegration = skinLabel_RefundIntegration.Value * -1; this.refundCostume.RefundOrder.MoneyVipCard = skinLabel_RefundStoredCard.Value * -1; this.refundCostume.RefundOrder.MoneyCash = skinLabel_RefundCash.Value * -1; this.refundCostume.RefundOrder.MoneyAlipay = numericTextBoxAlipay.Value * -1; this.refundCostume.RefundOrder.MoneyOther = numericTextBoxElse.Value * -1; this.refundCostume.RefundOrder.MoneyWeiXin = numericTextBoxWeixin.Value * -1; this.refundCostume.RefundOrder.MoneyBankCard = numericTextBoxBankCard.Value * -1; // decimal moneyVipCardDonate = this.refundCostume.RefundOrder.MoneyVipCard * (decimal)member.DonateCoef; // decimal moneyVipCardMain = this.refundCostume.RefundOrder.MoneyVipCard * (1 - (decimal)member.DonateCoef); if (!String.IsNullOrEmpty(refundCostume.RefundOrder.MemeberID)) { Member member = CommonGlobalCache.ServerProxy.GetOneMember(refundCostume.RefundOrder.MemeberID); if (member != null) { decimal moneyVipCardMain = refundCostume.RefundOrder.MoneyVipCard * (decimal)(1.0 - member.DonateCoef); refundCostume.RefundOrder.MoneyCash2 = refundCostume.RefundOrder.MoneyCash; refundCostume.RefundOrder.MoneyVipCardMain = moneyVipCardMain; refundCostume.RefundOrder.MoneyVipCardDonate = refundCostume.RefundOrder.MoneyVipCard * (decimal)(member.DonateCoef); } } else { refundCostume.RefundOrder.MoneyCash2 = refundCostume.RefundOrder.MoneyCash; refundCostume.RefundOrder.MoneyVipCardMain = 0; refundCostume.RefundOrder.MoneyVipCardDonate = 0; } if (refundCostume.RefundOrder.IsNotPay) { decimal total = 0; foreach (RetailDetail curDetail in this.refundCostume.RefundDetailList) { foreach (RetailDetail keepDetail in keepCostume.RefundDetailList) { if (curDetail.RetailOrderID == keepDetail.RetailOrderID && curDetail.CostumeID == keepDetail.CostumeID && curDetail.ColorName == keepDetail.ColorName && curDetail.SizeName == keepDetail.SizeName) { curDetail.SumMoney = keepDetail.SumMoney; total += keepDetail.SumMoney; } } } refundCostume.RefundOrder.TotalMoneyReceived = total * -1; } else { //总计=现金+积分+VIP卡+优惠券 //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券 refundCostume.RefundOrder.TotalMoneyReceived = refundCostume.RefundOrder.MoneyCash + refundCostume.RefundOrder.MoneyIntegration + refundCostume.RefundOrder.MoneyVipCard + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther + this.refundCostume.RefundOrder.MoneyWeiXin + this.refundCostume.RefundOrder.MoneyBankCard; refundCostume.RefundOrder.TotalMoneyReceivedActual = refundCostume.RefundOrder.MoneyCash + this.refundCostume.RefundOrder.MoneyAlipay + this.refundCostume.RefundOrder.MoneyOther + this.refundCostume.RefundOrder.MoneyWeiXin + this.refundCostume.RefundOrder.MoneyBankCard + refundCostume.RefundOrder.MoneyVipCardMain + (refundCostume.RefundOrder.RetailMoneyDeductedByTicket - refundCostume.RefundOrder.MoneyDeductedByTicket); refundCostume.RefundOrder.Benefit = refundCostume.RefundOrder.TotalMoneyReceivedActual - refundCostume.RefundOrder.TotalCost; //平摊 if (refundCostume.RefundDetailList != null) { CalcDirectly(); } //总计=现金+积分+VIP卡+优惠券 //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券 // refundCostume.RefundOrder.TotalMoneyReceived = refundCostume.RefundOrder.MoneyCash + refundCostume.RefundOrder.MoneyIntegration + refundCostume.RefundOrder.MoneyVipCard; } refundCostume.RefundOrder.ShopID = this.ShopID; InteractResult result = GlobalCache.ServerProxy.RefundCostume(this.refundCostume); if (result.ExeResult == ExeResult.Success) { GlobalMessageBox.Show("退货成功!"); this.DialogResult = DialogResult.OK; if (skinCheckBoxPrint.Checked) { RefundOrderPrintUtil printHelper = new RefundOrderPrintUtil(); int times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue); DataGridView dgv = deepCopyDataGridView(); printHelper.Print(refundCostume, times, dgv); } } else if (result.ExeResult == ExeResult.Error) { GlobalMessageBox.Show(result.Msg); } } catch (Exception ee) { GlobalUtil.WriteLog(ee); GlobalMessageBox.Show("内部错误,退货失败!"); } finally { GlobalUtil.UnLockPage(this); } }
private void selectPrintInfo() { switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: PrintTemplateInfo PTempInfo = result.Data; if (PTempInfo.PrintColumnInfos.Count > 0) { // List<PrintColumnsInfo> list = GlobalUtilOfPrint.getPurchaseStockColumnsInfo(); List <PrintColumnsInfo> source = (List <PrintColumnsInfo>) this.dataGridViewColumns.DataSource; //lastPrintColumnsInfo.Clear(); List <PrintColumnsInfo> columnsSelect = new List <PrintColumnsInfo>(); foreach (PrintColumnsInfo cInfo in source) { foreach (PrintColumnInfo item in PTempInfo.PrintColumnInfos) { if (cInfo.name == item.Name) { cInfo.ischeck = true; columnsSelect.Add(cInfo); break; } else { cInfo.ischeck = false; } } } // PTempInfo.PrintColumnInfos[0].n curColumnInfo = PTempInfo.PrintColumnInfos; curColumnsSelect = columnsSelect; setColumnsHeaderInfo(columnsSelect, PTempInfo.PrintColumnInfos); this.dataGridViewColumns.DataSource = source; } else { List <PrintColumnsInfo> source = (List <PrintColumnsInfo>) this.dataGridViewColumns.DataSource; foreach (PrintColumnsInfo cItem in source) { cItem.ischeck = false; } List <PrintColumnInfo> sourceList = null; // this.dataGridView3.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView3.DataSource = sourceList; } if (PTempInfo.SystemVariables.Count > 0) { List <PrintSysInfo> list = (List <PrintSysInfo>) this.dataGridViewSys.DataSource; // lastPrintSysInfo.Clear(); List <PrintSysInfo> columnsSys = new List <PrintSysInfo>(); List <PrintSysInfo> curFirstInfo = new List <PrintSysInfo>(); List <PrintSysInfo> curSecondInfo = new List <PrintSysInfo>(); List <PrintSysInfo> curThirdInfo = new List <PrintSysInfo>(); List <PrintSysInfo> curFourthInfo = new List <PrintSysInfo>(); foreach (PrintSysInfo pSys in list) { foreach (string sysInfo in PTempInfo.SystemVariables) { if (pSys.name == sysInfo) { pSys.ischeck = true; if (pSys.name == "单号" || pSys.name == "日期" || pSys.name == "电话" || pSys.name == "地址" || pSys.name == "顾问") { curFirstInfo.Add(pSys); } else if (pSys.name == "卡号" || pSys.name == "本次积分" || pSys.name == "当前积分" || pSys.name == "累计积分" || pSys.name == "余额") { curSecondInfo.Add(pSys); } else if (pSys.name == "银联卡" || pSys.name == "现金" || pSys.name == "VIP卡" || pSys.name == "支付宝" || pSys.name == "微信" || pSys.name == "积分兑现" || pSys.name == "优惠券" || pSys.name == "其他") { curThirdInfo.Add(pSys); } else if (pSys.name == "数量" || pSys.name == "折扣优惠" || pSys.name == "应收" || pSys.name == "姓名" || pSys.name == "找零" || pSys.name == "结尾附加文字" || pSys.name == "商城二维码" || pSys.name == "店铺") { curFourthInfo.Add(pSys); } // columnsSys.Add(pSys); break; } else { pSys.ischeck = false; } // loadList.Add(pSys); } } loadList.AddRange(curFirstInfo); loadList.AddRange(curSecondInfo); loadList.AddRange(curThirdInfo); loadList.AddRange(curFourthInfo); setLblValue(curFirstInfo, curSecondInfo, curThirdInfo, curFourthInfo, PTempInfo.AdditionalText); this.dataGridViewSys.DataSource = list; //curSysInfo = list; // loadList = list; } else { List <PrintSysInfo> list = (List <PrintSysInfo>) this.dataGridViewSys.DataSource; foreach (PrintSysInfo item in list) { item.ischeck = false; } } if (PTempInfo.PrintCount > 0) { this.numericTxtCount.Text = PTempInfo.PrintCount.ToString(); } // lastPrintColumnsInfo=result.Data. // listColumns = result.Data.PrintColumnInfos; break; default: break; } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (GlobalUtil.EngineUnconnectioned(this)) { return; } List <Costume> list = (List <Costume>) this.dataGridView1.DataSource; Costume item = (Costume)list[e.RowIndex]; if (e.ColumnIndex == ColumnPrintBarcode.Index) { this.PrintBarCode(item); } else if (e.ColumnIndex == Column1.Index) {//编辑 this.OpenModifyDialog(item, this); } else if (e.ColumnIndex == DeleteColumn.Index) { if (GlobalMessageBox.Show("确定删除该商品吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { InteractResult resultCancel = GlobalCache.ServerProxy.DeleteCostume(item.ID); switch (resultCancel.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("删除成功!"); GlobalCache.CostumeList_OnRemove(item); RefreshPage(); break; case ExeResult.Error: GlobalMessageBox.Show(resultCancel.Msg); break; default: break; } } } else if (e.ColumnIndex == Column2.Index) { //判断库存 UpdateCostumeValidPara para = new UpdateCostumeValidPara() { CostumeID = item.ID, IsValid = false }; InteractResult result = GlobalCache.ServerProxy.UpdateCostumeValid(para); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("禁用成功!"); item.IsValid = false; GlobalCache.CostumeList_OnChange(item); RefreshPage(); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } else if (e.ColumnIndex == Column3.Index) { UpdateCostumeValidPara paraCancel = new UpdateCostumeValidPara() { CostumeID = item.ID, IsValid = true }; InteractResult resultCancel = GlobalCache.ServerProxy.UpdateCostumeValid(paraCancel); switch (resultCancel.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("取消禁用成功!"); item.IsValid = true; GlobalCache.CostumeList_OnChange(item); RefreshPage(); break; case ExeResult.Error: GlobalMessageBox.Show(resultCancel.Msg); break; default: break; } } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void Export(PfCustomerOrder order) { try { List <String> keys = new List <string>(); List <String> values = new List <string>(); keys.Add("CostumeID"); keys.Add("CostumeName"); keys.Add("单位"); keys.Add("渠道供货商"); keys.Add("ColorID"); keys.Add("ColorName"); keys.Add("Size"); // keys.Add("F"); keys.Add("XS"); keys.Add("S"); keys.Add("M"); keys.Add("L"); keys.Add("XL"); keys.Add("2XL"); keys.Add("3XL"); keys.Add("4XL"); keys.Add("5XL"); keys.Add("6XL"); keys.Add("SameSize"); keys.Add("Count"); keys.Add("NOticeCount"); keys.Add("DiffCount"); keys.Add("SalePrice"); keys.Add("Discount"); keys.Add("SaleSinglePrice"); keys.Add("SaleTotalPrice"); keys.Add("Remark"); #region values.Add("商品代码"); values.Add("商品名称"); values.Add("单位"); values.Add("渠道供货商"); values.Add("色号"); values.Add("颜色"); values.Add("尺码档"); // values.Add("F"); values.Add("XS"); values.Add("S"); values.Add("M"); values.Add("L"); values.Add("XL"); values.Add("2XL"); values.Add("3XL"); values.Add("4XL"); values.Add("5XL"); values.Add("6XL"); values.Add("均码"); values.Add("数量"); values.Add("通知数"); values.Add("差异数"); values.Add("标准价"); values.Add("折扣"); values.Add("单价"); values.Add("金额"); values.Add("摘要"); #endregion DataTable dt = new DataTable(); dt.Columns.Add("CostumeID"); dt.Columns.Add("CostumeName"); dt.Columns.Add("单位"); dt.Columns.Add("渠道供货商"); dt.Columns.Add("ColorID"); dt.Columns.Add("ColorName"); dt.Columns.Add("Size"); // dt.Columns.Add("F"); dt.Columns.Add("XS"); dt.Columns.Add("S"); dt.Columns.Add("M"); dt.Columns.Add("L"); dt.Columns.Add("XL"); dt.Columns.Add("2XL"); dt.Columns.Add("3XL"); dt.Columns.Add("4XL"); dt.Columns.Add("5XL"); dt.Columns.Add("6XL"); dt.Columns.Add("SameSize"); dt.Columns.Add("Count"); dt.Columns.Add("NOticeCount"); dt.Columns.Add("DiffCount"); dt.Columns.Add("SalePrice"); dt.Columns.Add("Discount"); dt.Columns.Add("SaleSinglePrice"); dt.Columns.Add("SaleTotalPrice"); dt.Columns.Add("Remark"); int noticeNum = 0; // List<EmRetailDetail> listPage = GlobalCache.EMallServerProxy.GetEmRetailDetail(order.ID); InteractResult <EmOrderExportData> exportList = GlobalCache.ServerProxy.GetEmPfOrderExportData(order.ID); // exportList.Data.Details if (exportList.Data != null && exportList.Data.Details != null && exportList.Data.Details.Count > 0) { foreach (EmOrderExportDetail eDetail in exportList.Data.Details) { DataRow dr = dt.NewRow(); dr["CostumeID"] = eDetail.CostumeID; dr["CostumeName"] = eDetail.CostumeName; dr["ColorID"] = eDetail.ColorID; dr["ColorName"] = eDetail.ColorName; dr["Size"] = ""; // dr["F"] = eDetail.F; dr["XS"] = eDetail.XS.ToString() == "0" ? "" : eDetail.XS.ToString(); dr["S"] = eDetail.S.ToString() == "0" ? "" : eDetail.S.ToString(); dr["M"] = eDetail.M.ToString() == "0" ? "" : eDetail.M.ToString(); dr["L"] = eDetail.L.ToString() == "0" ? "" : eDetail.L.ToString(); dr["XL"] = eDetail.XL.ToString() == "0" ? "" : eDetail.XL.ToString(); dr["2XL"] = eDetail.XL2.ToString() == "0" ? "" : eDetail.XL2.ToString(); dr["3XL"] = eDetail.XL3.ToString() == "0" ? "" : eDetail.XL3.ToString(); dr["4XL"] = eDetail.XL4.ToString() == "0" ? "" : eDetail.XL4.ToString(); dr["5XL"] = eDetail.XL5.ToString() == "0" ? "" : eDetail.XL5.ToString(); dr["6XL"] = eDetail.XL6.ToString() == "0" ? "" : eDetail.XL6.ToString(); dr["SameSize"] = eDetail.F.ToString() == "0" ? "" : eDetail.F.ToString(); dr["Count"] = eDetail.Count.ToString() == "0" ? "" : eDetail.Count.ToString(); dr["NOticeCount"] = eDetail.NoticeCount; dr["DiffCount"] = eDetail.DifferenceCount; dr["SalePrice"] = eDetail.OnlinePrice; dr["Discount"] = eDetail.Discount; dr["SaleSinglePrice"] = eDetail.Price; dr["SaleTotalPrice"] = eDetail.SumMoney; dr["Remark"] = eDetail.Remarks; dt.Rows.Add(dr); noticeNum += eDetail.NoticeCount; } } NPOIHelper.hsRowCount = 22; List <CellType> cellList = EmExportUtil.getSaleCellList(exportList.Data); NPOIHelper.CellValues = cellList; List <CellType> cellButtomList = new List <CellType>(); NPOIHelper.bottomHsRowCount = 1; CellType curCellIT = new CellType(); curCellIT.RowIndex = dt.Rows.Count + 23; curCellIT.CellName = "合计:"; curCellIT.IsCollect = true; curCellIT.CellMergeNum = 1; cellButtomList.Add(curCellIT); for (int k = 0; k < 18; k++) { CellType curCellI = new CellType(); curCellI.RowIndex = dt.Rows.Count + 23; curCellI.CellName = ""; curCellI.CellMergeNum = 1; cellButtomList.Add(curCellI); } CellType curCellTotal = new CellType(); curCellTotal.RowIndex = dt.Rows.Count + 23;//1是要多加一行标题列 curCellTotal.CellName = noticeNum.ToString(); curCellTotal.IsCollect = true; curCellTotal.CellMergeNum = 1; cellButtomList.Add(curCellTotal); NPOIHelper.BottomCellValues = cellButtomList; NPOIHelper.Keys = keys.ToArray(); NPOIHelper.Values = values.ToArray(); NPOIHelper.ExportExcel(dt, path); GlobalMessageBox.Show("导出完毕!"); } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void BaseButton1_Click(object sender, EventArgs e) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } PfCustomer pfCustomer = Build(); if (!ValidateItem(pfCustomer)) { return; } if (curPfCustomer == null) { InteractResult result = PfCustomerCache.PfCustomer_OnInsert(pfCustomer); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("添加成功!"); if (node != null) { TreeModel CurChildrenClass = new TreeModel(); TreeNode newNode = new TreeNode(pfCustomer.Name); CurChildrenClass.Name = pfCustomer.Name; CurChildrenClass.ID = pfCustomer.ID; CurChildrenClass.ParentID = curItemID; newNode.Tag = CurChildrenClass; newNode.Text = pfCustomer.Name + "/" + pfCustomer.ContactPhone + "(0.00)"; node.Nodes.Add(newNode); CommonGlobalCache.InsertPFDistributor(CurChildrenClass); } ConfirmClick?.Invoke(curPfCustomer, this); this.Close(); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } else { pfCustomer.CreateTime = curPfCustomer.CreateTime; InteractResult result = PfCustomerCache.PfCustomer_OnUpdate(pfCustomer); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: GlobalMessageBox.Show("保存成功!"); this.DialogResult = DialogResult.OK; if (node != null) { List <TreeModel> treeModelL = CommonGlobalCache.DistributorPFList.FindAll(t => t.ID == pfCustomer.ID); TreeModel bigClass = node.Tag as TreeModel; bigClass.ID = pfCustomer.ID; bigClass.Name = pfCustomer.Name; bigClass.AccruedCommission = curPfCustomer.AccruedCommission; string accruedC = "0.00"; if (treeModelL.Count > 0) { accruedC = treeModelL[0].AccruedCommission.ToString(); } //JGNet.Common.ServerProxy.GetPfCustomer InteractResult <PfCustomer> selectPfCus = CommonGlobalCache.ServerProxy.GetPfCustomer(pfCustomer.ID); if (selectPfCus != null) { accruedC = Math.Round(selectPfCus.Data.AccruedCommission, 2).ToString(); } node.Text = pfCustomer.Name + "/" + pfCustomer.ContactPhone + "(" + accruedC + ")"; node.Tag = bigClass; CommonGlobalCache.UpdatePFDistributor(bigClass); } this.curPfCustomer = pfCustomer; ConfirmClick?.Invoke(curPfCustomer, this); this.Close(); break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (GlobalUtil.EngineUnconnectioned(this)) { return; } List <CommissionTemplate> list = (List <CommissionTemplate>)(dataGridView1.DataSource); CommissionTemplate item = (CommissionTemplate)list[e.RowIndex]; if (e.ColumnIndex == Column1.Index) { AddLevelModelForm AddCommissionTemplate = new AddLevelModelForm(0, OperationEnum.Edit, ListCount, item); if (AddCommissionTemplate.ShowDialog(this) == DialogResult.OK) { RefreshPageGetData(); } } else if (e.ColumnIndex == ColumnDelete.Index) { InteractResult <bool> IsUseresult = CommonGlobalCache.ServerProxy.IsCommissionTemplateUse(item.AutoID); if (IsUseresult.Data) { GlobalMessageBox.Show("有商品在使用该模板,不能删除!"); return; } else { if (item.IsDefault) { if (GlobalMessageBox.Show("删除默认模板会导致后续的批发分销佣金为0,若删除请重新设置默认模板,是否确认删除?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } else { Delete(list, item); } } else { if (GlobalMessageBox.Show("确定删除该模板吗?", "提示", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } else { Delete(list, item); } } } } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void BaseButtonSaveAccount_Click(object sender, EventArgs e) { try { String supllier = ValidateUtil.CheckEmptyValue(this.skinComboBoxSaveSupplier.SelectedValue); if (String.IsNullOrEmpty(supllier)) { skinComboBoxSaveSupplier.Focus(); GlobalMessageBox.Show("请先选择供应商!"); return; } if (numericTextBox1.Value == 0) { numericTextBox1.Focus(); return; } else { if (numericTextBox1.Value > Convert.ToDecimal(99999999.99)) { numericTextBox1.Focus(); GlobalMessageBox.Show("金额不能大于99999999.99!"); return; } } if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } decimal money = this.numericTextBox1.Value; SupplierAccountRecord record = new SupplierAccountRecord() { CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, AccountMoney = money, AccountType = (byte)(AccountType)this.skinComboBoxSaveType.SelectedValue, //SupplierID = supllier, SupplierID = ValidateUtil.CheckEmptyValue(this.skinComboBoxSaveSupplier.SelectedValue), AdminUserID = GlobalCache.CurrentUserID, Remarks = this.skinTextBoxRemark.Text, PayType = (byte)(SupplierAccountRecordPayType)this.skinComboBox1.SelectedValue }; if (CurItem != null) { string orderPrefix = CurItem.SourceOrderID.Substring(0, 2); if (orderPrefix != OrderPrefix.SupplierAccountRecordSource && isChangeSupplierOrType(CurItem)) { GlobalMessageBox.Show("该记录为采购单相关的付款记录单,不允许修改!"); this.CloseForm(); return; } UpdateSupplierAccountRecordPara para = new UpdateSupplierAccountRecordPara() { ID = CurItem.AutoID, AccountMoney = record.AccountMoney, SupplierID = record.SupplierID, AccountType = (AccountType)record.AccountType, CreateTime = record.CreateTime, Remarks = record.Remarks, PayType = (SupplierAccountRecordPayType)this.skinComboBox1.SelectedValue }; InteractResult result = GlobalCache.ServerProxy.UpdateSupplierAccountRecord(para); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("修改成功!"); // this.ReLoad(); this.DialogResult = DialogResult.OK; break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } else { InteractResult result = GlobalCache.ServerProxy.InsertSupplierAccountRecord(record); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("登记成功!"); // this.ReLoad(); this.DialogResult = DialogResult.OK; break; case ExeResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { numericTextBox1.SkinTxt.Text = string.Empty; this.skinTextBoxRemark.SkinTxt.Text = string.Empty; GlobalUtil.UnLockPage(this); } }
public void Btn_Save_Click(object sender, EventArgs e) { try { if (curAdminUser != null) { //if (curAdminUser.Password != SecurityHelper.MD5String2(this.skinTextBox_ID.SkinTxt.Text.Trim())) //{ // this.skinTextBox_ID.Focus(); // this.skinTextBox_ID.ResetText(); // GlobalMessageBox.Show("原密码错误!"); // this.skinTextBox_Name.ResetText(); // this.skinTextBox_Password.ResetText(); // return; //} if (String.IsNullOrEmpty(this.skinTextBox_Name.SkinTxt.Text.Trim())) { this.skinTextBox_Name.Focus(); this.skinTextBox_Name.ResetText(); return; } else if (String.IsNullOrEmpty(this.skinTextBox_Password.SkinTxt.Text.Trim())) { this.skinTextBox_Password.Focus(); this.skinTextBox_Password.ResetText(); return; } else if (this.skinTextBox_Password.SkinTxt.Text.Trim() != this.skinTextBox_Name.SkinTxt.Text.Trim()) { GlobalMessageBox.Show("两次新密码输入不相同,请重新确认!"); this.skinTextBox_Name.Focus(); return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } this.curAdminUser.Password = SecurityHelper.MD5String2(this.skinTextBox_Password.SkinTxt.Text.Trim()); InteractResult result = GlobalCache.ServerProxy.UpdateGuidePwd(curAdminUser.ID, this.curAdminUser.Password); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: // GlobalMessageBox.Show("保存成功!"); this.TabPage_Close?.Invoke(CurrentTabPage, SourceCtrlType); break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
//提交补货申请 private void Save(bool isHang) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } if (string.IsNullOrEmpty(this.shopID)) { GlobalMessageBox.Show("请选择店铺!"); return; } /* if (this.guideComboBox1.SelectedIndex == 0) * { * GlobalMessageBox.Show("操作人不能为空!"); * return; * } */ ReplenishCostume item = this.BuildReplenishCostume(); if (item == null) { GlobalMessageBox.Show("补货明细不能为空!"); return; } if (item.ReplenishOrder.TotalCount <= 0) { GlobalMessageBox.Show("补货数量应大于0"); return; } DialogResult dialogResult = GlobalMessageBox.Show("您确定该申请操作?", "提示", MessageBoxButtons.OKCancel); if (dialogResult != DialogResult.OK) { return; } InteractResult result; if (isHang) { result = GlobalCache.ServerProxy.HangUpReplenish(item); } else { result = GlobalCache.ServerProxy.ReplenishCostume(item); } switch (result.ExeResult) { case ExeResult.Success: if (isHang) { GlobalMessageBox.Show("挂单成功!"); } else { GlobalMessageBox.Show("补货申请成功!"); if (skinCheckBoxPrint.Checked) { DataGridView dgv = deepCopyDataGridView(); ReplenishOrderPrinter.Print(item.ReplenishOrder, dgv, 2); } } ResetAll(true); if (!IsShowOnePage) { TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType); } break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } catch (Exception ee) { GlobalUtil.ShowError(ee); } finally { GlobalUtil.UnLockPage(this); } }
private void Btn_Save_Click(object sender, EventArgs e) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } if (curItem == null) { SalesPromotion item = new SalesPromotion() { }; SetItem(item); if (!Validate(item)) { return; } item.CreateTime = DateTime.Now; item.ID = IDHelper.GetID(OrderPrefix.SalesPromotion, OrderPrefix.ShopCode4Admin); InsertResult result = GlobalCache.ServerProxy.InsertSalesPromotion(item); switch (result) { case InsertResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: CommonGlobalCache.InsertSalesPromotion(item); GlobalMessageBox.Show("添加成功!"); TabPage_Close(this.CurrentTabPage, this.SourceCtrlType); break; } } else { SetItem(curItem); if (!Validate(curItem)) { return; } UpdateResult result = GlobalCache.ServerProxy.UpdateSalesPromotion(curItem); switch (result) { case UpdateResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: CommonGlobalCache.UpdateSalesPromotion(curItem); GlobalMessageBox.Show("保存成功!"); TabPage_Close(this.CurrentTabPage, this.SourceCtrlType); break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void selectPrintInfo() { switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: PrintTemplateInfo PTempInfo = result.Data; if (PTempInfo.PrintColumnInfos.Count > 0) { // List<PrintColumnsInfo> list = GlobalUtilOfPrint.getPurchaseStockColumnsInfo(); List <PrintColumnsInfo> source = (List <PrintColumnsInfo>) this.dataGridViewColumns.DataSource; //lastPrintColumnsInfo.Clear(); List <PrintColumnsInfo> columnsSelect = new List <PrintColumnsInfo>(); foreach (PrintColumnsInfo cInfo in source) { foreach (PrintColumnInfo item in PTempInfo.PrintColumnInfos) { if (cInfo.name == item.Name) { cInfo.ischeck = true; columnsSelect.Add(cInfo); break; } else { cInfo.ischeck = false; } } } curColumnInfo = PTempInfo.PrintColumnInfos; curColumnsSelect = columnsSelect; setColumnsHeaderInfo(columnsSelect, PTempInfo.PrintColumnInfos); this.dataGridViewColumns.DataSource = source; } else { List <PrintColumnsInfo> source = (List <PrintColumnsInfo>) this.dataGridViewColumns.DataSource; foreach (PrintColumnsInfo cItem in source) { cItem.ischeck = false; } List <PrintColumnInfo> sourceList = null; this.dataGridView3.DataSource = sourceList; } if (PTempInfo.SystemVariables.Count > 0) { List <PrintSysInfo> list = (List <PrintSysInfo>) this.dataGridViewSys.DataSource; // lastPrintSysInfo.Clear(); List <PrintSysInfo> columnsSys = new List <PrintSysInfo>(); foreach (PrintSysInfo pSys in list) { foreach (string sysInfo in PTempInfo.SystemVariables) { if (pSys.name == sysInfo) { pSys.ischeck = true; columnsSys.Add(pSys); break; } else { pSys.ischeck = false; } } } loadList.AddRange(columnsSys); setLblValue(columnsSys); this.dataGridViewSys.DataSource = list; } else { List <PrintSysInfo> list = (List <PrintSysInfo>) this.dataGridViewSys.DataSource; foreach (PrintSysInfo item in list) { item.ischeck = false; } } if (PTempInfo.OrderName != null && PTempInfo.OrderName != "") { this.lblCurDataName.Text = PTempInfo.OrderName; this.txtDataName.Text = PTempInfo.OrderName; } if (PTempInfo.PrintCount > 0) { this.numericTxtCount.Text = PTempInfo.PrintCount.ToString(); } // lastPrintColumnsInfo=result.Data. // listColumns = result.Data.PrintColumnInfos; break; default: break; } }
private void DoImport() { try { List <Brand> emptyStore = new List <Brand>(); List <Brand> stores = new List <Brand>(); List <Brand> repeatItems = new List <Brand>(); DataTable dt = NPOIHelper.FormatToDatatable(path, 0); for (int i = 1; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; int index = 0; Brand store = new Brand(); try { if (!CommonGlobalUtil.ImportValidate(row, 2)) { store.AutoID = (i + 2); store.Name = CommonGlobalUtil.ConvertToString(row[index++]); store.OrderNo = CommonGlobalUtil.ConvertToInt32(row[index++]); if (String.IsNullOrEmpty(store.Name)) { //必填项为空 emptyStore.Add(store); continue; } else { //判断是否重复款号/颜色 if (stores.Find(t => t.Name == store.Name) != null) { repeatItems.Add(store); continue; } stores.Add(store); } } } catch (Exception ex) { } } if (emptyStore.Count > 0) { String str = string.Empty; foreach (var item in emptyStore) { str += "第" + item.AutoID + "行\r\n"; } ShowError("必填项没有填写,请补充完整!\r\n" + str); return; } if (repeatItems.Count > 0) { String str = string.Empty; foreach (var item in repeatItems) { str += "第" + item.AutoID + "行" + "\r\n"; } ShowError("名称重复,系统已过滤,详见错误报告!\r\n" + str); // return; } if (stores != null && stores.Count > 0) { } else { ShowMessage("没有数据可以导入,请检查列表信息!"); return; } path = null; //檢查結果 InteractResult result = GlobalCache.ServerProxy.ImportBrand(stores); switch (result.ExeResult) { case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; case ExeResult.Success: RefreshPage(); ShowMessage("导入成功!"); break; default: break; } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void BaseButtonSave_Click(object sender, EventArgs e) { try { item = GetEntity(); if (!Validate(item)) { return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } if (this.CurItem != null) { //线上商城原属性不替换 item.EmShowOnline = CurItem.EmShowOnline; item.EmOnlinePrice = CurItem.EmOnlinePrice; item.EmTitle = CurItem.EmTitle; item.EmThumbnail = CurItem.EmThumbnail == null ? string.Empty : CurItem.EmThumbnail; item.CreateTime = CurItem.CreateTime; item.SizeNames = CurItem.SizeNames; CostumeColor color = this.colorComboBox1.SelectedItem; List <string> colorList = CurItem.ColorList; if (colorList != null) { if (curStore.ColorName != color.Name) { colorList.Remove(curStore.ColorName); colorList.Add(color.Name); } } item.Colors = CommonGlobalUtil.GetColorFromGridView(colorList); short F = 0, XS = 0, S = 0, M = 0, L = 0, XL = 0, XL2 = 0, XL3 = 0, XL4 = 0, XL5 = 0, XL6 = 0; if (this.dataGridView2 != null && this.dataGridView2.Rows.Count > 0) { CostumeStore curStoreItem = this.dataGridView2.Rows[0].DataBoundItem as CostumeStore; if (curStoreItem != null) { F = curStoreItem.F; XS = curStoreItem.XS; S = curStoreItem.S; M = curStoreItem.M; L = curStoreItem.L; XL = curStoreItem.XL; XL2 = curStoreItem.XL2; XL3 = curStoreItem.XL3; XL4 = curStoreItem.XL4; XL5 = curStoreItem.XL5; XL6 = curStoreItem.XL6; } } UpdateStartStoreCostumePara updateStorePara = new UpdateStartStoreCostumePara() { BrandID = item.BrandID, ClassID = item.ClassID, CostPrice = item.CostPrice, ID = item.ID, Name = item.Name, Price = item.Price, Remarks = item.Remarks, SalePrice = item.SalePrice, Season = item.Season, SizeGroupName = item.SizeGroupName, SizeNames = item.SizeNames, SupplierID = item.SupplierID, Year = item.Year, OldColorName = curStore.ColorName, NewColorName = color.Name, F = F, XS = XS, S = S, L = L, M = M, XL = XL, XL2 = XL2, XL3 = XL3, XL4 = XL4, XL5 = XL5, XL6 = XL6, ShopID = curStore.ShopID }; InteractResult result = GlobalCache.ServerProxy.UpdateStartStoreCostume(updateStorePara); // InteractResult result = GlobalCache.ServerProxy.UpdateCostume(item); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("保存成功!"); GlobalCache.CostumeList_OnChange(item); CurItem = item; this.Hide(); this.Close(); this.DialogResult = DialogResult.OK; break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } else { CostumeStore costumeStore = dataGridView2.Rows[0].DataBoundItem as CostumeStore; CostumeStore item = new CostumeStore(); ReflectionHelper.CopyProperty(costumeStore, item); item.CostumeID = skinTextBox_ID.Text; item.CostumeName = skinTextBox_Name.Text; item.Year = (int)(this.skinComboBox_Year.SelectedValue); item.Price = numericUpDown_Price.Value; // item.SalePrice = item.CostPrice = numericUpDownCostPrice.Value; item.ClassID = skinComboBoxBigClass.SelectedValue.ClassID; item.ClassCode = GetClassCode(item.ClassID); //线上商城原属性不替换 // item.BigClass = this.skinComboBoxBigClass.SelectedValue?.BigClass; // item.SmallClass = this.skinComboBoxBigClass.SelectedValue?.SmallClass; // item.SubSmallClass = this.skinComboBoxBigClass.SelectedValue?.SubSmallClass; if (this.skinComboBox_Brand.SelectedItem != null) { item.BrandID = this.skinComboBox_Brand.SelectedItem.AutoID; item.BrandName = this.skinComboBox_Brand.SelectedItem.Name; } item.Season = ValidateUtil.CheckEmptyValue(this.skinComboBox_Season.SelectedValue); item.SupplierID = skinComboBox_SupplierID.SelectedItem?.ID; item.SupplierName = skinComboBox_SupplierID.SelectedItem?.Name; item.ColorName = this.colorComboBox1.SelectedItem?.Name; item.CostumeColorName = this.colorComboBox1.SelectedItem?.Name; List <CostumeStoreExcel> costumeStoreExcels = new List <CostumeStoreExcel>(); //item.SizeGroupName= selectSizeGroup.SelectedSizeNames if (selectSizeGroup != null && selectSizeGroup.SizeGroup != null) { item.SizeGroupName = selectSizeGroup.SizeGroup.SizeGroupName; item.SizeGroupShowName = selectSizeGroup.SizeGroup.ShowName; item.SizeNames = selectSizeGroup.SelectedSizeNames; } item.SalePrice = this.numericTextBoxSalePrice.Value; costumeStoreExcels.Add(GetCostumeStoreExcel(item)); CreateCostumeStore store = new CreateCostumeStore() { ShopID = shopID, Date = new CJBasic.Date(), CostumeStoreExcels = costumeStoreExcels, IsImport = true }; InteractResult result = GlobalCache.ServerProxy.InsertCostumeStores(store); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("新增成功!"); ResetAll(); this.Close(); SaveClick?.Invoke(item); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void btn_Save_Click(object sender, EventArgs e) { try { if (GlobalUtil.EngineUnconnectioned(this)) { return; } decimal moneyCash = decimal.Parse(this.skinTextBox_MoneyCash.SkinTxt.Text); if (moneyCash <= 0) { GlobalMessageBox.Show("输入的金额必须大于0!"); return; } else { if (moneyCash > Convert.ToDecimal(99999999.99)) { GlobalMessageBox.Show("输入的金额不能大于99999999.99!"); return; } } //if (this.guideComboBox1.SelectedIndex == 0) //{ // GlobalMessageBox.Show("操作人不能为空"); // return; //} CashRecordFeeType feeType = (CashRecordFeeType)(this.skinComboBox_FeeType.SelectedValue); if (feeType != CashRecordFeeType.Income) { moneyCash = moneyCash * -1; } CashRecord cashRecord = new CashRecord() { ShopID = GlobalCache.CurrentShopID, FeeType = (byte)feeType, FeeDetailType = this.skinComboBox_FeeDetailType.SelectedValue.ToString(), MoneyCash = moneyCash, Remarks = this.skinTextBox_Remarks.SkinTxt.Text.Trim(), CreateTime = DateTime.Now, OperatorUserID = CommonGlobalCache.CurrentUserID //(string)this.guideComboBox1.SelectedValue, }; InsertResult result = GlobalCache.ServerProxy.InsertCashRecord(cashRecord); switch (result) { case InsertResult.Success: GlobalMessageBox.Show("新增成功!"); TabPageClose(this.CurrentTabPage, this.SourceCtrlType); break; case InsertResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ee) { GlobalUtil.WriteLog(ee); GlobalMessageBox.Show("新增失败!"); } finally { GlobalUtil.UnLockPage(this); } }
private void Save(bool isHang) { try { if (!CheckValidate()) { return; } ReturnCostume item = this.Build(); if (item == null || item.OutboundOrder.TotalCount == 0) { GlobalMessageBox.Show("采购单为空,不能退货!"); return; } if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } if (GlobalUtil.EngineUnconnectioned(this)) { return; } InteractResult result; if (isHang) { result = GlobalCache.ServerProxy.HangUpReturn(item); } else { //输入金额 //SelectMoneyForm form = new SelectMoneyForm(); //if (form.ShowDialog(this.FindForm()) == DialogResult.OK) //{ item.ReturnOrder.PayMoney = numericTextBoxMoney.Value; // form.result; //} //else //{ // return; //} result = GlobalCache.ServerProxy.ReturnCostume(item); } switch (result.ExeResult) { case ExeResult.Success: if (isHang) { GlobalMessageBox.Show("挂单成功!"); } else { GlobalMessageBox.Show("退货成功!"); numericTextBoxMoney.Text = string.Empty; if (skinCheckBoxPrint.Checked) { DataGridView dgv = deepCopyDataGridView(); //SumMoney.Visible = false; //SumMoney.Tag = PurchaseReturnOrderPrinter.PrinterNoCount; //Column2.Visible = false; //Column2.Tag = PurchaseReturnOrderPrinter.PrinterNoCount; PurchaseReturnOrderPrinter.Print(item.ReturnOrder, dgv, 2); //SumMoney.Visible = true; //Column2.Visible = true; } } ResetAll(true); if (!IsShowOnePage) { TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType); } break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (GlobalUtil.EngineUnconnectioned(this)) { return; } List <Shop> list = DataGridViewUtil.BindingListToList <Shop>(dataGridView1.DataSource); Shop item = (Shop)list[e.RowIndex]; if (e.ColumnIndex == Column1.Index) { this.SaveClick(item, this); } else if (e.ColumnIndex == ColumnDisable.Index) { if (GlobalMessageBox.Show("确定禁用吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { InteractResult result = GlobalCache.Shop_OnDisable(item.ID); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("禁用成功!"); this.dataGridView1.DataSource = null; item.Enabled = false; this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(list); break; case ExeResult.Error: GlobalMessageBox.Show(result.Msg); break; default: break; } } } else if (e.ColumnIndex == EnabledLink.Index) { if (GlobalMessageBox.Show("确定启用吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { item.Enabled = true; InteractResult result = GlobalCache.ServerProxy.EnableShop(item.ID); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show("启用成功!"); this.dataGridView1.DataSource = null; item.Enabled = true; this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(list); break; case ExeResult.Error: item.Enabled = false; GlobalMessageBox.Show(result.Msg); break; default: break; } } } else if (e.ColumnIndex == ColumnDelete.Index) { Delete(item); } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } finally { GlobalUtil.UnLockPage(this); } }