| | |
| | | // 用于保存每个设备的初始状态 |
| | | var initialStates = new Dictionary<long, WcsDeviceOutput>(); |
| | | |
| | | var listPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine).ToList(); |
| | | var listPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine).Where(s => s.Enable == YesNoEnum.Y).ToList(); |
| | | var listPlcId = listPlc.Select(s => s.Id).ToList(); |
| | | var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.DeviceType == DeviceTypeEnum.Business && listPlcId.Contains(s.PlcId)).Select<WcsDeviceOutput>().ToList(); |
| | | var listPlcDeviceId = listPlcDevice.Select(s => s.Id).ToList(); |
| | |
| | | { |
| | | (result, var palletNo) = modConn.GetPlcDBValue(modPositionPalletNo.PosType, modDevice.DbNumber, modPositionPalletNo.PlcPos, modPositionPalletNo.StringLength); |
| | | modDevice.PalletNo = Convert.ToString(palletNo); |
| | | Console.WriteLine(modDevice.DbNumber + "." + modPositionPalletNo.PlcPos + "----------"); |
| | | } |
| | | if (modPlc.Type == PLCTypeEnum.ConveyorLine) |
| | | { |
| | |
| | | if (initialStates.TryGetValue(modDevice.Id, out var initialState)) |
| | | { |
| | | if (modDevice.Status != initialState.Status || |
| | | modDevice.Plc != initialState.Plc || |
| | | (!modDevice.Plc.IsNullOrEmpty() && modDevice.Plc != initialState.Plc) || |
| | | modDevice.Wcs != initialState.Wcs || |
| | | modDevice.TaskNo != initialState.TaskNo || |
| | | modDevice.TaskType != initialState.TaskType || |