duyongjia
2024-11-26 0c0ac28fc5784ac64612811c65be7dca8318d8c6
前端更新货位状态修改
已修改7个文件
321 ■■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Client/src/extension/basic/extend/updateStatus.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Client/src/views/basic/locationInfo.vue 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/LocationEnum/EnableStatusEnum.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Basic/Dt_LocationInfo.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs 242 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Client/src/extension/basic/extend/updateStatus.vue
@@ -12,15 +12,16 @@
          <el-input v-model="form.locationCode" disabled></el-input>
        </el-form-item>
        <el-form-item label="货位状态">
          <el-select v-model="form.locationStatus" placeholder="请选择货位状态">
          <el-select v-model="form.locationStatus" placeholder="请选择货位状态" @change="showStatus">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option> </el-select
        ></el-form-item>
            </el-option>
          </el-select>
          </el-form-item>
      </el-form>
      <template #footer>
        <el-button type="primary" size="small" @click="updateLocationStatus"
@@ -52,6 +53,9 @@
    };
  },
  methods: {
    showStatus(){
      console.log(this.form.locationStatus);
    },
    open(row) {
      this.row = row;
      this.showDetialBox = true;
@@ -63,8 +67,8 @@
        .post("/api/LocationInfo/GetLocationStatusDic", {}, true)
        .then((x) => {
          if (!x.status) return this.$message.error(x.message);
          this.options = x.data;
          console.log(this.options);
        });
    },
    updateLocationStatus() {
@@ -73,7 +77,7 @@
          "/api/LocationInfo/UpdateLocationStatus?key=" +
            this.row.id +
            "&locationStatus=" +
            this.row.locationStatus,
            this.form.locationStatus,
          {},
          "数据处理中"
        )
@@ -81,6 +85,8 @@
          if (!x.status) return this.$message.error(x.message);
          this.$message.success("操作成功");
          this.showDetialBox = false;
          this.form.locationStatus='';
          this.$parent.refresh()
        });
    },
  },
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Client/src/views/basic/locationInfo.vue
@@ -56,19 +56,38 @@
          field: "layer",
          type: "string",
        },
        {
          title: "货位深度",
          required: true,
          field: "depth",
          type: "string",
        },
        // {
        //   title: "货位深度",
        //   required: true,
        //   field: "depth",
        //   type: "string",
        // },
      ],
      [
        {
          title: "货位类型",
          required: true,
          field: "locationType",
          type: "string",
          type: "select",
          dataKey:"",
          data:[
            {key:1,value:'正常货位'},
            {key:2,value:'暂存位'},
            {key:3,value:'提升机'},
            {key:4,value:'输送线'},
            {key:5,value:'组立机'},
          ]
        },
         {
          title: "禁用状态",
          required: true,
          field: "enableStatus",
          type: "select",
          dataKey:"",
          data:[
            {key:0,value:'正常'},
            {key:1,value:'禁用'},
          ]
        },
        {
          title: "区域主键",
@@ -77,12 +96,12 @@
          type: "string",
          hidden:true,
        },
        {
          title: "巷道编号",
          required: true,
          field: "roadwayNo",
          type: "string",
        },
        // {
        //   title: "巷道编号",
        //   required: true,
        //   field: "roadwayNo",
        //   type: "string",
        // },
      ],
    ]);
    const searchFormFields = ref({
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/LocationEnum/EnableStatusEnum.cs
@@ -18,14 +18,14 @@
        /// <summary>
        /// åªå…¥
        /// </summary>
        [Description("只入")]
        OnlyIn = 1,
        //[Description("只入")]
        //OnlyIn = 1,
        /// <summary>
        /// åªå‡º
        /// </summary>
        [Description("只出")]
        OnlyOut = 2,
        //[Description("只出")]
        //OnlyOut = 2,
        /// <summary>
        /// ç¦ç”¨
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Basic/Dt_LocationInfo.cs
@@ -14,8 +14,8 @@
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主键")]
        public int Id { get; set; }
        [SugarColumn(IsNullable = false, ColumnDescription = "区域主键")]
        public int AreaId {  get; set; }
        [SugarColumn(ColumnDescription = "区域主键")]
        public int AreaId {  get; set; }=0;
        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "货位编号")]
        public string LocationCode {  get; set; }
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -12,8 +12,8 @@
  "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true
  //连接字符串
  //"ConnectionString": "Data Source=10.0.250.20;Initial Catalog=WIDESEAWCS_GD;User ID=sa;Password=STC@123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEAWCS_GD;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=10.0.250.20;Initial Catalog=WIDESEAWCS_GD;User ID=sa;Password=STC@123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEAWCS_GD;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //跨域
  "Cors": {
    "PolicyName": "CorsIpAccess", //策略名称
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -183,7 +183,7 @@
                            return content = WebResponseContent.Instance.Error($"WCS未查询到源站点对应的库位,源站点:{taskDTO.dest_station.ToString()}");
                        }
                        break;
                    case 3001://AGV放货完成 WMS发3001的同时会写提升信号
                    case 3001://AGV放货完成 WMS发3001的同时WCS需在job中写提升信号
                        if (BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id) == null)//手动入库直接发3001,需要生成任务,因为没有1001环节
                        {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -110,116 +110,140 @@
            //查询提升机/组立机信号
            //Task.Run(delegate
            //{
                try
            try
            {
                if (commonStackerCrane != null)
                {
                    if (commonStackerCrane != null)
                    Dt_Task? task1001 = _taskService.QueryStackerCraneTaskByAGVRequest("SC01");
                    if (task1001 != null)
                    {
                        Dt_Task? task1001 = _taskService.QueryStackerCraneTaskByAGVRequest("SC01");
                        if (task1001 != null)
                        //读取提升机信号,确定是否可以进入
                        int IsAllow = 0;
                        if (task1001.SourceAddress == "SC01-002-000-001")//WMS 1001站点
                        {
                            //读取提升机信号,确定是否可以进入
                            int IsAllow = 0;
                            if (task1001.SourceAddress == "SC01-002-000-001")//WMS 1001站点
                            IsAllow = commonStackerCrane.Communicator.Read<short>("DB2.0.0");
                        }
                        else if (task1001.SourceAddress == "SC01-002-000-002")//WMS 1002站点
                        {
                            IsAllow = commonStackerCrane.Communicator.Read<short>("DB2.8.0");
                        }
                        if (IsAllow == 1)//如果为1,则允计AGV进入,回传WMS
                        {
                            MESSendCMD sendcmd = new MESSendCMD { cmd = 2001, task_id = task1001.TaskNum, status = 6 };
                            MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
                            if (res != null && res.code != 0)
                            {
                                IsAllow = commonStackerCrane.Communicator.Read<short>("DB2.0.0");
                                WriteDebug(nameof(CommonStackerCraneJob), $"允计AGV进入提升机,回传WMS失败!任务号{task1001.TaskNum}");
                            }
                            else if (task1001.SourceAddress == "SC01-002-000-002")//WMS 1002站点
                            else
                            {
                                IsAllow = commonStackerCrane.Communicator.Read<short>("DB2.8.0");
                            }
                            if (IsAllow == 1)//如果为1,则允计AGV进入,回传WMS
                            {
                                MESSendCMD sendcmd = new MESSendCMD { cmd = 2001, task_id = task1001.TaskNum, status = 6 };
                                MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
                                if (res != null && res.code != 0)
                                {
                                    WriteDebug(nameof(CommonStackerCraneJob), $"提升机提升完成,回传WMS失败!任务号{task1001.TaskNum}");
                                }
                                WriteDebug(nameof(CommonStackerCraneJob), $"允计AGV进入提升机,回传WMS成功!任务号{task1001.TaskNum}");
                            }
                        }
                        Dt_Task? task3001 = _taskService.QueryStackerCraneTaskByAGVPutFinish("SC01");
                        if (task3001 != null)
                        else
                        {
                            int IsFinish = 0;
                            int IsWriteOne = 0;
                            int IsWriteTwo = 0;
                            if (task3001.SourceAddress == "SC01-002-000-001")//WMS 1001站点
                            WriteDebug(nameof(CommonStackerCraneJob), $"未读取到提升机允计进入信号,暂不允计AGV进入提升机,任务号{task1001.TaskNum}");
                        }
                    }
                    Dt_Task? task3001 = _taskService.QueryStackerCraneTaskByAGVPutFinish("SC01");
                    if (task3001 != null)
                    {
                        int IsFinish = 0;
                        int IsWriteOne = 0;
                        int IsWriteTwo = 0;
                        if (task3001.SourceAddress == "SC01-002-000-001")//WMS 1001站点
                        {
                            //提升机是否处于就绪状态
                            int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0");
                            WriteDebug(nameof(CommonStackerCraneJob), $"提升机状态:{IsReady}任务号:{task3001.TaskNum}");
                            //写入提升信息
                            IsWriteOne = commonStackerCrane.Communicator.Read<short>("DB1.0.0");
                            if (IsWriteOne == 0 && IsReady == 1)
                            {
                                //提升机是否处于就绪状态
                                int IsReady= commonStackerCrane.Communicator.Read<short>("DB2.0.0");
                                //写入提升信息
                                IsWriteOne = commonStackerCrane.Communicator.Read<short>("DB1.0.0");
                                if(IsWriteOne == 0&& IsReady == 1)
                                {
                                   commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1);
                                }
                                //读取提升机信号,确定是否提升完成
                              IsFinish=  commonStackerCrane.Communicator.Read<short>("DB2.2.0");
                                commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1);
                            }
                            else if (task3001.SourceAddress == "SC01-002-000-002")//WMS 1002站点
                            else
                            {
                                //提升机是否处于就绪状态
                                int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0");
                                //写入提升信息
                                IsWriteTwo = commonStackerCrane.Communicator.Read<short>("DB1.6.0");
                                if (IsWriteTwo == 0 && IsReady == 1)
                                {
                                    commonStackerCrane.Communicator.Write<short>("DB1.6.0", 1);
                                }
                                //读取提升机信号,确定是否提升完成
                                IsFinish = commonStackerCrane.Communicator.Read<short>("DB2.10.0");
                                WriteDebug(nameof(CommonStackerCraneJob), $"未写入提升信号,可能是已写入或者提升机未处理就绪状态,任务号:{task3001.TaskNum}");
                            }
                            if (IsFinish == 1)//如果为1,则表示提升完成,回传WMS
                            {
                                MESSendCMD sendcmd = new MESSendCMD { cmd = 2002, task_id = task3001.TaskNum, status = 6 };
                                MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
                                string inparam = JsonConvert.SerializeObject(sendcmd);
                                WriteDebug(nameof(CommonStackerCraneJob), $"提升机提升完成,回传WMS,入参:{inparam}");
                            //读取提升机信号,确定是否提升完成
                                if (res != null && res.code != 0)
                                {
                                    WriteDebug(nameof(CommonStackerCraneJob), $"提升机提升完成,回传WMS失败!任务号{task3001.TaskNum}");
                                }
                            IsFinish = commonStackerCrane.Communicator.Read<short>("DB2.2.0");
                        }
                        else if (task3001.SourceAddress == "SC01-002-000-002")//WMS 1002站点
                        {
                            //提升机是否处于就绪状态
                            int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0");
                            WriteDebug(nameof(CommonStackerCraneJob), $"提升机状态:{IsReady}任务号:{task3001.TaskNum}");
                            //写入提升信息
                            IsWriteTwo = commonStackerCrane.Communicator.Read<short>("DB1.6.0");
                            if (IsWriteTwo == 0 && IsReady == 1)
                            {
                                commonStackerCrane.Communicator.Write<short>("DB1.6.0", 1);
                            }
                            else
                            {
                                WriteDebug(nameof(CommonStackerCraneJob), $"未写入提升信号,可能是信号已写入或者提升机未处理就绪状态,任务号:{task3001.TaskNum}");
                            }
                            //读取提升机信号,确定是否提升完成
                            IsFinish = commonStackerCrane.Communicator.Read<short>("DB2.10.0");
                        }
                        if (IsFinish == 1)//如果为1,则表示提升完成,回传WMS
                        {
                            MESSendCMD sendcmd = new MESSendCMD { cmd = 2002, task_id = task3001.TaskNum, status = 6 };
                            MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
                            string inparam = JsonConvert.SerializeObject(sendcmd);
                            WriteDebug(nameof(CommonStackerCraneJob), $"提升机提升完成,回传WMS,入参:{inparam}");
                            if (res != null && res.code != 0)
                            {
                                WriteDebug(nameof(CommonStackerCraneJob), $"提升机提升完成,回传WMS失败!任务号{task3001.TaskNum}");
                            }
                        }
                        //小堆垛机出库完成任务
                        Dt_Task? taskSmall = _taskService.QueryStackerCraneFinishTask();
                        if(taskSmall != null)
                        else
                        {
                            //根据任务源地址确定写入PLC位置 Depth
                            Dt_LocationInfo location = _locationInfoRepository.QueryFirst(x=>x.LocationCode==taskSmall.SourceAddress);
                            if(location != null)
                            WriteDebug(nameof(CommonStackerCraneJob), $"提升机提升中...,任务号:{task3001.TaskNum}");
                        }
                    }
                    //小堆垛机出库完成任务
                    Dt_Task? taskSmall = _taskService.QueryStackerCraneFinishTask();
                    if (taskSmall != null)
                    {
                        //根据任务源地址确定写入PLC位置 Depth
                        Dt_LocationInfo location = _locationInfoRepository.QueryFirst(x => x.LocationCode == taskSmall.SourceAddress);
                        if (location != null)
                        {
                            string[] Levels = taskSmall.Remark.Split("-");
                            if (Levels.Length == 2)
                            {
                                string[] Levels = taskSmall.Remark.Split("-");
                                if (Levels.Length == 2)
                                if (!string.IsNullOrEmpty(Levels[0]) && !string.IsNullOrEmpty(Levels[1]))
                                {
                                    if (!string.IsNullOrEmpty(Levels[0]) && !string.IsNullOrEmpty(Levels[1]))
                                    int level = Convert.ToInt16(Levels[0]) - Convert.ToInt16(Levels[1]);
                                    //剩余层数写入
                                    bool issuccess = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth + ".0", Convert.ToInt16(level));
                                    WriteDebug(nameof(CommonStackerCraneJob), $"剩余层数信号写入{level}-任务号{taskSmall.TaskNum}");
                                    //如果当前提取层数等于总层数,则表示料车所有的层数取完
                                    if (level == 0)
                                    {
                                        int level = Convert.ToInt16(Levels[0]) - Convert.ToInt16(Levels[1]);
                                        //剩余层数写入
                                        bool issuccess = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth + ".0", Convert.ToInt16(level));
                                        WriteDebug(nameof(CommonStackerCraneJob), $"剩余层数信号写入{level}-任务号{taskSmall.TaskNum}");
                                        //如果当前提取层数等于总层数,则表示料车所有的层数取完
                                        if (level == 0)
                                        //源地址(暂存位)对应的目标地址(组立机)location.Remark
                                        if (!string.IsNullOrEmpty(location.Remark))
                                        {
                                            //源地址(暂存位)对应的目标地址(组立机)location.Remark
                                            if (!string.IsNullOrEmpty(location.Remark))
                                            {
                                                //根据目标地址查询组立机站点信息,获取写入整车完成的DB块 Depth
                                                Dt_LocationInfo location2 = _locationInfoRepository.QueryFirst(x => x.LocationCode == location.Remark);
                                            //根据目标地址查询组立机站点信息,获取写入整车完成的DB块 Depth
                                            Dt_LocationInfo location2 = _locationInfoRepository.QueryFirst(x => x.LocationCode == location.Remark);
                                            //整车完成写入层数
                                            int sn = 0;
                                            if(taskSmall.SourceAddress== "SC01-001-006-001"|| taskSmall.SourceAddress == "SC01-001-012-001"|| taskSmall.SourceAddress == "SC01-001-018-001" || taskSmall.SourceAddress == "SC01-001-022-001"|| taskSmall.SourceAddress == "SC01-001-026-001")
                                            if (taskSmall.SourceAddress == "SC01-001-006-001" || taskSmall.SourceAddress == "SC01-001-012-001" || taskSmall.SourceAddress == "SC01-001-018-001" || taskSmall.SourceAddress == "SC01-001-022-001" || taskSmall.SourceAddress == "SC01-001-026-001")
                                            {
                                                sn = 1;
                                            }
                                            else if(taskSmall.SourceAddress == "SC01-001-007-001" || taskSmall.SourceAddress == "SC01-001-013-001" || taskSmall.SourceAddress == "SC01-001-019-001" || taskSmall.SourceAddress == "SC01-001-023-001" || taskSmall.SourceAddress == "SC01-001-027-001")
                                            else if (taskSmall.SourceAddress == "SC01-001-007-001" || taskSmall.SourceAddress == "SC01-001-013-001" || taskSmall.SourceAddress == "SC01-001-019-001" || taskSmall.SourceAddress == "SC01-001-023-001" || taskSmall.SourceAddress == "SC01-001-027-001")
                                            {
                                                sn = 2;
                                            }
@@ -227,45 +251,45 @@
                                            {
                                                sn = 3;
                                            }
                                            bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location2.Depth+".0", Convert.ToInt16(sn));
                                                if (issuccess2&&issuccess)
                                                {
                                                    _taskService.UpdateTaskStatus(taskSmall.TaskId, (int)TaskOutStatusEnum.OutFinish);
                                                    _taskExecuteDetailService.AddTaskExecuteDetail(taskSmall.TaskId, $"出库任务完成");
                                                }
                                                else
                                                {
                                                    WriteDebug(nameof(CommonStackerCraneJob), $"整车完成信号写入失败!任务号{taskSmall.TaskNum}");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (issuccess)
                                            bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location2.Depth + ".0", Convert.ToInt16(sn));
                                            if (issuccess2 && issuccess)
                                            {
                                                _taskService.UpdateTaskStatus(taskSmall.TaskId, (int)TaskOutStatusEnum.OutFinish);
                                                _taskExecuteDetailService.AddTaskExecuteDetail(taskSmall.TaskId, $"出库任务完成");
                                            }
                                            else
                                            {
                                                WriteDebug(nameof(CommonStackerCraneJob), $"剩余层数信号写入失败!任务号{taskSmall.TaskNum}");
                                                WriteDebug(nameof(CommonStackerCraneJob), $"整车完成信号写入失败!任务号{taskSmall.TaskNum}");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (issuccess)
                                        {
                                            _taskService.UpdateTaskStatus(taskSmall.TaskId, (int)TaskOutStatusEnum.OutFinish);
                                            _taskExecuteDetailService.AddTaskExecuteDetail(taskSmall.TaskId, $"出库任务完成");
                                        }
                                        else
                                        {
                                            WriteDebug(nameof(CommonStackerCraneJob), $"剩余层数信号写入失败!任务号{taskSmall.TaskNum}");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                }
                catch (Exception ex)
                {
                    WriteError(nameof(CommonStackerCraneJob), "查询或写入PLC状态失败!", ex);
                }
            }
            catch (Exception ex)
            {
                WriteError(nameof(CommonStackerCraneJob), "查询或写入PLC状态失败!", ex);
            }
            WriteDebug("大堆垛机运行日志", "结束时间" + DateTime.Now);
            //});
            return Task.CompletedTask;