Beispiel #1
0
        public void AddPlan(string planCode, string planTypeName, string planPerson, DateTime planDate, string remark)
        {
            try
            {
                Plan_TypeModel planType = bllPlanType.GetModelByName(planTypeName);
                if (planType == null)
                {
                    this.View.ShowMessage("信息提示", "计划类型错误!");
                    return;
                }
                if (ViewDataManager.PLANINPUTDATA.PlanListData.Count() == 0)
                {
                    this.View.ShowMessage("信息提示", "请为计划添加物料信息!");
                    return;
                }
                PlanMainModel checkPlan = bllPlan.GetModelByPlanCode(planCode);
                if (checkPlan != null)
                {
                    this.View.ShowMessage("信息提示", "计划编号已存在:[" + planCode + "]");
                    return;
                }

                PlanMainModel plan = new PlanMainModel();

                plan.Plan_Code        = planCode;
                plan.Plan_ID          = Guid.NewGuid().ToString();
                plan.Plan_Type_ID     = planType.Plan_Type_ID;
                plan.Plan_Create_Time = planDate;
                plan.Plan_Status      = EnumPlanStatus.待执行.ToString();
                plan.Plan_Operater    = planPerson;
                plan.Plan_Remark      = remark;

                bllPlan.Add(plan);
                foreach (PlanListModel goods in ViewDataManager.PLANINPUTDATA.PlanListData)
                {
                    Plan_ListModel planList   = new Plan_ListModel();
                    GoodsModel     goodsModel = bllGoods.GetModelByCode(goods.物料编码);
                    if (goods == null)
                    {
                        this.WmsFrame.WriteLog("PlanInputPresenter", "", "错误", "物料编码错误!");
                        return;
                    }
                    planList.Goods_ID = goodsModel.Goods_ID;
                    planList.Plan_ID  = plan.Plan_ID;
                    planList.Plan_List_Finished_Quantity = "0";
                    planList.Plan_List_ID = Guid.NewGuid().ToString();
                    planList.Plan_List_Ordered_Quantity = "0";
                    planList.Plan_List_Quantity         = goods.计划数量;
                    bllPlanList.Add(planList);
                }
                this.View.ShowMessage("信息提示", "计划添加成功!");
                ViewDataManager.PLANINPUTDATA.PlanListData.Clear();//添加计划口清空计划列表
            }
            catch (Exception ex)
            {
                this.View.ShowMessage("信息提示", "计划添加失败!" + ex.Message);
            }
        }
Beispiel #2
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);
            }
        }
Beispiel #3
0
        //private void PutwayEventHandler(object sender,PutwayEventArgs e)
        //{
        //  View_Plan_StockListModel planStock =  bllViewPlanStockList.GetModelByPalletCode(e.PalletCode);

        //}
        public bool AddExternPlan(string planCode, string planTypeName, string planPerson, DateTime planDate, string warehouseCode, List <PlanListModel> planDetailList, string planTypeReserve, ref string restr)
        {
            try
            {
                Plan_TypeModel planType = bllPlanType.GetModelByName(planTypeName);
                if (planType == null)
                {
                    restr = "计划类型错误!";
                    return(false);
                }
                if (planDetailList == null || planDetailList.Count == 0)
                {
                    restr = "请为计划添加物料信息!";
                    return(false);
                }
                PlanMainModel checkPlan = bllPlan.GetModelByPlanCode(planCode);
                if (checkPlan != null)
                {
                    restr = "计划编号已存在:[" + planCode + "]";
                    return(false);
                }
                if (planDetailList == null)
                {
                    return(false);
                }
                foreach (PlanListModel goods in planDetailList)
                {
                    Plan_ListModel planList   = new Plan_ListModel();
                    GoodsModel     goodsModel = bllGoods.GetModelByCode(goods.物料编码);
                    if (goodsModel == null)
                    {
                        restr = "物料编码错误!";
                        return(false);
                    }
                }
                PlanMainModel plan = new PlanMainModel();

                plan.Plan_Code        = planCode;
                plan.Plan_ID          = Guid.NewGuid().ToString();
                plan.Plan_Type_ID     = planType.Plan_Type_ID;
                plan.Plan_Create_Time = planDate;
                plan.Plan_Status      = EnumPlanStatus.待执行.ToString();
                plan.Plan_Operater    = planPerson;
                plan.Plan_Remark      = warehouseCode;
                bllPlan.Add(plan);

                foreach (PlanListModel goods in planDetailList)
                {
                    Plan_ListModel planList   = new Plan_ListModel();
                    GoodsModel     goodsModel = bllGoods.GetModelByCode(goods.物料编码);
                    if (goodsModel == null)
                    {
                        restr = "物料编码错误!";
                        return(false);
                    }
                    planList.Goods_ID = goodsModel.Goods_ID;
                    planList.Plan_ID  = plan.Plan_ID;
                    planList.Plan_List_Finished_Quantity = "0";
                    planList.Plan_List_ID = Guid.NewGuid().ToString();
                    planList.Plan_List_Ordered_Quantity = "0";
                    planList.Plan_List_Quantity         = goods.计划数量;
                    planList.Plan_List_Remark           = goods.物料批次;
                    planList.Plan_List_Resever1         = planTypeReserve;//订单类型描述
                    bllPlanList.Add(planList);
                }

                return(true);
            }
            catch (Exception ex)
            {
                restr = "计划添加失败" + ex.StackTrace.ToString();
                return(false);
            }
        }
        public void TrayConfirm(bool isFull, string palletCode, string recCellName)
        {
            try
            {
                if (ViewDataManager.PALLETMANAGEDATA.PalletInforData.Count == 0)
                {
                    this.View.ShowMessage("信息提示", "请添加配盘物料!");
                    return;
                }
                //WH_WareHouseModel house = bllWareHouse.GetModelByName(houseName);
                //if (house == null)
                //{

                //    return ;
                //}
                WH_CellModel cell = bllCell.GetStationByName(recCellName);

                //WH_Station_LogicModel cell = bllStationLogic.GetStationByName(house.WareHouse_ID,recCellName);
                if (cell == null)
                {
                    this.View.ShowMessage("信息提示", "配盘地点错误!");
                    return;
                }
                StockModel stockModel = bllStock.GetModelByTrayCode(palletCode);
                if (stockModel == null)
                {
                    this.View.ShowMessage("信息提示", "此托盘条码不在库存中!");
                    return;
                }
                stockModel.Cell_Child_ID      = cell.Cell_ID;
                stockModel.Stock_Tray_Barcode = palletCode;
                if (isFull == true)
                {
                    stockModel.Stock_Full_Flag = "1";
                }
                else
                {
                    stockModel.Stock_Full_Flag = "0";
                }

                bllStock.Update(stockModel);
                Stock_ListModel stockListTemp = bllStockList.GetModelByPalletCode(palletCode);
                if (stockListTemp == null)
                {
                    this.View.ShowMessage("信息提示", "此托盘中没有物料!");
                    return;
                }
                bllStockList.DeleteByStockID(stockModel.Stock_ID);
                for (int i = 0; i < ViewDataManager.PALLETMANAGEDATA.PalletInforData.Count; i++)
                {
                    Stock_ListModel stockList = new Stock_ListModel();
                    stockList.Stock_List_ID = Guid.NewGuid().ToString();
                    stockList.Stock_ID      = stockModel.Stock_ID;
                    PalletGoodsListModel trayGoodsModel = ViewDataManager.PALLETMANAGEDATA.PalletInforData[i];
                    GoodsModel           goods          = bllGoods.GetModelByCode(trayGoodsModel.物料编码);
                    if (goods == null)
                    {
                        continue;
                    }
                    stockList.Goods_ID               = goods.Goods_ID;
                    stockList.Plan_List_ID           = stockListTemp.Plan_List_ID;
                    stockList.Stock_List_Box_Barcode = palletCode;
                    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);
                }
                this.View.ShowMessage("信息提示", "配盘成功!");
                QueryPallet(currPalletPos, currPlanCode);
            }
            catch (Exception ex)
            {
                this.View.ShowMessage("信息提示", "配盘失败!" + ex.Message);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 基础物料数据信息
        /// </summary>
        /// <param name="materialInfoJson">物料信息json串</param>
        /// <param name="operateType">操作类型:1增加、2更新、3删除</param>
        /// <returns></returns>
        public string MaterialInfo(string materialInfoJson, string operateType)
        {
            //materialInfoJson = GetMaterialTestJson();//测试

            ResponseData response = new ResponseData();

            try
            {
                MaterialInfo materialInfo = Newtonsoft.Json.JsonConvert.DeserializeObject <MaterialInfo>(materialInfoJson);
                if (materialInfo == null)
                {
                    response.Describe = "物料基础数据格式错误!";
                    response.Status   = false;
                    MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson);
                    return(response.ToJson());
                }
                if (materialInfo.material_class == "" || materialInfo.material_class == null)
                {
                    response.Describe = "物料基础数据的物料大类为空!";
                    response.Status   = false;
                    MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson);
                    return(response.ToJson());
                }
                Goods_ClassModel gsClassModel = bllGoods_Class.GetModelByClassName(materialInfo.material_class);//物料大类型

                if (gsClassModel == null)
                {
                    gsClassModel = new Goods_ClassModel();
                    gsClassModel.Goods_Class_Name = materialInfo.material_class;
                    string gsClassMainID = Guid.NewGuid().ToString();
                    gsClassModel.Goods_Class_ID   = gsClassMainID;
                    gsClassModel.Goods_Class_Flag = "true";
                    bllGoods_Class.Add(gsClassModel);
                }
                else
                {
                    gsClassModel.Goods_Class_Name = materialInfo.material_class;
                    gsClassModel.Goods_Class_Flag = "true";
                    bllGoods_Class.Update(gsClassModel);
                }
                if (operateType != "1" && operateType != "2" && operateType != "3")
                {
                    response.Describe = "接口操作标识错误!operateType,1为增加,2为更新,3为删除!";
                    response.Status   = false;
                    MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson);
                    return(response.ToJson());
                }
                switch (operateType)
                {
                case "1":    //增加
                {
                    GoodsModel existgoods = bllGoods.GetModelByCode(materialInfo.material_code);
                    if (existgoods != null)
                    {
                        response.Describe = "物料基础数据添加失败,已经存在此物料编码:" + materialInfo.material_code;
                        response.Status   = false;
                        MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson);
                        return(response.ToJson());
                    }
                    GoodsModel goods = new GoodsModel();
                    goods.Goods_ID           = Guid.NewGuid().ToString();
                    goods.Goods_Code         = materialInfo.material_code;
                    goods.Goods_Class_ID     = gsClassModel.Goods_Class_ID;
                    goods.Goods_Suppier_Code = materialInfo.material_supplier_code;
                    goods.Goods_Category     = materialInfo.material_category;

                    goods.Goods_Name = materialInfo.material_name;
                    if (materialInfo.material_enabled == true)
                    {
                        goods.Goods_Flag = "1";
                    }
                    else
                    {
                        goods.Goods_Flag = "0";
                    }

                    goods.Goods_Type  = materialInfo.material_category;
                    goods.Goods_Unit  = materialInfo.material_unit;
                    goods.Goods_Model = materialInfo.material_model;
                    bllGoods.Add(goods);
                    GoodsPropertyOperate(goods.Goods_ID, "shelflife", "保质期", materialInfo.material_shelflife.ToString(), true);        //保质期

                    break;
                }

                case "2":    //更新
                {
                    GoodsModel goods = bllGoods.GetModelByCode(materialInfo.material_code);
                    if (goods == null)
                    {
                        response.Describe = "物料基础数据更新失败,不存此物料编码:" + materialInfo.material_code;
                        response.Status   = false;
                        MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson);
                        return(response.ToJson());
                    }
                    goods.Goods_Code         = materialInfo.material_code;
                    goods.Goods_Class_ID     = gsClassModel.Goods_Class_ID;
                    goods.Goods_Suppier_Code = materialInfo.material_supplier_code;
                    goods.Goods_Name         = materialInfo.material_name;
                    if (materialInfo.material_enabled == true)
                    {
                        goods.Goods_Flag = "1";
                    }
                    else
                    {
                        goods.Goods_Flag = "0";
                    }

                    goods.Goods_Type  = materialInfo.material_category;
                    goods.Goods_Unit  = materialInfo.material_unit;
                    goods.Goods_Model = materialInfo.material_model;
                    bllGoods.Update(goods);
                    GoodsPropertyOperate(goods.Goods_ID, "shelflife", "保质期", materialInfo.material_shelflife.ToString(), false);        //保质期
                    break;
                }

                case "3":
                {
                    bllGoods.DeleteByCode(materialInfo.material_code);
                    bllGoodsProperty.DeleteByGoodsCode(materialInfo.material_code);
                    break;
                }

                default:
                {
                    response.Status   = false;
                    response.Describe = "操作类型错误,operateType,1为增加,2为更新,3为删除!";
                    return(response.ToJson());
                }
                }

                response.Describe = "物料基础数据导入成功!";
                response.Status   = true;
                MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson);
                return(response.ToJson());
            }
            catch (Exception ex)
            {
                response.Describe = "物料基础数据导入失败!错误原因:" + ex.StackTrace.ToString();
                response.Status   = false;
                MainFrameHandler.GetMainFrame().WriteLog("WMS_To_ERP服务", "", "提示", response.Describe + "信息内容:" + materialInfoJson);
                return(response.ToJson());
            }
        }
Beispiel #6
0
        public void TrayConfirm(string cellID)
        {
            try
            {
                string restr = "";
                //if (ViewDataManager.STOCKADJUSTVIEWDATA.PalletGoodsData.Count == 0)
                //{
                //    this.View.ShowMessage("信息提示", "请添加配盘物料!");
                //    return;
                //}

                List <View_Plan_StockListModel> oldStockList = bllViewPlanStockList.GetModelListByCellID(cellID);

                View_CellModel cell = bllViewCell.GetModelByChildCellID(cellID);
                if (cell == null)
                {
                    this.View.ShowMessage("信息提示", "库存货位错误!");
                    return;
                }
                if (cell.Cell_Child_Flag != "1")
                {
                    this.View.ShowMessage("信息提示", "被禁用的货位不允许调整库存!");
                    // this.WmsFrame.WriteLog("库存调整", "", "提示", "被禁用的货位不允许调整库存!");
                    return;
                }
                if (cell.Cell_Child_Status == EnumGSTaskStatus.锁定.ToString())
                {
                    this.View.ShowMessage("信息提示", "被锁定的货位不允许调整库存!请等待任务执行完成再调整!");
                    return;
                }
                if (ViewDataManager.STOCKADJUSTVIEWDATA.PalletInforData.Count == 0)//清空库存
                {
                    if (this.View.AskMessage("信息提示", "您确定要清空此货位库存么?") != 0)
                    {
                        return;
                    }
                    string operteDetail = cell.WareHouse_Name + ":[" + cell.Cell_Name + "]库存手动清空!";
                    TaskHandleMethod.AddCellOperRecord(cellID, EnumGSOperateType.手动修改状态, operteDetail, ref restr);
                    TaskHandleMethod.DeleteStockByCellChildID(cellID);
                    if (AddRecord(cellID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, ref restr) == false)
                    {
                        this.View.ShowMessage("信息提示", "库存状态、操作记录更新失败!");
                        return;
                    }
                    return;
                }
                List <string> distinctTray = new List <string>();
                foreach (PalletGoodsList tray in ViewDataManager.STOCKADJUSTVIEWDATA.PalletInforData)
                {
                    if (distinctTray.Contains(tray.托盘条码) == false)
                    {
                        distinctTray.Add(tray.托盘条码);
                    }
                }
                if (distinctTray.Count > 1)
                {
                    this.View.ShowMessage("信息提示", "一个货位只允许有一个托盘!");
                    return;
                }
                foreach (string tray in distinctTray)
                {
                    List <StockModel> stockListModel = bllStock.GetModelListByTrayCode(tray);
                    foreach (StockModel stockModel in stockListModel)
                    {
                        if (stockModel != null && stockModel.Cell_Child_ID != cellID)
                        {
                            this.View.ShowMessage("信息提示", "托盘条码" + tray + "已经在库存中,请确认托盘条码!");
                            ViewDataManager.STOCKADJUSTVIEWDATA.PalletInforData.Clear();
                            return;
                        }
                    }
                }
                TaskHandleMethod.DeleteStockByCellChildID(cellID);//先清空库存在往里添加
                foreach (string tray in distinctTray)
                {
                    StockModel stock = new StockModel();
                    stock.Stock_ID           = Guid.NewGuid().ToString();
                    stock.Cell_Child_ID      = cell.Cell_Chlid_ID;
                    stock.Stock_Tray_Barcode = tray;
                    bllStock.Add(stock);

                    for (int i = 0; i < ViewDataManager.STOCKADJUSTVIEWDATA.PalletInforData.Count; i++)
                    {
                        PalletGoodsList trayGoodsModel = ViewDataManager.STOCKADJUSTVIEWDATA.PalletInforData[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;
                        if (oldStockList != null && oldStockList.Count > 0)//计划编号从原来库存里获取
                        {
                            stockList.Plan_List_ID = oldStockList[0].Plan_List_ID;
                            if (oldStockList[0].Plan_List_ID != "-1")
                            {
                                if (UpdatePlanNum(oldStockList[0].Plan_List_ID, goods.Goods_ID, trayGoodsModel.数量.ToString(), ref restr) == false)
                                {
                                    this.WmsFrame.WriteLog("按计划配盘", "", "提示", restr);
                                }
                            }
                        }
                        else//如果没有库存默认为无计划
                        {
                            stockList.Plan_List_ID = "-1";
                        }

                        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 (AddRecord(cellID, EnumCellStatus.满位, EnumGSTaskStatus.完成, ref restr) == false)
                {
                    this.View.ShowMessage("信息提示", "库存状态、操作记录更新失败!");
                    return;
                }
                string operteStockDetail = cell.WareHouse_Name + ":[" + cell.Cell_Name + "]库存手动调整成功!!";

                TaskHandleMethod.AddCellOperRecord(cellID, EnumGSOperateType.手动修改状态, operteStockDetail, ref restr);

                ViewDataManager.STOCKADJUSTVIEWDATA.PalletInforData.Clear();//配盘完成后清除数据
                this.View.ShowMessage("信息提示", "库存调整成功!");
            }
            catch (Exception ex)
            {
                this.View.ShowMessage("信息提示", "库存调整失败!" + ex.Message);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 收料通知
        /// </summary>
        /// <param name="plan">计划</param>
        /// <param name="planList">计划详细</param>
        /// <returns></returns>

        public ResponseData ReceiveGoodsPlan(Plan plan, List <PlanList> planList)
        {
            ResponseData response = new ResponseData();

            try
            {
                if (plan == null)
                {
                    response.Status   = false;
                    response.Describe = "计划单据对象为空!";
                    return(response);
                }
                if (planList == null)
                {
                    response.Status   = false;
                    response.Describe = "计划单据详单为空!";
                    return(response);
                }

                PlanMainModel planMainModel = bllPlan.GetModelByPlanCode(plan.PlanCode);
                if (planMainModel != null)
                {
                    bllPlan.DeleteByPlanCode(planMainModel.Plan_Code);
                }
                planMainModel         = new PlanMainModel();
                planMainModel.Plan_ID = Guid.NewGuid().ToString();

                planMainModel.Plan_Create_Time = DateTime.Now;
                planMainModel.Plan_Remark      = plan.Payee;
                planMainModel.Plan_Code        = plan.PlanCode;

                Plan_TypeModel planTypeModel = bllPlanType.GetModelByCode(plan.PlanType);

                if (planTypeModel == null)
                {
                    response.Status   = false;
                    response.Describe = "不存在[" + plan.PlanCode + "]类型计划!";
                    return(response);
                }

                planMainModel.Plan_Type_ID = planTypeModel.Plan_Type_ID;
                DateTime recDate       = DateTime.Now;
                bool     recDataStatus = DateTime.TryParse(plan.RecvDateTime, out recDate);
                if (recDataStatus == true)
                {
                    planMainModel.Plan_Bill_Time = recDate;
                }
                else
                {
                    response.Status   = false;
                    response.Describe = "收料时间格式错误!" + plan.RecvDateTime;
                    return(response);
                }

                planMainModel.Plan_From_User = plan.Settlement;
                planMainModel.Plan_Reserve1  = plan.SettlementGroup;
                planMainModel.Plan_From_Dept = plan.Supplyer;
                planMainModel.Plan_Status    = EnumPlanStatus.待执行.ToString();
                bllPlan.UpdatePlan(planMainModel);

                foreach (PlanList pl in planList)
                {
                    Plan_ListModel planListModel = new Plan_ListModel();
                    planListModel.Plan_ID      = planMainModel.Plan_ID;
                    planListModel.Plan_List_ID = Guid.NewGuid().ToString();
                    planListModel.Plan_List_Ordered_Quantity  = "0";
                    planListModel.Plan_List_Quantity          = pl.RecvNum;
                    planListModel.Plan_List_Finished_Quantity = "0";
                    planListModel.Plan_List_Remark            = pl.NeedCheck.ToString();

                    GoodsModel goods = bllGoods.GetModelByCode(pl.GoodsCode);
                    if (goods == null)
                    {
                        response.Status   = false;
                        response.Describe = "不存在[" + pl.GoodsCode + "]物料!";
                        return(response);
                    }

                    planListModel.Goods_ID           = goods.Goods_ID;
                    planListModel.Plan_List_Resever1 = pl.NeedGroup + "," + pl.RecvUnit + "," + pl.StockUnit;
                    planListModel.Plan_List_Resever2 = pl.Sum + "," + pl.UnitPrice + "," + pl.ValuationUnit;

                    bllPlanList.Add(planListModel);
                }


                response.Status   = true;
                response.Describe = "收料成功!";
                return(response);
            }
            catch (Exception ex)
            {
                response.Status   = false;
                response.Describe = "收料失败:" + ex.Message;
                return(response);
            }
        }