wtt
2025-11-07 f95cc9aa0dae0ab3b7ec8b213c8be18ca47bfac2
WebAPI/Controllers/Æ·ÖʹÜÀí/Ê×¼þ¼ìÑéµ¥/QC_FirstPieceCheckBillController.cs
@@ -202,7 +202,7 @@
                List<object> columnNameList = new List<object>();
                string sql1 = "select * from h_v_QC_FirstPieceCheckBill_Edit where 1 = 1  ";
                string sql = sql1 + sWhere + " order by hmainid desc";
                string sql = sql1 + sWhere + " order by hmainid desc,hsubid asc";
                ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBill_Edit");
                //添加列名
@@ -278,6 +278,9 @@
                msg2 = "[" + msg2.ToString() + "]";
                List<Model.ClsQC_FirstPieceCheckBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillMain>>(msg2);
                DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill();
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
@@ -323,6 +326,7 @@
                BillNew.omodel.HBatchNo = ClsPub.isStrNull(mainList[0].HBatchNo);
                BillNew.omodel.HTakeSampleCheckBillID = ClsPub.isLong(mainList[0].HTakeSampleCheckBillID);
                BillNew.omodel.HTakeSampleCheckBillNo = ClsPub.isStrNull(mainList[0].HTakeSampleCheckBillNo);
                BillNew.omodel.HRemarkSN = mainList[0].HRemarkSN;
                List<Model.ClsQC_FirstPieceCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillSub>>(msg3);
                BillNew.DetailColl = new List<Model.ClsQC_FirstPieceCheckBillSub>();
                for (int i = 0; i < subList.ToArray().Length; i++)
@@ -369,6 +373,13 @@
                        oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect);
                        oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID);
                        oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult);
                        oSub.HQualityStdID = DBUtility.ClsPub.isLong(subList[i].HQualityStdID);//
                        oSub.HInspectMethodID = DBUtility.ClsPub.isLong(subList[i].HInspectMethodID);//
                        oSub.HInspectBasisID = DBUtility.ClsPub.isLong(subList[i].HInspectBasisID);//
                        oSub.HCompareSymbol = DBUtility.ClsPub.isStrNull(subList[i].HCompareSymbol);//
                        BillNew.DetailColl.Add(oSub);
                    }
                    else
@@ -380,7 +391,11 @@
                        return objJsonResult;
                    }
                }
                //保存完毕后处理
                if (OperationType.Equals("1") || OperationType.Equals("2"))
                {
@@ -388,6 +403,24 @@
                }
                else
                {
                    if (BillOld.ShowBill(mainList[0].HInterID, ref s) == false)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "此单据有误!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    //判断是否可编辑
                    if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "此单据已经被审核,不允许修改!";
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                }
                //提示
@@ -395,7 +428,6 @@
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    //objJsonResult.Message = "单据存盘完毕!单据号:" + mainList[0].HBillNo.Trim();
                    objJsonResult.Message = ClsPub.sExeReturnInfo+"单据号:" + mainList[0].HBillNo.Trim();
                    objJsonResult.data = null;
                    return objJsonResult;
@@ -498,7 +530,7 @@
        }
        #endregion
        #region è¿”回检验值列表
        /// <summary>
        ///返回检验值列表
        /// </summary>
@@ -553,6 +585,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region é¦–件检验单维护 å®¡æ ¸ åå®¡æ ¸ å…³é—­ åå…³é—­ ä½œåºŸ åä½œåºŸ
        /// <summary>
@@ -1063,9 +1096,7 @@
        }
        #endregion
        # region é¦–件检验逻辑删除功能
        /// <summary>
        /// é¦–件检验逻辑删除功能
        /// </summary>
@@ -1096,11 +1127,30 @@
                    return objJsonResult;
                }
                var s = "";
                if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "此单据有误!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                //判断是否可删除
                if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "此单据已经被审核,不允许删除!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                //开始事物
                oCN.BeginTran();
                var ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain");
                var ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain");
                //删除前控制
                DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_QC_FirstPieceCheckBill_BeforeDelCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_QC_FirstPieceCheckBill_BeforeDelCtrl");
                if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
@@ -1170,6 +1220,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region é¦–件检验单根据源单类型获取信息-源单为工序进站单
        [Route("QC_FirstPieceCheckBill/get_StationInBill")]
@@ -1227,6 +1278,62 @@
        }
        #endregion
        #region é¦–件检验单根据源单类型获取信息-源单为工序进站单 é€šè¿‡å•据号获取
        [Route("QC_FirstPieceCheckBill/get_StationInBill_ByHBillNo")]
        [HttpGet]
        public object get_StationInBill_ByHBillNo(string HBillNo, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_FirstPieceCheckBill_QCSchemeSource)
                    {
                        case "工序":
                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList_ByHBillNo " + "'工序','" + HBillNo + "'";
                            break;
                        case "物料":
                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList_ByHBillNo " + "'物料','" + HBillNo + "'";
                            break;
                        case "工艺路线":
                            sql = "exec h_p_QC_FirstPiece_GetStationInBillList_ByHBillNo " + "'工艺路线','" + HBillNo + "'";
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetStationInBillList");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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 = "查询数据异常,请与管理员联系!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é¦–ä»¶/工序 æ£€éªŒå•根据源单类型获取信息-源单为工序流转卡
        [Route("CheckBill/get_ProcessExchangeBill")]
        [HttpGet]
@@ -1250,6 +1357,62 @@
                            break;
                        case "工艺路线":
                            sql = "exec h_p_QC_FirstPiece_GetProcessExchangeBillList " + "'工艺路线','" + HInterID + "','" + HEntryID + "'";
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetProcessExchangeBillList");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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 = "查询数据异常,请与管理员联系!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é¦–ä»¶/工序 æ£€éªŒå•根据源单类型获取信息-源单为工序流转卡 æ ¹æ®å•据号查询
        [Route("CheckBill/get_ProcessExchangeBill_ByBillNo")]
        [HttpGet]
        public object get_ProcessExchangeBill_ByBillNo(string HBillNo, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_FirstPieceCheckBill_QCSchemeSource)
                    {
                        case "工序":
                            sql = "exec h_p_QC_FirstPiece_GetProcessExchangeBillList_ByBillNo " + "'工序','" + HBillNo + "'";
                            break;
                        case "物料":
                            sql = "exec h_p_QC_FirstPiece_GetProcessExchangeBillList_ByBillNo " + "'物料','" + HBillNo + "'";
                            break;
                        case "工艺路线":
                            sql = "exec h_p_QC_FirstPiece_GetProcessExchangeBillList_ByBillNo " + "'工艺路线','" + HBillNo + "'";
                            break;
                    }
@@ -1393,5 +1556,164 @@
        }
        #endregion
        #region é¦–件检验单根据源单类型获取信息-源单为生产订单
        [Route("QC_FirstPieceCheckBill/get_ICMOBill")]
        [HttpGet]
        public object get_ICMOBill(string HICMOInterID, string HICMOEntryID, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_FirstPieceCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_FirstPiece_GetICMOBillList " + "'物料','" + HICMOInterID + "','" + HICMOEntryID + "'";
                            break;
                        case "工艺路线":
                            sql = "exec h_p_QC_FirstPiece_GetICMOBillList " + "'工艺路线','" + HICMOInterID + "','" + HICMOEntryID + "'";
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetICMOBillList");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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 = "查询数据异常,请与管理员联系!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region é¦–件检验单根据源单类型获取信息-源单为生产订单 é€šè¿‡å•据号带出
        [Route("QC_FirstPieceCheckBill/get_ICMOBill_ByBillNo")]
        [HttpGet]
        public object get_ICMOBill_ByBillNo(string HBillNo, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_FirstPieceCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_FirstPiece_GetICMOBillList_ByBillNo " + "'物料','" + HBillNo + "'";
                            break;
                        case "工艺路线":
                            sql = "exec h_p_QC_FirstPiece_GetICMOBillList_ByBillNo " + "'工艺路线','" + HBillNo + "'";
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_FirstPiece_GetICMOBillList_ByBillNo");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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 = "查询数据异常,请与管理员联系!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¡æ£€æ£€éªŒå•根据源单类型获取信息-源单为生产订单
        [Route("QC_PatrolProcCheckBill/get_ICMOBill")]
        [HttpGet]
        public object get_ICMOBill_PatrolProcCheck(string HICMOInterID, string HICMOEntryID, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                string sReturn = "";
                string sql = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                {
                    switch (oSystemParameter.omodel.QC_PatrolProcCheckBill_QCSchemeSource)
                    {
                        case "物料":
                            sql = "exec h_p_QC_PatrolProcCheck_GetICMOBillList " + "'物料','" + HICMOInterID + "','" + HICMOEntryID + "'";
                            break;
                        case "工艺路线":
                            sql = "exec h_p_QC_PatrolProcCheck_GetICMOBillList " + "'工艺路线','" + HICMOInterID + "','" + HICMOEntryID + "'";
                            break;
                    }
                }
                ds = oCN.RunProcReturn(sql, "h_p_QC_PatrolProcCheck_GetICMOBillList");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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 = "查询数据异常,请与管理员联系!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}