From 0139536a43bc0ec80a31984b8e50c58286cfb5fa Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期四, 18 二月 2021 16:34:20 +0800
Subject: [PATCH] nothing

---
 src/BLL/Demo.BillView/Demo.BillView.csproj   |    1 
 src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs      |    4 +
 src/BLL/Demo.BillView/PRD/Pro_DayPlan.cs     |    6 +
 src/BLL/Demo.BillView/PRD/Pro_ScDayImport.cs |   12 ++-
 src/BLL/Demo.BillView/PRD/Pro_SCLLFSH.cs     |    5 +
 src/BLL/Demo.BillView/PRD/Prd_Pickmtrl.cs    |  150 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/BLL/Demo.BillView/PRD/Pro_TlPush.cs      |    2 
 7 files changed, 172 insertions(+), 8 deletions(-)

diff --git a/src/BLL/Demo.BillView/Demo.BillView.csproj b/src/BLL/Demo.BillView/Demo.BillView.csproj
index 353a3df..27ebd24 100644
--- a/src/BLL/Demo.BillView/Demo.BillView.csproj
+++ b/src/BLL/Demo.BillView/Demo.BillView.csproj
@@ -222,6 +222,7 @@
     <Compile Include="PRD\ProTardinessDetails.cs" />
     <Compile Include="PRD\ProCompleteAnalysisMateriel.cs" />
     <Compile Include="PRD\ProCompleteAnalysisDetails.cs" />
+    <Compile Include="PRD\Prd_Pickmtrl.cs" />
     <Compile Include="PRD\Pro_DayPlan.cs" />
     <Compile Include="PRD\Pro_DayPlanCheckSelectMenu.cs" />
     <Compile Include="PRD\Pro_DayPlanPushSCHB.cs" />
diff --git a/src/BLL/Demo.BillView/PRD/Prd_Pickmtrl.cs b/src/BLL/Demo.BillView/PRD/Prd_Pickmtrl.cs
new file mode 100644
index 0000000..1d3b151
--- /dev/null
+++ b/src/BLL/Demo.BillView/PRD/Prd_Pickmtrl.cs
@@ -0,0 +1,150 @@
+锘縰sing Kingdee.BOS;
+using Kingdee.BOS.Core.Bill.PlugIn;
+using Kingdee.BOS.Core.DynamicForm;
+using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
+using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
+using Kingdee.BOS.Core.List;
+using Kingdee.BOS.Core.Metadata.EntityElement;
+using Kingdee.BOS.Orm.DataEntity;
+using Kingdee.BOS.ServiceHelper;
+using Kingdee.BOS.Util;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+namespace Demo.BillView.PRD
+{
+    [Description("[鐢熶骇棰嗘枡鍗昡 琛ㄥ崟鎻掍欢"), HotUpdate]
+    public class Prd_Pickmtrl : AbstractBillPlugIn
+    {
+        public override void BarItemClick(BarItemClickEventArgs e)  
+        {
+            base.BarItemClick(e);
+            try
+            {
+                if (e.BarItemKey.ToUpper() == "TBDAYPLANMENU")
+                {
+                    string pageId = Guid.NewGuid().ToString();
+                    ListShowParameter showParameter = new ListShowParameter();
+                    showParameter.FormId = "Paez_Sc_WorkBillAutoSortBill";
+                    showParameter.PageId = pageId;
+                    showParameter.UseOrgId = this.Context.CurrentOrganizationInfo.ID;
+                    showParameter.IsLookUp = true;
+                    this.View.ShowForm(showParameter);
+
+                    this.View.ShowForm(showParameter, delegate (FormResult result)
+                    {
+                        object returnData = result.ReturnData;
+                        if (returnData is ListSelectedRowCollection)
+                        {
+                            ListSelectedRowCollection listSelectedRowCollection = returnData as ListSelectedRowCollection;
+                            if (listSelectedRowCollection != null)
+                            {
+                                DynamicObjectDataRow datarow = (DynamicObjectDataRow)listSelectedRowCollection[0].DataRow;
+
+                                this.View.Model.SetValue("FMATERIALID", datarow.DynamicObject["FHMaterID_Id"].ToString());
+                                this.View.Model.SetValue("FPROORDERNO", datarow.DynamicObject["FSCOrderNo"].ToString());
+                                this.View.Model.SetValue("FQty", datarow.DynamicObject["FHOrderNeedQty"].ToString());
+                                this.View.Model.SetValue("FDayPlanFID", datarow.DynamicObject["FID"].ToString());
+                                this.View.Model.SetValue("FDayPlanFentryID", datarow.DynamicObject["t1_FENTRYID"].ToString());
+                                this.View.Model.SetValue("FSourceBillNo", datarow.DynamicObject["FBillNo"].ToString());
+                                this.View.Model.SetValue("FSourceBillType", datarow.DynamicObject["FBillTypeID"].ToString());
+                            }
+                        }
+                    });
+                }
+            }
+            catch (Exception ex)
+            {
+                this.View.ShowErrMessage(ex.Message.ToString());
+            }
+        }
+
+        public override void EntryBarItemClick(BarItemClickEventArgs e)
+        {
+            base.EntryBarItemClick(e);
+            if (e.BarItemKey.ToUpper() == "TBROWCLOSE")
+            {
+                int[] selectedIndexsR = this.View.GetControl<EntryGrid>("FEntity").GetSelectedRows();        //鍗曟嵁浣撴暟鎹� 聽聽
+                Array.Sort(selectedIndexsR);
+                DynamicObjectCollection selectedRowsDy = this.Model.DataObject["FEntity"] as DynamicObjectCollection;聽 聽聽 聽聽聽//閫変腑琛屾暟鎹� 聽
+              聽聽DynamicObject selectedRow;
+                StringBuilder result = new StringBuilder();
+                List<string> sqlList = new List<string>();
+                foreach (var item in selectedIndexsR)
+                {
+                    selectedRow = selectedRowsDy[item];
+                    string sql = string.Format(@"
+/*dialect*/
+select isnull(c.FRealQty,0)FRealQty from Sc_WorkBillSortBillSub a
+left join T_PRD_MORPTENTRY b on a.FEntryID = b.FDAYPLANFID
+left join T_PRD_INSTOCKENTRY c on b.FENTRYID = c.FSrcEntryId
+where a.FEntryID in ({0})", selectedRow["Id"]);
+                    decimal FRealQty = DBServiceHelper.ExecuteScalar<decimal>(Context, sql, 0);
+                    if (FRealQty == 0)
+                    {
+                        result.Append($"鍒嗗綍琛岋細{selectedRow["Seq"]}锛屾棩璁″垝鏄庣粏鏈笅鎺ㄧ敓鎴愮敓浜у叆搴撳崟\r\n");
+                        continue;
+                    }
+                    sql = string.Format(@"
+/*dialect*/
+select count(*)res from Sc_WorkBillSortBillSub a 
+left join Sc_DayPlanPPBomBillMain b on a.FEntryID = b.FDayPlanFID
+left join Sc_DayPlanPPBomBillSub c on b.FID = c.FID
+where a.FEntryID in ({0})
+and FISSUETYPE in (1, 2)
+and FDwyl * {1} < FPickedQty", selectedRow["Id"], FRealQty);
+                    decimal Count = DBServiceHelper.ExecuteScalar<decimal>(Context, sql, 0);
+                    if (Count > 0)
+                    {
+                        result.Append($"鍒嗗綍琛岋細{selectedRow["Seq"]}锛屼笅娓搁鏂欏崟鐨勫凡棰嗘枡鏁板皬浜庡叆搴撶殑鏍囧噯鐢ㄩ噺\r\n");
+                        continue;
+                    }
+                    sql = string.Format(@"
+/*dialect*/
+update Sc_WorkBillSortBillSub set 
+FInStockCount = {0},
+FNotInStockCount = FHQty - {0},
+FHEntryCloseDate = getdate(),
+FHCloseTypeSub = 1
+where FEntryID={1}", FRealQty, selectedRow["Id"]);
+                    sqlList.Add(sql);
+                }
+                DBServiceHelper.ExecuteBatch(Context, sqlList);
+                this.View.Refresh();
+                if (string.IsNullOrEmpty(result.ToString()))
+                    this.View.ShowMessage("鎿嶄綔鎴愬姛");
+                else
+                    this.View.ShowErrMessage(result.ToString());
+                
+            }
+            else if (e.BarItemKey.ToUpper() == "TBROWCANCELCLOSE")
+            {
+                int[] selectedIndexsR = this.View.GetControl<EntryGrid>("FEntity").GetSelectedRows();        //鍗曟嵁浣撴暟鎹� 聽聽
+                Array.Sort(selectedIndexsR);
+                DynamicObjectCollection selectedRowsDy = this.Model.DataObject["FEntity"] as DynamicObjectCollection;聽 聽聽 聽聽聽//閫変腑琛屾暟鎹� 聽
+              聽聽DynamicObject selectedRow;
+                List<string> sqlList = new List<string>();
+                foreach (var item in selectedIndexsR)
+                {
+                    selectedRow = selectedRowsDy[item];
+                    string sql = string.Format(@"
+/*dialect*/
+update Sc_WorkBillSortBillSub set 
+FInStockCount = 0,
+FNotInStockCount =0,
+FHEntryCloseDate = null,
+FHCloseTypeSub = 0
+where FEntryID={0}", selectedRow["Id"]);
+                    sqlList.Add(sql);
+                }
+                DBServiceHelper.ExecuteBatch(Context, sqlList);
+                this.View.Refresh();
+                this.View.ShowMessage("鎿嶄綔鎴愬姛");
+            }
+
+        }
+    }
+}
diff --git a/src/BLL/Demo.BillView/PRD/Pro_DayPlan.cs b/src/BLL/Demo.BillView/PRD/Pro_DayPlan.cs
index 585f532..fcde28b 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_DayPlan.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_DayPlan.cs
@@ -112,13 +112,15 @@
 where FEntryID={1}", FRealQty, selectedRow["Id"]);
                     sqlList.Add(sql);
                 }
+                var fid = this.View.Model.GetPKValue();
+                sqlList.Add($"update Sc_WorkBillSortBillMain set FCloseCount = (select sum(FNotInStockCount) from Sc_WorkBillSortBillSub where FID ={fid}) where FID ={fid}");
                 DBServiceHelper.ExecuteBatch(Context, sqlList);
                 this.View.Refresh();
                 if (string.IsNullOrEmpty(result.ToString()))
                     this.View.ShowMessage("鎿嶄綔鎴愬姛");
                 else
                     this.View.ShowErrMessage(result.ToString());
-                
+
             }
             else if (e.BarItemKey.ToUpper() == "TBROWCANCELCLOSE")
             {
@@ -140,6 +142,8 @@
 where FEntryID={0}", selectedRow["Id"]);
                     sqlList.Add(sql);
                 }
+                var fid = this.View.Model.GetPKValue();
+                sqlList.Add($"update Sc_WorkBillSortBillMain set FCloseCount = (select sum(FNotInStockCount) from Sc_WorkBillSortBillSub where FID ={fid}) where FID ={fid}");
                 DBServiceHelper.ExecuteBatch(Context, sqlList);
                 this.View.Refresh();
                 this.View.ShowMessage("鎿嶄綔鎴愬姛");
diff --git a/src/BLL/Demo.BillView/PRD/Pro_SCLLFSH.cs b/src/BLL/Demo.BillView/PRD/Pro_SCLLFSH.cs
index b20422c..386b031 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_SCLLFSH.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_SCLLFSH.cs
@@ -33,6 +33,7 @@
             e.FieldKeys.Add("FBaseJoinQty");
             e.FieldKeys.Add("FDayPlanBillNo");
             e.FieldKeys.Add("FDayPlanFentryId");
+            e.FieldKeys.Add("FisFX");
         }
         /// <summary>
         ///鍙嶅鏍� 鍙嶆洿鏂版棩璁″垝鐢ㄦ枡娓呭崟璋冩嫧鏁伴噺
@@ -52,12 +53,14 @@
                 foreach (var entryRow in entryRows)
                 {
                     //鐢熶骇鐢ㄦ枡娓呭崟涓虹┖鏃�
-                    if (Convert.ToString(entryRow["FDayPlanBillNo"]) == "")
+                    if (Convert.ToString(entryRow["FDayPlanBillNo"]) == "" || !Convert.ToBoolean(entryRow["FisFX"]))
                         continue;
                     string fentryId = entryRow["FDayPlanFentryId"].ToString();
                     decimal FBaseQty = Convert.ToDecimal(entryRow["BaseActualQty"]);
                     sql = string.Format($"/*dialect*/update Sc_DayPlanPPBomBillSub set  FPickedQty -= {FBaseQty} where FEntryID = { fentryId} ");
                     sqlList.Add(sql);
+                    sql = string.Format($"/*dialect*/update T_PRD_PICKMTRLDATA set  FisFX =  0 where FentryId = {entryRow["Id"]}");
+                    sqlList.Add(sql);
                 }
             }
             DBServiceHelper.ExecuteBatch(Context, sqlList);
diff --git a/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs b/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs
index d09064f..b71d228 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_SCLLSH.cs
@@ -37,7 +37,7 @@
             e.FieldKeys.Add("FBaseActualQty");
         }
         /// <summary>
-        ///鍙嶅鏍� 鍙嶆洿鏂版棩璁″垝鐢ㄦ枡娓呭崟棰嗘枡鏁伴噺
+        ///瀹℃牳鏇存柊鏃ヨ鍒掔敤鏂欐竻鍗曢鏂欐暟閲�
         /// </summary>
         /// <param name="e"></param>
         public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
@@ -59,6 +59,8 @@
                     sql = string.Format($"/*dialect*/update Sc_DayPlanPPBomBillSub set  FPickedQty = FPickedQty + {Convert.ToDecimal(entryRow["BaseActualQty"])} where FEntryID = {fentryId} ");
                     //LogHelper.Info("棰嗘枡鍗曠殑鏃ヨ鍒掔敤鏂欐竻鍗旾D:" + fentryId);
                     sqlList.Add(sql);
+                    sql = string.Format($"/*dialect*/update T_PRD_PICKMTRLDATA set  FisFX =  1 where FentryId = {entryRow["Id"]}");
+                    sqlList.Add(sql);
                 }
             }
             DBServiceHelper.ExecuteBatch(Context, sqlList);
diff --git a/src/BLL/Demo.BillView/PRD/Pro_ScDayImport.cs b/src/BLL/Demo.BillView/PRD/Pro_ScDayImport.cs
index 26c16cc..405850f 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_ScDayImport.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_ScDayImport.cs
@@ -144,10 +144,11 @@
                                 FBILLNO = _dt.Rows[0]["FBILLNO"].ToString();
                                 FMoFBillType = _dt.Rows[0]["FMoFBillType"].ToString();
                             }
-                            //鐗╂枡缂栫爜 + 鐢熶骇璁㈠崟鍙� + 鐢熶骇璧勬簮 + 鐢熶骇璁㈠崟琛屽彿 鍘诲垽鏂槸鍚﹀鍏ヨ繃 甯﹀嚭鏃ヨ鍒掑伐鍗旾D鍙婄紪鍙�
+                            //鐗╂枡缂栫爜 + 鐢熶骇璁㈠崟鍙� + 鐢熶骇璧勬簮 + 鐢熶骇璁㈠崟琛屽彿 鍘诲垽鏂槸鍚﹀鍏ヨ繃 甯﹀嚭鏃ヨ鍒掑伐鍗旾D鍙婄紪鍙� 鍜� 鍏抽棴鏁伴噺锛�6.18鏇达級
                             string fDayPlanID = "";
                             string fDayPlanBillNo = "";
-                            sql = string.Format(@"select a.FID,FBILLNO,FSCOrderNo,FHMaterID,FHSourceID from Sc_WorkBillSortBillMain a JOIN T_BD_MATERIAL b ON a.FHMaterID = b.FMATERIALID 
+                            string fCloseCount = "";
+                            sql = string.Format(@"select a.FID,FBILLNO,FSCOrderNo,FHMaterID,FHSourceID,a.FCloseCount from Sc_WorkBillSortBillMain a JOIN T_BD_MATERIAL b ON a.FHMaterID = b.FMATERIALID 
 left join T_ENG_WORKCENTER c on a.FHSourceID=c.fid 
  where FSCOrderNo ='{0}' and b.FNUMBER ='{1}' and a.FSRCBILLENTRYSEQ ='{3}' and (isnull(c.FNUMBER,'') ='{2}' or (select count(*) from T_ENG_WORKCENTER where isnull(c.FNUMBER,'') ='{2}')=0)", dt.Rows[i][1].ToString(), dt.Rows[i][5].ToString(), dt.Rows[i][4].ToString(), dt.Rows[i][2].ToString());
                             DataTable dayPlanDt = DBServiceHelper.ExecuteDataSet(Context, sql).Tables[0];
@@ -155,6 +156,7 @@
                             {
                                 fDayPlanID = dayPlanDt.Rows[0]["FID"].ToString();
                                 fDayPlanBillNo = dayPlanDt.Rows[0]["FBILLNO"].ToString();
+                                fCloseCount = dayPlanDt.Rows[0]["FCloseCount"].ToString();
                             }
                             //DynamicObject row = new DynamicObject(entity.DynamicObjectType);
                             this.Model.CreateNewEntryRow("FEntity");
@@ -176,6 +178,7 @@
                             this.Model.SetValue("FDayPlanID", fDayPlanID, i);//鏃ヨ鍒掑伐鍗旾D
                             this.Model.SetValue("FDayPlanBillNo", fDayPlanBillNo, i);//鏃ュ伐鍗曠紪鍙�
                             this.Model.SetValue("FSRCBILLENTRYSEQ", dt.Rows[i][2].ToString(), i);//鐢熶骇璁㈠崟鏄庣粏琛屽彿
+                            this.Model.SetValue("FCloseCount", fCloseCount, i);//鍏抽棴鏁伴噺
                             for (int j = 0; j <= 60; j++)
                             {
                                 this.Model.SetValue("FT" + "" + j + "", dt.Rows[i][15 + j].ToString(), i);
@@ -296,8 +299,9 @@
                 }
                 foreach (DynamicObject current in entityDataObjoct)
                 {
-                    if (Convert.ToInt32(current["FNoScheduled"]) < 0)
-                        _result += "搴忓彿锛�" + Convert.ToString(current["SEQ"]) + ",鏃ヨ鍒掓�绘暟閲忚秴鍑虹敓浜ц鍗曟暟閲�";
+                    //鏈帓鏁伴噺= 鎬绘暟 - 鏃ヨ鍒�    瓒呭嚭鏃ヨ鍒掍负璐� + 鍏抽棴鏁伴噺 < 0 琛ㄧず瓒呭嚭浜嗘�昏鍒掓暟閲�
+                    if (Convert.ToInt32(current["FNoScheduled"]) + Convert.ToInt32(current["FCloseCount"]) < 0)
+                        _result += "搴忓彿锛�" + Convert.ToString(current["SEQ"]) + ",鏃ヨ鍒掓�绘暟閲忚秴鍑虹敓浜ц鍗曟暟閲�+鍏抽棴鏁伴噺";
                 }
                 if (_result != "")
                 {
diff --git a/src/BLL/Demo.BillView/PRD/Pro_TlPush.cs b/src/BLL/Demo.BillView/PRD/Pro_TlPush.cs
index 7ff670a..6d72db2 100644
--- a/src/BLL/Demo.BillView/PRD/Pro_TlPush.cs
+++ b/src/BLL/Demo.BillView/PRD/Pro_TlPush.cs
@@ -138,7 +138,7 @@
                             ["IsDeleteEntry"] = "false",
                             ["SubSystemId"] = "",
                             ["IsVerifyBaseDataField"] = "false",
-                            // ["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳�
+                            ["IsAutoSubmitAndAudit"] = true,//鑷姩璋冪敤鎻愪氦鍜屽鏍稿姛鑳�
                             ["Model"] = model
                         };
 

--
Gitblit v1.9.1