From 0fcc730fb3fa804c6e38f6f980eb15ee0a84eb33 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 08 九月 2021 13:24:15 +0800
Subject: [PATCH] 送货计划保存删除 反写提料计划 服务插件
---
src/BLL/Demo.BillView/PRD/Pur_ReceiveDelete.cs | 69 +++++++++++++++++++++++
src/BLL/Demo.BillView/PRD/Pur_Receive.cs | 68 ++++++++++++++++++++++
2 files changed, 137 insertions(+), 0 deletions(-)
diff --git a/src/BLL/Demo.BillView/PRD/Pur_Receive.cs b/src/BLL/Demo.BillView/PRD/Pur_Receive.cs
new file mode 100644
index 0000000..fd301f7
--- /dev/null
+++ b/src/BLL/Demo.BillView/PRD/Pur_Receive.cs
@@ -0,0 +1,68 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Kingdee.BOS.Util;
+using Kingdee.BOS.Core.Metadata;
+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 Kingdee.BOS.Contracts;
+using Kingdee.BOS.App;
+using Kingdee.BOS.Core.Metadata.FieldElement;
+using System.ComponentModel;
+using Kingdee.BOS.ServiceHelper;
+using Kingdee.K3.SCM.App;
+using ZD.Cloud.Logger;
+
+namespace Demo.BillView.PRD
+{
+ [Description("[鏀舵枡閫氱煡鍗�-淇濆瓨]鎸夐挳鍔熻兘]")]
+ [HotUpdate]
+ public class Pur_Receive : AbstractOperationServicePlugIn
+ {
+ public override void OnPreparePropertys(PreparePropertysEventArgs e)
+ {
+ base.OnPreparePropertys(e);
+ e.FieldKeys.Add("FSrcBillType");
+ e.FieldKeys.Add("FSrcBillNo");
+ e.FieldKeys.Add("FID");
+ e.FieldKeys.Add("FTreeEntity_FEntryID");
+ e.FieldKeys.Add("FBillNo");
+ e.FieldKeys.Add("FBFLowId");
+ e.FieldKeys.Add("FMaterialId");
+ e.FieldKeys.Add("FActReceiveQty");
+ e.FieldKeys.Add("FTLENTRYID");
+ e.FieldKeys.Add("FTLISFX");
+ }
+ /// <summary>
+ ///淇濆瓨鏇存柊鎻愭枡璁″垝鍗� 鏀舵枡鏁伴噺
+ /// </summary>
+ /// <param name="e"></param>
+ public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
+ {
+ base.AfterExecuteOperationTransaction(e);
+ List<string> sqlList = new List<string>();
+ string sql = "";
+ //瀹℃牳鏃舵洿鏂扮敓浜х敤鏂欐竻鍗曡〃鏄庣粏棰嗘枡鏁伴噺
+ Entity entity = this.BusinessInfo.GetEntity("FDetailEntity");//鑾峰彇鏄庣粏淇℃伅
+ foreach (var billObj in e.SelectedRows)
+ {
+ DynamicObjectCollection entryRows = entity.DynamicProperty.GetValue(billObj.DataEntity)
+ as DynamicObjectCollection;
+ foreach (var entryRow in entryRows)
+ {
+ string fentryId = entryRow["FTLENTRYID"].ToString();
+ bool fisfx = Convert.ToBoolean(entryRow["FTLISFX"]);
+ if (fentryId == "0" || fisfx)
+ continue;
+ sql = string.Format($"/*dialect*/update Cg_PODemandPlanBillSub set FReciveCount = FReciveCount + {Convert.ToDecimal(entryRow["ActReceiveQty"])} where FEntryID = {fentryId} ");
+ //LogHelper.Info("棰嗘枡鍗曠殑鏃ヨ鍒掔敤鏂欐竻鍗旾D:" + fentryId);
+ sqlList.Add(sql);
+ sql = string.Format($"/*dialect*/update T_PUR_ReceiveEntry set FTlisfx = 1 where FentryId = {entryRow["Id"]}");
+ sqlList.Add(sql);
+ }
+ }
+ DBServiceHelper.ExecuteBatch(Context, sqlList);
+ }
+ }
+}
diff --git a/src/BLL/Demo.BillView/PRD/Pur_ReceiveDelete.cs b/src/BLL/Demo.BillView/PRD/Pur_ReceiveDelete.cs
new file mode 100644
index 0000000..acbe875
--- /dev/null
+++ b/src/BLL/Demo.BillView/PRD/Pur_ReceiveDelete.cs
@@ -0,0 +1,69 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Kingdee.BOS.Util;
+using Kingdee.BOS.Core.Metadata;
+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 Kingdee.BOS.Contracts;
+using Kingdee.BOS.App;
+using Kingdee.BOS.Core.Metadata.FieldElement;
+using System.ComponentModel;
+using Kingdee.BOS.ServiceHelper;
+using Kingdee.K3.SCM.App;
+using ZD.Cloud.Logger;
+
+namespace Demo.BillView.PRD
+{
+ //鍒犻櫎鍗曟嵁 鎴� 鍒犻櫎鏄庣粏琛屾椂 鎵i櫎鎻愭枡鍗曠殑鏀舵枡鏁伴噺
+ [Description("[鏀舵枡閫氱煡鍗�-鍒犻櫎]鎸夐挳鍔熻兘]")]
+ [HotUpdate]
+ public class Pur_ReceiveDelete : AbstractOperationServicePlugIn
+ {
+ public override void OnPreparePropertys(PreparePropertysEventArgs e)
+ {
+ base.OnPreparePropertys(e);
+ e.FieldKeys.Add("FSrcBillType");
+ e.FieldKeys.Add("FSrcBillNo");
+ e.FieldKeys.Add("FID");
+ e.FieldKeys.Add("FTreeEntity_FEntryID");
+ e.FieldKeys.Add("FBillNo");
+ e.FieldKeys.Add("FBFLowId");
+ e.FieldKeys.Add("FMaterialId");
+ e.FieldKeys.Add("FActReceiveQty");
+ e.FieldKeys.Add("FTLENTRYID");
+ e.FieldKeys.Add("FTLISFX");
+ }
+ /// <summary>
+ ///淇濆瓨鏇存柊鎻愭枡璁″垝鍗� 鏀舵枡鏁伴噺
+ /// </summary>
+ /// <param name="e"></param>
+ public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
+ {
+ base.AfterExecuteOperationTransaction(e);
+ List<string> sqlList = new List<string>();
+ string sql = "";
+ //瀹℃牳鏃舵洿鏂扮敓浜х敤鏂欐竻鍗曡〃鏄庣粏棰嗘枡鏁伴噺
+ Entity entity = this.BusinessInfo.GetEntity("FDetailEntity");//鑾峰彇鏄庣粏淇℃伅
+ foreach (var billObj in e.SelectedRows)
+ {
+ DynamicObjectCollection entryRows = entity.DynamicProperty.GetValue(billObj.DataEntity)
+ as DynamicObjectCollection;
+ foreach (var entryRow in entryRows)
+ {
+ string fentryId = entryRow["FTLENTRYID"].ToString();
+ bool fisfx = Convert.ToBoolean(entryRow["FTLISFX"]);
+ if (fentryId == "0")
+ continue;
+ sql = string.Format($"/*dialect*/update Cg_PODemandPlanBillSub set FReciveCount = FReciveCount - {Convert.ToDecimal(entryRow["ActReceiveQty"])} where FEntryID = {fentryId} ");
+ //LogHelper.Info("棰嗘枡鍗曠殑鏃ヨ鍒掔敤鏂欐竻鍗旾D:" + fentryId);
+ sqlList.Add(sql);
+ sql = string.Format($"/*dialect*/update T_PUR_ReceiveEntry set FTlisfx = 0 where FentryId = {entryRow["Id"]}");
+ sqlList.Add(sql);
+ }
+ }
+ DBServiceHelper.ExecuteBatch(Context, sqlList);
+ }
+ }
+}
--
Gitblit v1.9.1