コード例 #1
0
        /// <summary>
        /// 处理进入盘点详情事件
        /// </summary>
        /// <returns></returns>
        private bool HanleInventoryDetail()
        {
            string inputStr = tbInputNumbers.Text;

            if (string.IsNullOrWhiteSpace(inputStr))
            {
                MessageBox.Show("盘点任务单号不可以为空!", "温馨提示", MessageBoxButton.OK);
                return(false);
            }

            TaskOrder taskOrder;
            string    taskName;

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

            LoadingDataEvent(this, true);
            BaseData <InventoryTask> bdInventoryTask = InventoryTaskBll.GetInstance().GetInventoryTaskByInventoryTaskName(taskName.ToUpper());

            LoadingDataEvent(this, false);

            //校验是否含有数据
            HttpHelper.GetInstance().ResultCheck(bdInventoryTask, out bool isSuccess);

            if (!isSuccess)
            {
                MessageBox.Show("无法获取盘点任务单!", "温馨提示", MessageBoxButton.OK);
                return(false);
            }


            LoadingDataEvent(this, true);
            BaseData <InventoryOrder> bdInventoryOrder = InventoryTaskBll.GetInstance().GetInventoryOrdersByInventoryTaskName(bdInventoryTask.body.objects[0].name);

            LoadingDataEvent(this, false);

            //校验是否含有数据
            HttpHelper.GetInstance().ResultCheck(bdInventoryOrder, out bool isSuccess1);
            if (!isSuccess1)
            {
                SetPopInventoryEvent(this, false);
                MessageBox.Show("无法获取盘点单!", "温馨提示", MessageBoxButton.OK);
                return(false);
            }

            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                EnterInventoryDetailEvent(this, bdInventoryOrder.body.objects[0]);
            }));

            return(true);
        }
コード例 #2
0
        public Task Execute(IJobExecutionContext context)
        {
            LogUtils.Debug("ExecuteInventoryPlanJoB进入");

            var epcs = RfidHelper.GetEpcDataJson(out bool isGetSucess);

            if (isGetSucess)
            {
                var baseDataCommodityCodes = CommodityCodeBll.GetInstance().GetCommodityCode(epcs);

                HttpHelper.GetInstance().ResultCheck(baseDataCommodityCodes, out bool isSuccess);

                if (isSuccess)
                {
                    var basePostInventoryDetail = InventoryTaskBll.GetInstance().CreateInventoryOrderAndDetail(baseDataCommodityCodes.body.objects);
                    LogUtils.Debug($"已执行自动盘点任务:{JsonConvert.SerializeObject(basePostInventoryDetail)}");
                }
            }
            else
            {
                LogUtils.Debug("盘点计划未扫描出有效商品");
            }

            return(null);
        }
コード例 #3
0
        public void InventoryTestMethod()
        {
            JsonSerializerSettings jsetting = new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            };

            string ret = JsonConvert.SerializeObject(new InventoryOrder
            {
                ConfirmDate = DateTime.Now.ToString("s")
            }, Formatting.Indented, jsetting);

            var taskName = "IT20190723000015";
            var temp     = InventoryTaskBll.GetInstance().GetInventoryOrdersByInventoryTaskName(taskName);

            LogUtils.Debug(temp);



/*            //通过【盘点任务名称】从表格【盘点任务】中查询获取盘点任务id。• 通过【盘点任务单】(InventoryTask.id =InventoryOrder.InventoryTaskId)从表格【盘点单】中查询获得盘点单列列表
 *          var taskName = "IT20190723000015";
 *          var inventoryOrders = InventoryTaskBll.GetInstance().GetInventoryOrdersByInventoryTaskName(taskName);
 *          LogUtils.Debug(inventoryOrders);
 *
 *          //移动端 更更新【盘点单管理理】的盘点状态为 ‘已确认’
 *          var inventoryOrder = InventoryTaskBll.GetInstance().UpdateInventoryOrderStatus(new InventoryOrder()
 *          {
 *              id = "AQACQqweDg8BAAAAc0w5SjP_sxVVfgQA",//AQACQqweJ4wBAAAAsOJ96Cr_sxWbDwQA
 *              Status = InventoryOrderStatus.待盘点.ToString(),
 *              ConfirmDate = "2019-07-24T15:19:00Z",
 *              version = 0
 *          });
 *          LogUtils.Debug(inventoryOrder);*/


            //• 通过当前【设备编码/id】从表格 【设备管理理】(Equipment)中查询获取设备的’⾃自动盘点计划’(InventoryPlanId)。
            //• 通过当前【id】(InventoryPlan.id = Equipment.InventoryPlanId)从表格【盘点计划管理理】(InventoryPlan)中查询获取相关盘点信息。
            var equipmentName = "E00000008";//设备名称
            //var equipmentId = "AQACQqweDg8BAAAAFUD8WDEPsxV_FwQA";//设备ID
            var plans = InventoryTaskBll.GetInstance().GetInventoryPlanByEquipmnetNameOrId(equipmentName);

            //var plans = InventoryTaskBll.GetInstance().GetInventoryPlanByEquipmnetNameOrId(equipmentId);
            LogUtils.Debug(plans);

            var createOrder = InventoryTaskBll.GetInstance().CreateInventoryOrder(new List <InventoryOrder>()
            {
                new InventoryOrder()
                {
                    ConfirmDate     = "2019-07-24T15:19:00Z",            //确认时间
                    EquipmentId     = "",                                //盘点设备
                    GoodsLocationId = "",                                //盘点货位
                    Status          = "",                                //盘点状态
                    StoreHouseId    = "",                                //盘点库房
                    Type            = InventoryOrderType.自动创建.ToString() //创建类型
                }
            });
        }
コード例 #4
0
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onInitData(object sender, ElapsedEventArgs e)
        {
            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                LoadingDataEvent(this, true);
                BaseData <InventoryPlan> bdInventoryPlan = InventoryTaskBll.GetInstance().GetInventoryPlanByEquipmnetNameOrId(ApplicationState.GetEquipName());
                LoadingDataEvent(this, false);

                if (bdInventoryPlan.code != 0)
                {
                    inventoryTime.Content = "无法获取盘点计划";
                }
                else
                {
                    InventoryPlan plan = bdInventoryPlan.body.objects[0];

                    if (plan.CheckPeriod == "每日")
                    {
                        inventoryTime.Content = plan.CheckPeriod + " " + plan.InventoryTime;
                    }
                    else if (plan.CheckPeriod == "每周")
                    {
                        inventoryTime.Content = plan.CheckPeriod + plan.InventoryWeekday + " " + plan.InventoryTime;
                    }
                    else if (plan.CheckPeriod == "每月")
                    {
                        inventoryTime.Content = plan.CheckPeriod + plan.InventoryDay + " " + plan.InventoryTime;
                    }
                    else
                    {
                        inventoryTime.Content = "";
                    }
                }
                DataContext = this;

                GetInventoryList();

                tbInputNumbers.Focus();
            }));
        }
コード例 #5
0
        public Task Execute(IJobExecutionContext context)
        {
            LogUtils.Debug("GetInventoryPlanJoB进入");

            var baseDataInventoryPlan = InventoryTaskBll.GetInstance().GetInventoryPlanByEquipmnetNameOrId(ApplicationState.GetEquipId());

            //校验是否含有数据,如果含有数据,进行后续操作
            HttpHelper.GetInstance().ResultCheck(baseDataInventoryPlan, out bool isSuccess);

            if (isSuccess)
            {
                var inventoryPlans = baseDataInventoryPlan.body.objects;
                CustomizeScheduler.GetInstance().SchedulerStartOrUpdateOrDeleteByPlans(inventoryPlans).Wait();
                //cronStr = "0 44 11 * * ?";
            }
            else
            {
                LogUtils.Error($"拉取盘点定时计划失败!");
            }

            return(null);
        }
コード例 #6
0
        /// <summary>
        /// 盘点确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void onSubmit(object sender, RoutedEventArgs e)
        {
            LoadingDataEvent(this, true);
            BasePutData <InventoryOrder> bdInventoryOrder = InventoryTaskBll.GetInstance().UpdateInventoryOrderStatus(inventoryOrder);

            LoadingDataEvent(this, false);

            //校验是否含有数据
            HttpHelper.GetInstance().ResultCheck(bdInventoryOrder, out bool isSuccess);

            if (!isSuccess)
            {
                MessageBox.Show("更新盘点任务单失败!" + bdInventoryOrder.message, "温馨提示", MessageBoxButton.OK);
                return;
            }

            LoadingDataEvent(this, true);
            BasePostData <InventoryDetail> bdInventoryDetail = InventoryTaskBll.GetInstance().CreateInventoryDetail(list, inventoryOrder.id);

            LoadingDataEvent(this, false);


            //校验是否含有数据
            HttpHelper.GetInstance().ResultCheck(bdInventoryDetail, out bool isSuccess1);

            if (isSuccess1)
            {
                MessageBox.Show("提交盘点任务单成功!" + bdInventoryDetail.message, "温馨提示", MessageBoxButton.OK);
                BackInventoryEvent(this, null);
            }
            else
            {
                MessageBox.Show("创建盘点商品明细失败!" + bdInventoryDetail.message, "温馨提示", MessageBoxButton.OK);
            }

            return;
        }