1
wangyi
5 天以前 fd6dfca81f21e5b246ac1568532838d25d0002f8
WebAPI/Controllers/Sc_MouldRepairInBillListController.cs
@@ -768,13 +768,17 @@
        {
            try
            {
                LogService.Write("1");
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                LogService.Write("2");
                string HBeginDate = dic["HBeginDate"].ToString();//开始日期
                LogService.Write("3"+ HBeginDate);
                string HEndDate = dic["HEndDate"].ToString();//结束日期
                LogService.Write("4" + HEndDate);
                string HMouldNo = dic["HMouldNo"].ToString();//模具编码
                LogService.Write("5" + HMouldNo);
                string HName = dic["HName"].ToString();//模具名称
                LogService.Write("6" + HName);
                ds = oCN.RunProcReturn("exec h_P_Sc_MouldLifeUsePicReport '" + HBeginDate + "'," + HEndDate + ",'" + HMouldNo + "','" + HName + "'", "h_P_Sc_MouldLifeUsePicReport");
                List<object> columnNameList = new List<object>();
@@ -6302,19 +6306,20 @@
                //==================================================================================  
                bool IsDete = oBill.DeleteBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_MouldConkBookBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                var oDelDs = oCn.RunProcReturn($"exec h_p_Sc_MouldConkBookBill_AfterDelCtrl {lngBillKey},{oBill.omodel.HBillNo}, {user}, {oBill.omodel.HMouldID}", "h_p_Sc_MouldConkBookBill_AfterDelCtrl");
                if (!IsDete || oDelDs == null)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
@@ -9475,6 +9480,7 @@
        public object CheckSc_MouldDotCheckPlanBill(string HInterID, int Type, string user)
        {
            DAL.ClsSc_MouldDotCheckPlanBill BillOld = new DAL.ClsSc_MouldDotCheckPlanBill();
            oCN.BeginTran();//开始事务
            try
            {
                //判断是否有审核权限
@@ -9484,6 +9490,7 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限审核!";
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
@@ -9493,11 +9500,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 +9515,7 @@
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (BillOld.omodel.HDeleteMan.Trim() != "")
@@ -9516,6 +9524,7 @@
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (Type == 1)  //审核判断
@@ -9526,6 +9535,7 @@
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                    }
@@ -9537,6 +9547,7 @@
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            oCN.RollBack();
                            return objJsonResult;
                        }
                    }
@@ -9547,6 +9558,7 @@
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    oCN.RollBack();
                    return objJsonResult;
                }
@@ -9559,7 +9571,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 +9581,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 +9592,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 +9607,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 +9628,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 +9652,7 @@
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();