Esempio n. 1
0
        /// <summary>
        /// 呼叫维修完成
        /// </summary>
        /// <param name="selectCall"></param>
        /// <returns></returns>
        async Task execCallRepairComplete(MqCall selectCall)
        {
            var call = new Redux.Models.MqCall()
            {
                machineCode = selectCall.MachineCode,
                callType    = Redux.Models.MqCallType.RepairComplete,
                CallId      = Guid.NewGuid().GetHashCode(),
            };

            App.Logger.Info("维修完成: " + JsonConvert.SerializeObject(call));
            var callSuccess = await App.Store.Dispatch(UnityIocService.ResolveDepend <MqEffects>().CallSystem(new MqActions.CallSystem(selectCall.MachineCode, call)));

            if (callSuccess)
            {
                App.Store.Dispatch(new SysActions.ShowNotification(new SysNotificationMsg()
                {
                    Title   = "通知",
                    Content = $"{selectCall.MachineCode} 维修完成"
                }));
            }
            else
            {
                App.Store.Dispatch(new SysActions.ShowNotification(new SysNotificationMsg()
                {
                    Title   = "警告",
                    Content = $"{selectCall.MachineCode} 维修完成状态上传失败,请重试"
                }));
            }
        }
Esempio n. 2
0
 public void Call(MqCall selectCall)
 {
     if (selectCall.CallType == MqCallType.Repair)
     {
         execCallRepair(selectCall);
     }
     else if (selectCall.CallType == MqCallType.RepairComplete)
     {
         execCallRepairComplete(selectCall);
     }
     else if (selectCall.CallType == MqCallType.Forklift)
     {
         execCallForklift(selectCall);
     }
 }
Esempio n. 3
0
        public MqCallViewModel()
        {
            MqCallDict = new Dictionary <string, List <MqCall> >();
            foreach (var pair in MachineConfig.MachineDict)
            {
                var machineCode = pair.Key;
                if (!MqCallDict.ContainsKey(machineCode))
                {
                    MqCallDict[machineCode] = new List <MqCall>();
                }
                var callRepair = new MqCall()
                {
                    CallIcon    = AssetsHelper.GetAssets().IconRepair,
                    CallTxt     = $"{machineCode} 报修",
                    MachineCode = machineCode,
                    Data        = null,
                    CallType    = MqCallType.Repair,
                };

                var callForklift = new MqCall()
                {
                    CallIcon    = AssetsHelper.GetAssets().IconForklift,
                    CallTxt     = $"{machineCode} 叉车",
                    MachineCode = machineCode,
                    Data        = null,
                    CallType    = MqCallType.Forklift
                };

                var callRepairComplete = new MqCall()
                {
                    CallIcon    = AssetsHelper.GetAssets().IconV,
                    CallTxt     = $"{machineCode} 完成维修",
                    MachineCode = machineCode,
                    Data        = null,
                    CallType    = MqCallType.RepairComplete
                };

                MqCallDict[machineCode].Add(callRepair);
                MqCallDict[machineCode].Add(callForklift);
                MqCallDict[machineCode].Add(callRepairComplete);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 呼叫维修
        /// </summary>
        /// <param name="selectCall"></param>
        void execCallRepair(MqCall selectCall)
        {
            var frm = new CallRepairForm()
            {
                OnOkPressed = async f => {
                    var repairForm = f as CallRepairForm;
                    var call       = new Redux.Models.MqCall()
                    {
                        machineCode = selectCall.MachineCode,
                        callType    = Redux.Models.MqCallType.Repair,
                        callAction  = repairForm.RepairType.GetAttribute <DisplayAttribute>().Name,
                        CallId      = Guid.NewGuid().GetHashCode(),
                    };
                    App.Logger.Info("呼叫维修: " + JsonConvert.SerializeObject(call));
                    var callSuccess = await App.Store.Dispatch(UnityIocService.ResolveDepend <MqEffects>().CallSystem(new MqActions.CallSystem(selectCall.MachineCode, call)));

                    if (callSuccess)
                    {
                        App.Store.Dispatch(new SysActions.ShowNotification(new SysNotificationMsg()
                        {
                            Title   = "通知",
                            Content = $"{selectCall.MachineCode} 申报维修成功 {repairForm.RepairType.GetAttribute<DisplayAttribute>().Name }"
                        }));
                    }
                    else
                    {
                        App.Store.Dispatch(new SysActions.ShowNotification(new SysNotificationMsg()
                        {
                            Title   = "警告",
                            Content = $"{selectCall.MachineCode} 申报维修失败 {repairForm.RepairType.GetAttribute<DisplayAttribute>().Name },请重试"
                        }));
                    }
                }
            };

            App.Store.Dispatch(new SysActions.ShowFormView("选择故障类型", frm, false));
        }