| | |
| | | using System.Web.Http; |
| | | using System.Windows.Forms; |
| | | using WebAPI.Models; |
| | | using Newtonsoft.Json; |
| | | using System.Collections.Generic; |
| | | |
| | | //using Excel = Microsoft.Office.Interop.Excel; |
| | | |
| | | |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | DAL.ClsGy_SOPBill oBill = new DAL.ClsGy_SOPBill(); |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"]; |
| | | |
| | | public DataGridView grdMain = new System.Windows.Forms.DataGridView(); |
| | | |
| | |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_SOPBillList order by hmainid ", "h_v_Gy_SOPBillList"); |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_SOPBillList order by hmainid desc ", "h_v_Gy_SOPBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_Gy_SOPBillList where 1 = 1 "; |
| | | string sql = sql1 + sWhere + " order by hmainid "; |
| | | string sql = sql1 + sWhere + " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_SOPBillList"); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// ä½ä¸æå¯¼ä¹¦å é¤ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Gy_SOPBill/Del")] |
| | | [HttpGet] |
| | | public object Del(string hmainid, string hsubid, string user) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | //å 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_SOPBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (string.IsNullOrWhiteSpace(hmainid)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "èµæå
ç 为空ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran();//å¼å§äºå¡ |
| | | ds = oCN.RunProcReturn("select * from Gy_SOPBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid, "Gy_SOPBillSub"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ²¡ææ°æ®ï¼æ æ³å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | |
| | | oCN.RunProc("delete Gy_SOPBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid); |
| | | oCN.RunProc("delete Gy_SOPBillSub2 where HInterID=" + hmainid + " and HEntryID=" + hsubid); |
| | | oCN.Commit();//æäº¤äºå¡ |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä½ä¸æå¯¼ä¹¦å 餿åï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å é¤å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #region å¼åº |
| | | [Route("Gy_SOPBill/SetExcel")] |
| | | [HttpGet] |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | // |
| | | private Int32 Fun_GetCol(string sCol) |
| | | { |
| | |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn(sWhere, "WindowPrint"); |
| | | List<object> columnNameList = new List<object>(); |
| | | //客æ·å¶å® |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "ä¹ä¸") |
| | | { |
| | | if (ds.Tables[0].Columns.Count > 8) { |
| | | LogService.CustomWriteLog("åæ®å·:"+ ds.Tables[0].Rows[0][7].ToString(),"CS"+ DateTime.Now.ToString("yyyyMMdd")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //æ·»å åå |
| | | 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.Message = "[0000-1-037]Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-038]Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å¯¹æ°æ®åºè¿è¡æä½ |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Gy_SOPBillList/UpDelSQL")] |
| | | [HttpGet] |
| | | public object UpDelSQL(string sWhere) |
| | | { |
| | | try |
| | | { |
| | | oCN.BeginTran(); |
| | | oCN.RunProc(sWhere); |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |