zxx
2025-05-30 034839c93e9f18d2b77105a85f65c8400798d74c
巨石
5个文件已修改
54 ■■■■■ 已修改文件
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/api/WmsController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/core/WMSCore.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/device/S7Helper.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/process/TaskProcess.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/wms/ContainerHelper.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/api/WmsController.cs
@@ -159,7 +159,7 @@
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Results S7Write(int offsetAddr)
        public Results S7Write(Isusing offsetAddr)
        {
            LogHelper.Info("S7Write 参数:" + offsetAddr, "WMSAPI");
            var res = S7Helper.S7Write(offsetAddr);
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/core/WMSCore.cs
@@ -323,6 +323,7 @@
                            //LogHelper.Info($"拆托机货位{endLoc}不存在或已被锁");
                            return;
                        }
                        //校验是否允许放货
                        var plcDeviceTable = S7Helper.plcDeviceTables;
                        LogHelper.Info($"自动送托 拆托机{dev}:{plcDeviceTable.requestPut1}");
                        if ((plcDeviceTable.requestPut1 && dev == "1") ||
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/device/S7Helper.cs
@@ -3,6 +3,7 @@
using Microsoft.Owin.BuilderProperties;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Opc.Ua;
using S7.Net;
using S7.Net.Types;
using SqlSugar;
@@ -298,9 +299,11 @@
            var db = new SqlHelper<WCSTask>().GetInstance();
            try
            {
                var linkplc = Settings.linePlcInfos.Find(a => a.enable == 1);
                var plc = new Plc(CpuType.S71500, linkplc.address, 0, 1);
                var linkplc = Settings.SafeInteractions.FindAll(a => a.code == 1|| a.code == 7).ToList();
                var plc = new Plc(CpuType.S71500, linkplc[1].ip, 0, 1);
                Link(plc);
                var plc1 = new Plc(CpuType.S71200, linkplc[0].ip, 0, 1);
                Link(plc1);
                //拆托机 
                //object rawValue = plc.Read(DataType.DataBlock, 8, 230, VarType.Byte, 1);
                //LogHelper.Info($"Raw value: {rawValue} (Type: {rawValue?.GetType()})");
@@ -314,13 +317,17 @@
                LogHelper.Info($"拆托机接收信号====={requestPut1},{requestTake1},{requestPut2},{requestTake2}");
                //RGV
                //var rawValue = plc1.Read(DataType.DataBlock, 51, 0, VarType.Int, 1);
                //LogHelper.Info($"Raw value: {rawValue}, Type: {rawValue?.GetType()}");
                // RGV允许卸货状态读取 (从DB51读取)
                int rgv1AllowUnload = (int)plc.Read(DataType.DataBlock, 51, 0, VarType.Int, 1);
                int rgv2AllowUnload = (int)plc.Read(DataType.DataBlock, 51, 2, VarType.Int, 1);
                int rgv3AllowUnload = (int)plc.Read(DataType.DataBlock, 51, 4, VarType.Int, 1);
                int rgv4AllowUnload = (int)plc.Read(DataType.DataBlock, 51, 6, VarType.Int, 1);
                int rgv5AllowUnload = (int)plc.Read(DataType.DataBlock, 51, 8, VarType.Int, 1);
                int rgv6AllowUnload = (int)plc.Read(DataType.DataBlock, 51, 10, VarType.Int, 1);
                int rgv1AllowUnload = Convert.ToInt32(plc1.Read(DataType.DataBlock, 51, 0, VarType.Int, 1));
                int rgv2AllowUnload = Convert.ToInt32(plc1.Read(DataType.DataBlock, 51, 2, VarType.Int, 1));
                int rgv3AllowUnload = Convert.ToInt32(plc1.Read(DataType.DataBlock, 51, 4, VarType.Int, 1));
                int rgv4AllowUnload = Convert.ToInt32(plc1.Read(DataType.DataBlock, 51, 6, VarType.Int, 1));
                int rgv5AllowUnload = Convert.ToInt32(plc1.Read(DataType.DataBlock, 51, 8, VarType.Int, 1));
                int rgv6AllowUnload = Convert.ToInt32(plc1.Read(DataType.DataBlock, 51, 10, VarType.Int, 1));
                LogHelper.Info($"RGV接收信号=== 1={rgv1AllowUnload}, 2={rgv2AllowUnload}, 3={rgv3AllowUnload}, 4={rgv4AllowUnload}, 5={rgv5AllowUnload}, 6={rgv6AllowUnload}");
                //存到缓存
@@ -964,12 +971,15 @@
        }
        //S7写入信号 测试用
        internal static Results S7Write(int offsetAddr)
        internal static Results S7Write(Isusing offsetAddr)
        {
            var linkplcs = Settings.linePlcInfos.Find(a => a.deviceNo == "1");
            var plc = new Plc(CpuType.S71500, linkplcs.address, 0, 1);
            //var linkplcs = Settings.linePlcInfos.Find(a => a.deviceNo == "1");
            //var plc = new Plc(CpuType.S71200, linkplcs.address, 0, 1);
            var linkplc = Settings.SafeInteractions.First();
            var plc = new Plc(CpuType.S71200, linkplc.ip, 0, 1);
            Link(plc);
            plc.WriteBit(DataType.DataBlock, 9, 182, offsetAddr, false);
            S7Helper.WriteInt(50, 0, (short)(offsetAddr.S_STATUS * 10 + int.Parse(offsetAddr.S_TYPE)));
            //plc.WriteBit(DataType.DataBlock, 9, 182, offsetAddr, false);
            return new Results() { Code = "0", Message = $"写入成功", Data = null };
        }
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/process/TaskProcess.cs
@@ -1761,10 +1761,10 @@
                    if (reservoirs.type.Equals("RGV"))
                    {
                        LogHelper.Info($"RGV安全交互  请求点位:{model.STATION_NAME}请求码:{model.APPLY_CODE}");
                        //根据ip读状态
                        LogHelper.Info($"RGV安全交互缓存信号{JsonConvert.SerializeObject(plcDeviceTable.RGVAllowUnload)}");
                        //处理信号
                        var res = plcDeviceTable.RGVAllowUnload[reservoirs.code];
                        var res =int.Parse(plcDeviceTable.RGVAllowUnload[reservoirs.code].ToString().Substring(1, 1));
                        //根据ip读状态
                        LogHelper.Info($"RGV安全交互缓存信号{res},{JsonConvert.SerializeObject(plcDeviceTable.RGVAllowUnload)}");
                        //卸货请求进入
                        if (model.APPLY_CODE.Equals("5"))
                        {
@@ -1778,6 +1778,7 @@
                        //卸货后已离开
                        else if (model.APPLY_CODE.Equals("8"))
                        {
                            //发送卸货完成、复位信号
                            safeAssistant(reservoirs.code,res);
                            LogHelper.Info($"RGV安全交互 卸货完成");
                            return new safeResult() { code = "0", msg = "success" };
@@ -1860,7 +1861,7 @@
                throw;
            }
        }
        //循环发送信号
        private static void safeAssistant(int code,int res) {
            //2卸货完成确认
            if (res != 2)
HH.WCS.Mobox3/HH.WCS.Mobox3.JuShi/wms/ContainerHelper.cs
@@ -559,16 +559,16 @@
                    if (db.Queryable<LocCntrRel>().Count(a => a.S_CNTR_CODE.Trim() == cntrCode) == 0)
                    {
                        var cir = new LocCntrRel { S_LOC_CODE = loc, S_CNTR_CODE = cntrCode};
                        var con = new Container { S_CODE = cntrCode,N_DETAIL_COUNT = 1,C_FULL="0" };
                        var con = new Container { S_CODE = cntrCode,N_DETAIL_COUNT = 1,C_FULL="2" };//默认满 主动绑定服务用
                        db.Insertable<LocCntrRel>(cir).ExecuteCommand();
                        db.Insertable<Container>(con).ExecuteCommand();
                        if (!string.IsNullOrEmpty(itemCode))
                        {
                            LogHelper.Info($"绑定容器参数:{JsonConvert.SerializeObject(con)}");
                            ContainerHelper.BindCntrItem(cntrCode, itemCode, itemName);
                            //有物料的话就是满的
                            con.C_FULL = "2";
                            db.Updateable(con).UpdateColumns(it => it.C_FULL).ExecuteCommand();
                            ////有物料的话就是满的
                            //con.C_FULL = "2";
                            //db.Updateable(con).UpdateColumns(it => it.C_FULL).ExecuteCommand();
                        }
                    }
                }