zrg
2025-04-08 d54613ce0b6960dafcbd28454172f21a2d0bb6d1
WebAPI/Controllers/SBGL/Sb_EquipBeginBillController.cs
@@ -21,7 +21,7 @@
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        public DAL.ClsSb_EquipBeginBillMain OBill = new DAL.ClsSb_EquipBeginBillMain();
        public DAL.ClsSb_EquipBeginBillMain BillOld = new DAL.ClsSb_EquipBeginBillMain();
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); //获取系统参数
        #region 设备开机单列表 查询       
        [Route("Sb_EquipBeginBill/getSb_EquipBeginBillMainList")]
@@ -161,7 +161,7 @@
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from h_v_Sb_EquipBeginBillMainList where HInterID = " + HInterID, " h_v_Sb_EquipBeginBillMainList");
                ds = oCN.RunProcReturn("select * from h_v_Sb_EquipBeginBillMain_Edit where HInterID = " + HInterID, " h_v_Sb_EquipBeginBillMain_Edit");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -293,6 +293,31 @@
                }
                if (bResult)
                {
                    //自动审核设置
                    if (refSav == "Add")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        //系统参数  自动审核
                        string sReturn = "";
                        if (oSystemParameter.ShowBill(ref sReturn) == true)
                        {
                            if (oSystemParameter.omodel.Sb_EquipBeginBill_AutoCheck == "Y") //系统参数  自动审核
                            {
                                objJsonResult.Verify = "Y";
                            }
                            else
                            {
                                objJsonResult.Verify = "N";
                            }
                        }
                    }
                    else
                    if (refSav == "Update")
                    {
                        objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID
                        objJsonResult.Verify = "N";
                    }
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -347,15 +372,49 @@
                oCN.BeginTran();
                oCN.RunProc("delete from Sb_EquipBeginBillMain where HInterID = " + HInterID);
                BillOld.MvarItemKey = "Sb_EquipBeginBillMain";
                //删除前控制=========================================
                string sql1 = "exec h_p_Sb_EquipBeginBill_BeforeDelCtrl " + HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipBeginBill_BeforeDelCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //==================================================================================
                bool IsDete = BillOld.DeleteBill(Convert.ToInt32(HInterID), BillOld.omodel.HBillNo, "h_p_Sb_EquipBeginBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                //oCN.RunProc("delete from Sb_EquipBeginBillMain where HInterID = " + HInterID);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
                if (IsDete)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
@@ -439,8 +498,32 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //审核单据
                        if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        //审核前控制=========================================
                        string sql1 = "exec h_p_Sb_EquipBeginBill_BeforeCheckCtrl " + HInterID + ",'','" + user + "'";
                        ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipBeginBill_BeforeCheckCtrl");
                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                        //==================================================================================
                        if (!BillOld.CheckBill(int.Parse(HInterID), "", "h_p_Sb_EquipBeginBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
@@ -482,12 +565,34 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反审核单据
                        if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        //反审核前控制=========================================
                        string sql1 = "exec h_p_Sb_EquipBeginBill_BeforeUnCheckCtrl " + HInterID + ",'','" + user + "'";
                        ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipBeginBill_BeforeUnCheckCtrl");
                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //===========================================================
                        if (!BillOld.AbandonCheck(int.Parse(HInterID), "", "h_p_Sb_EquipBeginBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -498,7 +603,7 @@
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.Message = "审核成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
@@ -507,7 +612,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.Message = "审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -586,15 +691,47 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //关闭单据
                        if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        string sql2 = "";
                        //关闭前控制===============================================Begin===================================================================
                        sql2 = "exec h_p_Sb_EquipBeginBill_BeforeCloseCtrl " + HInterID + ",'','" + user + "'";
                        ds = oCN.RunProcReturn(sql2, "h_p_Sb_EquipBeginBill_BeforeCloseCtrl");
                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.count = 0;
                            objJsonResult.Message = "关闭失败!原因:关闭前前判断失败,无返回信息,请与网络管理人员联系";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //关闭前控制===============================================End===================================================================
                        //关闭提交
                        if (BillOld.CloseBill(Convert.ToInt32(HInterID),"", "h_p_Sb_EquipBeginBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                        {
                            objJsonResult.code = "1";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "关闭成功";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
@@ -629,15 +766,48 @@
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反关闭单据
                        if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                        string sql2 = "";
                        //反关闭前控制===============================================Begin===================================================================
                        sql2 = "exec h_p_Sb_EquipBeginBill_BeforeUnCloseCtrl " + HInterID + ",'','" + user + "'";
                        ds = oCN.RunProcReturn(sql2, "h_p_Sb_EquipBeginBill_BeforeUnCloseCtrl");
                        if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                            objJsonResult.count = 0;
                            objJsonResult.Message = "反关闭失败!原因:反关闭前前判断失败,无返回信息,请与网络管理人员联系";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        //反关闭前控制===============================================End===================================================================
                        //反关闭提交
                        if (BillOld.CancelClose(Convert.ToInt32(HInterID), "", "h_p_Sb_EquipBeginBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                        {
                            objJsonResult.code = "1";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "反关闭成功";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                        else
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }