| | |
| | | { |
| | | list.RemoveAll(s => loca.Contains(s.S_CODE)); |
| | | } |
| | | //过滤一下 允许进入的才分配 |
| | | var reservoirs = Settings.ReservoirAreas.Where(s => s.areaName == "立库入库区").FirstOrDefault(); |
| | | if (reservoirs.areaCode.Equals(area)) |
| | | // 3. 如果是立库入库区,检查 PLC 是否允许卸载 |
| | | var reservoirs = Settings.ReservoirAreas.FirstOrDefault(s => s.areaName == "立库入库区"); |
| | | if (reservoirs != null && reservoirs.areaCode.Equals(area)) |
| | | { |
| | | var plcDeviceTable = S7Helper.plcDeviceTables; |
| | | foreach (var l in list) |
| | | // 先收集要移除的货位,避免在遍历时修改集合 |
| | | List<Location> locationsToRemove = new List<Location>(); |
| | | |
| | | foreach (var location in list) |
| | | { |
| | | var safeInteraction = Settings.SafeInteractions.Where(s => s.location == l.S_CODE).FirstOrDefault(); |
| | | var res = int.Parse(plcDeviceTable.RGVAllowUnload[safeInteraction.code].ToString().Substring(1, 1)); |
| | | if (res!=1) |
| | | var safeInteraction = Settings.SafeInteractions.FirstOrDefault(s => s.location == location.S_CODE); |
| | | if (safeInteraction != null) |
| | | { |
| | | list.Remove(l); |
| | | // 检查 PLC 是否允许卸载(取第二位数字,判断是否为 1) |
| | | string allowUnloadStr = plcDeviceTable.RGVAllowUnload[safeInteraction.code].ToString(); |
| | | int allowUnload = int.Parse(allowUnloadStr.Substring(1, 1)); |
| | | |
| | | if (allowUnload != 1) |
| | | { |
| | | locationsToRemove.Add(location); // 不允许卸载,加入待移除列表 |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 遍历结束后,再统一移除不符合条件的货位 |
| | | foreach (var locToRemove in locationsToRemove) |
| | | { |
| | | list.Remove(locToRemove); |
| | | } |
| | | } |
| | | ////过滤一下 允许进入的才分配 |
| | | //var reservoirs = Settings.ReservoirAreas.Where(s => s.areaName == "立库入库区").FirstOrDefault(); |
| | | //if (reservoirs.areaCode.Equals(area)) |
| | | //{ |
| | | // var plcDeviceTable = S7Helper.plcDeviceTables; |
| | | // foreach (var l in list) |
| | | // { |
| | | // var safeInteraction = Settings.SafeInteractions.Where(s => s.location == l.S_CODE).FirstOrDefault(); |
| | | // var res = int.Parse(plcDeviceTable.RGVAllowUnload[safeInteraction.code].ToString().Substring(1, 1)); |
| | | // if (res!=1) |
| | | // { |
| | | // list.Remove(l); |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | |
| | | //符合条件的排序选第一个 先找第一个 |
| | | if (list.Count > 0) |