From 3d148ef36144e4cd1a4a4e6f7e95533995594c9f Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期一, 16 十二月 2024 09:48:51 +0800
Subject: [PATCH] 添康组装排产;森楷扫码写入日志

---
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormImportController.cs |   65 +++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 15 deletions(-)

diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
index b607cfa..8df30d4 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormImportController.cs"
@@ -20,6 +20,8 @@
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         public static string BillType = "4610";
         Sc_WorkBillSortBillMain omdelMian = new Sc_WorkBillSortBillMain();
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+
 
         #region 鐢熶骇鏃ヨ鍒� 鏂囦欢涓婁紶
         [Route("JIT_DayPlanPlatFormImport/JIT_DayPlanPlatFormImport_DR")]
@@ -61,17 +63,45 @@
                 tb2.Columns.Add("ICMOBillHInterID", typeof(Int32));//鐢熶骇璁㈠崟涓籭d
                 tb2.Columns.Add("ICMOBillHEntryID", typeof(Int32));//鐢熶骇璁㈠崟瀛恑d
                 tb2.Columns.Add("HProdORGID", typeof(Int32));//缁勭粐id
-                tb2.Columns.Add("HSeOrderBillNo", typeof(string));//閿�鍞鍗曞彿
+                tb2.Columns.Add("HSeOrderBillNo", typeof(string));//閿�鍞鍗曞彿                
 
+                //鑾峰彇绯荤粺鍙傛暟
+                string Ret = "";
+                oSystemParameter.ShowBill(ref Ret);
+
+                LogService.Write("excel鍊硷細" + ExcelDs.Tables[0].Rows[1][15].ToString());//2024-11-26
                 //娣诲姞鏁版嵁
                 for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
-                {
+                {                  
                     DataRow row = tb2.NewRow();
                     for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
                     {
                         row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
                     }
-                    tb2.Rows.Add(row);
+                    //濡傛灉琛ㄦ牸绗琲琛岀殑绗竴鍒椾负绌猴紝鍒欏垽鏂负杩欎竴琛岀殑鏁版嵁涓虹┖锛岃烦鍑哄惊鐜苟涓斾笉鎶婃暟鎹啓鍏� tb2
+                    if (ExcelDs.Tables[0].Rows[i][0].ToString() == "" && ExcelDs.Tables[0].Rows[i][1].ToString() == "")
+                    {
+                        continue;
+                    }                    
+                    else if (oSystemParameter.omodel.JIT_DayPlan_TimeFrame != "0" && oSystemParameter.omodel.JIT_DayPlan_TimeFrame != "")
+                    {
+                        Int32 HDays = Convert.ToInt32(oSystemParameter.omodel.JIT_DayPlan_TimeFrame) * 7;
+
+
+
+
+                        for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
+                        {
+                            if (Convert.ToInt32(ExcelDs.Tables[0].Rows[i][j].ToString()) > 0 )
+                            {
+                                continue;
+                            }                          
+                        }                       
+                    }
+                    else
+                    {
+                        tb2.Rows.Add(row);
+                    }
                 }
 
                 var error = "";
@@ -295,10 +325,11 @@
                 }
 
               
-                int TrueCount = 0, SumCount = 0;
+                
 
                 for (int i = 0; i < list.Count; i++)
                 {
+                    int TrueCount = 0, SumCount = 0;
                     long HInterID = 0;
                     var HBillNo = "";
                     if (list[i]["鍗曟嵁鍙�"].ToString() == "" && list[i]["hmainid"].ToString() == "")
@@ -326,8 +357,10 @@
                         var HMainSourceEntryID = list[i]["ICMOBillHEntryID"].ToString();
                         var HSeOrderBillNo = list[i]["HSeOrderBillNo"].ToString();
 
-                        ds = oCN.RunProcReturn($"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
-                          $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}", "Sc_WorkBillSortBillMain");
+                        string sql = $"select * from  Sc_WorkBillSortBillMain where HMainSourceInterID={HMainSourceInterID}" +
+                          $" and HMainSourceEntryID={HMainSourceEntryID} and HICMOBillNo='{HICMOBillNo}' and HICMOEntrySEQ={HICMOEntrySEQ} and HSourceID={HSourceID}";
+                        LogService.Write("sql:" + sql);
+                        ds = oCN.RunProcReturn(sql, "Sc_WorkBillSortBillMain");
                         if (ds.Tables[0].Rows.Count > 0)
                         {
                             objJsonResult.code = "0";
@@ -358,6 +391,8 @@
 
                     for (int j = 0; j < SumDay; j++)
                     {
+                        LogService.Write("1:" + list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString());
+                        LogService.Write("2:" + DateTime.Now.AddDays(j).ToString("yyyy-MM-dd"));
                         //涓昏〃瀛愯〃閮芥湁鏁版嵁
                         if (list[i][DateTime.Now.AddDays(j).ToString("yyyy-MM-dd")].ToString() != "")
                         {
@@ -379,16 +414,17 @@
                             objJsonResult = AddBillSub(HInterID.ToString(), HBillNo, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd").ToString()), 0);
                         }
                     }
+                    if (TrueCount != SumCount)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = objJsonResult.Message;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
 
-                if (TrueCount != SumCount)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = objJsonResult.Message;
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+               
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
@@ -410,7 +446,6 @@
         {
             //鑾峰彇琛ㄦ牸鏁版嵁
             ds = oCN.RunProcReturn($"select * from  h_v_JIT_Sc_WorkBillSortBillList where 鍗曟嵁鍙�='{HBillNo}'", "h_v_JIT_Sc_WorkBillSortBillList");
-
             int count = 0;
             if (ds.Tables[0].Rows.Count > 0)
             {

--
Gitblit v1.9.1