|
|
@@ -26,6 +26,8 @@ using Business.StructuredDB.Replenishment;
|
|
|
using System.ComponentModel.Design;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using MathNet.Numerics.RootFinding;
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
+using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
namespace Business.Replenishment
|
|
|
{
|
|
|
@@ -57,6 +59,7 @@ namespace Business.Replenishment
|
|
|
private readonly IRepository<srm_pr_main, long> _mysql_srm_pr_main;
|
|
|
private readonly IRepository<mo_srm_po_occupy, long> _srm_po_occupy;
|
|
|
private readonly IRepository<srm_po_occupy, long> _mysql_srm_po_occupy;
|
|
|
+ private readonly IRepository<srm_pr_main_occupy, long> _mysql_srm_pr_main_occupy;
|
|
|
private readonly IRepository<mo_mes_morder, long> _mes_morder;
|
|
|
private readonly IRepository<mo_mes_moentry, long> _mes_moentry;
|
|
|
private readonly IRepository<mo_mes_mooccupy, long> _mes_mooccupy;
|
|
|
@@ -237,6 +240,7 @@ namespace Business.Replenishment
|
|
|
IRepository<srm_pr_main, long> mysql_srm_pr_main,
|
|
|
IRepository<mo_srm_po_occupy, long> srm_po_occupy,
|
|
|
IRepository<srm_po_occupy, long> mysql_srm_po_occupy,
|
|
|
+ IRepository<srm_pr_main_occupy, long> mysql_srm_pr_main_occupy,
|
|
|
IRepository<mo_mes_morder, long> mes_morder,
|
|
|
IRepository<mo_mes_moentry, long> mes_moentry,
|
|
|
IRepository<mo_mes_mooccupy, long> mes_mooccupy,
|
|
|
@@ -318,7 +322,8 @@ namespace Business.Replenishment
|
|
|
_mysql_srm_pr_main= mysql_srm_pr_main;
|
|
|
_srm_po_occupy = srm_po_occupy;
|
|
|
_mysql_srm_po_occupy = mysql_srm_po_occupy;
|
|
|
- _mes_morder= mes_morder;
|
|
|
+ _mysql_srm_pr_main_occupy = mysql_srm_pr_main_occupy;
|
|
|
+ _mes_morder = mes_morder;
|
|
|
_mes_moentry = mes_moentry;
|
|
|
_mes_mooccupy = mes_mooccupy;
|
|
|
_mysql_mes_mooccupy = mysql_mes_mooccupy;
|
|
|
@@ -503,6 +508,11 @@ namespace Business.Replenishment
|
|
|
annualProductionOutline.Totalhours = annualProductionOutline.AssemblyHours + annualProductionOutline.HeatSealingHours + annualProductionOutline.Totalhours;
|
|
|
annualProductionOutline.OrderNum = item.OrderNum;
|
|
|
annualProductionOutlines.Add(annualProductionOutline);
|
|
|
+ annualProductionOutline.create_time= DateTime.Now;
|
|
|
+ annualProductionOutline.tenant_id = input.tenant_id;
|
|
|
+ annualProductionOutline.company_id= input.company_id;
|
|
|
+ annualProductionOutline.factory_id= input.factory_id;
|
|
|
+ annualProductionOutline.org_id= input.org_id;
|
|
|
frontYearDemand.Add(item);
|
|
|
}
|
|
|
//保存数据
|
|
|
@@ -531,34 +541,79 @@ namespace Business.Replenishment
|
|
|
public async Task<string> SaveProductionMasterPlan(InputDto input)
|
|
|
{
|
|
|
//计算当前年月的N0,N+1,N+2
|
|
|
- List<string> planMons = new List<string>();
|
|
|
- string strN0 = input.year.ToString() + "-" + input.month.ToString("00");
|
|
|
- planMons.Add(strN0);
|
|
|
- int newYear = input.month == 12 ? input.year + 1 : input.year;
|
|
|
- int newMonth = input.month == 12 ? 1 : input.month + 1;
|
|
|
- string strN1 = newYear.ToString() + "-" + newMonth.ToString("00");
|
|
|
- planMons.Add(strN1);
|
|
|
- newYear = newMonth == 12 ? newYear + 1 : newYear;
|
|
|
- newMonth = newMonth == 12 ? 1 : newMonth + 1;
|
|
|
- string strN2 = newYear.ToString() + "-" + newMonth.ToString("00");
|
|
|
- planMons.Add(strN2);
|
|
|
+ List<string> planMons = GetPlanMonth(3);
|
|
|
+ List<ProductionMasterPlan> productionMasters= new List<ProductionMasterPlan>();
|
|
|
+ List<ProductionMasterPlan> pre3MonthPlan = _productionMasterPlan.GetListAsync(a => GetPlanMonth(-3).Contains(a.PlanMonth) && a.factory_id == input.factory_id && a.tenant_id == input.tenant_id && a.company_id == input.company_id).Result;
|
|
|
//N0,N+1,N+2月度发货计划
|
|
|
- var productionMasterPlan = _productionMasterPlan.GetListAsync(x => x.Year == input.year && !x.IsDeleted && x.tenant_id == input.tenant_id && x.company_id == input.company_id && x.factory_id == input.factory_id && planMons.Contains(x.PlanMonth)).Result.OrderBy(p => p.OrderNum).ThenBy(o => o.PlanMonth).ToList();
|
|
|
- foreach (var item in productionMasterPlan)
|
|
|
+ var annualProduction = _replenishmentAnnualProduction.GetListAsync(x => planMons.Contains(x.PlanMonth) && !x.IsDeleted && x.tenant_id == input.tenant_id && x.company_id == input.company_id && x.factory_id == input.factory_id).Result.OrderBy(p => p.PlanMonth).ThenBy(o => o.OrderNum).ToList();
|
|
|
+
|
|
|
+ var productionMasterPlan = _productionMasterPlan.GetListAsync(x => planMons.Contains(x.PlanMonth) && !x.IsDeleted && x.tenant_id == input.tenant_id && x.company_id == input.company_id && x.factory_id == input.factory_id).Result.OrderBy(p => p.PlanMonth).ThenBy(o => o.OrderNum).ToList();
|
|
|
+ List<LocationDetail> locations = _locationDetail.Select(x => annualProduction.Select(m => m.SAPItemNumber).Contains(x.ItemNum) && x.Domain == input.factory_id.ToString() && x.IsActive).ToList();
|
|
|
+ var InProdcutQty=GetInProdcutQty(annualProduction.Select(m => m.SAPItemNumber).ToList(),input);
|
|
|
+ var itemStock = CalcStock(annualProduction.Select(m => m.SAPItemNumber).ToList(),input);
|
|
|
+ foreach (var item in annualProduction)
|
|
|
{
|
|
|
+ ProductionMasterPlan plan = new ProductionMasterPlan();
|
|
|
+ plan.Area = item.Area;
|
|
|
+ plan.ProdLine = item.ProdLine;
|
|
|
+ plan.ProdRange = item.ProdRange;
|
|
|
+ plan.WorkshopLine = item.WorkshopLine;
|
|
|
+ plan.ItemNumber = item.SAPItemNumber;
|
|
|
+ plan.Model = item.Model;
|
|
|
+ plan.Languages = item.Languages;
|
|
|
+ plan.PlanMonth = item.PlanMonth;
|
|
|
+ plan.PlanShipQty = item.Qty;
|
|
|
+ //计划生产数量取下个月计划发货数量的一半
|
|
|
+ plan.PlanProductQty = item.Qty- itemStock.Find(a => a.ItemNumber == item.SAPItemNumber).Qty- InProdcutQty.Find(a => a.ItemNumber == item.SAPItemNumber).Qty;//发货计划-(库存+在制)
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ plan.PlanStockQty= item.Qty;//TODO:期末库存怎么算?
|
|
|
|
|
|
+ if(locations.FirstOrDefault(a => a.ItemNum == item.SAPItemNumber && a.Location == "8001")!=null)
|
|
|
+ {
|
|
|
+ plan.Inventory = locations.FirstOrDefault(a => a.ItemNum == item.SAPItemNumber && a.Location == "8001").QtyOnHand;
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ plan.Inventory = 0;
|
|
|
+ }
|
|
|
+ if (locations.FirstOrDefault(a => a.ItemNum == item.SAPItemNumber && a.Location == "8000") != null)
|
|
|
+ {
|
|
|
+ plan.Inventory1 = locations.FirstOrDefault(a => a.ItemNum == item.SAPItemNumber && a.Location == "8000").QtyOnHand;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ plan.Inventory1 = 0;
|
|
|
+ }
|
|
|
+ if (locations.FirstOrDefault(a => a.ItemNum == item.SAPItemNumber && a.Location == "5008") != null)
|
|
|
+ {
|
|
|
+ plan.Inventory2 = locations.FirstOrDefault(a => a.ItemNum == item.SAPItemNumber && a.Location == "5008").QtyOnHand;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ plan.Inventory2 = 0;
|
|
|
+ }
|
|
|
+ plan.DuringSterilization = 0;//TODO:灭菌中需要从委外订单接口获取
|
|
|
+ plan.InProduction = InProdcutQty.Find(a=>a.ItemNumber==item.SAPItemNumber).Qty;
|
|
|
+ if(pre3MonthPlan.Where(a => a.ItemNumber == item.SAPItemNumber).Count()>0)
|
|
|
+ {
|
|
|
+ plan.EconomicLotSize = pre3MonthPlan.Where(a => a.ItemNumber == item.SAPItemNumber).Average(a => a.PlanProductQty);
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ plan.EconomicLotSize = plan.PlanProductQty;
|
|
|
+ }
|
|
|
+ plan.tenant_id = input.tenant_id;
|
|
|
+ plan.factory_id = input.factory_id;
|
|
|
+ plan.company_id=input.company_id;
|
|
|
+ plan.org_id = input.org_id;
|
|
|
+ plan.create_time = DateTime.Now;
|
|
|
+ plan.OrderNum =item.OrderNum;
|
|
|
+ productionMasters.Add(plan);
|
|
|
+ }
|
|
|
//保存数据
|
|
|
using (var unitOfWork = _unitOfWorkManager.Begin(false, true))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- //await _annualProductionOutline.InsertManyAsync(annualProductionOutlines);
|
|
|
+ await _productionMasterPlan.InsertManyAsync(productionMasters);
|
|
|
await unitOfWork.CompleteAsync();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
@@ -569,7 +624,55 @@ namespace Business.Replenishment
|
|
|
};
|
|
|
}
|
|
|
return "OK";
|
|
|
+ }
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 获取物料在制数量
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="itemNumbers"></param>
|
|
|
+ /// <param name="input"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<EOPDto> GetInProdcutQty(List<string> itemNumbers,InputDto input)
|
|
|
+ {
|
|
|
+ List<EOPDto> itemQty = new List<EOPDto>();
|
|
|
+ DateTime startYear = new DateTime(DateTime.Now.AddYears(-1).Year, 1, 1);
|
|
|
+ DateTime endYear = new DateTime(DateTime.Now.Year, 12, 31);
|
|
|
+ List<WorkOrdRouting> workOrdRoutings = _workOrdRouting.Select(x => x.IsActive && x.QtyComplete > 0 && x.Domain == input.factory_id.ToString()).Where(p => p.DueDate >= startYear && p.DueDate <= endYear).ToList();
|
|
|
+ decimal? InProductionQty = 0.00m;
|
|
|
+ var workOrds = workOrdRoutings.GroupBy(x => x.WorkOrd).ToList();
|
|
|
+ Dictionary<string, decimal> dictInProduction = new Dictionary<string, decimal>();
|
|
|
+ //按照工单循环
|
|
|
+ //某工单10-90工序 Max(10-80工序QtyComplete)-90工序QtyComplete =在制数量
|
|
|
+ foreach (var item in workOrds)
|
|
|
+ {
|
|
|
+ var workOrdRoutingList = workOrdRoutings.Where(x => x.WorkOrd == item.Key).OrderByDescending(o => o.OP).ToList();
|
|
|
+ //找出最大工序
|
|
|
+ var MaxOp = workOrdRoutingList.FirstOrDefault();
|
|
|
+ //查询出其他工序最大值
|
|
|
+ var MaxQtyComplete = workOrdRoutingList.Where(x => x.RecID != MaxOp.RecID).ToList().Max(o => o.QtyComplete);
|
|
|
+ InProductionQty += MaxQtyComplete - MaxOp.QtyComplete;
|
|
|
+ if (dictInProduction.ContainsKey(MaxOp.ItemNum))
|
|
|
+ {
|
|
|
+ dictInProduction[MaxOp.ItemNum] += InProductionQty.Value;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dictInProduction.Add(MaxOp.ItemNum, InProductionQty.Value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ itemNumbers.ForEach(a =>
|
|
|
+ {
|
|
|
+ EOPDto eOP = new EOPDto();
|
|
|
+ eOP.ItemNumber = a;
|
|
|
+ eOP.Qty = 0;
|
|
|
+ if(dictInProduction.ContainsKey(a))
|
|
|
+ eOP.Qty = dictInProduction[a];
|
|
|
+
|
|
|
+ itemQty.Add(eOP);
|
|
|
+
|
|
|
+ });
|
|
|
+ return itemQty;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -586,6 +689,9 @@ namespace Business.Replenishment
|
|
|
string ropResult=await CalcROP(input);
|
|
|
if(ropResult!="OK")
|
|
|
return ropResult;
|
|
|
+ string masterPlanResult = await SaveProductionMasterPlan(input);
|
|
|
+ if (masterPlanResult != "OK")
|
|
|
+ return masterPlanResult;
|
|
|
return "OK|刷新成功!";
|
|
|
}
|
|
|
|
|
|
@@ -848,6 +954,7 @@ namespace Business.Replenishment
|
|
|
rop.monthl_avg_demand = CalcAvgDemand(planList, a.SAPItemNumber);
|
|
|
rop.monthl_avg_demand_variance = Math.Ceiling(Convert.ToDecimal(CalcVariance(planList, a.SAPItemNumber)));
|
|
|
rop.monthl_avg_outstock = CalcAvgOutStock(ropModelList, replenishmentDto, rop.actual_out_qty.Value, a.SAPItemNumber);
|
|
|
+ rop.supply_leadtime = 1;//默认
|
|
|
if (mesItemList.Find(s => s.ItemNum == a.SAPItemNumber) != null)
|
|
|
{
|
|
|
rop.stock_turnover = mesItemList.Find(s => s.ItemNum == a.SAPItemNumber).StockTurnOver;
|
|
|
@@ -1041,15 +1148,21 @@ namespace Business.Replenishment
|
|
|
/// <returns></returns>
|
|
|
public async Task<string> CalcDayPlan(InputDto input)
|
|
|
{
|
|
|
+ ReplenishmentDto replenishmentDto = GetROPParam(input.factory_id.ToString());
|
|
|
//DOP运行资源检查每个成品和半成品SKU的可用库存,当可用库存 <= 修正后ROP时,自动生成月度计划订单(MPlan order,MPO48年月日3位流水号)= EOP;可用库存为没有被其他SO和PO占用的(合格成品或半成品库存 + WIP);
|
|
|
+ var ropModelList = _replenishmentROP.GetListAsync(a =>a.isparam && a.factory_id==input.factory_id && a.company_id==input.company_id && !a.IsDeleted).Result;
|
|
|
+ var itemStock=CalcStock(ropModelList.Select(a=>a.number).ToList(),input);
|
|
|
+ //成品半成品取下周一开始+取供应提前期为结束时间
|
|
|
+ //原材料取第二天开始+取供应提前期为结束时间
|
|
|
+
|
|
|
|
|
|
//DOP运行资源检查每个原材料SKU的可用库存,当可用库存<=修正后ROP时,自动生成月度采购申请(Purchase request,PR46年月日4位流水号)=EOP;可用库存为没有被其他SO和PO占用的(合格原材料库存+在途库存);
|
|
|
|
|
|
//每天DOP检查每个SKU的可用库存<=SS时,第二次触发PO或PR,每次补货数量=圆整后EOP;SKU可用库存=实际库存+WIP或在途库存-销售订单占用-计划订单占用;当M+1\M+2实际有销售订单产生时,相同SKU的销售订单和计划订单先进行冲销;
|
|
|
|
|
|
|
|
|
- //1.获取补货模型全局参数
|
|
|
- ReplenishmentDto replenishmentDto = GetROPParam(input.factory_id.ToString());
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//Step1:按照瑞奇、两大平台分别根据历史出库数据和预测出货数据计算ROP
|
|
|
//Step2:计算瑞奇的M-M+2共12周补货(每次补EOP/4),计算海王的M-M+2共12周补货(每次补EOP/4),计算国科的M-M+2共12周补货(每次补EOP/4)
|
|
|
@@ -1070,8 +1183,6 @@ namespace Business.Replenishment
|
|
|
var mesItemList = _itemMaster.Select(a => planList.Select(p => p.SAPItemNumber).Contains(a.ItemNum) && a.Domain == input.factory_id.ToString() && a.IsActive);
|
|
|
var srm_purchaseList = _srmPurchase.GetListAsync(a => planList.Select(p => p.SAPItemNumber).Contains(a.number) && a.tenant_id == input.tenant_id && a.company_id == input.company_id && !a.IsDeleted).Result;
|
|
|
|
|
|
- //获取补货模型前H周期和未来F个周期的数据
|
|
|
- var ropModelList = _replenishmentROP.GetListAsync(a => a.zero_based_seqno >= -1 * replenishmentDto.HistoryOutStockMonth && a.zero_based_seqno <= replenishmentDto.SaleFcstMonth).Result;
|
|
|
//发货计划物料列表
|
|
|
List<string> planItemList = planList?.Select(a => a.SAPItemNumber).ToList();
|
|
|
//获取成品库存、灭菌库存、在制库存(会从SAP同步的库存表更新到LocationDetail、ic_item表中)
|
|
|
@@ -1190,6 +1301,61 @@ namespace Business.Replenishment
|
|
|
return "OK";
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 根据物料编码获取可用库存
|
|
|
+ /// 成品半成品可用库存为没有被其他SO和PO占用的(合格成品或半成品库存+WIP)
|
|
|
+ /// 原材料可用库存为没有被其他SO和PO占用的(合格原材料库存+在途库存);
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="itemNumbers">物料编码列表</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<EOPDto> CalcStock(List<string> itemNumbers,InputDto input)
|
|
|
+ {
|
|
|
+ List<EOPDto> itemQty = new List<EOPDto>();
|
|
|
+ var itemList=_mysql_ic_item.GetListAsync(a => itemNumbers.Contains(a.number) && a.factory_id == input.factory_id && a.company_id ==input.company_id && !a.IsDeleted).Result;
|
|
|
+ var itemStockList=_mysql_ic_item_stock.GetListAsync(a => itemNumbers.Contains(a.icitem_number) && a.factory_id == input.factory_id && a.company_id == input.company_id && !a.IsDeleted).Result;
|
|
|
+ var pooccupylist=_mysql_srm_po_occupy.GetListAsync(a => a.state == 1 && !a.IsDeleted && a.factory_id == input.factory_id && a.company_id == input.company_id && a.tenant_id == input.tenant_id).Result;
|
|
|
+ var poList = _mysql_srm_po_list.GetListAsync(a=> pooccupylist.Select(p=>p.polist_id).ToList().Contains(a.Id) && pooccupylist.Select(p => p.polist_row).ToList().Contains(a.polist_row) && a.factory_id == input.factory_id && a.company_id == input.company_id && !a.IsDeleted).Result;
|
|
|
+ var molist=_mysql_mes_morder.GetListAsync(a => itemNumbers.Contains(a.product_code) && a.factory_id == input.factory_id && a.company_id == input.company_id && !a.IsDeleted).Result;
|
|
|
+ var proccupylist=_mysql_srm_pr_main_occupy.GetListAsync(a=> molist.Select(p=>p.morder_no).ToList().Contains(a.morder_mo) && a.factory_id == input.factory_id && a.company_id == input.company_id && !a.IsDeleted).Result;
|
|
|
+
|
|
|
+ itemNumbers.ForEach(a =>
|
|
|
+ {
|
|
|
+ EOPDto eOPDto=new EOPDto();
|
|
|
+ eOPDto.ItemNumber = a;
|
|
|
+ decimal stockqty = 0;
|
|
|
+ if(itemStockList.Find(s => s.icitem_number == a)!=null)
|
|
|
+ {
|
|
|
+ stockqty = itemStockList.Find(s => s.icitem_number == a).sqty.Value;
|
|
|
+ }
|
|
|
+ decimal poOccupyQty = 0;
|
|
|
+ for(int i=0;i<pooccupylist.Count;i++)
|
|
|
+ {
|
|
|
+ for(int j=0;j<poList.Count;j++)
|
|
|
+ {
|
|
|
+ if (pooccupylist[i].polist_id== poList[j].Id && pooccupylist[i].polist_row == poList[j].polist_row && poList[j].ItemNum==a)
|
|
|
+ {
|
|
|
+ poOccupyQty += pooccupylist[i].qty.Value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ decimal prOccupyQty = 0;
|
|
|
+ for (int i = 0; i < proccupylist.Count; i++)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < molist.Count; j++)
|
|
|
+ {
|
|
|
+ if (proccupylist[i].morder_mo == molist[j].morder_no && molist[j].product_code == a)
|
|
|
+ {
|
|
|
+ prOccupyQty += proccupylist[i].qty.Value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ eOPDto.Qty = stockqty - poOccupyQty - prOccupyQty;
|
|
|
+ itemQty.Add(eOPDto);
|
|
|
+ });
|
|
|
+ return itemQty;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 计划工单齐套检查
|
|
|
/// </summary>
|
|
|
@@ -2186,7 +2352,7 @@ namespace Business.Replenishment
|
|
|
public async Task<string> CalcLongPeriodItemPR(InputDto input)
|
|
|
{
|
|
|
//获取滚动未来六个月数据
|
|
|
- var monthlist = GetSixPlanMonth();
|
|
|
+ var monthlist = GetPlanMonth(6);
|
|
|
var productList = _replenishmentAnnualProduction.GetListAsync(a => monthlist.Contains(a.PlanMonth) && !a.IsDeleted && a.factory_id == input.factory_id).Result.OrderBy(s=>s.OrderNum).ToList();
|
|
|
var itemList= productList.Select(a=>a.SAPItemNumber).ToList();
|
|
|
var planList=_mysql_ic_item.GetListAsync(a=>itemList.Contains(a.number) && a.factory_id==input.factory_id && !a.IsDeleted).Result.ToList();
|
|
|
@@ -2683,13 +2849,33 @@ namespace Business.Replenishment
|
|
|
return getPreMonthEndTime().AddMonths(months + 1);
|
|
|
}
|
|
|
|
|
|
- public List<string> GetSixPlanMonth()
|
|
|
+ /// <summary>
|
|
|
+ /// 获取未来几个月PlanMonth
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="monthCount"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<string> GetPlanMonth(int monthCount)
|
|
|
{
|
|
|
List<string> result=new List<string>();
|
|
|
- for(int i=0;i<6;i++)
|
|
|
+ for(int i=0;i< monthCount; i++)
|
|
|
+ {
|
|
|
+ var months = DateTime.Now.AddMonths(i);
|
|
|
+ result.Add($"{months.Year}-{months.Month.ToString("00")}");
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 获取前面几个月PlanMonth
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="monthCount"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public List<string> GetPrePlanMonth(int monthCount)
|
|
|
+ {
|
|
|
+ List<string> result = new List<string>();
|
|
|
+ for (int i = 0; i < monthCount; i++)
|
|
|
{
|
|
|
- var months = DateTime.Now.AddMonths(i + 1);
|
|
|
- result.Add($"{months.Year}-{months.Month}");
|
|
|
+ var months = DateTime.Now.AddMonths(-1*(i));
|
|
|
+ result.Add($"{months.Year}-{months.Month.ToString("00")}");
|
|
|
}
|
|
|
return result;
|
|
|
}
|