liudl
2025-02-16 ddd9612ed7cefe12c8ea33ced0711a0b9a3feb99
Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
@@ -416,35 +416,41 @@
            Log.Information("接收WMS入库放货确认,放货口:" + models.Port+"入库口");
            var portno = "";
            var layer = "3";
            switch (models.Port)
            {
                case "033":
                    portno = "33";
                    layer = "1";
                    break;
                case "039":
                    portno = "39";
                    layer = "1";
                    break;
                case "044":
                    portno = "44";
                    layer = "1";
                    break;
                case "051":
                    portno = "51";
                    layer = "1";
                    break;
            }
            //检测入库口状态,120为可放,占用则修改为130
            WcsDeviceDto mod = new WcsDeviceDto();
            var plcConn = mod.PLCUtil;
            var modPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.Text == (layer + "层托盘输送线")).First();
            if (modPlc == null)
                throw Oops.Bah("未找到输送线PLC");
            PLCUtil plcConn = new PLCUtil(modPlc);
            //获取工位点位信息
            var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.LedIP != null && s.StationNum == portno).First();
            var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "PLC流程字").First();
            var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "PLC").First();
            var (res1, val) = plcConn.GetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos);
            if (val.ToString() == "120")
            {
                //读取成功后写入130
                modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS流程字").First();
                modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS").First();
                var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "130");//占用此工位
                if (ret.IsSucceed)
                {
@@ -476,30 +482,37 @@
            Log.Information("接收WMS入库放货确认,放货口:" + models.Port + "入库口");
            var portno = "";
            var layer = "3";
            switch (models.Port)
            {
                case "033":
                    portno = "33";
                    layer = "1";
                    break;
                case "039":
                    portno = "39";
                    layer = "1";
                    break;
                case "044":
                    portno = "44";
                    layer = "1";
                    break;
                case "051":
                    portno = "51";
                    layer = "1";
                    break;
            }
            WcsDeviceDto mod = new WcsDeviceDto();
            var plcConn = mod.PLCUtil;
            var modPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.Text == (layer + "层托盘输送线")).First();
            if (modPlc == null)
                throw Oops.Bah("未找到输送线PLC");
            PLCUtil plcConn = new PLCUtil(modPlc);
            //获取工位点位信息
            var listPlcDevice = _db.Queryable<WcsDevice>().Where(s=>s.LedIP != null && s.StationNum == portno).First();
            var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "任务号").First();
            plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, models.TaskNo);//写入任务号
                                                                                                              //
            modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS流程字").First();
            modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS").First();
            var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "140");//写入开始放货信号
            if (ret.IsSucceed)
            {
@@ -532,27 +545,34 @@
            Log.Information("接收WMS入库放货确认,放货口:" + models.Port + "入库口");
            var portno = "";
            var layer = "3";
            switch (models.Port)
            {
                case "033":
                    portno = "33";
                    layer = "1";
                    break;
                case "039":
                    portno = "39";
                    layer = "1";
                    break;
                case "044":
                    portno = "44";
                    layer = "1";
                    break;
                case "051":
                    portno = "51";
                    layer = "1";
                    break;
            }
            WcsDeviceDto mod = new WcsDeviceDto();
            var plcConn = mod.PLCUtil;
            var modPlc = _db.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.Text == (layer + "层托盘输送线")).First();
            if (modPlc == null)
                throw Oops.Bah("未找到输送线PLC");
            PLCUtil plcConn = new PLCUtil(modPlc);
            //获取工位点位信息
            var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.LedIP != null && s.StationNum == portno).First();
            var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS流程字").First();
            var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS").First();
            var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "160");//放完成
            if (ret.IsSucceed)