// 收貨上架列表頁 public HttpResponseBase GetIinvdList() { string json = string.Empty; IinvdQuery iivd = new IinvdQuery(); iivd.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 iivd.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 string content = string.Empty; //變更的時候記得把匯出也修改了獲取條件是同時的 if (!string.IsNullOrEmpty(Request.Params["search_type"])) { iivd.serch_type = int.Parse(Request.Params["search_type"]); if (!string.IsNullOrEmpty(Request.Params["searchcontent"]) && Request.Params["searchcontent"].Trim().Length > 0)//有查詢內容就不管時間 { switch (iivd.serch_type) { case 1: case 2: iivd.serchcontent = Request.Params["searchcontent"].Trim(); break; case 3: #region 之後的更改 content = Request.Params["searchcontent"].Replace(',', ',').Replace('|', ',').Replace(' ', ',');//.Replace(' ',',') string[] list = content.Split(','); string test = "^[0-9]*$"; int count = 0;//實現最後一個不加, for (int i = 0; i < list.Length; i++) { if (!string.IsNullOrEmpty(list[i])) { if (Regex.IsMatch(list[i], test)) { count = count + 1; if (count == 1) { iivd.serchcontent = list[i]; } else { iivd.serchcontent = iivd.serchcontent + "," + list[i]; } } else { iivd.serchcontent = iivd.serchcontent + list[i] + ","; } } } #endregion break; default: break; } } } DateTime time; if (DateTime.TryParse(Request.Params["starttime"].ToString(), out time)) { iivd.starttime = DateTime.Parse(time.ToString("yyyy-MM-dd HH:mm:ss")); } if (DateTime.TryParse(Request.Params["endtime"].ToString(), out time)) { iivd.endtime = DateTime.Parse(time.ToString("yyyy-MM-dd HH:mm:ss")); } try { List<IinvdQuery> store = new List<IinvdQuery>(); _iinvd = new IinvdMgr(mySqlConnectionString); int totalCount = 0; store = _iinvd.GetIinvdList(iivd, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; foreach (var item in store) { item.product_name += GetProductSpec(item.item_id.ToString()); } json = "{success:true,'msg':'user',totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
//理货员工作--寄仓--庫存信息 public HttpResponseBase GetStockByProductId() { string json = string.Empty; int totalCount = 0; int islock = 0; _iinvd = new IinvdMgr(mySqlConnectionString); IinvdQuery query = new IinvdQuery() { plas_loc_id = Request.Params["loc_id"], ista_id = "A" }; try { if (!string.IsNullOrEmpty(query.plas_loc_id)) { List<IinvdQuery> listIinvdQuery = _iinvd.GetIinvdList(query, out totalCount); //處理顯示有效期控管的有效期 #region //foreach (var item in listIinvdQuery) //{ // if (item.pwy_dte_ctl == "Y") // { // if (!string.IsNullOrEmpty(item.cde_dt_incr.ToString())) // { // item.cde_dt = item.made_date.AddDays(item.cde_dt_incr); // } // } //} #endregion IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 //timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; timeConverter.DateTimeFormat = "yyyy-MM-dd"; if (totalCount > listIinvdQuery.Count) { islock = 1; } //實際能檢的庫存listIinvdQuery.Count if (listIinvdQuery.Count > 0) { json = "{success:true,islock:'" + islock + "',totalCount:" + listIinvdQuery.Count + ",data:" + JsonConvert.SerializeObject(listIinvdQuery, Formatting.Indented, timeConverter) + "}";//返回json數據 } else { IinvdQuery m = new IinvdQuery(); m.prod_qty = 0; m.made_date = DateTime.Now; m.cde_dt = DateTime.Now; listIinvdQuery.Add(m); json = "{success:true,islock:'" + islock + "',totalCount:" + listIinvdQuery.Count + ",data:" + JsonConvert.SerializeObject(listIinvdQuery, Formatting.Indented, timeConverter) + "}";//返回json數據 } } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public ActionResult IinvdCheck() { _IlocMgr = new IlocMgr(mySqlConnectionString); StringBuilder strHtml = new StringBuilder(); string loc_id = Request.Params["loc_id"]; IlocQuery ilocquery=new IlocQuery(); ilocquery.loc_id = loc_id; loc_id = _IlocMgr.GetIlocCount(ilocquery); ViewBag.loc_id = loc_id; ViewBag.lcat_id = ""; ViewBag.upc_id = ""; ViewBag.iplas = ""; _iinvd = new IinvdMgr(mySqlConnectionString); if (loc_id != "") { List<IinvdQuery> list = _iinvd.GetIinvdList(loc_id); IupcQuery iupc = new IupcQuery(); _IiupcMgr = new IupcMgr(mySqlConnectionString); if (list.Count > 0) { ViewBag.product_name = list[0].product_name; ViewBag.spec = list[0].spec; ViewBag.item_id = list[0].item_id.ToString() ; ViewBag.pwy_dte_ctl = list[0].pwy_dte_ctl; iupc.item_id=uint.Parse(ViewBag.item_id); List<IupcQuery> listiupc=new List<IupcQuery>(); if (iupc.item_id!=0) { listiupc = _IiupcMgr.GetIupcByItemID(iupc); } if (listiupc.Count > 0) { ViewBag.upc_id = listiupc[0].upc_id; } if (list[0].pwy_dte_ctl == "Y") { ViewBag.count = list.Count; } else { int prod_qty = 0; for (int i = 0; i < list.Count; i++) { prod_qty += list[i].prod_qty; } list[0].prod_qty = prod_qty; ViewBag.count = 1; } ViewBag.data = list; IlocQuery lsta_id = _IlocMgr.GetIlocLsta_id(loc_id); Iloc iloc = new Iloc(); if (lsta_id != null) { if (lsta_id.lsta_id == "F") { iloc.row_id = lsta_id.row_id; iloc.lsta_id = "A"; iloc.change_dtim = DateTime.Now; iloc.change_user = (Session["caller"] as Caller).user_id; _IlocMgr.UpdateIlocLock(iloc); } } } else { ViewBag.product_name =""; ViewBag.spec = ""; ViewBag.item_id = "此料位暫無商品"; IinvdQuery iinvd = new IinvdQuery(); iinvd.prod_qty = 0; list.Add(iinvd); ViewBag.pwy_dte_ctl = Request.Params["pwy_dte_ctl"]; ; ViewBag.count = 0; ViewBag.data = list; IIlocImplMgr ilocMgr = new IlocMgr(mySqlConnectionString); IplasDao iplas = new IplasDao(mySqlConnectionString); int total = 0; ilocquery.loc_id = loc_id; ilocquery.lcat_id = "0"; ilocquery.lsta_id = ""; ilocquery.IsPage = false; List<IlocQuery> listiloc = ilocMgr.GetIocList(ilocquery, out total); if (listiloc.Count > 0) { string lcat_id =listiloc.Count==0?"": listiloc[0].lcat_id; if (lcat_id == "S") { string item_id = iplas.Getlocid(loc_id); if (item_id != "") { ViewBag.item_id = item_id; iupc.item_id = uint.Parse(ViewBag.item_id); List<IupcQuery> listiupc = _IiupcMgr.GetIupcByItemID(iupc); if (listiupc.Count > 0) { ViewBag.upc_id = listiupc[0].upc_id; } DataTable table = iplas.GetProduct(item_id); if (table.Rows.Count > 0) { ViewBag.product_name = table.Rows[0]["product_name"]; ViewBag.spec = table.Rows[0]["spec"]; ViewBag.lcat_id = lcat_id; } DataTable tablePwy = _iinvd.Getprodubybar(item_id); if (tablePwy.Rows.Count > 0) { ViewBag.pwy_dte_ctl = tablePwy.Rows[0]["pwy_dte_ctl"].ToString(); } } else { IlocQuery lsta_id = _IlocMgr.GetIlocLsta_id(loc_id); Iloc iloc = new Iloc(); if (lsta_id != null) { if (lsta_id.lsta_id != "H") { iloc.row_id = lsta_id.row_id; iloc.lsta_id = "F"; iloc.change_dtim = DateTime.Now; iloc.change_user = (Session["caller"] as Caller).user_id; _IlocMgr.UpdateIlocLock(iloc); } } ViewBag.iplas = "false"; ViewBag.pwy_dte_ctl = "N"; } } else { IlocQuery lsta_id = _IlocMgr.GetIlocLsta_id(loc_id); Iloc iloc = new Iloc(); if(lsta_id!=null) { if(lsta_id.lsta_id!="H") { iloc.row_id=lsta_id.row_id; iloc.lsta_id = "F"; iloc.change_dtim = DateTime.Now; iloc.change_user = (Session["caller"] as Caller).user_id; _IlocMgr.UpdateIlocLock(iloc); } } ViewBag.pwy_dte_ctl = "N"; } } } if (ViewBag.pwy_dte_ctl==null) { ViewBag.pwy_dte_ctl = ""; } } return View(); }