From 2fd0e1116c1a99af7555d91728d1adc36f753464 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 18 七月 2023 17:26:29 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/项目管理/项目阶段/Gy_ProjectStageController.cs |  137 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 111 insertions(+), 26 deletions(-)

diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs"
index 992eec1..cf3e5c9 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\351\241\271\347\233\256\351\230\266\346\256\265/Gy_ProjectStageController.cs"
@@ -1321,7 +1321,10 @@
             public int HInterID;
             public string HBillNo;
             public string HDate;
+            public int HProID;
             public string HProNumber;
+            public string HMainSourceBillNo;
+            public string HMainSourceBillType;
             public int HProjectStageID;
             public string HProjectStageName;
             public string HStageNote;
@@ -1434,6 +1437,9 @@
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
+                }else if (OperationType == 4)
+                {
+
                 }
 
                 msg2 = "[" + msg2.ToString() + "]";
@@ -1448,7 +1454,10 @@
                 int HInterID = mainList[0].HInterID;
                 string HBillNo = mainList[0].HBillNo;
                 string HDate = mainList[0].HDate;
+                int HProID = mainList[0].HProID;
                 string HProNumber = mainList[0].HProNumber;
+                string HMainSourceBillNo = mainList[0].HMainSourceBillNo;
+                string HMainSourceBillType = mainList[0].HMainSourceBillType;
                 int HProjectStageID = mainList[0].HProjectStageID;
                 string HStageNote = mainList[0].HStageNote;
                 string HRelationGoods = mainList[0].HRelationGoods;
@@ -1465,7 +1474,7 @@
                 string HMakerDate = mainList[0].HMakerDate;
                 string HUpdater = mainList[0].HUpdater;
                 string HUpdaterDate = mainList[0].HUpdaterDate;
-
+                
 
                 if (OperationType == 2)
                 {
@@ -1552,9 +1561,48 @@
                     //璁板綍鏃ュ織
                     LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼椤圭洰闃舵姹囨姤:" + HBillNo);
                     oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼椤圭洰闃舵姹囨姤锛�" + HBillNo + "','LMES-椤圭洰闃舵姹囨姤妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+                }else if(OperationType == 4 && ds.Tables[0].Rows.Count == 0 )           //涓嬫帹-鏂板
+                {
+                    string sql = "insert into PM_ProjectReportBillMain" +
+                        "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HRemark,HMaker,HMakeDate" +
+                        ",HProNumber,HProjectStageID,HStageNote,HRelationGoods,HIsKey,HReportEmpID,HReportNote,HReportGoods,HReceiveEmp,HCopyEmp,HRate,HOrgID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType,HMainSourceBillNo) " +
+                        "values(" +
+                        "" + HYear +
+                        "," + HPeriod +
+                        ",'" + HBillType +
+                        "','" + HBillSubType +
+                        "'," + HInterID +
+                        ",'" + HDate +
+                        "','" + HBillNo +
+                        "'," + HBillStatus +
+                        ",'" + HRemark +
+                        "','" + HMaker +
+                        "','" + HMakerDate +
+                        "','" + HProNumber +
+                        "'," + HProjectStageID +
+                        ",'" + HStageNote +
+                        "','" + HRelationGoods +
+                        "'," + HIsKey +
+                        "," + HReportEmpID +
+                        ",'" + HReportNote +
+                        "','" + HReportGoods +
+                        "','" + HReceiveEmp +
+                        "','" + HCopyEmp +
+                        "'," + HRate +
+                        "," + HOrgID +
+                        "," + HProID +
+                        "," + HProjectStageID +
+                        ",'" + HMainSourceBillType +
+                        "','" + HMainSourceBillNo +
+                        "')";
+
+                    //涓昏〃
+                    oCN.RunProc(sql);
+                    LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板椤圭洰闃舵姹囨姤:" + HBillNo);
+                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板椤圭洰闃舵姹囨姤锛�" + HBillNo + "','LMES-椤圭洰闃舵姹囨姤妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub_ProjectReportBill(msg3, HInterID, HBillNo, OperationType);
+                objJsonResult = AddBillSub_ProjectReportBill(msg3, HInterID, HBillNo, OperationType,HProID, HProjectStageID, HMainSourceBillType, HMainSourceBillNo);
 
                 if (objJsonResult.code == "0")
                 {
@@ -1582,36 +1630,73 @@
         }
         #endregion
         #region 娣诲姞椤圭洰闃舵娓呭崟 瀛愯〃
-        public json AddBillSub_ProjectReportBill(string msg3, long HInterID, string HBillNo, int OperationType)
+        public json AddBillSub_ProjectReportBill(string msg3, long HInterID, string HBillNo, int OperationType, int HSourceInterID, int HSourceEntryID, string HSourceBillType, string HSourceBillNo)
         {
             List<PM_ProjectReportBill_Sub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM_ProjectReportBill_Sub>>(msg3);
             int i = 0;                                          //浣滀负瀛愯〃鍐呯爜
-            foreach (PM_ProjectReportBill_Sub oSub in DetailColl)
+            if(OperationType == 4)
             {
-                i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+                foreach (PM_ProjectReportBill_Sub oSub in DetailColl)
+                {
+                    i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
 
-                int HEntryID = i;
-                int HEmpID = oSub.HEmpID;
-                int HIsPM = oSub.HIsPM?1:0;
-                double HRate = oSub.HRate;
-                double HAvgMoney = oSub.HAvgMoney;
-                double HCountMoney = oSub.HCountMoney;
-                string HRemarkSub = oSub.HRemarkSub;
-                string sql = "insert into PM_ProjectReportBillSub" +
-                    "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney) " +
-                    "values(" +
-                    "" + HInterID +
-                    ",'" + HBillNo +
-                    "'," + HEntryID +
-                    ",'" + HRemarkSub +
-                    "'," + HEmpID +
-                    "," + HIsPM +
-                    "," + HRate +
-                    "," + HAvgMoney +
-                    "," + HCountMoney +
-                    ")";
-                oCN.RunProc(sql);
+                    int HEntryID = i;
+                    int HEmpID = oSub.HEmpID;
+                    int HIsPM = oSub.HIsPM ? 1 : 0;
+                    double HRate = oSub.HRate;
+                    double HAvgMoney = oSub.HAvgMoney;
+                    double HCountMoney = oSub.HCountMoney;
+                    string HRemarkSub = oSub.HRemarkSub;
+                    string sql = "insert into PM_ProjectReportBillSub" +
+                        "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo) " +
+                        "values(" +
+                        "" + HInterID +
+                        ",'" + HBillNo +
+                        "'," + HEntryID +
+                        ",'" + HRemarkSub +
+                        "'," + HEmpID +
+                        "," + HIsPM +
+                        "," + HRate +
+                        "," + HAvgMoney +
+                        "," + HCountMoney +
+                        "," + HSourceInterID + 
+                        "," + HSourceEntryID +
+                        ",'" + HSourceBillType + 
+                        "','" + HSourceBillNo +
+                        "')";
+                    oCN.RunProc(sql);
+                }
             }
+            else
+            {
+                foreach (PM_ProjectReportBill_Sub oSub in DetailColl)
+                {
+                    i++;                                            //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+                    int HEntryID = i;
+                    int HEmpID = oSub.HEmpID;
+                    int HIsPM = oSub.HIsPM ? 1 : 0;
+                    double HRate = oSub.HRate;
+                    double HAvgMoney = oSub.HAvgMoney;
+                    double HCountMoney = oSub.HCountMoney;
+                    string HRemarkSub = oSub.HRemarkSub;
+                    string sql = "insert into PM_ProjectReportBillSub" +
+                        "(HInterID,HBillNo_bak,HEntryID,HRemark,HEmpID,HIsPM,HRate,HAvgMoney,HCountMoney) " +
+                        "values(" +
+                        "" + HInterID +
+                        ",'" + HBillNo +
+                        "'," + HEntryID +
+                        ",'" + HRemarkSub +
+                        "'," + HEmpID +
+                        "," + HIsPM +
+                        "," + HRate +
+                        "," + HAvgMoney +
+                        "," + HCountMoney +
+                        ")";
+                    oCN.RunProc(sql);
+                }
+            }
+            
 
             objJsonResult.code = "1";
             objJsonResult.count = 1;

--
Gitblit v1.9.1