1
This commit is contained in:
@@ -20,16 +20,15 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.AR_SalesVATInvoice.ServicePlugIn
|
||||
// 根据日志中的实际实体属性名来添加
|
||||
e.FieldKeys.Add("FIDD");
|
||||
e.FieldKeys.Add("FSEQQ");
|
||||
e.FieldKeys.Add("SRCBILLTYPEID"); // 实体属性名(没有F前缀)
|
||||
e.FieldKeys.Add("SRCBILLNO"); // 实体属性名(没有F前缀)
|
||||
e.FieldKeys.Add("SEQ");
|
||||
e.FieldKeys.Add("BILLNO"); // 单据编号(主表字段)
|
||||
e.FieldKeys.Add("FSRCBILLTYPEID");
|
||||
e.FieldKeys.Add("FSRCBILLNO");
|
||||
}
|
||||
|
||||
|
||||
public override void EndOperationTransaction(EndOperationTransactionArgs e)
|
||||
public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
|
||||
{
|
||||
base.EndOperationTransaction(e);
|
||||
base.AfterExecuteOperationTransaction(e);
|
||||
|
||||
|
||||
foreach (var dataEntity in e.DataEntitys)
|
||||
{
|
||||
var billObj = dataEntity as DynamicObject;
|
||||
@@ -56,17 +55,26 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.AR_SalesVATInvoice.ServicePlugIn
|
||||
// 判断条件:FIDD != 当前行ID 且 源单编号为空
|
||||
if (fiddValue != entryId && string.IsNullOrWhiteSpace(srcBillNo))
|
||||
{
|
||||
// 从当前单据主表获取单据编号(实体属性名:BILLNO)
|
||||
var billNo = billObj["BILLNO"]?.ToString() ?? "";
|
||||
// 固定源单类型为"销售增值税专用发票"
|
||||
var srcBillType = "IV_SALESIC";
|
||||
// 查询源单据体信息(主键=FIDD的明细行)
|
||||
var sql = $@"/*dialect*/
|
||||
SELECT FSRCBILLTYPEID, FSRCBILLNO, FSEQ
|
||||
FROM T_IV_SALESICENTRY
|
||||
WHERE FENTRYID = {fiddValue}";
|
||||
Logger.Error("销售增值税专用发票", sql, new Exception());
|
||||
var result = DBServiceHelper.ExecuteDynamicObject(this.Context, sql);
|
||||
if (result == null || result.Count == 0)
|
||||
continue;
|
||||
Logger.Error("销售增值税专用发票", "69", new Exception());
|
||||
var srcData = result[0];
|
||||
var srcBillTypeId = srcData["FSRCBILLTYPEID"];
|
||||
var srcBillNoValue = srcData["FSRCBILLNO"];
|
||||
|
||||
// 回写当前单据体:源单类型、源单编号
|
||||
// 这里使用数据库字段名(带F前缀)
|
||||
var updateSql = $@"/*dialect*/
|
||||
UPDATE T_IV_SALESICENTRY
|
||||
SET FSRCBILLTYPEID = '{srcBillType.Replace("'", "''")}',
|
||||
FSRCBILLNO = '{billNo.Replace("'", "''")}'
|
||||
SET FSRCBILLTYPEID = '{srcBillTypeId}',
|
||||
FSRCBILLNO = '{srcBillNoValue}'
|
||||
WHERE FENTRYID = {entryId}";
|
||||
Logger.Error("销售增值税专用发票", updateSql, new Exception());
|
||||
Logger.Error("销售增值税专用发票", "78", new Exception());
|
||||
|
||||
@@ -51,22 +51,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>bin\Debug\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Data.v13.1, Version=13.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\DevExpress.Data.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Printing.v13.1.Core, Version=13.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\DevExpress.Printing.v13.1.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v13.1, Version=13.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\DevExpress.Utils.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraEditors.v13.1, Version=13.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\DevExpress.XtraEditors.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DocumentFormat.OpenXml">
|
||||
<HintPath>..\..\..\派诺-裴豪\派诺功能\代码\Pilot_KD_Parino (2)\Pilot_KD_Parino\Pilot_KD_Parino\bin\Debug\DocumentFormat.OpenXml.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,5 +1,4 @@
|
||||
using DevExpress.Xpo.DB;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
@@ -10,8 +9,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Pilot_KD_Parino.QPHY_AutoWrire.Bill2;
|
||||
|
||||
namespace Pilot_KD_Parino.QPHY_AutoWrire
|
||||
|
||||
@@ -1,27 +1,12 @@
|
||||
using DevExpress.Data.Linq;
|
||||
using DevExpress.Data.PLinq.Helpers;
|
||||
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||||
using FarPoint.Excel;
|
||||
using Kingdee.BOS.App.Core.Utils;
|
||||
using Kingdee.BOS.BusinessEntity.BusinessFlow;
|
||||
using Kingdee.BOS.Core.CommonFilter;
|
||||
using Kingdee.BOS.Core.CommonFilter;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
|
||||
using Kingdee.BOS.Core.Enums;
|
||||
using Kingdee.BOS.Core.List;
|
||||
using Kingdee.BOS.Core.Msg;
|
||||
using Kingdee.BOS.Core.Report.PlugIn.Args;
|
||||
using Kingdee.BOS.JSON;
|
||||
using Kingdee.BOS.Log;
|
||||
using Kingdee.BOS.Orm;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using Kingdee.BOS.Orm.Exceptions;
|
||||
using Kingdee.BOS.ServiceHelper;
|
||||
using Kingdee.BOS.Util;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Pilot_KD_Parino.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,10 +14,6 @@ using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
using static Kingdee.BOS.BusinessEntity.YunZhiJia.ERPInfoEnum;
|
||||
using static Pilot_KD_Parino.QPHY_AutoWrire.Bill2;
|
||||
using static Pilot_KD_Parino.QPHY_AutoWrire.Bill3;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Pilot_KD_Parino.QPHY_AutoWrireRecord
|
||||
//GROUP BY a.FBILLNO,a.F_AMOUNT ";
|
||||
|
||||
string sql = $@"/*dialect*/SELECT bb.F_CONTRACTNUMBER,bb.F_AMOUNT,fin.FBillAllAmount,bb.F_expenses, bb.FBILLNO
|
||||
,(bb.ZhengShuHeJi+bb.F_expenses-bb.F_AMOUNT) AS XiaoFamount
|
||||
,(bb.F_TOTALPOSITIVEAMOUNT+bb.F_expenses-bb.F_AMOUNT) AS XiaoFamount
|
||||
,b.FALLAMOUNT22
|
||||
FROM T_AutoWrireRecordEntry b
|
||||
INNER JOIN dbo.ZZV_SalOrder bb
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
using DevExpress.Data.PLinq.Helpers;
|
||||
using Kingdee.BOS;
|
||||
using Kingdee.BOS.App;
|
||||
using Kingdee.BOS.App.Data;
|
||||
using Kingdee.BOS.Contracts;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Core.Metadata;
|
||||
using Kingdee.BOS.Core.Metadata.FieldElement;
|
||||
using Kingdee.BOS.Log;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using Kingdee.BOS.ServiceHelper;
|
||||
using Kingdee.BOS.Util;
|
||||
using Org.BouncyCastle.Asn1.X509;
|
||||
using Pilot_KD_Parino.Common;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
@@ -38,7 +30,7 @@ namespace Pilot_KD_Parino.QPHY_AutoWrireRecord
|
||||
//获取单据Id
|
||||
string Id = sheet["Id"].ToString();
|
||||
string sql = $@"/*dialect*/SELECT bb.F_CONTRACTNUMBER,bb.F_AMOUNT,fin.FBillAllAmount,bb.F_expenses, bb.FBILLNO
|
||||
,(bb.ZhengShuHeJi+bb.F_expenses-bb.F_AMOUNT) AS XiaoFamount
|
||||
,(bb.F_TOTALPOSITIVEAMOUNT+bb.F_expenses-bb.F_AMOUNT) AS XiaoFamount
|
||||
,b.FALLAMOUNT22
|
||||
FROM T_AutoWrireRecordEntry b
|
||||
INNER JOIN dbo.ZZV_SalOrder bb
|
||||
|
||||
@@ -23,203 +23,215 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
|
||||
public override void BeforeDoSaveExecute(BeforeDoSaveExecuteEventArgs e)
|
||||
{
|
||||
base.BeforeDoSaveExecute(e);
|
||||
var FEntity = e.DataEntities[0];
|
||||
var FNAME1 = FEntity["BillTypeId_Id"].ToString();
|
||||
if (FNAME1.ToString() == "a300e2620037435492aed9842875b451" && FNAME1 != null)
|
||||
try
|
||||
{
|
||||
|
||||
var json = JsonUtil.Serialize(FEntity);
|
||||
//Logger.Error("销售订单保存前刷正确的合同号", json, new Exception());
|
||||
var fid = FEntity["id"];
|
||||
base.BeforeDoSaveExecute(e);
|
||||
var FEntity = e.DataEntities[0];
|
||||
var FNAME1 = FEntity["BillTypeId_Id"].ToString();
|
||||
|
||||
var sql3333 = $@"SELECT F_contractnumber FROM dbo.T_SAL_ORDER WHERE fid={fid} and F_contractnumber !='' ";
|
||||
var sqlDS33 = DBUtils.ExecuteDynamicObject(this.Context, sql3333);
|
||||
if (sqlDS33 != null && sqlDS33.Count > 0)
|
||||
{
|
||||
string contractnumber = sqlDS33[0]["F_contractnumber"].ToString();
|
||||
//Logger.Error("销售订单保存前刷正确的合同号2", contractnumber, new Exception());
|
||||
FEntity["F_contractnumber"] = contractnumber;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (FNAME1.ToString() == "a300e2620037435492aed9842875b451" && FNAME1 != null)
|
||||
{
|
||||
|
||||
var formID = FEntity["FFormId"];
|
||||
//销售订单新变更单
|
||||
if (formID.ToString() == "SAL_XORDER")
|
||||
var json = JsonUtil.Serialize(FEntity);
|
||||
//Logger.Error("销售订单保存前刷正确的合同号", json, new Exception());
|
||||
var fid = FEntity["id"];
|
||||
|
||||
var sql3333 = $@"SELECT F_contractnumber FROM dbo.T_SAL_ORDER WHERE fid={fid} and F_contractnumber !='' ";
|
||||
var sqlDS33 = DBUtils.ExecuteDynamicObject(this.Context, sql3333);
|
||||
if (sqlDS33 != null && sqlDS33.Count > 0)
|
||||
{
|
||||
string contractnumber = sqlDS33[0]["F_contractnumber"].ToString();
|
||||
//Logger.Error("销售订单保存前刷正确的合同号2", contractnumber, new Exception());
|
||||
FEntity["F_contractnumber"] = contractnumber;
|
||||
|
||||
|
||||
return;
|
||||
if (FNAME1.ToString() == "a300e2620037435492aed9842875b451" && FNAME1 != null)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var formID = FEntity["FFormId"];
|
||||
//销售订单新变更单
|
||||
if (formID.ToString() == "SAL_XORDER")
|
||||
{
|
||||
var FSaleOrderEntry_Link = FEntity["SaleOrderEntry"] as DynamicObjectCollection;
|
||||
if (FSaleOrderEntry_Link.Count > 0)
|
||||
return;
|
||||
if (FNAME1.ToString() == "a300e2620037435492aed9842875b451" && FNAME1 != null)
|
||||
{
|
||||
var details = FSaleOrderEntry_Link[0]["FSaleOrderEntry_Link"] as DynamicObjectCollection;
|
||||
//var FbiLLNO = this.View.Model.GetValue("FBILLNO");
|
||||
|
||||
if (details != null)
|
||||
var FSaleOrderEntry_Link = FEntity["SaleOrderEntry"] as DynamicObjectCollection;
|
||||
if (FSaleOrderEntry_Link.Count > 0)
|
||||
{
|
||||
var entrys = details;
|
||||
if (entrys != null && entrys.Count > 0)
|
||||
var details = FSaleOrderEntry_Link[0]["FSaleOrderEntry_Link"] as DynamicObjectCollection;
|
||||
//var FbiLLNO = this.View.Model.GetValue("FBILLNO");
|
||||
|
||||
if (details != null)
|
||||
{
|
||||
foreach (var entry in entrys)
|
||||
var entrys = details;
|
||||
if (entrys != null && entrys.Count > 0)
|
||||
{
|
||||
|
||||
var sBillId = entry == null ? 0 : entry["sBillId"].Long2Int();
|
||||
|
||||
//获取退货类型字段
|
||||
var F_Returntype = FEntity["F_Returntype"];
|
||||
|
||||
//获取纸质合同号
|
||||
String F_contractnumber = FEntity["F_contractnumber"].ToString();
|
||||
string yuanF_contractnumber = F_contractnumber;
|
||||
int dashPosition;
|
||||
if (F_contractnumber.Contains("-TH"))
|
||||
string yuanF_contractnumber = FEntity["F_contractnumber"].ToString();
|
||||
foreach (var entry in entrys)
|
||||
{
|
||||
|
||||
dashPosition = F_contractnumber.IndexOf("-TH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else if (F_contractnumber.Contains("-HH"))
|
||||
{
|
||||
dashPosition = F_contractnumber.IndexOf("-HH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashPosition = -2;
|
||||
}
|
||||
var sql = string.Format(@"SELECT COUNT(*) AS FNUMBER FROM T_SAL_ORDERENTRY_LK WHERE FSBILLID = '{0}'AND FRULEID = 'SaleOrder-ReturnSaleOrder'", sBillId);
|
||||
var sqlDS = DBUtils.ExecuteDynamicObject(this.Context, sql);
|
||||
String F_contractnumber2 = FEntity["F_contractnumber"].ToString();
|
||||
int number;
|
||||
if (F_contractnumber2.Contains("-") && dashPosition != -2)
|
||||
{
|
||||
number = F_contractnumber2.Substring(F_contractnumber2.Length - 2).Long2Int();
|
||||
}
|
||||
else
|
||||
{
|
||||
number = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
number += 1;
|
||||
//if (number == 1)
|
||||
var sBillId = entry == null ? 0 : entry["sBillId"].Long2Int();
|
||||
|
||||
//获取退货类型字段
|
||||
var F_Returntype = FEntity["F_Returntype"];
|
||||
|
||||
//获取纸质合同号
|
||||
String F_contractnumber = FEntity["F_contractnumber"].ToString();
|
||||
|
||||
int dashPosition;
|
||||
if (F_contractnumber.Contains("-TH"))
|
||||
{
|
||||
|
||||
dashPosition = F_contractnumber.IndexOf("-TH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else if (F_contractnumber.Contains("-HH"))
|
||||
{
|
||||
dashPosition = F_contractnumber.IndexOf("-HH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashPosition = -2;
|
||||
}
|
||||
var sql = string.Format(@"SELECT COUNT(*) AS FNUMBER FROM T_SAL_ORDERENTRY_LK WHERE FSBILLID = '{0}'AND FRULEID = 'SaleOrder-ReturnSaleOrder'", sBillId);
|
||||
var sqlDS = DBUtils.ExecuteDynamicObject(this.Context, sql);
|
||||
String F_contractnumber2 = FEntity["F_contractnumber"].ToString();
|
||||
int number;
|
||||
if (F_contractnumber2.Contains("-") && dashPosition != -2)
|
||||
{
|
||||
number = F_contractnumber2.Substring(F_contractnumber2.Length - 2).Long2Int();
|
||||
}
|
||||
else
|
||||
{
|
||||
number = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
number += 1;
|
||||
//if (number == 1)
|
||||
//{
|
||||
// number += 1;
|
||||
//}
|
||||
}
|
||||
|
||||
string F_contractnumber1;
|
||||
|
||||
int IFnumber = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
|
||||
if (IFnumber != 0 && !F_Returntype.IsNullOrEmpty())
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + number.ToString();
|
||||
FEntity["F_contractnumber"] = F_contractnumber1;
|
||||
break;
|
||||
}
|
||||
else if (!F_Returntype.IsNullOrEmpty())
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + '1';
|
||||
|
||||
FEntity["F_contractnumber"] = F_contractnumber1;
|
||||
break;
|
||||
}
|
||||
//else if (IFnumber != 0 && !F_Returntype.IsNullOrEmpty())
|
||||
//{
|
||||
// number += 1;
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
string F_contractnumber1;
|
||||
|
||||
int IFnumber = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
|
||||
if (IFnumber != 0 && !F_Returntype.IsNullOrEmpty())
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + number.ToString();
|
||||
FEntity["F_contractnumber"] = F_contractnumber1;
|
||||
break;
|
||||
}
|
||||
else if (!F_Returntype.IsNullOrEmpty())
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + '1';
|
||||
|
||||
FEntity["F_contractnumber"] = F_contractnumber1;
|
||||
break;
|
||||
}
|
||||
//else if (IFnumber != 0 && !F_Returntype.IsNullOrEmpty())
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//销售订单
|
||||
else if (formID.ToString() == "SAL_SaleOrder")
|
||||
{
|
||||
var FNAME = FEntity["BillTypeId_Id"].ToString();
|
||||
if (FNAME == "a300e2620037435492aed9842875b451" && FNAME != null)
|
||||
//销售订单
|
||||
else if (formID.ToString() == "SAL_SaleOrder")
|
||||
{
|
||||
var FSaleOrderEntry_Link = FEntity["SaleOrderEntry"] as DynamicObjectCollection;
|
||||
if (FSaleOrderEntry_Link.Count > 0)
|
||||
var FNAME = FEntity["BillTypeId_Id"].ToString();
|
||||
if (FNAME == "a300e2620037435492aed9842875b451" && FNAME != null)
|
||||
{
|
||||
var details = FSaleOrderEntry_Link[0]["FSaleOrderEntry_Link"] as DynamicObjectCollection;
|
||||
|
||||
|
||||
//var details = this.View.BusinessInfo.GetEntity("FSaleOrderEntry_Link");
|
||||
//var FbiLLNO = this.View.Model.GetValue("FID");
|
||||
|
||||
if (details != null)
|
||||
var FSaleOrderEntry_Link = FEntity["SaleOrderEntry"] as DynamicObjectCollection;
|
||||
if (FSaleOrderEntry_Link.Count > 0)
|
||||
{
|
||||
var entrys = details;
|
||||
if (entrys != null && entrys.Count > 0)
|
||||
var details = FSaleOrderEntry_Link[0]["FSaleOrderEntry_Link"] as DynamicObjectCollection;
|
||||
//string sdas=JsonHelper.ToJson(details);
|
||||
// Logger.Error("销售订单上游订单的xx ", sdas, new Exception());
|
||||
//var details = this.View.BusinessInfo.GetEntity("FSaleOrderEntry_Link");
|
||||
//var FbiLLNO = this.View.Model.GetValue("FID");
|
||||
|
||||
if (details != null)
|
||||
{
|
||||
foreach (var entry in entrys)
|
||||
var entrys = details;
|
||||
|
||||
if (entrys != null && entrys.Count > 0)
|
||||
{
|
||||
|
||||
var sBillId = entry == null ? 0 : entry["sBillId"].Long2Int();
|
||||
|
||||
//获取退货类型字段
|
||||
var F_Returntype = FEntity["F_Returntype"];
|
||||
|
||||
//获取纸质合同号
|
||||
String F_contractnumber = FEntity["F_contractnumber"].ToString();
|
||||
string yuanF_contractnumber = F_contractnumber;
|
||||
int dashPosition;
|
||||
if (F_contractnumber.Contains("-TH"))
|
||||
string yuanF_contractnumber = FEntity["F_contractnumber"].ToString();
|
||||
int i = 0;
|
||||
foreach (var entry in entrys)
|
||||
{
|
||||
if (i > 0)
|
||||
return;
|
||||
i++;
|
||||
|
||||
dashPosition = F_contractnumber.IndexOf("-TH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else if (F_contractnumber.Contains("-HH"))
|
||||
{
|
||||
dashPosition = F_contractnumber.IndexOf("-HH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashPosition = -2;
|
||||
}
|
||||
var sBillId = entry == null ? 0 : entry["sBillId"].Long2Int();
|
||||
|
||||
var sql = string.Format(@"SELECT COUNT(*) AS FNUMBER FROM T_SAL_ORDERENTRY_LK WHERE FSBILLID = '{0}' AND FRULEID = 'SaleOrder-ReturnSaleOrder'", sBillId);
|
||||
var sqlDS = DBUtils.ExecuteDynamicObject(this.Context, sql);
|
||||
String F_contractnumber2 = F_contractnumber;
|
||||
int number;
|
||||
if (F_contractnumber2.Contains("-") && dashPosition != -2)
|
||||
{
|
||||
number = F_contractnumber2.Substring(F_contractnumber2.Length - 2).Long2Int();
|
||||
}
|
||||
else
|
||||
{
|
||||
number = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
number += 1;
|
||||
//if (number == 1)
|
||||
//{
|
||||
// number += 1;
|
||||
//}
|
||||
}
|
||||
//获取退货类型字段
|
||||
var F_Returntype = FEntity["F_Returntype"];
|
||||
|
||||
string F_contractnumber1;
|
||||
//获取纸质合同号
|
||||
string F_contractnumber = FEntity["F_contractnumber"].ToString();
|
||||
|
||||
int IFnumber = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
Logger.Error("销售订单上游订单的合同号", yuanF_contractnumber, new Exception());
|
||||
int dashPosition;
|
||||
if (F_contractnumber.Contains("-TH"))
|
||||
{
|
||||
|
||||
if (IFnumber != 0 && !F_Returntype.IsNullOrEmpty())
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + number.ToString();
|
||||
FEntity["F_contractnumber"]= F_contractnumber1;
|
||||
break;
|
||||
}
|
||||
else if (!F_Returntype.IsNullOrEmpty() )
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + '1';
|
||||
FEntity["F_contractnumber"] = F_contractnumber1;
|
||||
break;
|
||||
dashPosition = F_contractnumber.IndexOf("-TH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else if (F_contractnumber.Contains("-HH"))
|
||||
{
|
||||
dashPosition = F_contractnumber.IndexOf("-HH");
|
||||
F_contractnumber = dashPosition > -1 ? F_contractnumber.Substring(0, dashPosition) : F_contractnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashPosition = -2;
|
||||
}
|
||||
|
||||
var sql = string.Format(@"SELECT COUNT(*) AS FNUMBER FROM T_SAL_ORDERENTRY_LK WHERE FSBILLID = '{0}' AND FRULEID = 'SaleOrder-ReturnSaleOrder'", sBillId);
|
||||
var sqlDS = DBUtils.ExecuteDynamicObject(this.Context, sql);
|
||||
string F_contractnumber2 = F_contractnumber;
|
||||
int number;
|
||||
if (F_contractnumber2.Contains("-") && dashPosition != -2)
|
||||
{
|
||||
number = F_contractnumber2.Substring(F_contractnumber2.Length - 2).Long2Int();
|
||||
}
|
||||
else
|
||||
{
|
||||
number = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
number += 1;
|
||||
//if (number == 1)
|
||||
//{
|
||||
// number += 1;
|
||||
//}
|
||||
}
|
||||
|
||||
string F_contractnumber1;
|
||||
|
||||
int IFnumber = sqlDS[0]["FNUMBER"].Long2Int();
|
||||
|
||||
if (IFnumber != 0 && !F_Returntype.IsNullOrEmpty())
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + number.ToString();
|
||||
FEntity["F_contractnumber"] = F_contractnumber1;
|
||||
break;
|
||||
}
|
||||
else if (!F_Returntype.IsNullOrEmpty())
|
||||
{
|
||||
F_contractnumber1 = yuanF_contractnumber.ToString() + '-' + F_Returntype + '0' + '1';
|
||||
FEntity["F_contractnumber"] = F_contractnumber1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,6 +241,10 @@ namespace Pilot_KD_Parino.Sal_Order
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error("销售订单保存前刷正确的合同号报错:", ex.Message, new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
//public override void BeforeUpdateValue(BeforeUpdateValueEventArgs e)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Pilot_KD_Parino/bin/Debug/GZ_KD_Parino.dll
Normal file
BIN
Pilot_KD_Parino/bin/Debug/GZ_KD_Parino.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user