Beispiel #1
0
        /// <summary>
        /// 派发模拟排产任务
        /// </summary>
        public static void DispatchMockSchTask(string machineCode, int id = 0)
        {
            var mockEffects = UnityIocService.ResolveDepend <MockEffects>();
            var task        = YUtil.GetJsonObjectFromFile <MqSchTask>(AssetsHelper.GetAssets().MockMqSchTaskJson);

            task.workcode = YUtil.GetRandomString(8);
            task.id       = id;
            task.taskId   = id.ToString();
            task.maccode  = machineCode;
            foreach (var axis in task.axisParam)
            {
                axis.maccode  = task.maccode;
                axis.axiscode = YUtil.GetRandomString(10);
                axis.taskId   = task.taskId;
            }
            JavaTime startTime = new JavaTime()
            {
                time = YUtil.GetUtcTimestampMs(YUtil.GetRandomTime(DateTime.Now.AddDays(-1), DateTime.Now))
            };

            task.pstime = startTime;
            task.pdtime = startTime;
            App.Store.Dispatch(mockEffects.MockSchTaskAccept(new MockActions.MockSchTaskAccpet(task)));
        }