wtt
3 天以前 e7ef7f02094dbfc44950cb5bb363b95f0c77c57a
WebAPI/Controllers/»ªÔ¶datamapping/Gy_PNLInfoController.cs
@@ -582,7 +582,9 @@
                sb.Append("HRowCount=N'" + list[0].HRowCount + "',");
                sb.Append("HColCount=N'" + list[0].HColCount + "',");
                sb.Append("HPNLPosition_x=N'" + list[0].HPNLPosition_x + "',");
                sb.Append("HPNLPosition_y=N'" + list[0].HPNLPosition_y + "'");
                sb.Append("HPNLPosition_y=N'" + list[0].HPNLPosition_y + "',");
                sb.Append("HModifyMan=N'" + msg4 + "',");
                sb.Append("HModifyDate=getdate()");
                sb.Append(" where HInterID=N'" + list[0].HInterID + "'");
                string sql1 = sb.ToString();
                oCN.RunProcReturn(sql1, "Gy_PNLInfo");
@@ -646,7 +648,7 @@
                // å­è¡¨åˆ é™¤
                string delWhereStr = "(" + string.Join(",", delEntryIDList.ToArray()) + ")";
                string sql2 = "Delete from Gy_PNLInfoSub where HEntryID in " + delWhereStr;
                //LogService.Write("执行SQL语句:" + sql2);
                LogService.Write("执行SQL语句:" + sql2);
                oCN.RunProcReturn(sql2, "Gy_PNLInfoSub");
@@ -656,9 +658,9 @@
                // åˆ¤æ–­æ˜¯å¦æœ‰set码或者PCS码重复的部分
                ds = oCN.RunProcReturn("select top 1 HEntryID from Gy_PNLInfoSub where HSetNo in " + HSetNoInStr
                    + "AND HPCSNo in " + HPCSNoInStr, "Gy_PNLInfoSub");
                //LogService.Write("执行 SQL è¯­å¥: select top 1 HEntryID from Gy_PNLInfoSub where HSetNo in " + HSetNoInStr
                //    + "AND HPCSNo in " + HPCSNoInStr);
                    + " AND HPCSNo in " + HPCSNoInStr + "and HInterID = " + list[0].HInterID , "Gy_PNLInfoSub");
                LogService.Write("执行 SQL è¯­å¥: select top 1 HEntryID from Gy_PNLInfoSub where HSetNo in " + HSetNoInStr
                    + " AND HPCSNo in " + HPCSNoInStr + "and HInterID = " + list[0].HInterID);
                if (ds.Tables[0].Rows.Count > 0)
                {
@@ -720,6 +722,367 @@
                return objJsonResult;
            }
        }
    #endregion
        #endregion
        #region å®¡æ ¸PNL布局
        [Route("Gy_PNLInfoController/CheckBill")]
        [HttpGet]
        public object CheckBill(int HInterID, string user, int IsAudit)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PNLInfo_Check", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select top 1 HCheckMan from Gy_PNLInfo  where HInterID=" + HInterID, "Gy_PNLInfo");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsAudit == 0)  //审核判断
                    {
                        if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["HCheckMan"].ToString()) != true)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["HCheckMan"].ToString()) == true)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsAudit == 0)  //审核判断
                {
                    //审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_PNLInfo set HCheckMan='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID);
                    //审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeUnCheckCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_PNLInfo set HCheckMan='',HCheckDate=null where HInterID=" + HInterID);
                    //反审核后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterUnCheckCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反审核成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region ç¦ç”¨PNL布局
        [Route("Gy_PNLInfoController/StopBill")]
        [HttpGet]
        public object StopBill(int HInterID, string user, int IsStop)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_PNLInfo_Stop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select top 1 HStopMan from Gy_PNLInfo where HInterID=" + HInterID, "Gy_PNLInfo");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopMan"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopMan"].ToString() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未禁用!不需要反禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();
                if (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_PNLInfo set HStopMan='" + user + "',HStopDate=getdate() where HInterID=" + HInterID);
                    //禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeUnStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeUnStopCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("update Gy_PNLInfo set HStopMan='',HStopDate=null where HInterID=" + HInterID);
                    //反禁用后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterUnStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterUnStopCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "禁用失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "反禁用成功";
                    objJsonResult.data = null;
                }
                oCN.Commit();
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}