Exemple #1
0
        public void ValidateStrategiesGpvMaxCountTest()
        {
            var teTypeObject = new TEType();
            var property     = TypeDescriptor.GetProperties(teTypeObject).Find("GLOBALPARAMVAL", true);

            if (property == null)
            {
                return;
            }
            const string strategyName = "gpv.maxcount";

            WMSValidateAttribute.TestStrategy(strategyName, new ValidateStrategyContext(teTypeObject, property, null, null)).Should().BeFalse();

            var arrayGpv = new WMSBusinessCollection <TETypeGPV>();

            property.SetValue(teTypeObject, arrayGpv);
            WMSValidateAttribute.TestStrategy(strategyName, new ValidateStrategyContext(teTypeObject, property, null, null)).Should().BeFalse();

            var gpv = new TETypeGPV();

            // HACK - знаем что такой GPV есть для TEType
            gpv.AsDynamic().GLOBALPARAMCODE_R_TETYPEGPV = "TETypeSequence2TENumber";
            arrayGpv.Add(gpv);
            property.SetValue(teTypeObject, arrayGpv);
            WMSValidateAttribute.TestStrategy(strategyName, new ValidateStrategyContext(teTypeObject, property, null, null)).Should().BeFalse();

            arrayGpv.Add(gpv);
            property.SetValue(teTypeObject, arrayGpv);
            WMSValidateAttribute.TestStrategy(strategyName, new ValidateStrategyContext(teTypeObject, property, null, null)).Should().BeTrue();
        }
Exemple #2
0
        public WMSBusinessCollection <OutputParam> CreateReportParams(Dictionary <string, Variable[]> epsReports, string resultReportFile, bool?changeOdbc)
        {
            var result = new WMSBusinessCollection <OutputParam>();

            if (epsReports != null)
            {
                foreach (var p in epsReports)
                {
                    if (!string.IsNullOrEmpty(p.Key))
                    {
                        result.Add(new OutputParam
                        {
                            OutputParamCode  = EpsTaskParams.EpsReport.ToString(),
                            OutputParamValue = p.Key,
                            OutputParamType  = EpsParamType.REP.ToString()
                        });
                        if (p.Value != null)
                        {
                            foreach (var v in p.Value.Where(v => !string.IsNullOrEmpty(v.Value)))
                            {
                                result.Add(new OutputParam
                                {
                                    OutputParamCode     = v.Value,
                                    OutputParamValue    = v.SubValue,
                                    OutputParamSubvalue = p.Key,
                                    OutputParamType     = EpsParamType.REP.ToString()
                                });
                            }
                        }
                    }
                }
            }

            if (!string.IsNullOrEmpty(resultReportFile))
            {
                result.Add(new OutputParam
                {
                    OutputParamCode  = EpsTaskParams.ResultReportFile.ToString(),
                    OutputParamValue = resultReportFile,
                    OutputParamType  = EpsParamType.REP.ToString()
                });
            }

            if (changeOdbc.HasValue)
            {
                result.Add(new OutputParam
                {
                    OutputParamCode  = EpsTaskParams.ChangeODBC.ToString(),
                    OutputParamValue = (changeOdbc.Value ? 1 : 0).ToString(CultureInfo.InvariantCulture),
                    OutputParamType  = EpsParamType.REP.ToString()
                });
            }

            return(result.Any() ? result : null);
        }
Exemple #3
0
        public WMSBusinessCollection <OutputParam> CreateEpsParams(bool useZip, bool useReserveCopy)
        {
            var result = new WMSBusinessCollection <OutputParam>();

            if (useZip)
            {
                result.Add(new OutputParam
                {
                    OutputParamCode = EpsTaskParams.Zip.ToString(),
                    OutputParamType = EpsParamType.EPS.ToString()
                });
            }
            if (useReserveCopy)
            {
                result.Add(new OutputParam
                {
                    OutputParamCode = EpsTaskParams.ReserveCopy.ToString(),
                    OutputParamType = EpsParamType.EPS.ToString()
                });
            }
            return(result.Any() ? result : null);
        }
Exemple #4
0
        public IEnumerable GetChild(object parent)
        {
            var ret = new WMSBusinessCollection <MotionAreaGroup>();

            foreach (var item in Source)
            {
                if (string.IsNullOrEmpty(item.MotionAreaGroupParent))
                {
                    continue;
                }

                if (((MotionAreaGroup)parent).GetKey().To <string>() == item.MotionAreaGroupParent)
                {
                    ret.Add(item);
                }
            }
            return(ret);
        }
        public static OWBPos[] OwbBoxReserve(decimal?owbid, SalesInvoiceWrapper owbwrapper)
        {
            if (owbwrapper == null || owbwrapper.OWBBOXRESERVE != 1 || !owbwrapper.MANDANTID.HasValue)
            {
                return(new OWBPos[0]);
            }

            var mandantid = owbwrapper.MANDANTID.Value;

            var boxNumbers =
                owbwrapper.OWBPOSL.Where(p => !string.IsNullOrEmpty(p.OWBPOSBOXNUMBER))
                .Select(p => p.OWBPOSBOXNUMBER)
                .Distinct()
                .ToArray();

            if (boxNumbers.Length == 0)
            {
                throw new IntegrationService.IntegrationLogicalException("Номера коробов не определены у всех позиций расходной накладной «{0}» в режиме OWBBOXRESERVE.", owbwrapper.OWBNAME);
            }

            var filterConst = string.Format(" AND MANDANTID = {0} AND STATUSCODE_R = '{1}'", mandantid, ProductStates.PRODUCT_FREE);

            var filterArray = FilterHelper.GetArrayFilterIn("PRODUCTBOXNUMBER", boxNumbers, filterConst);

            var products = new List <Product>();

            using (var mngProduct = IoC.Instance.Resolve <IBaseManager <Product> >())
            {
                foreach (var filter in filterArray)
                {
                    var res = mngProduct.GetFiltered(filter, GetModeEnum.Partial).ToArray();
                    if (res.Length > 0)
                    {
                        products.AddRange(res);
                    }
                }
            }

            if (!products.Any())
            {
                throw new IntegrationService.IntegrationLogicalException("Отсутствует свободный товар для формирования позиций расходной накладной «{0}» в режиме OWBBOXRESERVE.", owbwrapper.OWBNAME);
            }

            var grProducts = products.GroupBy(k => new
            {
                k.ProductBoxNumber,

                k.SKUID,
                k.ProductCount,
                k.PRODUCTOWNER,
                k.PRODUCTKITARTNAME,
                k.QLFCode_r,
                k.QLFDETAILCODE_R,
                k.ProductExpiryDate,
                k.ProductBatch,
                k.FactoryID_R,
                k.ProductColor,
                k.ProductSize,
                k.PRODUCTDATE,
                k.ProductSerialNumber,
                k.PRODUCTLOT,
                k.ProductTone,
            });

            var owbposL   = new WMSBusinessCollection <OWBPos>();
            var posnumber = 0;

            foreach (var grp in grProducts)
            {
                var owbpos = new OWBPos
                {
                    OWBID_R         = owbid,
                    OWBPOSBOXNUMBER = grp.Key.ProductBoxNumber,

                    MandantID    = mandantid,
                    OWBPosOwner  = grp.Key.PRODUCTOWNER,
                    OWBPosNumber = ++posnumber,
                    Status       = OWBPosStates.OWBPOS_CREATED,

                    SKUID            = grp.Key.SKUID,
                    OWBPosCount2SKU  = grp.Key.ProductCount,
                    OWBPOSKITARTNAME = grp.Key.PRODUCTKITARTNAME,

                    QLFCODE_R          = grp.Key.QLFCode_r,
                    QLFDETAILCODE_R    = grp.Key.QLFDETAILCODE_R,
                    OWBPOSEXPIRYDATE   = grp.Key.ProductExpiryDate,
                    OWBPosBatch        = grp.Key.ProductBatch,
                    FactoryID_R        = grp.Key.FactoryID_R,
                    OWBPOSCOLOR        = grp.Key.ProductColor,
                    OWBPOSSIZE         = grp.Key.ProductSize,
                    OWBPosCount        = grp.Sum(p => p.ProductCountSKU),
                    OWBPOSPRODUCTDATE  = grp.Key.PRODUCTDATE,
                    OWBPOSSERIALNUMBER = grp.Key.ProductSerialNumber,
                    OWBPOSLOT          = grp.Key.PRODUCTLOT,
                    OWBPOSTONE         = grp.Key.ProductTone
                };

                owbposL.Add(owbpos);
            }

            return(owbposL.ToArray());
        }