public List<IlocQuery> GetIocList(IlocQuery loc, out int totalCount) { try { return _IocDao.GetIocList(loc, out totalCount); } catch (Exception ex) { throw new Exception("IlocMgr-->GetIocList-->" + ex.Message, ex); } }
/// <summary> /// 獲取料位列表 /// </summary> /// <param name="loc">實體</param> /// <param name="totalCount"></param> /// <returns>料位列表</returns> public List<IlocQuery> GetIocList(IlocQuery loc, out int totalCount) { StringBuilder sb=new StringBuilder(); StringBuilder sbt=new StringBuilder(); StringBuilder sqlcount =new StringBuilder(); if (loc.lcat_id != "0") { sbt.AppendFormat(@" and iloc.lcat_id='{0}'",loc.lcat_id); } if (!string.IsNullOrEmpty(loc.lsta_id)) { sbt.AppendFormat(@" and iloc.lsta_id='{0}'",loc.lsta_id ); } if(!string.IsNullOrEmpty(loc.loc_id)) { sbt.AppendFormat(@" and (iloc.loc_id like '%{0}%' or iloc.hash_loc_id LIKE '%{0}%') ", loc.loc_id); } if (!string.IsNullOrEmpty(loc.starttime.ToString()) && loc.starttime>DateTime.MinValue) { sbt.AppendFormat(@" and iloc.create_dtim >='{0}' ", loc.starttime.ToString("yyyy-MM-dd HH:mm:ss")); } if (!string.IsNullOrEmpty(loc.endtime.ToString()) && loc.endtime > DateTime.MinValue) { sbt.AppendFormat(@" and iloc.create_dtim <= '{0}' ", loc.endtime.ToString("yyyy-MM-dd HH:mm:ss")); } sb.Append(@" select mu.user_username as change_users ,row_id,dc_id,whse_id,loc_id,llts_id,ldes_id,lsta_id,sel_stk_pos,sel_pos_hgt,rsv_stk_pos,rsv_pos_hgt,stk_pos_dep,stk_lmt,"); sb.Append(" stk_pos_wid,lev,lhnd_id,ldsp_id,create_user,create_dtim,comingle_allow,change_dtim,lcat_id,hash_loc_id "); sb.Append(" from iloc left join manage_user mu on iloc.change_user=mu.user_id where 1=1 and loc_status=1 "); sb.Append(sbt.ToString()); sb.AppendFormat(" order by loc_id asc "); //sqlcount.AppendFormat(" select count(*) as search_total from iloc where 1=1 and loc_status=1 "); //sqlcount.AppendFormat(sbt.ToString()); totalCount = 0; try { if (loc.IsPage) { System.Data.DataTable _dt = _access.getDataTable(sb.ToString()); if (_dt != null && _dt.Rows.Count > 0) { totalCount = _dt.Rows.Count; } sb.AppendFormat(" limit {0},{1}", loc.Start, loc.Limit); } return _access.getDataTableForObj<IlocQuery>(sb.ToString()); } catch (Exception ex) { throw new Exception("IlocDao.GetIocList-->" + ex.Message + sb.ToString(), ex); } }
public string GetIlocCount(IlocQuery loc) { try { return _IocDao.GetIlocCount(loc); } catch (Exception ex) { throw new Exception("IlocMgr-->GetIlocCount-->" + ex.Message, ex); } }
public List<IlocQuery> GetIlocExportList(IlocQuery loc) { try { return _IocDao.GetIlocExportList(loc); } catch (Exception ex) { throw new Exception("IlocMgr-->GetIlocExportList-->" + ex.Message, ex); } }
public void ExportIlocList() { string json = string.Empty; IlocQuery iloc = new IlocQuery(); iloc.lcat_id = Request.Params["Ilocid_type"]; if (!string.IsNullOrEmpty(Request.Params["startIloc"]))//model中默認為F { iloc.startiloc = Request.Params["startIloc"].ToUpper(); } else { iloc.startiloc = string.Empty; } if (!string.IsNullOrEmpty(Request.Params["endIloc"])) { iloc.endiloc = Request.Params["endIloc"] + "Z"; iloc.endiloc = iloc.endiloc.ToUpper(); } else { iloc.endiloc = string.Empty; } if (!System.IO.Directory.Exists(Server.MapPath(excelPath))) { System.IO.Directory.CreateDirectory(Server.MapPath(excelPath)); } DataTable dtHZ = new DataTable(); string newExcelName = string.Empty; dtHZ.Columns.Add("料位", typeof(String)); dtHZ.Columns.Add("屬性", typeof(String)); dtHZ.Columns.Add("狀態", typeof(String)); dtHZ.Columns.Add("長", typeof(String)); dtHZ.Columns.Add("寬", typeof(String)); dtHZ.Columns.Add("主高", typeof(String)); dtHZ.Columns.Add("副高", typeof(String)); dtHZ.Columns.Add("類型", typeof(String)); try { List<IlocQuery> store = new List<IlocQuery>(); _IlocMgr = new IlocMgr(mySqlConnectionString); store = _IlocMgr.Export(iloc); foreach (var item in store) { DataRow dr = dtHZ.NewRow(); dr[0] = item.loc_id; dr[1] = item.lcat_id; dr[2] = item.lsta_id; dr[3] = item.stk_pos_dep; dr[4] = item.stk_pos_wid; dr[5] = item.sel_pos_hgt; dr[6] = item.rsv_pos_hgt; dr[7] = item.ldes_id; dtHZ.Rows.Add(dr); } if (System.IO.File.Exists(newExcelName)) { System.IO.File.Delete(newExcelName); } string fileName = "匯出可用主料位/副料位報表_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; MemoryStream ms = ExcelHelperXhf.ExportDT(dtHZ, "匯出可用主料位/副料位報表_" + DateTime.Now.ToString("yyyyMMddHHmmss")); Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); Response.BinaryWrite(ms.ToArray()); } 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,data:[]}"; } }
public void IlocExcelList() { string json = string.Empty; IlocQuery ilocQuery = new IlocQuery(); DataTable dtExcel = new DataTable(); try { ilocQuery.lcat_id = Request.Params["Ilocid_type"]; if (!string.IsNullOrEmpty(Request.Params["search_type"]) && Request.Params["search_type"] != "null")//model中默認為F { ilocQuery.lsta_id = Request.Params["search_type"]; } else { ilocQuery.lsta_id = string.Empty; } if (!string.IsNullOrEmpty(Request.Params["searchcontent"].Trim())) { ilocQuery.loc_id = Request.Params["searchcontent"].ToString().ToUpper(); } DateTime time; if (DateTime.TryParse(Request.Params["starttime"].ToString(), out time)) { ilocQuery.starttime = time; } if (DateTime.TryParse(Request.Params["endtime"].ToString(), out time)) { ilocQuery.endtime = time; } List<IlocQuery> store = new List<IlocQuery>(); _IlocMgr = new IlocMgr(mySqlConnectionString); store = _IlocMgr.GetIlocExportList(ilocQuery); dtExcel.Columns.Add("料位編號", typeof(String)); dtExcel.Columns.Add("Hash料位", typeof(String)); dtExcel.Columns.Add("修改人員", typeof(String)); dtExcel.Columns.Add("修改時間", typeof(String)); dtExcel.Columns.Add("料位類型", typeof(String)); dtExcel.Columns.Add("料位狀態", typeof(String)); for (int i = 0; i < store.Count; i++) { DataRow newRow = dtExcel.NewRow(); newRow[0] = store[i].loc_id.ToString(); newRow[1] = store[i].hash_loc_id.ToString(); newRow[2] = store[i].change_users.ToString(); newRow[3] = store[i].change_dtim.ToString(); newRow[4] = store[i].lcat_id.ToString(); newRow[5] = store[i].lsta_id.ToString(); dtExcel.Rows.Add(newRow); } if (dtExcel.Rows.Count > 0) { string fileName = "料位維護_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls"; MemoryStream ms = ExcelHelperXhf.ExportDT(dtExcel, "料位維護_" + DateTime.Now.ToString("yyyyMMddHHmmss")); Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); Response.BinaryWrite(ms.ToArray()); } else { Response.Write("匯出數據不存在"); } } 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); } }
public void ExportDeliveryStatement() { string json = string.Empty; IlocQuery iloc = new IlocQuery(); if (!System.IO.Directory.Exists(Server.MapPath(excelPath))) { System.IO.Directory.CreateDirectory(Server.MapPath(excelPath)); } DataTable dtHZ = new DataTable(); string counts = Request.Params["counts"]; string searchtype = Request.Params["searchtype"];//常溫或者冷凍 string newExcelName = string.Empty; dtHZ.Columns.Add("主料位", typeof(String)); dtHZ.Columns.Add("溫層", typeof(String)); dtHZ.Columns.Add("品號", typeof(String)); dtHZ.Columns.Add("品名", typeof(String)); dtHZ.Columns.Add("規格", typeof(String)); dtHZ.Columns.Add("廠商", typeof(String)); dtHZ.Columns.Add("數量", typeof(String)); dtHZ.Columns.Add("寄倉/調度", typeof(String)); try { DataTable dt = new DataTable(); _iasdMgr = new AseldMgr(mySqlConnectionString); dt = _iasdMgr.ExportDeliveryStatement(Convert.ToInt32(counts), Convert.ToInt32(searchtype)); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dtHZ.NewRow(); dr[0] = dt.Rows[i]["loc_id"]; if (Convert.ToInt32(dt.Rows[i]["export_id"]) == 2) { dr[1] = "常溫"; } else if (Convert.ToInt32(dt.Rows[i]["export_id"]) == 92) { dr[1] = "冷凍"; } else { dr[1] = ""; } dr[2] = dt.Rows[i]["item_id"]; dr[3] = dt.Rows[i]["product_name"]; dr[4] = dt.Rows[i]["prod_sz"]; dr[5] = dt.Rows[i]["vendor_name_full"]; dr[6] = dt.Rows[i]["buy_num"]; if (dt.Rows[i]["product_mode"].ToString() == "2") { dr[7] = "寄倉"; } else if (dt.Rows[i]["product_mode"].ToString() == "3") { dr[7] = "調度"; } else { dr[7] = ""; } dtHZ.Rows.Add(dr); } if (System.IO.File.Exists(newExcelName)) { System.IO.File.Delete(newExcelName); } string fileName = DateTime.Now.ToString("大出貨報表_yyyyMMddHHmm") + ".xls"; MemoryStream ms = new MemoryStream(); if (searchtype == "2") { ms = ExcelHelperXhf.ExportDT(dtHZ, "常溫~大出貨報表_" + DateTime.Now.ToString("yyyyMMddHHmm")); } else { ms = ExcelHelperXhf.ExportDT(dtHZ, "冷凍~大出貨報表_" + DateTime.Now.ToString("yyyyMMddHHmm")); } Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); Response.BinaryWrite(ms.ToArray()); //CsvHelper.ExportDataTableToCsv(dtHZ, newExcelName, colname, true); } 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,data:[]}"; } }
public HttpResponseBase GetIlocList() { string json = string.Empty; IlocQuery iloc = new IlocQuery(); iloc.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 iloc.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 iloc.lcat_id = Request.Params["Ilocid_type"]; if (!string.IsNullOrEmpty(Request.Params["search_type"]))//model中默認為F { iloc.lsta_id = Request.Params["search_type"]; } else { iloc.lsta_id = string.Empty; } if (!string.IsNullOrEmpty(Request.Params["searchcontent"].Trim())) { iloc.loc_id = Request.Params["searchcontent"].ToString().ToUpper(); } DateTime time; if (DateTime.TryParse(Request.Params["starttime"].ToString(), out time)) { iloc.starttime = time; } if (DateTime.TryParse(Request.Params["endtime"].ToString(), out time)) { iloc.endtime = time; } try { List<IlocQuery> store = new List<IlocQuery>(); _IlocMgr = new IlocMgr(mySqlConnectionString); int totalCount = 0; store = _IlocMgr.GetIocList(iloc, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; 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 JsonResult GetIlocCount() { string result = "false"; try { IlocQuery query = new IlocQuery(); query.loc_id = Request.Params["loc_id"].ToUpper(); List<IlocQuery> ilocList = new List<IlocQuery>(); _IlocMgr = new IlocMgr(mySqlConnectionString); if (_IlocMgr.GetIlocCount(query)!="") { result = "true"; } else { result = "false"; } } 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); } return Json(new { success = result }); }
public HttpResponseBase SaveIinvd() { string json = "{success:false,message:'系統異常'}"; try { int temp = 0; if (int.TryParse(Request.Params["prod_qty"], out temp)) { if (temp > 0) { IinvdQuery iinvd = new IinvdQuery(); if (!string.IsNullOrEmpty(Request.Params["loc_id"])) { iinvd.plas_loc_id = Request.Params["loc_id"]; } if (!string.IsNullOrEmpty(Request.Params["item_id"])) { if (int.TryParse(Request.Params["item_id"], out temp)) { iinvd.item_id = uint.Parse(Request.Params["item_id"]); } } #region 判斷是否指定主料位 IlocQuery ilocquery = new IlocQuery(); _IiplasMgr = new IplasMgr(mySqlConnectionString); IplasQuery iplasquery = new IplasQuery(); iplasquery.item_id = iinvd.item_id; IIlocImplMgr ilocMgr = new IlocMgr(mySqlConnectionString); IplasDao iplasdao = new IplasDao(mySqlConnectionString); int total = 0; ilocquery.loc_id = iinvd.plas_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 = iplasdao.Getlocid(ilocquery.loc_id); if (item_id == "") { Iplas iplas = new Iplas(); if (int.TryParse(Request.Params["item_id"], out temp)) { iplas.item_id = uint.Parse(Request.Params["item_id"]); if (_IiplasMgr.IsTrue(iplas) == "false") { json = "{success:false,message:'不存在該商品編號'}"; this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; } if (_IiplasMgr.GetIplasid(iplasquery) > 0) { json = "{success:false,message:'此商品主料位非該料位'}"; this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; } Iloc iloc = new Iloc(); iloc.loc_id = iinvd.plas_loc_id; if (_IiplasMgr.GetLocCount(iloc) <= 0) { json = "{success:false,message:'該料位已鎖定或被指派'}"; this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; } iplas.loc_id = iloc.loc_id; iplas.loc_stor_cse_cap = 100; iplas.create_user = (Session["caller"] as Caller).user_id; iplas.create_dtim = DateTime.Now; iplas.change_user = (Session["caller"] as Caller).user_id; iplas.change_dtim = DateTime.Now; _IiplasMgr.InsertIplas(iplas); } } } } #endregion iinvd.create_user = (Session["caller"] as Caller).user_id; iinvd.create_dtim = DateTime.Now; iinvd.change_user = iinvd.create_user; iinvd.change_dtim = iinvd.create_dtim; iinvd.ista_id = "A"; if (!string.IsNullOrEmpty(Request.Params["loc_id"])) { iinvd.plas_loc_id = Request.Params["loc_id"]; } int change_prod_qty = int.Parse(Request.Params["prod_qty"]); iinvd.prod_qty = change_prod_qty; if (!string.IsNullOrEmpty(Request.Params["st_qty"])) { if (int.TryParse(Request.Params["st_qty"], out temp)) { iinvd.st_qty = int.Parse(Request.Params["st_qty"]); } } if (!string.IsNullOrEmpty(Request.Params["item_id"])) { if (int.TryParse(Request.Params["item_id"], out temp)) { iinvd.item_id = uint.Parse(Request.Params["item_id"]); } } DateTime date = DateTime.Now; if (DateTime.TryParse(Request.Params["datetimepicker1"], out date)) { iinvd.made_date = date; } else { iinvd.made_date = DateTime.Now; } _iinvd = new IinvdMgr(mySqlConnectionString); if (Request.Params["pwy_dte_ctl"] == "Y") { iinvd.pwy_dte_ctl = "Y"; IProductExtImplMgr productExt = new ProductExtMgr(mySqlConnectionString); int Cde_dt_incr = productExt.GetCde_dt_incr((int)iinvd.item_id); iinvd.cde_dt = date.AddDays(Cde_dt_incr); } else { iinvd.cde_dt = DateTime.Now; } iinvd.prod_qtys = _iinvd.GetProd_qty(Convert.ToInt32(iinvd.item_id), iinvd.plas_loc_id, "", iinvd.row_id.ToString()); IialgQuery iialg = new IialgQuery(); iialg.cde_dt = iinvd.cde_dt; int prod_qty = 0;// _iinvd.GetProd_qty((int)iinvd.item_id, iinvd.plas_loc_id, "", ""); int row = _iinvd.GetIinvdCount(iinvd); if (row > 1) { prod_qty = row - 1; json = "{success:true}"; } else { if (_iinvd.Insert(iinvd) == 1) { json = "{success:true}"; } } iialg.qty_o = prod_qty; iialg.loc_id = iinvd.plas_loc_id; iialg.item_id = iinvd.item_id; iialg.iarc_id = "循環盤點"; iialg.adj_qty = change_prod_qty; iialg.create_dtim = DateTime.Now; iialg.create_user = iinvd.create_user; iialg.type = 2; iialg.doc_no = "C" + DateTime.Now.ToString("yyyyMMddHHmmss"); iialg.made_dt = iinvd.made_date; iialg.cde_dt = iinvd.cde_dt; _iialgMgr = new IialgMgr(mySqlConnectionString); _iialgMgr.insertiialg(iialg); IstockChangeQuery istock = new IstockChangeQuery(); istock.sc_trans_id = iialg.doc_no; istock.item_id = iinvd.item_id; istock.sc_istock_why = 2; istock.sc_trans_type = 2; istock.sc_num_old = iinvd.prod_qtys; istock.sc_num_chg = iialg.adj_qty; istock.sc_num_new = _iinvd.GetProd_qty((int)iinvd.item_id, iinvd.plas_loc_id,"N",""); istock.sc_time = iinvd.create_dtim; istock.sc_user = iinvd.create_user; istock.sc_note = "循環盤點"; IstockChangeMgr istockMgr = new IstockChangeMgr(mySqlConnectionString); istockMgr.insert(istock); } else { json = "{success:false,message:'庫存不能小於1'}"; } } else { json = "{success:false,message:'庫存請輸入數字'}"; } } 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(); }
public IlocQuery GetIlocLsta_id(string loc_id)//add by yafeng0715j { StringBuilder sbt = new StringBuilder("SELECT lsta_id,row_id FROM iloc WHERE 1=1"); IlocQuery query = new IlocQuery(); if (loc_id != "") { sbt.AppendFormat(" and loc_id='{0}'",loc_id); } try { DataTable table=_access.getDataTable(sbt.ToString()); if(table.Rows.Count>0) { query.lsta_id = table.Rows[0][0].ToString(); query.row_id = int.Parse(table.Rows[0][1].ToString()); return query; } return null; } catch (Exception ex) { throw new Exception("IlocDao.GetIlocLsta_id-->" + ex.Message + sbt.ToString(), ex); } }
public string GetIlocCount(IlocQuery loc) { StringBuilder sbt = new StringBuilder("SELECT loc_id FROM iloc WHERE 1=1"); if (loc.loc_id != "") { sbt.AppendFormat(@" and (loc_id='{0}' or hash_loc_id='{0}')", loc.loc_id); } try { DataTable table = _access.getDataTable(sbt.ToString()); if(table.Rows.Count>0) { return table.Rows[0][0].ToString(); } return ""; } catch (Exception ex) { throw new Exception("IlocDao.GetIlocCount-->" + ex.Message + sbt.ToString(), ex); } }
public List<IlocQuery> GetIlocExportList(IlocQuery loc) { StringBuilder sb = new StringBuilder(); StringBuilder sbt = new StringBuilder(); StringBuilder sqlcount = new StringBuilder(); if (loc.lcat_id != "0") { sbt.AppendFormat(@" and iloc.lcat_id='{0}'", loc.lcat_id); } if (!string.IsNullOrEmpty(loc.lsta_id)) { sbt.AppendFormat(@" and iloc.lsta_id='{0}'", loc.lsta_id); } if (!string.IsNullOrEmpty(loc.loc_id)) { sbt.AppendFormat(@" and (iloc.loc_id like '%{0}%' or iloc.hash_loc_id LIKE '%{0}%') ", loc.loc_id); } DateTime dt = DateTime.Parse("1970-01-01 08:00:00"); if (!string.IsNullOrEmpty(loc.starttime.ToString()) && loc.starttime>dt) { sbt.AppendFormat(@" and iloc.create_dtim >='{0}' ", loc.starttime.ToString("yyyy-MM-dd HH:mm:ss")); } if (!string.IsNullOrEmpty(loc.endtime.ToString()) && loc.endtime > dt) { sbt.AppendFormat(@" and iloc.create_dtim <= '{0}' ", loc.endtime.ToString("yyyy-MM-dd HH:mm:ss")); } sb.Append(@" select mu.user_username as change_users ,row_id,dc_id,whse_id,loc_id,llts_id,ldes_id,lsta_id,sel_stk_pos,sel_pos_hgt,rsv_stk_pos,rsv_pos_hgt,stk_pos_dep,stk_lmt,"); sb.Append(" stk_pos_wid,lev,lhnd_id,ldsp_id,create_user,create_dtim,comingle_allow,change_dtim,lcat_id,hash_loc_id"); sb.Append(" from iloc left join manage_user mu on iloc.change_user=mu.user_id where 1=1 and loc_status=1 "); sb.Append(sbt.ToString()); sb.AppendFormat(" order by loc_id asc "); try { return _access.getDataTableForObj<IlocQuery>(sb.ToString()); } catch (Exception ex) { throw new Exception("IlocDao.GetIocList-->" + ex.Message + sb.ToString(), ex); } }
public List<IlocQuery> Export(IlocQuery loc) { StringBuilder sb = new StringBuilder(); StringBuilder sbt = new StringBuilder(); if (loc.lcat_id!="0") { sbt.AppendFormat(@" and iloc.lcat_id='{0}'", loc.lcat_id); } if (loc.startiloc!="" && loc.endiloc!="") { sbt.AppendFormat(@" and (iloc.loc_id>='{0}' and iloc.loc_id <='{1}') ", loc.startiloc,loc.endiloc); } sb.Append(@" select mu.user_username as change_users,loc_id,llts_id,ldes_id,lsta_id,sel_stk_pos,sel_pos_hgt,rsv_stk_pos,rsv_pos_hgt,stk_pos_dep,stk_lmt,"); sb.Append(" stk_pos_wid,lev,lhnd_id,ldsp_id,create_user,create_dtim,comingle_allow,change_dtim,lcat_id"); sb.Append(" from iloc left join manage_user mu on iloc.change_user=mu.user_id where 1=1 and loc_status=1 and lsta_id='F' "); sb.Append(sbt.ToString()); sb.Append(" order by loc_id asc "); try { return _access.getDataTableForObj<IlocQuery>(sb.ToString()); } catch (Exception ex) { throw new Exception("IlocDao.Export-->" + ex.Message + sb.ToString(), ex); } }