using System.Data; using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; using Newtonsoft.Json; using DBUtility; using System; namespace WebAPI.Controllers.SCGL { public class Sc_CallGoodsBackRequestBillController : 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 CallGoodsBackRequest { public string HBillNo { get; set; }//报废单号 public string HOrgID { get; set; }//组织 public string MaterialNumber { get; set; }//物料代码 public string MaterialName { get; set; }//物料名称 public string MaterialModel { get; set; }//规格型号 public string HDeptName { get; set; }//生产车间 public DateTime HBeginDate { get; set; }//开始时间 public DateTime HEndDate { get; set; }//结束时间 public string ProcMul { get; set; }//工段 public string Hmaker { get; set; }//当前登录人 } [Route("Sc_CallGoodsBackRequestBill/JIT_CallGoodsBackRequestBillList")] [HttpGet] public object JIT_CallGoodsBackRequestBillList(string sWhere, string user) { try { //查看权限 if (!DBUtility.ClsPub.Security_Log("JIT_ComplementGoods", 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; } //反序列化传递的值 CallGoodsBackRequest com = JsonConvert.DeserializeObject(sWhere.ToString()); ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoodsRequestBillList_Query '{com.HBeginDate}','{com.HEndDate.AddDays(1).AddSeconds(-1)}','{com.HBillNo}','{com.MaterialNumber}'," + $"'{com.MaterialName}','{com.MaterialModel}','{com.HDeptName}','{com.ProcMul}','{com.Hmaker}','{com.HOrgID}'", "h_p_JIT_BackGoodsRequestBillList_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_CallGoodsBackRequestBill/DelCallGoodsBackRequestBill")] [HttpGet] public object DelCallGoodsBackRequestBill(string HInterID, string HEntryID, string user) { try { //判断是否有查询权限 if (!DBUtility.ClsPub.Security_Log("JIT_ComplementGoods_Drop", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询权限"; objJsonResult.data = null; return objJsonResult; } ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoodsRequestBillList_Delete {HInterID},{HEntryID}", "h_p_JIT_BackGoodsRequestBillList_Delete"); 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 = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } }