using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.Http; using WebAPI.Models; using Newtonsoft.Json; namespace WebAPI.Controllers.CJGL { public class Cj_CallGoodsBillBackController : ApiController { private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; #region 叫料退料单列表 public class CallGoodsBill { public DateTime HBeginDate; //退料日期 public DateTime HEndDate; public string HBillNo;//报废单号 public string MaterialNumber;//物料代码 public string MaterialName;//物料名称 public string MaterialModel;//规格型号 public string HDeptName;//生产车间 public string ProcMul;//工段 public string Hmaker;//当前用户 public int HOrgID;//组织 public string HPZStatus;//品质确认 public string HCKStatus;//仓库接收 } [Route("Cj_CallGoodsBillBack/CallGoodsBillBackMainList")] [HttpGet] public object CallGoodsBillMainList(string sWhere, string user) { try { //判断是否有查询权限 if (!DBUtility.ClsPub.Security_Log("Cj_CallGoodsBillBack_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 =null; objJsonResult.data = new DataTable(); return objJsonResult; } CallGoodsBill ca = JsonConvert.DeserializeObject(sWhere); ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoodsBillList_Query '{ca.HBillNo}','{ca.MaterialNumber}','{ca.MaterialName}','{ca.MaterialModel}'," + $"'{ca.ProcMul}','{ca.HDeptName}',{ca.HOrgID},'{ca.Hmaker}','{ca.HPZStatus}','{ca.HCKStatus}','{ca.HBeginDate}','{ca.HEndDate.AddDays(1).AddSeconds(-1)}'", "h_p_JIT_BackGoodsBillList_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 = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 叫料退料单 删除 [Route("Cj_CallGoodsBillBack/DelCallGoodsBill")] [HttpGet] public object DelCallGoodsBill(string HInterID, string HEntryID, string user) { try { //判断是否有查询权限 if (!DBUtility.ClsPub.Security_Log("Cj_CallGoodsBillBack_Drop", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查询权限"; objJsonResult.data = null; return objJsonResult; } ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoodsBillList_Delete {HInterID},{HEntryID} ", "h_p_JIT_BackGoodsBillList_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 #region 叫料单列表 (默认查询) [Route("Cj_CallGoodsBillBack/JIT_BackGoodsList")] [HttpGet] public object JIT_BackGoodsList(string HInterID, string user) { try { if (HInterID == null || HInterID.Equals("")) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = null; objJsonResult.data = new DataTable(); return objJsonResult; } ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoods_Load '{HInterID}'", "h_p_JIT_BackGoods_Load"); 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 = "没有返回任何记录!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } }