| | |
| | | using System.Windows.Forms; |
| | | using WebAPI.Models; |
| | | |
| | | namespace WebAPI.Controllers.SBGL |
| | | namespace WebAPI.Controllers |
| | | { |
| | | public class Sb_EquipStopBillController : ApiController |
| | | { |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | public DAL.ClsSb_EquipStopBillMain OBill = new DAL.ClsSb_EquipStopBillMain(); |
| | | public DAL.ClsSb_EquipStopBillMain BillOld = new DAL.ClsSb_EquipStopBillMain(); |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); //获取系统参数 |
| | | |
| | | |
| | | #region 设备停机单列表 查询 |
| | |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second("Sb_EquipStopBillMain_Check", 1, false, user)) |
| | | if (!DBUtility.ClsPub.Security_Log_second("Sb_EquipStopBillMain_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | 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 |
| | | |
| | | #region 设备停机单分页查询 |
| | | [Route("Sb_EquipStopBill/getSb_EquipStopBillListPage")] |
| | | [HttpGet] |
| | | public object Sb_EquipStopBillListPage(string sWhere, string user, int page, int size) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second("Sb_EquipStopBillMain_Query", 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_Sb_EquipStopBillMainListPage " + page + "," + size + ",''", "h_p_Sb_EquipStopBillMainListPage"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sb_EquipStopBillMainListPage " + page + "," + size + ",'" + sWhere + "'", "h_p_Sb_EquipStopBillMainListPage"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | |
| | | } |
| | | if (bResult) |
| | | { |
| | | //自动审核设置 |
| | | if (refSav == "Add") |
| | | { |
| | | objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID |
| | | //系统参数 自动审核 |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | if (oSystemParameter.omodel.Sb_EquipStopBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | objJsonResult.Verify = "Y"; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | if (refSav == "Update") |
| | | { |
| | | objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.Message = "审核成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.Message = "审核失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 设备停机单列表PDA 查询 |
| | | [Route("Sb_EquipStopBill/Sb_EquipStopBillList_PDA")] |
| | | [HttpGet] |
| | | public object Sb_EquipStopBillList_PDA(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second("Sb_EquipStopBillMain_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "查询失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Sb_EquipStopBillList_PDA order by 单据号 desc", "h_v_Sb_EquipStopBillList_PDA"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Sb_EquipStopBillList_PDA where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by 单据号 desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipStopBillList_PDA"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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 |
| | | |
| | | } |
| | | } |