From ed36ed67fd9ff47fd762192c3fc8cf4d99a76294 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 13 十月 2023 11:12:25 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillEditController.cs |   83 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 69 insertions(+), 14 deletions(-)

diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs"
index d09ad7d..b022291 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs"
@@ -27,7 +27,7 @@
         public DAL.ClsGy_SOPBill BillOld = new DAL.ClsGy_SOPBill();
         public bool BillChange;   //
         public DataGridView grdMain = new System.Windows.Forms.DataGridView();
-        ClsGridViewSum oSumGrid = new ClsGridViewSum();
+        ClsGridViewSum oSumGrid = new ClsGridViewSum();        
 
         //瀹氫箟
         public const Int16 HTagCol = 0;
@@ -139,7 +139,7 @@
                 string msg1 = _value.ToString();
                 string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                 string msg2 = sArray[0].ToString();
-                string msg3 = sArray[1].ToString();//褰撳墠浜�
+                string msg3 = sArray[2].ToString();//褰撳墠浜�
 
                 //鍙嶅簭鍒楀寲
                 msg2 = "[" + msg2.ToString() + "]";
@@ -147,6 +147,7 @@
                 List<SOPBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SOPBill>>(msg2);
 
                 string HBillNo = list[0].HBillNo;
+                int HInterID = list[0].HInterID;
                 DateTime HDate = list[0].HDate;
                 string HName = list[0].HName;
                 int HMaterID = list[0].HMaterID;
@@ -159,6 +160,17 @@
                 string HRemark = list[0].HRemark;
                 bool HStandard = list[0].HStandard;
                 bool HUse = list[0].HUse;
+                string HMaker = msg3;
+                int HMaterTypeID = list[0].HMaterTypeID;
+
+                //瀛愯〃
+                List<SOPBillSub> list2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SOPBillSub>>(msg2);
+
+                int HProcNo = list2[0].HProcNo;
+                long HProcID = list2[0].HProcID;
+                long HWorkStationID = list2[0].HWorkStationID;
+                long HCenterID = list2[0].HCenterID;
+                string HRemark2 = list2[0].HRemark;
 
                 //鍒ゆ柇鏉冮檺
                 //if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg3))
@@ -170,6 +182,17 @@
                 //    return objJsonResult;
                 //}
 
+                DataSet CS;
+                Int64 lID = 0;
+                string BillType = "";
+                CS = oCN.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + 3305 + "'", "Gy_BillNumber");
+
+                if (CS.Tables[0].Rows.Count != 0)
+                {
+                    lID = ClsPub.isLong(CS.Tables[0].Rows[0]["IDNow"].ToString());
+                    BillType = CS.Tables[0].Rows[0]["BillType"].ToString().Trim();
+                }
+               
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
                 oCN.BeginTran();
                 //涓昏〃
@@ -178,16 +201,28 @@
                  ",HYear,HPeriod,HRemark,HMaker,Hmakedate,HMaterID,HName,HMaterTypeID" +
                  ",HUnitID,HMaterNumber,HUnitNumber,HStandard" +
                  ") " +
-                  " values('" + 3305 + "'," + HMaterID + ",'" + HMaterID + "','" + "2022-11-04" + "'" +
-                "," + 2022 + "," + 11 + ",'" + HRemark + "','" + "Test" + "'," + "2022-11-04" + "," + HMaterID.ToString() + ",'" + HName + "'," + 656 +
+                  " values('" + 3305 + "'," + HInterID + ",'" + HBillNo + "'," + "getdate()" +
+                "," + "datepart(yyyy,GETDATE())" + "," + "datepart(mm,getdate())" + ",'" + HRemark + "','" + HMaker + "'," + "getdate()" + "," + HMaterID.ToString() + ",'" + HName + "'," + HMaterTypeID +
                 "," + HUnitID.ToString() + ",'" + HMaterNumber + "','" + HUnitNumber + "','" + HStandard.ToString() +
                 "') ");
+            
+                //oCN.RunProc("update Gy_BillNumber set IDNow=IDNow+1 where BillType='" + BillType.Trim() + "'");
                 //" values(" + 3305 + "','" + 12333 + "','" + "test" + "','" + HDate + "','" +
                 //2022 + "','" + 11 + "','" + HRemark + "','" + "Test" + "','" + "2022-11-04" + "','" + HMaterID.ToString() + "','" + HName + "','" + "656" +
                 //"','" + HUnitID.ToString() + "','" + HMaterNumber + "','" + HUnitNumber + "','" + HStandard.ToString() +
                 //") ");
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 //oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                //鎻掑叆瀛愯〃
+              oCN.RunProc("Insert into Gy_SOPBillSub " +
+                "(HInterID,HEntryID,HProcID,HProcNO" +
+                ",HWorkStationID,HCenterID,HRemark" +
+                ") values("
+                + HInterID + "," + 1 + "," + HProcID + "," + HProcNo +
+                "," + HWorkStationID + "," + HCenterID + ",'" + HRemark2 + "'" +
+                ") ");
+              
 
                 oCN.Commit();
                 objJsonResult.code = "1";
@@ -256,12 +291,13 @@
         {
 
             string HBillNo = HttpContext.Current.Request.Params["HBillNo"];  //鍗曟嵁鍙�
-            string HRemark = HttpContext.Current.Request.Params["HRemark"];  //澶囨敞
             string HUserName = HttpContext.Current.Request.Params["HUserName"];  //鍒涘缓浜�
-            HttpPostedFile files = HttpContext.Current.Request.Files["file"];
+            string HInterID = HttpContext.Current.Request.Params["HInterID"];  //鍒涘缓浜�
+            HttpPostedFile files = HttpContext.Current.Request.Files["file"]; //鍗曟嵁涓诲唴鐮�
             string path = HttpContext.Current.Server.MapPath("~/../Files/" + HBillNo);
             //string path = @"D:\\Files\\"+ HBillNo;
-            dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName);
+            Int64 HEntryID = Convert.ToInt64(HttpContext.Current.Request.Params["HEntryID"]);  //瀛愬唴鐮�
+            dynamic dyResult = UpLoadFile(files, path, HBillNo, HInterID, HUserName, HEntryID);
             if (dyResult != null && dyResult.result == 1)
             {
                 objJsonResult.code = "1";
@@ -281,7 +317,7 @@
 
         }
 
-        public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName)
+        public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HInterID, string HUserName,Int64 HEntryID)
         {
             dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" };
             string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞
@@ -290,6 +326,25 @@
             string fileSavePath = path;// 涓婁紶淇濆瓨璺緞
             int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte
             int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M
+
+            DataSet CS;
+            Int64 lID = 0;
+            string BillType = "";
+            CS = oCN.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + 3305 + "'", "Gy_BillNumber");
+            if (CS.Tables[0].Rows.Count != 0)
+            {
+                lID = ClsPub.isLong(CS.Tables[0].Rows[0]["IDNow"].ToString())-1;
+                BillType = CS.Tables[0].Rows[0]["BillType"].ToString().Trim();
+            }
+
+            DataSet Ds;
+            Int64 Sno = 1;
+            Ds = oCN.RunProcReturn("select MAX(HSno) HSno from Gy_SOPBillSub2" , "Gy_SOPBillSub2");
+            if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HSno"].ToString())!= 0)
+            {
+                Sno = ClsPub.isLong(Ds.Tables[0].Rows[0]["HSno"].ToString());
+                Sno += 1;
+            }
 
             try
             {
@@ -322,11 +377,11 @@
                         //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
                         //鍐欏叆鏁版嵁琛�
                         oCN.RunProc("Insert into Gy_SOPBillSub2 (HFileName,HPath,HFileType" +
-                                    ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" +
-                                   ") values('"
-                                    + filename.ToString() + "','" + filePath.ToString() + "','" +  fileExtension.ToString() + "'" +
-                                    ",'" + HUserName + "',getdate()"  + ",'" + 0 + "','" + 0 + "','" + 0 + "','" + 0 + "','" + 0 +
-                                   "') ");
+                               ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" +
+                              ") values('"
+                               + filename.ToString() + "','" + filePath.ToString() + "','" +  fileExtension.ToString() + "'" +
+                               ",'" + HUserName + "',getdate()"  + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize +
+                        "') ");
                     }
                     else
                     {
@@ -346,7 +401,7 @@
                                      ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" +
                                     ") values('"
                                      + filename.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" +
-                                     ",'" + HUserName + "',getdate()" + ",'" + 111 + "','" + 222 + "','" + 333 + "','" + 444 + "','" + 555 +
+                                     ",'" + HUserName + "',getdate()" + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize +
                                     "') ");
                     }
                     else

--
Gitblit v1.9.1