Example #1
0
        public IList <WorkdayShift> GetWorkdayShiftsByWorkdayId(int workdayId)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(WorkdayShift));

            criteria.Add(Expression.Eq("Workday.Id", workdayId));
            IList workdayShifts = criteriaMgr.FindAll(criteria);

            return(IListHelper.ConvertToList <WorkdayShift>(workdayShifts));
        }
Example #2
0
        public void PostProcessInvDetail(IList list)
        {
            if (list == null)
            {
                throw new BusinessErrorException("Common.Business.Warn.DetailEmpty");
            }

            IList <LocationDetail> locationDetailList = IListHelper.ConvertToList <LocationDetail>(list);
            IList <string>         itemList           = locationDetailList.Select(l => l.Item.Code).Distinct().ToList <string>();

            string[] statusArray = new string[] { BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS };

            IList <string> locList = locationDetailList.Select(l => l.Location.Code).Distinct().ToList <string>();
            IList <OrderLocationTransaction> orderLocationTransactionList = OrderLocTransMgr.GetOpenOrderLocationTransaction(itemList, locList);
            IList <InProcessLocationDetail>  ipDetOut        = this.IPLocDetMgr.GetInProcessLocationDetailOut(itemList, locList);
            IList <InProcessLocationDetail>  ipDetIn         = this.IPLocDetMgr.GetInProcessLocationDetailIn(itemList, locList);
            IList <PickListResult>           pickListResults = this.PickListResultMgr.GetPickListResult(locList.ToArray(), itemList.ToArray(), null, null, statusArray, true);

            foreach (var ld in locationDetailList)
            {
                //订单待收
                ld.QtyToBeIn = (from o in orderLocationTransactionList
                                where o.Item.Equals(ld.Item) && o.Location.Equals(ld.Location) && o.IOType == BusinessConstants.IO_TYPE_IN
                                select o.RemainQty).Sum();

                //订单待发
                ld.QtyToBeOut = (from o in orderLocationTransactionList
                                 where o.Item.Equals(ld.Item) && o.Location.Equals(ld.Location) && o.IOType == BusinessConstants.IO_TYPE_OUT
                                 select o.RemainQty).Sum();

                //出在途
                ld.InTransitQtyOut = (from i in ipDetOut
                                      where StringHelper.Eq(ld.Item.Code, i.ItemCode) && StringHelper.Eq(ld.Location.Code, i.LocationCode)
                                      select i.Qty).Sum();

                //入在途
                ld.InTransitQty = (from i in ipDetIn
                                   where StringHelper.Eq(ld.Item.Code, i.ItemCode)
                                   select i.Qty).Sum();

                //已拣

                ld.PickedQty = (from pickListResult in pickListResults
                                where StringHelper.Eq(ld.Item.Code, pickListResult.ItemCode) &&
                                StringHelper.Eq(ld.Location.Code, pickListResult.LocationCode)
                                select pickListResult.Qty).Sum();

                //可用库存
                ld.PAB = ld.Qty + ld.QtyToBeIn - ld.QtyToBeOut;
            }
        }
Example #3
0
        public void PostProcessInvHistory(IList list, DateTime?date)
        {
            if (list == null)
            {
                throw new BusinessErrorException("Common.Business.Warn.DetailEmpty");
            }

            IList <LocationDetail>      locationDetailList      = IListHelper.ConvertToList <LocationDetail>(list);
            IList <string>              itemList                = locationDetailList.Select(l => l.Item.Code).Distinct().ToList <string>();
            IList <string>              locList                 = locationDetailList.Select(l => l.Location.Code).Distinct().ToList <string>();
            IList <LocationTransaction> locationTransactionList = LocTransMgr.GetProjectionLocationTransaction(itemList, locList, date);

            foreach (var ld in locationDetailList)
            {
                decimal transQty = (from l in locationTransactionList
                                    where StringHelper.Eq(l.Item, ld.Item.Code) && StringHelper.Eq(l.Location, ld.Location.Code)
                                    select l.Qty).Sum();

                //历史库存
                ld.InvQty = ld.Qty - transQty;
            }
        }
Example #4
0
        public void PostProcessInvVisualBoard(IList list, DateTime?date)
        {
            if (list == null)
            {
                throw new BusinessErrorException("Common.Business.Warn.DetailEmpty");
            }

            IList <FlowView>                 flowViewList                 = IListHelper.ConvertToList <FlowView>(list);
            IList <string>                   itemList                     = flowViewList.Select(f => f.FlowDetail.Item.Code).Distinct().ToList <string>();
            IList <string>                   locList                      = flowViewList.Where(f => f.LocationTo != null).Select(f => f.LocationTo.Code).Distinct().ToList <string>();
            IList <LocationDetail>           locationDetailList           = this.GetLocationDetail(itemList, locList);
            IList <OrderLocationTransaction> orderLocationTransactionList = OrderLocTransMgr.GetOpenOrderLocationTransaction(itemList, locList);
            IList <InProcessLocationDetail>  ipDetOut                     = this.IPLocDetMgr.GetInProcessLocationDetailOut(itemList, locList);
            IList <InProcessLocationDetail>  ipDetIn                      = this.IPLocDetMgr.GetInProcessLocationDetailIn(itemList, locList);

            IList <LocationDetail> result = new List <LocationDetail>();

            if (list != null && list.Count > 0)
            {
                foreach (var flowView in flowViewList)
                {
                    flowView.LocationDetail = locationDetailList.Where(l => l.Item.Equals(flowView.FlowDetail.Item) &&
                                                                       l.Location.Equals(flowView.LocationTo)).SingleOrDefault();

                    if (flowView.LocationDetail == null)
                    {
                        flowView.LocationDetail          = new LocationDetail();
                        flowView.LocationDetail.Location = flowView.LocationTo;
                        flowView.LocationDetail.Item     = flowView.FlowDetail.Item;
                    }
                    LocationDetail locationDetail = flowView.LocationDetail;

                    //订单待收
                    locationDetail.QtyToBeIn = (from o in orderLocationTransactionList
                                                where o.Item.Equals(locationDetail.Item) && o.Location.Equals(locationDetail.Location) &&
                                                o.IOType == BusinessConstants.IO_TYPE_IN
                                                //&& (!date.HasValue || o.OrderDetail.OrderHead.WindowTime >= date.Value)
                                                select o.RemainQty).Sum();

                    //订单待发
                    locationDetail.QtyToBeOut = (from o in orderLocationTransactionList
                                                 where o.Item.Equals(locationDetail.Item) && o.Location.Equals(locationDetail.Location) &&
                                                 o.IOType == BusinessConstants.IO_TYPE_OUT
                                                 //&& (!date.HasValue || o.OrderDetail.OrderHead.StartTime > date.Value)
                                                 select o.RemainQty).Sum();

                    //入在途
                    locationDetail.InTransitQty = (from i in ipDetIn
                                                   where locationDetail.Item.Code.Equals(i.ItemCode)
                                                   //&& (!date.HasValue || i.OrderLocationTransaction.OrderDetail.OrderHead.WindowTime >= date.Value)
                                                   select i.Qty).Sum();

                    //可用库存
                    if (StringHelper.Eq(flowView.Flow.FlowStrategy, BusinessConstants.CODE_MASTER_FLOW_STRATEGY_VALUE_KB))
                    {
                        locationDetail.PAB = locationDetail.Qty + locationDetail.QtyToBeIn;
                    }
                    else
                    {
                        locationDetail.PAB = locationDetail.Qty + locationDetail.QtyToBeIn - locationDetail.QtyToBeOut;
                    }

                    //单位换算
                    if (!flowView.FlowDetail.Item.Uom.Equals(flowView.FlowDetail.Uom))
                    {
                        locationDetail.Qty          = UomConversionMgr.ConvertUomQtyInvToOrder(flowView.FlowDetail, locationDetail.InvQty);
                        locationDetail.QtyToBeIn    = UomConversionMgr.ConvertUomQtyInvToOrder(flowView.FlowDetail, locationDetail.QtyToBeIn);
                        locationDetail.InTransitQty = UomConversionMgr.ConvertUomQtyInvToOrder(flowView.FlowDetail, locationDetail.InTransitQty);
                        locationDetail.QtyToBeOut   = UomConversionMgr.ConvertUomQtyInvToOrder(flowView.FlowDetail, locationDetail.QtyToBeOut);
                        locationDetail.PAB          = UomConversionMgr.ConvertUomQtyInvToOrder(flowView.FlowDetail, locationDetail.PAB);
                    }
                }
            }
        }
Example #5
0
        public void PostProcessInvIOB(IList list, DateTime?startEffDate, DateTime?endEffDate)
        {
            if (list == null)
            {
                throw new BusinessErrorException("Common.Business.Warn.DetailEmpty");
            }

            DateTime startDate = startEffDate.HasValue ? startEffDate.Value : DateTime.MinValue;
            DateTime endDate   = endEffDate.HasValue ? endEffDate.Value : DateTime.MaxValue;

            IList <LocationDetail>      locationDetailList      = IListHelper.ConvertToList <LocationDetail>(list);
            IList <string>              itemList                = locationDetailList.Select(l => l.Item.Code).Distinct().ToList <string>();
            IList <string>              locList                 = locationDetailList.Select(l => l.Location.Code).Distinct().ToList <string>();
            IList <LocationTransaction> locationTransactionList = LocTransMgr.GetLocationTransaction(itemList, locList, startEffDate);

            foreach (var ld in locationDetailList)
            {
                decimal afterTransQty = (from l in locationTransactionList
                                         where l.Item == ld.Item.Code && l.Location == ld.Location.Code && l.EffectiveDate >= endDate
                                         select l.Qty).Sum();

                decimal allTransQty = (from l in locationTransactionList
                                       where l.Item == ld.Item.Code && l.Location == ld.Location.Code && l.EffectiveDate >= startDate
                                       select l.Qty).Sum();

                //期初库存
                ld.StartInvQty = ld.Qty - allTransQty;
                //期末库存
                ld.InvQty = ld.Qty - afterTransQty;

                //采购收货、退货、调整
                ld.RCTPO = (from l in locationTransactionList
                            where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                            l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                            l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_PO)
                            select l.Qty).Sum();


                //移库入库、退货、调整
                ld.RCTTR = (from l in locationTransactionList
                            where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                            l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                            l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_TR)
                            select l.Qty).Sum();


                //检验入库
                ld.RCTINP = (from l in locationTransactionList
                             where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                             l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                             l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_INP)
                             select l.Qty).Sum();


                //生产入库、退货、调整
                ld.RCTWO = (from l in locationTransactionList
                            where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                            l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                            l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_WO)
                            select l.Qty).Sum();


                //计划外入库CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_UNP
                ld.RCTUNP = (from l in locationTransactionList
                             where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                             l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                             l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_UNP)
                             select l.Qty).Sum();
                //入库合计
                ld.TotalInQty = ld.RCTPO + ld.RCTTR + ld.RCTINP + ld.RCTWO + ld.RCTUNP;



                //销售出库、退货、调整
                ld.ISSSO = -(from l in locationTransactionList
                             where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                             l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                             l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_SO)
                             select l.Qty).Sum();

                //移库出库、退货、调整
                ld.ISSTR = -(from l in locationTransactionList
                             where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                             l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                             l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_TR)
                             select l.Qty).Sum();


                //检验出库
                ld.ISSINP = -(from l in locationTransactionList
                              where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                              l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                              l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_INP)
                              select l.Qty).Sum();


                //生产消耗、退货、调整
                ld.ISSWO = -(from l in locationTransactionList
                             where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                             l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                             l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO)
                             select l.Qty).Sum();

                //计划外出库
                ld.ISSUNP = -(from l in locationTransactionList
                              where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                              l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                              l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_UNP)
                              select l.Qty).Sum();
                //出库合计
                ld.TotalOutQty = ld.ISSSO + ld.ISSTR + ld.ISSINP + ld.ISSWO + ld.ISSUNP;

                //盘点
                ld.CYCCNT = (from l in locationTransactionList
                             where l.Item == ld.Item.Code && l.Location == ld.Location.Code &&
                             l.EffectiveDate >= startDate && l.EffectiveDate < endDate &&
                             l.TransactionType.StartsWith(BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_CYC_CNT)
                             select l.Qty).Sum();

                //未统计
                ld.NoStatsQty = ld.InvQty - ld.StartInvQty - ld.TotalInQty + ld.TotalOutQty - ld.CYCCNT;
            }
        }
Example #6
0
    public override IList GetDataSource(int pageSize, int pageIndex)
    {
        IList <OrderDetailView> list = TheOrderDetailViewMgr.GetProdIO(Flow, Region, StartDate, EndDate, Item, this.CurrentUser.Code, pageSize, pageIndex);

        return(IListHelper.ConvertToList(list));
    }
Example #7
0
    public LocationDetail[] FindLocationDetail(string[] locationCode, string[] itemCode, DateTime effectiveDate, string userCode)
    {
        try
        {
            IList <LocationDetail> locationDetailList = TheLocationDetailMgr.FindLocationDetail(IListHelper.ConvertToList(locationCode), IListHelper.ConvertToList(itemCode), effectiveDate, userCode);

            if (locationDetailList != null && locationDetailList.Count > 0)
            {
                return(locationDetailList.ToArray());
            }
            else
            {
                return(null);
            }
        }
        catch (Exception ex)
        {
            throw new SoapException(ex.Message, SoapException.ServerFaultCode, Context.Request.Url.AbsoluteUri);
        }
    }