예제 #1
0
        public IHttpActionResult savePickListDetail(whpl2 pickListDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            bool isDone = PickListHelper.savePickListDetail(pickListDetail);

            if (!isDone)
            {
                return(InternalServerError());
            }
            return(Ok());
        }
예제 #2
0
        public IHttpActionResult savePickList(whpl1 pickList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            int trxNo = PickListHelper.savePickList(pickList);

            if (trxNo <= 0)
            {
                return(InternalServerError());
            }
            return(Ok(trxNo));
        }
예제 #3
0
        public IHttpActionResult getPickListDetail(int TrxNo, int LineItemNo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var pickListDetail = PickListHelper.getPickListDetail(TrxNo, LineItemNo);

            if (pickListDetail == null)
            {
                return(NotFound());
            }
            return(Ok(pickListDetail));
        }
예제 #4
0
        public IHttpActionResult getPickList(int TrxNo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var pickList = PickListHelper.getPickList(TrxNo);

            if (pickList == null)
            {
                return(NotFound());
            }
            return(Ok(pickList));
        }
예제 #5
0
        public IHttpActionResult deletePickListDetail(int TrxNo, int LineItemNo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            bool isDone = PickListHelper.deletePickListDetail(TrxNo, LineItemNo);

            if (!isDone)
            {
                return(InternalServerError());
            }
            return(Ok());
        }
예제 #6
0
        public static IEnumerable <string> generatePickList(IEnumerable <whiv1> InvItemList, string WarehouseCode, string WaveBy)
        {
            List <string> pickNos = new List <string>();

            switch (WaveBy)
            {
            case "A":
                var aisleList = (from item in InvItemList
                                 select item.BinNo.Substring(0, 2)).Distinct();

                foreach (string aisle in aisleList)
                {
                    IEnumerable <whiv1> invItemGroup = from item in InvItemList
                                                       where item.BinNo.Substring(0, 2) == aisle
                                                       select item;

                    string pickNo   = PickListHelper.getNewPickNo(DateTime.Today);
                    whpl1  pickList = new whpl1
                    {
                        TrxNo          = 0,
                        PickNo         = pickNo,
                        PickDate       = DateTime.Today,
                        WarehouseCode  = WarehouseCode,
                        PickBy         = null,
                        Remark         = "",
                        WorkStation    = ApiService.HostName,
                        StatusCode     = "USE",
                        CreateBy       = ApiService.UserId,
                        CreateDateTime = ApiService.ClientDate,
                        UpdateBy       = ApiService.UserId,
                        UpdateDateTime = ApiService.ClientDate
                    };

                    pickList.TrxNo = PickListHelper.savePickList(pickList);

                    int          lineItemNo      = 1;
                    List <whpl2> pickListDetails = new List <whpl2>();
                    foreach (whiv1 invItem in invItemGroup)
                    {
                        whpl2 pickListDetail = new whpl2
                        {
                            TrxNo           = pickList.TrxNo,
                            LineItemNo      = lineItemNo,
                            BatchNo         = invItem.BatchNo,
                            BinNo           = invItem.BinNo,
                            Description     = invItem.Description,
                            DimensionFlag   = invItem.DimensionFlag,
                            ExpiryDate      = invItem.ExpiryDate,
                            Height          = -1 * invItem.Height,
                            Length          = -1 * invItem.Length,
                            Qty             = -1 * invItem.Qty,
                            ManufactureDate = invItem.ManufactureDate,
                            ItemCode        = invItem.ItemCode,
                            SpaceArea       = -1 * invItem.SpaceArea,
                            UomCode         = invItem.UomCode,
                            Volume          = -1 * invItem.Volume,
                            Weight          = -1 * invItem.Weight,
                            Width           = -1 * invItem.Width
                        };
                        pickListDetails.Add(pickListDetail);
                        lineItemNo++;

                        invItem.StatusCode = "CLS";
                        InventoryHelper.SaveInv(invItem);
                    }

                    PickListHelper.savePickListDetails(pickListDetails);
                    pickNos.Add(pickList.PickNo);
                }

                break;

            case "S":
                var sectionList = (from item in InvItemList
                                   select item.BinNo.Substring(2, 2)).Distinct();

                foreach (string section in sectionList)
                {
                    IEnumerable <whiv1> invItemGroup = from item in InvItemList
                                                       where item.BinNo.Substring(2, 2) == section
                                                       select item;

                    string pickNo   = PickListHelper.getNewPickNo(DateTime.Today);
                    whpl1  pickList = new whpl1
                    {
                        TrxNo          = 0,
                        PickNo         = pickNo,
                        PickBy         = null,
                        PickDate       = DateTime.Today,
                        WarehouseCode  = WarehouseCode,
                        Remark         = "",
                        WorkStation    = ApiService.HostName,
                        StatusCode     = "USE",
                        CreateBy       = ApiService.UserId,
                        CreateDateTime = ApiService.ClientDate,
                        UpdateBy       = ApiService.UserId,
                        UpdateDateTime = ApiService.ClientDate
                    };

                    pickList.TrxNo = PickListHelper.savePickList(pickList);

                    int          lineItemNo      = 1;
                    List <whpl2> pickListDetails = new List <whpl2>();
                    foreach (whiv1 invItem in invItemGroup)
                    {
                        whpl2 pickListDetail = new whpl2
                        {
                            TrxNo           = pickList.TrxNo,
                            LineItemNo      = lineItemNo,
                            BatchNo         = invItem.BatchNo,
                            BinNo           = invItem.BinNo,
                            Description     = invItem.Description,
                            DimensionFlag   = invItem.DimensionFlag,
                            ExpiryDate      = invItem.ExpiryDate,
                            Height          = -1 * invItem.Height,
                            Length          = -1 * invItem.Length,
                            Qty             = -1 * invItem.Qty,
                            ManufactureDate = invItem.ManufactureDate,
                            ItemCode        = invItem.ItemCode,
                            SpaceArea       = -1 * invItem.SpaceArea,
                            UomCode         = invItem.UomCode,
                            Volume          = -1 * invItem.Volume,
                            Weight          = -1 * invItem.Weight,
                            Width           = -1 * invItem.Width
                        };
                        pickListDetails.Add(pickListDetail);
                        lineItemNo++;

                        invItem.StatusCode = "CLS";
                        InventoryHelper.SaveInv(invItem);
                    }

                    PickListHelper.savePickListDetails(pickListDetails);
                    pickNos.Add(pickList.PickNo);
                }

                break;

            default:
                var shelfList = (from item in InvItemList
                                 select item.BinNo.Substring(4, 2)).Distinct();

                foreach (string shelf in shelfList)
                {
                    IEnumerable <whiv1> invItemGroup = from item in InvItemList
                                                       where item.BinNo.Substring(4, 2) == shelf
                                                       select item;

                    string pickNo   = PickListHelper.getNewPickNo(DateTime.Today);
                    whpl1  pickList = new whpl1
                    {
                        TrxNo          = 0,
                        PickNo         = pickNo,
                        PickBy         = null,
                        PickDate       = DateTime.Today,
                        WarehouseCode  = WarehouseCode,
                        Remark         = "",
                        WorkStation    = ApiService.HostName,
                        StatusCode     = "USE",
                        CreateBy       = ApiService.UserId,
                        CreateDateTime = ApiService.ClientDate,
                        UpdateBy       = ApiService.UserId,
                        UpdateDateTime = ApiService.ClientDate
                    };

                    pickList.TrxNo = PickListHelper.savePickList(pickList);

                    int          lineItemNo      = 1;
                    List <whpl2> pickListDetails = new List <whpl2>();
                    foreach (whiv1 invItem in invItemGroup)
                    {
                        whpl2 pickListDetail = new whpl2
                        {
                            TrxNo           = pickList.TrxNo,
                            LineItemNo      = lineItemNo,
                            BatchNo         = invItem.BatchNo,
                            BinNo           = invItem.BinNo,
                            Description     = invItem.Description,
                            DimensionFlag   = invItem.DimensionFlag,
                            ExpiryDate      = invItem.ExpiryDate,
                            Height          = -1 * invItem.Height,
                            Length          = -1 * invItem.Length,
                            Qty             = -1 * invItem.Qty,
                            ManufactureDate = invItem.ManufactureDate,
                            ItemCode        = invItem.ItemCode,
                            SpaceArea       = -1 * invItem.SpaceArea,
                            UomCode         = invItem.UomCode,
                            Volume          = -1 * invItem.Volume,
                            Weight          = -1 * invItem.Weight,
                            Width           = -1 * invItem.Width
                        };
                        pickListDetails.Add(pickListDetail);
                        lineItemNo++;

                        invItem.StatusCode = "CLS";
                        InventoryHelper.SaveInv(invItem);
                    }

                    PickListHelper.savePickListDetails(pickListDetails);
                    pickNos.Add(pickList.PickNo);
                }
                break;
            }

            return(pickNos);
        }