private void SetNormal(SalesPromotion curItem) { if (!String.IsNullOrEmpty(curItem.CostumeIDStr)) { this.targets = new List <Costume>(); String[] ids = curItem.CostumeIDStr.Split(','); foreach (var id in ids) { Costume item = CommonGlobalCache.CostumeList.Find(t => t.ID == id); if (item != null) { if (filterValid) { if (item.IsValid) { targets.Add(item); } } else { targets.Add(item); } } } this.dataGridViewTarget.DataSource = targets; } dataGridViewPagingSumCtrl.RemoveNotShowInColumnSettings(dataGridViewTextBoxColumnYear, dataGridViewTextBoxColumnSeason); dataGridViewPagingSumCtrl.AppendNotShowInColumnSettings(CostPrice, Price); }
/// <summary> /// 结算销售单的应收金额 /// </summary> /// <param name="retailCostume"></param> /// <returns></returns> public decimal GetTotalMoneySupposed(RetailCostume retailCostume, SalesPromotion salesPromotion, decimal minDiscount) { Dictionary <string, RetailCostumeInfo> retailDictionary = new Dictionary <string, RetailCostumeInfo>(); Dictionary <string, InSalesPromotionCostumeInfo> inSalesPromotionDict = new Dictionary <string, InSalesPromotionCostumeInfo>(); this.GetRetailStatus(retailCostume, retailDictionary, inSalesPromotionDict); return(this.GetTotalMoneySupposed(retailDictionary, inSalesPromotionDict, salesPromotion, minDiscount)); }
private void SetBuyoutRules(SalesPromotion item) { //获取所有相同价格,并且赋予RuleExpression String costumeStr = string.Empty; String ruleExp = string.Empty; if (costumeResult != null) { List <Costume> list = costumeResult.Value; Dictionary <decimal, List <Costume> > hashTable = new Dictionary <decimal, List <Costume> >(); foreach (var costume in list) { if (!hashTable.ContainsKey(costume.BuyoutPrice)) { List <Costume> costumes = new List <Costume>(); costumes.Add(costume); hashTable.Add(costume.BuyoutPrice, costumes); } else { List <Costume> costumes = hashTable[costume.BuyoutPrice]; costumes.Add(costume); } } foreach (decimal key in hashTable.Keys) { ruleExp += key + ";"; String keyValue = string.Empty; foreach (var cos in hashTable[key]) { keyValue += cos.ID + ","; } if (keyValue.Length > 0) { keyValue = keyValue.Remove(keyValue.LastIndexOf(",")); } costumeStr += keyValue + ";"; } if (ruleExp.Length > 0) { ruleExp = ruleExp.Remove(ruleExp.LastIndexOf(";")); } if (costumeStr.Length > 0) { costumeStr = costumeStr.Remove(costumeStr.LastIndexOf(";")); } item.RuleExpression = ruleExp; item.CostumeIDStr = costumeStr; } //现在一直是true item.ContainsSpecify = true; }
/// <summary> /// 初始化促销表 /// </summary> protected virtual void InstallSalesPromotion() { var promotion = new SalesPromotion() { TypeId = 1, StartTime = DateTime.Now, EndTime = DateTime.Now }; _salesPromotionRepository.Insert(promotion); }
private bool Validate(SalesPromotion item) { bool success = true; if (String.IsNullOrEmpty(item.Name.Trim())) { this.skinTextBox_Name.Focus(); success = false; } return(success); }
public SaveSalesPromotionCtrl(SalesPromotion item) { InitializeComponent(); DateTimeUtil.DateTimePicker_GetTodayAndAfterAMonth(dateTimePickerBeginDate, dateTimePickerEndDate); new DataGridViewPagingSumCtrl(this.dataGridViewShop).Initialize(); this.dataGridViewShop.AutoGenerateColumns = false; this.curItem = item; if (this.curItem != null) { this.isSalesPromotionUse = this.IsSalesPromotionUse(); skinLabel4.Visible = true; } else { skinLabel4.Visible = false; } try { List <Shop> listItem = new List <Shop>(); foreach (var shop in GlobalCache.EnabledShopList) { Shop shopTemp = new Shop(); ReflectionHelper.CopyProperty(shop, shopTemp); shopTemp.Selected = false; listItem.Add(shopTemp); } // this.dataGridViewShop.DataSource = null; this.dataGridViewShop.DataSource = listItem; List <ListItem <PromotionTypeEnum> > types = new List <ListItem <PromotionTypeEnum> >(); types.AddRange(GlobalCache.PromotionTypeEnumList); types.RemoveAt(0); this.skinComboBoxPromotionType.DisplayMember = "Key"; this.skinComboBoxPromotionType.ValueMember = "Value"; this.skinComboBoxPromotionType.DataSource = types; Display(); } catch (Exception ex) { GlobalUtil.ShowError(ex); } }
private void SetBuyout(SalesPromotion curItem) { if (!String.IsNullOrEmpty(curItem.CostumeIDStr)) { this.targets = new List <Costume>(); String[] buyoutRangeRule = curItem.RuleExpression.Split(';'); String[] buyoutRange = curItem.CostumeIDStr.Split(';'); for (int i = 0; i < buyoutRange.Length; i++) { // var cos in buyoutRange String cos = buyoutRange[i]; String buyoutPrice = buyoutRangeRule[i] == ""?"0" : buyoutRangeRule[i]; String[] ids = cos.Split(','); foreach (var id in ids) { Costume item = CommonGlobalCache.CostumeList.Find(t => t.ID == id); if (item != null) { item.BuyoutPrice = Convert.ToDecimal(buyoutPrice); if (filterValid) { if (item.IsValid) { targets.Add(item); } } else { targets.Add(item); } } } } this.dataGridViewTarget.DataSource = targets; } dataGridViewPagingSumCtrl.AppendNotShowInColumnSettings(dataGridViewTextBoxColumnYear, dataGridViewTextBoxColumnSeason); dataGridViewPagingSumCtrl.RemoveNotShowInColumnSettings(CostPrice, Price); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (!DataGridViewUtil.CheckPerrmisson(this, sender, e)) { return; } try { if (e.RowIndex > -1 && e.ColumnIndex > -1) { List <SalesPromotion> list = DataGridViewUtil.BindingListToList <SalesPromotion>(dataGridView1.DataSource); SalesPromotion item = (SalesPromotion)list[e.RowIndex]; if (e.ColumnIndex == Column2.Index) { if (GlobalMessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { DeleteResult result = GlobalCache.ServerProxy.DeleteSalesPromotion(item.ID); if (result == DeleteResult.Error) { GlobalMessageBox.Show("内部错误!"); return; } else { GlobalMessageBox.Show("删除成功!"); this.dataGridView1.DataSource = null; list.Remove(item); this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList <SalesPromotion>(list); } } } else if (e.ColumnIndex == Column1.Index) { this.SaveClick(item, this); } } } catch (Exception ex) { GlobalUtil.ShowError(ex); } }
private void BaseButton1_Click(object sender, EventArgs e) { try { if (tempItem == null) { tempItem = curItem; } SalesPromotionCostumeSelectForm form = new SalesPromotionCostumeSelectForm(tempItem, curType, isSalesPromotionUse, filterValid); if (form.ShowDialog(this) == DialogResult.OK) { costumeResult = form.Result; if (costumeResult.Value != null) { SetLabel(costumeResult.Value.Count, costumeResult.Key); } else { if (costumeResult.Key) { // this.skinLabelCostume.Text = "所有商品不参与促销"; this.skinLabelCostume.Text = "没有商品参与该促销活动,请添加"; } else { this.skinLabelCostume.Text = "没有商品参与该促销活动,请添加"; } } if (tempItem == null) { tempItem = new SalesPromotion(); } SetItem(tempItem); } } catch (Exception ex) { GlobalUtil.ShowError(ex); } }
public decimal SettlementMoney(List <InSalesPromotionCostumeInfo> infoList, SalesPromotion salesPromotion, decimal minDiscount, bool round) { List <IPromotionRule> rules = salesPromotion.Rules; Dictionary <decimal, decimal> dict = new Dictionary <decimal, decimal>(); foreach (IPromotionRule item in rules) { MJPromotionRule rule = (MJPromotionRule)item; if (!dict.ContainsKey(rule.HitMoney)) { dict.Add(rule.HitMoney, rule.MinusMoney); } } decimal allPrice = 0; foreach (InSalesPromotionCostumeInfo info in infoList) { allPrice += (info.Price * info.BuyCount); } List <decimal> keyList = new List <decimal>();//dict.Keys.ToList(); foreach (var item in dict.Keys) { keyList.Add(item); } keyList.Sort(); for (int i = (keyList.Count - 1); i >= 0; i--) { decimal allPriceKey = keyList[i]; if (allPrice >= allPriceKey) { return(allPrice - dict[allPriceKey]); } } return(allPrice); }
private void SetItem(SalesPromotion item) { item.Name = this.skinTextBox_Name.SkinTxt.Text.Trim(); item.PromotionType = Byte.Parse(((int)this.skinComboBoxPromotionType.SelectedValue).ToString()); item.Enabled = this.skinCheckBox_Enabled.Checked; item.EndDate = this.dateTimePickerEndDate.Value; item.StartDate = this.dateTimePickerBeginDate.Value; item.Remarks = this.skinTextBox_Remarks.SkinTxt.Text.Trim(); if (item.PromotionType == (int)PromotionTypeEnum.YKJ) { SetBuyoutRules(item); } else { item.RuleExpression = GetRules(); SetUpCostume(item); } item.ShopIDStr = GetShopIDStr(); item.Name = this.skinTextBox_Name.SkinTxt.Text.Trim(); item.IsValid = true; }
private void SetUpCostume(SalesPromotion item) { if (costumeResult != null) { item.ContainsSpecify = costumeResult.Key; List <Costume> list = costumeResult.Value; String str = ""; if (list != null) { foreach (var c in list) { str += c.ID + ","; } if (!String.IsNullOrEmpty(str)) { str = str.Remove(str.LastIndexOf(",")); } } item.CostumeIDStr = str; } //现在一直是true item.ContainsSpecify = true; }
/// <summary> /// 修改促销活动 /// </summary> /// <param name="para"></param> /// <returns></returns> public UpdateResult UpdateSalesPromotion(SalesPromotion para) { byte[] response = this.engine.CustomizeOutter.Query(ManageInformationTypes.UpdateSalesPromotion, SerializeHelper.ResultToSerialize(para)); return((UpdateResult)SerializeHelper.ByteArrayToInt(response)); }
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); } }
public BalanceForm(Member _member, List <RetailDetail> list, string shopID, bool currentIsInSingleDiscount, decimal _mjMoney, SalesPromotion promotion, string guideID, string promotionText, DateTime createTime, DataGridView dgvRetail) { InitializeComponent(); this.shopID = shopID; LoadConfig(); sorceList = list; deepSourceDataGridView = dgvRetail; List <RetailDetail> tempList = new List <RetailDetail>(); if (list != null) { foreach (var item in list) { RetailDetail temp = new RetailDetail(); ReflectionHelper.CopyProperty(item, temp); tempList.Add(temp); } } if (!currentIsInSingleDiscount) { this.salesPromotion = promotion; this.promotionText = promotionText; this.mjMoney = _mjMoney; } else { foreach (var item in tempList) { item.InSalesPromotion = false; } } //if (this.retailDetailList != null) //{ // foreach (RetailDetail detail in this.retailDetailList) // { // this.totalMoneyReceived += detail.SumMoney; // } //} this.guideID = guideID; this.member = _member; this.createTime = createTime; // this.sizeGroup = sizeGroup; this.retailDetailList = tempList; //计算最优惠的折扣 textBox1.ValueChanged += TextBox1_ValueChanged; skinTextBox_MoneyCash.ValueChanged += TextBox1_ValueChanged; skinTextBox_MoneyBankCard.ValueChanged += TextBox1_ValueChanged; skinTextBox_MoneyStoredCard.ValueChanged += TextBox1_ValueChanged; skinTextBox_MoneyWeiXin.ValueChanged += TextBox1_ValueChanged; skinTextBox_MoneyAlipay.ValueChanged += TextBox1_ValueChanged; numericTextBoxElse.ValueChanged += TextBox1_ValueChanged; skinTextBox_MoneyIntegration.ValueChanged += TextBox1_ValueChanged; this.Initialize(); CalcGiftTickets(); MenuPermission = Common.Core.RolePermissionMenuEnum.收银; }
internal static SalesPromotion GetSalesPromotionFromAll(string salesPromotionID) { SalesPromotion result = salesPromotionList.Find(t => t.ID == salesPromotionID); return(result); }
/// <summary> /// 获取退货后退款情况 /// </summary> /// <param name="retailCostume"></param> /// <param name="refundCostume"></param> /// <param name="salesPromotion"></param> /// <returns></returns> public RefundMoney GetRefundMoney(RetailCostume retailCostume, RefundCostume refundCostume, decimal moneyBuyByTicket, SalesPromotion salesPromotion, decimal minDiscount) { if (retailCostume.RetailOrder.ID != refundCostume.RefundOrder.OriginOrderID) { throw new Exception("销售单的id与退货单id不一致"); } else { /* foreach (RetailDetail rDetailSource in retailCostume.RetailDetailList) * { * foreach (RetailDetail rDetailRe in refundCostume.RefundDetailList) * { * if (rDetailSource.RetailOrderID == refundCostume.RefundOrder.OriginOrderID && rDetailSource.CostumeID == rDetailRe.CostumeID * && rDetailSource.ColorName==rDetailRe.ColorName && rDetailSource.BrandName==rDetailRe.BrandName && rDetailSource.SizeName==rDetailRe.SizeName) * { * rDetailSource.SalePrice = rDetailRe.SalePrice; * } * } * }*/ } if (retailCostume.RetailOrder.IsNotPay) { return(new RefundMoney()); } Dictionary <string, RetailCostumeInfo> retailDictionary = new Dictionary <string, RetailCostumeInfo>(); Dictionary <string, InSalesPromotionCostumeInfo> inSalesPromotionDict = new Dictionary <string, InSalesPromotionCostumeInfo>(); //有活动的时候没有打折 this.GetRetailStatus(retailCostume, retailDictionary, inSalesPromotionDict); Dictionary <string, int> refundDict = this.GetRefundStatus(refundCostume); foreach (KeyValuePair <string, int> kvp in refundDict) { if (retailDictionary.ContainsKey(kvp.Key)) { retailDictionary[kvp.Key].BuyCount += kvp.Value; } else if (inSalesPromotionDict.ContainsKey(kvp.Key)) { inSalesPromotionDict[kvp.Key].BuyCount += kvp.Value; } } decimal supporedMoney = this.GetTotalMoneySupposed(retailDictionary, inSalesPromotionDict, salesPromotion, minDiscount); // 应收金额(因为要退积分,不能去掉)+要买的那件衣服的优惠券-总的优惠金额-结算销售单的应收金额-运费 decimal refundMoney = retailCostume.RetailOrder.TotalMoneyReceived + moneyBuyByTicket - retailCostume.RetailOrder.MoneyDeductedByTicket - supporedMoney - retailCostume.RetailOrder.CarriageCost; if (refundMoney <= 0) { return(new RefundMoney()); } if (refundMoney <= retailCostume.RetailOrder.MoneyIntegration) { return(new RefundMoney() { RefundIntegration = refundMoney, RefundStoredCard = 0, RefundCash = 0 }); } else { refundMoney -= retailCostume.RetailOrder.MoneyIntegration; if (refundMoney <= retailCostume.RetailOrder.MoneyVipCard) { return(new RefundMoney() { RefundIntegration = retailCostume.RetailOrder.MoneyIntegration, RefundStoredCard = refundMoney, RefundCash = 0 }); } else { refundMoney -= retailCostume.RetailOrder.MoneyVipCard; return(new RefundMoney() { RefundIntegration = retailCostume.RetailOrder.MoneyIntegration, RefundStoredCard = retailCostume.RetailOrder.MoneyVipCard, RefundCash = refundMoney }); } } }
/// <summary> /// 结算销售单的应收金额 /// </summary> /// <param name="retailDictionary">不参与促销的订单</param> /// <param name="inSalesPromotionDict">参与促销活动的订单</param> /// <param name="salesPromotion">促销活动</param> /// <param name="minDiscount">最低折扣</param> /// <returns>应收的金额</returns> private decimal GetTotalMoneySupposed(Dictionary <string, RetailCostumeInfo> retailDictionary, Dictionary <string, InSalesPromotionCostumeInfo> inSalesPromotionDict, SalesPromotion salesPromotion, decimal minDiscount) { decimal totalMoney = 0; foreach (KeyValuePair <string, RetailCostumeInfo> kvp in retailDictionary) { if (balanceRound) { totalMoney += MathHelper.Rounded(kvp.Value.Price, 0) * kvp.Value.BuyCount; } else { totalMoney += kvp.Value.Price * kvp.Value.BuyCount; } } if (inSalesPromotionDict.Count == 0) { return(totalMoney); } if (salesPromotion == null) { return(totalMoney); } ISalesPromotion promotion = SalesPromotionFactory.CreatePromotion((PromotionTypeEnum)salesPromotion.PromotionType); if (promotion == null) { return(totalMoney); } if (salesPromotion.Rules.Count == 0) { return(totalMoney); } List <InSalesPromotionCostumeInfo> list = new List <InSalesPromotionCostumeInfo>(inSalesPromotionDict.Values); //inSalesPromotionDict.Values.ToList(); totalMoney += promotion.SettlementMoney(list, salesPromotion, minDiscount, balanceRound); return(totalMoney); }
public void HandleInformation(string sourceUserID, int informationType, byte[] info) { GlobalUtil.WriteLog("收到通知" + informationType); #region 充值规则更改 if (NoticeInformationTypes.UpdateRechargeDonateRule == informationType) { RechargeDonateRule rechargeDonateRule = CompactPropertySerializer.Default.Deserialize <RechargeDonateRule>(info, 0); GlobalCache.UpdateRechargeDonateRule(rechargeDonateRule); } else if (NoticeInformationTypes.DeleteRechargeDonateRule == informationType) { GlobalCache.DeleteRechargeDonateRule(); } else if (NoticeInformationTypes.UpdateShopRechargeRuleID == informationType) { RechargeDonateRule rechargeDonateRule = CompactPropertySerializer.Default.Deserialize <RechargeDonateRule>(info, 0); GlobalCache.UpdateShopRechargeRuleID(rechargeDonateRule); } #endregion #region 系统配置更改 else if (NoticeInformationTypes.UpdateParameterConfig == informationType) { ParameterConfig c = CompactPropertySerializer.Default.Deserialize <ParameterConfig>(info, 0); GlobalCache.ParameterConfig(c); } else if (NoticeInformationTypes.UpdateParameterConfigs == informationType) { List <ParameterConfig> collection = CompactPropertySerializer.Default.Deserialize <List <ParameterConfig> >(info, 0); foreach (var item in collection) { GlobalCache.ParameterConfig(item); } } #endregion #region 导购员信息更改 else if (NoticeInformationTypes.UpdateGuide == informationType) { Guide guide = CompactPropertySerializer.Default.Deserialize <Guide>(info, 0); GlobalCache.UpdateGuide(guide); } else if (NoticeInformationTypes.InsertGuide == informationType) { Guide guide = CompactPropertySerializer.Default.Deserialize <Guide>(info, 0); GlobalCache.InsertGuide(guide); } else if (NoticeInformationTypes.DeleteGuide == informationType) { string guideID = Encoding.UTF8.GetString(info); GlobalCache.DeleteGuide(guideID); } else if (NoticeInformationTypes.DeleteGuides == informationType) { List <String> guideIDs = CompactPropertySerializer.Default.Deserialize <List <String> >(info, 0); foreach (var guideID in guideIDs) { GlobalCache.DeleteGuide(guideID); } } #endregion #region 促销活动更改 else if (NoticeInformationTypes.InsertSalesPromotion == informationType) { SalesPromotion salesPromotion = CompactPropertySerializer.Default.Deserialize <SalesPromotion>(info, 0); GlobalCache.InsertSalesPromotion(salesPromotion); } else if (NoticeInformationTypes.DeleteSalesPromotion == informationType) { string salesPromotionID = Encoding.UTF8.GetString(info); GlobalCache.DeleteSalesPromotion(salesPromotionID); } else if (NoticeInformationTypes.UpdateSalesPromotion == informationType) { SalesPromotion salesPromotion = CompactPropertySerializer.Default.Deserialize <SalesPromotion>(info, 0); GlobalCache.UpdateSalesPromotion(salesPromotion); } #endregion #region 品牌配置更改 else if (NoticeInformationTypes.InsertBrand == informationType) { Brand brand = CompactPropertySerializer.Default.Deserialize <Brand>(info, 0); GlobalCache.InsertBrand(brand); } else if (NoticeInformationTypes.UpdateBrand == informationType) { Brand brand = CompactPropertySerializer.Default.Deserialize <Brand>(info, 0); GlobalCache.UpdateBrand(brand); } else if (NoticeInformationTypes.DeleteBrand == informationType) { int brandID = BitConverter.ToInt32(info, 0); GlobalCache.DeleteBrand(brandID); } #endregion #region 装信息更改 //新增服装 else if (NoticeInformationTypes.InsertCostume == informationType) { Costume costume = CompactPropertySerializer.Default.Deserialize <Costume>(info, 0); GlobalCache.InsertCostume(costume); } //服装信息更改 else if (NoticeInformationTypes.UpdateCostume == informationType) { Costume costume = CompactPropertySerializer.Default.Deserialize <Costume>(info, 0); GlobalCache.UpdateCostume(costume); } else if (NoticeInformationTypes.DeleteCostume == informationType) { string costumeID = Encoding.UTF8.GetString(info); GlobalCache.DeleteCostume(costumeID); } else if (NoticeInformationTypes.InsertCostumes == informationType) { List <Costume> costumes = CompactPropertySerializer.Default.Deserialize <List <Costume> >(info, 0); foreach (var costume in costumes) { GlobalCache.InsertCostume(costume); } } else if (NoticeInformationTypes.UpdateCostumes == informationType) { List <Costume> costumes = CompactPropertySerializer.Default.Deserialize <List <Costume> >(info, 0); foreach (var costume in costumes) { GlobalCache.UpdateCostume(costume); } } else if (NoticeInformationTypes.UpdateCostumeValid == informationType) { UpdateCostumeValidPara result = CompactPropertySerializer.Default.Deserialize <UpdateCostumeValidPara>(info, 0); GlobalCache.UpdateCostumeValid(result); } else if (NoticeInformationTypes.InsertCostumeStores == informationType) { GlobalCache.LoadCostumeInfos(); } #endregion #region 管理员信息更改 //新增管理员 else if (NoticeInformationTypes.InsertAdminUser == informationType) { AdminUser adminUser = CompactPropertySerializer.Default.Deserialize <AdminUser>(info, 0); GlobalCache.InsertAdminUser(adminUser); } //管理员信息更改 else if (NoticeInformationTypes.UpdateAdminUser == informationType) { AdminUser adminUser = CompactPropertySerializer.Default.Deserialize <AdminUser>(info, 0); GlobalCache.UpdateAdminUser(adminUser); } #endregion #region 供应商信息更改 //新增供应商 else if (NoticeInformationTypes.InsertSupplier == informationType) { Supplier supplier = CompactPropertySerializer.Default.Deserialize <Supplier>(info, 0); GlobalCache.InsertSupplier(supplier); } else if (NoticeInformationTypes.ImportSupplier == informationType) { List <Supplier> suppliers = CompactPropertySerializer.Default.Deserialize <List <Supplier> >(info, 0); if (suppliers != null) { foreach (var supplier in suppliers) { GlobalCache.InsertSupplier(supplier); } } } //供应商信息更改 else if (NoticeInformationTypes.UpdateSupplier == informationType) { Supplier supplier = CompactPropertySerializer.Default.Deserialize <Supplier>(info, 0); GlobalCache.UpdateSupplier(supplier); } //删除供应商 else if (NoticeInformationTypes.DeleteSupplier == informationType) { string supplierID = Encoding.UTF8.GetString(info); GlobalCache.DeleteSupplier(supplierID); } #endregion #region 店铺更改 //新增店铺 else if (NoticeInformationTypes.InsertShop == informationType) { Shop shop = CompactPropertySerializer.Default.Deserialize <Shop>(info, 0); GlobalCache.InsertShop(shop); } //店铺信息更改 else if (NoticeInformationTypes.UpdateShop == informationType) { Shop shop = CompactPropertySerializer.Default.Deserialize <Shop>(info, 0); GlobalCache.UpdateShop(shop); } else if (NoticeInformationTypes.DisableShop == informationType) { String shopID = Encoding.UTF8.GetString(info); GlobalCache.DisableShop(shopID); } else if (NoticeInformationTypes.DeleteShop == informationType) { String shopID = Encoding.UTF8.GetString(info); GlobalCache.RemoveShop(shopID); } //Todo: #endregion else if (NoticeInformationTypes.InsertDifferenceOrder == informationType) { int result = SerializeHelper.ByteArrayToInt(info); DifferenceOrderPagePara checkOrderPagePara = new DifferenceOrderPagePara() { OrderID = null, CostumeID = null, IsOpenDate = true, IsOnlyGetOut = true, StartDate = new CJBasic.Date("1900-01-01"), EndDate = new CJBasic.Date(DateTime.Now), PageIndex = 0, PageSize = 1000, ShopID = CommonGlobalCache.CurrentShopID, OrderPrefixType = ValidateUtil.CheckEmptyValue(OrderPrefix.AllocateOrder), DifferenceOrderConfirmed = DifferenceOrderConfirmed.False, }; DifferenceOrderPage checkOrderListPage = CommonGlobalCache.ServerProxy.GetDifferenceOrderPage(checkOrderPagePara); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + checkOrderListPage.DifferenceOrderList.Count + "张差异单待处理,请及时处理!" + "#" + informationType); } #region 新的补货申请单待处理通知 else if (NoticeInformationTypes.ReplenishOutbound == informationType) { ReplenishCostumePagePara pageParaReplenish = new ReplenishCostumePagePara() { CostumeID = null, ReplenishOrderID = null, IsOpenDate = true, StartDate = new CJBasic.Date("1900-01-01"), EndDate = new CJBasic.Date(DateTime.Now), PageIndex = 0, PageSize = 10000, ShopID = CommonGlobalCache.CurrentShopID, ReplenishOrderState = ReplenishOrderState.NotProcessing, BrandID = -1 }; ReplenishCostumePage listPageReplenish = CommonGlobalCache.ServerProxy.GetReplenishCostumePage(pageParaReplenish); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + listPageReplenish.ReplenishOrderList.Count + "张待发货的补货申请单待处理,请及时处理!" + "#" + informationType); } else if (NoticeInformationTypes.AllocateOutbound == informationType) { int result = SerializeHelper.ByteArrayToInt(info); if (GlobalCache.GetParameter(ParameterConfigKey.AllocateInDirectly)?.ParaValue == "1") { ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有新的调拨单已入库!"); } else { GetAllocateOrdersPara pagePara = new GetAllocateOrdersPara() { AllocateOrderID = null, AllocateOrderState = AllocateOrderState.Normal, CostumeID = null, EndDate = new CJBasic.Date(DateTime.Now), StartDate = new CJBasic.Date("1900-01-01"), ShopID = "", Type = AllocateOrderType.All, PageIndex = 0, PageSize = 20, ReceiptState = ReceiptState.WaitReceipt, LockShop = PermissonUtil.HasPermission(RolePermissionMenuEnum.调拨单查询, RolePermissionEnum.查看_只看本店), DestShopID = CommonGlobalCache.CurrentShopID, SourceShopID = "", }; InteractResult <AllocateOrderPage> listPage = CommonGlobalCache.ServerProxy.GetAllocateOrders(pagePara); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + listPage.Data.AllocateOrderList.Count + "张调拨单待处理,请及时处理!" + "#" + informationType); } } else if (NoticeInformationTypes.ReplenishCostume == informationType) { int result = SerializeHelper.ByteArrayToInt(info); ReplenishCostumePagePara pageParaReplenish = new ReplenishCostumePagePara() { CostumeID = null, ReplenishOrderID = null, IsOpenDate = true, StartDate = new CJBasic.Date("1900-01-01"), EndDate = new CJBasic.Date(DateTime.Now), PageIndex = 0, PageSize = 10000, ShopID = CommonGlobalCache.CurrentShopID, ReplenishOrderState = ReplenishOrderState.NotProcessing, BrandID = -1 }; ReplenishCostumePage listPageReplenish = CommonGlobalCache.ServerProxy.GetReplenishCostumePage(pageParaReplenish); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有补货申请单待处理,请及时处理!" + "#" + informationType); } #endregion #region 盘点已审核通知 else if (NoticeInformationTypes.CheckStorePass == informationType) { GlobalUtil.WriteLog("盘点已审核通知"); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单已审核,请及时查收!" + "#" + informationType); // GlobalUtil.MainForm.OnStoreStateChanged(false); } #endregion #region 盘点退回通知 /* else if (NoticeInformationTypes.CancelCheckStore == informationType) * { * GlobalUtil.WriteLog("盘点退回通知"); * ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单被退回,请及时查收!" + "#" + informationType); * * } */ #endregion #region 补货申请单/调拨单冲单通知 else if (NoticeInformationTypes.OverrideOrder == informationType) { string result = String.Empty; if (info != null) { result = Encoding.UTF8.GetString(info); } GlobalUtil.WriteLog("补货申请单/或调拨单" + result + "冲单通知"); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的" + GlobalUtil.OrderType(result) + "单" + result + "被冲单,请及时查收!" + "#" + informationType); } #endregion #region 补货申请单取消 else if (NoticeInformationTypes.CancelReplenish == informationType) { string result = String.Empty; if (info != null) { result = Encoding.UTF8.GetString(info); } GlobalUtil.WriteLog("补货申请单" + result + "取消通知"); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的" + GlobalUtil.OrderType(result) + "单" + result + "被取消,请及时查收!" + "#" + informationType); } #endregion else if (NoticeInformationTypes.NewEmRefundOrder == informationType) { int result = SerializeHelper.ByteArrayToInt(info); GetEmOrderPagePara EmReturnpagePara = new GetEmOrderPagePara() { OrderID = null, StartDate = new CJBasic.Date("1900-01-01"), EndDate = new CJBasic.Date(DateTime.Now), PageIndex = 0, PageSize = 1000, MemberPhoneOrName = null, CostumeIDOrName = null, OrderState = EmRetailOrderState.All, RefundStatus = RefundStatus.Refunding, }; EmOrderPage EmReturnlistPage = CommonGlobalCache.ServerProxy.GetEmOrderPage(EmReturnpagePara); int rows = EmReturnlistPage.ResultList.FindAll(t => t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.RefundApplication) || t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.Refunding)).Count; ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + rows + "张线上退货待处理,请及时处理!" + "#" + informationType); } else if (NoticeInformationTypes.NewEmRetailOrder == informationType) { int result = SerializeHelper.ByteArrayToInt(info); GetEmOrderPagePara EmpagePara = new GetEmOrderPagePara() { OrderID = null, StartDate = new CJBasic.Date("1900-01-01"), EndDate = new CJBasic.Date(DateTime.Now), PageIndex = 0, PageSize = 1000, MemberPhoneOrName = null, CostumeIDOrName = null, OrderState = EmRetailOrderState.WaitDelivery, RefundStatus = RefundStatus.NotSelect, }; EmOrderPage EmlistPage = CommonGlobalCache.ServerProxy.GetEmOrderPage(EmpagePara); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + EmlistPage.ResultList.Count + "张线上订单待处理,请及时处理!" + "#" + informationType); } #region 批发客户信息更改 //新增供应商 else if (NoticeInformationTypes.InsertPfCustomer == informationType) { PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0); PfCustomerCache.InsertPfCustomer(supplier); } else if (NoticeInformationTypes.ImportPfCustomer == informationType) { List <PfCustomer> suppliers = CompactPropertySerializer.Default.Deserialize <List <PfCustomer> >(info, 0); foreach (var supplier in suppliers) { PfCustomerCache.InsertPfCustomer(supplier); } } //供应商信息更改 else if (NoticeInformationTypes.UpdatePfCustomer == informationType) { PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0); PfCustomerCache.UpdatePfCustomer(supplier); } //删除供应商 else if (NoticeInformationTypes.DeletePfCustomer == informationType) { string supplierID = Encoding.UTF8.GetString(info); PfCustomerCache.DeletePfCustomer(supplierID); } #endregion #region 盘点待处理通知 else if (NoticeInformationTypes.InsertCheckStore == informationType) { GlobalUtil.WriteLog("盘点待处理通知"); CheckStoreOrderPagePara checkPagePara = new CheckStoreOrderPagePara() { CheckStoreOrderID = null, IsOpenDate = true, StartDate = new CJBasic.Date("1900-01-01"), EndDate = new CJBasic.Date(DateTime.Now), PageIndex = 0, PageSize = 1000, //ShopID = CommonGlobalCache.CurrentShopID, CostumeID = null, State = CheckStoreOrderState.PendingReview, }; CheckStoreOrderPage ChecklistPage = CommonGlobalCache.ServerProxy.GetCheckStoreOrderPage(checkPagePara); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有" + ChecklistPage.CheckStoreOrderList.Count + "张盘点单待审核,请及时处理!" + "#" + informationType); } #endregion #region 盘点退回通知 else if (NoticeInformationTypes.CancelCheckStore == informationType) { GlobalUtil.WriteLog("盘点退回通知"); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您的盘点单被退回,请及时处理!" + "#" + informationType); } #endregion #region 盘点取消通知 else if (NoticeInformationTypes.CancelCheckStoreTask == informationType) { GlobalUtil.WriteLog("盘点取消通知"); ((MainForm)GlobalUtil.MainForm).OnNewInfomation("您有盘点已取消!"); } #endregion else if (NoticeInformationTypes.EnabledSizeGroup == informationType) { EnabledSizeGroupPara sizeGroup = CompactPropertySerializer.Default.Deserialize <EnabledSizeGroupPara>(info, 0); GlobalCache.EnabledSizeGroup(sizeGroup); } else if (NoticeInformationTypes.InsertSizeGroup == informationType) { SizeGroup sizeGroup = CompactPropertySerializer.Default.Deserialize <SizeGroup>(info, 0); GlobalCache.InsertSizeGroup(sizeGroup); } else if (NoticeInformationTypes.UpdateSizeGroup == informationType) { SizeGroup sizeGroup = CompactPropertySerializer.Default.Deserialize <SizeGroup>(info, 0); GlobalCache.UpdateSizeGroup(sizeGroup); } else if (NoticeInformationTypes.DeleteSizeGroup == informationType) { String SizeGroupName = Encoding.UTF8.GetString(info); GlobalCache.DeleteSizeGroup(SizeGroupName); } else if (NoticeInformationTypes.UpdateSizeNames == informationType) { UpdateSizeNamesInfo sizeNameInfo = CompactPropertySerializer.Default.Deserialize <UpdateSizeNamesInfo>(info, 0); GlobalCache.UpdateSizeNames(sizeNameInfo); } else if (NoticeInformationTypes.InsertDistributor == informationType) { Distributor supplier = CompactPropertySerializer.Default.Deserialize <Distributor>(info, 0); GlobalCache.InsertDistributor(supplier); } else if (NoticeInformationTypes.UpdateDistributor == informationType) { Distributor supplier = CompactPropertySerializer.Default.Deserialize <Distributor>(info, 0); GlobalCache.UpdateDistributor(supplier); } #region 批发客户信息更改 //新增供应商 else if (NoticeInformationTypes.InsertPfCustomer == informationType) { PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0); PfCustomerCache.InsertPfCustomer(supplier); } //供应商信息更改 else if (NoticeInformationTypes.UpdatePfCustomer == informationType) { PfCustomer supplier = CompactPropertySerializer.Default.Deserialize <PfCustomer>(info, 0); PfCustomerCache.UpdatePfCustomer(supplier); } //删除供应商 else if (NoticeInformationTypes.DeletePfCustomer == informationType) { string supplierID = Encoding.UTF8.GetString(info); PfCustomerCache.DeletePfCustomer(supplierID); } else if (NoticeInformationTypes.SendAnnounce == informationType) { int result = SerializeHelper.ByteArrayToInt(info); Announce announce = CompactPropertySerializer.Default.Deserialize <Announce>(info, 0); //1:发布中,2:已完成,3:已取消 AnnounceState state = (AnnounceState)announce.State; switch (state) { case AnnounceState.Finished: case AnnounceState.Cancel: ((MainForm)GlobalUtil.MainForm).SendAnnounce(state); break; case AnnounceState.Releasing: CommonGlobalCache.SystemUpdateMessage = announce.AnnounceContent; ((MainForm)GlobalUtil.MainForm).OnNewInfomation("系统升级公告\r\n尊敬的客户:\r\n" + announce.AnnounceContent); ((MainForm)GlobalUtil.MainForm).SendAnnounce(state); break; default: break; } } else if (NoticeInformationTypes.NoticeClose == informationType) { ((MainForm)GlobalUtil.MainForm).DoClose(); // System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); } #endregion }
public decimal SettlementMoney(List <InSalesPromotionCostumeInfo> infoList, SalesPromotion salesPromotion, decimal minDiscount, Boolean round) { List <IPromotionRule> rules = salesPromotion.Rules; Dictionary <int, decimal> dict = new Dictionary <int, decimal>(); foreach (IPromotionRule item in rules) { DiscountPromotionRule rule = (DiscountPromotionRule)item; if (!dict.ContainsKey(rule.HitBuyCout)) { dict.Add(rule.HitBuyCout, (decimal)rule.Discount / 100); } } int buyAllCount = 0; decimal allPrice = 0; foreach (InSalesPromotionCostumeInfo info in infoList) { buyAllCount += info.BuyCount; allPrice += (info.Price * info.BuyCount); } List <int> keyList = new List <int>();// dict.Keys.ToList(); foreach (var item in dict.Keys) { keyList.Add(item); } keyList.Sort(); for (int i = (keyList.Count - 1); i >= 0; i--) { int buyCountKey = keyList[i]; if (buyAllCount >= buyCountKey) { decimal value = dict[buyCountKey]; decimal min = minDiscount / 100; decimal result = 0; if (value < min) { if (round) { foreach (InSalesPromotionCostumeInfo info in infoList) { result += MathHelper.Rounded(info.Price * min, 0) * info.BuyCount;; } return(result); } else { foreach (InSalesPromotionCostumeInfo info in infoList) { result += (info.Price * info.BuyCount) * min; } return(result); } } else { if (round) { foreach (InSalesPromotionCostumeInfo info in infoList) { result += MathHelper.Rounded(info.Price * value, 0) * info.BuyCount; } return(result); } else { foreach (InSalesPromotionCostumeInfo info in infoList) { result += (info.Price * info.BuyCount) * value; } return(result); } } } } return(allPrice); }
public void Refresh(SalesPromotion e) { curItem = e; Display(); }