From 8aa5b5b90724ef9665c03fcc72a503319d354fdb Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期三, 22 五月 2024 14:46:00 +0800
Subject: [PATCH] 网页版: 增加 设备启动点检清单 单据编辑模块 ,以及 单据列表

---
 WebAPI/ListModels.cs                                          |   25 +
 WebAPI/Models/ClsGy_EquipFileMain.cs                          |    1 
 DAL/DAL.csproj                                                |    1 
 DAL/车间管理/ClsGy_WorkBeginDotCheckListBillMain.cs               |  250 +++++++++++++
 Model/Model.csproj                                            |    2 
 Model/车间管理/ClsGy_WorkBeginDotCheckListBillSub.cs              |   13 
 WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs |  742 +++++++++++++++++++++++++++++++++++++++++
 Model/车间管理/ClsGy_WorkBeginDotCheckListBillMain.cs             |   15 
 WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs         |    9 
 9 files changed, 1,053 insertions(+), 5 deletions(-)

diff --git a/DAL/DAL.csproj b/DAL/DAL.csproj
index 7cbdda3..a5688aa 100644
--- a/DAL/DAL.csproj
+++ b/DAL/DAL.csproj
@@ -668,6 +668,7 @@
     <Compile Include="璐ㄦ绠$悊\ClsCrm_CustomerAppealBill.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsGy_MaterPreventErrMouldBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsQc_PreventErrMouldCheckBillMain.cs" />
+    <Compile Include="杞﹂棿绠$悊\ClsGy_WorkBeginDotCheckListBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_WorkBeginDotCheckBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_ProcExchRecordBackBill.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_ProcExchSendWorkBill.cs" />
diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillMain.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillMain.cs"
new file mode 100644
index 0000000..7150798
--- /dev/null
+++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillMain.cs"
@@ -0,0 +1,250 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace DAL
+{
+    public  class ClsGy_WorkBeginDotCheckListBillMain : DBUtility.ClsXt_BaseBill
+    {
+        public Model.ClsGy_WorkBeginDotCheckListBillMain omodel = new Model.ClsGy_WorkBeginDotCheckListBillMain();
+        public List<Model.ClsGy_WorkBeginDotCheckListBillSub> DetailColl = new List<Model.ClsGy_WorkBeginDotCheckListBillSub>();
+
+        public ClsGy_WorkBeginDotCheckListBillMain()
+        {
+            base.MvarItemKeySub = "Gy_WorkBeginDotCheckListBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey= "Gy_WorkBeginDotCheckListBillMain";
+            base.MvarReportTitle="璁惧鍚姩鐐规娓呭崟";
+            base.BillType = "3744";
+            base.HBillSubType = "3744";
+
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsGy_WorkBeginDotCheckListBillMain()
+        {
+            DetailColl = null;
+        }
+       
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate Gy_WorkBeginDotCheckListBillMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +  
+                ",HYear='" + omodel.HYear.ToString() + "'" +
+                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpDater='" + omodel.HMaker + "'" +
+                ",HUpDateDate=getdate()" +
+                //========================================              
+                ",HMaterID =" + omodel.HMaterID.ToString() +
+                ",HSourceID ='" + omodel.HSourceID.ToString() + "'" +
+                ",HProcID ='" + omodel.HProcID.ToString() + "'" +
+                ",HNote ='" + omodel.HNote + "'" +
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                foreach (Model.ClsGy_WorkBeginDotCheckListBillSub oSub in DetailColl)
+                {
+                    string subSql = "insert into Gy_WorkBeginDotCheckListBillSub " +
+                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
+                        ",HCheckNoteItemID,HCheckPostID) " +
+                        " values(" +
+                        "" + omodel.HInterID.ToString() +
+                        "," + oSub.HEntryID.ToString() +
+                        "," + oSub.HSourceInterID +
+                        "," + oSub.HSourceEntryID +
+                        ",'" + oSub.HSourceBillNo +
+                        "','" + oSub.HSourceBillType +
+                        "','" + oSub.HRemark +
+                        "','" + oSub.HCheckNoteItemID +
+                        "','" + oSub.HCheckPostID +
+                        "')";
+                    oCn.RunProc(subSql);
+                }
+
+
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+
+                DataSet ds;
+
+                oCn.BeginTran();
+
+                //妫�鏌ヤ富琛ㄥ唴鐮佹槸鍚﹂噸澶嶏紝鑻ラ噸澶嶅垯閲嶆柊鐢熸垚骞剁户缁鏌ワ紝鐩村埌涓嶅啀閲嶅
+                while (true)
+                {
+                    ds = oCn.RunProcReturn("select * from Gy_WorkBeginDotCheckListBillMain where HInterID = " + omodel.HInterID, "Gy_WorkBeginDotCheckListBillMain");
+                    if (ds != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+
+                //涓昏〃
+                string mainSql = "insert into Gy_WorkBeginDotCheckListBillMain" +
+                    "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" +
+                    ",HMaterID,HSourceID,HProcID,HNote) " +
+                    "values(" +
+                    "" + (omodel.HYear.ToString() != "0" ? omodel.HYear.ToString() : DateTime.Now.Year.ToString()) +
+                    "," + omodel.HPeriod.ToString() +
+                    ",'" + this.BillType +
+                    "','" + this.HBillSubType +
+                    "'," + omodel.HInterID +
+                    ",'" + omodel.HDate +
+                    "','" + omodel.HBillNo +
+                    "','" + omodel.HRemark +
+                    "','" + omodel.HMaker +
+                    "','" + omodel.HMakeDate +                 
+                    "','" + omodel.HMaterID +
+                    "','" + omodel.HSourceID +
+                    "','" + omodel.HProcID +                   
+                    "','" + omodel.HNote +
+                    "')";
+
+                oCn.RunProc(mainSql);
+
+                //鎻掑叆瀛愯〃
+                foreach (Model.ClsGy_WorkBeginDotCheckListBillSub oSub in DetailColl)
+                {
+                    string subSql = "insert into Gy_WorkBeginDotCheckListBillSub " +
+                        "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" +
+                        ",HCheckNoteItemID,HCheckPostID) " +
+                        " values(" +
+                        "" + omodel.HInterID.ToString() +
+                        "," + oSub.HEntryID.ToString() +
+                        "," + oSub.HSourceInterID +
+                        "," + oSub.HSourceEntryID +
+                        ",'" + oSub.HSourceBillNo +
+                        "','" + oSub.HSourceBillType +
+                        "','" + oSub.HRemark +
+                        "','" + oSub.HCheckNoteItemID +
+                        "','" + oSub.HCheckPostID +
+                        "')";
+                    oCn.RunProc(subSql);
+                }
+
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏄剧ず鍗曟嵁
+        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet Ds ;
+                Ds = oCn.RunProcReturn("Select * from Gy_WorkBeginDotCheckListBillMain Where HInterID=" + lngBillKey.ToString(), "Gy_WorkBeginDotCheckListBillMain");
+                if(Ds.Tables[0].Rows.Count==0)
+                {
+                    sReturn = "鍗曟嵁鏈壘鍒帮紒";
+                    return false;
+                }
+                //鍥哄畾璧嬪��===========================================
+                omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
+                omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim();
+                omodel.HDate =DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]);
+                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
+                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
+                omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]);
+                omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]);
+                omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]);
+                omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim();
+                omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]);
+                omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]);
+                omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]);
+                omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim();
+                omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim();
+                omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim();
+                omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim();
+                omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim();
+                omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim();
+                omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim();
+                omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
+                omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim();
+                omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
+                omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim();
+                omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
+                //========================================================
+              
+                //
+                
+                //寰幆
+                DataSet DsSub ;
+                DsSub = oCn.RunProcReturn("Select * from Gy_WorkBeginDotCheckListBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Gy_WorkBeginDotCheckListBillSub");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Model.ClsGy_WorkBeginDotCheckListBillSub oSub = new Model.ClsGy_WorkBeginDotCheckListBillSub();
+                    // 鍥哄畾璧嬪��===============================================
+                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
+                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
+                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
+                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
+                    oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim();
+                    oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim();
+                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
+                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); 
+                    oSub.HCloseMan =  DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
+                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
+                    oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]);
+                    oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
+                    //===================================================
+                  
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+       
+        
+    }
+
+}
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 05b83cd..09d927a 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -675,9 +675,11 @@
     <Compile Include="璐ㄦ绠$悊\ClsCrm_CustomerAppealBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsGy_MaterPreventErrMouldBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsQc_PreventErrMouldCheckBillMain.cs" />
+    <Compile Include="杞﹂棿绠$悊\ClsGy_WorkBeginDotCheckListBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_WorkBeginDotCheckBillMain.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsGy_MaterPreventErrMouldBillSub.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsQc_PreventErrMouldCheckBillSub.cs" />
+    <Compile Include="杞﹂棿绠$悊\ClsGy_WorkBeginDotCheckListBillSub.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_WorkBeginDotCheckBillSub.cs" />
     <Compile Include="杞﹂棿绠$悊\Sc_AssemblyBill_BindSourceTemp.cs" />
     <Compile Include="杞﹂棿绠$悊\ClsSc_ProcExchRecordBackBillMain.cs" />
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillMain.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillMain.cs"
new file mode 100644
index 0000000..3f52212
--- /dev/null
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillMain.cs"
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_WorkBeginDotCheckListBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+       
+        public Int64 HMaterID;          //int ---物料(gy_Material)
+        public Int64 HSourceID;  // int --生产资源(gy_Source)     
+        public Int64 HProcID;    //int --工序(gy_Process)
+        public string HNote;        // varchar(500) --记录事项
+    }
+}
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillSub.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillSub.cs"
new file mode 100644
index 0000000..9d429a3
--- /dev/null
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsGy_WorkBeginDotCheckListBillSub.cs"
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Model
+{
+    public class ClsGy_WorkBeginDotCheckListBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+        public Int64 HCheckNoteItemID;  // int --检查项目 (Gy_CheckNoteItem)
+        public Int64 HCheckPostID;         //int --确认者角色(gy_Post)
+
+    }
+}
diff --git a/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs b/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs
index daa5cb8..f4ec9b4 100644
--- a/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs
@@ -19,8 +19,10 @@
         private json objJsonResult = new json();
         public DataSet ds = new DataSet();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-        public DAL.ClsSc_WorkBeginDotCheckBillMain OBill = new DAL.ClsSc_WorkBeginDotCheckBillMain();
-        public DAL.ClsSc_WorkBeginDotCheckBillMain BillOld = new DAL.ClsSc_WorkBeginDotCheckBillMain();
+        public DAL.ClsSc_WorkBeginDotCheckBillMain OBill = new DAL.ClsSc_WorkBeginDotCheckBillMain();   //鍚姩鐐规鍗�
+        public DAL.ClsSc_WorkBeginDotCheckBillMain BillOld = new DAL.ClsSc_WorkBeginDotCheckBillMain();//鍚姩鐐规鍗�
+        public DAL.ClsGy_WorkBeginDotCheckListBillMain OBill1 = new DAL.ClsGy_WorkBeginDotCheckListBillMain();  //璁惧鍚姩鐐规娓呭崟
+        public DAL.ClsGy_WorkBeginDotCheckListBillMain BillOld1 = new DAL.ClsGy_WorkBeginDotCheckListBillMain(); //璁惧鍚姩鐐规娓呭崟
 
 
         #region 鍚姩鐐规鍒楄〃 鏌ヨ       
@@ -759,5 +761,741 @@
         }
         #endregion
 
+        #region 璁惧鍚姩鐐规娓呭崟鍒楄〃 鏌ヨ       
+        [Route("Sc_WorkBeginDotCheckBill/getGy_WorkBeginDotCheckListBillMainList")]
+        [HttpGet]
+        public object getGy_WorkBeginDotCheckListBillMainList(string sWhere, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_WorkBeginDotCheckListBillMain_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Gy_WorkBeginDotCheckListBillMainList order by 鍗曟嵁鍙� desc", "锘縣_v_Gy_WorkBeginDotCheckListBillMainList");
+                }
+                else
+                {
+                    string sql1 = "select * from  h_v_Gy_WorkBeginDotCheckListBillMainList  where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+                    ds = oCN.RunProcReturn(sql, "锘縣_v_Gy_WorkBeginDotCheckListBillMainList");
+                }
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璁惧鍚姩鐐规娓呭崟鍒楄〃 鑾峰彇缂栬緫鍒楄〃鏁版嵁
+        [Route("Sc_WorkBeginDotCheckBill/Gy_WorkBeginDotCheckListBillMainEditList")]
+        [HttpGet]
+        public object Gy_WorkBeginDotCheckListBillMainEditList(string HInterID, string User)
+        {
+            try
+            {
+                List<DataTable> tableList = new List<DataTable>();
+
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Edit", 1, false, User))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ澶辫触!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ds = oCN.RunProcReturn("select * from h_v_Gy_WorkBeginDotCheckListBillMainList where HInterID = " + HInterID, " h_v_Gy_WorkBeginDotCheckListBillMainList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璁惧鍚姩鐐规娓呭崟鍗� 淇濆瓨/缂栬緫      
+        [Route("Sc_WorkBeginDotCheckBill/SaveGy_WorkBeginDotCheckListBillMain")]
+        [HttpPost]
+        public object SaveGy_WorkBeginDotCheckListBillMain([FromBody] JObject sMainSub)
+        {
+            var _value = sMainSub["sMainSub"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();
+            string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+            string user = sArray[3].ToString();//鐢ㄦ埛鍚�
+
+            string UserName = "";
+            string s = "";
+            ListModels oListModels = new ListModels();
+            try
+            {
+                //淇濆瓨鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_WorkBeginDotCheckListBillMain_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsGy_WorkBeginDotCheckListBillMain oBill = new DAL.ClsGy_WorkBeginDotCheckListBillMain();
+                List<Model.ClsGy_WorkBeginDotCheckListBillMain> lsmain = new List<Model.ClsGy_WorkBeginDotCheckListBillMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_WorkBeginDotCheckListBillMain(msg2);
+                foreach (Model.ClsGy_WorkBeginDotCheckListBillMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (OBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, OBill.omodel.HInterID))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    if (refSav == "Update")
+                    {
+                        if (OBill.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (OBill.omodel.HChecker != "" && OBill.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (OBill.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+
+                    }
+                    UserName = oItem.HMaker;  //鍒跺崟浜�
+                    oItem.HBillType = "3744";
+                    oItem.HBillSubType = "3744";
+
+
+
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+                // 琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg3 = msg3.Substring(1, msg3.Length - 2);
+                msg3 = msg3.Replace("\\", "");
+                msg3 = msg3.Replace("\n", "");  //\n
+                List<Model.ClsGy_WorkBeginDotCheckListBillSub> ls = new List<Model.ClsGy_WorkBeginDotCheckListBillSub>();
+                ls = oListModels.getObjectByJson_Gy_WorkBeginDotCheckListBillSub(msg3);
+                int i = 0;
+                foreach (Model.ClsGy_WorkBeginDotCheckListBillSub oItemSub in ls)
+                {
+                    i++;
+                    oItemSub.HEntryID = i;
+
+
+                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+                    oItemSub.HCloseType = false;   //鍏抽棴绫诲瀷
+
+                    oBill.DetailColl.Add(oItemSub);
+
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (refSav == "Add")
+                {
+
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else if (refSav == "Update")
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = false;
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璁惧鍚姩鐐规娓呭崟鍗� 鍒犻櫎     
+        [Route("Sc_WorkBeginDotCheckBill/DeleteGy_WorkBeginDotCheckListBill")]
+        [HttpGet]
+        public object DeleteGy_WorkBeginDotCheckListBill(string HInterID, string user)
+        {
+            try
+            {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Delete", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (HInterID == null || HInterID.Equals(""))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                oCN.RunProc("delete from Gy_WorkBeginDotCheckListBillMain where HInterID = " + HInterID);
+
+                oCN.Commit();
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璁惧鍚姩鐐规娓呭崟鍗� 瀹℃牳/鍙嶅鏍�     
+        [Route("Sc_WorkBeginDotCheckBill/AuditGy_WorkBeginDotCheckListBill")]
+        [HttpGet]
+        public object AuditGy_WorkBeginDotCheckListBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Check", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "Gy_WorkBeginDotCheckListBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //瀹℃牳鍗曟嵁
+                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅鏍稿崟鎹�
+                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璁惧鍚姩鐐规娓呭崟鍗� 鍏抽棴/鍙嶅叧闂姛鑳�
+        [Route("Sc_WorkBeginDotCheckBill/CloseGy_WorkBeginDotCheckListBill")]
+        [HttpGet]
+        public object CloseGy_WorkBeginDotCheckListBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "Gy_WorkBeginDotCheckListBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍏抽棴鍗曟嵁
+                        if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶅叧闂崟鎹�
+                        if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 璁惧鍚姩鐐规娓呭崟鍗� 浣滃簾/鍙嶄綔搴熷姛鑳�
+        [Route("Sc_WorkBeginDotCheckBill/DropGy_WorkBeginDotCheckListBill")]
+        [HttpGet]
+        public object DropGy_WorkBeginDotCheckListBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "Gy_WorkBeginDotCheckListBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 浣滃簾  2  鍙嶄綔搴�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //浣滃簾鍗曟嵁
+                        if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        //鍙嶄綔搴熷崟鎹�
+                        if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file
diff --git a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
index 312c52a..fafe1d8 100644
--- a/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
+++ b/WebAPI/Controllers/SBGL/Gy_EquipFileMainController.cs
@@ -213,6 +213,7 @@
                 int HMakeSupID = list[0].HMakeSupID;              // int		//鍒堕�犲晢 (Gy_Supplier) 
                 string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
                 string HMacAddress = list[0].HMacAddress;   // varchar(50) //鏁伴噰鐗╃悊鍦板潃
+                int HMainSourceID = list[0].HMainSourceID;  //int //鎵�灞炰富鐢熶骇璁惧锛圙y_EquipFileBillMain锛�
                 string HMaker = msg4;
                 string HMakeDate = DateTime.Now.Date.ToString();
                 int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
@@ -233,11 +234,11 @@
                 oCN.RunProc("Insert into Gy_EquipFileBillMain " +
                    " (hbillno,HEquipFileNumber,HEquipFileNo,HName,HModel,HModel2,HMaterID,HUnitID,HOutComDate" +
                    ",HOutComNo,HDeptID,HUseEmpID,HRepairEmpID,HAddress,HSetupDate,HStartupDate,HStatus," +
-"HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID,HSourceID,HMainSourceFlag,HMacAddress) " +
+"HEquipFileTypeID,HProNum,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,hbilltype,HDate,HYear,HMaker,HMakeDate,HEquipMaintainRuleInterID,HEquipDotCheckRuleInterID,HSourceID,HMainSourceFlag,HMacAddress,HMainSourceID) " +
                    " Values('" + hbillno + "','" + HEquipFileNumber + "','" + HEquipFileNo + "','" + HName + "','" + HModel + "','" + HModel2 + "'," + HMaterID + "," + HUnitID +
                    ",'" + HOutComDate + "','" + HOutComNo + "'," + HDeptID + "," + HUseEmpID + "," + HRepairEmpID + ",'" + HAddress +
                    "','" + HSetupDate + "','" + HStartupDate + "','" + HStatus + "'," + HEquipFileTypeID + ",'" + HProNum +
-                   "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "','" + HMakeDate + "','" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                   "','" + HBarCode + "','" + HWorkArea + "','" + HLogo + "'," + HSellSupID + "," + HMakeSupID + ",'3308','" + HDate + "','" + HYear + "','" + HMaker + "','" + HMakeDate + "','" + HEquipMaintainRuleInterID + "','" + HEquipDotCheckRuleInterID +"'," + HSourceID + ",'" + HMainSourceFlag + "','" + HMacAddress + "','" + HMainSourceID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 oCN.Commit();
                 objJsonResult.code = "1";
@@ -313,6 +314,7 @@
                 int HMakeSupID = list[0].HMakeSupID;              // int		//鍒堕�犲晢 (Gy_Supplier)
                 string HMainSourceFlag = list[0].HMainSourceFlag;             //varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
                 string HMacAddress = list[0].HMacAddress;   // varchar(50) //鏁伴噰鐗╃悊鍦板潃
+                int HMainSourceID = list[0].HMainSourceID;  //int //鎵�灞炰富鐢熶骇璁惧锛圙y_EquipFileBillMain锛�
                 string HUpDater = msg4;
                 string HUpDateDate = DateTime.Now.Date.ToString();
                 int HEquipDotCheckRuleInterID = list[0].HEquipDotCheckRuleInterID;
@@ -374,7 +376,8 @@
                     ",HEquipMaintainRuleInterID='" + HEquipMaintainRuleInterID + "'" +
                     ",HSourceID='" + HSourceID + "'" +
                     ",HMainSourceFlag= '" + HMainSourceFlag + "'" +
-                     ",HMacAddress= '" + HMacAddress + "'" +
+                    ",HMacAddress= '" + HMacAddress + "'" +
+                    ",HMainSourceID = '" + HMainSourceID + "'" +
                     " Where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�
                 //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 2278e91..f791426 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -2833,6 +2833,31 @@
         }
 
         /// <summary>
+        /// 澶勭悊鏂板璁惧鍚姩鐐规娓呭崟涓昏〃鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsGy_WorkBeginDotCheckListBillMain> getObjectByJson_Gy_WorkBeginDotCheckListBillMain(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsGy_WorkBeginDotCheckListBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_WorkBeginDotCheckListBillMain>>(jsonString);
+            return list;
+        }
+
+
+        /// <summary>
+        /// 澶勭悊鏂板璁惧鍚姩鐐规娓呭崟瀛愯〃鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsGy_WorkBeginDotCheckListBillSub> getObjectByJson_Gy_WorkBeginDotCheckListBillSub(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsGy_WorkBeginDotCheckListBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_WorkBeginDotCheckListBillSub>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 澶勭悊鏂板浜у搧闃查敊楠岃瘉娓呭崟涓昏〃鐨刯son
         /// </summary>
         /// <param name="jsonString"></param>
diff --git a/WebAPI/Models/ClsGy_EquipFileMain.cs b/WebAPI/Models/ClsGy_EquipFileMain.cs
index cf4fb2f..97e9fda 100644
--- a/WebAPI/Models/ClsGy_EquipFileMain.cs
+++ b/WebAPI/Models/ClsGy_EquipFileMain.cs
@@ -32,6 +32,7 @@
         public int HMakeSupID;              // int		//鍒堕�犲晢 (Gy_Supplier) 
         public string HMainSourceFlag;              // varchar(10) //鏄惁涓荤敓浜ц澶�(鍚︼紝鏄�)
         public string HMacAddress;              // varchar(50) //鏁伴噰鐗╃悊鍦板潃
+        public int HMainSourceID;                //   鈭�	int    		鎵�灞炰富鐢熶骇璁惧锛圙y_EquipFileBillMain锛�
         public int HEquipDotCheckRuleInterID=0;
         public int HEquipMaintainRuleInterID=0;
         public int HSourceID = 0;

--
Gitblit v1.9.1