/// <summary> /// 撿貨——調度流程頁面加載數據 /// </summary> /// <returns></returns> public HttpResponseBase GetMarkTallyTW() { string json = string.Empty; string ord_id = Request.Params["ord_id"]; string type = Request.Params["type"]; AseldQuery ase = new AseldQuery(); Aseld m = new Aseld(); try { if (!string.IsNullOrEmpty(Request.Params["ord_id"])) { ase.ord_id = int.Parse(Request.Params["ord_id"]); } if (!string.IsNullOrEmpty(Request.Params["freight_set"])) { ase.freight_set = Request.Params["freight_set"].Substring(0, 1); } //if (!string.IsNullOrEmpty(Request.Params["deliver_code"])) //{ // ase.deliver_code = Request.Params["deliver_code"].Substring(0, 1); //} if (!string.IsNullOrEmpty(Request.Params["item_id"])) { if (Request.Params["item_id"].Length == 6) { ase.item_id = uint.Parse(Request.Params["item_id"]); } else { ase.upc_id = Request.Params["item_id"]; } } _iasdMgr = new AseldMgr(mySqlConnectionString); DataTable dt = _iasdMgr.GetOrderProductInformation(ase); //0代表加載工作代號 if (type == "0")//141980010 { if (dt.Rows.Count > 0) { json = "\"" + "assg_id" + "\"" + ":" + "\"" + dt.Rows[0]["assg_id"].ToString() + "\""; json += ",\r\n" + "\"" + "deliver_code" + "\"" + ":" + "\"" + dt.Rows[0]["deliver_code"].ToString() + "\""; } } else { if (dt.Rows.Count > 0) { //json = "\"" + "assg_id" + "\"" + ":" + "\"" + dr["assg_id"].ToString() + "\""; if (!string.IsNullOrEmpty(dt.Rows[0]["prod_sz"].ToString())) { json = "\"" + "product_name" + "\"" + ":" + "\"" + dt.Rows[0]["description"].ToString() + " (" + dt.Rows[0]["prod_sz"].ToString() + ")\""; } else { json = "\"" + "product_name" + "\"" + ":" + "\"" + dt.Rows[0]["description"].ToString() + " " + dt.Rows[0]["prod_sz"].ToString() + "\""; } //json = "\"" + "product_name" + "\"" + ":" + "\"" + dt.Rows[0]["description"].ToString() + " " + dt.Rows[0]["prod_sz"].ToString() + "\""; json += ",\r\n" + "\"" + "seld_id" + "\"" + ":" + "\"" + dt.Rows[0]["seld_id"].ToString() + "\"";//row_id.唯一的 json += ",\r\n" + "\"" + "ord_qty" + "\"" + ":" + "\"" + dt.Rows[0]["ord_qty"].ToString() + "\"";//訂貨量 json += ",\r\n" + "\"" + "out_qty" + "\"" + ":" + "\"" + dt.Rows[0]["out_qty"].ToString() + "\"";//缺貨量 json += ",\r\n" + "\"" + "ordd_id" + "\"" + ":" + "\"" + dt.Rows[0]["ordd_id"].ToString() + "\""; json += ",\r\n" + "\"" + "deliver_id" + "\"" + ":" + "\"" + dt.Rows[0]["deliver_id"].ToString() + "\""; json += ",\r\n" + "\"" + "deliver_code" + "\"" + ":" + "\"" + dt.Rows[0]["deliver_code"].ToString() + "\""; json += ",\r\n" + "\"" + "note_order" + "\"" + ":" + "\"" + dt.Rows[0]["note_order"].ToString() + "\""; if (!string.IsNullOrEmpty(dt.Rows[0]["cde_dt_shp"].ToString())) { json += ",\r\n" + "\"" + "cde_dt_shp" + "\"" + ":" + "\"" + dt.Rows[0]["cde_dt_shp"].ToString() + "\"";//商品的允出天數 } else { json += ",\r\n" + "\"" + "cde_dt_shp" + "\"" + ":" + "\"" + "999999" + "\"";//商品的允出天數 } if (!string.IsNullOrEmpty(dt.Rows[0]["pwy_dte_ctl"].ToString())) { json += ",\r\n" + "\"" + "pwy_dte_ctl" + "\"" + ":" + "\"" + dt.Rows[0]["pwy_dte_ctl"].ToString() + "\"";//有效期控管 } else { json += ",\r\n" + "\"" + "pwy_dte_ctl" + "\"" + ":" + "\"" + "N" + "\"";//有效期控管 } #region 查詢商品信息同時把wust_id更改為BSY m.wust_id = "BSY"; m.create_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; if (!string.IsNullOrEmpty(dt.Rows[0]["seld_id"].ToString())) { m.seld_id = int.Parse(dt.Rows[0]["seld_id"].ToString()); } _iasdMgr.Updwust(m); #endregion } else {//判斷條碼輸入的是否正確 DataTable data = new DataTable(); Iupc i = new Iupc(); _IiupcMgr = new IupcMgr(mySqlConnectionString); if (!string.IsNullOrEmpty(ase.upc_id)) { i.upc_id = ase.upc_id; data = _IiupcMgr.upcid(i); if (data.Rows.Count > 0) { json = "\"" + "item_id" + "\"" + ":" + "\"" + data.Rows[0]["item_id"].ToString() + "\""; } } } } json = "{success:true,data:\r\n {\r\n" + json + "\r\n} \r\n" + "}"; } 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:true,data:\r\n {\r\n" + "" + "\r\n} \r\n" + "}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }