From b129762a4bb5ec2cde5edf16bc9cbda57c73587d Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 24 五月 2023 09:33:10 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs |  138 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 138 insertions(+), 0 deletions(-)

diff --git a/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs b/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs
index 9a2ee03..8bc97a1 100644
--- a/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs
+++ b/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs
@@ -33,5 +33,143 @@
         }
 
         #endregion   鑷畾涔夋柟娉�
+
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate Sb_EquipMaintainRuleBillMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                ",HDate='" + omodel.HDate + "'" +
+                ",HYear='" + omodel.HYear.ToString() + "'" +
+                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpDater='" + omodel.HMaker + "'" +
+                ",HUpDateDate=getdate()" +
+                //========================================
+                ",HCycleUnit='" + omodel.HCycleUnit + "'" +
+                ",HCheckCycle=" + omodel.HCheckCycle.ToString() +
+                ",HExplanation='" + omodel.HExplanation + "'" +
+                ",HInnerBillNo='" + omodel.HInnerBillNo + "'" +
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+                DeleteBillSub2(lngBillKey);
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                //鎻掑叆淇濆吇椤瑰瓙琛�
+                foreach (Models.ClsSb_EquipMaintainRuleBillSub_Item Item in DetailColl_Pay)
+                {
+                    oCn.RunProc("Insert into Sb_EquipMaintainRuleBillSub_Item" +
+                          " (HInterID,HEntryID,HMaintainItemID,HMaintainItem" +
+                          ",HMaintainPart,HClaim" +
+                          ",HManagerID" +
+                          ",HCloseMan,HCloseType,HRemark" +
+                          ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                          ") values("
+                          + omodel.HInterID.ToString() + "," + Item.HEntryID.ToString() + "," + Item.HMaintainItemID.ToString() + ",'" + Item.HMaintainItem.ToString() + "'" +
+                          ",'" + Item.HMaintainPart.ToString() + "','" + Item.HClaim.ToString() + "'" +
+                          "," + Item.HManagerID.ToString() +
+                          ",'" + Item.HCloseMan + "'," + Convert.ToString(Item.HCloseType ? 1 : 0) + ",'" + Item.HRemark + "'" +
+                          "," + Item.HSourceInterID.ToString() + "," + Item.HSourceEntryID.ToString() + ",'" + Item.HSourceBillNo + "','" + Item.HSourceBillType + "'," + Item.HRelationQty.ToString() + "," + Item.HRelationMoney.ToString() +
+                          ") ");
+                }
+                //鎻掑叆閰嶄欢瀛愯〃
+                foreach (Models.ClsSb_EquipMaintainRuleBillSub oSub in DetailColl_Mater)
+                {
+                    string sql = "Insert into Sb_EquipMaintainRuleBillSub " +
+                      " (HInterID,HEntryID," +
+                      "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
+                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
+                      "HQty,HMaterID,HUnitID,HQtyMust" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() +
+                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + ",0" +
+                      ") ";
+                    oCn.RunProc(sql);
+                }
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                //寰楀埌mainid
+                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                oCn.BeginTran();
+                //涓昏〃
+                oCn.RunProc("Insert Into Sb_EquipMaintainRuleBillMain   " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" +
+                ",HYear,HPeriod,HRemark" +
+                ",HCheckCycle,HCycleUnit,HExplanation,HInnerBillNo" +
+                ") " +
+                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" +
+                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + 
+                "',"+ omodel.HCheckCycle.ToString() + ",'" + omodel.HCycleUnit + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo +
+                "') ");
+
+                //鎻掑叆淇濆吇椤瑰瓙琛�
+                foreach (Models.ClsSb_EquipMaintainRuleBillSub_Item Item in DetailColl_Pay)
+                {
+                    oCn.RunProc("Insert into Sb_EquipMaintainRuleBillSub_Item" +
+                          " (HInterID,HEntryID,HMaintainItemID,HMaintainItem" +
+                          ",HMaintainPart,HClaim" +
+                          ",HManagerID" +
+                          ",HCloseMan,HCloseType,HRemark" +
+                          ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+                          ") values("
+                          + omodel.HInterID.ToString() + "," + Item.HEntryID.ToString() + "," + Item.HMaintainItemID.ToString() + ",'" + Item.HMaintainItem.ToString() + "'" +
+                          ",'" + Item.HMaintainPart.ToString() + "','" + Item.HClaim.ToString() + "'" +
+                          "," + Item.HManagerID.ToString() +
+                          ",'" + Item.HCloseMan + "'," + Convert.ToString(Item.HCloseType ? 1 : 0) + ",'" + Item.HRemark + "'" +
+                          "," + Item.HSourceInterID.ToString() + "," + Item.HSourceEntryID.ToString() + ",'" + Item.HSourceBillNo + "','" + Item.HSourceBillType + "'," + Item.HRelationQty.ToString() + "," + Item.HRelationMoney.ToString() +
+                          ") ");
+                }
+                //鎻掑叆閰嶄欢瀛愯〃
+                foreach (Models.ClsSb_EquipMaintainRuleBillSub oSub in DetailColl_Mater)
+                {
+                    string sql = "Insert into Sb_EquipMaintainRuleBillSub " +
+                      " (HInterID,HEntryID," +
+                      "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
+                      "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
+                      "HQty,HMaterID,HUnitID,HQtyMust" +
+                      ") values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() +
+                      ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + ",0" +
+                      ") ";
+                    oCn.RunProc(sql);
+                }
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1