yusijie
7 天以前 8a0e28f065e7414bef9386ed35b381a10bbabdc5
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -9475,6 +9475,7 @@
        public object CheckSc_MouldDotCheckPlanBill(string HInterID, int Type, string user)
        {
            DAL.ClsSc_MouldDotCheckPlanBill BillOld = new DAL.ClsSc_MouldDotCheckPlanBill();
            oCN.BeginTran();//开始事务
            try
            {
                //判断是否有审核权限
@@ -9484,6 +9485,7 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
@@ -9493,11 +9495,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))
@@ -9508,6 +9510,7 @@
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (BillOld.omodel.HDeleteMan.Trim() != "")
@@ -9516,6 +9519,7 @@
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (Type == 1)  //审核判断
@@ -9526,6 +9530,7 @@
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                    }
@@ -9537,6 +9542,7 @@
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                    }
@@ -9547,6 +9553,7 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
@@ -9559,7 +9566,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();
@@ -9569,7 +9576,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();
@@ -9580,14 +9587,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
                {
@@ -9597,18 +9602,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;
                    }
                    //===========================================================         
@@ -9616,14 +9623,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;
@@ -9634,6 +9647,7 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();