From 73c9a20d924da117f89b280e589c33ae1fa0d0f6 Mon Sep 17 00:00:00 2001
From: yuyubo <1870149533@qq.com>
Date: Fri, 12 Dec 2025 19:35:04 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E4=B8=93=E7=A5=A8=E5=A4=8D=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ServicePlugIn/AfterSave.cs | 29 ++++++++++++++-----
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs b/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
index 7b0fa4a..8aa3de5 100644
--- a/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
+++ b/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
@@ -58,20 +58,34 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.AR_SalesVATInvoice.ServicePlugIn
// 判断条件:FIDD != 当前行ID 且 源单编号为空
if (fiddValue != entryId && string.IsNullOrWhiteSpace(srcBillNo))
{
- // 从当前单据主表获取单据编号(实体属性名:BILLNO)
- var billNo = billObj["BILLNO"]?.ToString() ?? "";
+ // 通过源分录ID(FIDD)查询源单据的单据编号
+ string srcBillNoFromSource = "";
+
+ var querySql = $@"/*dialect*/
+SELECT A.FBILLNO
+FROM T_IV_SALESIC A
+INNER JOIN T_IV_SALESICENTRY B ON A.FID = B.FID
+WHERE B.FENTRYID = {fiddValue}";
+
+ var result = DBServiceHelper.ExecuteDynamicObject(this.Context, querySql);
+ if (result != null && result.Count > 0)
+ {
+ srcBillNoFromSource = result[0]["FBILLNO"]?.ToString() ?? "";
+ }
+
+
+
// 固定源单类型为"销售增值税专用发票"
var srcBillType = "IV_SALESIC";
- // 回写当前单据体:源单类型、源单编号
+ // 回写当前单据体:源单类型、源单编号(使用源单据的编号)
// 这里使用数据库字段名(带F前缀)
var updateSql = $@"/*dialect*/
UPDATE T_IV_SALESICENTRY
SET FSRCBILLTYPEID = '{srcBillType.Replace("'", "''")}',
- FSRCBILLNO = '{billNo.Replace("'", "''")}'
+ FSRCBILLNO = '{srcBillNoFromSource.Replace("'", "''")}'
WHERE FENTRYID = {entryId}";
- Logger.Error("销售增值税专用发票", updateSql, new Exception());
- Logger.Error("销售增值税专用发票", "78", new Exception());
+ Logger.Error("销售增值税专用发票_回写源单信息", updateSql, new Exception());
DBServiceHelper.Execute(this.Context, updateSql);
}
}
@@ -95,6 +109,7 @@ WHERE FENTRYID = {entryId}";
{
Logger.Error("销售增值税专用发票出错了:", ex.Message, new Exception());
}
+
}
}
-}
\ No newline at end of file
+}
From 6289385a963823a080286a7312f6bd03bdb3a683 Mon Sep 17 00:00:00 2001
From: yuyubohh <403221757@qq.com>
Date: Fri, 12 Dec 2025 20:51:46 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ServicePlugIn/AfterSave.cs | 31 ++++++++++++++-----
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs b/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
index 7b0fa4a..b8aaaf3 100644
--- a/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
+++ b/Pilot_KD_Parino/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
@@ -9,7 +9,7 @@ using Kingdee.BOS.Util;
using System;
using System.ComponentModel;
-namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.AR_SalesVATInvoice.ServicePlugIn
+namespace Pilot_KD_Parino.AR_SalesVATInvoice.ServicePlugIn
{
[HotUpdate, Description("销售增值税专用发票_保存后事件")]
public class AfterSave : AbstractOperationServicePlugIn
@@ -58,20 +58,34 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.AR_SalesVATInvoice.ServicePlugIn
// 判断条件:FIDD != 当前行ID 且 源单编号为空
if (fiddValue != entryId && string.IsNullOrWhiteSpace(srcBillNo))
{
- // 从当前单据主表获取单据编号(实体属性名:BILLNO)
- var billNo = billObj["BILLNO"]?.ToString() ?? "";
+ // 通过源分录ID(FIDD)查询源单据的单据编号
+ string srcBillNoFromSource = "";
+
+ var querySql = $@"/*dialect*/
+SELECT A.FBILLNO
+FROM T_IV_SALESIC A
+INNER JOIN T_IV_SALESICENTRY B ON A.FID = B.FID
+WHERE B.FENTRYID = {fiddValue}";
+
+ var result = DBServiceHelper.ExecuteDynamicObject(this.Context, querySql);
+ if (result != null && result.Count > 0)
+ {
+ srcBillNoFromSource = result[0]["FBILLNO"]?.ToString() ?? "";
+ }
+
+
+
// 固定源单类型为"销售增值税专用发票"
var srcBillType = "IV_SALESIC";
- // 回写当前单据体:源单类型、源单编号
+ // 回写当前单据体:源单类型、源单编号(使用源单据的编号)
// 这里使用数据库字段名(带F前缀)
var updateSql = $@"/*dialect*/
UPDATE T_IV_SALESICENTRY
SET FSRCBILLTYPEID = '{srcBillType.Replace("'", "''")}',
- FSRCBILLNO = '{billNo.Replace("'", "''")}'
+ FSRCBILLNO = '{srcBillNoFromSource.Replace("'", "''")}'
WHERE FENTRYID = {entryId}";
- Logger.Error("销售增值税专用发票", updateSql, new Exception());
- Logger.Error("销售增值税专用发票", "78", new Exception());
+ Logger.Error("销售增值税专用发票_回写源单信息", updateSql, new Exception());
DBServiceHelper.Execute(this.Context, updateSql);
}
}
@@ -95,6 +109,7 @@ WHERE FENTRYID = {entryId}";
{
Logger.Error("销售增值税专用发票出错了:", ex.Message, new Exception());
}
+
}
}
-}
\ No newline at end of file
+}
From 62c55e5f14a49f18b5f90442676f725e9d594d17 Mon Sep 17 00:00:00 2001
From: yuyubohh <403221757@qq.com>
Date: Fri, 12 Dec 2025 23:15:06 +0800
Subject: [PATCH 3/6] 1
---
.../ServicePlugIn/AfterSave.cs | 94 -------------------
.../Gatedge.K3.Pilot.PlugIn.csproj | 2 +-
2 files changed, 1 insertion(+), 95 deletions(-)
delete mode 100644 Gatedge.K3.Pilot.PlugIn/BOSPlugIn/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
diff --git a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
deleted file mode 100644
index 5bdf242..0000000
--- a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/AR_SalesVATInvoice/ServicePlugIn/AfterSave.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-using Kingdee.BOS;
-using Kingdee.BOS.Core.DynamicForm.PlugIn;
-using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
-using Kingdee.BOS.Log;
-using Kingdee.BOS.Orm;
-using Kingdee.BOS.Orm.DataEntity;
-using Kingdee.BOS.ServiceHelper;
-using Kingdee.BOS.Util;
-using System;
-using System.ComponentModel;
-using System.Dynamic;
-
-namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.AR_SalesVATInvoice.ServicePlugIn
-{
- [HotUpdate, Description("销售增值税专用发票_保存后事件")]
- public class AfterSave : AbstractOperationServicePlugIn
- {
- public override void OnPreparePropertys(PreparePropertysEventArgs e)
- {
- base.OnPreparePropertys(e);
- // 根据日志中的实际实体属性名来添加
- 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"); // 单据编号(主表字段)
- }
-
-
- public override void EndOperationTransaction(EndOperationTransactionArgs e)
- {
- base.EndOperationTransaction(e);
- foreach (var dataEntity in e.DataEntitys)
- {
- var billObj = dataEntity as DynamicObject;
- if (billObj == null)
- continue;
-
- // 获取单据体
- var entrys = billObj["SALESICENTRY"] as DynamicObjectCollection;
- if (entrys == null || entrys.Count == 0)
- continue;
-
- foreach (var entry in entrys)
- {
- // 使用 Id 获取主键值
- var entryId = Convert.ToInt64(entry.GetPrimaryKeyValue());
- var fidd = entry["FIDD"];
- var fiddValue = fidd == null ? 0 : Convert.ToInt64(fidd);
-
- if (fiddValue > 0)
- {
- // FIDD > 0 时,判断是否需要回写
- var srcBillNo = entry["SRCBILLNO"]?.ToString() ?? "";
-
- // 判断条件:FIDD != 当前行ID 且 源单编号为空
- if (fiddValue != entryId && string.IsNullOrWhiteSpace(srcBillNo))
- {
- // 从当前单据主表获取单据编号(实体属性名:BILLNO)
- var billNo = billObj["BILLNO"]?.ToString() ?? "";
- // 固定源单类型为"销售增值税专用发票"
- var srcBillType = "IV_SALESIC";
-
- // 回写当前单据体:源单类型、源单编号
- // 这里使用数据库字段名(带F前缀)
- var updateSql = $@"/*dialect*/
-UPDATE T_IV_SALESICENTRY
-SET FSRCBILLTYPEID = '{srcBillType.Replace("'", "''")}',
- FSRCBILLNO = '{billNo.Replace("'", "''")}'
-WHERE FENTRYID = {entryId}";
- Logger.Error("销售增值税专用发票", updateSql, new Exception());
- Logger.Error("销售增值税专用发票", "78", new Exception());
- DBServiceHelper.Execute(this.Context, updateSql);
- }
- }
- else
- {
- // FIDD <= 0 时,把当前行FID赋值给FIDD,同时把FSEQ赋值给FSEQQ
- var seq = entry["SEQ"]?.ToString() ?? "0";
- var updateSql = $@"/*dialect*/
-UPDATE T_IV_SALESICENTRY
-SET FIDD = {entryId},
- FSEQQ = '{seq.Replace("'", "''")}'
-WHERE FENTRYID = {entryId}";
- Logger.Error("销售增值税专用发票", updateSql, new Exception());
- Logger.Error("销售增值税专用发票", "78", new Exception());
- DBServiceHelper.Execute(this.Context, updateSql);
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj b/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj
index cc432a0..e21859f 100644
--- a/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj
+++ b/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj
@@ -89,7 +89,6 @@
-
@@ -106,6 +105,7 @@
+
From 37f9fd08fb778b00dd2323ee03f62f56bae2ff15 Mon Sep 17 00:00:00 2001
From: yuyubohh <403221757@qq.com>
Date: Sat, 13 Dec 2025 00:20:50 +0800
Subject: [PATCH 4/6] 2
---
.../Sal_Order/SaleOrderContractnumber.cs | 2 +-
修改合同号一些列订单.txt | 32 +++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
create mode 100644 修改合同号一些列订单.txt
diff --git a/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs b/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs
index 63c059c..e25670a 100644
--- a/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs
+++ b/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs
@@ -180,7 +180,7 @@ namespace Pilot_KD_Parino.Sal_Order
//获取纸质合同号
string F_contractnumber = FEntity["F_contractnumber"].ToString();
- Logger.Error("销售订单上游订单的合同号", yuanF_contractnumber, new Exception());
+ Logger.Error("销售订单上游订单的合同号"+ i.ToString(), yuanF_contractnumber, new Exception());
int dashPosition;
if (F_contractnumber.Contains("-TH"))
{
diff --git a/修改合同号一些列订单.txt b/修改合同号一些列订单.txt
new file mode 100644
index 0000000..54d3624
--- /dev/null
+++ b/修改合同号一些列订单.txt
@@ -0,0 +1,32 @@
+select F_CONTRACTNUMBER, * from T_SAL_ORDER
+where fbillno='PL-XSDD20251200583'
+
+--update T_SAL_ORDER set F_CONTRACTNUMBER='P202512090017-HH01'
+--where fbillno='PL-XSDD20251200583'
+
+
+select F_Papercontract, * from T_SAL_DELIVERYNOTICE
+where FBillNo='SEOUT25121086'
+
+--update T_SAL_DELIVERYNOTICE set F_Papercontract='P202512090017-HH01'
+--where FBillNo='SEOUT25121086'
+
+select F_contractnumber,* from T_SAL_OUTSTOCK
+where FBillNo='PL-XSCKD20251200647'
+
+--update T_SAL_OUTSTOCK set F_contractnumber='P202512090017-HH01'
+--where FBillNo='PL-XSCKD20251200647'
+
+
+select F_Paperpro,* from T_AR_RECEIVABLE
+where FBillNo='PL-XSCKD20251200647'
+
+
+--update T_AR_RECEIVABLE set F_Paperpro='P202512090017-HH01'
+--where FBillNo='PL-XSCKD20251200647'
+
+select F_Paper,* from T_AR_RECEIVABLEENTRY
+where fid=129824
+
+--update T_AR_RECEIVABLEENTRY set F_Paper='P202512090017-HH01'
+--where fid=129824
\ No newline at end of file
From c98a91d0c9886f1d818415ef78bdbba971886524 Mon Sep 17 00:00:00 2001
From: yuyubohh <403221757@qq.com>
Date: Sat, 13 Dec 2025 00:56:57 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=90=88=E5=90=8C?=
=?UTF-8?q?=E5=8F=B7=E6=9D=A5=E6=BA=90=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Sal_Order/SaleOrderContractnumber.cs | 22 ++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs b/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs
index e25670a..4aa926c 100644
--- a/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs
+++ b/Pilot_KD_Parino/Sal_Order/SaleOrderContractnumber.cs
@@ -7,6 +7,7 @@ using Kingdee.BOS.Log;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
+using NPOI.Util;
using Pilot_KD_Parino.Common;
using System;
using System.ComponentModel;
@@ -153,8 +154,11 @@ namespace Pilot_KD_Parino.Sal_Order
if (FSaleOrderEntry_Link.Count > 0)
{
var details = FSaleOrderEntry_Link[0]["FSaleOrderEntry_Link"] as DynamicObjectCollection;
- //string sdas=JsonHelper.ToJson(details);
- // Logger.Error("销售订单上游订单的xx ", sdas, new Exception());
+ 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");
@@ -164,7 +168,7 @@ namespace Pilot_KD_Parino.Sal_Order
if (entrys != null && entrys.Count > 0)
{
- string yuanF_contractnumber = FEntity["F_contractnumber"].ToString();
+ string yuanF_contractnumber = "";
int i = 0;
foreach (var entry in entrys)
{
@@ -173,7 +177,19 @@ namespace Pilot_KD_Parino.Sal_Order
i++;
var sBillId = entry == null ? 0 : entry["sBillId"].Long2Int();
+ //销售订单找到上游的销售订单
+ string getSourceSql = $@"/*dialect*/select F_CONTRACTNUMBER from T_SAL_ORDER where fid={sBillId} ";
+ var dt333 = DBServiceHelper.ExecuteDynamicObject(this.Context, getSourceSql);
+ if (dt333 == null || dt333.Count == 0)
+ {
+ return;
+ }
+ else
+ {
+ yuanF_contractnumber = dt333.FirstOrDefault()["F_CONTRACTNUMBER"].ToString();
+ }
+
//获取退货类型字段
var F_Returntype = FEntity["F_Returntype"];
From f16f9b516e13f1b3d89fe4946680772644ab8c0c Mon Sep 17 00:00:00 2001
From: yuyubohh <403221757@qq.com>
Date: Sat, 13 Dec 2025 01:00:36 +0800
Subject: [PATCH 6/6] 1
---
修改合同号一些列订单.txt | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/修改合同号一些列订单.txt b/修改合同号一些列订单.txt
index 54d3624..6d8b2b2 100644
--- a/修改合同号一些列订单.txt
+++ b/修改合同号一些列订单.txt
@@ -29,4 +29,14 @@ select F_Paper,* from T_AR_RECEIVABLEENTRY
where fid=129824
--update T_AR_RECEIVABLEENTRY set F_Paper='P202512090017-HH01'
---where fid=129824
\ No newline at end of file
+--where fid=129824
+
+select * from T_PRD_MO a
+where FBillNo='PL-MO20251201392'
+
+
+select F_ZZHTH,* from T_PRD_MOENTRY b
+where fid=129745
+
+--update T_PRD_MOENTRY set F_ZZHTH='P202512090017-HH01'
+--where fid=129745