pulg
2025-07-05 db825ff9bb1352e79c3e018a647b3c88713d6f69
HH.WCS.QingXiNongfu/process/DeviceProcess.cs
@@ -1733,9 +1733,42 @@
               状态2   送空完成之后为状态2
               状态3   满托取走,送空之前为状态3,开机默认状态也为状态3
           */
            //3F 00 12 22 0D 0A--无任务信号
            //3F 00 11 22 0D 0A--A口工作信号
            //3F 00 12 21 0D 0A--B口信号
            //3F 00 11 21 0D 0A--A、B口工作信号
            //A口复位信号 - 3F 00 10 0D 0A
            //B口复位信号 - 3F 00 20 0D 0A
            if (data.Length == 4)
            {
                //if (data == "1122")//A口工作信号
                //{
                //    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
                //    {
                //    }
                //}
                //else if (data == "1221")//B口工作信号
                //{
                //    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
                //    {
                //    }
                //}
                //else if (data == "1121")//B口工作信号
                //{
                //    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
                //    {
                //    }
                //    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
                //    {
                //    }
                //}
                if (data.Substring(1, 1) == "1")
                {
                    if (BottlePEMInfoFull(plc, plc.location[0]))
@@ -1962,6 +1995,26 @@
                        }
                    }
                }
            }
        }
        static bool BottlePEMInfoFullTwo(Settings.deviceInfo plc, string location)
        {
            try
            {
                if (location != "")
                {
                    var workOrder = WCSHelper.GetWorkOrder(plc.deviceName);
                    if (workOrder == null)
                    {
                        LogHelper.Info(plc.deviceName + "没有【执行中】的工单");
                        return false;
                    }
                }
                return false;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
@@ -3491,25 +3544,26 @@
                                    if (endBit == null && _tempList.Any())
                                    {
                                        LogHelper.Info(" ar_RplaceRow over!" + JsonConvert.SerializeObject(_tempList.Select(x => x.N_ROW).Distinct()));
                                        var ar_RplaceRows = LocationHelper.GetLocList(x => x.S_AREA_CODE != area1 && x.S_AREA_CODE.Contains(are) && x.S_LOCK_STATE != "报废");//.Select(x => x.N_ROW).Distinct();
                                                                                                                                                                            //var ar_RplaceRow1 = ar_RplaceRows.FindAll(x => x.S_LOCK_STATE != "无").Select(x => x.N_ROW).Distinct();
                                        IEnumerable<int> ar_RplaceRow1 = ar_RplaceRows.FindAll(x => "入库锁;出库锁".Contains(x.S_LOCK_STATE?.Trim())).Select(x => x.N_ROW).Distinct();
                                        LogHelper.Info(" 有锁排 - " + JsonConvert.SerializeObject(ar_RplaceRow1));                                                                                        //LogHelper.Info(" 有锁排 - " + JsonConvert.SerializeObject(ar_RplaceRow1));
                                        var ar_RplaceRow2 = ar_RplaceRows.FindAll(x => x.N_CURRENT_NUM > 0).Select(x => x.N_ROW).Distinct();
                                        LogHelper.Info(" 有货排: - " + JsonConvert.SerializeObject(ar_RplaceRow2));
                                        var ar_RplaceRow_rowlock = LocationHelper.GetRowLock(x => x.S_AREA_CODE.Contains(are))?.Select(x => x.N_ROW);
                                        //var ar_RplaceRows = LocationHelper.GetLocList(x => x.S_AREA_CODE != area1 && x.S_AREA_CODE.Contains(are) && x.S_LOCK_STATE != "报废");//.Select(x => x.N_ROW).Distinct();
                                        //                                                                                                                                    //var ar_RplaceRow1 = ar_RplaceRows.FindAll(x => x.S_LOCK_STATE != "无").Select(x => x.N_ROW).Distinct();
                                        //IEnumerable<int> ar_RplaceRow1 = ar_RplaceRows.FindAll(x => "入库锁;出库锁".Contains(x.S_LOCK_STATE?.Trim())).Select(x => x.N_ROW).Distinct();
                                        //LogHelper.Info(" 有锁排 - " + JsonConvert.SerializeObject(ar_RplaceRow1));                                                                                        //LogHelper.Info(" 有锁排 - " + JsonConvert.SerializeObject(ar_RplaceRow1));
                                        //var ar_RplaceRow2 = ar_RplaceRows.FindAll(x => x.N_CURRENT_NUM > 0).Select(x => x.N_ROW).Distinct();
                                        //LogHelper.Info(" 有货排: - " + JsonConvert.SerializeObject(ar_RplaceRow2));
                                        //var ar_RplaceRow_rowlock = LocationHelper.GetRowLock(x => x.S_AREA_CODE.Contains(are))?.Select(x => x.N_ROW);
                                        var ar_RplaceRow = ar_RplaceRow1.Concat(ar_RplaceRow2).Concat(ar_RplaceRow_rowlock).Distinct();
                                        //var ar_RplaceRow = ar_RplaceRow1.Concat(ar_RplaceRow2).Concat(ar_RplaceRow_rowlock).Distinct();
                                        if (ar_RplaceRow.Any())
                                        {
                                            LogHelper.Info("排除非空排 - " + JsonConvert.SerializeObject(ar_RplaceRow));
                                            _tempList.RemoveAll(x => ar_RplaceRow.Contains(x.N_ROW));
                                        }
                                        if (_tempList.Any())//三个库区的交集空排
                                        {
                                            endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault();
                                        }
                                        //if (ar_RplaceRow.Any())
                                        //{
                                        //    LogHelper.Info("排除非空排 - " + JsonConvert.SerializeObject(ar_RplaceRow));
                                        //    _tempList.RemoveAll(x => ar_RplaceRow.Contains(x.N_ROW));
                                        //}
                                        //if (_tempList.Any())//三个库区的交集空排
                                        //{
                                        //    endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault();
                                        //}
                                        endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault();
                                    }
                                    #endregion