From 63de78593dde730afa310a401b757f6d89e79f0b Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期五, 18 十一月 2022 17:32:43 +0800
Subject: [PATCH] 作业指导书

---
 WebAPI/Models/SOPBillSub.cs                              |   16 ++++++++
 WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillEditController.cs |   71 +++++++++++++++++++++++++++++++----
 WebAPI/WebAPI.csproj                                     |    1 
 3 files changed, 79 insertions(+), 9 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..eb1dc4a 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() + "]";
@@ -159,6 +159,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 +181,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 +200,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 + "'," + lID + ",'" + 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("
+                + lID + "," + 1 + "," + HProcID + "," + HProcNo +
+                "," + HWorkStationID + "," + HCenterID + ",'" + HRemark2 + "'" +
+                ") ");
+              
 
                 oCN.Commit();
                 objJsonResult.code = "1";
@@ -291,6 +325,25 @@
             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
             {
                 if (files == null || files.ContentLength <= 0)
@@ -322,11 +375,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()"  + ",'" + Sno + "','" + 0 + "','" + Sno + "','" + lID + "','" + 0 +
+                        "') ");
                     }
                     else
                     {
diff --git a/WebAPI/Models/SOPBillSub.cs b/WebAPI/Models/SOPBillSub.cs
new file mode 100644
index 0000000..b542486
--- /dev/null
+++ b/WebAPI/Models/SOPBillSub.cs
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class SOPBillSub
+    {
+        public int HProcNo { get; set; }  //----宸ュ簭鍙�(宸ュ簭娴佹搴忓彿)
+        public Int64 HProcID { get; set; }   //----宸ュ簭ID(Gy_Process)
+        public Int64 HWorkStationID { get; set; }  //----宸ヤ綅ID(Gy_WorkStation)
+        public Int64 HCenterID { get; set; }  //----宸ヤ綔涓績ID (Gy_WorkCenter)
+        public string HRemark { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 2d2d391..9e9eac2 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -604,6 +604,7 @@
     <Compile Include="Models\Sc_WorkDemandPlanBillMain.cs" />
     <Compile Include="Models\Sc_WorkDemandPlanBillSub.cs" />
     <Compile Include="Models\SOPBill.cs" />
+    <Compile Include="Models\SOPBillSub.cs" />
     <Compile Include="Models\TechnologyParameter.cs" />
     <Compile Include="Models\TechnologyParameterUnit.cs" />
     <Compile Include="Models\TechParamByProc.cs" />

--
Gitblit v1.9.1