1
zrg
5 天以前 da4b0a4e9a171b46d08beb45aa2b2ac7f7e3b12e
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -9479,6 +9479,7 @@
        public object CheckSc_MouldDotCheckPlanBill(string HInterID, int Type, string user)
        {
            DAL.ClsSc_MouldDotCheckPlanBill BillOld = new DAL.ClsSc_MouldDotCheckPlanBill();
            oCN.BeginTran();//开始事务
            try
            {
                //判断是否有审核权限
@@ -9488,6 +9489,7 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
@@ -9497,11 +9499,11 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
                ClsPub.CurUserName = user;
                oCN.BeginTran();//开始事务
                //查看是否已审核,关闭,作废
                if (BillOld.ShowBill(Convert.ToInt32(HInterID), ref DBUtility.ClsPub.sExeReturnInfo))
@@ -9512,6 +9514,7 @@
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (BillOld.omodel.HDeleteMan.Trim() != "")
@@ -9520,6 +9523,7 @@
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (Type == 1)  //审核判断
@@ -9530,6 +9534,7 @@
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                    }
@@ -9541,6 +9546,7 @@
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                    }
@@ -9551,6 +9557,7 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
@@ -9563,7 +9570,7 @@
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
@@ -9573,7 +9580,7 @@
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
@@ -9584,14 +9591,12 @@
                    if (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldDotCheckPlanBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //自动生成点检计划单
                    oCN.RunProc("exec h_p_Sc_MouldDotCheckPlan_Auto " + HInterID);
                }
                else
                {
@@ -9601,18 +9606,20 @@
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.count = 0;
                        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.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //===========================================================         
@@ -9620,14 +9627,20 @@
                    if (!BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldDotCheckPlanBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }                    
                }
                oCN.Commit();//提交事务
                if (Type == 1)
                {
                    // 在提交事务后再尝试生成器具点检计划单 预防死锁
                    oCN.RunProc("exec h_p_Sc_MouldDotCheckPlan_Auto " + HInterID);
                }
                objJsonResult.code = "0";
                objJsonResult.count = 1;
@@ -9638,6 +9651,7 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();