Esempio n. 1
0
        private bool CheckMaterialNum(ref string restr)
        {
            Dictionary <string, float> materialNum = new Dictionary <string, float>();

            for (int i = 0; i < ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Count; i++)
            {
                TrayGoodsListModel trayGoodsModel = ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData[i];
                if (materialNum.Keys.Contains(trayGoodsModel.物料编码) == false)
                {
                    materialNum[trayGoodsModel.物料编码] = float.Parse(trayGoodsModel.数量);
                    continue;
                }
                materialNum[trayGoodsModel.物料编码] += float.Parse(trayGoodsModel.数量);
            }
            foreach (KeyValuePair <string, float> keyValue in materialNum)
            {
                int planNum = GetPlanMateriNum(keyValue.Key);
                if (keyValue.Value > planNum)
                {
                    restr = "物料:" + keyValue.Key + "超出计划剩余的数量(计划数量-下达数量)";
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 2
0
 public void DeleteTrayGoods(string pallet, string goodsCode)
 {
     for (int i = 0; i < ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Count; i++)
     {
         TrayGoodsListModel tglm = ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData[i];
         if (tglm.物料编码 == goodsCode && pallet == tglm.托盘条码)
         {
             ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Remove(tglm);
             break;
         }
     }
 }
Esempio n. 3
0
        public void AddTrayGoods(string planListID, string trayCode, float goodsNum, string goodsCode, string planCode)
        {
            if (trayCode.Trim() == "")
            {
                this.View.ShowMessage("信息提示", "请输入托盘条码!");
                return;
            }
            if (goodsNum == 0)
            {
                this.View.ShowMessage("信息提示", "请输入物料配盘数量!");
                return;
            }
            if (IsExistPalletGoods(trayCode, goodsCode) == true)
            {
                this.View.ShowMessage("信息提示", "此物料已经在配盘中!");
                return;
            }
            View_GoodsModel goodsModel = bllViewGoods.GetModelByGoodsCode(goodsCode);

            if (goodsModel == null)
            {
                return;
            }
            TrayGoodsListModel tglm = new TrayGoodsListModel();

            tglm.计划单号   = planCode;
            tglm.计划列表编号 = planListID;
            tglm.托盘条码   = trayCode;
            tglm.单位     = goodsModel.Goods_Unit;
            tglm.规格型号   = goodsModel.Goods_Model;
            //tglm.生产日期 = createDatetime;
            tglm.数量   = goodsNum.ToString();
            tglm.物料编码 = goodsCode;

            ViewDataManager.PALLETWITHPLANDATA.TrayGoodsListData.Add(tglm);
        }
Esempio n. 4
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);
            }
        }