/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(CRM_VisitPlanResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (param.CompanyGuID == Guid.Empty) { throw new WarnException("请选择跟踪的客户!"); } if (string.IsNullOrEmpty(param.PlanName)) { throw new WarnException("请指定跟踪主题!"); } if (string.IsNullOrEmpty(param.VstText)) { throw new WarnException("请填写拜访内容!"); } if (string.IsNullOrEmpty(param.VstTyp)) { throw new WarnException("请选择拜访类型!"); } if (param.OpEmpID.ToInt32() <= 0) { throw new WarnException("请选择所属人!"); } if (param.StartDate == null) { throw new WarnException("请选择开始时间!"); } #endregion #region 系统默认值 if (param.CustVstPlnID.ToInt32() > 0) { WhereClip where = CRM_VisitPlan._.CustVstPlnID == param.CustVstPlnID; param.GCompanyGuID = this.SessionInfo.CompanyID; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedEmpName = this.SessionInfo.UserName; param.UpdatedTime = DateTime.Now; affect = this.Update <CRM_VisitPlanResult>(param, where); } else { Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; param.BillNo = param.BillNo = codeRulerBll.GetBillNo(new Entity.UserModel.Sys.SYS_CredentialCodeRuleParam() { BillDate = DateTime.Today, TableName = "CRM_VisitPlan" }); param.GCompanyGuID = this.SessionInfo.CompanyID; param.CustVstPlnGuID = Guid.NewGuid(); param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedEmpName = this.SessionInfo.UserName; param.CreatedTime = DateTime.Now; param.TraceStatus = "计划跟踪"; param.IsDeleted = false; param.IsRead = false; affect = this.Insert <CRM_VisitPlanResult>(param); param = this.Select <CRM_VisitPlanResult>(new List <Field>() { CRM_VisitPlan._.CustVstPlnID, CRM_VisitPlan._.CustVstPlnGuID }, CRM_VisitPlan._.CustVstPlnGuID == param.CustVstPlnGuID); } #region 设置返回值 ret.Key = param.CustVstPlnID; ret.KeyGuid = param.CustVstPlnGuID; 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); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(CRM_JobMastResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (param.JobName.ToStringHasNull().Trim() == "") { throw new WarnException("请指定报告标题!"); } if (param.JobType.ToStringHasNull().Trim() == "") { throw new WarnException("请指定报告类型"); } if (param.JobDate == null) { throw new WarnException("请指定报告日期!"); } if (param.JobContext.ToStringHasNull().Trim() == "") { throw new WarnException("请指定报告内容!"); } if (param.JobContext.VarcharLen() > 8000) { throw new WarnException("请指定报告内容超长,请指定4000个汉字,8000个英文!"); } #endregion #region 系统默认值 param.Summary = param.JobContext; if (param.EmpJobGuid != null) { WhereClip where = CRM_JobMast._.EmpJobGuid == param.EmpJobGuid; param.GCompanyID = this.SessionInfo.CompanyID; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedTime = DateTime.Now; affect = this.Update <CRM_JobMastResult>(param, where); } else { Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; param.BillNo = codeRulerBll.GetBillNo(new Entity.UserModel.Sys.SYS_CredentialCodeRuleParam() { BillDate = DateTime.Today, TableName = "CRM_JobMast" }); param.Status = "New"; param.EmpJobGuid = Guid.NewGuid(); param.GCompanyID = this.SessionInfo.CompanyID; param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedTime = DateTime.Now; param.BeLongEmpID = this.SessionInfo.UserID; param.BelongEmpName = this.SessionInfo.UserName; param.IsDeleted = false; affect = this.Insert <CRM_JobMastResult>(param); } #region 设置返回值 ret.Key = param.EmpJobID; ret.KeyGuid = param.EmpJobGuid; ret.BillNo = param.BillNo; 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); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(STK_OutResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (string.IsNullOrEmpty(param.BillType)) { throw new WarnException("请指定出库类型!"); } if (string.IsNullOrEmpty(param.Currency)) { throw new WarnException("请选择币种!"); } if (param.StkOutLineList == null) { throw new WarnException("请填写出库明细!"); } string msg = string.Empty; foreach (STK_OutLineResult rst in param.StkOutLineList) { if (string.IsNullOrEmpty(rst.Model)) { msg = "请填写出库明细的型号!"; break; } if (rst.Qty <= 0) { msg = "请填写出库明细的数量!"; } } #endregion List <STK_OutLineResult> orderLineList = param.StkOutLineList; #region 系统默认值 if (param.StkOutGuid.ToGuid() != Guid.Empty) { WhereClip where = STK_Out._.StkOutGuid == param.StkOutGuid; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedEmpName = this.SessionInfo.UserName; param.UpdatedTime = DateTime.Now; affect = this.Update <STK_OutResult>(param, where); } else { param.StkOutGuid = Guid.NewGuid(); Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; param.BillNo = param.BillNo = codeRulerBll.GetBillNo(new Entity.UserModel.Sys.SYS_CredentialCodeRuleParam() { BillDate = DateTime.Today, TableName = "STK_Out" }); param.GCompanyID = this.SessionInfo.CompanyID; param.Status = "New"; param.ApproveStatus = "待提交"; param.IsDeleted = false; param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedEmpName = this.SessionInfo.UserName; param.CreatedTime = DateTime.Now; affect = this.Insert <STK_OutResult>(param); param = this.Select <STK_OutResult>(new List <Field>() { STK_Out._.All }, STK_Out._.StkOutGuid == param.StkOutGuid); } foreach (STK_OutLineResult rst in orderLineList) { if (rst.StkOutLineGuid.ToGuid() == Guid.Empty) { rst.StkOutLineGuid = Guid.NewGuid(); rst.StkOutGuid = param.StkOutGuid; rst.GCompanyID = this.SessionInfo.CompanyID; rst.CreatedEmpID = this.SessionInfo.UserID; rst.CreatedEmpName = this.SessionInfo.UserName; rst.CreatedTime = DateTime.Now; rst.IsDeleted = false; } else { rst.UpdatedEmpID = this.SessionInfo.UserID; rst.UpdatedEmpName = this.SessionInfo.UserName; rst.UpdatedTime = DateTime.Now; } } this.BatchInsertOrUpdate <STK_OutLineResult>(orderLineList); this.BatchExecute(); #region 设置返回值 ret.KeyGuid = param.StkOutGuid; 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); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(ORD_PurchaseOrderResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (string.IsNullOrEmpty(param.SupplierName.Trim())) { throw new WarnException("请指定公司名称!"); } if (string.IsNullOrEmpty(param.BuyerName)) { throw new WarnException("请选择采购员!"); } if (string.IsNullOrEmpty(param.Currency)) { throw new WarnException("请选择币种!"); } if (string.IsNullOrEmpty(param.ClearingForm)) { throw new WarnException("请填写结算方式!"); } if (param.OrderLineList == null) { throw new WarnException("请填写采购明细!"); } string msg = string.Empty; foreach (ORD_PurchaseOrderLineResult rst in param.OrderLineList) { if (string.IsNullOrEmpty(rst.Model)) { msg = "请填写采购明细的型号!"; break; } if (rst.Qty <= 0) { msg = "请填写采购明细的数量!"; } } #endregion List <ORD_PurchaseOrderLineResult> orderLineList = param.OrderLineList; #region 系统默认值 if (param.POGuid != null) { WhereClip where = ORD_PurchaseOrder._.POGuid == param.POGuid; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedEmpName = this.SessionInfo.UserName; param.UpdatedTime = DateTime.Now; affect = this.Update <ORD_PurchaseOrderResult>(param, where); } else { param.POGuid = Guid.NewGuid(); Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; param.BillNo = param.BillNo = codeRulerBll.GetBillNo(new Entity.UserModel.Sys.SYS_CredentialCodeRuleParam() { BillDate = DateTime.Today, TableName = "ORD_PurchaseOrder" }); param.GCompanyID = this.SessionInfo.CompanyID; param.StkInOccStatus = "待占有"; param.StkInStatus = "待入库"; param.StkOutStatus = "待出库"; param.ReturnOccStatus = "待占有"; param.ReturnStatus = "待退货"; param.PaymentStatus = "待收款"; param.Status = "New"; param.ApproveStatus = "待提交"; param.IsDeleted = false; param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedEmpName = this.SessionInfo.UserName; param.CreatedTime = DateTime.Now; affect = this.Insert <ORD_PurchaseOrderResult>(param); param = this.Select <ORD_PurchaseOrderResult>(new List <Field>() { ORD_PurchaseOrder._.All }, ORD_PurchaseOrder._.POGuid == param.POGuid); } foreach (ORD_PurchaseOrderLineResult rst in orderLineList) { if (rst.POLineGuid == null) { rst.POLineGuid = Guid.NewGuid(); rst.POGuid = param.POGuid; rst.GCompanyID = this.SessionInfo.CompanyID; rst.CreatedEmpID = this.SessionInfo.UserID; rst.CreatedEmpName = this.SessionInfo.UserName; rst.CreatedTime = DateTime.Now; rst.IsCancel = false; rst.IsDeleted = false; } else { rst.UpdatedEmpID = this.SessionInfo.UserID; rst.UpdatedEmpName = this.SessionInfo.UserName; rst.UpdatedTime = DateTime.Now; } } this.BatchInsertOrUpdate <ORD_PurchaseOrderLineResult>(orderLineList); this.BatchExecute(); #region 设置返回值 ret.Key = param.POID.ToInt32(); ret.KeyGuid = param.POGuid; 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); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(FIN_SubmitExpenseResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (string.IsNullOrEmpty(param.SourceBillNo)) { throw new WarnException("请选择关联单号!"); } if (string.IsNullOrEmpty(param.ExpName)) { throw new WarnException("请填写报销标题!"); } if (string.IsNullOrEmpty(param.OpEmpName)) { throw new WarnException("请选择处理人!"); } #endregion #region 系统默认值 List <FIN_SubmitExpenseLineResult> expenseLineList = param.ExpenseLineList; if (param.ExpID.ToInt32() > 0) { WhereClip where = FIN_SubmitExpense._.ExpID == param.ExpID; param.GCompanyGuID = this.SessionInfo.CompanyID; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedEmpName = this.SessionInfo.UserName; param.UpdatedTime = DateTime.Now; affect = this.Update <FIN_SubmitExpenseResult>(param, where); } else { Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; param.BillNo = param.BillNo = codeRulerBll.GetBillNo(new Entity.UserModel.Sys.SYS_CredentialCodeRuleParam() { BillDate = DateTime.Today, TableName = "FIN_SubmitExpense" }); param.GCompanyGuID = this.SessionInfo.CompanyID; param.OrgID = this.SessionInfo.OrgID; param.ExpGuID = Guid.NewGuid(); param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedEmpName = this.SessionInfo.UserName; param.CreatedTime = DateTime.Now; param.IsDeleted = false; affect = this.Insert <FIN_SubmitExpenseResult>(param); param = this.Select <FIN_SubmitExpenseResult>(new List <Field>() { FIN_SubmitExpense._.All }, FIN_SubmitExpense._.ExpGuID == param.ExpGuID); } foreach (FIN_SubmitExpenseLineResult rst in expenseLineList) { if (rst.ExpLineID == 0) { rst.IsDeleted = false; rst.ExpGuID = param.ExpGuID; rst.ExpLineGuID = Guid.NewGuid(); rst.CreatedEmpID = this.SessionInfo.UserID; rst.CreatedEmpName = this.SessionInfo.UserName; rst.CreatedTime = DateTime.Now; } else { rst.UpdatedEmpID = this.SessionInfo.UserID; rst.UpdatedEmpName = this.SessionInfo.UserName; rst.UpdatedTime = DateTime.Now; } } this.BatchInsertOrUpdate <FIN_SubmitExpenseLineResult>(expenseLineList); this.BatchExecute(); #region 设置返回值 ret.Key = param.ExpID; 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); }
/// <summary> /// 添加和新增修改 /// </summary> /// <param name="param">新增或修改的实体</param> /// <returns></returns> public WCFAddUpdateResult AddOrUpdate(ORD_SalesReturnResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (string.IsNullOrEmpty(param.CustomerName.Trim())) { throw new WarnException("请选择客户!"); } if (string.IsNullOrEmpty(param.SOBillNo)) { throw new WarnException("请选择销售单号!"); } if (string.IsNullOrEmpty(param.OperEmpName)) { throw new WarnException("请选择归属人!"); } if (string.IsNullOrEmpty(param.Currency)) { throw new WarnException("请选择币种!"); } if (param.ReturnLineList == null) { throw new WarnException("请导入退货明细!"); } string msg = string.Empty; foreach (ORD_SalesReturnLineResult rst in param.ReturnLineList) { if (rst.StkOutLineGuid.ToGuid() == Guid.Empty) { msg = "请选择关联的出库明细!"; break; } if (rst.Qty <= 0) { msg = "请填写销售退货明细的数量!"; break; } } if (!string.IsNullOrEmpty(msg)) { throw new WarnException(msg); } #endregion List <ORD_SalesReturnLineResult> orderLineList = param.ReturnLineList; #region 系统默认值 if (param.SRGuid != null) { WhereClip where = ORD_SalesReturn._.SRGuid == param.SRGuid; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedEmpName = this.SessionInfo.UserName; param.UpdatedTime = DateTime.Now; affect = this.Update <ORD_SalesReturnResult>(param, where); } else { param.SRGuid = Guid.NewGuid(); Sys_CodeRulerBLL codeRulerBll = new Sys_CodeRulerBLL(); codeRulerBll.SessionInfo = this.SessionInfo; param.BillNo = param.BillNo = codeRulerBll.GetBillNo(new Entity.UserModel.Sys.SYS_CredentialCodeRuleParam() { BillDate = DateTime.Today, TableName = "ORD_SalesReturn" }); param.GCompanyID = this.SessionInfo.CompanyID; param.StkInOccStatus = "待占有"; param.StkInStatus = "待入库"; param.Status = "New"; param.ApproveStatus = "待提交"; param.IsDeleted = false; param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedEmpName = this.SessionInfo.UserName; param.CreatedTime = DateTime.Now; affect = this.Insert <ORD_SalesReturnResult>(param); param = this.Select <ORD_SalesReturnResult>(new List <Field>() { ORD_SalesReturn._.All }, ORD_SalesReturn._.SRGuid == param.SRGuid); } foreach (ORD_SalesReturnLineResult rst in orderLineList) { if (rst.SRLineGuid.ToGuid() == Guid.Empty) { rst.SRLineGuid = Guid.NewGuid(); rst.SRGuid = param.SRGuid; rst.GCompanyID = this.SessionInfo.CompanyID; rst.CreatedEmpID = this.SessionInfo.UserID; rst.CreatedEmpName = this.SessionInfo.UserName; rst.CreatedTime = DateTime.Now; rst.IsDeleted = false; } else { rst.UpdatedEmpID = this.SessionInfo.UserID; rst.UpdatedEmpName = this.SessionInfo.UserName; rst.UpdatedTime = DateTime.Now; } } this.BatchInsertOrUpdate <ORD_SalesReturnLineResult>(orderLineList); this.BatchExecute(); #region 设置返回值 ret.Key = param.SRID.ToInt32(); ret.KeyGuid = param.SRGuid; 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); }