/// <summary> /// 删除实体 /// </summary> /// <param name="param">删除条件实体</param> /// <returns></returns> public WCFAddUpdateResult DelInfo(ORD_SalesReturnParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.SRGuid == null) { throw new WarnException("请指定要删除的退货单ID!"); } #endregion WhereClip whereClip = GetWhereClip(param); ORD_SalesReturnResult info = new ORD_SalesReturnResult(); info.IsDeleted = true; affect = this.Update <ORD_SalesReturnResult>(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); }
/// <summary> /// 查询条件 /// </summary> /// <param name="param"></param> /// <returns></returns> WhereClip GetWhereClip(ORD_SalesReturnParam param) { this.CheckSession(); WhereClip where = ORD_SalesReturn._.IsDeleted == 0; if (param.SRGuid != null) { where = where && ORD_SalesReturn._.SRGuid == param.SRGuid; } if (param.SRGuids != null && param.SRGuids.Length > 0) { where = where && ORD_SalesReturn._.SRGuid.In(param.SRGuids); } if (!string.IsNullOrEmpty(param.BillNo)) { where = where && ORD_SalesReturn._.BillNo.Like("%" + param.BillNo + "%"); } if (!string.IsNullOrEmpty(param.CustomerName)) { where = where && ORD_SalesReturn._.CustomerName.Like("%" + param.CustomerName + "%"); } if (!string.IsNullOrEmpty(param.Status)) { where = where && ORD_SalesReturn._.Status == param.Status; } if (param.StatusArr != null && param.StatusArr.Length > 0) { where = where && ORD_SalesReturn._.Status.In(param.StatusArr); } return(where); }
public WCFAddUpdateResult DelInfo(ORD_SalesReturnParam param) { WCFAddUpdateResult ret = new WCFAddUpdateResult(); ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesReturnBLL", "DelInfo", param); ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult); return(ret); }
public ORD_SalesReturnResult GetInfo(ORD_SalesReturnParam param) { ORD_SalesReturnResult ret = new ORD_SalesReturnResult(); ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesReturnBLL", "GetInfo", param); ret = rst == null ? new ORD_SalesReturnResult() : rst.Result as ORD_SalesReturnResult; return(ret); }
public bool AuditSalesReturnBill(ORD_SalesReturnParam param) { bool ret = true; ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesReturnBLL", "AuditSalesReturnBill", param); ret = (rst == null ? false : (bool)rst.Result); return(ret); }
public PageList <ORD_SalesReturnResult> GetPageList(ORD_SalesReturnParam param) { ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesReturnBLL", "GetPageList", param); PageList <ORD_SalesReturnResult> pageList = new PageList <ORD_SalesReturnResult>(); pageList = (rst == null ? new PageList <ORD_SalesReturnResult>() : rst.Result as PageList <ORD_SalesReturnResult>); return(pageList); }
public List <ORD_SalesReturnResult> GetList(ORD_SalesReturnParam param) { ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesReturnBLL", "GetList", param); List <ORD_SalesReturnResult> list = new List <ORD_SalesReturnResult>(); list = (rst == null ? new List <ORD_SalesReturnResult>() : rst.Result as List <ORD_SalesReturnResult>); return(list); }
/// <summary> /// 分页集合 /// </summary> /// <param name="param"></param> /// <returns></returns> public PageList <ORD_SalesReturnResult> GetPageList(ORD_SalesReturnParam param) { this.CheckSession(); PageList <ORD_SalesReturnResult> ret = new PageList <ORD_SalesReturnResult>(); try { List <Field> field = new List <Field>() { Field.All }; ret = this.SelectList <ORD_SalesReturnResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, GetWhereClip(param), ORD_SalesReturn._.CreatedTime.Desc); if (ret.ResultList != null && ret.ResultList.Count > 0) { HR_OrgBLL orgBLL = new HR_OrgBLL(); orgBLL.SessionInfo = this.SessionInfo; HR_OrgParam orgParam = new HR_OrgParam(); orgParam.OrgIDs = ret.ResultList.Where(a => a.OperOrgID != null).Select(a => a.OperOrgID).Distinct().ToArray(); List <HR_OrgResult> orgList = orgBLL.GetOrgTree(orgParam); HR_DepartmentBLL deptBLL = new HR_DepartmentBLL(); deptBLL.SessionInfo = this.SessionInfo; HR_DepartmentParam deptParam = new HR_DepartmentParam(); deptParam.DeptIDs = ret.ResultList.Where(a => a.OperDeptID != null).Select(a => a.OperDeptID).Distinct().ToArray(); List <HR_DepartmentResult> deptList = deptBLL.GetDeptList(deptParam); foreach (ORD_SalesReturnResult orderResult in ret.ResultList) { if (orderResult.OperOrgID != null) { orderResult.OperOrgName = orgList.FirstOrDefault(a => a.OrgID == orderResult.OperOrgID).OrgName; } if (orderResult.OperDeptID != null) { orderResult.OperDeptName = deptList.FirstOrDefault(a => a.DeptID == orderResult.OperDeptID).DeptName; } orderResult.AllStatus = orderResult.StkInStatus; } } } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
private void BindDataGridView(int pageIndex) { ORD_SalesReturnParam param = new ORD_SalesReturnParam(); param.PageIndex = pageIndex; param.PageSize = 100; param.BillNo = txtBillNo.Text.Trim(); PageList <ORD_SalesReturnResult> lstRst = returnLogic.GetPageList(param); dgvSalesReturn.DataSource = lstRst.ResultList; pgSalesReturn.RecordCount = lstRst.TotalCount; this.SetDataSource <ORD_SalesReturnResult>(lstRst.ResultList); SetGridCheck(this.dgvSalesReturn, _idColName, _chkColName); }
private void BindDataGridView(int pageIndex) { ORD_SalesReturnParam param = new ORD_SalesReturnParam(); param.BillNo = txtBillNo.Text; param.SOBillNo = txtSOBillNo.Text; param.PageIndex = pageIndex; param.PageSize = 100; PageList <ORD_SalesReturnResult> pageList = this.AsyncExecute <PageList <ORD_SalesReturnResult>, ORD_SalesReturnParam>(param, returnLogic.GetPageList, a => { dgvSalesReturn.DataSource = a.ResultList; pgSalesReturn.RecordCount = a.TotalCount; }); }
public bool UpdateStatus(ORD_SalesReturnParam param) { bool flag = true; try { ORD_SalesReturnResult orderResult = this.GetInfo(param); if (orderResult != null) { if (orderResult.ReturnLineList != null && orderResult.ReturnLineList.Count > 0) { List <ORD_SalesReturnLineResult> lineList = orderResult.ReturnLineList; if (lineList != null && lineList.Count > 0) { int?qty = lineList.Where(a => a.Qty != null).Select(a => a.Qty).Sum(); int?stkInQty = lineList.Where(a => a.StkInQty != null).Select(a => a.StkInQty).Sum(); if (stkInQty == 0) { orderResult.StkInStatus = "待入库"; } else if (stkInQty >= qty) { orderResult.StkInStatus = "全部入库"; } else { orderResult.StkInStatus = "部分入库"; } this.AddOrUpdate(orderResult); } } } } catch (WarnException exp) { flag = false; throw exp; } catch (System.Exception exp) { flag = false; LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(flag); }
private void tsbDel_Click(object sender, EventArgs e) { ORD_SalesReturnParam param = new ORD_SalesReturnParam(); param.SRGuid = srguid; ORD_SalesReturnResult rst = returnLogic.GetInfo(param); if (rst != null) { if (MessageBox.Show("请确认是否要删除销售退货单:【" + rst.BillNo + "】", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { WCFAddUpdateResult result = this.AsyncExecute <WCFAddUpdateResult, ORD_SalesReturnParam>(param, returnLogic.DelInfo, a => { BindDataGridView(pgSalesReturn.PageIndex); }); } } else { this.ShowMessage("请选择需要删除的采购明细!"); } }
/// <summary> /// 获取集合 /// </summary> /// <param name="param"></param> /// <returns></returns> public List <ORD_SalesReturnResult> GetList(ORD_SalesReturnParam param) { this.CheckSession(); List <ORD_SalesReturnResult> ret = new List <ORD_SalesReturnResult>(); try { WhereClip whereClip = GetWhereClip(param); ret = this.SelectList <ORD_SalesReturnResult>(whereClip, ORD_SalesReturn._.CreatedTime.Desc); } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 获取一条信息记录 /// </summary> /// <param name="param"></param> /// <returns></returns> public ORD_SalesReturnResult GetInfo(ORD_SalesReturnParam param) { this.CheckSession(); ORD_SalesReturnResult rst = new ORD_SalesReturnResult(); #region 判断 if (param.SRGuid == null) { throw new WarnException("请指定销售退货单GUID!"); } #endregion #region 获取实体 rst = this.Select <ORD_SalesReturnResult>(GetWhereClip(param)); if (rst != null) { string[] statusArr = new string[] { rst.StkInStatus }; rst.AllStatus = string.Join(",", statusArr); ORD_SalesReturnLineBLL lineBLL = new ORD_SalesReturnLineBLL(); lineBLL.SessionInfo = this.SessionInfo; rst.ReturnLineList = lineBLL.GetList(new ORD_SalesReturnLineParam() { SRGuid = rst.SRGuid }); //this.SelectList<ORD_SalesOrderLineResult>(ORD_SalesOrderLine._.SOGuid == rst.SOGuid); HR_DepartmentBLL deptBLL = new HR_DepartmentBLL(); deptBLL.SessionInfo = this.SessionInfo; HR_DepartmentResult deptResult = deptBLL.GetInfo(new HR_DepartmentParam() { DeptID = rst.OperDeptID }); rst.OperDeptName = deptResult.DeptName; } #endregion return(rst); }
public bool SubmitSalesReturnBill(ORD_SalesReturnParam param) { this.CheckSession(); bool submitFlag = true; try { ORD_SalesReturnResult returnResult = this.GetInfo(param); if (returnResult != null) { #region 判断是否可以提交 bool isAllowSubmit = true; if (returnResult.ApproveStatus == "待审核") { isAllowSubmit = false; throw new WarnException("销售退货单当前状态为:【已提交,待审核】,禁止重复提交!"); } else if (returnResult.ApproveStatus == "审核完成") { isAllowSubmit = false; throw new WarnException("销售退货单当前状态为:【审核完成】,撤单后才可以再次提交!"); } if (isAllowSubmit) { returnResult.Status = "Approve"; returnResult.ApproveStatus = "待审核"; WCFAddUpdateResult ret = this.AddOrUpdate(returnResult); if (ret.KeyGuid.ToGuid() == Guid.Empty) { submitFlag = false; } else { #region 定义相关变量 ORD_SalesOrderBLL saleOrderBLL = new ORD_SalesOrderBLL(); saleOrderBLL.SessionInfo = this.SessionInfo; ORD_SalesOrderLineBLL saleOrderLineBLL = new ORD_SalesOrderLineBLL(); saleOrderLineBLL.SessionInfo = this.SessionInfo; STK_OutBLL outBLL = new STK_OutBLL(); outBLL.SessionInfo = this.SessionInfo; STK_OutLineBLL outLineBLL = new STK_OutLineBLL(); outLineBLL.SessionInfo = this.SessionInfo; ORD_SalesReturnLineBLL returnLineBLL = new ORD_SalesReturnLineBLL(); returnLineBLL.SessionInfo = this.SessionInfo; Guid?[] SOLineGuids = null; Guid?[] StkOutLineGuids = null; Guid?[] SRGuids = null; Guid?[] effSRGuids = null; Guid?[] SOGuids = null; List <STK_OutLineResult> linkOutLineList = new List <STK_OutLineResult>(); List <ORD_SalesOrderLineResult> linkSaleOrderLineList = new List <ORD_SalesOrderLineResult>(); List <ORD_SalesReturnResult> linkReturnList = new List <ORD_SalesReturnResult>(); List <ORD_SalesReturnLineResult> linkReturnLineList = new List <ORD_SalesReturnLineResult>(); List <ORD_SalesReturnLineResult> effReturnLineList = new List <ORD_SalesReturnLineResult>(); #endregion List <ORD_SalesReturnLineResult> salesReturnLineList = returnLineBLL.GetList(new ORD_SalesReturnLineParam() { SRGuid = returnResult.SRGuid }); #region 更新出库明细的数量 //获取退货明细关联的出库明细ID集合 StkOutLineGuids = salesReturnLineList.Select(a => a.StkOutLineGuid).Distinct().ToArray(); if (StkOutLineGuids != null && StkOutLineGuids.Length > 0) { //退货明细关联的出库明细 linkOutLineList = outLineBLL.GetList(new STK_OutLineParam() { StkOutLineGuids = StkOutLineGuids }); //关联的出库明细所关联的退货明细 linkReturnLineList = returnLineBLL.GetList(new ORD_SalesReturnLineParam() { StkOutLineGuids = StkOutLineGuids }); SRGuids = linkReturnLineList.Select(a => a.SRGuid).Distinct().ToArray(); if (SRGuids != null && SRGuids.Length > 0) { //关联的出库明细所关联的退货明细对应的退货主单 linkReturnList = this.GetList(new ORD_SalesReturnParam() { SRGuids = SRGuids, StatusArr = new string[] { "Complete", "Approve" } }); if (linkReturnList != null && linkReturnList.Count > 0) { effSRGuids = linkReturnList.Select(a => (Guid?)a.SRGuid).Distinct().ToArray(); effReturnLineList = linkReturnLineList.Where(a => effSRGuids.Contains(a.SRGuid)).ToList(); foreach (STK_OutLineResult outLineResult in linkOutLineList) { int?qty = effReturnLineList.Where(a => a.StkOutLineGuid == outLineResult.StkOutLineGuid).Sum(a => a.Qty.ToInt32()); outLineResult.ReturnOccQty = qty; } } } //更新退货明细关联的出库明细的退货数量 outLineBLL.UpdateOrInsertList(linkOutLineList); } #endregion #region 更新销售明细的退货占有数量和销售主单的退货占有状态 //获取关联的销售明细ID集合 SOLineGuids = salesReturnLineList.Select(a => a.SOLineGuid).Distinct().ToArray(); linkSaleOrderLineList = saleOrderLineBLL.GetList(new ORD_SalesOrderLineParam() { SOLineGuids = SOLineGuids, IsCancel = false }); //获取关联的销售明细所关联的退货明细 linkReturnLineList = returnLineBLL.GetList(new ORD_SalesReturnLineParam() { SOLineGuids = SOLineGuids }); SRGuids = linkReturnLineList.Select(a => a.SRGuid).Distinct().ToArray(); if (SRGuids != null && SRGuids.Length > 0) { //销售明细所关联的退货明细对应的退货主单 linkReturnList = this.GetList(new ORD_SalesReturnParam() { SRGuids = SRGuids, StatusArr = new string[] { "Complete", "Approve" } }); if (linkReturnList != null && linkReturnList.Count > 0) { effSRGuids = linkReturnList.Select(a => (Guid?)a.SRGuid).Distinct().ToArray(); effReturnLineList = linkReturnLineList.Where(a => effSRGuids.Contains(a.SRGuid)).ToList(); foreach (ORD_SalesOrderLineResult saleLineResult in linkSaleOrderLineList) { int?qty = effReturnLineList.Where(a => a.SOLineGuid == saleLineResult.SOLineGuid).Sum(a => a.Qty.ToInt32()); saleLineResult.ReturnOccQty = qty; } } } saleOrderLineBLL.UpdateOrInsertList(linkSaleOrderLineList); SOGuids = linkSaleOrderLineList.Select(a => a.SOGuid).Distinct().ToArray(); foreach (Guid soguid in SOGuids) { saleOrderBLL.UpdateStatus(new ORD_SalesOrderParam() { SOGuid = soguid }); } #endregion } } #endregion } else { throw new WarnException("要提交的销售退货单在系统中不存在!"); } } catch (WarnException exp) { throw exp; } catch (Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(submitFlag); }