using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; using Newtonsoft.Json; using DBUtility; namespace WebAPI.Controllers.SCGL { public class Sc_ComplementGoodsController : ApiController { private json objJsonResult = new json(); public DataSet ds = new DataSet(); public WebServer webserver = new WebServer(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); #region 拣料配送单列表 public class ComplementGoods { public string MaterialNumber { get; set; }//物料代码 public string MaterialName { get; set; }//物料名称 public string MaterialModel { get; set; }//规格型号 public string HGD { get; set; }//工段 public string HWHName { get; set; }//仓库 public string Organization { get; set; }//组织 public DateTime HBeginDate { get; set; }//开始时间 public DateTime HEndDate { get; set; }//结束时间 public string HDeptName { get; set; }//部门 public string HJLStatus { get; set; }//拣料状态 public string user { get; set; }//制单人 } [Route("Sc_ComplementGoods/ComplementGoodsList")] [HttpGet] public object ComplementGoodBillList(string sWhere, string user) { try { //查看权限 if (!DBUtility.ClsPub.Security_Log("Cj_ComplementGoodsBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = new DataTable(); return objJsonResult; } //反序列化传递的值 ComplementGoods com = JsonConvert.DeserializeObject(sWhere.ToString()); ds = oCN.RunProcReturn($"exec h_p_JIT_ComplementGoodsBillList_Query '{com.MaterialNumber}','{com.MaterialName}','{com.MaterialModel}','{com.HGD}'," + $"'{com.HWHName}','{com.HDeptName}','{com.Organization}','{com.user}','{com.HJLStatus}','{com.HBeginDate}','{com.HEndDate}'" ,"h_p_JIT_ComplementGoodsBillList_Query"); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 配料单列表 [Route("Sc_ComplementGoods/ComplementGoodsBill")] [HttpGet] public object ComplementGoodsBill(string sWhere, string user) { try { if (sWhere == null || sWhere.Equals("")) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = new DataTable(); return objJsonResult; } //反序列化传递的值 ComplementGoods com = JsonConvert.DeserializeObject(sWhere.ToString()); //ds = oCN.RunProcReturn($"exec h_p_JIT_ComplementGoods_Load '{com.MaterialNumber}','{com.MaterialName}','{com.MaterialModel}','{com.HGD}'," + // $"'{com.HWHName}','{com.HDeptName}','{com.Organization}','{com.user}','{com.HJLStatus}','{com.HBeginDate}','{com.HEndDate}'", "h_p_JIT_ComplementGoodsBillList_Query"); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } }