| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检计划单分页列表 |
| | | [Route("Sc_MouldDotCheckPlanBill/page")] |
| | | [HttpGet] |
| | | public object Sc_MouldDotCheckPlanBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckPlanBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheckPlanBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldDotCheckPlanBillList_Query"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldDotCheckPlanBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldDotCheckPlanBillList_Query"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = CodeConstant.SUCCEED; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 模具点检记录表列表 |
| | | /// </summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具保养计划分页列表 |
| | | [Route("Sc_MouldMaintainPlanBill/page")] |
| | | [HttpGet] |
| | | public object Sc_MouldMaintainPlanBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainPlanBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintainPlanBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldMaintainPlanBillList_Query"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintainPlanBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldMaintainPlanBillList_Query"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = CodeConstant.SUCCEED; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 模具故障登记表列表 |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 器具寿命耗用分析报表 |
| | | |
| | | /// <summary> |
| | | /// 器具寿命耗用分析报表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldRepairInBillList/Get_Sc_MouldLifeUsePicReport_list")] |
| | | [HttpGet] |
| | | public object Get_Sc_MouldLifeUsePicReport_list(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | |
| | | Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere); |
| | | |
| | | string HBeginDate = dic["HBeginDate"].ToString();//开始日期 |
| | | string HEndDate = dic["HEndDate"].ToString();//结束日期 |
| | | string HMouldNo = dic["HMouldNo"].ToString();//模具编码 |
| | | string HName = dic["HName"].ToString();//模具名称 |
| | | |
| | | ds = oCN.RunProcReturn("exec h_P_Sc_MouldLifeUsePicReport '" + HBeginDate + "'," + HEndDate + ",'" + HMouldNo + "','" + HName + "'", "h_P_Sc_MouldLifeUsePicReport"); |
| | | List<object> columnNameList = new List<object>(); |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString)); //获取到DataColumn列对象的列名 |
| | | } |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | //} |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "返回报表信息失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 获取模具寿命 |
| | | [Route("Sc_MouldRepairInBillList/Get_HMouldLifeUsePic")] |
| | | [HttpGet] |
| | | public object Get_HMouldLifeUsePic(string HItemID) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFile_Life where HInterID="+ HItemID, "h_v_Gy_MouldFile_Life"); |
| | | |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sb_MouldRepairWorkBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sb_MouldRepairWorkBill_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_MouldRepairWorkBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | if (IsAudit == 0) //审核提交 |
| | | { |
| | | //审核提交 |
| | | if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sb_MouldRepairWorkBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sb_MouldRepairWorkBill_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核成功"; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Sb_MouldRepairWorkBill_AfterCheckCtrl", CurUserName, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反审核提交 |
| | | { |
| | | //反审核提交AbandonCheck |
| | | if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sb_MouldRepairWorkBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sb_MouldRepairWorkBill_BeforeUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核成功"; |
| | | 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; |
| | | } |
| | | else |
| | | //=========================================================== |
| | | |
| | | if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Sb_MouldRepairWorkBill_AfterUnCheckCtrl", CurUserName, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具维修记录单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sb_MouldRepairWorkBill/CloseSb_MouldRepairWorkBill")] |
| | | [HttpGet] |
| | | public object CloseSb_MouldRepairWorkBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sb_MouldRepairWorkBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSb_MouldRepairWorkBill oBill = new DAL.ClsSb_MouldRepairWorkBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sb_MouldRepairWorkBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sb_MouldRepairWorkBill_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, oBill.omodel.HBillNo, "h_p_Sb_MouldRepairWorkBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sb_MouldRepairWorkBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sb_MouldRepairWorkBill_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, oBill.omodel.HBillNo, "h_p_Sb_MouldRepairWorkBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具维修记录单保存/编辑 |
| | | /// <summary> |
| | |
| | | public object DeltetMouldRepairCheckBill(string HInterID,string user) |
| | | { |
| | | //编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBill_Delete", 1, false, user)) |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairCheckBill_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldRepairCheckBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldRepairCheckBill_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_Sc_MouldRepairCheckBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未找到"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具维修验收单 审核/反审核功能 |
| | | [Route("Sc_MouldRepairCheckBill/CheckSc_MouldRepairCheckBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldRepairCheckBill(string HInterID, int Type, string user) |
| | | { |
| | | DAL.ClsSc_MouldRepairCheckBill BillOld = new DAL.ClsSc_MouldRepairCheckBill(); |
| | | try |
| | | { |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairCheckBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //查看是否已审核,关闭,作废 |
| | | if (BillOld.ShowBill(Convert.ToInt32(HInterID), ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (BillOld.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (BillOld.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (Type == 1) //审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (Type == 2) //反审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldRepairCheckBill_BeforeCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldRepairCheckBill_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 (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldRepairCheckBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldRepairCheckBill_BeforeUnCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldRepairCheckBill_BeforeUnCheckCtrl"); |
| | | 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; |
| | | } |
| | | //=========================================================== |
| | | |
| | | if (!BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldRepairCheckBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具维修验收单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldRepairCheckBill/CloseSc_MouldRepairCheckBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldRepairCheckBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldRepairCheckBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldRepairCheckBill oBill = new DAL.ClsSc_MouldRepairCheckBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldRepairCheckBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldRepairCheckBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldRepairCheckBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldRepairCheckBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldRepairCheckBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldRepairCheckBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldConkBookBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldConkBookBill_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_Sc_MouldConkBookBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未找到"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检记录单 审核/反审核功能 |
| | | [Route("Sc_MouldConkBookBill/CheckSc_MouldConkBookBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldConkBookBill(string HInterID, int Type, string user) |
| | | { |
| | | DAL.ClsSc_MouldConkBookBill BillOld = new DAL.ClsSc_MouldConkBookBill(); |
| | | try |
| | | { |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldConkBookBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //查看是否已审核,关闭,作废 |
| | | if (BillOld.ShowBill(Convert.ToInt32(HInterID), ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (BillOld.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (BillOld.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (Type == 1) //审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (Type == 2) //反审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldConkBookBill_BeforeCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldConkBookBill_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 (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldConkBookBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldConkBookBill_BeforeUnCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldConkBookBill_BeforeUnCheckCtrl"); |
| | | 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; |
| | | } |
| | | //=========================================================== |
| | | |
| | | if (!BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldConkBookBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检计划单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldConkBookBill/CloseSc_MouldConkBookBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldConkBookBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldConkBookBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldConkBookBill oBill = new DAL.ClsSc_MouldConkBookBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldConkBookBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldConkBookBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldConkBookBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldConkBookBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldConkBookBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldConkBookBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | 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_Sc_MouldMaintainPlanBillList where hmainid= " + HID + " ", "h_v_Sc_MouldMaintainPlanBillList"); |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldMaintainPlanBill_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldMaintainPlanBill_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 }; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldMaintainPlanBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainPlanBill_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, BillOld.omodel.HBillNo, "h_p_Sc_MouldMaintainPlanBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | lsmain = oListModels.getObjectByJson_Sc_MouldMaintainBillMain(msg2); |
| | | foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain) |
| | | { |
| | | oItem.HMaker = msg5; |
| | | UserName = oItem.HMaker; //制单人 |
| | | DBUtility.ClsPub.CurUserName = msg5; |
| | | oItem.HBillType = "3819"; |
| | | oItem.HBillSubType = "3819"; |
| | | |
| | | //oItem.HInterID =0; |
| | | //oItem.HBillNo = ""; |
| | | |
| | | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --日期 |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | //oItem.HMakeDate = ""; |
| | | //oItem.HYear = ""; |
| | | //oItem.HPeriod = ""; |
| | | //oItem.HRemark = ""; |
| | | //oItem.HCycleUnit = ""; |
| | | //oItem.HCheckCycle = ""; |
| | | //oItem.HBeginDate = ""; |
| | | //oItem.HEndDate = ""; |
| | | //oItem.HInnerBillNo = ""; |
| | | //oItem.HExplanation = ""; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具保养记录 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldMaintainBill/CloseSc_MouldMaintainBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldMaintainBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldMaintainBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldMaintainBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldMaintainBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 模具点检记录表 |
| | |
| | | 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_Sc_MouldDotCheckBillList where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckBillList"); |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldDotCheckBillMain_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckBillMain_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 }; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldDotCheckBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldDotCheckBill_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_Sc_MouldDotCheckBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检记录单 审核/反审核功能 |
| | | [Route("Sc_MouldDotCheckBill/CheckSc_MouldDotCheckBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldDotCheckBill(string HInterID, int Type, string user) |
| | | { |
| | | DAL.ClsSc_MouldDotCheckBill BillOld = new DAL.ClsSc_MouldDotCheckBill(); |
| | | try |
| | | { |
| | | //判断是否有审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //查看是否已审核,关闭,作废 |
| | | if (BillOld.ShowBill(Convert.ToInt32(HInterID), ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (BillOld.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (BillOld.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (Type == 1) //审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (Type == 2) //反审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldDotCheckBill_BeforeCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldDotCheckBill_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 (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldDotCheckBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //自动生成点检计划单 |
| | | oCN.RunProc("exec h_p_Sc_MouldDotCheckPlan_Auto " + HInterID); |
| | | } |
| | | else |
| | | { |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldDotCheckBill_BeforeUnCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldDotCheckBill_BeforeUnCheckCtrl"); |
| | | 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; |
| | | } |
| | | //=========================================================== |
| | | |
| | | if (!BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldDotCheckBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检计划单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldDotCheckPlanBill/CloseSc_MouldDotCheckPlanBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldDotCheckPlanBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldDotCheckPlanBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldDotCheckBill oBill = new DAL.ClsSc_MouldDotCheckBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldDotCheckPlanBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldDotCheckPlanBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldDotCheckPlanBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldDotCheckPlanBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldDotCheckPlanBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldDotCheckPlanBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | 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_Sc_MouldDotCheckPlanBillList where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckPlanBillList"); |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldDotCheckPlanBillMain_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckPlanBillMain_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 }; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldDotCheckPlanBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldDotCheckPlanBill_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_Sc_MouldDotCheckPlanBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //查看是否已审核,关闭,作废 |
| | | if (BillOld.ShowBill(Convert.ToInt32(HInterID), ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (BillOld.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (BillOld.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (Type == 1) //审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (Type == 2) //反审核判断 |
| | | { |
| | | if (BillOld.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldDotCheckPlanBill_BeforeCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldDotCheckPlanBill_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 (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldDotCheckPlanBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //自动生成点检计划单 |
| | | oCN.RunProc("exec h_p_Sc_MouldDotCheckPlan_Auto " + HInterID); |
| | | } |
| | | else |
| | | { |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldDotCheckPlanBill_BeforeUnCheckCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldDotCheckPlanBill_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 (!BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Sc_MouldDotCheckPlanBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具点检记录单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldDotCheckBill/CloseSc_MouldDotCheckBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldDotCheckBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldDotCheckBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldDotCheckPlanBill oBill = new DAL.ClsSc_MouldDotCheckPlanBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldDotCheckBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldDotCheckBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldDotCheckBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldDotCheckBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldDotCheckBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldDotCheckBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (flag == 1) |
| | | { |
| | | if (oBill.omodel.HBillStatus == 2) |
| | |
| | | } |
| | | else |
| | | { |
| | | if (oBill.omodel.HBillStatus == 1) |
| | | if (oBill.omodel.HBillStatus != 2) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具处理出库单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldScrapOutHouseBill/CloseSc_MouldScrapOutHouseBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldScrapOutHouseBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldScrapOutBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | //关闭提交 |
| | | if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | //反关闭提交 |
| | | if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | try |
| | | { |
| | | Log.LogInfo("成功!"); //记录提交数据 |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBillList", 1, false, user)) |
| | |
| | | ds = new SQLHelper.ClsCN().RunProcReturn(sql, "h_p_Sc_MouldProdBackBillList_Query"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" }; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdBackBillList where hmainid= " + HID + " ", "h_v_Sc_MouldProdBackBillList"); |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdBackBill_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldProdBackBill_Edit"); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "不存在退库单号" }; |
| | | |
| | |
| | | ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,收料仓库ID HWHID, 收料仓库代码 HWHCode, 收料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdBackBillList"), "h_v_Sc_MouldProdBackBillList"); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdBackBill_Edit"), "h_v_Sc_MouldProdBackBill_Edit"); |
| | | |
| | | } |
| | | else |
| | |
| | | string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,收料仓库ID HWHID, 收料仓库代码 HWHCode, 收料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdBackBillList where 1 = 1 "); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdBackBill_Edit where 1 = 1 "); |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList"); |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdBackBill_Edit"); |
| | | |
| | | } |
| | | //查汇总 |
| | | ds1 = oCN.RunProcReturn(string.Format(@"select 物料代码,max(物料名称)物料名称,规格型号,max(单据号)单据号,批次,sum(实发数量)实发数量, |
| | | 收料仓库ID,max(收料仓库代码)收料仓库代码,max(收料仓库)收料仓库,表体备注 from h_v_Sc_MouldProdBackBillList |
| | | where 1=1 " + sqlWhere + " group by 物料代码,规格型号,收料仓库ID,批次,表体备注"), "h_v_Sc_MouldProdBackBillList"); |
| | | 收料仓库ID,max(收料仓库代码)收料仓库代码,max(收料仓库)收料仓库,表体备注 from h_v_Sc_MouldProdBackBill_Edit |
| | | where 1=1 " + sqlWhere + " group by 物料代码,规格型号,收料仓库ID,批次,表体备注"), "h_v_Sc_MouldProdBackBill_Edit"); |
| | | |
| | | list.Add(ds.Tables[0]); |
| | | list.Add(ds1.Tables[0]); |
| | |
| | | // swhere = swhere + ds.Tables[0].Rows[i]["HMaterID"].ToString()+","; |
| | | //} |
| | | //swhere = swhere.Substring(0, swhere.Length - 1); |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldProdBackBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldProdBackBill_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(oBill.omodel.HInterID,oBill.omodel.HBillNo, "h_p_Sc_MouldProdBackBill_AfterDelCtrl",user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | //删除成功修改器具档案位置 |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); |
| | | DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (flag == 1) |
| | | { |
| | | if (oBill.omodel.HBillStatus == 2) |
| | |
| | | } |
| | | else |
| | | { |
| | | string HCheckDate = DateTime.Now.Date.ToString(); |
| | | oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker='" + user + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='3803' and HInterID=" + HInterID); |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldProdBackBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldProdBackBill_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 (!oBill.CheckBill(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sc_MouldProdBackBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //string HCheckDate = DateTime.Now.Date.ToString(); |
| | | //oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker='" + user + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='3803' and HInterID=" + HInterID); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核成功!"; |
| | |
| | | } |
| | | else |
| | | { |
| | | if (oBill.omodel.HBillStatus == 1) |
| | | if (oBill.omodel.HBillStatus != 2) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | else |
| | | { |
| | | string HCheckDate = DateTime.Now.Date.ToString(); |
| | | oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker=' ',HCheckDate=' ',HBillStatus=1 Where HBillType='3803' and HInterID=" + HInterID); |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldProdBackBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldProdBackBill_BeforeUnCheckCtrl"); |
| | | 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; |
| | | } |
| | | //=========================================================== |
| | | |
| | | if (!oBill.AbandonCheck(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sc_MouldProdBackBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //string HCheckDate = DateTime.Now.Date.ToString(); |
| | | //oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker=' ',HCheckDate=' ',HBillStatus=1 Where HBillType='3803' and HInterID=" + HInterID); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核成功!"; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具领用退库单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldProdBackBill/CloseSc_MouldProdBackBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldProdBackBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldProdBackBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldProdBackBill oBill = new DAL.ClsSc_MouldProdBackBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldProdBackBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldProdBackBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldProdBackBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldProdBackBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldProdBackBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldProdBackBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 模具领用单 |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdOutBillList", 1, false, user)) |
| | | { |
| | |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldProdOutHouseBillList_Query"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" }; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdOutHouseBillList where hmainid= " + HID + " ", "h_v_Sc_MouldProdOutHouseBillList"); |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdOutHouseBill_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldProdOutHouseBill_Edit"); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "不存在退库单号" }; |
| | | |
| | |
| | | ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdOutHouseBillList"), "h_v_Sc_MouldProdOutHouseBillList"); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdOutHouseBill_Edit"), "h_v_Sc_MouldProdOutHouseBill_Edit"); |
| | | |
| | | } |
| | | else |
| | |
| | | string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdOutHouseBillList where 1 = 1 "); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdOutHouseBill_Edit where 1 = 1 "); |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBillList"); |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBill_Edit"); |
| | | } |
| | | //查汇总 |
| | | ds1 = oCN.RunProcReturn(string.Format(@"select 物料代码,max(物料名称)物料名称,规格型号,max(单据号)单据号,批次,sum(实发数量)实发数量, |
| | | HWHSonID,max(发料仓库代码)发料仓库代码,max(发料仓库)发料仓库,表体备注 from h_v_Sc_MouldProdOutHouseBillList |
| | | where 1=1 " + sqlWhere + " group by 物料代码,规格型号,HWHSonID,批次,表体备注"), "h_v_Sc_MouldProdOutHouseBillList"); |
| | | HWHSonID,max(发料仓库代码)发料仓库代码,max(发料仓库)发料仓库,表体备注 from h_v_Sc_MouldProdOutHouseBill_Edit |
| | | where 1=1 " + sqlWhere + " group by 物料代码,规格型号,HWHSonID,批次,表体备注"), "h_v_Sc_MouldProdOutHouseBill_Edit"); |
| | | |
| | | list.Add(ds.Tables[0]); |
| | | list.Add(ds1.Tables[0]); |
| | |
| | | // swhere = swhere + ds.Tables[0].Rows[i]["HMaterID"].ToString() + ","; |
| | | //} |
| | | //swhere = swhere.Substring(0, swhere.Length - 1); |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldProdOutBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldProdOutBill_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(oBill.omodel.HInterID,oBill.omodel.HBillNo, "h_p_Sc_MouldProdOutBill_AfterDelCtrl",user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (IsDete) |
| | | { |
| | | //删除成功修改器具档案位置 |
| | |
| | | DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (flag == 1) |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HBillStatus == 2) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | else |
| | | { |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldProdOutBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldProdOutBill_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; |
| | | } |
| | | //================================================================================== |
| | | |
| | | string HCheckDate = DateTime.Now.Date.ToString(); |
| | | oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker='" + user + "',HCheckDate='" + HCheckDate + "',HBillStatus=2 Where HBillType='3802' and HInterID=" + HInterID); |
| | | |
| | | //审核后控制========================================= |
| | | string sql2 = "exec h_p_Sc_MouldProdOutBill_AfterCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Sc_MouldProdOutBill_AfterCheckCtrl"); |
| | | 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; |
| | | } |
| | | //================================================================================== |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核成功!"; |
| | |
| | | } |
| | | else |
| | | { |
| | | if (oBill.omodel.HBillStatus == 1) |
| | | if (oBill.omodel.HBillStatus != 2) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | } |
| | | else |
| | | { |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldProdOutBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldProdOutBill_BeforeUnCheckCtrl"); |
| | | 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; |
| | | } |
| | | //=========================================================== |
| | | |
| | | string HCheckDate = DateTime.Now.Date.ToString(); |
| | | oCn.RunProc(" Update Sc_MouldStockBillMain set HChecker=' ',HCheckDate=' ',HBillStatus=1 Where HBillType='3802' and HInterID=" + HInterID); |
| | | |
| | | //反审核前控制========================================= |
| | | string sql2 = "exec h_p_Sc_MouldProdOutBill_AfterUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Sc_MouldProdOutBill_AfterUnCheckCtrl"); |
| | | 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; |
| | | } |
| | | //=========================================================== |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核成功!"; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具领用出库单 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldProdOutBill/CloseSc_MouldProdOutBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldProdOutBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldProdOutBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldProdOutBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldProdOutBill_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,oBill.omodel.HBillNo, "h_p_Sc_MouldProdOutBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldProdOutBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldProdOutBill_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,oBill.omodel.HBillNo, "h_p_Sc_MouldProdOutBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 模具寿命调整单 |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 器具寿命调整单分页列表 |
| | | [Route("Sc_MouldLifeChangeBill/page")] |
| | | [HttpGet] |
| | | public object Sc_MouldLifeChangeBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeChangeBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBillList_Query " + page + "," + size + ",''", "h_p_Sc_MouldLifeChangeBillList_Query"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldLifeChangeBillList_Query"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = CodeConstant.SUCCEED; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region[模具寿命调整单编辑时获取表头数据] |
| | | [Route("Sc_MouldLifeChangeBill/Sc_GetMouldLifeChangeBillListCheckDetai")] |
| | | [HttpGet] |
| | |
| | | return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" }; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldLifeChangeBillList where hmainid= " + HID + " ", "h_v_Sc_MouldLifeChangeBillList"); |
| | | var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldLifeChangeBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldLifeChangeBillList_Edit"); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "不存在退库单号" }; |
| | | |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldLifeChangeBill_BeforeDelCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldLifeChangeBill_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_Sc_MouldLifeChangeBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | if (IsDete) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具寿命调整 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldLifeChangeBill/CloseSc_MouldLifeChangeBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldLifeChangeBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldLifeChangeBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldLifeChangeBill oBill = new DAL.ClsSc_MouldLifeChangeBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldLifeChangeBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCn.RunProcReturn(sql, "h_p_Sc_MouldLifeChangeBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldLifeChangeBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldLifeChangeBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCn.RunProcReturn(sql, "h_p_Sc_MouldLifeChangeBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldLifeChangeBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | #region 器具保养计划单审核/反审核功能 |
| | |
| | | |
| | | ClsPub.CurUserName = user; |
| | | oCN.BeginTran();//开始事务 |
| | | DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); |
| | | //查看是否已审核,关闭,作废 |
| | | if (oBill.ShowBill(Convert.ToInt32(HInterID), ref DBUtility.ClsPub.sExeReturnInfo)) |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (Type == 1) //审核判断 |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (Type == 2) //反审核判断 |
| | | { |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不需要反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldMaintainPlanBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainPlanBill_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 (!BillOld.CheckBill(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainPlanBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //自动生成点检计划单 |
| | | oCN.RunProc("exec h_p_Sc_MouldMaintainPlan_Auto " + HInterID); |
| | | } |
| | | else |
| | | { |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Sc_MouldMaintainPlanBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Sc_MouldMaintainPlanBill_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 (!BillOld.AbandonCheck(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainPlanBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具保养计划 关闭/反关闭 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <param name="IsAudit">关闭(0),反关闭(1)</param> |
| | | /// <param name="CurUserName">关闭人</param> |
| | | /// <returns></returns> |
| | | [Route("Sc_MouldMaintainPlanBill/CloseSc_MouldMaintainPlanBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldMaintainPlanBill(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | string ModRightNameCheck = "Sc_MouldMaintainPlanBill_Close"; |
| | | DBUtility.ClsPub.CurUserName = CurUserName; |
| | | try |
| | | { |
| | | //检查权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //HInterID数据判断 |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); //对HInterID进行类型的转换 |
| | | DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); //实例化单据操作类,用于进行相关操作 |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不能进行关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (IsAudit == 0) //关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭判断 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未关闭!不需要反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | //进行需要进行的关闭/反关闭操作 |
| | | if (IsAudit == 0) //关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldMaintainPlanBill_BeforeCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainPlanBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainPlanBill_AfterCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //反关闭提交 |
| | | { |
| | | string sql = ""; |
| | | //反关闭前控制===============================================Begin=================================================================== |
| | | sql = "exec h_p_Sc_MouldMaintainPlanBill_BeforeUnCloseCtrl " + HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Sc_MouldMaintainPlanBill_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, oBill.omodel.HBillNo, "h_p_Sc_MouldMaintainPlanBill_AfterUnCloseCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反关闭失败!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "关闭失败或者反关闭失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region[器具保养计划表编辑时获取表体数据--保养计划] |
| | | [Route("Sc_MouldMaintainPlanBill/GetPlanList")] |
| | | [HttpGet] |