예제 #1
0
 public void RefreshSerials(string workArea)
 {
     CallHub.Static_SendOperatorCall(workArea, workArea);
     //SmartWatchConnector.RefreshSerials(workArea);
 }
예제 #2
0
        public StartSerialResponse StartSerial(StartSerialRequest startSerialRequest)
        {
            var response = new StartSerialResponse
            {
                Succeeded = true,
                Error     = string.Empty
            };
            UAFConnector uafConnector = null;

            try
            {
                uafConnector = new UAFConnector(startSerialRequest.User, startSerialRequest.Password);
            }
            catch (Exception e)
            {
                response.Succeeded = false;
                response.Error     = e.Message;
                return(response);
            }

            if (startSerialRequest.Status == "Active")
            {
                var uafResponse = uafConnector.CallCommand <DABCompleteSerial, DABCompleteSerial.Response>(new DABCompleteSerial
                {
                    //EquipmentNId = startSerialRequest.Equipment,
                    //MaterialDefinitionNId = startSerialRequest.ProductCode,
                    //SerialNumber = startSerialRequest.SerialNumber,
                    //WorkOrderOperationNId = startSerialRequest.Operation
                    CompleteSerializedWoOpParameterList = new List <CompleteSerializedParameterType>
                    {
                        new CompleteSerializedParameterType
                        {
                            EquipmentNId            = startSerialRequest.Equipment,
                            NId                     = startSerialRequest.Operation,
                            Id                      = startSerialRequest.OperationId,
                            ActualProducedMaterials = new List <MaterialItemParameterType>
                            {
                                new MaterialItemParameterType
                                {
                                    EquipmentNId          = startSerialRequest.Equipment,
                                    MaterialDefinitionNId = startSerialRequest.ProductCode,
                                    SerialNumber          = startSerialRequest.SerialNumber,
                                    NId = startSerialRequest.SerialNumber
                                }
                            }
                        }
                    }
                });
                if (!uafResponse.Succeeded)
                {
                    response.Succeeded = false;
                    response.Error     = $"Errore {uafResponse.Error.ErrorCode}: {uafResponse.Error.ErrorMessage}";
                    return(response);
                }
            }
            else
            {
                var uafResponse = uafConnector.CallCommand <DABStartSerial, DABStartSerial.Response>(new DABStartSerial
                {
                    //EquipmentNId = startSerialRequest.Equipment,
                    //MaterialDefinitionNId = startSerialRequest.ProductCode,
                    //SerialNumber = startSerialRequest.SerialNumber,
                    //WorkOrderOperationNId = startSerialRequest.Operation
                    StartWOOperationSerializedParameterTypeList = new List <StartSerializedParameterType>
                    {
                        new StartSerializedParameterType
                        {
                            EquipmentNId = startSerialRequest.Equipment,
                            NId          = startSerialRequest.Operation,
                            Id           = startSerialRequest.OperationId,
                            //EquipmentName = startSerialRequest.Equipment,
                            ToBeProducedMaterials = new List <MaterialItemParameterType>
                            {
                                new MaterialItemParameterType
                                {
                                    EquipmentNId          = startSerialRequest.Equipment,
                                    MaterialDefinitionNId = startSerialRequest.ProductCode,
                                    SerialNumber          = startSerialRequest.SerialNumber,
                                    NId = startSerialRequest.SerialNumber
                                }
                            }
                        }
                    }
                });
                if (!uafResponse.Succeeded)
                {
                    response.Succeeded = false;
                    response.Error     = $"Errore {uafResponse.Error.ErrorCode}: {uafResponse.Error.ErrorMessage}";
                    return(response);
                }
            }
            if (response.Succeeded == true)
            {
                CallHub.Static_SendOperatorCall(startSerialRequest.WorkArea, startSerialRequest.SerialNumber);
                //SmartWatchConnector.RefreshSerials(startSerialRequest.WorkArea);
            }
            return(response);
        }