private void btnAddRow_Click(object sender, EventArgs e) { bsStkInLine.AddNew(); STK_InLineResult rst = bsStkInLine.Current as STK_InLineResult; InitNewData(rst); }
public void SetStkLineObjectValue(STK_InLineResult inLineRst, ORD_PurchaseOrderLineResult purLineRst) { inLineRst.BuyerID = purLineRst.BuyerID; inLineRst.BuyerName = purLineRst.BuyerName; inLineRst.SourceBillGuid = purLineRst.POGuid; inLineRst.SourceBillLineGuid = purLineRst.POLineGuid; inLineRst.SOLineGuid = purLineRst.SOLineGuid; inLineRst.Model = purLineRst.Model; inLineRst.Brand = purLineRst.Brand; inLineRst.Package = purLineRst.Package; inLineRst.Batch = purLineRst.Batch; inLineRst.InvType = purLineRst.InvType; inLineRst.Currency = purLineRst.Currency; inLineRst.Unit = purLineRst.Unit; inLineRst.UnitPrice = purLineRst.UnitPrice; inLineRst.CostPrice = inLineRst.UnitPrice.ToDecimal() + inLineRst.Freight.ToDecimal(); inLineRst.Qty = purLineRst.Qty.ToInt32() - purLineRst.StkInQty.ToInt32(); inLineRst.Amount = purLineRst.UnitPrice * purLineRst.Qty; inLineRst.SCAmount = inLineRst.Amount * inLineRst.ExchangeRate; inLineRst.TaxRate = purLineRst.TaxRate; inLineRst.Warehouse = purLineRst.Warehouse; inLineRst.Location = purLineRst.Location; inLineRst.IsCut = true; inLineRst.IsPCut = true; inLineRst.IsRaiseTaxes = false; inLineRst.IsGive = inLineRst.IsGive == true ? true : false; inLineRst.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(STK_InLineParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.StkInLineGuid == null) { throw new WarnException("请指定明细GUID!"); } #endregion WhereClip whereClip = GetWhereClip(param); STK_InLineResult info = new STK_InLineResult(); info.IsDeleted = true; affect = this.Update <STK_InLineResult>(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); }
public STK_InLineResult GetInfo(STK_InLineParam param) { STK_InLineResult ret = new STK_InLineResult(); ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.STK.STK_InLineBLL", "GetInfo", param); ret = rst == null ? new STK_InLineResult() : rst.Result as STK_InLineResult; return(ret); }
private void btnInsertBefore_Click(object sender, EventArgs e) { if (dgvStkInLine.CurrentRow != null) { STK_InLineResult rst = new STK_InLineResult(); InitNewData(rst); bsStkInLine.Insert(dgvStkInLine.CurrentRow.Index, rst); } }
/// <summary> /// 获取集合 /// </summary> /// <param name="param"></param> /// <returns></returns> public List <ORD_SalesReturnLineResult> GetList(ORD_SalesReturnLineParam param) { this.CheckSession(); List <ORD_SalesReturnLineResult> ret = new List <ORD_SalesReturnLineResult>(); try { WhereClip whereClip = GetWhereClip(param); ret = this.SelectList <ORD_SalesReturnLineResult>(whereClip, ORD_SalesReturnLine._.CreatedTime.Asc); if (ret != null) { STK_InLineBLL stkInLineBLL = new STK_InLineBLL(); stkInLineBLL.SessionInfo = this.SessionInfo; Guid?[] stkInLineGuids = ret.Select(a => a.StkInLineGuid).Distinct().ToArray(); List <STK_InLineResult> linkInLineResultList = stkInLineBLL.GetList(new STK_InLineParam() { StkInLineGuids = stkInLineGuids }); ORD_SalesReturnBLL returnBLL = new ORD_SalesReturnBLL(); returnBLL.SessionInfo = this.SessionInfo; Guid?[] SRGuids = ret.Select(a => a.SRGuid).Distinct().ToArray(); List <ORD_SalesReturnResult> returnResultList = returnBLL.GetList(new ORD_SalesReturnParam() { SRGuids = SRGuids }); foreach (ORD_SalesReturnLineResult returnLineResult in ret) { ORD_SalesReturnResult returnResult = returnResultList.FirstOrDefault(a => a.SRGuid == returnLineResult.SRGuid); if (returnResult != null) { returnLineResult.SRBillNo = returnResult.BillNo; } STK_InLineResult linkStkInLineResult = linkInLineResultList.FirstOrDefault(a => a.StkInLineGuid == returnLineResult.StkInLineGuid); if (linkStkInLineResult != null) { returnLineResult.LinkStkInCurrency = linkStkInLineResult.Currency; returnLineResult.LinkStkInTaxRate = linkStkInLineResult.TaxRate; returnLineResult.LinkStkInUnitPrice = linkStkInLineResult.UnitPrice; returnLineResult.LinkStkInFreight = linkStkInLineResult.Freight; returnLineResult.LinkStkInCostPrice = linkStkInLineResult.CostPrice; } } } } 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.bsStkInLine.Current != null) { Guid? stkInLineGuid = null; STK_InLineResult delResult = this.bsStkInLine.Current as STK_InLineResult; stkInLineGuid = delResult.StkInLineGuid; if (stkInLineGuid != null) { delResult.IsDeleted = true; delList.Add(delResult); } bsStkInLine.RemoveCurrent(); } }
/// <summary> /// 获取一条信息记录 /// </summary> /// <param name="param"></param> /// <returns></returns> public STK_InLineResult GetInfo(STK_InLineParam param) { this.CheckSession(); STK_InLineResult rst = new STK_InLineResult(); #region 判断 if (param.StkInLineGuid == null) { throw new WarnException("请指定明细GUID!"); } #endregion #region 获取实体 rst = this.Select <STK_InLineResult>(GetWhereClip(param)); #endregion return(rst); }
private void dgvStkInLine_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > -1) { if (dgvStkInLine.Columns[e.ColumnIndex].Name == "colAddGive") { STK_InLineResult rst = bsStkInLine.Current as STK_InLineResult; STK_InLineResult newLine = EntityHandler.Clone(rst); newLine.StkInGuid = null; newLine.StkInLineGuid = null; newLine.IsCut = true; newLine.IsPCut = true; newLine.IsRaiseTaxes = false; newLine.IsGive = true; newLine.IsDeleted = false; newLine.Qty = null; newLine.UnitPrice = null; newLine.CostPrice = null; newLine.CostPrice = null; newLine.Amount = null; bsStkInLine.Insert(e.RowIndex + 1, newLine); } } }
public void SetStkLineObjectValue(ORD_SalesReturnResult salesReturnRst) { decimal? totalAmount = 0.0m; decimal? scAmount = 0.0m; STK_InLineResult inLineRst; txtSourceBillGuid.Text = salesReturnRst.SRGuid.ToStringHasNull(); txtSourceBillNo.Text = salesReturnRst.BillNo; cboTaxRate.SelectedValue = ""; if (salesReturnRst.ReturnLineList != null && salesReturnRst.ReturnLineList.Count > 0) { cboCurrency.SelectedValue = salesReturnRst.ReturnLineList[0].Currency; } else { cboCurrency.SelectedValue = ""; } foreach (ORD_SalesReturnLineResult returnLineResult in salesReturnRst.ReturnLineList) { inLineRst = new STK_InLineResult(); SetStkLineObjectValue(inLineRst, returnLineResult); totalAmount += inLineRst.Amount.ToDecimal(); scAmount += inLineRst.SCAmount.ToDecimal(); bsStkInLine.Add(inLineRst); } totalAmount = Math.Round(totalAmount.ToDecimal(), 3, MidpointRounding.AwayFromZero); scAmount = Math.Round(scAmount.ToDecimal(), 3, MidpointRounding.AwayFromZero); txtAmount.Text = totalAmount.ToStringHasNull(); txtSCAmount.Text = scAmount.ToStringHasNull(); txtTaxAmount.Text = ""; this.cboOperOrgID.SelectedValue = salesReturnRst.OperOrgID; this.txtOperDeptID.Text = salesReturnRst.OperDeptName; this.txtOperDeptID.Text = salesReturnRst.OperDeptID.ToStringHasNull(); this.txtOperEmpID.Text = salesReturnRst.OperEmpID.ToStringHasNull(); this.txtOperEmpName.Text = salesReturnRst.OperEmpName.ToStringHasNull(); }
public void SetStkLineObjectValue(ORD_PurchaseOrderResult purchaseOrder) { decimal? taxAmount = 0.0m; decimal? totalAmount = 0.0m; decimal? scAmount = 0.0m; STK_InLineResult inLineRst; txtSourceBillGuid.Text = purchaseOrder.POGuid.ToStringHasNull(); txtSourceBillNo.Text = purchaseOrder.BillNo; cboCurrency.SelectedValue = purchaseOrder.Currency; cboTaxRate.SelectedValue = purchaseOrder.TaxRate.ToDecimal(); foreach (ORD_PurchaseOrderLineResult purLineRst in purchaseOrder.OrderLineList) { inLineRst = new STK_InLineResult(); purLineRst.BuyerID = purchaseOrder.BuyerID; purLineRst.BuyerName = purchaseOrder.BuyerName; purLineRst.Currency = purchaseOrder.Currency; SetStkLineObjectValue(inLineRst, purLineRst); bsStkInLine.Add(inLineRst); taxAmount += inLineRst.TaxRate.ToDecimal(); totalAmount += inLineRst.Amount.ToDecimal(); taxAmount += purLineRst.UnitPrice * purLineRst.Qty.ToInt32() - purLineRst.NTaxPrice * purLineRst.Qty.ToInt32(); scAmount += inLineRst.SCAmount.ToDecimal(); } totalAmount = Math.Round(totalAmount.ToDecimal(), 3, MidpointRounding.AwayFromZero); scAmount = Math.Round(scAmount.ToDecimal(), 3, MidpointRounding.AwayFromZero); taxAmount = Math.Round(taxAmount.ToDecimal(), 3, MidpointRounding.AwayFromZero); txtAmount.Text = totalAmount.ToStringHasNull(); txtSCAmount.Text = scAmount.ToStringHasNull(); txtTaxAmount.Text = taxAmount.ToStringHasNull(); this.cboOperOrgID.SelectedValue = purchaseOrder.PurOrgID; this.txtOperDeptID.Text = purchaseOrder.PurDeptName; this.txtOperDeptID.Text = purchaseOrder.PurDeptID.ToStringHasNull(); this.txtOperEmpID.Text = purchaseOrder.BuyerID.ToStringHasNull(); this.txtOperEmpName.Text = purchaseOrder.BuyerName.ToStringHasNull(); }
public void SetStkLineObjectValue(ORD_PurchaseReturnLineResult returnLineResult, STK_InLineResult inLineRst) { returnLineResult.POGuid = inLineRst.SourceBillGuid; returnLineResult.POBillNo = inLineRst.SourceBillNo;//采购单号 returnLineResult.POLineGuid = inLineRst.SourceBillLineGuid; returnLineResult.StkInGuid = inLineRst.StkInGuid; returnLineResult.StkInBillNo = inLineRst.StkInBillNo;//入库单号 returnLineResult.StkInLineGuid = inLineRst.StkInLineGuid; returnLineResult.ItemCode = inLineRst.ItemCode; returnLineResult.Model = inLineRst.Model; returnLineResult.Brand = inLineRst.Brand; returnLineResult.Package = inLineRst.Package; returnLineResult.Batch = inLineRst.Batch; returnLineResult.MPQ = inLineRst.MPQ; returnLineResult.Quality = inLineRst.Quality; returnLineResult.MarkCode = inLineRst.MarkCode; returnLineResult.InvType = inLineRst.InvType; returnLineResult.Unit = inLineRst.Unit; returnLineResult.UnitPrice = inLineRst.UnitPrice; returnLineResult.Qty = inLineRst.Qty.ToInt32() - inLineRst.ReturnOccQty.ToInt32(); returnLineResult.Currency = inLineRst.Currency; returnLineResult.Amount = returnLineResult.UnitPrice * returnLineResult.Qty; returnLineResult.Warehouse = inLineRst.Warehouse; returnLineResult.Location = inLineRst.Location; returnLineResult.IsDeleted = false; }
private void ImportSalesReturnLineLine(bool isMutiSelect) { if (!string.IsNullOrEmpty(txtSourceBillGuid.Text)) { frmSelectSalesReturnLine frm = new frmSelectSalesReturnLine(isMutiSelect); frm.SRGuid = txtSourceBillGuid.Text.ToGuid(); Guid? srlineGuid = Guid.Empty; string model = string.Empty; if (!isMutiSelect) { srlineGuid = dgvStkInLine.CurrentRow.Cells["colSourceBillLineGuid"].Value.ToGuid(); model = dgvStkInLine.CurrentRow.Cells["colModel"].Value.ToStringHasNull(); } if (!string.IsNullOrEmpty(model)) { frm.Model = model; } if (srlineGuid != Guid.Empty)//如果已经存在关联的源单据明细,则只筛选此条明细 { frm.SRLineGuid = srlineGuid; } else//如果是新行,则排除掉已经存在列表里面的所有的源单据明细 { Guid?[] noSRLineGuids = addOrModifyList.Where(a => a.SourceBillLineGuid.ToGuid() != Guid.Empty).Select(a => a.SourceBillLineGuid).Distinct().ToArray(); frm.NoSRLineGuids = noSRLineGuids; } frm.BringToFront(); frm.StartPosition = FormStartPosition.CenterScreen; DialogResult rst = frm.ShowDialog(); if (rst == DialogResult.OK) { List <ORD_SalesReturnLineResult> rstList = frm.GetSelectList <ORD_SalesReturnLineResult>(); if (rstList != null && rstList.Count > 0) { foreach (ORD_SalesReturnLineResult returnLineResult in rstList) { bool isAddNew = true; foreach (DataGridViewRow row in dgvStkInLine.Rows) { //如果是已经存在的行,则利用现成的行进行编辑 if (row.Cells["colSourceBillLineGuid"].Value.ToGuid() == returnLineResult.SRLineGuid) { isAddNew = false; STK_InLineResult stkInLineResult = bsStkInLine[row.Index] as STK_InLineResult; SetStkLineObjectValue(stkInLineResult, returnLineResult); break; } } if (isAddNew) { if (!isMutiSelect)//单选 { STK_InLineResult stkInLineResult = bsStkInLine.Current as STK_InLineResult; SetStkLineObjectValue(stkInLineResult, returnLineResult); } else//多选 { STK_InLineResult stkInLineResult = new STK_InLineResult(); SetStkLineObjectValue(stkInLineResult, returnLineResult); bsStkInLine.Add(stkInLineResult); } } } } } dgvStkInLine.EndEdit(); CalcExchangeRate(); } else { MessageBox.Show("请先选择源单据!"); } }
void InitNewData(STK_InLineResult rst) { rst.InvType = "备货库存"; rst.Unit = "PCS"; rst.SCAmount = 0; }