| | |
| | | |
| | | namespace zymes_Project.OperationService |
| | | { |
| | | [Description("[业务员-审核]服务插件]")] |
| | | [Description("[业务员-保存]服务插件]")] |
| | | [HotUpdate] |
| | | public class zymes_RealessOperator : AbstractOperationServicePlugIn |
| | | { |
| | |
| | | Entity entity = this.BusinessInfo.GetEntity("FEntity");//获取明细信息 |
| | | foreach (var billObj in e.DataEntitys) |
| | | { |
| | | //var sql = $"exec zymes_RealessUnit {billObj["Id"]} "; |
| | | //var sql = $"exec zymes_RealessOperator {billObj["Id"]} "; |
| | | var id = billObj["Id"].ToString(); |
| | | string sql =string.Empty; |
| | | sql = $@" |
| | | /*dialect*/ |
| | | select a.FOPERATORID as HItemID,'' as HNumber,'' as HName,'' as HHelpCode,'' as HShortNumber,0 as HParentID |
| | | select a.FENTRYID as HItemID,a.FNUMBER as HNumber,l.FNAME as HName,'' as HHelpCode,a.FNUMBER as HShortNumber,0 as HParentID |
| | | ,1 as HLevel,'true' as HEndFlag,'false' as HStopflag,'CLD-ERP导入' as HRemark,'' as HUseFlag,0 as HUSEORGID |
| | | ,0 as HOperatorId,'' as HOperatorType,0 as HSEQ,0 as HStaffId,0 as HIsUse |
| | | from T_BD_OPERATOR a with(nolock) |
| | | inner join T_BD_OPERATOR_L l with(nolock) on a.FOPERATORID=l.FOPERATORID and FLOCALEID=2052 |
| | | ,a.FOPERATORID as HOperatorId,a.FOPERATORTYPE as HOperatorType,a.FSEQ as HSEQ,a.FSTAFFID as HStaffId,a.FISUSE as HIsUse |
| | | from T_BD_OPERATORENTRY a with(nolock) |
| | | inner join T_BD_OPERATORENTRY_L l with(nolock) on a.FENTRYID=l.FENTRYID and FLOCALEID=2052 |
| | | Where a.FOPERATORID={id} |
| | | "; |
| | | DataTable dt = DBServiceHelper.ExecuteDataSet(Context, sql).Tables[0]; |
| | |
| | | LogService.Write("业务员同步异常:" + sql); |
| | | continue; |
| | | } |
| | | DataRow dr = dt.Rows[0]; |
| | | JObject model = new JObject(); |
| | | foreach (DataColumn column in dt.Columns) |
| | | //DataRow dr = dt.Rows[0]; |
| | | JArray array = new JArray(); |
| | | foreach(DataRow dr in dt.Rows) |
| | | { |
| | | model.Add(column.ColumnName, dr[column.ColumnName].ToString()); |
| | | JObject fentrymodel = new JObject(); |
| | | foreach (DataColumn column in dt.Columns) |
| | | { |
| | | fentrymodel.Add(column.ColumnName, dr[column.ColumnName].ToString()); |
| | | } |
| | | array.Add(fentrymodel); |
| | | } |
| | | JObject model = new JObject(); |
| | | model.Add("HOperatorInfoEntry", array); |
| | | //foreach (DataColumn column in dt.Columns) |
| | | //{ |
| | | // model.Add(column.ColumnName, dr[column.ColumnName].ToString()); |
| | | //} |
| | | JObject _jsonRoot = new JObject() |
| | | { |
| | | ["model"] = model |
| | | }; |
| | | LogService.Write("业务员同步示例:" + JsonConvert.SerializeObject(_jsonRoot)); |
| | | LogService.Write("业务员同步示例:" + _jsonRoot); |
| | | //LogService.Write("业务员同步示例:" + JsonConvert.SerializeObject(_jsonRoot)); |
| | | //LogService.Write("业务员同步示例:" + _jsonRoot); |
| | | //string clientUrl = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "ClientUrl");//K/3 Cloud 业务站点地址 |
| | | var client = new RestSharp.RestClient("http://61.130.182.102:18181/simoerAPI/"); |
| | | var requestPost = new RestRequest("Gy_Operator/SaveGy_OperatorListApi", Method.POST); |
| | |
| | | |
| | | namespace zymes_Project.OperationService |
| | | { |
| | | [Description("[汇率类型-审核]服务插件]")] |
| | | [Description("[汇率类型-保存]服务插件]")] |
| | | [HotUpdate] |
| | | public class zymes_RealessRateType : AbstractOperationServicePlugIn |
| | | { |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Kingdee.BOS.Util; |
| | | using Kingdee.BOS.Core.Metadata.EntityElement; |
| | | using Kingdee.BOS.Core.DynamicForm.PlugIn; |
| | | using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; |
| | | using Kingdee.BOS.Orm.DataEntity; |
| | | using System.ComponentModel; |
| | | using Kingdee.BOS.ServiceHelper; |
| | | using System.Data; |
| | | using Newtonsoft.Json.Linq; |
| | | using ZD.Cloud.WebApi; |
| | | using Newtonsoft.Json; |
| | | using Kingdee.BOS.Core.DynamicForm; |
| | | using System.Linq; |
| | | using RestSharp; |
| | | using zymes_Project.Utility; |
| | | |
| | | namespace zymes_Project.OperationService |
| | | { |
| | | [Description("[员工-审核]服务插件]")] |
| | | [HotUpdate] |
| | | public class zymes_RealessStaff : AbstractOperationServicePlugIn |
| | | { |
| | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| | | public override void OnPrepareOperationServiceOption(OnPrepareOperationServiceEventArgs e) |
| | | { |
| | | base.OnPrepareOperationServiceOption(e); |
| | | |
| | | //为了在BeginOperationTransaction里检查数据抛出异常时 |
| | | //只回滚当前单据的事务,这里设置为不支持批量事务,这样BOS会 |
| | | //循环为每一张单据创建事务调用操作 |
| | | e.SupportTransaction = true; |
| | | e.SurportBatchTransaction = false; |
| | | } |
| | | public override void OnPreparePropertys(PreparePropertysEventArgs e) |
| | | { |
| | | base.OnPreparePropertys(e); |
| | | e.FieldKeys.Add("FEntity"); |
| | | e.FieldKeys.Add("FEntity_FEntryID"); |
| | | } |
| | | public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e) |
| | | { |
| | | base.AfterExecuteOperationTransaction(e); |
| | | Entity entity = this.BusinessInfo.GetEntity("FEntity");//获取明细信息 |
| | | foreach (var billObj in e.DataEntitys) |
| | | { |
| | | //var sql = $"exec zymes_RealessStaff {billObj["Id"]} "; |
| | | var id = billObj["Id"].ToString(); |
| | | string sql =string.Empty; |
| | | sql = $@" |
| | | /*dialect*/ |
| | | select a.FID as HItemID,a.FNUMBER as HNumber,l.FNAME as HName,'' as HHelpCode,a.FNUMBER as HShortNumber,0 as HParentID |
| | | ,1 as HLevel,'true' as HEndFlag,'false' as HStopflag,'CLD-ERP导入' as HRemark,'' as HUseFlag,a.FUSEORGID as HUSEORGID |
| | | ,a.FCREATEORGID as HCREATEORGID,a.FPERSONID as HPERSONID,a.FPOSTID as HPOSTID,a.FFIRSTCARDID as HFIRSTCARDID |
| | | ,0 as HDEPTID,a.FSTAFFNUMBER as HSTAFFNUMBER |
| | | from T_HR_EMPINFO a with(nolock) |
| | | inner join T_HR_EMPINFO_L l with(nolock) on a.FID=l.FID and FLOCALEID=2052 |
| | | Where a.FID={id} |
| | | "; |
| | | DataTable dt = DBServiceHelper.ExecuteDataSet(Context, sql).Tables[0]; |
| | | if (dt.Rows.Count == 0) |
| | | { |
| | | LogService.Write("员工同步异常:" + sql); |
| | | continue; |
| | | } |
| | | DataRow dr = dt.Rows[0]; |
| | | JObject model = new JObject(); |
| | | foreach (DataColumn column in dt.Columns) |
| | | { |
| | | model.Add(column.ColumnName, dr[column.ColumnName].ToString()); |
| | | } |
| | | JObject _jsonRoot = new JObject() |
| | | { |
| | | ["model"] = model |
| | | }; |
| | | //LogService.Write("员工同步示例:" + JsonConvert.SerializeObject(_jsonRoot)); |
| | | //LogService.Write("员工同步示例:" + _jsonRoot); |
| | | //string clientUrl = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "ClientUrl");//K/3 Cloud 业务站点地址 |
| | | var client = new RestSharp.RestClient("http://61.130.182.102:18181/simoerAPI/"); |
| | | var requestPost = new RestRequest("Gy_Staff/SaveGy_StaffListApi", Method.POST); |
| | | requestPost.AddParameter("application/json", JsonConvert.SerializeObject(_jsonRoot), ParameterType.RequestBody); |
| | | IRestResponse responsePost = client.Execute(requestPost); |
| | | var contentPost = responsePost.Content; |
| | | if (!contentPost.Contains("成功")) |
| | | { |
| | | LogService.Write("员工同步异常,POST方式获取结果," + billObj["Id"] + "," + contentPost); |
| | | LogService.Write("员工同步异常,POST," + "Gy_Staff/SaveGy_StaffListApi"); |
| | | LogService.Write("员工同步异常,JsonConvert.SerializeObject(_jsonRoot)," + JsonConvert.SerializeObject(_jsonRoot)); |
| | | } |
| | | }; |
| | | |
| | | foreach (var item in dictionary) |
| | | { |
| | | ResultMessage.dataError(this.OperationResult.OperateResult, item.Key, item.Value); |
| | | } |
| | | } |
| | | public static class ResultMessage |
| | | {/// <summary> |
| | | /// 修改提示信息 |
| | | /// </summary> |
| | | /// <param name="operateResult"></param> |
| | | /// <param name="billno"></param> |
| | | public static void dataError(OperateResultCollection operateResult, string billno, string message) |
| | | { |
| | | OperateResult operate = operateResult.Where(n => n.Number == billno).First(); |
| | | operate.Message = message; |
| | | operate.SuccessStatus = false; |
| | | operate.MessageType = MessageType.FatalError; |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Kingdee.BOS.Util; |
| | | using Kingdee.BOS.Core.Metadata.EntityElement; |
| | | using Kingdee.BOS.Core.DynamicForm.PlugIn; |
| | | using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; |
| | | using Kingdee.BOS.Orm.DataEntity; |
| | | using System.ComponentModel; |
| | | using Kingdee.BOS.ServiceHelper; |
| | | using System.Data; |
| | | using Newtonsoft.Json.Linq; |
| | | using ZD.Cloud.WebApi; |
| | | using Newtonsoft.Json; |
| | | using Kingdee.BOS.Core.DynamicForm; |
| | | using System.Linq; |
| | | using RestSharp; |
| | | using zymes_Project.Utility; |
| | | |
| | | namespace zymes_Project.OperationService |
| | | { |
| | | [Description("[作业-审核]服务插件]")] |
| | | [HotUpdate] |
| | | public class zymes_RealessWork : AbstractOperationServicePlugIn |
| | | { |
| | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| | | public override void OnPrepareOperationServiceOption(OnPrepareOperationServiceEventArgs e) |
| | | { |
| | | base.OnPrepareOperationServiceOption(e); |
| | | |
| | | //为了在BeginOperationTransaction里检查数据抛出异常时 |
| | | //只回滚当前单据的事务,这里设置为不支持批量事务,这样BOS会 |
| | | //循环为每一张单据创建事务调用操作 |
| | | e.SupportTransaction = true; |
| | | e.SurportBatchTransaction = false; |
| | | } |
| | | public override void OnPreparePropertys(PreparePropertysEventArgs e) |
| | | { |
| | | base.OnPreparePropertys(e); |
| | | e.FieldKeys.Add("FEntity"); |
| | | e.FieldKeys.Add("FEntity_FEntryID"); |
| | | } |
| | | public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e) |
| | | { |
| | | base.AfterExecuteOperationTransaction(e); |
| | | Entity entity = this.BusinessInfo.GetEntity("FEntity");//获取明细信息 |
| | | foreach (var billObj in e.DataEntitys) |
| | | { |
| | | //var sql = $"exec zymes_RealessWork {billObj["Id"]} "; |
| | | var id = billObj["Id"].ToString(); |
| | | string sql =string.Empty; |
| | | sql = $@" |
| | | /*dialect*/ |
| | | select a.FID as HItemID,a.FNUMBER as HNumber,l.FNAME as HName,'' as HHelpCode,a.FNUMBER as HShortNumber,0 as HParentID |
| | | ,1 as HLevel,'true' as HEndFlag,'false' as HStopflag,'CLD-ERP导入' as HRemark,'' as HUseFlag,a.FUSEORGID as HUSEORGID |
| | | ,a.FCREATEORGID as HCREATEORGID,a.FWORKCENTERID as HWORKCENTERID |
| | | from T_ENG_PROCESS a with(nolock) |
| | | inner join T_ENG_PROCESS_L l with(nolock) on a.FID=l.FID and FLOCALEID=2052 |
| | | Where a.FID={id} |
| | | "; |
| | | DataTable dt = DBServiceHelper.ExecuteDataSet(Context, sql).Tables[0]; |
| | | if (dt.Rows.Count == 0) |
| | | { |
| | | LogService.Write("作业同步异常:" + sql); |
| | | continue; |
| | | } |
| | | DataRow dr = dt.Rows[0]; |
| | | JObject model = new JObject(); |
| | | foreach (DataColumn column in dt.Columns) |
| | | { |
| | | model.Add(column.ColumnName, dr[column.ColumnName].ToString()); |
| | | } |
| | | JObject _jsonRoot = new JObject() |
| | | { |
| | | ["model"] = model |
| | | }; |
| | | //LogService.Write("作业同步示例:" + JsonConvert.SerializeObject(_jsonRoot)); |
| | | //LogService.Write("作业同步示例:" + _jsonRoot); |
| | | //string clientUrl = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "ClientUrl");//K/3 Cloud 业务站点地址 |
| | | var client = new RestSharp.RestClient("http://61.130.182.102:18181/simoerAPI/"); |
| | | var requestPost = new RestRequest("Gy_Work/SaveGy_WorkListApi", Method.POST); |
| | | requestPost.AddParameter("application/json", JsonConvert.SerializeObject(_jsonRoot), ParameterType.RequestBody); |
| | | IRestResponse responsePost = client.Execute(requestPost); |
| | | var contentPost = responsePost.Content; |
| | | if (!contentPost.Contains("成功")) |
| | | { |
| | | LogService.Write("作业同步异常,POST方式获取结果," + billObj["Id"] + "," + contentPost); |
| | | LogService.Write("作业同步异常,POST," + "Gy_Work/SaveGy_WorkListApi"); |
| | | LogService.Write("作业同步异常,JsonConvert.SerializeObject(_jsonRoot)," + JsonConvert.SerializeObject(_jsonRoot)); |
| | | } |
| | | }; |
| | | |
| | | foreach (var item in dictionary) |
| | | { |
| | | ResultMessage.dataError(this.OperationResult.OperateResult, item.Key, item.Value); |
| | | } |
| | | } |
| | | public static class ResultMessage |
| | | {/// <summary> |
| | | /// 修改提示信息 |
| | | /// </summary> |
| | | /// <param name="operateResult"></param> |
| | | /// <param name="billno"></param> |
| | | public static void dataError(OperateResultCollection operateResult, string billno, string message) |
| | | { |
| | | OperateResult operate = operateResult.Where(n => n.Number == billno).First(); |
| | | operate.Message = message; |
| | | operate.SuccessStatus = false; |
| | | operate.MessageType = MessageType.FatalError; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <Compile Include="OperationService\zymes_RealessTaxRate.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessSupplier.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessStockStatus.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessStaff.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessWork.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessUnit.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessPrdMo.cs" /> |
| | | <Compile Include="Properties\AssemblyInfo.cs" /> |