public void UpdateItemFlowPlanDetailPlanQty(int Id, decimal planQty) { ItemFlowPlanDetail itemFlowPlanDetail = this.LoadItemFlowPlanDetail(Id); itemFlowPlanDetail.PlanQty = planQty; this.UpdateItemFlowPlanDetail(itemFlowPlanDetail); }
private IList <ItemFlowPlanDetail> ConvertOrderDmdToItemFlowPlanDetail(ItemFlowPlan itemFlowPlan, IList <OrderLocationTransaction> orderLocTransList) { IList <ItemFlowPlanDetail> itemFlowPlanDetailList = new List <ItemFlowPlanDetail>(); List <DateTime> dateTimeList = this.CollectDateList(orderLocTransList); if (dateTimeList.Count > 0) { foreach (DateTime date in dateTimeList) { ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail(); itemFlowPlanDetail.ItemFlowPlan = itemFlowPlan; itemFlowPlanDetail.ReqDate = date; itemFlowPlanDetail.OrderRemainQty = 0; foreach (OrderLocationTransaction orderLocTrans in orderLocTransList) { if (DateTime.Compare(date, orderLocTrans.OrderDetail.OrderHead.WindowTime.Date) == 0) { itemFlowPlanDetail.OrderRemainQty += orderLocTrans.RemainQty; ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack(); itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail; itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans; //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty; itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack); } } if (itemFlowPlanDetail.OrderRemainQty > 0) { itemFlowPlanDetailList.Add(itemFlowPlanDetail); } } } return(itemFlowPlanDetailList); }
private ItemFlowPlanDetail GetSupplyFlow(string item, string timePeriodType, DateTime reqDate) { IList <ItemFlowPlan> ifpList = this.GetPreItemFlowPlan(BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS, timePeriodType, DateTime.Now, DateTime.Now, null, null, item, null); if (ifpList.Count == 0) { ifpList = this.GetPreItemFlowPlan(BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MRP, timePeriodType, DateTime.Now, DateTime.Now, null, null, item, null); } //todo,bid ItemFlowPlanDetail ifpd = null; if (ifpList.Count > 0) { ItemFlowPlan ifp = ifpList[0]; ifpd = ItemFlowPlanDetailMgr.GetItemFlowPlanDetail(ifp.Id, timePeriodType, reqDate); if (ifpd == null) { ifpd = new ItemFlowPlanDetail(); ifpd.ItemFlowPlan = ifp; ifpd.TimePeriodType = timePeriodType; ifpd.ReqDate = reqDate; ifpd.PlanQty = 0; ItemFlowPlanDetailMgr.CreateItemFlowPlanDetail(ifpd); } } return(ifpd); }
public IList <ItemFlowPlanDetail> GetItemFlowPlanDetailRangeOrderByReqDate(ItemFlowPlan itemFlowPlan, string timePeriodType, List <DateTime> dateList, bool autoPlan) { IList <ItemFlowPlanDetail> ifpdList = new List <ItemFlowPlanDetail>(); DateTime planStartTime = DateTimeHelper.GetStartTime(timePeriodType, DateTime.Now.Date); decimal PAB = itemFlowPlan.StartPAB; foreach (DateTime date in dateList) { ItemFlowPlanDetail ifpd = this.GetItemFlowPlanDetail(itemFlowPlan.Id, timePeriodType, date); if (ifpd == null) { ifpd = new ItemFlowPlanDetail(); ifpd.ItemFlowPlan = itemFlowPlan; ifpd.TimePeriodType = timePeriodType; ifpd.ReqDate = date; ifpd.PlanQty = 0;//todo } ifpd.GrossDemand = 0;//todo IList <ItemFlowPlanTrack> ifptList = ItemFlowPlanTrackMgr.GetItemFlowPlanTrackList(ifpd, null, null); if (ifptList != null && ifptList.Count > 0) { foreach (ItemFlowPlanTrack ifpt in ifptList) { ifpd.GrossDemand += ifpt.ReferencePlanDetail.PlanQty * ifpt.Rate; } } ifpd.OrderRemainQty = 0;//todo //auto Plan,已有计划不再重排 if (autoPlan && ifpd.PlanQty == 0) { decimal safeInv = ifpd.ItemFlowPlan.FlowDetail.SafeStock.HasValue ? (decimal)ifpd.ItemFlowPlan.FlowDetail.SafeStock : 0; decimal planQty = ifpd.GrossDemand + safeInv - PAB; if (planQty > 0) { if (ifpd.ItemFlowPlan.FlowDetail.BatchSize.HasValue) { decimal batchSize = (decimal)ifpd.ItemFlowPlan.FlowDetail.BatchSize; if (batchSize > 0) { planQty = batchSize * Math.Ceiling(planQty / batchSize); } } ifpd.PlanQty = planQty; } } PAB += Math.Max(ifpd.PlanQty, ifpd.OrderRemainQty) - ifpd.GrossDemand; ifpd.PAB = PAB; ifpdList.Add(ifpd); } return(ifpdList); }
public void ReleaseItemFlowPlanDetail(int itemFlowPlanId, string timePeriodType, DateTime reqDate) { ItemFlowPlanDetail ifpd = ItemFlowPlanDetailMgr.GetItemFlowPlanDetail(itemFlowPlanId, timePeriodType, reqDate); if (ifpd != null) { this.ReleaseItemFlowPlanDetail(ifpd); } }
public void SaveRelation(ItemFlowPlanDetail ifpd, ItemFlowPlanDetail parIfpd, decimal rate) { ItemFlowPlanTrack ifpt = new ItemFlowPlanTrack(); ifpt.ItemFlowPlanDetail = ifpd; ifpt.ReferencePlanDetail = parIfpd; ifpt.Rate = rate; ItemFlowPlanTrackMgr.CreateItemFlowPlanTrack(ifpt); }
public void ClearOldRelation(ItemFlowPlanDetail mstrIfpd, ItemFlowPlanDetail refIfpd, OrderLocationTransaction orderLocTrans) { IList <ItemFlowPlanTrack> ifptList = this.GetItemFlowPlanTrackList(mstrIfpd, refIfpd, orderLocTrans); if (ifptList != null && ifptList.Count > 0) { foreach (ItemFlowPlanTrack ifpt in ifptList) { this.DeleteItemFlowPlanTrack(ifpt); } } }
private IList <ItemFlowPlanDetail> GetPreItemFlowPlanDetailByParent(ItemFlowPlan parentItemFlowPlan, ItemFlowPlan itemFlowPlan, decimal qtyPer) { IList <ItemFlowPlanDetail> itemFlowPlanDetailList = new List <ItemFlowPlanDetail>(); if (parentItemFlowPlan.ItemFlowPlanDetails != null && parentItemFlowPlan.ItemFlowPlanDetails.Count > 0) { DateTime dmdStartTime = DateTime.Now; DateTime dmdEndTime = DateTime.Now; foreach (ItemFlowPlanDetail parentItemFlowPlanDetail in parentItemFlowPlan.ItemFlowPlanDetails) { //确定计划区间/需求时界 double leadTime = parentItemFlowPlanDetail.ItemFlowPlan.Flow.LeadTime == null ? 0 : Convert.ToDouble((decimal)(parentItemFlowPlanDetail.ItemFlowPlan.Flow.LeadTime)); if (parentItemFlowPlan.ItemFlowPlanDetails.IndexOf(parentItemFlowPlanDetail) == 0) { dmdStartTime = parentItemFlowPlanDetail.ReqDate.AddHours(-1 * leadTime); //WorkCalendar if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS || itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MRP) { dmdStartTime = WorkCalendarMgr.GetWorkTime(dmdStartTime, parentItemFlowPlan.Flow.PartyFrom.Code, true); } } dmdEndTime = this.GetDmdEndTime(parentItemFlowPlanDetail, parentItemFlowPlan.ItemFlowPlanDetails).AddHours(-1 * leadTime); //WorkCalendar if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS || itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MRP) { dmdEndTime = WorkCalendarMgr.GetWorkTime(dmdEndTime, parentItemFlowPlan.Flow.PartyFrom.Code, true); } if (DateTime.Compare(DateTime.Now, dmdStartTime) > 0) { //Rogue Town! dmdStartTime = dmdEndTime; continue; } ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail(); itemFlowPlanDetail.ReqDate = WorkCalendarMgr.GetDayShiftStart(dmdStartTime, itemFlowPlan.Flow.PartyTo.Code); //毛需求 itemFlowPlanDetail.GrossDemand = (Math.Max(parentItemFlowPlanDetail.OrderRemainQty, parentItemFlowPlanDetail.PlanQty)) * qtyPer; itemFlowPlanDetailList.Add(itemFlowPlanDetail); //Rogue Town! dmdStartTime = dmdEndTime; } } return(itemFlowPlanDetailList); }
private IList <ItemFlowPlanDetail> MergeItemFlowPlanDetail(IList <ItemFlowPlanDetail> preItemFlowPlanDetailList, IList <ItemFlowPlanDetail> oldItemFlowPlanDetailList) { IList <ItemFlowPlanDetail> itemFlowPlanDetailList = new List <ItemFlowPlanDetail>(); if (oldItemFlowPlanDetailList == null || oldItemFlowPlanDetailList.Count > 0) { return(preItemFlowPlanDetailList); } if (preItemFlowPlanDetailList == null || preItemFlowPlanDetailList.Count > 0) { return(oldItemFlowPlanDetailList); } int i = 0; foreach (ItemFlowPlanDetail preItemFlowPlanDetail in preItemFlowPlanDetailList) { while (i < oldItemFlowPlanDetailList.Count) { ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail(); if (DateTime.Compare(preItemFlowPlanDetail.ReqDate.Date, oldItemFlowPlanDetailList[i].ReqDate.Date) == 0) { itemFlowPlanDetail = preItemFlowPlanDetail; itemFlowPlanDetail.GrossDemand = preItemFlowPlanDetail.GrossDemand + oldItemFlowPlanDetailList[i].GrossDemand; itemFlowPlanDetail.AddRangeItemFlowPlanTrack(preItemFlowPlanDetail.ItemFlowPlanTracks); itemFlowPlanDetail.AddRangeItemFlowPlanTrack(oldItemFlowPlanDetailList[i].ItemFlowPlanTracks); itemFlowPlanDetailList.Add(itemFlowPlanDetail); i++; continue; } else if (DateTime.Compare(preItemFlowPlanDetail.ReqDate, oldItemFlowPlanDetailList[i].ReqDate) < 0) { itemFlowPlanDetailList.Add(preItemFlowPlanDetail); break; } else { itemFlowPlanDetailList.Add(oldItemFlowPlanDetailList[i]); i++; continue; } } } return(itemFlowPlanDetailList); }
private DateTime GetReqDate(ItemFlowPlanDetail parentItemFlowPlanDetail) { double leadTime = 0; if (parentItemFlowPlanDetail.ItemFlowPlan.Flow.LeadTime != null) { leadTime = Convert.ToDouble((decimal)(parentItemFlowPlanDetail.ItemFlowPlan.Flow.LeadTime)); } DateTime reqDate = parentItemFlowPlanDetail.ReqDate.AddHours(-1 * leadTime); reqDate = WorkCalendarMgr.GetWorkTime(reqDate, parentItemFlowPlanDetail.ItemFlowPlan.Flow.PartyFrom.Code, true); return(reqDate); }
private DataRow FillPlanIndexColumn(DataRow dr, List <DateTime> dateList, string timePeriodType, int ItemFlowPlanId) { foreach (DateTime date in dateList) { int ID = 0; ItemFlowPlanDetail ifpd = ItemFlowPlanDetailMgr.GetItemFlowPlanDetail(ItemFlowPlanId, timePeriodType, date); if (ifpd != null) { ID = ifpd.Id; } string colName = date.ToString(); dr[colName] = ID; } return(dr); }
public void SaveItemFlowPlanDetail(ItemFlowPlanDetail itemFlowPlanDetail) { ItemFlowPlanDetail ifpd = this.GetItemFlowPlanDetail(itemFlowPlanDetail.ItemFlowPlan.Id, itemFlowPlanDetail.TimePeriodType, itemFlowPlanDetail.ReqDate); if (ifpd == null) { this.CreateItemFlowPlanDetail(itemFlowPlanDetail); } else { if (ifpd.PlanQty != itemFlowPlanDetail.PlanQty) { ifpd.PlanQty = itemFlowPlanDetail.PlanQty; this.UpdateItemFlowPlanDetail(ifpd); } } }
public void ReleaseItemFlowPlanDetail(ItemFlowPlanDetail itemFlowPlanDetail) { if (itemFlowPlanDetail.PlanQty < 0) { return; } DateTime reqDate = itemFlowPlanDetail.ReqDate; double leadTime = Convert.ToDouble(itemFlowPlanDetail.ItemFlowPlan.Flow.LeadTime == null ? 0 : (decimal)itemFlowPlanDetail.ItemFlowPlan.Flow.LeadTime); if (itemFlowPlanDetail.TimePeriodType == BusinessConstants.CODE_MASTER_TIME_PERIOD_TYPE_VALUE_DAY) { //to be refactored if (leadTime > 12) { reqDate = reqDate.AddHours(-1 * leadTime); } } ItemFlowPlanTrackMgr.ClearOldRelation(null, itemFlowPlanDetail, null); if (itemFlowPlanDetail.ItemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_DMDSCHEDULE) { ItemFlowPlanDetail ifpd = this.GetSupplyFlow(itemFlowPlanDetail.ItemFlowPlan.FlowDetail.Item.Code, itemFlowPlanDetail.TimePeriodType, reqDate); if (ifpd != null) { this.SaveRelation(ifpd, itemFlowPlanDetail, 1); } } else if (itemFlowPlanDetail.ItemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS) { string bomCode = itemFlowPlanDetail.ItemFlowPlan.FlowDetail.Item.Bom == null ? itemFlowPlanDetail.ItemFlowPlan.FlowDetail.Item.Code : itemFlowPlanDetail.ItemFlowPlan.FlowDetail.Item.Bom.Code; IList <BomDetail> bomdetList = BomDetailMgr.GetFlatBomDetail(bomCode, reqDate); if (bomdetList != null && bomdetList.Count > 0) { foreach (BomDetail bd in bomdetList) { decimal rateQty = (1 + bd.ScrapPercentage) * bd.RateQty; ItemFlowPlanDetail ifpd = this.GetSupplyFlow(bd.Item.Code, itemFlowPlanDetail.TimePeriodType, reqDate); if (ifpd != null) { this.SaveRelation(ifpd, itemFlowPlanDetail, rateQty); } } } } }
public IList <ItemFlowPlanTrack> GetItemFlowPlanTrackList(ItemFlowPlanDetail mstrIfpd, ItemFlowPlanDetail refIfpd, OrderLocationTransaction orderLocTrans) { DetachedCriteria criteria = DetachedCriteria.For(typeof(ItemFlowPlanTrack)); if (mstrIfpd != null) { criteria.Add(Expression.Eq("ItemFlowPlanDetail.Id", mstrIfpd.Id)); } if (refIfpd != null) { criteria.Add(Expression.Eq("ReferencePlanDetail.Id", refIfpd.Id)); } if (orderLocTrans != null) { criteria.Add(Expression.Eq("OrderLocationTransaction.Id", orderLocTrans.Id)); } return(CriteriaMgr.FindAll <ItemFlowPlanTrack>(criteria)); }
public IList <ItemFlowPlanTrack> GenerateItemFlowPlanTrack(ItemFlowPlanDetail parentItemFlowPlanDetail, ItemFlowPlanDetail itemFlowPlanDetail, decimal qtyPer) { IList <ItemFlowPlanTrack> itemFlowPlanTrackList = new List <ItemFlowPlanTrack>(); if (parentItemFlowPlanDetail.ItemFlowPlanTracks != null && parentItemFlowPlanDetail.ItemFlowPlanTracks.Count > 0) { foreach (ItemFlowPlanTrack parentItemFlowPlanTrack in parentItemFlowPlanDetail.ItemFlowPlanTracks) { ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack(); itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail; itemFlowPlanTrack.ReferencePlanDetail = parentItemFlowPlanTrack.ReferencePlanDetail; itemFlowPlanTrack.OrderLocationTransaction = parentItemFlowPlanTrack.OrderLocationTransaction; //itemFlowPlanTrack.DemandQty = parentItemFlowPlanTrack.DemandQty * qtyPer; itemFlowPlanTrackList.Add(itemFlowPlanTrack); } } return(itemFlowPlanTrackList); }
private void RefreshItemFlowPlanDetail(ItemFlowPlanDetail itemFlowPlanDetail, IList <OrderLocationTransaction> orderLocTransList) { decimal inputOrderDmd = 0; if (orderLocTransList != null && orderLocTransList.Count > 0) { foreach (OrderLocationTransaction orderLocTrans in orderLocTransList) { if (orderLocTrans.RemainQty > 0) { inputOrderDmd += orderLocTrans.RemainQty; ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack(); itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail; itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans; //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty; itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack); } } } itemFlowPlanDetail.OrderRemainQty = inputOrderDmd; }
private DateTime GetDmdEndTime(ItemFlowPlanDetail itemFlowPlanDetail, IList <ItemFlowPlanDetail> itemFlowPlanDetailList) { DateTime dmdEndTime = DateTime.Now; int index = itemFlowPlanDetailList.IndexOf(itemFlowPlanDetail); if (index + 1 < itemFlowPlanDetailList.Count) { dmdEndTime = itemFlowPlanDetailList[index + 1].ReqDate; } else { if (index >= 1) { TimeSpan ts = itemFlowPlanDetailList[index].ReqDate - itemFlowPlanDetailList[index - 1].ReqDate; dmdEndTime = itemFlowPlanDetailList[index].ReqDate.AddDays(ts.TotalDays); } else { dmdEndTime = itemFlowPlanDetailList[index].ReqDate.AddDays(1); } } return(dmdEndTime.Date); }
public void Save() { if (GV_List.Rows.Count == 0 || dt.Rows.Count == 0) { return; } int rowIndex = 0; foreach (DataRow dr in dt.Rows) { if (dr["Type"].ToString() == BusinessConstants.PLAN_VIEW_TYPE_PLAN) { string timePeriodType = dr["TimePeriodType"].ToString(); for (int j = 0; j < GV_List.Columns.Count - _firstDynColIndex; j++) { int itemFlowPlanId = (int)dr["ItemFlowPlanId"]; DateTime date = this.dateList[j]; ItemFlowPlan ifp = TheItemFlowPlanMgr.LoadItemFlowPlan(itemFlowPlanId); try { string editControlID = this.GetDynControlID(j); TextBox _editControl = (TextBox)GV_List.Rows[rowIndex].Cells[j + _firstDynColIndex].FindControl(editControlID); string colName = "DynCol_" + j.ToString(); decimal newValue = 0; if (_editControl.Text.Trim() != string.Empty) { newValue = decimal.Parse(_editControl.Text.Trim()); } decimal oldValue = (decimal)dr[colName]; if (newValue != 0 || oldValue != 0) { ItemFlowPlanDetail ifpd = new ItemFlowPlanDetail(); ifpd.ItemFlowPlan = ifp; ifpd.TimePeriodType = timePeriodType; ifpd.ReqDate = date; ifpd.PlanQty = newValue; //ifpd.LastModifyDate = DateTime.Now; //ifpd.LastModifyUser = this.Session["UserCode"].ToString(); if (ifpd.PlanQty < 0) { ShowErrorMessage("MRP.Error.Save", ifp.FlowDetail.Item.Code, GetHeaderText(timePeriodType, date)); return; } TheItemFlowPlanDetailMgr.SaveItemFlowPlanDetail(ifpd); dr[colName] = newValue; ShowSuccessMessage("Common.Business.Result.Save.Successfully"); } } catch (Exception) { ShowErrorMessage("MRP.Error.Save", ifp.FlowDetail.Item.Code, GetHeaderText(timePeriodType, date)); return; } } } rowIndex++; } this.ListView(); }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView drv = (DataRowView)e.Row.DataItem; string planViewType = drv["Type"].ToString(); if (planViewType == string.Empty) { //Group line e.Row.BackColor = Color.Gray; e.Row.ForeColor = Color.Snow; } else if (planViewType == BusinessConstants.PLAN_VIEW_TYPE_DEMAND) { //Demand e.Row.BackColor = Color.Aquamarine; e.Row.Cells[3].Text = "${MRP.PlanViewType.Demand}"; //ToolTip e.Row.Cells[2].ToolTip = "${MRP.PlanViewType.TotalDemand}"; //demand source foreach (DateTime date in dateList) { int dynColIndex = dateList.IndexOf(date); if ((decimal)drv["DynCol_" + dynColIndex.ToString()] > 0) { int itemFlowPlanId = (int)drv["ItemFlowPlanId"]; string timePeriodType = (string)drv["TimePeriodType"]; ItemFlowPlanDetail ifpd = TheItemFlowPlanDetailMgr.GetItemFlowPlanDetail(itemFlowPlanId, timePeriodType, date); IList <ItemFlowPlanTrack> ifptList = TheItemFlowPlanTrackMgr.GetItemFlowPlanTrackList(ifpd, null, null); e.Row.Cells[dynColIndex + _firstDynColIndex].Attributes.Add("title", this.GetToolTip(ifptList)); } } } else if (planViewType == BusinessConstants.PLAN_VIEW_TYPE_PLAN) { //Plan if (ModuleType != BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_DMDSCHEDULE) { e.Row.Cells[_firstDynColIndex - 1].Text = "${MRP.PlanViewType.Plan}"; //ToolTip e.Row.Cells[1].ToolTip = "${Common.Business.MaxInv}"; e.Row.Cells[2].ToolTip = "${MRP.PlanViewType.TotalPlan}"; } for (int j = 0; j < GV_List.Columns.Count - _firstDynColIndex; j++) { //首次加载动态控件 TextBox _editControl = new TextBox(); _editControl.ID = this.GetDynControlID(j); _editControl.Width = 50; decimal planQty = (decimal)drv["DynCol_" + j.ToString()]; if (planQty > 0) { _editControl.Text = planQty.ToString("0.########"); } _editControl.Attributes.Add("onclick", "this.select()"); if (!e.Row.Cells[j + _firstDynColIndex].Controls.Contains(_editControl)) { e.Row.Cells[j + _firstDynColIndex].Controls.Add(_editControl); } } } //else if (planViewType == BusinessConstants.PLAN_VIEW_TYPE_ORDER) //{ // e.Row.Cells[3].Text = "订单"; //} else if (planViewType == BusinessConstants.PLAN_VIEW_TYPE_PAB) { //PAB e.Row.Cells[_firstDynColIndex - 1].Text = "${MRP.PlanViewType.PAB}"; //ToolTip e.Row.Cells[1].ToolTip = "${Common.Business.SafeInv}"; e.Row.Cells[2].ToolTip = "${Common.Business.StartPAB}"; decimal safeStock = decimal.Parse(drv["StaCol_1"].ToString()); for (int j = 0; j < GV_List.Columns.Count - _firstDynColIndex; j++) { decimal PAB = decimal.Parse(drv["DynCol_" + j.ToString()].ToString()); if (PAB < 0) { e.Row.Cells[j + _firstDynColIndex].BackColor = Color.Red; } else if (PAB < safeStock) { e.Row.Cells[j + _firstDynColIndex].BackColor = Color.Yellow; } else { e.Row.Cells[j + _firstDynColIndex].BackColor = Color.LawnGreen; } } } } else if (e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[0].Text = "${Common.Business.ItemCode}"; e.Row.Cells[1].Text = "${Common.Business.ItemDescription}"; if (ModuleType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_DMDSCHEDULE) { e.Row.Cells[2].Text = "${Common.Business.ReferenceItemCode}"; e.Row.Cells[3].Text = "${Common.Business.Uom}"; } else { e.Row.Cells[2].Text = "${Common.Business.Total}"; e.Row.Cells[3].Text = "${Common.Business.Date}"; } } }
public virtual void DeleteItemFlowPlanDetail(ItemFlowPlanDetail entity) { entityDao.DeleteItemFlowPlanDetail(entity); }
public virtual void UpdateItemFlowPlanDetail(ItemFlowPlanDetail entity) { entityDao.UpdateItemFlowPlanDetail(entity); }
public virtual void CreateItemFlowPlanDetail(ItemFlowPlanDetail entity) { entityDao.CreateItemFlowPlanDetail(entity); }
public IList <ItemFlowPlanDetail> GetItemFlowPlanDetailView(ItemFlowPlan itemFlowPlan, IList <ItemFlowPlanDetail> itemFlowPlanDetailList, bool computePlanQty) { if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_DMDSCHEDULE) { if (itemFlowPlanDetailList != null && itemFlowPlanDetailList.Count > 0) { foreach (ItemFlowPlanDetail itemFlowPlanDetail in itemFlowPlanDetailList) { DateTime startWinTime = itemFlowPlanDetail.ReqDate.Date; DateTime endWinTime = this.GetDmdEndTime(itemFlowPlanDetail, itemFlowPlanDetailList); IList <OrderLocationTransaction> orderLocTransList = new List <OrderLocationTransaction>(); if (itemFlowPlanDetailList.IndexOf(itemFlowPlanDetail) == itemFlowPlanDetailList.Count - 1) { orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, startWinTime, null); } else { orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, startWinTime, endWinTime); } this.RefreshItemFlowPlanDetail(itemFlowPlanDetail, orderLocTransList); } if (DateTime.Compare(DateTime.Now.Date, itemFlowPlanDetailList[0].ReqDate) < 0) { IList <OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, itemFlowPlanDetailList[0].ReqDate); IList <ItemFlowPlanDetail> orderDemandList = this.ConvertOrderDmdToItemFlowPlanDetail(itemFlowPlan, orderLocTransList); foreach (ItemFlowPlanDetail ifpd in itemFlowPlanDetailList) { orderDemandList.Add(ifpd); } itemFlowPlanDetailList = orderDemandList; } } else { IList <OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, null); itemFlowPlanDetailList = this.ConvertOrderDmdToItemFlowPlanDetail(itemFlowPlan, orderLocTransList); } } else if (itemFlowPlan.PlanType == BusinessConstants.CODE_MASTER_PLAN_TYPE_VALUE_MPS) { decimal PAB = this.GetDmdStartPAB(WorkCalendarMgr.GetDayShiftStart(DateTime.Now, itemFlowPlan.Flow.PartyTo.Code), "", itemFlowPlan.FlowDetail.Item.Code); //itemFlowPlan.PAB = PAB; DateTime maxDate = DateTime.Now.Date; if (itemFlowPlanDetailList != null && itemFlowPlanDetailList.Count > 0) { maxDate = itemFlowPlanDetailList[itemFlowPlanDetailList.Count - 1].ReqDate; } IList <OrderLocationTransaction> orderLocTransList = this.GetOpenOrderLocTransInByFlow(itemFlowPlan.Flow.Code, itemFlowPlan.FlowDetail.Item.Code, DateTime.Now.Date, null); if (orderLocTransList != null && orderLocTransList.Count > 0) { DateTime maxWinTime = orderLocTransList[orderLocTransList.Count - 1].OrderDetail.OrderHead.WindowTime; maxWinTime = WorkCalendarMgr.GetDayShiftStart(maxWinTime, itemFlowPlan.Flow.PartyTo.Code); if (DateTime.Compare(maxDate, maxWinTime) < 0) { maxDate = maxWinTime; } } DateTime date = DateTime.Now.Date; while (date <= maxDate) { ItemFlowPlanDetail itemFlowPlanDetail = new ItemFlowPlanDetail(); itemFlowPlanDetail.ItemFlowPlan = itemFlowPlan; itemFlowPlanDetail.GrossDemand = 0; itemFlowPlanDetail.OrderRemainQty = 0; itemFlowPlanDetail.PlanQty = 0; foreach (ItemFlowPlanDetail ifpd in itemFlowPlanDetailList) { if (DateTime.Compare(ifpd.ReqDate, date) == 0) { itemFlowPlanDetail = ifpd; break; } } foreach (OrderLocationTransaction orderLocTrans in orderLocTransList) { DateTime winTime = orderLocTrans.OrderDetail.OrderHead.WindowTime; if (DateTime.Compare(date, winTime) <= 0 && DateTime.Compare(date.AddDays(1), winTime) > 0) { ItemFlowPlanTrack itemFlowPlanTrack = new ItemFlowPlanTrack(); itemFlowPlanTrack.ItemFlowPlanDetail = itemFlowPlanDetail; itemFlowPlanTrack.OrderLocationTransaction = orderLocTrans; //itemFlowPlanTrack.DemandQty = orderLocTrans.RemainQty; itemFlowPlanDetail.AddItemFlowPlanTrack(itemFlowPlanTrack); } } date = date.AddDays(1); } } itemFlowPlanDetailList = this.PlanningAndScheduling(itemFlowPlanDetailList, itemFlowPlan, computePlanQty); return(itemFlowPlanDetailList); }