分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-21 2d3d006620bb15a2350c516f050058e5f84c7bf8
添加人工一键下料功能,人工一键切换托盘功能,优化任务等级
已修改9个文件
已添加1个文件
372 ■■■■■ 文件已修改
代码管理/WMS/WMS_Client/config/buttons.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/dist.zip 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/api/http.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/extension/widesea_wms/system/dt_stationinfo.js 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/IServices/system/Partial/Idt_stationinfoService.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/agvTransferList.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_stationinfoController.cs 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WMS_Client/config/buttons.js
@@ -80,6 +80,50 @@
    onClick: function () {
        this.Upload();
    }
}, {
    name: "下料任务",
    icon: 'el-icon-plus',
    value: 'AddTask',
    class: '',
     plain:true,
    type: 'success',
    // plain:true,
    onClick: function () {
        this.addTask();
    }
}, {
    name: "取消禁用",
    icon: 'ios-cog',
    value: 'EnableBtn',
    class: '',
    //  plain:true,
    type: 'success',
    // plain:true,
    onClick: function () {
        // this.addTask();
    }
}
, {
    name: "禁用",
    icon: 'ios-cog',
    value: 'DisEnableBtn',
    class: '',
    //  plain:true,
    type: 'danger',
    onClick: function () {
        // this.addTask();
    }
}, {
    name: "切换托盘",
    icon: 'el-icon-edit',
    value: 'Trayswitching',
    class: '',
     plain:true,
    type: 'danger',
    // plain:true,
    onClick: function () {
        // this.addTask();
    }
}
    // , {
    //     name: "数据结构",
´úÂë¹ÜÀí/WMS/WMS_Client/dist.zip
Binary files differ
´úÂë¹ÜÀí/WMS/WMS_Client/src/api/http.js
@@ -12,7 +12,7 @@
let loadingInstance;
let loadingStatus = false;
if (process.env.NODE_ENV == 'development') {
    axios.defaults.baseURL = 'http://192.168.12.101:8098/';
    axios.defaults.baseURL = 'http://127.0.0.1:8098/';
}
else if (process.env.NODE_ENV == 'debug') {
    axios.defaults.baseURL = 'http://192.168.12.101:8098/';
´úÂë¹ÜÀí/WMS/WMS_Client/src/extension/widesea_wms/system/dt_stationinfo.js
@@ -38,6 +38,69 @@
        //     x.icon='el-icon-document'
        //   }
        // });
        let AddTaskBtn = this.buttons.find(r => r.name == "下料任务");
        if(null!=AddTaskBtn){
          AddTaskBtn.onClick = function (){
            let rows = this.$refs.table.getSelected();
            if (rows.length == 0) return this.$error("请选择下料位!");
            let addkeys = rows.map(x => {
                return x[this.table.key];
            });
            if (!addkeys || addkeys.Length == 0) return this.$error("未获取到下料位!");
            this.$confirm("是否确认要添加下料任务?","提示",{
                        // iconClass:"el-icon-success",//el-icon-remove自定义图标样式
                        confirmButtonText:"确认",//确认按钮文字更换
                        cancelButtonText:"取消",//取消按钮文字更换
                        // cancelBtn:"取消",//取消按钮文字更换
                        showClose: true,//是否显示右上角关闭按钮
                        type: "warning",//提示类型 success:成功/info:信息/warning:警告/error:报错
            }).then(()=>{
              let params = {
                MainData: null,
                DetailData: null,
                DelKeys: addkeys
            }
            this.http.post("/api/dt_stationinfo/SendAGVTask", params, "正在添加任务....").then(x => {
                if (!x.status) return this.$error(x.message);
                this.$success(x.message);
                this.refresh();
            });
            })
          }
        }
        let TrayswitchingBtn = this.buttons.find(r => r.name == "切换托盘");
        if(null!=TrayswitchingBtn){
          TrayswitchingBtn.onClick = function (){
            let rows = this.$refs.table.getSelected();
            if (rows.length == 0) return this.$error("请选择下料位!");
            let addkeys = rows.map(x => {
                return x[this.table.key];
            });
            if (!addkeys || addkeys.Length == 0) return this.$error("未获取到下料位!");
            this.$confirm("是否确认切换托盘?","提示",{
                        // iconClass:"el-icon-success",//el-icon-remove自定义图标样式
                        confirmButtonText:"确认",//确认按钮文字更换
                        cancelButtonText:"取消",//取消按钮文字更换
                        // cancelBtn:"取消",//取消按钮文字更换
                        showClose: true,//是否显示右上角关闭按钮
                        type: "warning",//提示类型 success:成功/info:信息/warning:警告/error:报错
            }).then(()=>{
              let params = {
                MainData: null,
                DetailData: null,
                DelKeys: addkeys
            }
            this.http.post("/api/dt_stationinfo/Trayswitching", params, "正在切换....").then(x => {
                if (!x.status) return this.$error(x.message);
                this.$success(x.message);
                this.refresh();
            });
            })
          }
        }
        //示例:设置修改新建、编辑弹出框字段标签的长度
        // this.boxOptions.labelWidth = 150;
@@ -47,11 +110,10 @@
            row.sort=true;
          }
        })
        this.buttons.splice(1, 0, {
          name: "取消禁用",
          icon: 'md-refresh',
          type: 'primary',
          onClick: function () {
        let EnableBtn = this.buttons.find(r => r.name == "取消禁用");
        if(null!=EnableBtn){
          EnableBtn.onClick = function (){
              let rows = this.$refs.table.getSelected();
              if (rows.length == 0) return this.$error("请选择要取消禁用的数据");
@@ -77,13 +139,42 @@
                  })
              });
          }
      })
        }
      this.buttons.splice(1, 0, {
          name: "禁用",
          icon: 'md-refresh',
          type: 'danger',
          onClick: function () {
      //   this.buttons.splice(1, 0, {
      //     name: "取消禁用",
      //     icon: 'md-refresh',
      //     type: 'primary',
      //     onClick: function () {
      //         let rows = this.$refs.table.getSelected();
      //         if (rows.length == 0) return this.$error("请选择要取消禁用的数据");
      //         this.$confirm('确认要取消禁用吗?', '警告', {
      //             confirmButtonText: '确定',
      //             cancelButtonText: '取消',
      //             type: 'warning',
      //             center: true
      //         }).then(() => {
      //             let data = [];
      //             let parm = {
      //                 "data": data,
      //                 "type": "1"
      //             }
      //             rows.forEach(t => data.push(t.id))
      //             this.http.post("/api/dt_stationinfo/SetStationEnable", parm, "取消禁用中...").then(x => {
      //                 if (x.status) {
      //                     this.$Message.success("取消禁用成功!");
      //                     this.refresh();
      //                 } else {
      //                     this.$Message.error(x.message);
      //                 }
      //             })
      //         });
      //     }
      // })
      let DisEnableBtn = this.buttons.find(r => r.name == "禁用");
        if(null!=DisEnableBtn){
          DisEnableBtn.onClick = function (){
              let rows = this.$refs.table.getSelected();
              if (rows.length == 0) return this.$error("请选择要禁用的数据");
@@ -109,7 +200,39 @@
                  })
              });
          }
      })
        }
      // this.buttons.splice(1, 0, {
      //     name: "禁用",
      //     icon: 'md-refresh',
      //     type: 'danger',
      //     onClick: function () {
      //         let rows = this.$refs.table.getSelected();
      //         if (rows.length == 0) return this.$error("请选择要禁用的数据");
      //         this.$confirm('确认要禁用吗?', '警告', {
      //             confirmButtonText: '确定',
      //             cancelButtonText: '取消',
      //             type: 'warning',
      //             center: true
      //         }).then(() => {
      //             let data = [];
      //             let parm = {
      //                 "data": data,
      //                 "type": "0"
      //             }
      //             rows.forEach(t => data.push(t.id))
      //             this.http.post("/api/dt_stationinfo/SetStationEnable", parm, "锁定中...").then(x => {
      //                 if (x.status) {
      //                     this.$Message.success("禁用成功!");
      //                     this.refresh();
      //                 } else {
      //                     this.$Message.error(x.message);
      //                 }
      //             })
      //         });
      //     }
      // })
      //   this.buttons.splice(1, 0, {
      //     name: "移库",
      //     icon: 'el-icon-document',
´úÂë¹ÜÀí/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js
@@ -27,6 +27,7 @@
  // }
  add(){
    this.$refs.gridHeader.detialBox = true;
  },
     //下面这些方法可以保留也可以删除
    onInit() {  //框架初始化配置前,
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/IServices/system/Partial/Idt_stationinfoService.cs
@@ -10,7 +10,8 @@
    public partial interface Idt_stationinfoService
    {
        WebResponseContent SetStationEnable(object parm);
        WebResponseContent SendAGVTask(object parm);
        WebResponseContent SendAGVTask(SaveModel saveModel);
        WebResponseContent dt_stationinfolist();
        WebResponseContent Trayswitching(SaveModel saveModel);
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs
@@ -25,6 +25,9 @@
using static System.Collections.Specialized.BitVector32;
using WIDESEA_Core.EFDbContext;
using WIDESEA_WMS.Repositories;
using WIDESEA_Comm;
using WIDESEA_Comm.TaskNo;
using WIDESEA_Common;
namespace WIDESEA_WMS.Services
{
@@ -97,17 +100,159 @@
            }
            return webResponse;
        }
        public WebResponseContent SendAGVTask(object json)
        /// <summary>
        /// åˆ‡æ¢æ‰˜ç›˜
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        public WebResponseContent Trayswitching(SaveModel saveModel)
        {
            WebResponseContent webResponse = new WebResponseContent();
            VOLContext context = new VOLContext();
            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
            IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
            string completor = UserContext.Current.UserName;
            foreach (var Key in saveModel.DelKeys)
            {
            try
            {
                    var station = repository.Find(x => x.id.ToString() == Key.ToString()).FirstOrDefault();
                    if (!station.stationCode.Contains("X")) throw new Exception($"无{station.stationCode}使用权限!");
                    if (!station.enable) throw new Exception($"{station.stationCode}未启用!");
                    if (station.location_state == LocationStateEnum.Abnormal.ToString()) throw new Exception($"{station.stationCode}状态异常!");
                    if (station.location_state == LocationStateEnum.Empty.ToString()) throw new Exception($"{station.stationCode}状态为空!");
                    if (station.remark == "桁架下料") throw new Exception($"{station.stationCode}桁架正在下料!");
                    if (agvtaskRepository.Find(x => x.agv_toaddress == station.stationCode).Any()) throw new Exception($"{station.stationCode}存在任务!");
                    if (!agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode).Any())
                    {
                        #region ä¸ºç©ºæ‰˜å¹¶ä¸”数量为0,创建取空托任务
                        if (station.tray_status == TrayStateEnum.EmptyTray.ToString() && station.quantity == 0)
                        {
                            dt_agvtask agvtask = new dt_agvtask()
                            {
                                agv_fromaddress = station.stationCode,
                                agv_id = Guid.NewGuid(),
                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                agv_grade = 1,
                                agv_createtime = DateTime.Now,
                                agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
                                agv_qty = 1,
                                StarQuantity = 0,
                                EndQuantity = 0,//EmptyStation.quantity,
                                agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
                                agv_toaddress = "",
                                agv_userid = UserContext.Current.UserName,
                                agv_TrayStatus = station.tray_status,
                                agv_Traytype = station.tray_type
                            };
                            agvtaskRepository.Add(agvtask, true);
                            station.location_state = LocationStateEnum.Busy.ToString();
                        }
                        #endregion
                        #region åˆ›å»ºå…¥åº“任务
                        else if (station.location_state == LocationStateEnum.Stroge.ToString() && station.quantity > 0)
                        {
                            var Work = workinfoRepository.Find(x => x.workOrder == station.Number && x.processCode == "17").FirstOrDefault();
                            if (Work == null) throw new Exception($"未找到货位{station.stationCode}的机加工工单信息!");
                            dt_agvtask agvtask = new dt_agvtask()
                            {
                                agv_fromaddress = station.stationCode,
                                agv_id = Guid.NewGuid(),
                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                                agv_grade = 1,
                                agv_createtime = DateTime.Now,
                                agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
                                agv_materielid = station.stationType,
                                agv_qty = station.quantity,
                                agv_tasktype = station.stationCode.Contains("3") ? AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString() : AGVTaskTypeEnum.TaskType_Inbound.ToString(),
                                agv_toaddress = "",
                                agv_userid = UserContext.Current.UserName,
                                bindSN = station.bindSN,
                                agv_worktype = Convert.ToInt32(Work.processCode),
                                agv_materbarcode = Work.materialCode,
                                agv_Traytype = station.tray_type,
                                jobID = station.Number,
                                agv_TrayStatus = station.tray_status
                            };
                            agvtaskRepository.Add(agvtask, true);
                            station.location_state = LocationStateEnum.InBusy.ToString();
                        }
                        #endregion
                    }
                    station.tray_type = station.tray_type == TrayTypeEnum.SmallTray.ToString() ? TrayTypeEnum.LargeTray.ToString() : TrayTypeEnum.SmallTray.ToString();
                    repository.Update(station, x => new { x.location_state, x.tray_type }, true);
                    webResponse.OK(webResponse.Message += $"{station.stationCode}切换成功!");
            }
            catch (Exception ex)
            {
                    webResponse.Error(webResponse.Message += ex.Message);
                }
            }
            return webResponse;
        }
        /// <summary>
        /// ä¸‹æ–™ä»»åŠ¡
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        public WebResponseContent SendAGVTask(SaveModel saveModel)
        {
            WebResponseContent webResponse = new WebResponseContent();
            VOLContext context = new VOLContext();
            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
            IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
            string completor = UserContext.Current.UserName;
            foreach (var Key in saveModel.DelKeys)
            {
                try
                {
                    var station = repository.Find(x => x.id.ToString() == Key.ToString()).FirstOrDefault();
                    if (!station.stationCode.Contains("X")) throw new Exception($"无{station.stationCode}使用权限!");
                    if (!station.enable) throw new Exception($"{station.stationCode}未启用!");
                    if (station.location_state == LocationStateEnum.Abnormal.ToString()) throw new Exception($"{station.stationCode}状态异常!");
                    if (station.location_state == LocationStateEnum.Empty.ToString()) throw new Exception($"{station.stationCode}状态为空!");
                    if (station.tray_status == TrayStateEnum.EmptyTray.ToString()) throw new Exception($"{station.stationCode}为空托盘!");
                    if (station.quantity < 1) throw new Exception($"{station.stationCode}数量少于1!");
                    if (station.remark == "桁架下料") throw new Exception($"{station.stationCode}桁架正在下料!");
                    //if (station.location_state.Contains("Busy")) throw new Exception($"{station.stationCode}占用!");
                    if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_fromaddress == station.stationCode).Any()) throw new Exception($"{station.stationCode}存在任务!");
                    var Work = workinfoRepository.Find(x => x.workOrder == station.Number && x.processCode == "17").FirstOrDefault();
                    if (Work == null) throw new Exception($"未找到货位{station.stationCode}的机加工工单信息!");
                    dt_agvtask agvtask = new dt_agvtask()
                    {
                        agv_fromaddress = station.stationCode,
                        agv_id = Guid.NewGuid(),
                        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                        agv_grade = 1,
                        agv_createtime = DateTime.Now,
                        agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
                        agv_materielid = station.stationType,
                        agv_qty = station.quantity,
                        agv_tasktype = station.stationCode.Contains("3") ? AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString() : AGVTaskTypeEnum.TaskType_Inbound.ToString(),
                        agv_toaddress = "",
                        agv_userid = UserContext.Current.UserName,
                        bindSN = station.bindSN,
                        agv_worktype = Convert.ToInt32(Work.processCode),
                        agv_materbarcode = Work.materialCode,
                        agv_Traytype = station.tray_type,
                        jobID = station.Number,
                        agv_TrayStatus = station.tray_status
                    };
                    agvtaskRepository.Add(agvtask, true);
                    station.location_state = LocationStateEnum.InBusy.ToString();
                    repository.Update(station, x => new { x.location_state }, true);
                    webResponse.OK(webResponse.Message += $"{station.stationCode}任务添加成功!");
                }
                catch (Exception ex)
                {
                    webResponse.Error(webResponse.Message += ex.Message);
                }
            }
            return webResponse;
        }
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/ToMes/agvTransferList.cs
@@ -90,7 +90,7 @@
                        agv_fromaddress = station.stationCode,
                        agv_id = Guid.NewGuid(),
                        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                        agv_grade = 1,
                        agv_grade = 0,
                        agv_createtime = DateTime.Now,
                        agv_taskstate = "Queue",
                        agv_materielid = station.stationType,
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs
@@ -65,7 +65,7 @@
                    agv_fromaddress = station1.stationCode,
                    agv_id = Guid.NewGuid(),
                    agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
                    agv_grade = 1,
                    agv_grade = 0,
                    agv_createtime = DateTime.Now,
                    agv_taskstate = "Create",
                    agv_materielid = station1.stationType,
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_stationinfoController.cs
@@ -13,6 +13,7 @@
using WIDESEA_WMS.IServices;
using WIDESEA_Core.Utilities;
using WIDESEA_WMS.Services;
using Microsoft.AspNetCore.Authorization;
namespace WIDESEA_WMS.Controllers
{
@@ -43,14 +44,25 @@
        }
        /// <summary>
        /// ä¸‹å‘NG任务
        /// ä¸‹æ–™ä»»åŠ¡
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        [HttpPost, Route("SendAGVTask")]
        public WebResponseContent SendAGVTask([FromBody] object parm)
        [HttpPost, Authorize, Route("SendAGVTask"),AllowAnonymous]
        public WebResponseContent SendAGVTask([FromBody] SaveModel saveModel)
        {
            return dt_stationinfoService.Instance.SendAGVTask(parm);
            return dt_stationinfoService.Instance.SendAGVTask(saveModel);
        }
        /// <summary>
        /// åˆ‡æ¢æ‰˜ç›˜
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        [HttpPost, Authorize, Route("Trayswitching"), AllowAnonymous]
        public WebResponseContent Trayswitching([FromBody] SaveModel saveModel)
        {
            return dt_stationinfoService.Instance.Trayswitching(saveModel);
        }
        /// <summary>