private InboundPara BuildInboundPara() { if (this.curOutbound == null || this.curOutbound.OutboundOrder == null || this.curOutbound.OutboundDetails == null || this.curOutbound.OutboundDetails.Count == 0) { return(null); } int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; List <BoundDetail> inboundDetails = new List <BoundDetail>(); string id = IDHelper.GetID(OrderPrefix.InboundOrder, CommonGlobalCache.CurrentShop.AutoCode); foreach (BoundDetail detail in this.curOutbound.OutboundDetails) { //if (detail.SumCount <= 0) //{ // continue; //} totalCost += detail.SumCost; totalCount += detail.SumCount; totalPrice += detail.SumMoney; inboundDetails.Add(OutboundDetailConvertToInboundDetail(detail, id)); } if (CommonGlobalCache.CurrentUser.Type == UserInfoType.Admin) { AllocateOrder allocateOrder = CommonGlobalCache.ServerProxy.GetAllocateOrder(this.curOutbound.OutboundOrder.SourceOrderID); shopID = allocateOrder.DestShopID; } InboundOrder inboundOrder = new InboundOrder() { SourceOrderID = this.curOutbound.OutboundOrder.SourceOrderID, ShopID = shopID, ID = id, OperatorUserID = //IsPos ? (string)this.guideComboBox1.SelectedValue : CommonGlobalCache.CurrentUserID, CreateTime = DateTime.Now, EntryTime = DateTime.Now, TotalCost = totalCost, TotalCount = totalCount, TotalPrice = totalPrice, Remarks = this.skinTextBox_Remarks.SkinTxt.Text, }; return(new InboundPara() { InboundOrder = inboundOrder, InboundDetails = inboundDetails }); }
private Outbound BuildOutbound() { if (this.curReplenishOrder == null || this.curReplenishDetailList == null || this.curReplenishDetailList.Count == 0) { return(null); } int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; List <BoundDetail> details = new List <BoundDetail>(); //使用补货申请单的店铺ID信息 Shop shop = GlobalCache.ShopList.Find(t => t.ID == this.curReplenishOrder.ShopID); string id = IDHelper.GetID(OrderPrefix.OutboundOrder, shop.AutoCode); string replenishOrderid = IDHelper.GetID(OrderPrefix.ReplenishOrder, shop.AutoCode); foreach (ReplenishDetail detail in this.curReplenishDetailList) { if (detail.SumCount <= 0) { continue; } totalCost += detail.SumCost; totalCount += detail.SumCount; totalPrice += detail.SumMoney; details.Add(this.ReplenishDetailConvertToOutboundDetail(detail, id)); } OutboundOrder order = new OutboundOrder() { SourceOrderID = curReplenishOrder.IsRedo? replenishOrderid:this.curReplenishOrder.ID, ID = id, OperatorUserID = GlobalCache.CurrentUserID, ShopID = GlobalCache.ServerProxy.GetGeneralStoreShopID(), CreateTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, TotalCost = totalCost, Remarks = this.skinTextBox_Remarks.SkinTxt.Text }; return(new Outbound() { OutboundDetails = details, OutboundOrder = order }); }
/// <summary> /// 生成ReplenishCostume对象 /// </summary> /// <returns></returns> private ReplenishCostume BuildReplenishCostume() { if (this.curReplenishDetailList == null || this.curReplenishDetailList.Count == 0) { return(null); } string id = IDHelper.GetID(OrderPrefix.ReplenishOrder, GlobalCache.GetShop(shopID).AutoCode); if (action == OperationEnum.Pick) { id = this.order?.ID; } int totalCount = 0; decimal totalMoney = 0; List <ReplenishDetail> list = new List <ReplenishDetail>(); for (int i = 0; i < this.curReplenishDetailList.Count; i++) { if (this.curReplenishDetailList[i].SumCount == 0) { continue; } list.Add(this.curReplenishDetailList[i]); totalCount += this.curReplenishDetailList[i].SumCount; totalMoney += this.curReplenishDetailList[i].SumMoney; this.curReplenishDetailList[i].ReplenishOrderID = id; } ReplenishOrder replenishOrder = new ReplenishOrder() { ID = id, RequestGuideID = GlobalCache.CurrentUserID,// (string)this.guideComboBox1.SelectedValue, ShopID = shopID, Remarks = this.skinTextBox_Remarks.SkinTxt.Text, State = (byte)ReplenishOrderState.NotProcessing, TotalCount = totalCount, TotalPrice = totalMoney, CreateTime = DateTime.Now, FinishedTime = SystemDefault.DateTimeNull, }; return(new ReplenishCostume() { ReplenishOrder = replenishOrder, ReplenishDetailList = list }); }
private static InboundPara BuildInboundPara(Outbound curOutbound, AllocateOrder allocateOrder) { if (curOutbound == null || curOutbound.OutboundOrder == null || curOutbound.OutboundDetails == null || curOutbound.OutboundDetails.Count == 0) { return(null); } int totalCount = 0; decimal totalCost = 0; decimal totalPrice = 0; List <BoundDetail> inboundDetails = new List <BoundDetail>(); string id = IDHelper.GetID(OrderPrefix.InboundOrder, CommonGlobalCache.CurrentShop.AutoCode); foreach (BoundDetail detail in curOutbound.OutboundDetails) { //if (detail.SumCount <= 0) //{ // continue; //} totalCost += detail.SumCost; totalCount += detail.SumCount; totalPrice += detail.SumMoney; inboundDetails.Add(OutboundDetailConvertToInboundDetail(detail, id)); } InboundOrder inboundOrder = new InboundOrder() { SourceOrderID = curOutbound.OutboundOrder.SourceOrderID, ShopID = allocateOrder.DestShopID, ID = id, OperatorUserID = string.Empty, CreateTime = allocateOrder.CreateTime, EntryTime = DateTime.Now, TotalCost = totalCost, TotalCount = totalCount, TotalPrice = totalPrice, Remarks = "自动入库", }; return(new InboundPara() { InboundOrder = inboundOrder, InboundDetails = inboundDetails }); }
private PfCustomerRetailInfo Build() { if ( this.PfCustomerRetailDetailList == null || this.PfCustomerRetailDetailList.Count == 0) { return(null); } int totalCount = 0; List <PfCustomerRetailDetail> details = new List <PfCustomerRetailDetail>(); //使用补货申请单的店铺ID信息 string id = IDHelper.GetID(OrderPrefix.PfCustomerRetailOrder, CommonGlobalCache.CurrentShop.AutoCode); foreach (PfCustomerRetailDetail detail in this.PfCustomerRetailDetailList) { //if (detail.BuyCount <= 0) //{ // continue; //} detail.PfCustomerRetailOrderID = id; totalCount += detail.BuyCount; details.Add(detail); } PfCustomerRetailOrder pOrder = new PfCustomerRetailOrder() { PfCustomerID = lastAddCustomer.ID, ID = id, CreateTime = this.dateTimePicker_Start.Value, TotalCount = totalCount, Comment = this.skinTextBox_Remarks.SkinTxt.Text, }; return(new PfCustomerRetailInfo() { PfCustomerRetailOrder = pOrder, PfCustomerRetailDetails = details }); }
private void BaseButtonConfirm_Click(object sender, EventArgs e) { try { if (this.bean == null) { GlobalMessageBox.Show(this, "找不到客户信息"); this.textBoxCustomer.Focus(); return; } if (this.textBoxAmount.Value == 0) { GlobalMessageBox.Show(this, "请输入金额"); this.textBoxAmount.Focus(); return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } PfCustomerRechargeRecord pfCustomerRechargeRecord = new PfCustomerRechargeRecord() { BalanceOld = this.bean.Balance, BalanceNew = this.bean.Balance + decimal.ToInt32(textBoxAmount.Value), ID = IDHelper.GetID(OrderPrefix.PfCustomerRechargeRecord, CommonGlobalCache.CurrentShop.AutoCode), // BalanceOld = Remarks = richTextBoxRemark.Text, PfCustomerID = bean.ID, CreateTime = DateTime.Now, RechargeMoney = decimal.ToInt32(textBoxAmount.Value) }; InteractResult result = GlobalCache.ServerProxy.InsertPfCustomerRechargeRecord(pfCustomerRechargeRecord); switch (result.ExeResult) { case ExeResult.Success: GlobalMessageBox.Show(this.FindForm(), "添加成功!"); this.bean.Balance = pfCustomerRechargeRecord.BalanceNew; //TabPageClose(this.CurrentTabPage, this.SourceCtrlType); PfCustomerRechargeRecordSuccess?.Invoke(pfCustomerRechargeRecord); this.Close(); break; case ExeResult.Error: GlobalMessageBox.Show(this.FindForm(), result.Msg); break; default: break; } } catch (Exception ex) { ShowError(ex); } finally { UnLockPage(); } }
private void BaseButton_ConfirmRefund_Click(object sender, EventArgs e) { try { if (originalRetailCostume == null) { GlobalMessageBox.Show("请选择销售单!"); return; } if (!string.IsNullOrEmpty(this.originalRetailCostume.RetailOrder.RefundOrderID)) { GlobalMessageBox.Show("该销售单号已经退过货,不能再次退货!"); return; } if (this.originalRetailCostume.RetailOrder.IsCancel) { GlobalMessageBox.Show("该销售单号已被冲单!"); return; } if (this.guideComboBox1.SelectedIndex == 0) { GlobalMessageBox.Show("该笔单的导购员不能为空!"); return; } string id = IDHelper.GetID(OrderPrefix.RefundOrder, GlobalCache.GetShop(shopID).AutoCode); //if (this.currentRetailCostume.RetailOrder.ShopID != shopID || this.currentRetailCostume.RetailOrder.EmOnline) //{ // GlobalMessageBox.Show("该商品不是在本店销售的,不能退货!"); // return; //} bool isNoHasGuidFlag = false; if (this.currentRetailCostume.RetailDetailList != null && this.currentRetailCostume.RetailDetailList.Count > 0) { foreach (RetailDetail detail in this.currentRetailCostume.RetailDetailList) { if (detail.GuideID == null || detail.GuideID == "") { isNoHasGuidFlag = true; break; } } } if (isNoHasGuidFlag) { GlobalMessageBox.Show("导购员不能为空,请检查列表里所有款号的导购员!"); return; } #region 创建RefundCostume对象 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"; RefundCostume costume = new RefundCostume() { RefundOrder = null, RefundDetailList = new List <RetailDetail>() }; int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; foreach (RetailDetail detail in this.currentRetailCostume.RetailDetailList) { if (detail.IsRefund && detail.RefundCount > 0) { totalCount += detail.RefundCount; totalPrice += detail.RefundCount * detail.Price; totalCost += detail.RefundCount * detail.CostPrice; costume.RefundDetailList.Add(this.RetailDetailToRefundDetail(detail, id)); } } List <String> costumeIds = new List <string>(); foreach (var item in costume.RefundDetailList) { if (!costumeIds.Contains(item.CostumeID)) { costumeIds.Add(item.CostumeID); } } if (costumeIds != null && costumeIds.Count > 0) { //判断是否又禁用的商品,并提示返回 InteractResult interactResult = GlobalCache.ServerProxy.IsCostumeValid(costumeIds); if (interactResult.ExeResult == ExeResult.Error) { GlobalMessageBox.Show(interactResult.Msg); return; } } RetailOrder refundOrder = new RetailOrder() { ID = id, IsRefundOrder = true, OriginOrderID = this.currentRetailCostume.RetailOrder.ID, // GuideID = this.currentRetailCostume.RetailOrder.GuideID, // OperateGuideID = this.currentRetailCostume.RetailOrder.GuideID, GuideID = (string)this.guideComboBox1.SelectedValue, ShopID = shopID, MemeberID = this.currentRetailCostume.RetailOrder.MemeberID, SalesPromotionID = this.currentRetailCostume.RetailOrder.SalesPromotionID, PromotionText = this.currentRetailCostume.RetailOrder.PromotionText, EntryUserID = CommonGlobalCache.CurrentUserID, // TotalMoneyReceived = this.currentRetailCostume.RetailOrder.TotalMoneyReceived, // TotalMoneyReceivedActual = this.currentRetailCostume.RetailOrder.TotalMoneyReceivedActual, MoneyBankCard = 0, MoneyWeiXin = 0, MoneyAlipay = 0, MoneyOther = 0, SmallMoneyRemoved = 0, MoneyChange = 0, TotalCount = totalCount * -1, TotalCost = totalCost * -1, TotalPrice = totalPrice * -1, MoneyDiscounted = -totalCount == this.originalRetailCostume.RetailOrder.TotalCount ? this.originalRetailCostume.RetailOrder.MoneyDiscounted * -1 : 0,//若是全部退款,折扣金额为原始折扣金额,否则为0 Remarks = this.skinTextBox_RefundReason.SkinTxt.Text.Trim(), CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, IsNotPay = this.currentRetailCostume.RetailOrder.IsNotPay, }; costume.RefundOrder = refundOrder; #endregion decimal sourceTotalMoneyReceived = this.currentRetailCostume.RetailOrder.TotalMoneyReceived; #region 根据活动获取退款的金额,并赋值给RefundCostume decimal originalDonate = 0; if (this.originalRetailCostume.RetailOrder.MoneyVipCard != 0) { originalDonate = this.originalRetailCostume.RetailOrder.MoneyVipCardDonate / this.originalRetailCostume.RetailOrder.MoneyVipCard; } //应该退还的金额 decimal moneyBuyByTicket = CalGiftTicket(costume); SettlementMoney settlementMoney = new SettlementMoney(balanceRound); RefundMoney refundMoney = settlementMoney.GetRefundMoney(this.originalRetailCostume, costume, moneyBuyByTicket, GlobalCache.GetSalesPromotionFromAll(this.originalRetailCostume.RetailOrder.SalesPromotionID), GlobalCache.CurrentShop.MinDiscount); costume.RefundOrder.MoneyCash = refundMoney.RefundCash * -1; costume.RefundOrder.MoneyCash2 = costume.RefundOrder.MoneyCash; costume.RefundOrder.MoneyIntegration = refundMoney.RefundIntegration * -1; costume.RefundOrder.MoneyVipCard = refundMoney.RefundStoredCard * -1; costume.RefundOrder.MoneyVipCardMain = refundMoney.RefundStoredCard * (1 - originalDonate) * -1; costume.RefundOrder.MoneyVipCardDonate = refundMoney.RefundStoredCard * originalDonate * -1; //costume.RefundOrder.MoneyBuyByTicket = moneyBuyByTicket; costume.RefundOrder.RetailMoneyDeductedByTicket = originalRetailCostume.RetailOrder.MoneyDeductedByTicket; costume.RefundOrder.MoneyDeductedByTicket = moneyBuyByTicket; //总计=现金+积分+VIP卡+优惠券 //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券 costume.RefundOrder.TotalMoneyReceived = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyIntegration + costume.RefundOrder.MoneyVipCard; costume.RefundOrder.TotalMoneyReceivedActual = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyVipCardMain; costume.RefundOrder.Benefit = costume.RefundOrder.TotalMoneyReceivedActual - costume.RefundOrder.TotalCost; ////平摊 #endregion if (Math.Abs(costume.RefundOrder.TotalCount) < 1) { GlobalMessageBox.Show("退货数量不能小于1"); return; } //foreach (RetailDetail detail in costume.RefundDetailList) //{ // if (detail.IsRefund && detail.RefundCount > 0) // { // detail.SinglePrice = detail.SumMoney / detail.BuyCount * -1; // } //} ConfirmRefundForm confirmRefundForm = new ConfirmRefundForm(costume, shopID, this.dataGridView1, sourceTotalMoneyReceived, 1); DialogResult result = confirmRefundForm.ShowDialog(); if (result == DialogResult.Cancel) { return; } this.ResetForm(); } catch (Exception ee) { GlobalUtil.ShowError(ee); } }
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 ReturnCostume Build() { if ( this.curDetailList == null || this.curDetailList.Count == 0) { return(null); } int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; List <BoundDetail> details = new List <BoundDetail>(); //使用补货申请单的店铺ID信息 // Shop shop = GlobalCache.ShopList.Find(t => t.ID == this.curReplenishOrder.ShopID); Shop shop = (Shop)this.skinComboBoxShopID.SelectedItem; string id = IDHelper.GetID(OrderPrefix.OutboundOrder, shop.AutoCode); string returnOrderId = IDHelper.GetID(OrderPrefix.ReturnOrder, shop.AutoCode); if (action == OperationEnum.Pick) { returnOrderId = this.order?.ID; } foreach (BoundDetail detail in this.curDetailList) { if (detail.SumCount <= 0) { continue; } detail.SumCount = -detail.SumCount; detail.SumMoney = -detail.SumMoney; // detail.SumCount = -detail.SumMoney; totalCount += detail.SumCount; totalPrice += detail.SumMoney; totalCost += detail.SumCost; detail.BoundOrderID = id; detail.SupplierID = ValidateUtil.CheckEmptyValue(skinComboBoxSupplierID.SelectedValue); details.Add(detail); // details.Add(this.OutboundDetailConvertToOutboundDetail(detail, id)); } OutboundOrder order = new OutboundOrder() { SourceOrderID = returnOrderId, ID = id, OperatorUserID = GlobalCache.CurrentUserID, ShopID = ValidateUtil.CheckEmptyValue(this.skinComboBoxShopID.SelectedValue), CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, TotalCost = totalCost, Remarks = this.skinTextBox_Remarks.SkinTxt.Text }; PurchaseOrder pOrder = new PurchaseOrder() { SupplierID = ValidateUtil.CheckEmptyValue(this.skinComboBoxSupplierID.SelectedValue), ID = returnOrderId, AdminUserID = GlobalCache.CurrentUserID, InboundOrderID = order.ID, DestShopID = order.ShopID, CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, TotalCost = totalCost, Remarks = this.skinTextBox_Remarks.SkinTxt.Text }; return(new ReturnCostume() { ReturnOrder = pOrder, OutboundOrder = order, OutboundDetailList = details }); }
private void BaseButton_OK_Click(object sender, EventArgs e) { RechargeResult result = RechargeResult.Error; try { /* if (this.guideComboBox1.SelectedIndex == 0) * { * GlobalMessageBox.Show("操作人不能为空"); * return; * }*/ if (this.member == null) { GlobalMessageBox.Show("充值会员不能为空!"); return; } //if (this.member.CardType != 1) //{ // GlobalMessageBox.Show("该会员不是充值卡会员!"); // return; //} // int rechargeMoney = int.Parse(this.skinTextBox_RechargeMoney.SkinTxt.Text); int moneyCash = Decimal.ToInt32(this.skinTextBox_MoneyCash.Value); int moneyBankCard = Decimal.ToInt32(this.skinTextBox_MoneyBankCard.Value); int moneyAlipay = Decimal.ToInt32(this.skinTextBox_MoneyAlipay.Value); int moneyWeiXin = Decimal.ToInt32(this.skinTextBox_MoneyWeiXin.Value); int rechargeMoney = moneyCash + moneyBankCard + moneyAlipay + moneyWeiXin; if (rechargeMoney <= 0) { GlobalMessageBox.Show("充值金额应为正整数,充值失败"); return; } if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } int donateMoney = int.Parse(this.skinLabel_GiveMoney.Text); decimal balanceNew = this.member.Balance + donateMoney + rechargeMoney; result = CommonGlobalCache.ServerProxy.Recharge(new RechargeRecord() { ID = IDHelper.GetID(OrderPrefix.RechargeRecordOrder, shop.AutoCode), BalanceOld = this.member.Balance, BalanceNew = balanceNew, DonateMoney = donateMoney, MemberID = this.member.PhoneNumber, GuideID = this.guideID, MoneyAlipay = moneyAlipay, MoneyBankCard = moneyBankCard, MoneyCash = moneyCash, MoneyWeiXin = moneyWeiXin, RechargeMoney = rechargeMoney, CreateTime = DateTime.Now, Remarks = this.skinTextBox_Remark.Text, MemberName = this.member.Name, ShopID = shop.ID } ); UnLockPage(); switch (result) { case RechargeResult.Success: RechargeDialogForm form = new RechargeDialogForm(member, rechargeMoney, donateMoney, balanceNew); if (form.ShowDialog() == DialogResult.OK) { } this.member = CommonGlobalCache.ServerProxy.GetOneMember(this.member.PhoneNumber); this.SetMemberLabel(); this.CleanRechargeTextBox(); //20180616充值完成自动关闭! // if (isClose) { //只给POS端收银充值用 TabPageClose(this.CurrentTabPage, this); break; case RechargeResult.MemberIsNotExist: GlobalMessageBox.Show("会员不存在!"); break; case RechargeResult.Error: GlobalMessageBox.Show("内部错误!"); break; default: break; } } catch (Exception ee) { WriteLog(ee); } finally { UnLockPage(); } }
private AllocateOutboundPara Build() { if (this.curDetailList == null || this.curDetailList.Count == 0) { return(null); } int totalCount = 0; decimal totalCost = 0; decimal totalPrice = 0; List <BoundDetail> details = new List <BoundDetail>(); string id = IDHelper.GetID(OrderPrefix.OutboundOrder, shop.AutoCode); String pOrderID = IDHelper.GetID(OrderPrefix.AllocateOrder, shop.AutoCode); if (action == OperationEnum.Pick) { pOrderID = this.order.ID; } foreach (BoundDetail detail in this.curDetailList) { if (detail.SumCount <= 0) { continue; } totalCost += detail.SumCost; totalCount += detail.SumCount; totalPrice += detail.SumMoney; detail.BoundOrderID = id; details.Add(detail); // details.Add(this.InboundDetailConvertToOutboundDetail(detail, id)); } OutboundOrder order = new OutboundOrder() { SourceOrderID = pOrderID, ID = id, OperatorUserID = operatorId, ShopID = shop.ID, CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, TotalCost = totalCost, Remarks = this.skinTextBox_Remarks.SkinTxt.Text }; AllocateOrder pOrder = new AllocateOrder() { AllocateType = (byte)this.curAllocateType, ID = pOrderID, SourceUserID = order.OperatorUserID, OutboundOrderID = order.ID, InboundOrderID = String.Empty, DestShopID = ValidateUtil.CheckEmptyValue(this.skinComboBoxShopID.SelectedValue), CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, State = 0, SourceShopID = order.ShopID, Remarks = this.skinTextBox_Remarks.SkinTxt.Text // InboundOrderID= }; return(new AllocateOutboundPara() { AllocateOrder = pOrder, OutboundOrder = order, OutboundDetailList = details }); }
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 baseButton3_Click(object sender, EventArgs e) { try { if (this.guideComboBox1.SelectedIndex == 0) { GlobalMessageBox.Show("该笔单的导购员不能为空!"); return; } string id = IDHelper.GetID(OrderPrefix.RefundOrder, CommonGlobalCache.GetShop(shopID).AutoCode); bool isNoHasGuidFlag = false; bool isSuperlen = false; if (this.retailDetailList != null && this.retailDetailList.Count > 0) { foreach (RetailDetail detail in this.retailDetailList) { if (detail.GuideID == null || detail.GuideID == "") { isNoHasGuidFlag = true; break; } if (Math.Abs(detail.SumMoney) > 0 && Math.Abs(detail.SumMoney) > Convert.ToDecimal(99999999.99)) { isSuperlen = true; break; } } } if (isNoHasGuidFlag) { GlobalMessageBox.Show("导购员不能为空,请检查列表里所有款号的导购员!"); return; } if (isSuperlen) { GlobalMessageBox.Show("请检查列表里所有款号的金额是否大于99999999.99!"); return; } #region 创建RefundCostume对象 RefundCostume costume = new RefundCostume() { RefundOrder = null, RefundDetailList = new List <RetailDetail>() }; int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; decimal moneyCash = 0; foreach (RetailDetail detail in this. retailDetailList) { if (detail.IsRefund && detail.RefundCount > 0) { detail.Refunded = true; totalCount += detail.RefundCount; totalPrice += detail.RefundCount * detail.Price; totalCost += detail.RefundCount * detail.CostPrice; moneyCash += detail.SumMoney; detail.SalePrice = detail.Price; costume.RefundDetailList.Add(this.RetailDetailToRefundDetail(detail, id)); } } List <String> costumeIds = new List <string>(); foreach (var item in costume.RefundDetailList) { if (!costumeIds.Contains(item.CostumeID)) { costumeIds.Add(item.CostumeID); } } if (costumeIds != null && costumeIds.Count > 0) { //判断是否又禁用的商品,并提示返回 InteractResult interactResult = GlobalCache.ServerProxy.IsCostumeValid(costumeIds); if (interactResult.ExeResult == ExeResult.Error) { GlobalMessageBox.Show(interactResult.Msg); return; } } RetailOrder refundOrder = new RetailOrder() { ID = id, IsRefundOrder = true, OriginOrderID = string.Empty, //GuideID = (string)("-1".Equals(this.guideComboBox2.SelectedValue) ? string.Empty : this.guideComboBox2.SelectedValue), // OperateGuideID = (string)this.guideComboBox1.SelectedValue, GuideID = (string)this.guideComboBox1.SelectedValue, ShopID = shopID, MemeberID = this.memberIDTextBox2.Text, SalesPromotionID = string.Empty, PromotionText = string.Empty, // TotalMoneyReceived = this.currentRetailCostume.RetailOrder.TotalMoneyReceived, // TotalMoneyReceivedActual = this.currentRetailCostume.RetailOrder.TotalMoneyReceivedActual, MoneyBankCard = 0, MoneyWeiXin = 0, MoneyOther = 0, MoneyAlipay = 0, SmallMoneyRemoved = 0, MoneyChange = 0, TotalCount = totalCount * -1, TotalCost = totalCost * -1, TotalPrice = totalPrice * -1, EntryUserID = CommonGlobalCache.CurrentUserID, MoneyDiscounted = 0,//若是全部退款,折扣金额为原始折扣金额,否则为0 Remarks = this.skinTextBox_RefundReason.SkinTxt.Text.Trim(), CreateTime = DateTime.Now, }; costume.RefundOrder = refundOrder; #endregion costume.RefundOrder.MoneyCash = moneyCash * -1; costume.RefundOrder.MoneyCash2 = costume.RefundOrder.MoneyCash; costume.RefundOrder.MoneyIntegration = 0; costume.RefundOrder.MoneyVipCard = 0; costume.RefundOrder.MoneyVipCardMain = 0; costume.RefundOrder.MoneyVipCardDonate = 0; costume.RefundOrder.CreateTime = dateTimePicker_Start.Value; costume.RefundOrder.EntryTime = DateTime.Now; //总计=现金+积分+VIP卡+优惠券 //这笔单的应收金额 - (不退的那几件以原价* 数量 -满减金额) - (退的那几件)优惠券 costume.RefundOrder.TotalMoneyReceived = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyIntegration + costume.RefundOrder.MoneyVipCard; costume.RefundOrder.TotalMoneyReceivedActual = costume.RefundOrder.MoneyCash + costume.RefundOrder.MoneyVipCardMain; costume.RefundOrder.Benefit = costume.RefundOrder.TotalMoneyReceivedActual - costume.RefundOrder.TotalCost; // this.moneyDiscounted = costume.RefundOrder.to- costume.RefundOrder ; costume.IsNotHaveRetailOrder = true; if (Math.Abs(costume.RefundOrder.TotalCount) < 1) { GlobalMessageBox.Show("退货数量不能小于1"); return; } ConfirmRefundForm confirmRefundForm = new ConfirmRefundForm(costume, shopID, dataGridView1); DialogResult result = confirmRefundForm.ShowDialog(); if (result == DialogResult.Cancel) { return; } this.ResetForm(); } catch (Exception ee) { GlobalUtil.ShowError(ee); } }
private ScrapCostume Build() { if (this.curOutboundDetailList == null || this.curOutboundDetailList.Count == 0) { return(null); } int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; List <BoundDetail> outboundDetails = new List <BoundDetail>(); //使用报损单的店铺ID信息 // Shop shop = GlobalCache.ShopList.Find(t => t.ID == this.curReplenishOrder.ShopID); Shop shop = (Shop)this.skinComboBoxShopID.SelectedItem; string id = IDHelper.GetID(OrderPrefix.OutboundOrder, shop.AutoCode); string pOrderID = IDHelper.GetID(OrderPrefix.ScrapOrder, shop.AutoCode); foreach (BoundDetail detail in this.curOutboundDetailList) { if (detail.SumCount <= 0) { continue; } if (detail.Comment == null) { detail.Comment = ""; } totalCount += detail.SumCount; totalPrice += detail.SumMoney; totalCost += detail.SumCost; detail.BoundOrderID = id; outboundDetails.Add(detail); } OutboundOrder order = new OutboundOrder() { SourceOrderID = pOrderID, ID = id, OperatorUserID = GlobalCache.CurrentUserID, ShopID = ValidateUtil.CheckEmptyValue(this.skinComboBoxShopID.SelectedValue), CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalCost = totalCost, TotalPrice = totalPrice, Remarks = this.skinTextBox_Remarks.SkinTxt.Text }; ScrapOrder pOrder = new ScrapOrder() { // GuideID = ValidateUtil.CheckEmptyValue(this.guideComboBox1.SelectedValue), ID = pOrderID, OperatorUserID = GlobalCache.CurrentUserID, OutboundOrderID = order.ID, ShopID = order.ShopID, CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, Remarks = this.skinTextBox_Remarks.SkinTxt.Text }; List <ScrapDetail> scrapDetails = OutboundDetail2ScrapDetail(outboundDetails, pOrderID); return(new ScrapCostume() { ScrapOrder = pOrder, OutboundOrder = order, OutboundDetails = outboundDetails, ScrapDetails = scrapDetails }); }
private PfInfo Build() { if ( this.curInboundDetailList == null || this.curInboundDetailList.Count == 0) { return(null); } int totalCount = 0; decimal totalPrice = 0; decimal totalCost = 0; List <PfOrderDetail> details = new List <PfOrderDetail>(); //使用补货申请单的店铺ID信息 // Shop shop = GlobalCache.ShopList.Find(t => t.ID == this.curReplenishOrder.ShopID); Shop shop = (Shop)this.skinComboBoxShopID.SelectedItem; string id = IDHelper.GetID(OrderPrefix.PfDelivery, shop.AutoCode); if (action == OperationEnum.Pick) { id = order?.ID; } // string pOrderID = IDHelper.GetID(OrderPrefix.PurchaseOrder, shop.AutoCode); foreach (PfOrderDetail detail in this.curInboundDetailList) { if (detail.SumCount <= 0) { continue; } totalCount += detail.SumCount; totalPrice += detail.SumMoney; totalCost += detail.SumCost; detail.PfOrderID = id; details.Add(detail); } PfOrder pOrder = new PfOrder() { ShopID = shop.ID, PfCustomerID = selectedSupplierID,// ValidateUtil.CheckEmptyValue(this.skinComboBox_SupplierID.SelectedValue), ID = id, AdminUserID = GlobalCache.CurrentUserID, CreateTime = dateTimePicker_Start.Value, EntryTime = DateTime.Now, TotalCount = totalCount, TotalPrice = totalPrice, TotalPfPrice = totalCost, Remarks = this.skinTextBox_Remarks.SkinTxt.Text // InboundOrderID= }; return(new PfInfo() { PfOrder = pOrder, PfOrderDetails = details }); }