From b9eecc02632b2047c8bf8bff77c3caccec582970 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期日, 14 三月 2021 14:32:59 +0800
Subject: [PATCH] 日计划用料清单表单插件

---
 src/BLL/Demo.BillView/Demo.BillView.csproj         |    1 
 src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs            |    4 +
 src/BLL/Demo.BillView/PRD/Pro_RjhylqdDatachange.cs |   46 +++++++++++++++++++++++
 src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs  |   24 ++++++++++-
 4 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/src/BLL/Demo.BillView/Demo.BillView.csproj b/src/BLL/Demo.BillView/Demo.BillView.csproj
index b1ebd36..2b286e1 100644
--- a/src/BLL/Demo.BillView/Demo.BillView.csproj
+++ b/src/BLL/Demo.BillView/Demo.BillView.csproj
@@ -225,6 +225,7 @@
     <Compile Include="PRD\Pro_SCLLFSH.cs" />
     <Compile Include="PRD\Pro_SCHBSH.cs" />
     <Compile Include="PRD\Pro_SCLLSH.cs" />
+    <Compile Include="PRD\Pro_RjhylqdDatachange.cs" />
     <Compile Include="PRD\Pro_WorkBillPlatformXNQT.cs" />
     <Compile Include="PRD\Pro_ShowParameter.cs" />
     <Compile Include="PRD\Pro_ZJDBSH.cs" />
diff --git a/src/BLL/Demo.BillView/PRD/Pro_RjhylqdDatachange.cs b/src/BLL/Demo.BillView/PRD/Pro_RjhylqdDatachange.cs
new file mode 100644
index 0000000..98f2611
--- /dev/null
+++ b/src/BLL/Demo.BillView/PRD/Pro_RjhylqdDatachange.cs
@@ -0,0 +1,46 @@
+锘縰sing Kingdee.BOS.Core.Bill;
+using Kingdee.BOS.Core.Bill.PlugIn;
+using Kingdee.BOS.Core.DynamicForm;
+using Kingdee.BOS.Core.DynamicForm.PlugIn;
+using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
+using Kingdee.BOS.Core.Metadata;
+using Kingdee.BOS.Orm.DataEntity;
+using Kingdee.BOS.Util;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZD.Cloud.Logger;
+
+namespace Demo.BillView.PRD
+{
+    [Description("[鏃ヨ鍒掔敤鏂欐竻鍗昡Datachange浜嬩欢鍒嗗瓙鍒嗘瘝鏇存敼")]
+    [HotUpdate]
+    public class Pro_RjhylqdDatachange : AbstractBillPlugIn
+    {
+        public override void DataChanged(DataChangedEventArgs e)
+        {
+            //if (!isSearched) return;
+            base.DataChanged(e);
+            var model = this.View.Model;
+            double FHQty = Convert.ToDouble(model.GetValue("FHQty"));
+            //鍒嗗瓙
+            if (e.Field.Key.Contains("FNumerator") || e.Field.Key.Contains("FDenominator"))
+            {
+                double FNumerator = Convert.ToDouble(model.GetValue("FNumerator", e.Row));//鍒嗗瓙
+                double FDenominator = Convert.ToDouble(model.GetValue("FDenominator", e.Row));//鍒嗘瘝
+                if (FNumerator == 0 || FDenominator == 0)
+                    return;
+                var Hqty = Math.Ceiling((FNumerator / FDenominator) * FHQty);
+                this.View.Model.SetValue("FHQtySub", Hqty, e.Row);//璁″垝鏁伴噺
+                this.View.Model.SetValue("FHQtyMust", Hqty, e.Row);//搴斿彂鏁伴噺
+                this.View.Model.SetValue("FDwyl", FNumerator / FDenominator, e.Row);//鍗曚綅鐢ㄩ噺
+
+            }
+
+
+        }
+    }
+}
diff --git a/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs b/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs
index f78e99b..c9dffc0 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs
@@ -12,6 +12,7 @@
 using System.ComponentModel;
 using Kingdee.BOS.ServiceHelper;
 using Kingdee.K3.SCM.App;
+using ZD.Cloud.Logger;
 
 namespace Demo.DynamicForm.PRD
 {
@@ -55,7 +56,8 @@
                     if (Convert.ToString(entryRow["FDayPlanBillNo"]) == "")
                         continue;
                     string fentryId = entryRow["FDayPlanFentryId"].ToString();
-                    sql = string.Format($"/*dialect*/update Sc_DayPlanPPBomBillSub set  FPickedQty = (select sum(FBaseActualQty) from T_PRD_PICKMTRLDATA where FDayPlanFentryId = { fentryId})where FEntryID = { fentryId} ");
+                    sql = string.Format($"/*dialect*/update Sc_DayPlanPPBomBillSub set  FPickedQty = (select sum(FBaseActualQty) from T_PRD_PICKMTRLDATA where FDayPlanFentryId = {fentryId})where FEntryID = {fentryId} ");
+                    LogHelper.Info("棰嗘枡鍗曠殑鏃ヨ鍒掔敤鏂欐竻鍗旾D:" + fentryId);
                     sqlList.Add(sql);
                 }
             }
diff --git a/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs b/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs
index cfc5ebd..31bb71a 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs
@@ -2,11 +2,13 @@
 using Demo.Model.Model.PODemandPlan;
 using K3Cloud.Extend.Utils;
 using Kingdee.BOS.Core;
+using Kingdee.BOS.Core.Bill;
 using Kingdee.BOS.Core.Const;
 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.Metadata;
 using Kingdee.BOS.Core.Metadata.EntityElement;
 using Kingdee.BOS.JSON;
 using Kingdee.BOS.KDThread;
@@ -175,7 +177,7 @@
                     sqlList.Add(sql);
                     string columnName = DBServiceHelper.ExecuteScalar<string>(Context, "/*dialect*/ select stuff((select ',' + name  from syscolumns Where id = object_Id('Sc_WorkBillMainXnqt') for xml path('')),1,1,'') as name ", "");
                     sql = $"insert into  Sc_WorkBillMainXnqt({columnName}) select {columnName} from  Sc_WorkBillSortBillMain";
-                    LogHelper.Info("娴嬭瘯1锛�"+sql);
+                    LogHelper.Info("娴嬭瘯1锛�" + sql);
                     sqlList.Add(sql);
                     columnName = DBServiceHelper.ExecuteScalar<string>(Context, "/*dialect*/ select stuff((select ',' + name  from syscolumns Where id = object_Id('Sc_WorkBillSubXnqt') for xml path('')),1,1,'') as name ", "");
                     sql = $"insert into  Sc_WorkBillSubXnqt({columnName}) select {columnName} from  Sc_WorkBillSortBillSub";
@@ -206,18 +208,34 @@
             base.EntityRowClick(e);
             DynamicFormShowParameter formPa = new DynamicFormShowParameter();
             if (e.ColKey == "FDELAYLNUM")
-            {
+            {   
                 //鐢熶骇璁″垝骞冲彴鎷栨湡鏄庣粏璺宠浆
                 formPa.FormId = "paez_TardinessDetails";
                 formPa.CustomParams.Add("FID", Convert.ToString(this.View.Model.GetValue("FDayPlanWorkID", e.Row).ToString()));
+                this.View.ShowForm(formPa);
+            }
+            else if (e.ColKey == "FQTYLS")
+            {
+                //鐢熶骇璁″垝骞冲彴
+                string pageId = Guid.NewGuid().ToString();
+                BillShowParameter showParameter = new BillShowParameter();
+                showParameter.FormId = "Paez_Sc_WorkBillAutoSortBill";
+                showParameter.OpenStyle.ShowType = ShowType.MainNewTabPage;
+                showParameter.PageId = pageId;
+                showParameter.Status = OperationStatus.EDIT;
+                // 浼犲叆闇�瑕佷慨鏀圭殑鏃ヨ鍒掑伐鍗曞唴鐮侊紝 
+                showParameter.PKey =Convert.ToString(this.View.Model.GetValue("FDayPlanWorkID", e.Row).ToString());
+                this.View.ShowForm(showParameter);
+
             }
             else
             {
                 //榻愬鍒嗘瀽鏄庣粏鍒楄〃璺宠浆
                 formPa.FormId = "paez_CompleteAnalysisDetail";
                 formPa.CustomParams.Add("FHICMOInterID", Convert.ToString(this.View.Model.GetValue("FDayPlanWorkID", e.Row).ToString()));
+                this.View.ShowForm(formPa);
             }
-            this.View.ShowForm(formPa);
+           
         }
         /// <summary>
         /// 鏌ョ湅铏氭嫙榻愬

--
Gitblit v1.9.1