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; //} PfCustomerRetailDetail detail = new PfCustomerRetailDetail() { CostumeID = this.currentSelectedItem.Costume.ID, CostumeName = this.currentSelectedItem.Costume.Name, ColorName = this.skinComboBox_Color.Text, SizeName = ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), // 显示自己设置的尺码组和对应的尺码列表 SizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(ValidateUtil.CheckEmptyValue(this.skinComboBox_Size.SelectedValue), CommonGlobalCache.GetSizeGroup(this.currentSelectedItem.Costume.SizeGroupName)), BuyCount = buyCount, }; if (!this.AddSelectedCostumeToList(detail)) { return; } dataGridViewPagingSumCtrl.BindingDataSource(this.PfCustomerRetailDetailList); this.skinTextBox_bugCount.SkinTxt.Text = "1"; } catch (Exception ee) { CommonGlobalUtil.WriteLog(ee); GlobalMessageBox.Show("添加失败!"); } }
private void ShowDiff() {//显示盘点录入中有差异的商品 List <CheckStoreDiff> diffList = new List <CheckStoreDiff>(); foreach (var item in costumeStores) { if (!CheckBrand(item)) { continue; } CheckStoreDetail real = item; CostumeStoreHistory shot = shots.Find(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && item.ColorName == t.ColorName); if (shot == null) { WebResponseObj <List <CostumeStoreHistory> > result = CommonGlobalCache.ServerProxy.GetCostumeStoreHistory4CheckStore( this.shopId, item.CostumeID, new Date(this.date), true ); if (result?.Data != null && result?.Data.Count > 0) { shot = result.Data.Find(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && item.ColorName == t.ColorName); } } CheckStoreDetail quick = ToCheckStoreDetail(shot); CheckStoreDetail liaojian = new CheckStoreDetail(); CheckStoreDetail diff = null; diff = SetCostumeStoreDiff(real, liaojian, quick, "差异"); foreach (string sizeName in CostumeStoreHelper.CostumeSizeColumn) { String dbSize = sizeName; //CostumeStoreHelper.GetCostumeSize(sizeName, sizeGroup); int differenceCount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(diff, sizeName + "WinLost")); if (differenceCount != 0) { int realcount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(real, sizeName)); int changeCount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(liaojian, sizeName)); int storeCount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(quick, sizeName + "Atm")); CheckStoreDiff storeDiff = new CheckStoreDiff(); ReflectionHelper.CopyProperty(real, storeDiff); Costume costume = CommonGlobalCache.GetCostume(storeDiff.CostumeID); String sizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(sizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName)); storeDiff.SizeName = sizeDisplayName; storeDiff.BrandName = CommonGlobalCache.GetBrandName(costume.BrandID); storeDiff.DiffCount = differenceCount; storeDiff.RealCount = realcount; storeDiff.QuickCount = storeCount; storeDiff.ChangeCount = changeCount; diffList.Add(storeDiff); } } } dataGridViewPagingSumCtrl2.BindingDataSource(diffList); }
private void PrintRetail(RetailOrder retailOrder) { OrderPrintUtil printHelper = new OrderPrintUtil(); 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)); } RetailCostume retailCostume = new RetailCostume() { RetailDetailList = retailDetailList, RetailOrder = retailOrder }; int times = CommonGlobalUtil.ConvertToInt32(CommonGlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue); DataGridView dgv = deepCopyDataGridView(); printHelper.Print(retailCostume, times, dgv); }
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(); } }
public string DisplaySizeName(SizeGroup sizeGroup) { return(CostumeStoreHelper.GetCostumeSizeName(this.SizeName, sizeGroup)); }
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(); } }
private void UpdateNewStore() { //还原所有颜色 foreach (DataGridViewRow item in dataGridView2.Rows) { SetNormalCellStyle(item); } //如果是同颜色同尺码,则不变 bool isTheSame = skinComboBox_Color.SelectedValue.ToString().Equals(skinComboBox_Color1.SelectedValue.ToString()) && skinComboBox_Size.SelectedValue.ToString().Equals(skinComboBox_Size1.SelectedValue.ToString()); //CommonGlobalUtil.Debug("isTheSame" + isTheSame); if (isTheSame) { return; } //获取下调信息 CostumeStore orgStore = orgStores.Find(t => t.ColorName == ValidateUtil.CheckEmptyValue(skinComboBox_Color.SelectedValue)); CostumeStore store = newStores.Find(t => t.ColorName == ValidateUtil.CheckEmptyValue(skinComboBox_Color.SelectedValue)); DataGridViewColumn col = null; switch (CostumeStoreHelper.GetCostumeSize(skinComboBox_Size.SelectedValue.ToString(), CommonGlobalCache.DefaultSizeGroup)) { case CostumeSize.XS: col = xSDataGridViewTextBoxColumn; break; case CostumeSize.S: col = sDataGridViewTextBoxColumn; break; case CostumeSize.M: col = mDataGridViewTextBoxColumn; break; case CostumeSize.L: col = lDataGridViewTextBoxColumn; break; case CostumeSize.XL: col = xLDataGridViewTextBoxColumn; break; case CostumeSize.XL2: col = xL2DataGridViewTextBoxColumn; break; case CostumeSize.XL3: col = xL3DataGridViewTextBoxColumn; break; case CostumeSize.XL4: col = xL4DataGridViewTextBoxColumn; break; case CostumeSize.XL5: col = xL5DataGridViewTextBoxColumn; break; case CostumeSize.XL6: col = xL6DataGridViewTextBoxColumn; break; case CostumeSize.F: col = fDataGridViewTextBoxColumn; break; default: break; } //直接改界面值 DataGridViewColumn col2 = null; switch (CostumeStoreHelper.GetCostumeSize(skinComboBox_Size1.SelectedValue.ToString(), CommonGlobalCache.DefaultSizeGroup)) { case CostumeSize.XS: col2 = xSDataGridViewTextBoxColumn2; break; case CostumeSize.S: col2 = sDataGridViewTextBoxColumn2; break; case CostumeSize.M: col2 = mDataGridViewTextBoxColumn2; break; case CostumeSize.L: col2 = lDataGridViewTextBoxColumn2; break; case CostumeSize.XL: col2 = xLDataGridViewTextBoxColumn2; break; case CostumeSize.XL2: col2 = xL2DataGridViewTextBoxColumn2; break; case CostumeSize.XL3: col2 = xL3DataGridViewTextBoxColumn2; break; case CostumeSize.XL4: col2 = xL4DataGridViewTextBoxColumn2; break; case CostumeSize.XL5: col2 = xL5DataGridViewTextBoxColumn2; break; case CostumeSize.XL6: col2 = xL6DataGridViewTextBoxColumn2; break; case CostumeSize.F: col2 = fDataGridViewTextBoxColumn2; break; default: break; } //one row for (int i = 0; i < dataGridView1.Rows.Count; i++) { // CommonGlobalUtil.Debug(""+dataGridView1.Rows.Count); DataGridViewRow orgRow = dataGridView1.Rows[i]; DataGridViewRow row = dataGridView2.Rows[i]; CostumeStore newStore = (CostumeStore)row.DataBoundItem; // CommonGlobalUtil.Debug("skinComboBox_Color.SelectedValue" + skinComboBox_Color.SelectedValue); if (newStore.ColorName != ValidateUtil.CheckEmptyValue(skinComboBox_Color.SelectedValue)) { continue; } // CommonGlobalUtil.Debug("col.Index:" + col.Index); row.Cells[col.Index].Value = (int.Parse(orgRow.Cells[col.Index].Value.ToString()) - int.Parse(skinTextBox_MoneyCash.Text)).ToString(); SetAlertCellStyle(row.Cells[col.Index]); } //value 必须是通string类型 //获取上调信息 for (int i = 0; i < dataGridView1.Rows.Count; i++) { DataGridViewRow orgRow = dataGridView1.Rows[i]; DataGridViewRow row = dataGridView2.Rows[i]; CostumeStore newStore = (CostumeStore)row.DataBoundItem; // CommonGlobalUtil.Debug("skinComboBox_Color1.SelectedValue" + skinComboBox_Color1.SelectedValue); if (newStore.ColorName != ValidateUtil.CheckEmptyValue(skinComboBox_Color1.SelectedValue)) { continue; } // CommonGlobalUtil.Debug("col.Index1:" + col2.Index); row.Cells[col2.Index].Value = (int.Parse(orgRow.Cells[col2.Index].Value.ToString()) + int.Parse(skinTextBox_MoneyCash1.Text)).ToString(); SetAlertCellStyle(row.Cells[col2.Index]); } }
private int GetStore(string color, string size) { CostumeStore store = this.currentSelectedItem?.CostumeStoreList?.Find(t => t.ColorName == color); return(CostumeStoreHelper.GetStoreCountBySize(store, CostumeStoreHelper.GetCostumeSize(size, CommonGlobalCache.DefaultSizeGroup))); }
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("添加失败!"); } }