public static List <ViewTransfer> QueryTransfer(QueryTransferParas model) { string LocID = model.LocID != null ? model.LocID : ""; string TransferDateFrom = model.TransferDateFrom != null ? model.TransferDateFrom : ""; string TransferDateTo = model.TransferDateTo != null ? model.TransferDateTo : ""; string ProductMoFrom = model.ProductMoFrom != null ? model.ProductMoFrom : ""; string ProductMoTo = model.ProductMoTo != null ? model.ProductMoTo : ""; string GoodsIDFrom = model.GoodsIDFrom != null ? model.GoodsIDFrom : ""; string GoodsIDTo = model.GoodsIDTo != null ? model.GoodsIDTo : ""; if (LocID == "" && TransferDateFrom == "" && TransferDateTo == "" && ProductMoFrom == "" && ProductMoTo == "" && GoodsIDFrom == "" && GoodsIDTo == "") { LocID = "ZZZ"; TransferDateFrom = "1900/01/01"; TransferDateTo = "1900/01/01"; } string strSql = "p_WmTransferDetails"; SqlParameter[] parameters = { new SqlParameter("@LocID", LocID) , new SqlParameter("@DateFrom", TransferDateFrom) , new SqlParameter("@DateTo", TransferDateTo) , new SqlParameter("@ProductMoFrom", ProductMoFrom) , new SqlParameter("@ProductMoTo", ProductMoTo) , new SqlParameter("@GoodsIDFrom", GoodsIDFrom) , new SqlParameter("@GoodsIDTo", GoodsIDTo) }; DataTable dt = SQLHelper.ExecuteProcedureRetrunDataTable(strSql, parameters); List <ViewTransfer> lsDetails = new List <ViewTransfer>(); for (int i = 0; i < dt.Rows.Count; i++) { ViewTransfer mdj = new ViewTransfer(); DataRow dr = dt.Rows[i]; mdj.ID = dr["ID"].ToString(); mdj.LocID = dr["LocID"].ToString(); mdj.ProductMo = dr["ProductMo"].ToString(); mdj.GoodsID = dr["GoodsID"].ToString(); mdj.LotNo = dr["LotNo"].ToString(); mdj.TransferQty = Convert.ToInt32(dr["TransferQty"]); //mdj.QtyUnit = dr["QtyUnit"].ToString(); mdj.TransferWeg = Convert.ToDecimal(dr["TransferWeg"]); //mdj.WegUnit = dr["WegUnit"].ToString(); mdj.GoodsName = dr["GoodsName"].ToString();//"file:///" + Server.MapPath("~") +"~/Images/login.jpg";// mdj.NextLocID = dr["NextLocID"].ToString(); mdj.TransferDate = dr["TransferDate"].ToString(); mdj.FlagID = dr["FlagID"].ToString(); mdj.FlagName = dr["FlagName"].ToString(); mdj.TransferFlag = dr["TransferFlag"].ToString(); mdj.LocIDFrom = dr["LocIDFrom"].ToString(); mdj.UseItem = dr["UseItem"].ToString(); mdj.UseItemName = dr["UseItemName"].ToString(); mdj.WmQty = dr["WmQty"].ToString() != "" ? Convert.ToInt32(dr["WmQty"]) : 0; mdj.WmWeg = dr["WmWeg"].ToString() != "" ? Convert.ToDecimal(dr["WmWeg"]) : 0; lsDetails.Add(mdj); } return(lsDetails); }
public static List <TransferDetails> SearchTransfer(QueryTransferParas model) { string strSql = "Select a.TransferDate,b.*,c.name,c.english_name" + " FROM wm_TransferHead a " + " Inner Join wm_TransferDetails b On a.ID=b.ID" + " Left Join it_goods c ON b.GoodsID=c.id" + " Where a.ID>='" + "" + "'"; if (model.IDFrom != null && model.IDTo != null) { strSql += " And a.ID>='" + model.IDFrom + "' And a.ID<='" + model.IDTo + "'"; } if (model.TransferDateFrom != null && model.TransferDateTo != null) { string DateTo = Convert.ToDateTime(model.TransferDateTo).AddDays(1).ToString("yyyy/MM/dd"); strSql += " And a.TransferDate>='" + model.TransferDateFrom + "' And a.TransferDate<'" + DateTo + "'"; } if (model.IDFrom == null && model.IDTo == null && model.TransferDateFrom == null && model.TransferDateTo == null) { strSql += " And a.ID=''"; } strSql += " ORDER BY a.TransferDate Desc,b.Seq Desc"; DataTable dt = SQLHelper.ExecuteSqlReturnDataTable(strSql); List <TransferDetails> lsDetails = new List <TransferDetails>(); for (int i = 0; i < dt.Rows.Count; i++) { TransferDetails mdj = new TransferDetails(); DataRow dr = dt.Rows[i]; mdj.TransferDate = dr["TransferDate"].ToString(); mdj.ID = dr["ID"].ToString(); mdj.Seq = dr["Seq"].ToString(); mdj.ProductMo = dr["ProductMo"].ToString(); mdj.GoodsID = dr["GoodsID"].ToString(); mdj.LotNo = dr["LotNo"].ToString(); mdj.TransferQty = Convert.ToInt32(dr["TransferQty"]); mdj.QtyUnit = dr["QtyUnit"].ToString(); mdj.TransferWeg = Convert.ToDecimal(dr["TransferWeg"]); mdj.WegUnit = dr["WegUnit"].ToString(); mdj.GoodsName = dr["name"].ToString();//"file:///" + Server.MapPath("~") +"~/Images/login.jpg";// mdj.NextLocID = dr["NextLocID"].ToString(); lsDetails.Add(mdj); } return(lsDetails); }
public ActionResult StockList(QueryTransferParas model) { var list = TransferDAL.QueryStockList(model); return(Json(list, JsonRequestBehavior.AllowGet)); }
//查找移交單 public ActionResult SearchTransfer(QueryTransferParas model) { var list = TransferDAL.SearchTransfer(model); return(Json(list, JsonRequestBehavior.AllowGet)); }