| New file |
| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Converters; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using WebAPI.Models; |
| | | |
| | | namespace WebAPI.Controllers.ä»å管ç.æ¡ç åºå
¥åºè®°å½ |
| | | { |
| | | public class Kf_ICStockInOutBillController : ApiController |
| | | { |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus;//åæ®ç¶æï¼æ°å¢ï¼ä¿®æ¹ï¼æµè§ï¼æ´æ°åä»·ï¼åæ´ï¼ |
| | | |
| | | private json objJsonResult = new json(); |
| | | public DataSet ds = new DataSet(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | //åå¨è¿ç¨ æ°æ® ç±» |
| | | public class Data |
| | | { |
| | | public Data() |
| | | { |
| | | HStartDate = DateTime.Now.AddMonths(-1); |
| | | HEndDate = DateTime.Now; |
| | | BillType = "å
¨é¨"; |
| | | } |
| | | public DateTime HStartDate;//å¼å§æ¥æ |
| | | public DateTime HEndDate;//ç»ææ¥æ |
| | | public string MaterialName;//ç©æ |
| | | public string sWH;//ä»åº |
| | | public string sSP;//ä»ä½ |
| | | public string sBatchNo;//æ¹å· |
| | | public string HBarCode;//æ¡å½¢ç |
| | | public string BillType;//åæ®ç±»å |
| | | public string BillNo;//åæ®å· |
| | | public string SeOrderBillNo;//(éå®è®¢åå·) |
| | | } |
| | | |
| | | #region åºå
¥åºè®°å½æ¥è¯¢ |
| | | [Route("Kf_ICStockInOutBill/StockInOutBillList")] |
| | | [HttpGet] |
| | | public object StockInOutBillList(string sWhere) |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | try |
| | | { |
| | | var data = JsonConvert.DeserializeObject<Data>(sWhere); |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Kf_BarCodeOutInReport '" + |
| | | data.HStartDate + "','" + data.HEndDate + "','" + data.MaterialName + "','" + data.sWH + "','" + data.sSP + "','" + data.sBatchNo + "','" + data.HBarCode + "','" + data.BillType + "','" + data.BillNo + "','" + data.SeOrderBillNo |
| | | + "'", "h_p_Kf_BarCodeOutInReport"); |
| | | |
| | | 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å对象çåå |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count > 0) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = ds.Tables[0].Rows.Count; |
| | | objJsonResult.Message = "è·åèµæºç»å®æ°æ®æåï¼"; |
| | | objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" })); //åºååDataSetä¸çæ¶é´æ ¼å¼ï¼ç¶ååååºåå忥 |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ææ èµæºç»å®ï¼"; |
| | | // objJsonResult.data = null; |
| | | // objJsonResult.list = columnNameList; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = e.Message.ToString(); |
| | | objJsonResult.data = null; |
| | | objJsonResult.list = columnNameList; |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¡ç åºå
¥åºç¼å |
| | | #region æ¡ç åºå
¥åºç¼åå表 |
| | | [Route("Kf_ICStockInOutBill/GetPonderationBillMain_Temp")] |
| | | [HttpGet] |
| | | public object GetPonderationBillMain_Temp(string sWhere,string user) |
| | | { |
| | | try |
| | | { |
| | | //ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_BarCodeBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DataSet ds = new DataSet(); |
| | | string sql1 = string.Format(@"select * from h_v_KF_PonderationBillMain_Temp2 where 1=1 "); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds= oCN.RunProcReturn(sql1 + "order by HInterID desc", "h_v_KF_PonderationBillMain_Temp2"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn(sql1 + sWhere + "order by HInterID desc", "h_v_KF_PonderationBillMain_Temp2"); |
| | | } |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥è¯¢æ°æ®å¼å¸¸ï¼è¯·ä¸ç®¡çåèç³»ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "è¿åè®°å½æåï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = e.Message.ToString(); |
| | | objJsonResult.data = null; |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¡ç åºå
¥åºç¼åå é¤ |
| | | [Route("Kf_ICStockInOutBill/DelectPonderationBillMain_TempByID")] |
| | | [HttpGet] |
| | | public object DelectPonderationBillMain_TempByID(string HInterID, string user) |
| | | { |
| | | //ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_BarCodeBillList_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string s = ""; |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | if (lngBillKey == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ID为空ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DataSet ds = new DataSet(); |
| | | DataSet ds1 = new DataSet(); |
| | | ds = oCN.RunProcReturn("select * from KF_PonderationBillMain_Temp where HInterID="+ HInterID, "KF_PonderationBillMain_Temp"); |
| | | if (ds.Tables[0].Rows.Count!=0) |
| | | { |
| | | oCN.BeginTran(); |
| | | oCN.RunProc("delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å 餿å"; |
| | | objJsonResult.data = null; |
| | | oCN.Commit(); |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªæ¾å°"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | } |
| | | } |