/// <summary> /// 在庫情報を照会して要求数量が在庫数量を下回るかチェックする /// </summary> /// <param name="storeHouseCode">倉庫コード</param> /// <param name="productCode">品番コード</param> /// <param name="expirationDate">賞味期限</param> /// <param name="nowStockQty">現在庫数(個数返却用)</param> /// <param name="requestQty">要求数量</param> /// <returns>下回る場合真</returns> public bool CheckStokItemQty(int storeHouseCode, int productCode, DateTime?expirationDate, out decimal nowStockQty, decimal requestQty = 0) { using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { try { context.Connection.Open(); } catch (Exception ex) { throw new DBOpenException(ex); } // REMARKS:DateTime.MaxValue だと時刻を含む為 DateTime maxDate = AppCommon.GetMaxDate(); var stokInfo = context.S03_STOK .Where(w => w.削除日時 == null && w.庫コード == storeHouseCode && w.品番コード == productCode && w.賞味期限 == (expirationDate ?? maxDate)) .FirstOrDefault(); if (stokInfo == null) { // 対象在庫なし nowStockQty = 0; return(false); } // 在庫数と要求数を比較した結果を返す nowStockQty = stokInfo.在庫数; return(stokInfo.在庫数 >= requestQty); } }
/// <summary> /// 帳票出力データを取得する /// </summary> /// <param name="yearMonth"></param> /// <returns></returns> public List <PrintDataMember> GetPrintData(string yearMonth, int?p倉庫コード) { int iYearMonth = int.Parse(yearMonth.Replace("/", "")); using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { var result = context.S05_STOK_MONTH.Where(w => w.締年月 == iYearMonth) .GroupJoin(context.M22_SOUK, x => x.庫コード, y => y.庫コード, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (a, b) => new { STOK = a.x, SOUK = b }) .GroupJoin(context.M09_HIN, x => x.STOK.品番コード, y => y.品番コード, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (c, d) => new { c.x.STOK, c.x.SOUK, HIN = d }) .GroupJoin(context.M06_IRO, x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (c, d) => new { c.x.STOK, c.x.SOUK, c.x.HIN, IRO = d }) .Where(w => p倉庫コード == null || w.SOUK.庫コード == p倉庫コード) .ToList() .Select(s => new PrintDataMember { 品番コード = s.STOK.品番コード, 庫コード = s.STOK.庫コード, // No-117 Mod Start 自社品番 = s.HIN == null ? string.Empty : s.HIN.自社品番, 自社色 = s.HIN == null ? string.Empty : s.HIN.自社色, 自社色名 = s.IRO == null ? string.Empty : s.IRO.色名称, 自社品名 = s.HIN == null ? string.Empty : s.HIN.自社品名, 庫名 = s.SOUK == null ? string.Empty : s.SOUK.庫名, 在庫数量 = s.STOK == null ? 0 : s.STOK.在庫数量, // No-117 Mod End 賞味期限 = (s.STOK.賞味期限 != AppCommon.GetMaxDate() ? s.STOK.賞味期限 : (DateTime?)null), }) .OrderBy(o => o.品番コード) .ThenBy(t => t.庫コード) .ThenBy(t => t.賞味期限); return(result.ToList()); } }
/// <summary> /// 棚卸 対象情報取得 /// </summary> /// <param name="context">TRAC3Entities</param> /// <param name="pMyCompany">自社コード</param> /// <param name="pStocktakingDate">棚卸日</param> /// <param name="pParamDic">パラメータ辞書</param> private List <StocktakingDataMember> GetStockTakingList(TRAC3Entities context, int pMyCompany, string pStocktakingDate, Dictionary <string, string> pParamDic) { DateTime dtStocktaking = DateTime.Parse(pStocktakingDate); // --------------------------- // 情報取得 // --------------------------- // 棚卸在庫情報(品番マスタ,倉庫マスタ,在庫テーブル) List <StocktakingDataMember> retResult = new List <StocktakingDataMember>(); var stocktakingList = context.S10_STOCKTAKING.Where(w => w.削除日時 == null && w.棚卸日 == dtStocktaking && w.更新済みFLG == 0) .Join(context.M09_HIN.Where(w => w.削除日時 == null), x => x.品番コード, y => y.品番コード, (x, y) => new { STOCKTAKING = x, HIN = y }) .Join(context.M22_SOUK.Where(w => w.削除日時 == null && w.場所会社コード == pMyCompany), x => x.STOCKTAKING.庫コード, y => y.庫コード, (x, y) => new { x.STOCKTAKING, x.HIN, SOUK = y }) .GroupJoin(context.S03_STOK.Where(w => w.削除日時 == null), x => new { 庫コード = x.STOCKTAKING.庫コード, 品番コード = x.STOCKTAKING.品番コード, 賞味期限 = x.STOCKTAKING.賞味期限 }, y => new { 庫コード = y.庫コード, 品番コード = y.品番コード, 賞味期限 = y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (a, b) => new { STOCKTAKING = a.x.STOCKTAKING, HIN = a.x.HIN, SOUK = a.x.SOUK, STOK = b }) .GroupJoin(context.M06_IRO.Where(w => w.削除日時 == null), x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (g, h) => new { g.x.STOCKTAKING, g.x.HIN, g.x.SOUK, g.x.STOK, IRO = h }) .GroupJoin(context.M14_BRAND.Where(w => w.削除日時 == null), x => x.HIN.ブランド, y => y.ブランドコード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (i, j) => new { i.x.STOCKTAKING, i.x.HIN, i.x.SOUK, i.x.STOK, i.x.IRO, BRAND = j }) .GroupJoin(context.M15_SERIES.Where(w => w.削除日時 == null), x => x.HIN.シリーズ, y => y.シリーズコード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (k, l) => new { k.x.STOCKTAKING, k.x.HIN, k.x.SOUK, k.x.STOK, k.x.IRO, k.x.BRAND, SERIES = l }) .AsQueryable(); #region 入力項目による絞込 // 倉庫の条件チェック string Warehouse = pParamDic["倉庫コード"]; if (string.IsNullOrEmpty(Warehouse) == false) { int iWarehouse = int.Parse(Warehouse); stocktakingList = stocktakingList.Where(w => w.STOCKTAKING.庫コード == iWarehouse); } // 自社品番の条件チェック string myProduct = pParamDic["自社品番"]; if (string.IsNullOrEmpty(myProduct) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.自社品番 == myProduct); } // 品名の条件チェック string productName = pParamDic["自社品名"]; if (string.IsNullOrEmpty(productName) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.自社品名 != null && w.HIN.自社品名.Contains(productName)); } // 商品分類の条件チェック int itemType; if (int.TryParse(pParamDic["商品分類コード"], out itemType) == true) { if (itemType >= CommonConstants.商品分類.食品.GetHashCode()) { stocktakingList = stocktakingList.Where(w => w.HIN.商品分類 == itemType); } } // ブランドの条件チェック string brand = pParamDic["ブランドコード"]; if (string.IsNullOrEmpty(brand) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.ブランド == brand); } // シリーズの条件チェック string series = pParamDic["シリーズコード"]; if (string.IsNullOrEmpty(series) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.シリーズ == series); } #endregion // --------------------------- // 出力形式に成型 // --------------------------- retResult = stocktakingList .Select(s => new StocktakingDataMember { 棚卸日 = s.STOCKTAKING.棚卸日, 庫コード = s.STOCKTAKING.庫コード, 庫名 = s.SOUK.庫略称名, 品番コード = s.STOCKTAKING.品番コード, 自社品番 = s.HIN.自社品番, 自社品名 = s.HIN.自社品名, 自社色 = s.IRO == null ? null : s.IRO.色名称, 賞味期限 = s.STOCKTAKING.賞味期限, 数量 = s.STOK == null ? 0 : s.STOK.在庫数, 単位 = s.HIN.単位, 実在庫数 = s.STOCKTAKING.実在庫数, 品番追加FLG = s.STOCKTAKING.品番追加FLG, 更新済みFLG = s.STOCKTAKING.更新済みFLG, }) .ToList(); DateTime maxDate = AppCommon.GetMaxDate(); foreach (var row in retResult) { // 表示用賞味期限を設定 row.表示用賞味期限 = maxDate == row.賞味期限 ? "" : row.賞味期限.ToString("yyyy/MM/dd"); // 差異数量を設定 row.差異数量 = row.実在庫数 - row.数量; } return(retResult); }
/// <summary> /// 在庫集計処理 /// </summary> /// <param name="paramDic">パラメータ辞書</param> /// <param name="userId">ログインユーザID</param> public void InventorySummary(Dictionary <string, string> paramDic, int userId) { string yearMonth = paramDic["集計年月"]; int iYearMonth = int.Parse(yearMonth.Replace("/", "")); DateTime startDate = DateTime.Parse(string.Format("{0}/01", yearMonth)); // 集計月前月 int oneOldYearMonth = int.Parse(startDate.AddMonths(-1).ToString("yyyyMM")); // 集計月末日 DateTime endDate = new DateTime(startDate.Year, startDate.Month, DateTime.DaysInMonth(startDate.Year, startDate.Month)); using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { context.Connection.Open(); using (var tran = context.Connection.BeginTransaction(System.Data.IsolationLevel.Serializable)) { try { #region 集計のベースとなる倉庫・商品データを作成 // -- A.倉庫・品番の全組合せリスト var itemList = context.M22_SOUK.Where(w => w.削除日時 == null) .SelectMany(x => context.M09_HIN.Where(w => w.削除日時 == null), (x, y) => new { SOUK = x, HIN = y }); // -- B.前月の在庫締集計結果データ var stokMonthList = context.S05_STOK_MONTH .Where(w => w.締年月 == oneOldYearMonth); // -- C.対象月の入出庫データ var historyList = context.S04_HISTORY .Where(w => w.入出庫日 >= startDate && w.入出庫日 <= endDate); #endregion // 基本倉庫・商品データ var baseList = ( itemList.ToList() .Select(s => new BaseItemMember { 庫コード = s.SOUK.庫コード, 品番コード = s.HIN.品番コード, 賞味期限 = AppCommon.GetMaxDate() }) .Union(stokMonthList.ToList() .Select(s => new BaseItemMember { 庫コード = s.庫コード, 品番コード = s.品番コード, 賞味期限 = s.賞味期限 })) .Union(historyList.ToList() .Select(s => new BaseItemMember { 庫コード = s.庫コード, 品番コード = s.品番コード, 賞味期限 = s.賞味期限 ?? AppCommon.GetMaxDate() })) ) //.Distinct() // Remarks:Distinctが効かないのでGroupByで対応 .GroupBy(g => new { g.庫コード, g.品番コード, g.賞味期限 }) .Select(s => s.Key) .OrderBy(o => o.庫コード) .ThenBy(t => t.品番コード) .ThenBy(t => t.賞味期限); #region 入出庫データのデータを集計 // -- D.入庫データ集計 var receipt = historyList .Where(w => w.削除日時 == null && w.入出庫区分 == (int)CommonConstants.入出庫区分.ID01_入庫) .GroupBy(g => new { g.庫コード, g.品番コード, g.賞味期限 }) .ToList() .Select(s => new HistorySummaryMember { 庫コード = s.Key.庫コード, 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限 ?? AppCommon.GetMaxDate(), 数量 = s.Sum(m => m.数量 ?? 0) }); // -- E.出庫データ集計 var issue = historyList .Where(w => w.削除日時 == null && w.入出庫区分 == (int)CommonConstants.入出庫区分.ID02_出庫) .GroupBy(g => new { g.庫コード, g.品番コード, g.賞味期限 }) .ToList() .Select(s => new HistorySummaryMember { 庫コード = s.Key.庫コード, 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限 ?? AppCommon.GetMaxDate(), 数量 = s.Sum(m => m.数量 ?? 0) }); #endregion // 上記までのデータを使用して在庫数を計算取得 var result = baseList .GroupJoin(stokMonthList, x => new { x.庫コード, x.品番コード, x.賞味期限 }, y => new { y.庫コード, y.品番コード, y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (a, b) => new { BASE = a.x, STK = b }) .GroupJoin(receipt, x => new { x.BASE.庫コード, x.BASE.品番コード, x.BASE.賞味期限 }, y => new { y.庫コード, y.品番コード, y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (c, d) => new { c.x.BASE, c.x.STK, NYK = d }) .GroupJoin(issue, x => new { x.BASE.庫コード, x.BASE.品番コード, x.BASE.賞味期限 }, y => new { y.庫コード, y.品番コード, y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (e, f) => new { e.x.BASE, e.x.STK, e.x.NYK, SYK = f }) .Select(s => new S05_STOK_MONTH { 締年月 = iYearMonth, 庫コード = s.BASE.庫コード, 品番コード = s.BASE.品番コード, 賞味期限 = s.BASE.賞味期限, 在庫数量 = (s.STK != null ? s.STK.在庫数量 : 0) + (s.NYK != null ? s.NYK.数量 : 0) - (s.SYK != null ? s.SYK.数量 : 0), 登録者 = userId, 登録日時 = DateTime.Now }); //▼Add Start Arinobu 2019/03/19 主キー違反がおこるため result = result .GroupBy(g => new { g.締年月, g.庫コード, g.品番コード, g.賞味期限 }) .Select(s => new S05_STOK_MONTH { 締年月 = s.Key.締年月, 庫コード = s.Key.庫コード, 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限, 在庫数量 = s.Max(m => m.在庫数量), 登録者 = userId, 登録日時 = DateTime.Now }); //▲Add End Arinobu 2019/03/19 // 集計年月の作成済締データを一括削除 var delObject = context.ExecuteStoreQuery <object>(string.Format("DELETE FROM S05_STOK_MONTH WHERE 締年月 = {0}", iYearMonth)); // 抽出データを登録 result.Where(w => w.在庫数量 != 0).ToList().ForEach(S05 => context.S05_STOK_MONTH.ApplyChanges(S05)); // 変更内容を確定 context.SaveChanges(); // トランザクションのコミット tran.Commit(); } catch (Exception ex) { // トランザクションのロールバック tran.Rollback(); throw ex; } } } }
/// <summary> /// 商品在庫問い合わせ検索情報取得 /// </summary> /// <param name="p自社コード">画面指定の自社コード</param> /// <param name="p自社販社区分">(ログインユーザの)自社販社区分</param> /// <param name="cond"> /// == 検索条件 == /// 自社品番(品番指定検索) /// 検索品名(品名Like検索) /// 商品分類 /// シリーズ /// ブランド /// </param> /// <returns></returns> public List <SearchDataMember> GetDataList(int p自社コード, int p自社販社区分, Dictionary <string, string> cond) { using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { try { // 在庫基本情報 var stockList = context.S03_STOK.Where(w => w.削除日時 == null && w.在庫数 != 0) .Join(context.M09_HIN.Where(w => w.削除日時 == null), x => x.品番コード, y => y.品番コード, (x, y) => new { STOK = x, HIN = y }) .ToList(); #region 入力項目による絞込 // 自社品番の条件チェック string myProduct = cond["自社品番"]; if (!string.IsNullOrEmpty(myProduct)) { stockList = stockList.Where(w => w.HIN.自社品番 == myProduct).ToList(); } // 品名の条件チェック string productName = cond["検索品名"]; if (!string.IsNullOrEmpty(productName)) { stockList = stockList.Where(w => w.HIN.自社品名 != null && w.HIN.自社品名.Contains(productName)).ToList(); } // 商品分類の条件チェック int itemType; if (int.TryParse(cond["商品分類"], out itemType)) { if (itemType >= CommonConstants.商品分類.食品.GetHashCode()) { stockList = stockList.Where(w => w.HIN.商品分類 == itemType).ToList(); } } // ブランドの条件チェック string brand = cond["ブランド"]; if (!string.IsNullOrEmpty(brand)) { stockList = stockList.Where(w => w.HIN.ブランド == brand).ToList(); } // シリーズの条件チェック string series = cond["シリーズ"]; if (!string.IsNullOrEmpty(series)) { stockList = stockList.Where(w => w.HIN.シリーズ == series).ToList(); } #endregion var jis = context.M70_JIS .Where(w => w.削除日時 == null && w.自社コード == p自社コード) .FirstOrDefault(); // 販社の場合は、販社倉庫、マルセン倉庫(xxx確保)の在庫を抽出 // 自社の場合は、すべての倉庫の在庫を抽出 if (jis != null && jis.自社区分 == CommonConstants.自社区分.販社.GetHashCode()) { // No.270 Mod Start var soukList = context.M22_SOUK.Where(v => v.削除日時 == null && (v.寄託会社コード == p自社コード)) .Select(s => s.庫コード).ToList(); stockList = stockList.Where(w => soukList.Contains(w.STOK.庫コード)).ToList(); } // 検索データ取得 var dataList = stockList .GroupJoin(context.M22_SOUK.Where(w => w.削除日時 == null), x => x.STOK.庫コード, y => y.庫コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (a, b) => new { a.x.STOK, a.x.HIN, SOUK = b }) .GroupJoin(context.M06_IRO.Where(w => w.削除日時 == null), x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (c, d) => new { c.x.STOK, c.x.HIN, c.x.SOUK, IRO = d }) .GroupJoin(context.M70_JIS.Where(w => w.削除日時 == null), x => x.SOUK.寄託会社コード, y => y.自社コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (e, f) => new { e.x.STOK, e.x.HIN, e.x.SOUK, e.x.IRO, JIS = f }) .Select(x => new SearchDataMember { 自社コード = x.JIS.自社コード, // No.227,228 Add 自社名 = x.JIS.自社名 ?? "", // No.227,228 Add 庫コード = x.STOK.庫コード.ToString(), 庫名称 = x.SOUK != null ? x.SOUK.庫名 : "", 品番コード = x.STOK.品番コード.ToString(), 自社品番コード = x.HIN.自社品番, 自社色コード = x.HIN.自社色, 品番名称 = x.HIN.自社品名, 色名称 = x.IRO != null ? x.IRO.色名称 : "", 賞味期限 = AppCommon.GetMaxDate() == x.STOK.賞味期限 ? "" : x.STOK.賞味期限.ToString("yyyy/MM/dd"), 在庫数量 = x.STOK.在庫数, 単位 = x.HIN.単位 }); return(dataList.ToList()); } catch (System.ArgumentException agex) { throw agex; } catch (Exception ex) { throw ex; } } }
/// <summary> /// 在庫評価額一覧印刷データ取得 /// </summary> /// <param name="dic">検索条件Dictionary</param> /// <returns></returns> public List <PrintMenber> GetPrintData(Dictionary <string, string> dic) { using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { try { int val = -1; int yearMonth = Int32.TryParse(dic["処理年月"].Replace("/", ""), out val) ? val : -1; int companyCd = Int32.TryParse(dic["会社コード"], out val) ? val : -1; int sokoCd = Int32.TryParse(dic["倉庫コード"], out val) ? val : -1; int tagetStock = Int32.TryParse(dic["対象在庫"], out val) ? val == (int)対象在庫.月次在庫 ? (int)対象在庫.月次在庫 : (int)対象在庫.調整在庫 : -1; #region 月次在庫データを取得 // 月次在庫データを取得 if (tagetStock == (int)対象在庫.月次在庫) { // =========================== // 在庫基本情報取得 // =========================== // 月次在庫情報取得 var stocktakingList = context.S05_STOK_MONTH.Where(w => w.締年月 == yearMonth) .Join(context.M09_HIN.Where(w => w.削除日時 == null), x => x.品番コード, y => y.品番コード, (x, y) => new { STOK_MONTH = x, HIN = y }) .GroupJoin(context.M22_SOUK.Where(w => w.削除日時 == null), x => x.STOK_MONTH.庫コード, y => y.庫コード, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (a, b) => new { STOK_MONTH = a.x.STOK_MONTH, HIN = a.x.HIN, SOUK = b }) .ToList(); // 検索条件絞り込み if (companyCd != -1) { stocktakingList = stocktakingList.Where(w => w.SOUK.場所会社コード == companyCd).ToList(); } if (sokoCd != -1) { stocktakingList = stocktakingList.Where(w => w.STOK_MONTH.庫コード == sokoCd).ToList(); } // =========================== // 直近の仕入単価(最少額)を取得 // =========================== // 年月末日の取得 ZIK05010 zik05010 = new ZIK05010(); DateTime dteEndofMonth = zik05010.getDateEndofMonth(yearMonth); // 品番毎の直近日付を取得する var LatestList = context.T03_SRHD.Where(w => w.削除日時 == null && w.仕入日 < dteEndofMonth) .Join(context.T03_SRDTL.Where(w => w.削除日時 == null), x => x.伝票番号, y => y.伝票番号, (x, y) => new { SHD = x, SDTL = y }) .GroupBy(g => new { g.SDTL.品番コード, g.SDTL.賞味期限 }) .Select(s => new { 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限, 仕入日 = s.Max(m => m.SHD.仕入日), }) .OrderBy(o => o.品番コード) .ToList(); // 直近の仕入単価(最少額)を取得 DateTime dteMaxDate = AppCommon.GetMaxDate(); var PurchaseList = LatestList .Join(context.T03_SRHD.Where(w => w.削除日時 == null), x => x.仕入日, y => y.仕入日, (x, y) => new { Latest = x, SRHD = y }) .Join(context.T03_SRDTL.Where(w => w.削除日時 == null), x => new { dno = x.SRHD.伝票番号, hin = x.Latest.品番コード, date = x.Latest.賞味期限 }, y => new { dno = y.伝票番号, hin = y.品番コード, date = y.賞味期限 }, (x, y) => new { x.Latest, x.SRHD, SDTL = y }) .GroupBy(g => new { g.SDTL.品番コード, g.SDTL.賞味期限 }) .Select(s => new ZIK05010.SearchDataUnitPrice { 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限 ?? dteMaxDate, 仕入単価 = s.Min(m => m.SDTL.単価), }) .OrderBy(o => o.品番コード) .ToList(); // =========================== // 帳票データ取得 // =========================== var dataList = stocktakingList .GroupJoin(context.M06_IRO.Where(w => w.削除日時 == null), x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (a, b) => new { a.x.STOK_MONTH, a.x.HIN, a.x.SOUK, IRO = b }) .GroupJoin(context.M70_JIS.Where(w => w.削除日時 == null), x => x.SOUK.寄託会社コード, y => y.自社コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (c, d) => new { c.x.STOK_MONTH, c.x.HIN, c.x.SOUK, c.x.IRO, JIS = d }) .GroupJoin(PurchaseList.Where(w => w.品番コード > 0), x => new { dno = x.STOK_MONTH.品番コード, date = x.STOK_MONTH.賞味期限 }, y => new { dno = y.品番コード, date = y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (e, f) => new { e.x.STOK_MONTH, e.x.HIN, e.x.SOUK, e.x.IRO, e.x.JIS, Purchase = f }) .Select(x => new PrintMenber { 自社コード = x.JIS.自社コード, 自社名 = x.JIS.自社名 ?? "", 庫名 = x.SOUK != null ? x.SOUK.庫略称名 : "", 庫コード = x.STOK_MONTH.庫コード, 品番コード = x.STOK_MONTH.品番コード, 自社品番 = x.HIN.自社品番, 自社品名 = x.HIN.自社品名, 自社色コード = x.HIN.自社色, 色名称 = x.IRO != null ? x.IRO.色名称 : "", 賞味期限 = AppCommon.GetMaxDate() == x.STOK_MONTH.賞味期限 ? "" : x.STOK_MONTH.賞味期限.ToString("yyyy/MM/dd"), 数量 = x.STOK_MONTH.在庫数量, 単位 = x.HIN.単位, 単価 = x.HIN.商品形態分類 == (int)商品形態分類.SET品 ? x.HIN.原価 ?? 0 : x.Purchase != null ? x.Purchase.仕入単価 : x.HIN.原価 ?? 0, 評価額 = x.STOK_MONTH.在庫数量 * (x.Purchase != null ? x.Purchase.仕入単価 : x.HIN.原価 ?? 0) }) .OrderBy(o => o.自社コード) .ThenBy(t => t.庫コード) .ThenBy(t => t.品番コード) .ThenBy(t => t.自社色コード) .ThenBy(t => t.賞味期限) ; return(dataList.ToList()); } #endregion #region 調整在庫データを取得 // 調整在庫データを取得 else { // =========================== // 在庫基本情報取得 // =========================== // 調整在庫情報取得 var stockAdjTakingList = context.S05_STOK_ADJUST.Where(w => w.締年月 == yearMonth) .Join(context.M09_HIN.Where(w => w.削除日時 == null), x => x.品番コード, y => y.品番コード, (x, y) => new { STOK_MONTH = x, HIN = y }) .GroupJoin(context.M22_SOUK.Where(w => w.削除日時 == null), x => x.STOK_MONTH.庫コード, y => y.庫コード, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (a, b) => new { STOK_MONTH = a.x.STOK_MONTH, HIN = a.x.HIN, SOUK = b }) .ToList(); // 検索条件絞り込み if (companyCd != -1) { stockAdjTakingList = stockAdjTakingList.Where(w => w.SOUK.場所会社コード == companyCd).ToList(); } if (sokoCd != -1) { stockAdjTakingList = stockAdjTakingList.Where(w => w.STOK_MONTH.庫コード == sokoCd).ToList(); } // =========================== // 帳票データ取得 // =========================== var dataList = stockAdjTakingList .GroupJoin(context.M06_IRO.Where(w => w.削除日時 == null), x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (a, b) => new { a.x.STOK_MONTH, a.x.HIN, a.x.SOUK, IRO = b }) .GroupJoin(context.M70_JIS.Where(w => w.削除日時 == null), x => x.SOUK.寄託会社コード, y => y.自社コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (c, d) => new { c.x.STOK_MONTH, c.x.HIN, c.x.SOUK, c.x.IRO, JIS = d }) .Select(x => new PrintMenber { 自社コード = x.JIS.自社コード, 自社名 = x.JIS.自社名 ?? "", 庫名 = x.SOUK != null ? x.SOUK.庫略称名 : "", 庫コード = x.STOK_MONTH.庫コード, 品番コード = x.STOK_MONTH.品番コード, 自社品番 = x.HIN.自社品番, 自社品名 = x.HIN.自社品名, 自社色コード = x.HIN.自社色, 色名称 = x.IRO != null ? x.IRO.色名称 : "", 賞味期限 = AppCommon.GetMaxDate() == x.STOK_MONTH.賞味期限 ? "" : x.STOK_MONTH.賞味期限.ToString("yyyy/MM/dd"), 数量 = x.STOK_MONTH.在庫数量, 単位 = x.HIN.単位, 単価 = x.STOK_MONTH.仕入単価, 評価額 = x.STOK_MONTH.在庫数量 * x.STOK_MONTH.仕入単価 }) .OrderBy(o => o.自社コード) .ThenBy(t => t.庫コード) .ThenBy(t => t.品番コード) .ThenBy(t => t.自社色コード) .ThenBy(t => t.賞味期限) ; return(dataList.ToList()); } #endregion } catch (System.ArgumentException agex) { throw agex; } catch (Exception ex) { throw ex; } } }
/// <summary> /// 月次在庫データ取得 /// </summary> /// <param name="pDateYM">処理年月</param> /// <param name="pCompany">会社コード</param> /// <param name="pSokoCd">倉庫コード</param> /// <returns></returns> public List <SearchDataMember> GetData(string pDateYM, string pCompany, string pSokoCd) { using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { try { int yearMonth = int.Parse(pDateYM.Replace("/", "")); int val = -1; int companyCd = Int32.TryParse(pCompany, out val) ? val : -1; int sokoCd = Int32.TryParse(pSokoCd, out val)? val : -1; #region 月次在庫データを取得 // 月次在庫データを取得 // =========================== // 在庫基本情報取得 // =========================== // 月次在庫情報取得 var stocktakingList = context.S05_STOK_MONTH.Where(w => w.締年月 == yearMonth) .Join(context.M09_HIN.Where(w => w.削除日時 == null), x => x.品番コード, y => y.品番コード, (x, y) => new { STOK_MONTH = x, HIN = y }) .GroupJoin(context.M22_SOUK.Where(w => w.削除日時 == null), x => x.STOK_MONTH.庫コード, y => y.庫コード, (x, y) => new { x, y }) .SelectMany(z => z.y.DefaultIfEmpty(), (a, b) => new { STOK_MONTH = a.x.STOK_MONTH, HIN = a.x.HIN, SOUK = b }) .ToList(); // 検索条件絞り込み if (companyCd != -1) { stocktakingList = stocktakingList.Where(w => w.SOUK.場所会社コード == companyCd).ToList(); } if (sokoCd != -1) { stocktakingList = stocktakingList.Where(w => w.STOK_MONTH.庫コード == sokoCd).ToList(); } // =========================== // 直近の仕入単価(最少額)を取得 // =========================== // 年月末日の取得 ZIK05010 zik05010 = new ZIK05010(); DateTime dteEndofMonth = zik05010.getDateEndofMonth(yearMonth); // 品番毎の直近日付を取得する var LatestList = context.T03_SRHD.Where(w => w.削除日時 == null && w.仕入日 < dteEndofMonth) .Join(context.T03_SRDTL.Where(w => w.削除日時 == null), x => x.伝票番号, y => y.伝票番号, (x, y) => new { SHD = x, SDTL = y }) .GroupBy(g => new { g.SDTL.品番コード, g.SDTL.賞味期限 }) .Select(s => new { 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限, 仕入日 = s.Max(m => m.SHD.仕入日), }) .OrderBy(o => o.品番コード) .ToList(); // 直近の仕入単価(最少額)を取得 DateTime dteMaxDate = AppCommon.GetMaxDate(); var PurchaseList = LatestList .Join(context.T03_SRHD.Where(w => w.削除日時 == null), x => x.仕入日, y => y.仕入日, (x, y) => new { Latest = x, SRHD = y }) .Join(context.T03_SRDTL.Where(w => w.削除日時 == null), x => new { dno = x.SRHD.伝票番号, hin = x.Latest.品番コード, date = x.Latest.賞味期限 }, y => new { dno = y.伝票番号, hin = y.品番コード, date = y.賞味期限 }, (x, y) => new { x.Latest, x.SRHD, SDTL = y }) .GroupBy(g => new { g.SDTL.品番コード, g.SDTL.賞味期限 }) .Select(s => new ZIK05010.SearchDataUnitPrice { 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限 ?? dteMaxDate, 仕入単価 = s.Min(m => m.SDTL.単価), }) .OrderBy(o => o.品番コード) .ToList(); // =========================== // データ取得 // =========================== var dataList = stocktakingList .GroupJoin(context.M06_IRO.Where(w => w.削除日時 == null), x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (a, b) => new { a.x.STOK_MONTH, a.x.HIN, a.x.SOUK, IRO = b }) .GroupJoin(context.M70_JIS.Where(w => w.削除日時 == null), x => x.SOUK.寄託会社コード, y => y.自社コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (c, d) => new { c.x.STOK_MONTH, c.x.HIN, c.x.SOUK, c.x.IRO, JIS = d }) .GroupJoin(PurchaseList.Where(w => w.品番コード > 0), x => new { dno = x.STOK_MONTH.品番コード, date = x.STOK_MONTH.賞味期限 }, y => new { dno = y.品番コード, date = y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (e, f) => new { e.x.STOK_MONTH, e.x.HIN, e.x.SOUK, e.x.IRO, e.x.JIS, Purchase = f }) .Select(s => new SearchDataMember { 締年月 = s.STOK_MONTH.締年月, 品番コード = s.STOK_MONTH.品番コード, 自社品番 = s.HIN.自社品番, 自社色 = s.HIN.自社色, 色名称 = s.IRO != null ? s.IRO.色名称 : "", 自社品名 = s.HIN.自社品名, 賞味期限 = s.STOK_MONTH.賞味期限 == DEFAULT_YYYYMMDD ? (DateTime?)null : s.STOK_MONTH.賞味期限, 庫コード = s.STOK_MONTH.庫コード, 庫名 = s.SOUK != null ? s.SOUK.庫略称名 : "", 仕入単価 = s.HIN.商品形態分類 == (int)商品形態分類.SET品 ? s.HIN.原価 ?? 0 : s.Purchase != null ? s.Purchase.仕入単価 : s.HIN.原価 ?? 0, 在庫数量 = s.STOK_MONTH.在庫数量, 調整単価 = null, 調整数量 = null, }) .OrderBy(t => t.庫コード) .ThenBy(t => t.品番コード) .ThenBy(t => t.賞味期限); return(dataList.ToList()); #endregion } catch (Exception ex) { throw ex; } } }
/// <summary> /// 商品在庫残高一覧表情報取得 /// </summary> /// <param name="pMyCompany">画面指定の自社コード</param> /// <param name="pDate">締年月</param> /// <param name="pParamDic"> /// == 検索条件 == /// 自社品番(品番指定検索) /// 検索品名(品名Like検索) /// 商品分類 /// シリーズ /// ブランド /// </param> /// <param name="pCoefficient">係数</param> /// <returns></returns> public List <SearchDataMember> GetPrintList(int pMyCompany, string pDate, Dictionary <string, string> pParamDic, decimal pCoefficient) { using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { try { int yearMonth = int.Parse(pDate.Replace("/", "")); // =========================== // 在庫基本情報取得 // =========================== // 月次在庫情報取得 var stocktakingList = context.S05_STOK_MONTH.Where(w => w.締年月 == yearMonth) .Join(context.M09_HIN.Where(w => w.削除日時 == null), x => x.品番コード, y => y.品番コード, (x, y) => new { STOK_MONTH = x, HIN = y }) .Join(context.M22_SOUK.Where(w => w.削除日時 == null && w.場所会社コード == pMyCompany), x => x.STOK_MONTH.庫コード, y => y.庫コード, (x, y) => new { x.STOK_MONTH, x.HIN, SOUK = y }) .ToList(); #region 入力項目による絞込 // 倉庫の条件チェック string Warehouse = pParamDic["倉庫コード"]; if (string.IsNullOrEmpty(Warehouse) == false) { stocktakingList = stocktakingList.Where(w => w.STOK_MONTH.庫コード == int.Parse(Warehouse)).ToList(); } // 自社品番の条件チェック string myProduct = pParamDic["自社品番"]; if (string.IsNullOrEmpty(myProduct) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.自社品番 == myProduct).ToList(); } // 品名の条件チェック string productName = pParamDic["自社品名"]; if (string.IsNullOrEmpty(productName) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.自社品名 != null && w.HIN.自社品名.Contains(productName)).ToList(); } // 商品分類の条件チェック int itemType; if (int.TryParse(pParamDic["商品分類コード"], out itemType) == true) { if (itemType >= CommonConstants.商品分類.食品.GetHashCode()) { stocktakingList = stocktakingList.Where(w => w.HIN.商品分類 == itemType).ToList(); } } // ブランドの条件チェック string brand = pParamDic["ブランドコード"]; if (string.IsNullOrEmpty(brand) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.ブランド == brand).ToList(); } // シリーズの条件チェック string series = pParamDic["シリーズコード"]; if (string.IsNullOrEmpty(series) == false) { stocktakingList = stocktakingList.Where(w => w.HIN.シリーズ == series).ToList(); } #endregion // =========================== // 直近の仕入単価(最少額)を取得 // =========================== // 年月末日の取得 DateTime dteEndofMonth = getDateEndofMonth(yearMonth); // 品番毎の直近日付を取得する var LatestList = context.T03_SRHD.Where(w => w.削除日時 == null && w.仕入日 < dteEndofMonth) .Join(context.T03_SRDTL.Where(w => w.削除日時 == null), x => x.伝票番号, y => y.伝票番号, (x, y) => new { SHD = x, SDTL = y }) .GroupBy(g => new { g.SDTL.品番コード, g.SDTL.賞味期限 }) .Select(s => new { 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限, 仕入日 = s.Max(m => m.SHD.仕入日), }) .OrderBy(o => o.品番コード) .ToList(); // 直近の仕入単価(最少額)を取得 DateTime dteMaxDate = AppCommon.GetMaxDate(); var PurchaseList = LatestList .Join(context.T03_SRHD.Where(w => w.削除日時 == null), x => x.仕入日, y => y.仕入日, (x, y) => new { Latest = x, SRHD = y }) .Join(context.T03_SRDTL.Where(w => w.削除日時 == null), x => new { dno = x.SRHD.伝票番号, hin = x.Latest.品番コード, date = x.Latest.賞味期限 }, y => new { dno = y.伝票番号, hin = y.品番コード, date = y.賞味期限 }, (x, y) => new { x.Latest, x.SRHD, SDTL = y }) .GroupBy(g => new { g.SDTL.品番コード, g.SDTL.賞味期限 }) .Select(s => new SearchDataUnitPrice { 品番コード = s.Key.品番コード, 賞味期限 = s.Key.賞味期限 ?? dteMaxDate, 仕入単価 = s.Min(m => m.SDTL.単価), }) .OrderBy(o => o.品番コード) .ToList(); // =========================== // 帳票データ取得 // =========================== var dataList = stocktakingList .GroupJoin(context.M06_IRO.Where(w => w.削除日時 == null), x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (a, b) => new { a.x.STOK_MONTH, a.x.HIN, a.x.SOUK, IRO = b }) .GroupJoin(context.M70_JIS.Where(w => w.削除日時 == null), x => x.SOUK.寄託会社コード, y => y.自社コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (c, d) => new { c.x.STOK_MONTH, c.x.HIN, c.x.SOUK, c.x.IRO, JIS = d }) .GroupJoin(PurchaseList.Where(w => w.品番コード > 0), x => new { dno = x.STOK_MONTH.品番コード, date = x.STOK_MONTH.賞味期限 }, y => new { dno = y.品番コード, date = y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (e, f) => new { e.x.STOK_MONTH, e.x.HIN, e.x.SOUK, e.x.IRO, e.x.JIS, Purchase = f }) .Select(x => new SearchDataMember { 自社コード = x.JIS.自社コード, 自社名 = x.JIS.自社名 ?? "", 庫コード = x.STOK_MONTH.庫コード.ToString(), 庫名称 = x.SOUK != null ? x.SOUK.庫略称名 : "", 品番コード = x.STOK_MONTH.品番コード.ToString(), 自社品番コード = x.HIN.自社品番, 自社色コード = x.HIN.自社色, 品番名称 = x.HIN.自社品名, 色名称 = x.IRO != null ? x.IRO.色名称 : "", 賞味期限 = AppCommon.GetMaxDate() == x.STOK_MONTH.賞味期限 ? "" : x.STOK_MONTH.賞味期限.ToString("yyyy/MM/dd"), 数量 = x.STOK_MONTH.在庫数量, 単位 = x.HIN.単位, 単価 = (x.Purchase != null ? x.Purchase.仕入単価 : x.HIN.原価 ?? 0) * pCoefficient, 金額 = x.STOK_MONTH.在庫数量 * (x.Purchase != null ? x.Purchase.仕入単価 : x.HIN.原価 ?? 0) * pCoefficient }) .OrderBy(o => o.自社コード) .ThenBy(t => t.庫コード) .ThenBy(t => t.品番コード) .ThenBy(t => t.自社色コード) .ThenBy(t => t.賞味期限) ; return(dataList.ToList()); } catch (System.ArgumentException agex) { throw agex; } catch (Exception ex) { throw ex; } } }
/// <summary> /// 在庫データ取得 /// </summary> /// <param name="context">TRAC3Entities</param> /// <param name="pMyCompany">自社コード</param> /// <param name="pStocktakingDate">棚卸日</param> /// <param name="pParamDic">パラメータ辞書</param> public List <StocktakingDataMember> GetStockList(TRAC3Entities context, int pMyCompany, string pStocktakingDate, Dictionary <string, string> pParamDic) { DateTime dteStocktaking = DateTime.Parse(pStocktakingDate); // --------------------------- // 情報取得 // --------------------------- // 棚卸在庫情報(品番マスタ,倉庫マスタ,在庫テーブル) List <StocktakingDataMember> retResult = new List <StocktakingDataMember>(); var stockList = context.S03_STOK.Where(w => w.削除日時 == null) .Join(context.M22_SOUK.Where(w => w.削除日時 == null && w.場所会社コード == pMyCompany), x => x.庫コード, y => y.庫コード, (x, y) => new { STOK = x, SOUK = y }) .Join(context.M09_HIN.Where(w => w.削除日時 == null), x => x.STOK.品番コード, y => y.品番コード, (x, y) => new { x.STOK, x.SOUK, HIN = y }) .GroupJoin(context.S10_STOCKTAKING.Where(w => w.棚卸日 == dteStocktaking && w.更新済みFLG == 1 && w.削除日時 == null), x => new { 庫コード = x.STOK.庫コード, 品番コード = x.STOK.品番コード, 賞味期限 = x.STOK.賞味期限 }, y => new { 庫コード = y.庫コード, 品番コード = y.品番コード, 賞味期限 = y.賞味期限 }, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (a, b) => new { a.x.STOK, a.x.SOUK, a.x.HIN, STOCKTAKING = b }) .GroupJoin(context.M06_IRO.Where(w => w.削除日時 == null), x => x.HIN.自社色, y => y.色コード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (e, f) => new { e.x.STOK, e.x.SOUK, e.x.HIN, e.x.STOCKTAKING, IRO = f }) .GroupJoin(context.M14_BRAND.Where(w => w.削除日時 == null), x => x.HIN.ブランド, y => y.ブランドコード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (g, h) => new { g.x.STOK, g.x.SOUK, g.x.HIN, g.x.STOCKTAKING, g.x.IRO, BRAND = h }) .GroupJoin(context.M15_SERIES.Where(w => w.削除日時 == null), x => x.HIN.シリーズ, y => y.シリーズコード, (x, y) => new { x, y }) .SelectMany(x => x.y.DefaultIfEmpty(), (i, j) => new { i.x.STOK, i.x.SOUK, i.x.HIN, i.x.STOCKTAKING, i.x.IRO, i.x.BRAND, SERIES = j }) .Where(c => c.STOCKTAKING == null) .AsQueryable(); #region 入力項目による絞込 // 倉庫の条件チェック string Warehouse = pParamDic["倉庫コード"]; if (string.IsNullOrEmpty(Warehouse) == false) { int iWarehouse = int.Parse(Warehouse); stockList = stockList.Where(w => w.STOK.庫コード == iWarehouse); } #endregion // --------------------------- // 出力形式に成型 // --------------------------- retResult = stockList .Select(s => new StocktakingDataMember { 棚卸日 = dteStocktaking, 庫コード = s.STOK.庫コード, 庫名 = s.SOUK.庫略称名, 品番コード = s.STOK.品番コード, 自社品番 = s.HIN.自社品番, 自社品名 = s.HIN.自社品名, シリーズ = s.SERIES == null ? null : s.SERIES.シリーズコード, ブランド = s.BRAND == null ? null : s.BRAND.ブランドコード, 自社色 = s.IRO == null ? null : s.IRO.色名称, 賞味期限 = s.STOK.賞味期限, 数量 = s.STOK == null ? 0 : s.STOK.在庫数, 単位 = s.HIN.単位, 実在庫数 = 0, 品番追加FLG = 0, 更新済みFLG = 0, 商品分類 = s.HIN.商品分類, 新規データFLG = true, 行追加FLG = false, }) .ToList(); DateTime maxDate = AppCommon.GetMaxDate(); foreach (var row in retResult) { row.表示用賞味期限 = maxDate == row.賞味期限 ? "" : row.賞味期限.ToString("yyyy/MM/dd"); } return(retResult); }
/// <summary> /// 在庫参照データを取得する /// </summary> /// <param name="stockpileCode"></param> /// <param name="paramDic"></param> /// <returns></returns> public List <Search_S03_STOK> GetData(int stockpileCode, Dictionary <string, string> paramDic) { using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString())) { context.Connection.Open(); DateTime maxDate = AppCommon.GetMaxDate(); var result = context.S03_STOK .Where(w => w.削除日時 == null && w.庫コード == stockpileCode) .Join(context.V_M09_HIN, x => x.品番コード, y => y.品番コード, (x, y) => new { STOK = x, HIN = y }) .ToList() .Select(x => new Search_S03_STOK { 品番コード = x.STOK.品番コード, 自社品番 = x.HIN.自社品番 ?? string.Empty, 自社品名 = x.HIN.自社品名 ?? string.Empty, 自社色名 = x.HIN.自社色名 ?? string.Empty, 賞味期限 = x.STOK.賞味期限 == maxDate ? (DateTime?)null : x.STOK.賞味期限, 在庫数 = x.STOK.在庫数, ブランド名 = x.HIN.ブランド名 ?? string.Empty, シリーズ名 = x.HIN.シリーズ名 ?? string.Empty, 品群名 = x.HIN.品群名 ?? string.Empty }); #region 画面入力条件適用 string productCode = paramDic["品番"], productName = paramDic["品名"], colorName = paramDic["色名"], brandName = paramDic["ブランド"], seriesName = paramDic["シリーズ"], hingunName = paramDic["品群"]; if (!string.IsNullOrEmpty(productCode)) { result = result.Where(x => x.自社品番.Contains(productCode)); } if (!string.IsNullOrEmpty(productName)) { result = result.Where(x => x.自社品名.Contains(productName)); } if (!string.IsNullOrEmpty(colorName)) { result = result.Where(x => x.自社色名.Contains(colorName)); } if (!string.IsNullOrEmpty(brandName)) { result = result.Where(x => x.ブランド名.Contains(brandName)); } if (!string.IsNullOrEmpty(seriesName)) { result = result.Where(x => x.シリーズ名.Contains(seriesName)); } if (!string.IsNullOrEmpty(hingunName)) { result = result.Where(x => x.品群名.Contains(hingunName)); } #endregion return(result.ToList()); } }