Example #1
0
        /// <summary>
        /// 数据加载
        /// </summary>
        private void onInitData(object sender, ElapsedEventArgs e)
        {
            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                AllotShelfList.Clear();

                LoadingDataEvent(this, true);
                BaseData <AllotShelf> baseDataAllotShelf = AllotShelfBll.GetInstance().GetAllotShelfTask();
                LoadingDataEvent(this, false);

                HttpHelper.GetInstance().ResultCheck(baseDataAllotShelf, out bool isSuccess);
                if (!isSuccess)
                {
                    //MessageBox.Show("此拣货工单中失败!", "温馨提示", MessageBoxButton.OK);
                    return;
                }

                List <AllotShelf> tasks = baseDataAllotShelf.body.objects;
                tasks.ForEach(task =>
                {
                    DateTime dt = Convert.ToDateTime(task.created_at);
                    task.created_at = dt.ToString("yyyy年MM月dd日");
                    AllotShelfList.Add(task);
                });

                tbInputNumbers.Focus();
            }));
        }
        /// <summary>
        /// 数据加载
        /// </summary>
        private void onInitData(object sender, ElapsedEventArgs e)
        {
            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                HashSet <CommodityEps> before = ApplicationState.GetGoodsInfo();

                List <CommodityCode> commodityCodeList = CommodityCodeBll.GetInstance().GetCompareSimpleCommodity(before, after);
                if (commodityCodeList == null || commodityCodeList.Count <= 0)
                {
                    MessageBox.Show("没有检测到商品变化!", "温馨提示", MessageBoxButton.OK);
                    isSuccess = false;
                    return;
                }

                LoadingDataEvent(this, true);
                bdCommodityCode = CommodityCodeBll.GetInstance().GetCommodityCode(commodityCodeList);
                LoadingDataEvent(this, false);

                HttpHelper.GetInstance().ResultCheck(bdCommodityCode, out isSuccess);
                if (!isSuccess)
                {
                    MessageBox.Show("获取商品信息错误!" + bdCommodityCode.message, "温馨提示", MessageBoxButton.OK);
                    return;
                }

                bdCommodityDetail = AllotShelfBll.GetInstance().GetShelfTaskCommodityDetail(allotShelf);
                HttpHelper.GetInstance().ResultCheck(bdCommodityDetail, out isSuccess);
                if (!isSuccess)
                {
                    MessageBox.Show("获取拣货任务单商品明细信息错误!" + bdCommodityDetail.message, "温馨提示", MessageBoxButton.OK);
                    return;
                }

                LoadingDataEvent(this, true);
                AllotShelfBll.GetInstance().HandleAllotShelfChangeWithOrder(bdCommodityCode, allotShelf, bdCommodityDetail);
                LoadingDataEvent(this, false);

                int inCnt = bdCommodityCode.body.objects.Where(item => item.operate_type == 1).ToList().Count;
                int abnormalOutCnt = bdCommodityCode.body.objects.Where(item => item.operate_type == 0).ToList().Count;
                int abnormalInCnt = bdCommodityCode.body.objects.Where(item => item.operate_type == 1 && item.AbnormalDisplay == "异常").ToList().Count;

                inNum.Content = inCnt;
                abnormalInNum.Content = abnormalInCnt;
                abnormalOutNum.Content = abnormalOutCnt;
                listView.DataContext = bdCommodityCode.body.objects;

                //没有异常商品才能进入提交页面
                if (abnormalInCnt == 0 && abnormalOutCnt == 0)
                {
                    normalBtmView.Visibility = Visibility.Visible;
                    abnormalBtmView.Visibility = Visibility.Collapsed;
                }
                else
                {
                    normalBtmView.Visibility = Visibility.Collapsed;
                    abnormalBtmView.Visibility = Visibility.Visible;
                }
            }));
        }
Example #3
0
        /// <summary>
        /// 数据加载
        /// </summary>
        private void onInitData(object sender, ElapsedEventArgs e)
        {
            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                LoadingDataEvent(this, true);
                BaseData <AllotShelfCommodity> bdAllotShelf = AllotShelfBll.GetInstance().GetShelfTaskCommodityDetail(allotShelf);
                LoadingDataEvent(this, false);

                HttpHelper.GetInstance().ResultCheck(bdAllotShelf, out bool isSuccess);
                if (!isSuccess)
                {
                    MessageBox.Show("获取拣货单商品明细错误!", "温馨提示", MessageBoxButton.OK);
                    return;
                }

                listView.DataContext = bdAllotShelf.body.objects;
            }));
        }
        /// <summary>
        /// 结束操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onEndOperation(object sender, RoutedEventArgs e)
        {
            if (isSuccess)
            {
                //获取没有上架商品的信息

                List <string> codeIds = bdCommodityCode.body.objects.Select(item => item.id).ToList();

                List <AllotShelfCommodity> list = bdCommodityDetail.body.objects.Where(item => item.Status == "未上架" || !codeIds.Contains(item.CommodityCodeId)).ToList();

                //还有未上架的商品,让用户选择原因
                if (list.Count > 0)
                {
                    normalView.Visibility   = Visibility.Hidden;
                    abnormalView.Visibility = Visibility.Visible;
                }
                else
                {
                    BaseData <AllotShelfCommodity> bdAllotShelfCommodity = AllotShelfBll.GetInstance().GetShelfTaskAllCommodityDetail(allotShelf);

                    HttpHelper.GetInstance().ResultCheck(bdCommodityDetail, out bool isSuccess1);
                    if (!isSuccess1)
                    {
                        MessageBox.Show("获取拣货任务单商品明细信息错误!" + bdCommodityDetail.message, "温馨提示", MessageBoxButton.OK);
                        allotShelf.Status = AllotShelfStatusEnum.异常.ToString();
                    }
                    else
                    {
                        int cnt = bdAllotShelfCommodity.body.objects.Where(item => item.Status == "未上架" && item.EquipmentId != ApplicationState.GetEquipId()).Count();
                        if (cnt > 0)
                        {
                            allotShelf.Status = AllotShelfStatusEnum.进行中.ToString();
                        }
                        else
                        {
                            allotShelf.Status = AllotShelfStatusEnum.已完成.ToString();
                        }
                    }
                }
            }
            bExit = (((Button)sender).Name == "YesAndExitBtn" ? true : false);
            EndOperation(bExit);
        }
        /// <summary>
        /// 结束操作,包括主动提交和长时间未操作界面被动提交
        /// </summary>
        /// <param name="bExit">退出登陆还是回到首页</param>
        /// <param name="bAutoSubmit">是否是主动提交</param>
        private void EndOperation(bool bExit, bool bAutoSubmit = true)
        {
            if (isSuccess)
            {
                LoadingDataEvent(this, true);
                BasePostData <CommodityInventoryChange> basePostData = AllotShelfBll.GetInstance().SubmitAllotShelfChangeWithOrder(bdCommodityCode, allotShelf, bdCommodityDetail);
                LoadingDataEvent(this, false);

                HttpHelper.GetInstance().ResultCheck(basePostData, out bool isSuccess1);

                if (!isSuccess1)
                {
                    if (bAutoSubmit)
                    {
                        MessageBox.Show("创建调拨上架任务单库存明细失败!" + basePostData.message, "温馨提示", MessageBoxButton.OK);
                    }
                }
                else
                {
                    allotShelf.AbnormalCauses = abnormalOptions.GetAbnormal().ToString();

                    LoadingDataEvent(this, true);
                    BasePutData <AllotShelf> putData = AllotShelfBll.GetInstance().PutAllotShelf(allotShelf);
                    LoadingDataEvent(this, false);

                    HttpHelper.GetInstance().ResultCheck(putData, out bool isSuccess2);

                    if (!isSuccess2 && bAutoSubmit)
                    {
                        MessageBox.Show("更新挑拨上架任务单失败!" + putData.message, "温馨提示", MessageBoxButton.OK);
                    }
                }
            }

            ConsumingBll.GetInstance().InsertLocalCommodityCodeInfo(bdCommodityCode, "AllotShelf");

            ApplicationState.SetGoodsInfo(after);
            if (bAutoSubmit)
            {
                EnterPopCloseEvent(this, bExit);
            }
        }
Example #6
0
        /// <summary>
        /// 处理输入事件
        /// </summary>
        /// <returns></returns>
        private bool HandleEnterDetail()
        {
            string inputStr = tbInputNumbers.Text;

            if (string.IsNullOrWhiteSpace(inputStr))
            {
                MessageBox.Show("调拨上架工单号不可以为空!", "温馨提示", MessageBoxButton.OK);
                return(false);
            }

            TaskOrder taskOrder;
            string    name;

            try
            {
                taskOrder = JsonConvert.DeserializeObject <TaskOrder>(inputStr);
                name      = taskOrder.name;
            }
            catch (Exception ex)
            {
                LogUtils.Error($"数据解析失败!{inputStr} ; 异常报错为:{ex.Message}");
                name = inputStr;
            }

            LoadingDataEvent(this, true);
            BaseData <AllotShelf> baseDataAllotShelf = AllotShelfBll.GetInstance().GetAllotShelfTask(name.ToUpper());

            LoadingDataEvent(this, false);

            HttpHelper.GetInstance().ResultCheck(baseDataAllotShelf, out bool isSuccess);
            if (!isSuccess)
            {
                MessageBox.Show("此调拨上架工单中商品已经领取完毕, 或没有登记在您名下,或者不存在!", "温馨提示", MessageBoxButton.OK);
                return(false);
            }

            EnterAllotShelfDetailEvent(this, baseDataAllotShelf.body.objects[0]);

            return(true);
        }