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_RealessPaymentCondition : 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_RealessPaymentCondition {billObj["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):" + 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(clientUrl); |
| | | var requestPost = new RestRequest("Gy_PaymentCondition/SaveGy_PaymentConditionListApi", 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," + clientUrl + "Gy_PaymentCondition/SaveGy_PaymentConditionListApi"); |
| | | 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_RealessRecCondition : 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_RealessRecCondition {billObj["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):" + 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(clientUrl); |
| | | var requestPost = new RestRequest("Gy_RecCondition/SaveGy_RecConditionListApi", 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," + clientUrl + "Gy_RecCondition/SaveGy_RecConditionListApi"); |
| | | 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_RealessStockStatus : 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_RealessStockStatus {billObj["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):" + 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(clientUrl); |
| | | var requestPost = new RestRequest("Gy_StockStatus/SaveGy_StockStatusListApi", 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," + clientUrl + "Gy_StockStatus/SaveGy_StockStatusListApi"); |
| | | 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_RealessTaxRate : 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_RealessTaxRate {billObj["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):" + 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(clientUrl); |
| | | var requestPost = new RestRequest("Gy_TaxRate/SaveGy_TaxRateListApi", 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," + clientUrl + "Gy_TaxRate/SaveGy_TaxRateListApi"); |
| | | 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="InvokeHelper.cs" /> |
| | | <Compile Include="LogService.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessDepartment.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessRecCondition.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessStock.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessCustomer.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessPaymentCondition.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessTaxRate.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessSupplier.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessStockStatus.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessUnit.cs" /> |
| | | <Compile Include="OperationService\zymes_RealessPrdMo.cs" /> |
| | | <Compile Include="Properties\AssemblyInfo.cs" /> |
| | |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <WCFMetadata Include="Connected Services\" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Folder Include="bin\Release\" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Content Include="bin\Debug\Antlr3.Runtime.dll" /> |
| | |
| | | <Content Include="bin\Debug\ZD.Share.dll" /> |
| | | <Content Include="bin\Debug\zymes_Project.dll" /> |
| | | <Content Include="bin\Debug\zymes_Project.pdb" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Folder Include="bin\Release\" /> |
| | | </ItemGroup> |
| | | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
| | | </Project> |