GetOrderDetailByFlowDetailIdAndItemCode() public méthode

public GetOrderDetailByFlowDetailIdAndItemCode ( int flowDetailId, string itemCode ) : OrderDetail
flowDetailId int
itemCode string
Résultat OrderDetail
    public void CollectData(OrderHead orderHead)
    {
        foreach (GridViewRow gvr in GV_List.Rows)
        {
            int flowDetailId = int.Parse(((HiddenField)gvr.FindControl("hfFlowDetailId")).Value);
            string itemCode = ((Label)gvr.FindControl("lblItemCode")).Text;
            decimal reqQty = decimal.Parse(((Label)gvr.FindControl("lblOrderedQty")).Text);

            orderHead.GetOrderDetailByFlowDetailIdAndItemCode(flowDetailId, itemCode).RequiredQty = reqQty;
            orderHead.GetOrderDetailByFlowDetailIdAndItemCode(flowDetailId, itemCode).OrderedQty = reqQty;
        }
    }
        public IList<OrderHead> ConvertShiftPlanScheduleToOrders(IList<ShiftPlanSchedule> shiftPlanScheduleList)
        {
            IList<OrderHead> orderHeadList = new List<OrderHead>();
            if (shiftPlanScheduleList != null && shiftPlanScheduleList.Count > 0)
            {
                foreach (ShiftPlanSchedule sps in shiftPlanScheduleList)
                {
                    decimal orderLotSize = sps.FlowDetail.OrderLotSize.HasValue ? sps.FlowDetail.OrderLotSize.Value : 0;
                    IList<decimal> reqQtyList = OrderHelper.SplitByOrderLotSize(sps.PlanQty, orderLotSize);
                    foreach (decimal reqQty in reqQtyList)
                    {
                        double leadTime = sps.FlowDetail.Flow.LeadTime.HasValue ? Convert.ToDouble(sps.FlowDetail.Flow.LeadTime.Value) : 0;
                        OrderHead oh = new OrderHead();
                        oh = this.TransferFlow2Order(sps.FlowDetail.Flow.Code);
                        oh.Priority = BusinessConstants.CODE_MASTER_ORDER_PRIORITY_VALUE_NORMAL;
                        oh.StartTime = shiftMgrE.GetShiftStartTime(sps.ReqDate, sps.Shift.Code);
                        oh.WindowTime = shiftMgrE.GetShiftEndTime(sps.ReqDate, sps.Shift.Code);

                        oh.GetOrderDetailByFlowDetailIdAndItemCode(sps.FlowDetail.Id, sps.FlowDetail.Item.Code).RequiredQty = reqQty;
                        oh.GetOrderDetailByFlowDetailIdAndItemCode(sps.FlowDetail.Id, sps.FlowDetail.Item.Code).OrderedQty = reqQty;
                        orderHeadList.Add(oh);
                    }
                }
            }

            OrderHelper.FilterZeroOrderQty(orderHeadList);
            return orderHeadList;
        }
        public IList<OrderHead> ConvertFlowPlanToOrders(IList<FlowPlan> flowPlanList)
        {
            IList<OrderHead> orderHeadList = new List<OrderHead>();
            if (flowPlanList != null && flowPlanList.Count > 0)
            {
                foreach (FlowPlan flowPlan in flowPlanList)
                {
                    bool isExist = false;
                    foreach (OrderHead orderHead in orderHeadList)
                    {
                        if (orderHead.Flow.Trim().ToUpper() == flowPlan.FlowDetail.Flow.Code.Trim().ToUpper())
                        {
                            orderHead.GetOrderDetailByFlowDetailIdAndItemCode(flowPlan.FlowDetail.Id, flowPlan.FlowDetail.Item.Code).RequiredQty = flowPlan.PlanQty;
                            orderHead.GetOrderDetailByFlowDetailIdAndItemCode(flowPlan.FlowDetail.Id, flowPlan.FlowDetail.Item.Code).OrderedQty = flowPlan.PlanQty;
                            isExist = true;
                            break;
                        }
                    }

                    if (!isExist)
                    {
                        double leadTime = flowPlan.FlowDetail.Flow.LeadTime.HasValue ? Convert.ToDouble(flowPlan.FlowDetail.Flow.LeadTime.Value) : 0;

                        OrderHead oh = new OrderHead();
                        oh = this.TransferFlow2Order(flowPlan.FlowDetail.Flow.Code);
                        oh.Priority = BusinessConstants.CODE_MASTER_ORDER_PRIORITY_VALUE_NORMAL;
                        oh.StartTime = flowPlan.ReqDate.AddHours(-leadTime);
                        oh.WindowTime = flowPlan.ReqDate;

                        oh.GetOrderDetailByFlowDetailIdAndItemCode(flowPlan.FlowDetail.Id, flowPlan.FlowDetail.Item.Code).RequiredQty = flowPlan.PlanQty;
                        oh.GetOrderDetailByFlowDetailIdAndItemCode(flowPlan.FlowDetail.Id, flowPlan.FlowDetail.Item.Code).OrderedQty = flowPlan.PlanQty;
                        orderHeadList.Add(oh);
                    }
                }
            }

            OrderHelper.FilterZeroOrderQty(orderHeadList);
            return orderHeadList;
        }
Exemple #4
0
        public IList<OrderHead> ConvertShiftPlanScheduleToOrders(IList<ShiftPlanSchedule> shiftPlanScheduleList, decimal leadTime)
        {
            IList<OrderHead> orderHeadList = new List<OrderHead>();
            if (shiftPlanScheduleList != null && shiftPlanScheduleList.Count > 0)
            {

                foreach (ShiftPlanSchedule sps in shiftPlanScheduleList)
                {
                    decimal orderLotSize = sps.FlowDetail.OrderLotSize.HasValue ? sps.FlowDetail.OrderLotSize.Value : 0;
                    IList<decimal> reqQtyList = OrderHelper.SplitByOrderLotSize(sps.PlanQty, orderLotSize);
                    DateTime startTime = shiftMgr.GetShiftStartTime(sps.ReqDate, sps.Shift.Code);
                    DateTime windowTime = startTime.AddHours(Convert.ToDouble(leadTime));
                    if (startTime.AddHours((double)(reqQtyList.Count * leadTime)) > shiftMgr.GetShiftEndTime(sps.ReqDate, sps.Shift.Code))
                    {
                        throw new BusinessErrorException("MasterData.WindowTime.LaterThanShiftEndTime");
                    }
                    foreach (decimal reqQty in reqQtyList)
                    {
                        OrderHead oh = new OrderHead();
                        oh = this.TransferFlow2Order(sps.FlowDetail.Flow.Code);
                        oh.Priority = BusinessConstants.CODE_MASTER_ORDER_PRIORITY_VALUE_NORMAL;

                        oh.StartTime = startTime;
                        oh.WindowTime = windowTime;

                        oh.GetOrderDetailByFlowDetailIdAndItemCode(sps.FlowDetail.Id, sps.FlowDetail.Item.Code).RequiredQty = reqQty;
                        oh.GetOrderDetailByFlowDetailIdAndItemCode(sps.FlowDetail.Id, sps.FlowDetail.Item.Code).OrderedQty = reqQty;
                        orderHeadList.Add(oh);

                        startTime = windowTime;
                        windowTime = startTime.AddHours(Convert.ToDouble(leadTime));
                    }
                }
            }

            OrderHelper.FilterZeroOrderQty(orderHeadList);
            return orderHeadList;
        }