zrg
2025-04-08 d54613ce0b6960dafcbd28454172f21a2d0bb6d1
WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs
@@ -736,7 +736,7 @@
            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_Sb_EquipRepairWorkBillList  where hmainid= " + HID + " ", "h_v_Sb_EquipRepairWorkBillList");
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipRepairWorkBill_Edit  where hmainid= " + HID + " ", "h_v_Sb_EquipRepairWorkBill_Edit");
            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 };
@@ -1179,7 +1179,30 @@
                    return objJsonResult;
                }
                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                //删除前控制=========================================
                string sql1 = "exec h_p_Sb_EquipRepairCheckBill_BeforeDelCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipRepairCheckBill_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 = oBill.DeleteBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sb_EquipRepairCheckBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {
                    objJsonResult.code = "0";
@@ -1884,22 +1907,86 @@
                //Type 1 关闭  2  反关闭
                if (Type == 1)
                {
                    if (!BillOld2.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    string sql = "";
                    //关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_EqpConkBookBill_BeforeCloseCtrl " + HInterID + ",'" + BillOld2.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EqpConkBookBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (BillOld2.CloseBill(Convert.ToInt32(HInterID), BillOld2.omodel.HBillNo, "h_p_Sb_EqpConkBookBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        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
                {
                    if (!BillOld2.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    string sql = "";
                    //反关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_EqpConkBookBill_BeforeUnCloseCtrl " + HInterID + ",'" + BillOld2.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EqpConkBookBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (BillOld2.CancelClose(Convert.ToInt32(HInterID), BillOld2.omodel.HBillNo, "h_p_Sb_EqpConkBookBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2093,22 +2180,86 @@
                //Type 1 关闭  2  反关闭
                if (Type == 1)
                {
                    if (!BillOld3.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    string sql = "";
                    //关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_EquipRepairWorkBill_BeforeCloseCtrl " + HInterID + ",'" + BillOld3.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipRepairWorkBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (BillOld3.CloseBill(Convert.ToInt32(HInterID), BillOld3.omodel.HBillNo, "h_p_Sb_EquipRepairWorkBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        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
                {
                    if (!BillOld3.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    string sql = "";
                    //反关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_EquipRepairWorkBill_BeforeUnCloseCtrl " + HInterID + ",'" + BillOld3.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipRepairWorkBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (BillOld3.CancelClose(Convert.ToInt32(HInterID), BillOld3.omodel.HBillNo, "h_p_Sb_EquipRepairWorkBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2166,7 +2317,31 @@
                //Type 1 审核  2  反审核
                if (Type == 1)
                {
                    if (!BillOld4.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Sb_EquipRepairCheckBill_BeforeCheckCtrl " + HInterID + ",'" + BillOld4.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipRepairCheckBill_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 (!BillOld4.CheckBill(int.Parse(HInterID), BillOld4.omodel.HBillNo, "h_p_Sb_EquipRepairCheckBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
@@ -2177,11 +2352,29 @@
                }
                else
                {
                    if (BillOld4.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Sb_EquipRepairCheckBill_BeforeUnCheckCtrl " + HInterID + ",'" + BillOld4.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipRepairCheckBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    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 (!BillOld4.AbandonCheck(int.Parse(HInterID), BillOld4.omodel.HBillNo, "h_p_Sb_EquipRepairCheckBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
@@ -2244,22 +2437,86 @@
                //Type 1 关闭  2  反关闭
                if (Type == 1)
                {
                    if (!BillOld4.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    string sql = "";
                    //关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_EquipRepairCheckBill_BeforeCloseCtrl " + HInterID + ",'" + BillOld4.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipRepairCheckBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (BillOld4.CloseBill(Convert.ToInt32(HInterID), BillOld4.omodel.HBillNo, "h_p_Sb_EquipRepairCheckBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        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
                {
                    if (!BillOld4.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    string sql = "";
                    //反关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_EquipRepairCheckBill_BeforeUnCloseCtrl " + HInterID + ",'" + BillOld4.omodel.HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipRepairCheckBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (BillOld4.CancelClose(Convert.ToInt32(HInterID), BillOld4.omodel.HBillNo, "h_p_Sb_EquipRepairCheckBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "反关闭成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -3042,8 +3299,31 @@
                //进行需要进行的关闭/反关闭操作
                if (IsAudit == 1) //关闭提交
                {
                    string sql = "";
                    //关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_CheckEqpRepairWorkBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_CheckEqpRepairWorkBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sb_CheckEqpRepairWorkBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -3062,8 +3342,31 @@
                }
                if (IsAudit == 2) //反关闭提交
                {
                    string sql = "";
                    //反关闭前控制===============================================Begin===================================================================
                    sql = "exec h_p_Sb_CheckEqpRepairWorkBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sb_CheckEqpRepairWorkBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        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 (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_Sb_CheckEqpRepairWorkBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;