Пример #1
0
        public void TrayConfirm(string planListID, string recCellName)
        {
            try
            {
                View_PlanListModel planlistView = bllViewPlanList.GetModelByPlanListID(planListID);
                if (planlistView == null)
                {
                    return;
                }
                if (planlistView.Plan_Status == EnumPlanStatus.完成.ToString())
                {
                    this.View.ShowMessage("信息提示", "已完成的计划不允许再进行配盘操作!");
                    return;
                }
                string restr = "";
                if (ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Count == 0)
                {
                    this.View.ShowMessage("信息提示", "请添加配盘物料!");
                    return;
                }
                //if (isFull == true)
                //{
                //    stock.Stock_Full_Flag = "1";
                //}
                //else
                //{
                //    stock.Stock_Full_Flag = "0";
                //}
                //WH_WareHouseModel house = bllWareHouse.GetModelByName(houseName);
                //if (house == null)
                //{
                //    restr = "库房对象为空!";
                //    return ;
                //}
                WH_CellModel cell = bllCell.GetStationByName(recCellName);
                if (cell == null)
                {
                    this.View.ShowMessage("信息提示", "配盘地点错误!");
                    return;
                }
                List <string> distinctTray = new List <string>();
                foreach (TrayGoodsListModel tray in ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData)
                {
                    if (distinctTray.Contains(tray.托盘条码) == false)
                    {
                        distinctTray.Add(tray.托盘条码);
                    }
                }
                foreach (string tray in distinctTray)
                {
                    StockModel stockModel = bllStock.GetModelByTrayCode(tray);
                    if (stockModel != null)
                    {
                        this.View.ShowMessage("信息提示", "托盘条码" + tray + "已经在库存中,请确认托盘条码!");
                        ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Clear();
                        return;
                    }
                }

                //if (CheckMaterialNum(ref restr) == false)//不做校验了
                //{
                //    this.View.ShowMessage("信息提示", restr);
                //    return;
                //}
                foreach (string tray in distinctTray)
                {
                    StockModel stock = new StockModel();
                    stock.Stock_ID           = Guid.NewGuid().ToString();
                    stock.Cell_Child_ID      = cell.Cell_ID;
                    stock.Stock_Tray_Barcode = tray;
                    bllStock.Add(stock);

                    for (int i = 0; i < ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Count; i++)
                    {
                        TrayGoodsListModel trayGoodsModel = ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData[i];
                        if (trayGoodsModel.托盘条码 != tray)
                        {
                            continue;
                        }
                        Stock_ListModel stockList = new Stock_ListModel();
                        stockList.Stock_List_ID = Guid.NewGuid().ToString();
                        stockList.Stock_ID      = stock.Stock_ID;

                        GoodsModel goods = bllGoods.GetModelByCode(trayGoodsModel.物料编码);
                        if (goods == null)
                        {
                            continue;
                        }
                        stockList.Goods_ID               = goods.Goods_ID;
                        stockList.Plan_List_ID           = trayGoodsModel.计划列表编号;
                        stockList.Stock_List_Box_Barcode = trayGoodsModel.托盘条码;
                        stockList.Stock_List_Entry_Time  = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        stockList.Stock_List_Quantity    = trayGoodsModel.数量.ToString();

                        bllStockList.Add(stockList);

                        if (UpdatePlanNum(trayGoodsModel.计划列表编号, goods.Goods_ID, float.Parse(trayGoodsModel.数量), ref restr) == false)
                        {
                            this.WmsFrame.WriteLog("按计划配盘", "", "提示", restr);
                        }
                    }
                }
                ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Clear();//配盘完成后清除数据
                QueryPlan(this.currPlanCode);
                this.View.ShowMessage("信息提示", "配盘成功!");
            }
            catch (Exception ex)
            {
                this.View.ShowMessage("信息提示", "配盘失败!" + ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="houseName">库房名称</param>
        /// <param name="palletPos">配盘工位</param>
        public void QueryPallet(string palletPos, string planCode)
        {
            //this.currHouseName = houseName;
            this.currPalletPos = palletPos;
            this.currPlanCode  = planCode;
            string cellChildID = "";
            //if (houseName == "所有")
            //{

            //    cellChildID = "所有";
            //}
            //else
            //{


            //WH_WareHouseModel house = bllWareHouse.GetModelByName(houseName);
            //if (house == null)
            //{

            //    return;
            //}
            //WH_CellModel station = bllStationLogic.GetModelByHouseIDAndCellName(house.WareHouse_ID, palletPos);
            WH_CellModel station = bllCell.GetStationByName(palletPos);

            if (station == null)
            {
                this.View.ShowMessage("信息提示", "配盘工位获取失败!");
                return;
            }

            cellChildID = station.Cell_ID;



            List <View_StockListModel> stockList = bllViewStockList.GetModelList(cellChildID, planCode);

            //var p1 = stockList.Distinct(sl=>sl.Stpcl);

            ViewDataManager.PALLETMANAGEDATA.PalletList.Clear();
            if (stockList == null)
            {
                return;
            }

            List <View_StockListModel> distinctPallet = new List <View_StockListModel>();//去除重复数据

            foreach (View_StockListModel vsm in stockList)
            {
                var existPallet = distinctPallet.Where(s => s.Stock_Tray_Barcode == vsm.Stock_Tray_Barcode);
                if (existPallet == null || existPallet.Count() == 0)
                {
                    distinctPallet.Add(vsm);
                }
            }


            foreach (View_StockListModel stock in distinctPallet)
            {
                PalletListData pallet = new PalletListData();
                if (planCode != "所有")
                {
                    View_PlanListModel planList = bllViewPlanList.GetModelByPlanListID(stock.Plan_List_ID);
                    if (planList == null)
                    {
                        return;
                    }
                    if (stock.Plan_List_ID == "-1")
                    {
                        pallet.计划配盘 = "否";
                    }
                    else
                    {
                        pallet.计划配盘 = "是";

                        pallet.计划单号 = planList.Plan_Code;
                    }
                }
                else
                {
                    pallet.计划配盘 = "否";
                    pallet.计划单号 = "-1";
                }


                pallet.配盘时间   = stock.Stock_List_Entry_Time.ToString();
                pallet.托盘条码   = stock.Stock_Tray_Barcode;
                pallet.配盘工位名称 = stock.Cell_Name;
                ViewDataManager.PALLETMANAGEDATA.PalletList.Add(pallet);
            }
        }