From e7b25b1c1d8d3310aa5deae5f72a3e0cc36c6fc2 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期一, 19 四月 2021 15:18:01 +0800
Subject: [PATCH] 代码提交

---
 src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs |   82 ++++++++++++++++++++++++++---------------
 1 files changed, 52 insertions(+), 30 deletions(-)

diff --git a/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs b/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs
index 0bb8d39..b454828 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs
@@ -40,6 +40,28 @@
         string PathName = "鏃ヨ鍒掑鍏ユā鏉�.xlsx";
         List<PRD_Inventory> ListInventory;//搴撳瓨鏄庣粏
         List<PRD_Inventory> ListInventoryByStockOrgId;//鐗╂枡鎬诲簱瀛�
+
+        private bool isSearched = false;
+
+        public override void DataChanged(DataChangedEventArgs e)
+        {
+            if (!isSearched) return;
+            base.DataChanged(e);
+            var columns = new List<string>() { "", "" };
+            for (int i = 0; i < 100; i++)
+            {
+                columns.Add("FT" + i.ToString());
+            }
+            var model = this.View.Model;
+            if (columns.Contains(e.Field.Key))
+            {
+                var sum = columns.Select(x => Convert.ToDouble(model.GetValue(x, e.Row))).Sum();//鏃ヨ鍒掓�诲拰
+                var scOrderCount = Convert.ToDouble(model.GetValue("FOrderQuantity", e.Row));//鐢熶骇璁㈠崟鏁伴噺
+                var FQTYLS = Convert.ToDouble(model.GetValue("FQTYLS", e.Row));//鍘嗗彶
+                this.View.Model.SetValue("FNoScheduled", scOrderCount - sum - FQTYLS, e.Row);
+                this.View.Model.SetValue("FDayPlanQuantity", sum, e.Row);
+            }
+        }
         public override void BarItemClick(BarItemClickEventArgs e)
         {
             base.BarItemClick(e);
@@ -58,7 +80,9 @@
                 }
                 if (e.BarItemKey.ToUpper() == "TBSEARCH")
                 {
+                    isSearched = false;
                     SearchList();
+                    isSearched = true;
                 }
                 if (e.BarItemKey.ToUpper() == "TBLOCK")
                 {
@@ -76,6 +100,7 @@
                 if (e.BarItemKey.ToUpper() == "TBCOMPLETE")
                 {
                     COMPLETE();
+
                 }
                 //鎻愭枡璁″垝
                 if (e.BarItemKey.ToUpper() == "TBEXTRACTION")
@@ -116,7 +141,9 @@
             base.EntryBarItemClick(e);
             if (e.BarItemKey.ToUpper() == "TBEDIT")
             {
+                isSearched = false;
                 SearchListEdit();
+                isSearched = true;
             }
         }
         /// <summary>
@@ -295,14 +322,9 @@
                 sql = $"/*dialect*/update t1 set t1.FHLockedSub=0 from Sc_WorkBillSortBillSub t1  join Sc_WorkBillSortBillMain t2 on  t1.FID = t2.FID  where  FHMASTERDATE between  DATEADD(day,-1,getdate()) and DATEADD(day,{day - 1},getdate())   and t1.FID = { Convert.ToString(item["FDayPlanWorkID"])} ";
                 sqlList.Add(sql);
             }
-            int result = DBServiceHelper.ExecuteBatch(Context, sqlList);
-            if (result > 0)
-            {
-                SearchList();
-                this.View.ShowMessage("鎿嶄綔鎴愬姛");
-            }
-            else
-                this.View.ShowMessage("鎿嶄綔澶辫触锛岃仈绯荤鐞嗗憳锛�");
+            SearchList();
+            this.View.ShowMessage("鎿嶄綔鎴愬姛");
+
         }
         /// <summary>
         /// 淇濆瓨鍔熻兘
@@ -339,7 +361,7 @@
                 JObject jsonModel = new JObject();
                 jsonModel.Add("FID", Convert.ToString(current["FDayPlanWorkID"]));
                 jsonModel.Add("FOrderQuantity", Convert.ToString(current["FOrderQuantity"]));
-                jsonModel.Add("FDayPlanQuantity", Convert.ToString(current["FDayPlanQuantity"]));
+                jsonModel.Add("FDayPlanQuantity", Convert.ToDecimal(current["FDayPlanQuantity"]) + Convert.ToDecimal(current["FQTYLS"]));
                 jsonModel.Add("FNoScheduled", Convert.ToString(current["FNoScheduled"]));
                 sql = $" /*dialect*/ select FEntryID, FHMASTERDATE from SC_WORKBILLSORTBILLSub  where FID={Convert.ToString(current["FDayPlanWorkID"])} ";
                 List<DayPlanModel> dayPlanModel = new List<DayPlanModel>();
@@ -1159,11 +1181,11 @@
             //閿�鍞鍗曞彿
             string FSalOrder = Convert.ToString((this.Model.GetValue("FSalOrder")));
             if (!string.IsNullOrEmpty(FSalOrder))
-                sqlwhere += $" and FHSeOrderBillNo='{FSalOrder}'";
+                sqlwhere += $" and FHSeOrderBillNo like '%{FSalOrder}%'";
             //鐢熶骇璁㈠崟鍙�
             string FScOrderMainNo = Convert.ToString((this.Model.GetValue("FScOrderMainNo")));
             if (!string.IsNullOrEmpty(FScOrderMainNo))
-                sqlwhere += $" and FSCORDERNO='{FScOrderMainNo}'";
+                sqlwhere += $" and FSCORDERNO like '%{FScOrderMainNo}%'";
             //鐗╂枡
             if ((this.Model.GetValue("FMatralId") as DynamicObject) != null)
             {
@@ -1177,7 +1199,8 @@
                 sqlwhere += $" and FPreparatDate='{FPreparatDate}'";
             try
             {
-                string sql = @"/*dialect*/ select t1.*,isnull((select SUM(isnull(FNotProductNum,0)) from SC_WORKBILLSORTBILLSub t2 where t2.FID = t1.FID and DATEDIFF(D,FHMASTERDATE,GETDATE())>0),0)FNotProductNum from  Sc_WorkBillSortBillMain t1
+                string sql = @"/*dialect*/ select t1.*,isnull((select SUM(isnull(FNotProductNum,0)) from SC_WORKBILLSORTBILLSub t2 where t2.FID = t1.FID and DATEDIFF(D,FHMASTERDATE,GETDATE())>0),0)FNotProductNum ,isnull((select SUM(isnull(FHQTY,0)) from SC_WORKBILLSORTBILLSub t2 where t2.FID = t1.FID and DATEDIFF(D,FHMASTERDATE,GETDATE())>0),0)FQTYLS 
+ from  Sc_WorkBillSortBillMain t1
  left join T_BD_MATERIAL t3 on t1.FHMaterID=t3.FMATERIALID
 " + sqlwhere;
                 DataTable dt = DBServiceHelper.ExecuteDataSet(Context, sql).Tables[0];
@@ -1209,7 +1232,8 @@
                     this.Model.SetValue("FProductWorkShopId", dt.Rows[i]["FHWorkShopID"].ToString(), i);//鐢熶骇杞﹂棿
                     this.Model.SetValue("FCompleteSetCount", dt.Rows[i]["FCompleteCount"].ToString(), i);//榻愬鏁伴噺
                     this.Model.SetValue("FOrderQuantity", dt.Rows[i]["FOrderQuantity"].ToString(), i);//鐢熶骇璁㈠崟鏁伴噺
-                    this.Model.SetValue("FDayPlanQuantity", dt.Rows[i]["FDayPlanQuantity"].ToString(), i);//鏃ヨ鍒掓暟閲�
+                    this.Model.SetValue("FDayPlanQuantity", Convert.ToDecimal(dt.Rows[i]["FDAYPLANQUANTITY"]) - Convert.ToDecimal(dt.Rows[i]["FQTYLS"]), i);//鏃ヨ鍒掓暟閲�
+                    this.Model.SetValue("FQTYLS", dt.Rows[i]["FQTYLS"].ToString(), i);//鍘嗗彶閬楃暀
                     this.Model.SetValue("FNoScheduled", dt.Rows[i]["FNoScheduled"].ToString(), i);//鏈帓鏁伴噺
                     this.Model.SetValue("FDelaylnUM", dt.Rows[i]["FNotProductNum"].ToString(), i);//鎷栨湡鏁伴噺
                     sql = @"/*dialect*/SELECT * FROM Sc_WorkBillSortBillSub WHERE DATEDIFF(D,GETDATE(),FHMASTERDATE)>=0 and FID=" + dt.Rows[i]["FID"].ToString();
@@ -1225,7 +1249,7 @@
                         if (dr["FHLockedSub"].ToString() == "1")
                             this.View.GetFieldEditor("FT" + getDay.Days.ToString(), i).Enabled = false; //鍗曟嵁浣撹閿佸畾瀛楁
                     }
-                    this.View.InvokeFieldUpdateService("FMatrailId", i);//璋冪敤鏁伴噺鍊兼洿鏂�
+                    this.View.InvokeFieldUpdateService("FMatrailId", i);//GetControl
                 }
                 this.View.UpdateView();
                 for (int j = 0; j < dt.Rows.Count; j++)
@@ -1279,20 +1303,12 @@
             }
             //閿�鍞鍗曞彿
             string FSalOrder = Convert.ToString((this.Model.GetValue("FSalOrder")));
-            if (string.IsNullOrEmpty(FSalOrder))
-            {
-
-            }
-            else
-                sqlwhere += $" and FHSeOrderBillNo='{FSalOrder}'";
+            if (!string.IsNullOrEmpty(FSalOrder))
+                sqlwhere += $" and FHSeOrderBillNo like '%{FSalOrder}%'";
             //鐢熶骇璁㈠崟鍙�
             string FScOrderMainNo = Convert.ToString((this.Model.GetValue("FScOrderMainNo")));
-            if (string.IsNullOrEmpty(FScOrderMainNo))
-            {
-
-            }
-            else
-                sqlwhere += $" and FSCORDERNO='{FScOrderMainNo}'";
+            if (!string.IsNullOrEmpty(FScOrderMainNo))
+                sqlwhere += $" and FSCORDERNO like '%{FScOrderMainNo}%'";
 
             //鐗╂枡
             if ((this.Model.GetValue("FMatralId") as DynamicObject) != null)
@@ -1307,7 +1323,8 @@
                 sqlwhere += $" and FPreparatDate='{FPreparatDate}'";
             try
             {
-                string sql = @"/*dialect*/ select t1.*,isnull((select SUM(isnull(FNotProductNum,0)) from SC_WORKBILLSORTBILLSub t2 where t2.FID = t1.FID and DATEDIFF(D,FHMASTERDATE,GETDATE())>0),0)FNotProductNum from  Sc_WorkBillSortBillMain t1
+                string sql = @"/*dialect*/  select t1.*,isnull((select SUM(isnull(FNotProductNum,0)) from SC_WORKBILLSORTBILLSub t2 where t2.FID = t1.FID and DATEDIFF(D,FHMASTERDATE,GETDATE())>0),0)FNotProductNum ,isnull((select SUM(isnull(FHQTY,0)) from SC_WORKBILLSORTBILLSub t2 where t2.FID = t1.FID and DATEDIFF(D,FHMASTERDATE,GETDATE())>0),0)FQTYLS 
+ from  Sc_WorkBillSortBillMain t1
  left join T_BD_MATERIAL t3 on t1.FHMaterID=t3.FMATERIALID
 " + sqlwhere;
                 DataTable dt = DBServiceHelper.ExecuteDataSet(Context, sql).Tables[0];
@@ -1339,7 +1356,8 @@
                     this.Model.SetValue("FProductWorkShopId", dt.Rows[i]["FHWorkShopID"].ToString(), i);//鐢熶骇杞﹂棿
                     this.Model.SetValue("FCompleteSetCount", dt.Rows[i]["FCompleteCount"].ToString(), i);//榻愬鏁伴噺
                     this.Model.SetValue("FOrderQuantity", dt.Rows[i]["FOrderQuantity"].ToString(), i);//鐢熶骇璁㈠崟鏁伴噺
-                    this.Model.SetValue("FDayPlanQuantity", dt.Rows[i]["FDayPlanQuantity"].ToString(), i);//鏃ヨ鍒掓暟閲�
+                    this.Model.SetValue("FDayPlanQuantity", Convert.ToDecimal(dt.Rows[i]["FOrderQuantity"]) - Convert.ToDecimal(dt.Rows[i]["FQTYLS"]), i);//鏃ヨ鍒掓暟閲�
+                    this.Model.SetValue("FQTYLS", dt.Rows[i]["FQTYLS"].ToString(), i);//鍘嗗彶閬楃暀
                     this.Model.SetValue("FNoScheduled", dt.Rows[i]["FNoScheduled"].ToString(), i);//鏈帓鏁伴噺
                     this.Model.SetValue("FDelaylnUM", dt.Rows[i]["FNotProductNum"].ToString(), i);//鎷栨湡鏁伴噺
                     sql = @"/*dialect*/SELECT * FROM Sc_WorkBillSortBillSub WHERE DATEDIFF(D,GETDATE(),FHMASTERDATE)>=0 and FID=" + dt.Rows[i]["FID"].ToString();
@@ -1519,7 +1537,7 @@
             {
                 string sql = string.Format(@"
 /*dialect*/
- select t1.FID,t1.FEntryID,t3.FMATERIALID,T5.FNUMBER,t1.FHMASTERDATE,t1.FHQTY,t4.FMATERIALID FMATERIALID2,T6.FNUMBER FNUMBER2,T7.FNUMBER FUNITNUMBER,FNumerator,FDenominator,convert(decimal(18,2),(FNumerator/FDenominator) *t1.FHQTY) FHQtyMust,T4.FUnitID,t8.FNUMBER FUNITNUMBER2,T3.FID FPPBOM,T4.FENTRYID FPPBOMENTRYID,isnull(T9.FBillNo,'')FBillNo,t10.FNUMBER FORGNUMBER,t11.FNUMBER FHSOURCENUMBER,FSCRAPRATE,FFIXSCRAPQTY,T9.FID AS DayPlanFID,t2.FSCORDERNO,
+ select t1.FID,t1.FSEQ FDayPlanFSEQ,t1.FEntryID,T2.FBILLNO AS FDayPlanFBILLNO,t3.FMATERIALID,T5.FNUMBER,t1.FHMASTERDATE,t1.FHQTY,t4.FMATERIALID FMATERIALID2,T6.FNUMBER FNUMBER2,T7.FNUMBER FUNITNUMBER,FNumerator,FDenominator,convert(decimal(18,2),(FNumerator/FDenominator) *t1.FHQTY) FHQtyMust,T4.FUnitID,t8.FNUMBER FUNITNUMBER2,T3.FID FPPBOM,T4.FENTRYID FPPBOMENTRYID,isnull(T9.FBillNo,'')FBillNo,t10.FNUMBER FORGNUMBER,t11.FNUMBER FHSOURCENUMBER,FSCRAPRATE,FFIXSCRAPQTY,T9.FID AS DayPlanFID,t2.FSCORDERNO,
 t3.FMOENTRYID,t3.FBILLNO FPPBOMBILLNO,T4.FSEQ,tc.FOWNERTYPEID,tc.FOWNERID,tc.FEntrustPickOrgId,torg.FNUMBER as FORGNUMBER,t3.FMOID,FIssueType,FMaterialType
 FROM Sc_WorkBillSortBillSub t1
 JOIN Sc_WorkBillSortBillMAIN t2 on t1.FID = t2.FID
@@ -1576,7 +1594,9 @@
                             FEntrustPickOrgId = dr["FORGNUMBER"].ToString(),
                             FMOID = dr["FMOID"].ToString(),
                             FIssueType = dr["FIssueType"].ToString(),
-                            FMaterialType = dr["FMaterialType"].ToString()
+                            FMaterialType = dr["FMaterialType"].ToString(),
+                            FDayPlanFSEQ = dr["FDayPlanFSEQ"].ToString(),
+                            FDayPlanFBILLNO = dr["FDayPlanFBILLNO"].ToString()
                         });
                     }
                     LogHelper.Info($"鏃ヨ鍒掔敤鏂欐竻鍗曪紝鏁版嵁鍑嗗瀹屾垚锛屼繚瀛樺埌Model瀹炰綋锛屾�昏鏁帮細{DayPlanMaterial.Count}锛岃�楁椂锛�" + sw.Elapsed);
@@ -1597,6 +1617,8 @@
                         model.Add("FHQty", _DayPlanMaterial[0].FHQty);//涓讳骇鍝佹暟閲忥細FHQty 
                         model.Add("FHUnitID", new JObject() { ["Fnumber"] = _DayPlanMaterial[0].FHUnitID });//鍗曚綅锛欶HUnitID 
                         model.Add("FDayPlanFID", _DayPlanMaterial[0].FDayPlanFID);//鏃ヨ鍒掑伐鍗曞唴鐮� 
+                        model.Add("FDayPlanFSEQ", _DayPlanMaterial[0].FDayPlanFSEQ);//鏃ヨ鍒掑伐鍗曟槑缁嗚鍙�
+                        model.Add("FDayPlanFBillNo", _DayPlanMaterial[0].FDayPlanFBILLNO);//鏃ヨ鍒掑伐鍗曞崟鎹紪鍙�
                         JArray Entry = new JArray();
                         int FSEQ = 1;
                         foreach (var _item in _DayPlanMaterial)

--
Gitblit v1.9.1