yxj
2024-06-27 4a71279770509d6876265b64002779c035295e3c
WebAPI/Controllers/QC_ManagementController.cs
@@ -126,12 +126,12 @@
                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");
                    ds = oCN.RunProcReturn("select  * from h_v_Gy_QCCheckProjectList order by 日期 desc ", "h_v_Gy_QCCheckProjectList");
                }
                else
                {
                    string sql1 = "select * from h_v_Gy_QCCheckProjectList where 1=1";
                    string sql = sql1 + sWhere+ " order by hmainid desc ";
                    string sql = sql1 + sWhere+ " order by 日期 desc ";
                    ds = oCN.RunProcReturn(sql, "h_v_Gy_QCCheckProjectList");
                }
            }
@@ -939,9 +939,9 @@
                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");
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_QCCheckProjectList_Edit  where hmainid= " + HID + " ", "h_v_Gy_QCCheckProjectList_Edit");
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在生产汇报单号" };
                return new ApiResult<DataSet> { code = -1, msg = "不存在检验方案" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
@@ -956,14 +956,12 @@
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn(string.Format(@"select 次序号 HPrjNo,检验项目ID HQCCheckItemID,检验项目代码 HQCCheckItemNumber,检验项目 HQCCheckItemName,
                                                       检验标准 HQCStd,最大检验标准 HQCStdMax,检验单位 HQCUnit,表体备注 HRemark from h_v_Gy_QCCheckProjectList_NEW
                                                       where hinterid='"+HInterID+"'"), "h_v_Gy_QCCheckProjectList_NEW");
                ds = oCN.RunProcReturn(string.Format(@"select * from h_v_Gy_QCCheckProjectList_Edit where hinterid='" + HInterID+"'"), "h_v_Gy_QCCheckProjectList_Edit");
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "获取信息成功!";
                    objJsonResult.data = ds.Tables[0];
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取信息成功!";
                objJsonResult.data = ds.Tables[0];
            }
            catch (Exception e)
            {
@@ -1025,7 +1023,6 @@
                    oItem.HBillStatus = 0;
                    oItem.HPeriod = 0;
                    oItem.HMaker = "";
                    oItem.HStandard = false;
                    oItem.HMainSourceInterID = oItem.HInterID;
                    //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo);
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
@@ -1069,6 +1066,8 @@
                    oItemSub.HRelationQty = 0;
                    oItemSub.HRelationMoney = 0;
                    oItemSub.HCloseMan = "";
                    oItemSub.HDestructInspect = Convert.ToInt32(oItemSub.HDestructInspect);
                    oItemSub.HKeyInspect = Convert.ToInt32(oItemSub.HKeyInspect);
                    oBill.DetailColl.Add(oItemSub);
                }
@@ -1262,6 +1261,109 @@
        }
        #endregion
        #region 检验方案审核/反审核
        [Route("Gy_QCCheckProject/AuditGy_QCCheckProject")]
        [HttpGet]
        public object AuditGy_QCCheckProject(string HInterID, int Type, string user)
        {
            try
            {
                //判断是否有审核权限
                if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckProject_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;
                }
                DAL.ClsGy_QCCheckProjectMain oBill = new DAL.ClsGy_QCCheckProjectMain();
                ClsPub.CurUserName = user;
                oCN.BeginTran();//开始事务
                //Type 1 审核  2  反审核
                if (Type == 1)
                {
                    //判断单据是否已经审核
                    DataSet ds;
                    string sql = "select * from  Gy_QCCheckProjectMain  where HInterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
                    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 (!oBill.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  Gy_QCCheckProjectMain  where HInterID = " + HInterID;
                    ds = oCN.RunProcReturn(sql, oBill.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 (!oBill.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 来料检验
        /// <summary>
        /// 保存来料检验单