public override object Execute() { var data = eprBll.GetEntity(this._context.strBOID); var projectid = data.ProjectID; var ecommerceid = data.EcommerceID; var istrunk = 1; //查询是否存在电商和项目是否存在istrunk=1 int conunt = eprBll.GetIsTrunkCount(projectid, ecommerceid, istrunk); if (conunt > 0) { istrunk = 0; } EcommerceProjectRelationEntity model = new EcommerceProjectRelationEntity() { IsTrunk = istrunk, EcommerceProjectRelationID = this._context.strBOID, ApprovalState = this._context.ApproveStatus, LatestApprover = this._context.strApproverId, LatestApprovetime = this._context.dtTime, LatestComment = this._context.strComment, Procinstid = this._context.iProcInstID.ToString() }; eprBll.ApprovalUpdateState(this._context.strBOID, model); return(true); }
/// <summary> /// /// </summary> /// <param name="inputPayEntity"></param> /// <param name="existingPayEntity"></param> /// <param name="lastPayInfoDetailsEntity"></param> /// <param name="db"></param> public PayToolsBase(Pay_InfoEntity entity) { this._inputPayEntity = entity; #region 为了保证下面的数据都是一致的所以这里把该查的数据都一起查出来 //项目信息 var projectInfo = new Base_ProjectInfoEntity(); if (entity.Project_Id != null) { _projectInfoEntity = projectService.GetEntityBase(entity.Project_Id); } if (_projectInfoEntity == null) { throw new Exception("项目信息不正确!"); } //数据库存储的付款单 this._existingPayEntity = payInfoService.GetEntity(entity.Pay_Info_Id); if (existingPayEntity != null) { this._lastPayInfoDetailsEntity = payDeailsService.GetEntityByCode(existingPayEntity.LastPayInfoDetailsCode); } this._ecommerceProjectMoneyCapacity = eprService.GetTrunkEntity(entity.Project_Id, entity.EcommerceID); if (_ecommerceProjectMoneyCapacity == null) { throw new Exception("未找到对应的电商合同!"); } _codeNumber = coderuleService.SetBillCodeByCode("System", "100"); #endregion try { string errMsg = string.Empty; if (existingPayEntity != null) { inputPayEntity.Modify(inputPayEntity.Pay_Info_Id); new RepositoryFactory().BaseRepository().Update(inputPayEntity); } else { inputPayEntity.CompanyID = projectInfoEntity.CompanyCode; inputPayEntity.CompanyName = projectInfoEntity.CompanyName; inputPayEntity.Create(); new RepositoryFactory().BaseRepository().Insert(inputPayEntity); } Transdb = new RepositoryFactory().BaseRepository().BeginTrans(); } catch (Exception ex) { Transdb.Rollback(); throw new Exception(ex.Message); } }
/// <summary> /// 组装统计流水表的电商支出合计 /// </summary> /// <param name="plist">今日审批通过的付款信息</param> /// <param name="erpModel">合同信息</param> /// <param name="fundsDetailsModel">今日统计流水信息</param> public decimal?PayTotal(List <Pay_InfoEntity> plist, EcommerceProjectRelationEntity erpModel) { decimal?money = 0m; var tempTranfer = plist.Where(p => p.CompanyID == erpModel.CompanyId && p.Project_Id == erpModel.ProjectID && p.DeleteMark == 0).ToList(); if (tempTranfer.Count > 0) { money = tempTranfer.Sum(p => p.Pay_Money);//收入合计 } return(money); }
/// <summary> /// 审核 /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void ApprovalUpdateState(string keyValue, EcommerceProjectRelationEntity entity) { try { service.ApprovalUpdateState(keyValue, entity); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public string GetKeyValue(string keyValue, EcommerceProjectRelationEntity entity, List <EcommerceDiscountProgramEntity> discountList, List <FileModel> uploadFiles) { try { return(service.GetKeyValue(keyValue, entity, discountList, uploadFiles)); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 保存表单(新增、修改) /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, EcommerceProjectRelationEntity entity, List <EcommerceDiscountProgramEntity> discountList, List <FileModel> uploadFiles) { try { service.SaveForm(keyValue, entity, discountList, uploadFiles); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult SaveForm(string keyValue, EcommerceProjectRelationEntity entity, List <EcommerceDiscountProgramEntity> discountList, List <FileModel> uploadFiles) { var projectdata = bpibll.GetEntityBase(entity.ProjectID); var ecomdata = ecombll.GetEntity(entity.EcommerceID); entity.EcommerceCode = ecomdata.EcommerceCode; entity.ProjectCode = projectdata.ProjectCode; entity.CityCode = projectdata.CityCode; entity.CityID = projectdata.CityID; entity.CityName = projectdata.CityName; ecommerceprojectrelationbll.SaveForm(keyValue, entity, discountList, uploadFiles); return(Success("操作成功")); }
public override object Execute() { EcommerceProjectRelationEntity model = new EcommerceProjectRelationEntity() { EcommerceProjectRelationID = this._context.strBOID, ApprovalState = this._context.ApproveStatus, LatestApprover = this._context.strApproverId, LatestApprovetime = this._context.dtTime, LatestComment = this._context.strComment, Procinstid = this._context.iProcInstID.ToString() }; eprBll.ApprovalUpdateState(this._context.strBOID, model); return(true); }
public ActionResult SubmitForm(string keyValue, EcommerceProjectRelationEntity entity, List <EcommerceDiscountProgramEntity> discountList, List <FileModel> uploadFiles) { try { var dataedad = ecommerceprojectrelationbll.GetList(); foreach (var item in dataedad) { if (item.EcommerceID == entity.EcommerceID && item.ProjectID == entity.ProjectID && item.ApprovalState == (int)ApproveStatus.in_approval) { return(Error("此项目和此电商已经有流程在审核中,不允许重复提交!")); } } //判断所选择的项目不存在相应地块 OP_ParcelEntity op_parcelEntity = op_parcelbll.GetEntityByproid(entity.ProjectID); if (op_parcelEntity == null) { return(Error("此项目不存在对应的地块信息!")); } var projectdata = bpibll.GetEntityBase(entity.ProjectID); var ecomdata = ecombll.GetEntity(entity.EcommerceID); entity.EcommerceCode = ecomdata.EcommerceCode; entity.ProjectCode = projectdata.ProjectCode; entity.CityCode = projectdata.CityCode; entity.CityID = projectdata.CityID; entity.CityName = projectdata.CityName; if (string.IsNullOrEmpty(keyValue)) { keyValue = ecommerceprojectrelationbll.GetKeyValue(keyValue, entity, discountList, uploadFiles); } else { entity.EcommerceProjectRelationID = keyValue; string key = ecommerceprojectrelationbll.GetKeyValue(keyValue, entity, discountList, uploadFiles); } ///作者:durry ///time:2018-06-29 10:06 ///获取发起流程的url var starturl = dataItemCache.GetDataItemByCodeAndName("SysConfig", "BPMStartProcess"); var starturlname = starturl.ItemValue; var data = ecommerceprojectrelationbll.GetStartUrl(keyValue, starturlname); return(Success("操作成功。", data)); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 保存表单(新增、修改) /// 增加编辑保存功能 作者:durry, time:2018-06-22 17:15 /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void SaveForm(string keyValue, EcommerceProjectRelationEntity entity, List <EcommerceDiscountProgramEntity> discountList, List <FileModel> uploadFiles) { try { IRepository db = new RepositoryFactory().BaseRepository().BeginTrans(); if (!string.IsNullOrEmpty(keyValue)) { entity.Modify(keyValue); entity.ForceContractAmount = entity.ForceContractAmount; db.Update(entity); } else { entity.Create(); entity.ForceContractAmount = entity.ForceContractAmount; db.Insert(entity); } try { var parameter = new List <DbParameter>(); parameter.Add(DbParameters.CreateDbParameter("@EcommerceProjectRelationID", entity.EcommerceProjectRelationID)); db.ExecuteBySql("delete T_EcommerceDiscountProgram where EcommerceProjectRelationID=@EcommerceProjectRelationID", parameter.ToArray()); if (discountList != null) { foreach (EcommerceDiscountProgramEntity item in discountList) { item.Create(); item.EcommerceProjectRelationID = entity.EcommerceProjectRelationID; this.BaseRepository().Insert(item); } } attservice.MapingFiles(entity.EcommerceProjectRelationID, uploadFiles, db); db.Commit(); } catch (Exception) { db.Rollback(); throw; } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// 审核 /// </summary> /// <param name="keyValue">主键值</param> /// <param name="entity">实体对象</param> /// <returns></returns> public void ApprovalUpdateState(string keyValue, EcommerceProjectRelationEntity entity) { try { var model = this.BaseRepository().FindEntity <EcommerceProjectRelationEntity>(entity.EcommerceProjectRelationID); model.ApprovalState = entity.ApprovalState; model.IsTrunk = entity.IsTrunk; model.LatestApprover = entity.LatestApprover; model.LatestApprovetime = entity.LatestApprovetime; model.LatestComment = entity.LatestComment; model.Procinstid = entity.Procinstid.ToString(); model.ModifyDate = DateTime.Now; this.BaseRepository().Update(model); } catch (Exception ex) { throw new Exception(ex.Message); } }
private static void ExprotContract() { SqlConnection conn = new SqlConnection("Server=.;Initial Catalog=E_Commerce_DB;User ID=sa;Password=dq123456"); StringBuilder sqlstr = new StringBuilder(); sqlstr.Append(@"select * from Test003 "); conn.Open(); SqlCommand comm = new SqlCommand(sqlstr.ToString(), conn); SqlDataReader sdr = comm.ExecuteReader(); contractEntity list = new contractEntity(); List <contractEntity> conlists = new List <contractEntity>(); while (sdr.Read()) { list = new contractEntity { projectname = sdr[0].ToString(), ecommercename = sdr[1].ToString(), ecommercegroupname = sdr[2].ToString(), platfromrate = Convert.ToDecimal(sdr[3]), contractname = sdr[4].ToString(), ControllerAmount = Convert.ToDecimal(sdr[5]), FlowAmount = Convert.ToDecimal(sdr[6]), ActualControllerAmount = Convert.ToDecimal(sdr[7]) }; conlists.Add(list); if (!sdr.HasRows) { list = new contractEntity { projectname = "", }; conlists.Add(list); } } sdr.Close(); conn.Close(); Base_ProjectInfoBLL bpbbll = new Base_ProjectInfoBLL(); EcommerceBLL ecombll = new EcommerceBLL(); EcommerceGroupBLL ecomgroupbll = new EcommerceGroupBLL(); List <EcommerceGroupEntity> ecomgrouplists = new List <EcommerceGroupEntity>(); List <EcommerceEntity> ecomlists = new List <EcommerceEntity>(); List <EcommerceProjectRelationEntity> ecomprorelists = new List <EcommerceProjectRelationEntity>(); int count = 0; foreach (var item in conlists) { count++; var data = bpbbll.GetList("").ToList().Where(t => t.ProjecName == item.projectname).ToList(); if (data.Count == 0) { Console.WriteLine("找不到对应的项目数据'" + item.projectname + "'"); Console.ReadKey(); return; } EcommerceProjectRelationEntity ecom = new EcommerceProjectRelationEntity(); ecom.EcommerceProjectRelationID = Guid.NewGuid().ToString(); var ecomgroupdata = ecomgroupbll.GetList("").Where(t => t.EcommerceGroupName == item.ecommercegroupname).ToList(); if (ecomgroupdata.Count == 0) { EcommerceGroupEntity ecomgroupentity = new EcommerceGroupEntity(); ecomgroupentity.EcommerceGroupID = Guid.NewGuid().ToString(); ecomgroupentity.EcommerceGroupName = item.ecommercegroupname; ecomgroupentity.DeleteMark = 0; var t2 = new SqlDatabase("BaseDb").Connection.Insertable(ecomgroupentity).ExecuteCommand(); //if (!ecomgrouplists.Any(t => t.EcommerceGroupName == ecomgroupentity.EcommerceGroupName)) //{ // ecomgrouplists.Add(ecomgroupentity); //} EcommerceEntity ecomentity = new EcommerceEntity(); ecomentity.EcommerceName = item.ecommercename; ecomentity.EcommerceID = Guid.NewGuid().ToString(); ecomentity.EcommerceGroupID = ecomgroupentity.EcommerceGroupID; ecomentity.EcommerceCode = count.ToString(); ecomentity.EcommerceGroupName = ecomgroupentity.EcommerceGroupName; ecomentity.DeleteMark = 0; ecomentity.EcommerceType = 0; ecomentity.PlatformRate = item.platfromrate; ecomentity.CooperateStartTime = Convert.ToDateTime("2018-01-01"); ecomentity.CooperateEndTime = Convert.ToDateTime("2018-06-30"); var t3 = new SqlDatabase("BaseDb").Connection.Insertable(ecomentity).ExecuteCommand(); //if (!ecomlists.Any(t => t.EcommerceName == ecomentity.EcommerceName)) //{ // ecomlists.Add(ecomentity); //} ecom.EcommerceGroupID = ecomgroupentity.EcommerceGroupID; ecom.EcommerceGroupName = ecomgroupentity.EcommerceGroupName; ecom.EcommerceID = ecomentity.EcommerceID; ecom.EcommerceName = ecomentity.EcommerceName; ecom.EcommerceCode = ecomentity.EcommerceCode; ecom.PartyB = ecomentity.EcommerceName; } else { ecom.EcommerceGroupID = ecomgroupdata[0].EcommerceGroupID; ecom.EcommerceGroupName = ecomgroupdata[0].EcommerceGroupName; var ecomdata = ecombll.GetList("").Where(t => t.EcommerceName == item.ecommercename).ToList(); if (ecomdata.Count == 0) { EcommerceEntity ecomentity = new EcommerceEntity(); ecomentity.EcommerceName = item.ecommercename; ecomentity.EcommerceID = Guid.NewGuid().ToString(); ecomentity.EcommerceCode = count.ToString(); ecomentity.EcommerceGroupID = ecomgroupdata[0].EcommerceGroupID; ecomentity.EcommerceGroupName = ecomgroupdata[0].EcommerceGroupName; ecomentity.PlatformRate = item.platfromrate; ecomentity.DeleteMark = 0; ecomentity.EcommerceType = 0; ecomentity.CooperateStartTime = Convert.ToDateTime("2018-01-01"); ecomentity.CooperateEndTime = Convert.ToDateTime("2018-06-30"); var t3 = new SqlDatabase("BaseDb").Connection.Insertable(ecomentity).ExecuteCommand(); //if (!ecomlists.Any(t => t.EcommerceName == ecomentity.EcommerceName)) //{ // ecomlists.Add(ecomentity); //} ecom.EcommerceGroupID = ecomentity.EcommerceGroupID; ecom.EcommerceGroupName = ecomentity.EcommerceGroupName; ecom.EcommerceID = ecomentity.EcommerceID; ecom.EcommerceName = ecomentity.EcommerceName; ecomentity.EcommerceCode = ecomentity.EcommerceCode; ecom.PartyB = ecomentity.EcommerceName; } else { ecom.EcommerceID = ecomdata[0].EcommerceID; ecom.EcommerceName = ecomdata[0].EcommerceName; ecom.EcommerceCode = ecomdata[0].EcommerceCode; ecom.PartyB = ecomdata[0].EcommerceName; } } ecom.PlatformRate = item.platfromrate; ecom.ContractName = item.contractname; ecom.EcommerceType = 0; ecom.EcommerceTypeName = EnumHelper.ToDescription((EcommerceTypeEnum)0); ecom.Agent = "金涛"; ecom.CooperateStartTime = Convert.ToDateTime("2018-01-01"); ecom.CooperateEndTime = Convert.ToDateTime("2018-06-30"); ecom.ForceContractAmount = 100000; ecom.DeleteMark = 0; ecom.CityCode = data[0].CityCode; ecom.CityID = data[0].CityID; ecom.CityName = data[0].CityName; ecom.ProjectID = data[0].ProjectID; ecom.ProjectCode = data[0].ProjectCode; ecom.ProjecName = item.projectname; ecom.CompanyId = data[0].CompanyCode; ecom.CompanyCode = data[0].CompanyCode; ecom.CompanyName = data[0].CompanyName; ecom.ProjectType = 0; ecom.ApprovalState = 4; ecom.FlowNopayTotalAmount = 0; ecom.ContractNature = 0; ecom.IsStandard = 1; ecom.PartyA = "阳光城集团股份有限公司"; ecom.BiddingMethod = 0; ecom.IsStamp = 1; ecom.ContractTypeName = "主合同"; ecom.CreateDate = Convert.ToDateTime("2018-06-30"); ecom.ControlTotalAmount = item.ControllerAmount * 0; ecom.FlowNopayTotalAmount = item.FlowAmount * 10000; ecom.ActualControlTotalAmount = item.ActualControllerAmount * 10000; ecom.IsTrunk = 1; if (!ecomprorelists.Any(t => t.EcommerceID == ecom.EcommerceID && t.ProjectID == ecom.ProjectID)) { ecomprorelists.Add(ecom); } } var t1 = new SqlDatabase("BaseDb").Connection.Insertable(ecomprorelists).ExecuteCommand(); //var t2 = new SqlDatabase("BaseDb").Connection.Insertable(ecomgrouplists).ExecuteCommand(); //var t3 = new SqlDatabase("BaseDb").Connection.Insertable(ecomlists).ExecuteCommand(); Console.ReadKey(); }
public override object Execute() { T_CapitalFlowEntity cf = new T_CapitalFlowEntity() { CapitalFlow_Id = this._context.strBOID, LatestApprovetime = this._context.dtTime, ApprovalState = this._context.ApproveStatus, LatestComment = this._context.strComment, Procinstid = this._context.iProcInstID.ToString(), }; cfBll.ApprovalUpdateState(this._context.strBOID, cf); if (this._context.ApproveStatus == (int)ApproveStatus.approved) { /// <summary> /// 1.根据CapitalFlow_Id 查询 /// 1.1如果orderNo为空 是第一个 /// 1.1.1根据CapitalFlow_Id查询出子表数据 /// 1.1.2循环子表数据 根据每一个子表数据中的电商id和项目id 查询出来合同表 /// 1.1.3然后将子表中资金和合同表中资金相加 然后更新合同表 /// 1.1.4更新当前CapitalFlow的orderNo为0 /// 1.2如果不为空 /// 1.2.1根据查询出来orderNo最大的一条CapitalFlow记录 /// 1.2.2根据CapitalFlow_Id查询出子表数据 /// 1.2.3循环子表数据 根据每一个子表数据中的电商id和项目id 查询出来合同表 /// </summary> //根据区域id 年份 月份 获取orderno最大的一条 List <T_CapitalFlowEntity> cfEntity = cfBll.check(this._context.strBOID, cf).ToList(); //判断是否为第一次收入 if (cfEntity[0].OrderNo == null) { //第一笔收入 //获取子表 List <CapitalFlow_ProRelaView> cfNodeList = cfBll.updateMoney(this._context.strBOID).ToList(); //新建一个合同list 便于update List <EcommerceProjectRelationEntity> ecomList = new List <EcommerceProjectRelationEntity>(); //新建一个流水list 便于insert List <T_PartnerCapitalPoolEntity> pCaPoolList = new List <T_PartnerCapitalPoolEntity>(); CapitalFlow_ProRelaView ecomEntity = new CapitalFlow_ProRelaView(); foreach (CapitalFlow_ProRelaView c in cfNodeList) { EcommerceProjectRelationEntity ecomProReEntity = new EcommerceProjectRelationEntity(); T_PartnerCapitalPoolEntity pcEntity = new T_PartnerCapitalPoolEntity(); //根据项目id和电商id查询合同表 //ecomEntity = ecomBll.GetTrunkEntity(c.ProjectID, c.EcommerceID); ecomEntity = cfNodeList.FirstOrDefault(p => p.ProjectID == c.ProjectID && p.EcommerceID == c.EcommerceID); if (ecomEntity != null) { //List<EcommerceProjectRelationEntity> list= ecomBll.searchActAmount(ecomEntity.EcommerceID,ecomEntity.ProjectID).ToList(); decimal aca = (decimal)(ecomEntity.ActualControlTotalAmount + c.CapitalPoolAdd); decimal ca = (decimal)(ecomEntity.ControlTotalAmount + c.CapitalPoolAdd); //合同表 ecomProReEntity.EcommerceProjectRelationID = c.EcommerceProjectRelationID; ecomProReEntity.ActualControlTotalAmount = aca; ecomProReEntity.ControlTotalAmount = ca; ecomList.Add(ecomProReEntity); //流水表 pcEntity.OperationTitle = "资金导入"; pcEntity.OperationType = 3; pcEntity.T_P_PartnerCapitalPoolID = null; pcEntity.OperationMoney = c.CapitalPoolAdd; pcEntity.CurrentMoney = ecomEntity.ControlTotalAmount; pcEntity.CurrentBalance = ca; pcEntity.AccountingType = 0; pcEntity.EcommerceProjectRelationID = c.EcommerceProjectRelationID; pcEntity.PartnerCapitalPoolID = Guid.NewGuid().ToString(); pcEntity.CreateDate = DateTime.Now; pcEntity.CreateUserId = c.CreateUserId; pcEntity.CreateUserName = c.CreateUserName; pcEntity.ObjectID = c.CapitalFlow_Details_Id; pcEntity.DeleteMark = 0; pcEntity.StatisticalDate = c.UploadDate; pCaPoolList.Add(pcEntity); } } //更新钱 ecomBll.updateMoneyAA(ecomList); pCaPoolBll.InsertEntityList(pCaPoolList); //更新orderno cfBll.updateOrderNo(0, this._context.strBOID); } else { //获取流水表的明细 IEnumerable <T_PartnerCapitalPoolEntity> paCaPoolList = pCaPoolBll.getAllPaCaPoolList(); //获取上一个通过的记录 List <CapitalFlow_ProRelaView> cfNodeListBefor = cfBll.updateMoney(cfEntity[0].CapitalFlow_Id).ToList(); //获取当前记录 List <CapitalFlow_ProRelaView> cfNodeListNow = cfBll.updateMoney(this._context.strBOID).ToList(); //新建一个资金池list 更新资金池 List <EcommerceProjectRelationEntity> ecomListBefor = new List <EcommerceProjectRelationEntity>(); //新建一个流水list 便于insert List <T_PartnerCapitalPoolEntity> pCaPoolListBefor = new List <T_PartnerCapitalPoolEntity>(); //新建一个流水list 便于update deletemark=1 List <T_PartnerCapitalPoolEntity> pCaPoolListDel = new List <T_PartnerCapitalPoolEntity>(); //循环上一个通过的记录 foreach (CapitalFlow_ProRelaView c in cfNodeListBefor) { EcommerceProjectRelationEntity ecomProReEntity = new EcommerceProjectRelationEntity(); CapitalFlow_ProRelaView ecomEntity = new CapitalFlow_ProRelaView(); CapitalFlow_ProRelaView ecomEntityZ = new CapitalFlow_ProRelaView(); T_PartnerCapitalPoolEntity pcEntity = new T_PartnerCapitalPoolEntity(); T_PartnerCapitalPoolEntity pcZEntity = new T_PartnerCapitalPoolEntity(); //根据项目id和电商id查询合同表 ecomEntity = cfNodeListBefor.FirstOrDefault(p => p.ProjectID == c.ProjectID && p.EcommerceID == c.EcommerceID); ecomEntityZ = cfNodeListNow.FirstOrDefault(p => p.ProjectID == c.ProjectID && p.EcommerceID == c.EcommerceID); pcZEntity = paCaPoolList.FirstOrDefault(p => p.ObjectID == c.CapitalFlow_Details_Id && p.OperationType == 3); pcZEntity.DeleteMark = 1; pCaPoolListDel.Add(pcZEntity); if (ecomEntity != null) { decimal aca = (decimal)(ecomEntity.ActualControlTotalAmount - c.CapitalPoolAdd); decimal ca = (decimal)(ecomEntity.ControlTotalAmount - c.CapitalPoolAdd); ecomProReEntity.EcommerceProjectRelationID = c.EcommerceProjectRelationID; ecomProReEntity.ActualControlTotalAmount = aca; ecomProReEntity.ControlTotalAmount = ca; ecomListBefor.Add(ecomProReEntity); //流水表 pcEntity.OperationTitle = "资金导入"; pcEntity.OperationType = 2; pcEntity.OperationMoney = c.CapitalPoolAdd; pcEntity.CurrentMoney = ecomEntity.ControlTotalAmount; pcEntity.CurrentBalance = ca; pcEntity.AccountingType = 1; pcEntity.EcommerceProjectRelationID = c.EcommerceProjectRelationID; pcEntity.PartnerCapitalPoolID = Guid.NewGuid().ToString(); pcEntity.CreateDate = DateTime.Now; pcEntity.T_P_PartnerCapitalPoolID = pcZEntity.PartnerCapitalPoolID; if (ecomEntityZ != null) { pcEntity.ObjectID = ecomEntityZ.CapitalFlow_Details_Id; } else { pcEntity.ObjectID = ecomEntity.CapitalFlow_Details_Id; } pcEntity.StatisticalDate = c.UploadDate; pcEntity.DeleteMark = 1; pcEntity.CreateUserId = cfNodeListNow.First().CreateUserId; pcEntity.CreateUserName = cfNodeListNow.First().CreateUserName; pCaPoolListBefor.Add(pcEntity); } } pCaPoolBll.InsertEntityList(pCaPoolListBefor); ecomBll.updateMoneyAA(ecomListBefor); pCaPoolBll.UpdateEntityList(pCaPoolListDel); cfBll.updateDeleteMark(cfEntity[0].CapitalFlow_Id); cfBll.updateCapDeleteMark(cfEntity[0].CapitalFlow_Id); //获取当前的记录 paCaPoolList = pCaPoolBll.getAllPaCaPoolList(); cfNodeListNow = cfBll.updateMoney(this._context.strBOID).ToList(); List <EcommerceProjectRelationEntity> ecomListNow = new List <EcommerceProjectRelationEntity>(); //新建一个流水list 便于insert List <T_PartnerCapitalPoolEntity> pCaPoolListNow = new List <T_PartnerCapitalPoolEntity>(); foreach (CapitalFlow_ProRelaView c in cfNodeListNow) { EcommerceProjectRelationEntity ecomProReEntity = new EcommerceProjectRelationEntity(); CapitalFlow_ProRelaView ecomEntity = new CapitalFlow_ProRelaView(); T_PartnerCapitalPoolEntity pcEntity = new T_PartnerCapitalPoolEntity(); T_PartnerCapitalPoolEntity pcZEntity = new T_PartnerCapitalPoolEntity(); //根据项目id和电商id查询合同表 ecomEntity = cfNodeListNow.FirstOrDefault(p => p.ProjectID == c.ProjectID && p.EcommerceID == c.EcommerceID); pcZEntity = paCaPoolList.FirstOrDefault(p => p.ObjectID == c.CapitalFlow_Details_Id); if (ecomEntity != null) { decimal aca = (decimal)(ecomEntity.ActualControlTotalAmount + c.CapitalPoolAdd); decimal ca = (decimal)(ecomEntity.ControlTotalAmount + c.CapitalPoolAdd); ecomProReEntity.EcommerceProjectRelationID = c.EcommerceProjectRelationID; ecomProReEntity.ActualControlTotalAmount = aca; ecomProReEntity.ControlTotalAmount = ca; ecomListNow.Add(ecomProReEntity); //流水表 if (pcZEntity != null) { pcEntity.OperationTitle = "资金导入"; pcEntity.OperationType = 3; pcEntity.OperationMoney = c.CapitalPoolAdd; pcEntity.CurrentMoney = ecomEntity.ControlTotalAmount; pcEntity.CurrentBalance = ca; pcEntity.AccountingType = 0; pcEntity.EcommerceProjectRelationID = c.EcommerceProjectRelationID; pcEntity.PartnerCapitalPoolID = Guid.NewGuid().ToString(); pcEntity.CreateDate = DateTime.Now; pcEntity.CreateUserId = c.CreateUserId; pcEntity.T_P_PartnerCapitalPoolID = pcZEntity.PartnerCapitalPoolID; pcEntity.CreateUserName = c.CreateUserName; pcEntity.ObjectID = c.CapitalFlow_Details_Id; pcEntity.StatisticalDate = c.UploadDate; pcEntity.DeleteMark = 0; } else { pcEntity.OperationTitle = "资金导入"; pcEntity.OperationType = 3; pcEntity.OperationMoney = c.CapitalPoolAdd; pcEntity.CurrentMoney = ecomEntity.ControlTotalAmount; pcEntity.CurrentBalance = ca; pcEntity.AccountingType = 0; pcEntity.EcommerceProjectRelationID = c.EcommerceProjectRelationID; pcEntity.PartnerCapitalPoolID = Guid.NewGuid().ToString(); pcEntity.CreateDate = DateTime.Now; pcEntity.CreateUserId = c.CreateUserId; pcEntity.T_P_PartnerCapitalPoolID = null; pcEntity.CreateUserName = c.CreateUserName; pcEntity.ObjectID = c.CapitalFlow_Details_Id; pcEntity.StatisticalDate = c.UploadDate; pcEntity.DeleteMark = 0; } pCaPoolListNow.Add(pcEntity); } } ecomBll.updateMoneyAA(ecomListNow); pCaPoolBll.InsertEntityList(pCaPoolListNow); int a = cfEntity[0].OrderNo ?? 0; cfBll.updateOrderNo(a + 1, this._context.strBOID); } } return(true); }
public override object Execute() { string EProjectRelationId = this._context.strBOID;//合同ID EcommerceProjectRelationEntity ecommerceprojectrelationEntity = eprBll.GetEntity(EProjectRelationId); OP_ParcelEntity op_parcelEntity = op_parcelbll.GetEntityByproid(ecommerceprojectrelationEntity.ProjectID); IEnumerable <EcommerceDiscountProgramEntity> discount = edpbll.GetEntity(EProjectRelationId); List <T_AttachmentEntity> attaclist = tabll.GetFormList(EProjectRelationId, "default"); ContractView cv = new ContractView(); List <ITEM> its = new List <ITEM>(); List <ATTACHMENT1> attcs = new List <ATTACHMENT1>(); cv.ProjectName = ecommerceprojectrelationEntity.ProjecName; cv.ProjCode = op_parcelEntity.ParcelCode.Replace("-", "."); cv.ProjectType = EnumHelper.ToDescription((ProjectTypeEnum)ecommerceprojectrelationEntity.ProjectType); cv.OrgName = ecommerceprojectrelationEntity.CompanyName; cv.OrgCode = ecommerceprojectrelationEntity.CompanyId; cv.EcommerceGroupName = ecommerceprojectrelationEntity.EcommerceGroupName; cv.EcommerceTypeName = ecommerceprojectrelationEntity.EcommerceTypeName; cv.ContractName = ecommerceprojectrelationEntity.ContractName; cv.ContractNature = EnumHelper.ToDescription((ContractNatureEnum)ecommerceprojectrelationEntity.ContractNature); cv.ContractTypeName = ecommerceprojectrelationEntity.ContractTypeName; cv.IsStandard = ecommerceprojectrelationEntity.IsStandard == 0?"否":"是"; cv.PartyA = ecommerceprojectrelationEntity.PartyA; cv.PartyB = ecommerceprojectrelationEntity.PartyB; cv.CooperateStartTime = Convert.ToDateTime(ecommerceprojectrelationEntity.CooperateStartTime).ToString("yyyy-MM-dd"); cv.CooperateEndTime = Convert.ToDateTime(ecommerceprojectrelationEntity.CooperateEndTime).ToString("yyyy-MM-dd"); cv.BiddingMethod = EnumHelper.ToDescription((BiddingMethodEnum)ecommerceprojectrelationEntity.BiddingMethod); cv.IsStamp = ecommerceprojectrelationEntity.IsStamp == 0?"否":"是"; cv.Agent = ecommerceprojectrelationEntity.Agent; cv.CreateDate = Convert.ToDateTime(ecommerceprojectrelationEntity.CreateDate).ToString("yyyy-MM-dd"); cv.ForceContractAmount = ecommerceprojectrelationEntity.ForceContractAmount; cv.PlatformRate = ecommerceprojectrelationEntity.PlatformRate; foreach (var item in discount) { ITEM it = new ITEM(); it.Format = item.Format; it.Amount = item.Amount; it.Discount = item.Discount; if (!its.Contains(it)) { its.Add(it); } } cv.BDITEM = new BDITEM(); cv.BDITEM.item = its.ToArray(); var geturl = dataItemCache.GetDataItemByCodeAndName("SysConfig", "BPMAttacPath"); string urlname = geturl.ItemValue; foreach (var item in attaclist) { ATTACHMENT1 attc = new ATTACHMENT1(); attc.FILENAME = item.AttachmentName; attc.URL = string.Format("{0}/{1}", urlname, item.Path); if (!attcs.Contains(attc)) { attcs.Add(attc); } } cv.ATTACHMENT = new ATTACHMENT(); cv.ATTACHMENT.attachment = attcs.ToArray(); var d = Movit.Util.XmlHelper.Serializer(typeof(ContractView), cv); return(d); //XmlDocument doc = new XmlDocument(); //XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-16", null); //doc.AppendChild(dec); ////创建一个根节点(一级) //XmlNode root = doc.CreateElement("DATA"); //doc.AppendChild(root); ////创建节点(二级) //XmlElement ITEM = null; //XmlElement element = null; ////合同编号 //element = doc.CreateElement("ProjectName"); //element.SetAttribute("Text", "项目名称"); //element.InnerText = ecommerceprojectrelationEntity.EcommerceProjectRelationID; ////项目名称 //element = doc.CreateElement("CompanyName"); //element.SetAttribute("Text", "所属区域"); //element.InnerText = ecommerceprojectrelationEntity.ProjectName; //root.AppendChild(element); //ITEM = doc.CreateElement("优化方案Items"); //ITEM.SetAttribute("ID", "BudgetItem"); //root.AppendChild(ITEM); //foreach (var item in tcollection) //{ // XmlNode item = doc.CreateElement("item"); // //创建节点(三级) // element = null; // //集团/地区公司GUID // element = doc.CreateElement("OrgUnitGUID"); // element.SetAttribute("Text", "集团/地区公司"); // element.InnerText = "三级节点数据"; // item.AppendChild(element); //} //return XmlHelper.ConvertXmlToString(doc); }