Ejemplo n.º 1
0
        public Chain LogisticChainGet(string item, int loc, int wh)
        {
            var chain = new Chain { Item = item, Loc = loc, Wh = wh };
            AssortmentProcedure.LogisticChainGet.Parameters["i_item"].Value = item;
            AssortmentProcedure.LogisticChainGet.Parameters["i_loc"].Value = loc;
            AssortmentProcedure.LogisticChainGet.Parameters["i_wh"].Value = wh;
            var parameters = CallProcedure(AssortmentProcedure.LogisticChainGet);
            var chains = parameters["o_recordset"] as List<Dictionary<string, object>>;
            for (var i = 0; i < chains.Count; i++)
            {
                var rec = new ChainRec
                {
                    Id = 1,
                    Seq = chain.Nodes.Count + 1,
                    Item = item,
                    Loc = Convert.ToInt32(chains[i]["LOC"].ToString()),
                    SourceMethod = new ChainValue
                    {
                        State = ValueStates.Valid,
                        Value =
                            (chains[i][
                                "DIM_ITEMLOC_SOURCEMETHOD"] != DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SOURCEMETHOD"]
                                 : null)
                    },
                    SourceWh = new ChainValue
                    {
                        State = ValueStates.Valid,
                        Value =
                            (chains[i]["DIM_ITEMLOC_SOURCEWH"] !=
                             DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SOURCEWH"]
                                 : null)
                    },
                    SourceMethodNew = new ChainValue
                    {
                        State =
                            (chains[i][
                                "DIM_ITEMLOC_SOURCEMETHOD_NEW"] != DBNull.Value
                                 ? ValueStates.Valid
                                 : ValueStates.NotValid),
                        Value =
                            (chains[i][
                                "DIM_ITEMLOC_SOURCEMETHOD_NEW"] != DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SOURCEMETHOD_NEW"]
                                 : null)
                    },
                    SourceWhNew = new ChainValue
                    {
                        State =
                            (chains[i][
                                "DIM_ITEMLOC_SOURCEWH_NEW"] != DBNull.Value ||
                             (chains[i][
                                 "DIM_ITEMLOC_SOURCEMETHOD_NEW"] != DBNull.Value &&
                              Convert.ToChar(
                                  chains[i][
                                      "DIM_ITEMLOC_SOURCEMETHOD_NEW"].ToString()) ==
                              (char)SourceMethods.S)
                                 ? ValueStates.Valid
                                 : ValueStates.NotValid),
                        Value =
                            (chains[i][
                                "DIM_ITEMLOC_SOURCEWH_NEW"] != DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SOURCEWH_NEW"]
                                 : null)
                    },
                    Supplier = new ChainValue
                    {
                        State = ValueStates.Valid,
                        Value =
                            (chains[i]["DIM_ITEMLOC_SUPPLIER"] !=
                             DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SUPPLIER"]
                                 : null)
                    },
                    SupplierDesc = new ChainValue
                    {
                        State = ValueStates.Valid,
                        Value =
                            (chains[i][
                                "DIM_ITEMLOC_SUPPLIER_DESC"] != DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SUPPLIER_DESC"]
                                 : null)
                    },
                    SupplierNew = new ChainValue
                    {
                        State =
                            (chains[i][
                                "DIM_ITEMLOC_SUPPLIER_NEW"] != DBNull.Value
                                 ? ValueStates.Valid
                                 : ValueStates.NotValid),
                        Value =
                            (chains[i][
                                "DIM_ITEMLOC_SUPPLIER_NEW"] != DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SUPPLIER_NEW"]
                                 : null)
                    },
                    SupplierDescNew = new ChainValue
                    {
                        State =
                            (chains[i][
                                "DIM_ITEMLOC_SUPPLIER_DESC_NEW"] != DBNull.Value
                                 ? ValueStates.Valid
                                 : ValueStates.NotValid),
                        Value =
                            (chains[i][
                                "DIM_ITEMLOC_SUPPLIER_DESC_NEW"] != DBNull.Value
                                 ? chains[i][
                                     "DIM_ITEMLOC_SUPPLIER_DESC_NEW"]
                                 : null)
                    },
                    Status = new ChainValue
                    {
                        State = ValueStates.Valid,
                        Value = chains[i]["MEASURE_STATUS"]
                    },
                    StatusNew = new ChainValue
                    {
                        //State = (Actions)Convert.ToInt32(dr["ACTION"]) != Actions.NoAction ? ValueState.Valid : ValueState.NotValid,
                        State = ValueStates.Valid,
                        Value = chains[i]["MEASURE_STATUS_NEW"]
                    },
                    Action = new ChainValue
                    {
                        State =
                            (Actions)
                            Convert.ToInt32(chains[i]["ACTION"]) !=
                            Actions.NoAction
                                ? ValueStates.Valid
                                : ValueStates.NotValid,
                        Value =
                            (Actions)
                            Convert.ToInt32(chains[i]["ACTION"])
                    }
                };

                chain.Nodes.Add(rec);
            }
            return chain;
        }
Ejemplo n.º 2
0
 public void Join(Chain chain)
 {
     for (int index = 0; index < Nodes.Count; index++)
     {
         var chainRow = Nodes[index];
         chainRow.Join(chain.Nodes[index]);
     }
 }