private void SearchTrayEventHandler(object sender, SearchTrayEventArgs e)
        {
            StockDetailModel stockDetailModel = bllStockDetail.GetModelByTrayID(e.TrayCode);

            if (stockDetailModel == null)
            {
                this.View.ShowMessage("信息提示", "此条码在库存中不存在,请核对条码是否正确!");
                return;
            }
            StockListModel stockListModel = bllStockList.GetModel(stockDetailModel.StockListID);

            if (stockListModel == null)
            {
                this.View.ShowMessage("信息提示", "此条码在库存中不存在,请核对条码是否正确!");
                return;
            }
            else
            {
                string[] splitArr = new string[3] {
                    "排", "列", "层"
                };
                string[] rclArr = stockListModel.GoodsSiteName.Split(splitArr, StringSplitOptions.RemoveEmptyEntries);
                this.View.SearchTray(stockListModel.StoreHouseName, rclArr[0], rclArr[1], rclArr[2]);
                this.View.ShowMessage("信息提示", "托盘位置:" + stockListModel.StoreHouseName + "," + stockListModel.GoodsSiteName + "!");
            }
        }
Exemple #2
0
        public void Execute(ActionExecutionContext context)
        {
            StockDetailModel stockDetail = this.stockService.Get(this.symbol);

            this.detailModel.SetValue(stockDetail);

            this.Completed(this, new ResultCompletionEventArgs());
        }
Exemple #3
0
        public IStockTickerContentViewModel CreateContent(StockDetailModel detailModel)
        {
            // NOTE: When no detail model is present the news model is provided
            if (detailModel == null)
            {
                return(this.resolutionRoot.Get <INewsViewModel>());
            }

            return(this.resolutionRoot.Get <IStockDetailViewModel>(new { detailModel }));
        }
Exemple #4
0
 public StockDetailModel ConvertItemtoStok(ItemMasterModel itemMaster)
 {
     if (itemMaster != null)
     {
         StockDetailModel stockDetailModel = new StockDetailModel {
             StockDetailItemId = itemMaster.ItemMasterId, StockDetailItem = itemMaster, StockDetailQty = 1, StockDetailUnitPrice = 0, StockDetailPurchaserType = 1, StockDetailTransferType = 1
         };
         return(stockDetailModel);
     }
     return(null);
 }
        private void DeleteTrayEventHandler(object sender, TrayEventArgs e)
        {
            if (e.GsRunStatus != EnumGSRunStatus.任务完成.ToString())
            {
                this.View.ShowMessage("信息提示", "货位正在运行不允许删除料框信息!");
                return;
            }
            int ask = this.View.AskMessBox("您确定要删除条码为:" + e.TrayID + "的料框信息么?");

            //this.mainPre.ShowLog(EnumLogCategory
            if (ask == 0)
            {
                StockDetailModel deleteStockDetailModel = bllStockDetail.GetModelByTrayID(e.TrayID);
                bool             status = bllStockDetail.DeteleModelByTrayID(e.TrayID);
                if (status)
                {
                    this.View.ShowMessage("信息提示", "删除料框信息成功!");
                }
                this.mainPre.View.AddLog(EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",删除条码+" + e.TrayID
                                         + ",货位号:" + e.GoodsSiteName);

                //库存删掉后要清空库存和货位状态,只有任务完成的时候才可以删除此时只需更新库存状态和货位状态
                if (deleteStockDetailModel == null)
                {
                    this.View.ShowMessage("信息提示", "料框详细为空!!");
                    return;
                }
                StockListModel deleteStockListModel = bllStockList.GetModel(deleteStockDetailModel.StockListID);

                if (deleteStockListModel == null)
                {
                    this.View.ShowMessage("信息提示", "库存列表信息为空!!");
                    return;
                }

                StockModel deleteStockModel = bllStock.GetModel(deleteStockListModel.StockID);
                if (deleteStockModel == null)
                {
                    return;
                }
                List <StockDetailModel> stockDetailList = bllStockDetail.GetDetailModelList(deleteStockListModel.StockListID);//查询当前库存料框所有
                if (stockDetailList == null || stockDetailList.Count == 0)
                {
                    bllStock.Delete(deleteStockListModel.StockID);

                    bllGoodsSite.UpdateGoodsSiteStatus(EnumGSStoreStatus.空货位.ToString(), EnumGSRunStatus.待用.ToString(), EnumTaskCategory.出入库.ToString(), deleteStockModel.GoodsSiteID);
                    this.View.RefreshGoodsSite();
                }

                RefreshStockDetail(currentSelectGSID);
                //this.View.RefreshStorage();
            }
        }
Exemple #6
0
        private async Task <List <StockDetailModel> > GetStockDetails(string itemId, string itemType, string assetLocationId)
        {
            List <StockDetailModel> retValue = new List <StockDetailModel>();

            try
            {
                if (App.CheckInternetConnection())
                {
                    HttpClient client = new HttpClient()
                    {
                        BaseAddress = new Uri(App.baseUrl)
                    };
                    StockDetailModel model = new StockDetailModel()
                    {
                        UserId          = userId,
                        DeviceId        = deviceId,
                        ItemId          = itemId,
                        ItemType        = itemType,
                        AssetLocationId = assetLocationId
                    };

                    string jsonData = JsonConvert.SerializeObject(model);
                    var    content  = new StringContent(jsonData, Encoding.UTF8, "application/json");
                    HttpResponseMessage response = await client.PostAsync(App.getStockDetailsUri, content).ConfigureAwait(false);

                    if (response != null && response.IsSuccessStatusCode)
                    {
                        var result = await response.Content.ReadAsStringAsync();

                        retValue = JsonConvert.DeserializeObject <List <StockDetailModel> >(result);
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "No internet connection", "Exit");

                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    System.Environment.Exit(0);
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "Exit");

                System.Diagnostics.Process.GetCurrentProcess().Kill();
                System.Environment.Exit(0);
            }
            return(retValue);
        }
Exemple #7
0
        /// <summary>
        /// 添加空料筐库存
        /// </summary>
        /// <param name="houseName">库房名称</param>
        /// <param name="cellCoord">货位位置</param>
        /// <param name="reStr">执行状态描述</param>
        /// <returns>执行状态结果</returns>
        public bool AddEmptyMeterialBox(string houseName, CellCoordModel cellCoord, ref string reStr)
        {
            StoreHouseModel houseModel = bllStoreHouse.GetModelByName(houseName);

            if (houseModel == null)
            {
                reStr = "不存在此库房!";
                return(false);
            }
            GoodsSiteModel gsm = bllGoodsSite.GetModelByRCL(houseModel.StoreHouseID, cellCoord.Row, cellCoord.Col, cellCoord.Layer);

            if (gsm == null)
            {
                reStr = "不存在此库存!";
                return(false);
            }
            gsm.Reserve = cellCoord.ExtProp1;//保存货位扩展属性,目前为空托盘型号
            bllGoodsSite.Update(gsm);

            StockModel sm = new StockModel();

            sm.GoodsSiteID = gsm.GoodsSiteID;
            sm.IsFull      = true;
            sm.TrayID      = "12345678";//测试
            long stockID = bllStock.Add(sm);

            StockListModel slm = new StockListModel();

            slm.InHouseTime     = DateTime.Now;
            slm.StockID         = stockID;
            slm.MeterialBatch   = ""; //暂时没有
            slm.MeterialboxCode = "";
            slm.MeterialStatus  = ""; //暂时没有赋值,若有库存详细应在此增加
            long stockListID = bllStockList.Add(slm);

            StockDetailModel sdm = new StockDetailModel();

            sdm.StockListID  = stockListID;
            sdm.MeterialName = "空料筐";
            bllStockDetail.Add(sdm);

            // string operateStr = "库房:" + houseName + ",货位:" + cellCoord.Row + "排" + cellCoord.Col + "列"
            //+ cellCoord.Layer + "层," + "添加空料框";
            // AddGSOperRecord(houseName, cellCoord, EnumGSOperateType.系统添加空料框, operateStr, ref reStr);
            return(true);
        }
        public HttpResponseMessage GetStockDetails([FromBody] StockDetailModel model)
        {
            HttpResponseMessage retValue = null;

            using (retValue = new HttpResponseMessage(HttpStatusCode.InternalServerError))
            {
                try
                {
                    if (model != null)
                    {
                        List <Models.StockDetailModel> snapModel = GetStockDetails(model.ItemId, model.ItemType, model.AssetLocationId);
                        retValue = Request.CreateResponse(HttpStatusCode.OK, snapModel);
                    }
                }
                catch (Exception ex)
                {
                    new Logger().LogException(ex, "GetStockDetails");
                    retValue = Request.CreateResponse(HttpStatusCode.OK, ex.Message);
                }
                return(retValue);
            }
        }
Exemple #9
0
 private void ConvertSelectedItemstoStock(object obj)
 {
     if (obj != null)
     {
         try
         {
             var selectedItems = (System.Collections.IList)obj;
             if (selectedItemList != null)
             {
                 foreach (var selecteItem in selectedItems)
                 {
                     ItemMasterModel itemMaster = (ItemMasterModel)selecteItem;
                     if (itemMaster != null)
                     {
                         if (!CheckItemexitsorNot(itemMaster.ItemMasterId))
                         {
                             if (this.StockDetailList == null)
                             {
                                 this.StockDetailList = new ObservableCollection <StockDetailModel>();
                             }
                             StockDetailModel stockModel = ConvertItemtoStok(itemMaster);
                             if (stockModel != null)
                             {
                                 this.StockDetailList.Add(stockModel);
                                 OnPropertyChanged("StockDetailList");
                             }
                         }
                     }
                 }
                 this.SearchItemList.Clear();
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
Exemple #10
0
        /// <summary>
        /// 添加库存
        /// </summary>
        /// <param name="houseName">库房名称</param>
        /// <param name="cellCoord">货位位置</param>
        /// <param name="goodsInfo">库存信息</param>
        /// <param name="reStr">执行状态描述</param>
        /// <returns>执行状态结果</returns>
        public bool AddStack(string houseName, CellCoordModel cellCoord, string proBatch, string[] goodsInfo, ref string reStr)
        {
            StoreHouseModel houseModel = bllStoreHouse.GetModelByName(houseName);

            if (houseModel == null)
            {
                reStr = "不存在此库房!";
                return(false);
            }
            GoodsSiteModel gsm = bllGoodsSite.GetModelByRCL(houseModel.StoreHouseID, cellCoord.Row, cellCoord.Col, cellCoord.Layer);

            if (gsm == null)
            {
                reStr = "不存在此库存!";
                return(false);
            }
            if (goodsInfo == null)
            {
                reStr = "传入空货位信息!";
                return(false);
            }
            StockModel sm = new StockModel();

            sm.GoodsSiteID = gsm.GoodsSiteID;
            sm.IsFull      = true;
            sm.TrayID      = "12345678";//测试
            long stockID = bllStock.Add(sm);

            for (int i = 0; i < goodsInfo.Length; i++)
            {
                StockListModel slm = new StockListModel();
                slm.StockID         = stockID;
                slm.InHouseTime     = DateTime.Now;
                slm.MeterialBatch   = proBatch; //暂时没有
                slm.MeterialboxCode = goodsInfo[i];
                slm.MeterialStatus  = "";       //暂时没有赋值,若有库存详细应在此增加
                long stockListID = bllStockList.Add(slm);

                StockDetailModel sdm = new StockDetailModel();
                sdm.StockListID  = stockListID;
                sdm.MeterialName = "电芯";
                bllStockDetail.Add(sdm);
            }
            string goodsInforStr = "";

            for (int i = 0; i < goodsInfo.Length; i++)
            {
                if (i == 0)
                {
                    goodsInforStr += goodsInfo[i];
                }
                else
                {
                    goodsInforStr += "," + goodsInfo[i];
                }
            }
            //string operateStr = "库房:" + houseName + ",货位:" + cellCoord.Row + "排" + cellCoord.Col + "列"
            //  + cellCoord.Layer + "层," + "添加库存:" + goodsInforStr;
            //AddGSOperRecord(houseName, cellCoord, EnumGSOperateType.系统添加库存, operateStr, ref reStr);
            return(true);
        }
 public StockDetailViewModel(StockDetailModel detailModel)
 {
     this.Model = detailModel;
 }
Exemple #12
0
        public static List <StockDetailModel> GetStockDetailModel(List <string> datas)
        {
            int count = 26;
            List <StockDetailModel> result = new List <StockDetailModel>();

            try
            {
                datas.ForEach(data =>
                {
                    try
                    {
                        var arrs = data.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                        if (arrs.Count() == count)
                        {
                            StockDetailModel model = new StockDetailModel();
                            model.Code             = arrs[1];
                            model.Name             = arrs[2];
                            //try
                            //{
                            model.Price = double.Parse(arrs[3]);
                            //}
                            //catch
                            //{

                            //}
                            //try
                            //{
                            model.ChangedPrice = double.Parse(arrs[4]);
                            //}
                            //catch
                            //{

                            //}
                            //try
                            //{
                            model.ChangedPercent = double.Parse(arrs[5]);
                            //}
                            //catch
                            //{

                            //}
                            //try
                            //{
                            model.TodayTotalHand = double.Parse(arrs[6]);
                            //}
                            //catch
                            //{

                            //}
                            //try
                            //{
                            model.TodayAmount = double.Parse(arrs[7]);
                            //}
                            //catch
                            //{

                            //}
                            //try
                            //{
                            model.YesterdayEndPrice = double.Parse(arrs[12]);
                            //}
                            //catch
                            //{

                            //}
                            //try
                            //{
                            model.TotalValue = double.Parse(arrs[18]);
                            //}
                            //catch
                            //{

                            //}

                            //try
                            //{
                            model.FlowlValue = double.Parse(arrs[19]);
                            //}
                            //catch
                            //{

                            //}
                            result.Add(model);
                        }
                    }
                    catch
                    {
                        return;
                    }
                });
            }
            catch
            {
            }
            return(result);
        }
        private void AddTrayEventHandler(object sender, TrayEventArgs e)
        {
            if (e.GsRunStatus != EnumGSRunStatus.任务完成.ToString())
            {
                this.View.ShowMessage("信息提示", "货位正在运行不允许添加料框信息!");
                return;
            }
            if (this.currentSelectGSID != 999999)
            {
                View_QueryStockListModel viewStockListModel = bllView_QueryStockList.GetModelByGSID(currentSelectGSID);
                if (viewStockListModel != null)
                {
                    TB_Tray_indexModel trayModel = bllTrayIndex.GetModel(e.TrayID);
                    if (trayModel == null)
                    {
                        this.View.ShowMessage("信息提示", "条码在数据库不存在!");
                        return;
                    }
                    if (currStockListModel != null)
                    {
                        List <StockDetailModel> stockDetailList = bllStockDetail.GetDetailModelList(currStockListModel.StockListID);
                        if (stockDetailList != null)
                        {
                            if (viewStockListModel.StoreHouseName == EnumStoreHouse.A1库房.ToString())
                            {
                                if (stockDetailList.Count >= 2)
                                {
                                    this.View.ShowMessage("信息提示", "A库房每个货位只能存储2个料框!");
                                    return;
                                }
                            }
                            else if (viewStockListModel.StoreHouseName == EnumStoreHouse.B1库房.ToString())
                            {
                                if (stockDetailList.Count >= 6)
                                {
                                    this.View.ShowMessage("信息提示", "B库房每个货位只能存储6个料框!");
                                    return;
                                }
                            }

                            bool isTheSame = true;
                            for (int i = 0; i < stockDetailList.Count; i++)
                            {
                                TB_Tray_indexModel existTrayModel = bllTrayIndex.GetModel(stockDetailList[i].TrayID);
                                if (existTrayModel.Tf_BatchID != trayModel.Tf_BatchID)
                                {
                                    isTheSame = false;
                                    this.View.ShowMessage("信息提示", "您添加的托盘号所属批次号与现有库存的托盘批次不一致!若您要添加请将现有库存的托盘删除!");
                                    break;
                                }
                            }
                            if (isTheSame == false)
                            {
                                return;
                            }
                        }
                    }

                    StockDetailModel stockDetailModel = new StockDetailModel();
                    stockDetailModel.TrayID      = e.TrayID;
                    stockDetailModel.StockListID = viewStockListModel.StockListID;
                    bllStockDetail.Add(stockDetailModel);

                    currStockListModel.ProductBatchNum = trayModel.Tf_BatchID;
                    bllStockList.Update(currStockListModel);//更新库存列表

                    RefreshStockDetail(currentSelectGSID);
                    this.mainPre.View.AddLog(EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",添加条码+" + trayModel.Tf_TrayId
                                             + ",货位号:" + viewStockListModel.GoodsSiteName);
                }
                else
                {
                    this.View.ShowMessage("信息提示", "此货位没有库存信息!");
                }
            }
            else
            {
                this.View.ShowMessage("信息提示", "请选择要添加料框的货位!");
            }
        }