using Newtonsoft.Json; 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; namespace WebAPI.Controllers.CJGL { public class Cj_SendGoodsBillController : ApiController { private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; #region 车间收料列表 查询 //过滤条件 public class JIT_SendGoodsBill { public DateTime HBeginDate; public DateTime HEndDate; public string HBillNo { get; set; } public string HDeptName { get; set; } public string MaterialCode { get; set; } public string MaterialName { get; set; } public string MaterialModel { get; set; } public int? HOrgID; } [Route("Cj_SendGoodsBill/Cj_SendGoodsBillList")] [HttpGet] public object Cj_SendGoodsBillList(string sWhere,string user) { try { //查看权限 if (!DBUtility.ClsPub.Security_Log("JIT_SendGoodsBill_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; } //反序列化传递的值 JIT_SendGoodsBill com = JsonConvert.DeserializeObject(sWhere.ToString()); ds = oCN.RunProcReturn($"exec h_p_JIT_DeptCheckGoodsBillList_Query '{com.HBeginDate}','{com.HEndDate.AddDays(1).AddSeconds(-1)}','{com.HBillNo}','{com.HDeptName}'," + $"'{com.MaterialCode}','{com.MaterialName}','{com.MaterialModel}','{com.HOrgID}'", "h_p_JIT_DeptCheckGoodsBillList_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("Cj_SendGoodsBill/DeptCheckGoodsBillList_Check")] [HttpGet] public object DeptCheckGoodsBillList_Check(string HInterID,string HEntryID,string User) { try { //查看权限 if (!DBUtility.ClsPub.Security_Log("JIT_SendGoodsBill_Check", 1, false, User)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无审核权限!"; objJsonResult.data = null; return objJsonResult; } ds = oCN.RunProcReturn($"exec h_p_JIT_DeptCheckGoodsBillList_Check '{HInterID}','{HEntryID}','{User}'", "h_p_JIT_DeptCheckGoodsBillList_Check"); objJsonResult.code = ds.Tables[0].Rows[0][0].ToString(); objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString()); objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); 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 } }