public void SetStkLineObjectValue(ORD_SalesReturnLineResult returnLineResult, STK_OutLineResult outLineRst) { returnLineResult.SOGuid = outLineRst.SourceBillGuid; returnLineResult.SOBillNo = outLineRst.SourceBillNo;//销售单号 returnLineResult.SOLineGuid = outLineRst.SourceBillLineGuid; returnLineResult.StkOutGuid = outLineRst.StkOutGuid; returnLineResult.StkOutBillNo = outLineRst.StkOutBillNo;//出库单号 returnLineResult.StkOutLineGuid = outLineRst.StkOutLineGuid; returnLineResult.BuyerID = outLineRst.BuyerID; returnLineResult.BuyerName = outLineRst.BuyerName; returnLineResult.StkInLineGuid = outLineRst.StkInLineGuid; returnLineResult.ItemCode = outLineRst.ItemCode; returnLineResult.Model = outLineRst.Model; returnLineResult.Brand = outLineRst.Brand; returnLineResult.Package = outLineRst.Package; returnLineResult.Batch = outLineRst.Batch; returnLineResult.MPQ = outLineRst.MPQ; returnLineResult.Quality = outLineRst.Quality; returnLineResult.MarkCode = outLineRst.MarkCode; returnLineResult.InvType = outLineRst.InvType; returnLineResult.Currency = outLineRst.Currency; returnLineResult.Unit = outLineRst.Unit; returnLineResult.UnitPrice = outLineRst.UnitPrice; returnLineResult.Qty = outLineRst.Qty.ToInt32() - outLineRst.ReturnOccQty.ToInt32(); returnLineResult.Amount = returnLineResult.UnitPrice * returnLineResult.Qty; returnLineResult.Warehouse = outLineRst.Warehouse; returnLineResult.Location = outLineRst.Location; returnLineResult.IsDeleted = false; }
public void SetStkLineObjectValue(STK_InLineResult inLineRst, ORD_SalesReturnLineResult returnLineResult) { inLineRst.ItemCode = returnLineResult.ItemCode; inLineRst.BuyerID = returnLineResult.BuyerID; inLineRst.BuyerName = returnLineResult.BuyerName; inLineRst.SourceBillGuid = returnLineResult.SRGuid; inLineRst.SourceBillLineGuid = returnLineResult.SRLineGuid; inLineRst.Model = returnLineResult.Model; inLineRst.Brand = returnLineResult.Brand; inLineRst.Package = returnLineResult.Package; inLineRst.Batch = returnLineResult.Batch; inLineRst.InvType = returnLineResult.InvType; inLineRst.Currency = returnLineResult.LinkStkInCurrency; inLineRst.TaxRate = returnLineResult.LinkStkInTaxRate; inLineRst.ExchangeRate = returnLineResult.LinkStkInExchangeRate; inLineRst.Unit = returnLineResult.Unit; inLineRst.UnitPrice = returnLineResult.LinkStkInUnitPrice; inLineRst.Freight = returnLineResult.LinkStkInFreight; inLineRst.CostPrice = returnLineResult.LinkStkInCostPrice; inLineRst.Qty = returnLineResult.Qty.ToInt32() - returnLineResult.StkInOccQty.ToInt32(); inLineRst.Amount = inLineRst.CostPrice * inLineRst.Qty; inLineRst.SCAmount = inLineRst.CostPrice * inLineRst.Qty; inLineRst.Warehouse = returnLineResult.Warehouse; inLineRst.Location = returnLineResult.Location; inLineRst.IsCut = true; inLineRst.IsPCut = true; inLineRst.IsRaiseTaxes = false; inLineRst.IsGive = false; inLineRst.IsDeleted = false; }
/// <summary> /// 删除实体 /// </summary> /// <param name="param">删除条件实体</param> /// <returns></returns> public WCFAddUpdateResult DelInfo(ORD_SalesReturnLineParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.SRLineGuid == null) { throw new WarnException("请指定明细GUID!"); } #endregion WhereClip whereClip = GetWhereClip(param); ORD_SalesReturnLineResult info = new ORD_SalesReturnLineResult(); info.IsDeleted = true; affect = this.Update <ORD_SalesReturnLineResult>(info, whereClip); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
void InitSourceData(ORD_SalesOrderResult orderResult) { if (orderResult != null) { txtSOGuid.Text = orderResult.SOGuid.ToStringHasNull(); txtSOBillNo.Text = orderResult.BillNo; cboCurrency.SelectedValue = orderResult.Currency; txtSODate.Text = orderResult.SODate.ToStringHasNull(); txtCustomerID.Text = orderResult.CustomerID.ToStringHasNull(); txtCustomerName.Text = orderResult.CustomerName; decimal?totalAmount = 0.0m; List <STK_OutLineResult> outLineList = outLineLogic.GetList(new STK_OutLineParam() { SourceBillGuid = orderResult.SOGuid, IsReturnOver = false }); foreach (STK_OutLineResult outLineResult in outLineList) { ORD_SalesReturnLineResult returnListResult = new ORD_SalesReturnLineResult(); SetStkLineObjectValue(returnListResult, outLineResult); totalAmount += returnListResult.Amount; bsSalesReturnLine.Add(returnListResult); } totalAmount = Math.Round(totalAmount.ToDecimal(), 3, MidpointRounding.AwayFromZero); txtAmount.Text = totalAmount.ToStringHasNull(); } }
private void btnInsertBefore_Click(object sender, EventArgs e) { ORD_SalesReturnLineResult rst = new ORD_SalesReturnLineResult(); InitNewData(rst); bsSalesReturnLine.Insert(dgvSalesReturnLine.CurrentRow.Index, rst); }
private void btnAddRow_Click(object sender, EventArgs e) { bsSalesReturnLine.AddNew(); ORD_SalesReturnLineResult rst = bsSalesReturnLine.Current as ORD_SalesReturnLineResult; InitNewData(rst); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(ORD_SalesReturnLineResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 #endregion #region 系统默认值 if (param.SRLineGuid != null) { WhereClip where = ORD_SalesReturnLine._.SRLineGuid == param.SRLineGuid; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedEmpName = this.SessionInfo.UserName; param.UpdatedTime = DateTime.Now; affect = this.Update <ORD_SalesReturnLineResult>(param, where); } else { param.SRLineGuid = Guid.NewGuid(); param.IsDeleted = false; param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedEmpName = this.SessionInfo.UserName; param.CreatedTime = DateTime.Now; affect = this.Insert <ORD_SalesReturnLineResult>(param); param = this.Select <ORD_SalesReturnLineResult>(new List <Field>() { ORD_SalesReturnLine._.All }, ORD_SalesReturnLine._.SRLineGuid == param.SRLineGuid); } #region 设置返回值 ret.KeyGuid = param.SRLineGuid; ret.CreatedTime = param.CreatedTime; ret.CreatedEmpID = param.CreatedEmpID; ret.CreatedEmpName = param.CreatedEmpName; ret.UpdatedEmpID = param.UpdatedEmpID; ret.UpdatedEmpName = param.UpdatedEmpName; ret.UpdatedTime = param.UpdatedTime; #endregion #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
private void btnDelRow_Click(object sender, EventArgs e) { if (this.bsSalesReturnLine.Current != null) { Guid?SRGuid = null; ORD_SalesReturnLineResult delResult = this.bsSalesReturnLine.Current as ORD_SalesReturnLineResult; SRGuid = delResult.SRGuid; if (SRGuid.ToGuid() != Guid.Empty) { delResult.IsDeleted = true; delList.Add(delResult); } bsSalesReturnLine.RemoveCurrent(); } }
/// <summary> /// 获取一条信息记录 /// </summary> /// <param name="param"></param> /// <returns></returns> public ORD_SalesReturnLineResult GetInfo(ORD_SalesReturnLineParam param) { this.CheckSession(); ORD_SalesReturnLineResult rst = new ORD_SalesReturnLineResult(); #region 判断 if (param.SRLineGuid == null) { throw new WarnException("请指定明细GUID!"); } #endregion #region 获取实体 rst = this.Select <ORD_SalesReturnLineResult>(GetWhereClip(param)); #endregion return(rst); }
private void ImportSourceLine(bool isMutiSelect) { if (string.IsNullOrEmpty(txtCustomerID.Text)) { this.ShowMessage("请选择客户!"); return; } if (string.IsNullOrEmpty(cboCurrency.Text)) { this.ShowMessage("请选择币种!"); return; } frmSelectStkOutLine frm = new frmSelectStkOutLine(isMutiSelect); if (txtSOGuid.Text.ToGuid() != Guid.Empty) { frm.SourceBillGuid = txtSOGuid.Text.ToGuid(); } Guid? stkOutLineGuid = Guid.Empty; string model = string.Empty; if (!isMutiSelect) { stkOutLineGuid = dgvSalesReturnLine.CurrentRow.Cells["colStkOutLineGuid"].Value.ToGuid(); model = dgvSalesReturnLine.CurrentRow.Cells["colModel"].Value.ToStringHasNull(); } if (!string.IsNullOrEmpty(model)) { frm.Model = model; } if (stkOutLineGuid != Guid.Empty) //如果已经存在关联的源单据明细,则只筛选此条明细 { frm.StkOutLineGuid = stkOutLineGuid; } else //如果是新行,则排除掉已经存在列表里面的所有的源单据明细 { Guid?[] noStkOutLineGuids = addOrModifyList.Where(a => a.StkOutLineGuid.ToGuid() != Guid.Empty).Select(a => a.StkOutLineGuid).Distinct().ToArray(); frm.NoStkOutLineGuids = noStkOutLineGuids; } frm.BringToFront(); frm.StartPosition = FormStartPosition.CenterScreen; DialogResult rst = frm.ShowDialog(); if (rst == DialogResult.OK) { List <STK_OutLineResult> rstList = frm.GetSelectList <STK_OutLineResult>(); if (rstList != null && rstList.Count > 0) { foreach (STK_OutLineResult outLineResult in rstList) { bool isAddNew = true; foreach (DataGridViewRow row in dgvSalesReturnLine.Rows) { //如果是已经存在的行,则利用现成的行进行编辑 if (row.Cells["colStkOutLineGuid"].Value.ToGuid() == outLineResult.StkOutLineGuid) { isAddNew = false; ORD_SalesReturnLineResult returnLineResult = bsSalesReturnLine[row.Index] as ORD_SalesReturnLineResult; SetStkLineObjectValue(returnLineResult, outLineResult); break; } } if (isAddNew) { if (!isMutiSelect) //单选 { ORD_SalesReturnLineResult returnLineResult = bsSalesReturnLine.Current as ORD_SalesReturnLineResult; SetStkLineObjectValue(returnLineResult, outLineResult); } else //多选 { ORD_SalesReturnLineResult returnLineResult = new ORD_SalesReturnLineResult(); SetStkLineObjectValue(returnLineResult, outLineResult); bsSalesReturnLine.Add(returnLineResult); } } } } } dgvSalesReturnLine.EndEdit(); }
void InitNewData(ORD_SalesReturnLineResult rst) { rst.Currency = cboCurrency.SelectedValue.ToStringHasNull(); rst.InvType = "备货库存"; rst.Unit = "PCS"; }