From 3ad2a9ea53d9b647ec10c9ece51f40d7f078653a Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期三, 27 十二月 2023 13:36:53 +0800
Subject: [PATCH] 生产入库、委外入库、其他入库、生产领料、委外领料、其他出库、直接调拨扫码上传方法增加递入保管人、验收人、金蝶WISE制单人等

---
 WebAPI/Controllers/QC_ManagementController.cs |  462 +++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 331 insertions(+), 131 deletions(-)

diff --git a/WebAPI/Controllers/QC_ManagementController.cs b/WebAPI/Controllers/QC_ManagementController.cs
index c0966ad..7452035 100644
--- a/WebAPI/Controllers/QC_ManagementController.cs
+++ b/WebAPI/Controllers/QC_ManagementController.cs
@@ -13,6 +13,8 @@
 {
     public class QC_ManagementController : ApiController
     {
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
 
         #region 閿欒杩斿洖鏂规硶
         // GET: QC_Management
@@ -29,22 +31,22 @@
         {
             try
             {
-                if (ds == null || ds.Tables[0].Rows.Count <= 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    return objJsonResult;
-                }
+                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+                //{
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+                //}
+                //else
+                //{
+                //objJsonResult.code = "0";
+                //objJsonResult.count = 0;
+                //objJsonResult.Message = "鏃犳暟鎹�";
+                //objJsonResult.data = null;
+                //return objJsonResult;
+                //}
             }
             catch (Exception e)
             {
@@ -104,20 +106,30 @@
         /// <returns></returns>
         [Route("QC_Management/MES_QC_CheckProjectList_Json")]
         [HttpGet]
-        public object MES_QC_CheckProjectList_Json(string sqlWhere)
+        public object MES_QC_CheckProjectList_Json(string sWhere,string user)
         {
             DataSet ds;
             try
             {
-                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (sqlWhere == null || sqlWhere.Equals(""))
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Query", 1, false, user))
                 {
-                    ds = oCN.RunProcReturn("select top 500 * from h_v_Gy_QCCheckProjectList where HBillStatus>-1 ", "h_v_Gy_QCCheckProjectList");
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡璇㈡潈闄�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select  * from h_v_Gy_QCCheckProjectList order by hmainid desc ", "h_v_Gy_QCCheckProjectList");
                 }
                 else
                 {
-                    string sql1 = "select * from h_v_Gy_QCCheckProjectList where HBillStatus>-1 ";
-                    string sql = sql1 + sqlWhere;
+                    string sql1 = "select * from h_v_Gy_QCCheckProjectList where 1=1";
+                    string sql = sql1 + sWhere+ " order by hmainid desc ";
                     ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList");
                 }
             }
@@ -151,7 +163,7 @@
                 }
                 else
                 {
-                    string sql1 = "select * from h_v_QC_POStockInCheckBillList where 1 = 1 ";
+                    string sql1 = "select * from h_v_QC_POStockInCheckBillList where 鍏抽棴浜�='' ";
                     string sql = sql1 + sqlWhere;
                     ds = oCN.RunProcReturn(sql, "h_v_QC_POStockInCheckBillList");
                 }
@@ -174,20 +186,30 @@
         /// <returns></returns>
         [Route("QC_Management/MES_QC_FirstPieceCheckBillList_Json")]
         [HttpGet]
-        public object MES_QC_FirstPieceCheckBillList_Json(string sqlWhere)
+        public object MES_QC_FirstPieceCheckBillList_Json(string sqlWhere,string user)
         {
             DataSet ds;
             try
             {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select top 500 * from h_v_QC_FirstPieceCheckBillList ", "h_v_QC_FirstPieceCheckBillList");
+                    ds = oCN.RunProcReturn("select top 500 * from h_v_QC_FirstPieceCheckBillList  where  鍏抽棴浜�='' order by hmainid desc ", "h_v_QC_FirstPieceCheckBillList");
                 }
                 else
                 {
-                    string sql1 = "select * from h_v_QC_FirstPieceCheckBillList where 1 = 1 ";
-                    string sql = sql1 + sqlWhere;
+                    string sql1 = "select * from h_v_QC_FirstPieceCheckBillList where 鍏抽棴浜�='' ";
+                    string sql = sql1 + sqlWhere+ " order by hmainid desc ";
                     ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBillList");
                 }
             }
@@ -209,20 +231,30 @@
         /// <returns></returns>
         [Route("QC_Management/MES_QC_PatrolProcCheckBillList_Json")]
         [HttpGet]
-        public object MES_QC_PatrolProcCheckBillList_Json(string sqlWhere)
+        public object MES_QC_PatrolProcCheckBillList_Json(string sqlWhere,string user)
         {
             DataSet ds;
             try
             {
+                //鏌ョ湅鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("QC_PatrolProcCheckBill_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (sqlWhere == null || sqlWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select top 500 * from h_v_QC_PatrolProcCheckBillList ", "h_v_QC_PatrolProcCheckBillList");
+                    ds = oCN.RunProcReturn("select top 500 * from h_v_QC_PatrolProcCheckBillList where  鍏抽棴浜�='' order by hmainid desc ", "h_v_QC_PatrolProcCheckBillList");
                 }
                 else
                 {
-                    string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 1 = 1 ";
-                    string sql = sql1 + sqlWhere;
+                    string sql1 = "select * from h_v_QC_PatrolProcCheckBillList where 鍏抽棴浜�='' ";
+                    string sql = sql1 + sqlWhere+ " order by hmainid desc ";
                     ds = oCN.RunProcReturn(sql, "h_v_QC_PatrolProcCheckBillList");
                 }
             }
@@ -435,13 +467,59 @@
 
         #region 淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
 
-        #region 妫�楠屾柟妗�
+        #region  妫�楠屾柟妗堢紪杈戞椂鑾峰彇琛ㄥご鏁版嵁
+        [Route("QC_Management/MES_QC_CheckProjectListCheckDetai")]
+        [HttpGet]
+        public ApiResult<DataSet> MES_QC_CheckProjectListCheckDetai(string HID)
+        {
+            if (string.IsNullOrEmpty(HID))
+                return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_QCCheckProjectList_NEW  where hmainid= " + HID + " ", "h_v_Gy_QCCheckProjectList_NEW");
+            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ敓浜ф眹鎶ュ崟鍙�" };
+
+            return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
+        }
+        #endregion
+
+        #region 妫�楠屾柟妗堢紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁
+        [Route("QC_Management/MES_QC_CheckProjectListProjectDetai")]
+        [HttpGet]
+        public object MES_QC_CheckProjectListProjectDetai(string HInterID)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                ds = oCN.RunProcReturn(string.Format(@"select 娆″簭鍙� HPrjNo,妫�楠岄」鐩甀D HQCCheckItemID,妫�楠岄」鐩唬鐮� HQCCheckItemNumber,妫�楠岄」鐩� HQCCheckItemName,
+                                                       妫�楠屾爣鍑� HQCStd,鏈�澶ф楠屾爣鍑� HQCStdMax,妫�楠屽崟浣� HQCUnit,琛ㄤ綋澶囨敞 HRemark from h_v_Gy_QCCheckProjectList_NEW
+                                                       where hinterid='"+HInterID+"'"), "h_v_Gy_QCCheckProjectList_NEW");
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region 妫�楠屾柟妗堜繚瀛�
         /// <summary>
         /// 淇濆瓨妫�楠屾柟妗�
         /// </summary>
         /// <param name="msg"></param>
         /// <returns></returns>
-        [Route("SaveQCCheckProjectList")]
+        [Route("QC_Management/SaveQCCheckProjectList")]
         [HttpPost]
         public object SaveQCCheckProjectList([FromBody] JObject msg)
         {
@@ -450,7 +528,17 @@
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
+            string user = sArray[2].ToString();//鐢ㄦ埛鍚�
 
+            //鍒ゆ柇鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Edit", 1, false, user))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犵紪杈戞潈闄�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
 
             string UserName = "";
             ListModels oListModels = new ListModels();
@@ -465,17 +553,17 @@
                 {
                     //oItem.HMaker = "";
                     UserName = oItem.HMaker;
+                    DBUtility.ClsPub.CurUserName = UserName;
                     oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                     oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                     oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
-                    oItem.HBillType = "3302";
-                    oItem.HBillSubType = "3302";
+                    oItem.HBillType = "3320";
+                    oItem.HBillSubType = "3320";
                     oItem.HBillStatus = 0;
                     oItem.HPeriod = 0;
                     oItem.HMaker = "";
                     oItem.HStandard = false;
                     oItem.HMainSourceInterID = oItem.HInterID;
-                    oItem.HMaterTypeID = 0;
                     //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
                     if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                     {
@@ -518,7 +606,6 @@
                     oItemSub.HRelationQty = 0;
                     oItemSub.HRelationMoney = 0;
                     oItemSub.HCloseMan = "";
-                    oItemSub.HRemark = "";
                     oBill.DetailColl.Add(oItemSub);
 
                 }
@@ -527,7 +614,6 @@
                 bool bResult;
                 if (oBill.omodel.HInterID == 0)
                 {
-                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
@@ -562,20 +648,96 @@
             }
         }
 
+        #endregion
+
+        #region  妫�楠屾柟妗堥�昏緫鍒犻櫎鍔熻兘
         /// <summary>
         /// 妫�楠屾柟妗堥�昏緫鍒犻櫎鍔熻兘
         /// </summary>
         /// <returns></returns>
         [Route("DeltetQCCheckProject")]
         [HttpGet]
-        public object DeltetQCCheckProject(string HInterID)
+        public object DeltetQCCheckProject(string HInterID,string UserName)
         {
+
+            DBUtility.ClsPub.CurUserName = UserName;
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_Delete", 1, false, DBUtility.ClsPub.CurUserName))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+            if (lngBillKey == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            DAL.ClsGy_QCCheckProjectMain oBill = new DAL.ClsGy_QCCheckProjectMain();
+            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+            {
+                if (oBill.omodel.HBillStatus > 1)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (oBill.omodel.HChecker != "")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                if (IsDete)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁鏈壘鍒�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+
+
             DataSet ds;
             //string ModRightNameCheck = "Sc_ProcessReport_check";
             try
             {
                 //鍒犻櫎鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
+                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName))
                 //{
                 //    objJsonResult.code = "0";
                 //    objJsonResult.count = 0;
@@ -778,7 +940,7 @@
             try
             {
                 //鍒犻櫎鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
+                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName))
                 //{
                 //    objJsonResult.code = "0";
                 //    objJsonResult.count = 0;
@@ -967,80 +1129,82 @@
                 return objJsonResult;
             }
         }
+        #region [浼垹闄ゆā寮廬
+        ///// <summary>
+        ///// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
+        ///// </summary>
+        ///// <returns></returns>
+        //[Route("DeltetQC_FirstPieceCheck")]
+        //[HttpGet]
+        //public object DeltetQC_FirstPieceCheck(string HInterID,string user)
+        //{
+        //    DataSet ds;
+        //    string ModRightNameCheck = "QC_FirstPieceCheckBill_Delete";
+        //    try
+        //    {
+        //        //鍒犻櫎鏉冮檺
+        //        if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
 
-        /// <summary>
-        /// 棣栦欢妫�楠岄�昏緫鍒犻櫎鍔熻兘
-        /// </summary>
-        /// <returns></returns>
-        [Route("DeltetQC_FirstPieceCheck")]
-        [HttpGet]
-        public object DeltetQC_FirstPieceCheck(string HInterID)
-        {
-            DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
-            try
-            {
-                //鍒犻櫎鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+        //        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        //        if (string.IsNullOrWhiteSpace(HInterID))
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "HInterID涓虹┖锛�";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
+        //        oCN.BeginTran();//寮�濮嬩簨鍔�
+        //        ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain");
+        //        DataSet ds2 = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub where HInterID=" + HInterID, "QC_FirstPieceCheckBillSub");
+        //        if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0)
+        //        {
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "娌℃湁杩欎釜鍗曟嵁锛屾棤娉曞垹闄わ紒";
+        //            objJsonResult.data = null;
+        //            return objJsonResult; ;
+        //        }
+        //        var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]);
+        //        var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]);
+        //        if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2))
+        //        {
+        //            oCN.RollBack();//鍥炴粴浜嬪姟
+        //            objJsonResult.code = "0";
+        //            objJsonResult.count = 0;
+        //            objJsonResult.Message = "鍗曟嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒";
+        //            objJsonResult.data = null;
+        //            return objJsonResult;
+        //        }
 
-                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                if (string.IsNullOrWhiteSpace(HInterID))
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "HInterID涓虹┖锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                oCN.BeginTran();//寮�濮嬩簨鍔�
-                ds = oCN.RunProcReturn("select * from QC_POStockInCheckBillMain where HInterID=" + HInterID, "QC_POStockInCheckBillMain");
-                DataSet ds2 = oCN.RunProcReturn("select * from QC_POStockInCheckBillSub where HInterID=" + HInterID, "QC_POStockInCheckBillSub");
-                if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "娌℃湁杩欎釜鍗曟嵁锛屾棤娉曞垹闄わ紒";
-                    objJsonResult.data = null;
-                    return objJsonResult; ;
-                }
-                var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]);
-                var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]);
-                if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2))
-                {
-                    oCN.RollBack();//鍥炴粴浜嬪姟
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+        //        oCN.RunProc("update QC_FirstPieceCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID);
+        //        oCN.RunProc("update QC_FirstPieceCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID);
+        //        oCN.Commit();//鎻愪氦浜嬪姟
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 1;
+        //        objJsonResult.Message = "* 鍗曟嵁鍒犻櫎鎴愬姛锛�";
+        //        objJsonResult.data = null;
+        //        return objJsonResult; ;
 
-                oCN.RunProc("update QC_POStockInCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID);
-                oCN.RunProc("update QC_POStockInCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID);
-                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;
-            }
-        }
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        objJsonResult.code = "0";
+        //        objJsonResult.count = 0;
+        //        objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+        //        objJsonResult.data = null;
+        //        return objJsonResult;
+        //    }
+        //}
+        #endregion
+       
         #endregion
 
         #region 宸℃
@@ -1058,13 +1222,25 @@
             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
+            string user = sArray[2].ToString();
+            string badmsg = sArray[3].ToString();
 
 
             string UserName = "";
             ListModels oListModels = new ListModels();
             try
             {
-                DAL.ClsQC_PatrolProcCheckBill oBill = new DAL.ClsQC_PatrolProcCheckBill();
+                //鍒ゆ柇鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("QC_PatrolProcCheckBill_Edit", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犱繚瀛樻潈闄�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                WebAPI.DLL.ClsQC_PatrolProcCheckBill oBill = new WebAPI.DLL.ClsQC_PatrolProcCheckBill();
                 List<Model.ClsQC_PatrolProcCheckBillMain> lsmain = new List<Model.ClsQC_PatrolProcCheckBillMain>();
                 msg2 = msg2.Replace("\\", "");
                 msg2 = msg2.Replace("\n", "");  //\n
@@ -1076,11 +1252,11 @@
                     oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                     oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                     oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
-                    oItem.HBillType = "7503";
-                    oItem.HBillSubType = "7503";
+                    oItem.HBillType = "7506";
+                    oItem.HBillSubType = "7506";
                     oItem.HBillStatus = 0;
                     oItem.HPeriod = 0;
-                    oItem.HMaker = "";
+                    oItem.HMaker = user;
                     oItem.HMainSourceInterID = oItem.HInterID;
 
                     //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1126,10 +1302,34 @@
                     oItemSub.HRelationQty = 0;
                     oItemSub.HRelationMoney = 0;
                     oItemSub.HCloseMan = "";
-                    oItemSub.HRemark = "";
+                    //oItemSub.HRemark = "";
                     oBill.DetailColl.Add(oItemSub);
 
                 }
+                badmsg = badmsg.Substring(1, badmsg.Length - 2);
+                badmsg = badmsg.Replace("\\", "");
+                badmsg = badmsg.Replace("\n", "");  //\n
+                List<Model.ClsQC_PatrolProcCheckBillSub_BadReason> bs = new List<Model.ClsQC_PatrolProcCheckBillSub_BadReason>();
+                bs = oListModels.getObjectByJson_ClsQC_PatrolProcCheckBillSub_BadReason(badmsg);
+                int j = 0;
+                foreach (Model.ClsQC_PatrolProcCheckBillSub_BadReason badSub in bs)
+                {
+                    badSub.HBillNo_bak = oBill.omodel.HBillNo;//鍗曟嵁鍙凤紙澶囦唤锛屼互鍏嶅唴鐮佷涪澶憋紝鎵句笉鍒板搴斾富琛級
+                    j++;
+                    if (string.IsNullOrWhiteSpace(badSub.HBillNo_bak))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病澶囦唤鍗曟嵁鍙凤紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    badSub.HInterID = oBill.omodel.HInterID;
+                    badSub.HEntryID = j;
+                    badSub.HSEQ = j;             
+                    oBill.DetailColl_Bad.Add(badSub);
+                }
+
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
@@ -1176,21 +1376,21 @@
         /// <returns></returns>
         [Route("DeltetQC_PatrolProcCheck")]
         [HttpGet]
-        public object DeltetQC_PatrolProcCheck(string HInterID)
+        public object DeltetQC_PatrolProcCheck(string HInterID,string user)
         {
             DataSet ds;
-            //string ModRightNameCheck = "Sc_ProcessReport_check";
+            string ModRightNameCheck = "QC_PatrolProcCheckBill_Delete";
             try
             {
                 //鍒犻櫎鏉冮檺
-                //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒犻櫎澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
 
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 if (string.IsNullOrWhiteSpace(HInterID))
@@ -1202,8 +1402,8 @@
                     return objJsonResult;
                 }
                 oCN.BeginTran();//寮�濮嬩簨鍔�
-                ds = oCN.RunProcReturn("select * from QC_POStockInCheckBillMain where HInterID=" + HInterID, "QC_POStockInCheckBillMain");
-                DataSet ds2 = oCN.RunProcReturn("select * from QC_POStockInCheckBillSub where HInterID=" + HInterID, "QC_POStockInCheckBillSub");
+                ds = oCN.RunProcReturn("select * from QC_PatrolProcCheckBillMain where HInterID=" + HInterID, "QC_PatrolProcCheckBillMain");
+                DataSet ds2 = oCN.RunProcReturn("select * from QC_PatrolProcCheckBillSub where HInterID=" + HInterID, "QC_PatrolProcCheckBillSub");
                 if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
@@ -1224,8 +1424,8 @@
                     return objJsonResult;
                 }
 
-                oCN.RunProc("update QC_POStockInCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID);
-                oCN.RunProc("update QC_POStockInCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID);
+                oCN.RunProc("update QC_PatrolProcCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID);
+                oCN.RunProc("update QC_PatrolProcCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID);
                 oCN.Commit();//鎻愪氦浜嬪姟
                 objJsonResult.code = "0";
                 objJsonResult.count = 1;

--
Gitblit v1.9.1