分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-04-16 e883d7e4bf057f7a2ed7cc001fe27083d82baa22
优化NG下料位任务触发逻辑
已修改12个文件
288 ■■■■ 文件已修改
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/extension/widesea_wms/system/dt_stationinfo.js 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/views/Task/widesea_wms/taskinfo/dt_agvtask.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/views/dialog/addTask.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Client/src/views/widesea_wms/system/dt_stationinfo.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/IServices/system/Partial/Idt_stationinfoService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_stationinfoController.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -829,12 +829,11 @@
                            if (Stationinfo == null)
                            {
                                //var stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
                                //if (stationinfo != null)
                                //{
                                //    agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), "TaskType_OutsourceInbound");
                                //}
                                Stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
                                #region è§¦å‘NG任务
                                var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
                                if (NG != null)
                                        agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound");
                                #endregion
                            }
                            if (Stationinfo != null)
                            {
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs
@@ -9,12 +9,14 @@
using WIDESEA_Core.BaseProvider;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Entity.ToAGV;
using WIDESEA_WCS.IRepositories;
using WIDESEA_WCS.Repositories;
using WIDESEA_WCS.WCSClient;
using WIDESEA_WMS.IRepositories;
using WIDESEA_WMS.IServices;
using WIDESEA_WMS.Repositories;
using static FreeSql.Internal.GlobalFilter;
namespace WIDESEA_WCS.JobsPart.Common
{
@@ -100,6 +102,27 @@
                            #endregion
                        }
                    }
                    else if (task.agv_tasktype == "TaskType_OutsourceInbound")//下料去外协口
                    {
                        if (task.agv_toaddress == "")
                        {
                            var TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
                            if (TargetLocation != null)
                            {
                                if (agvtaskService.Find(x => x.agv_toaddress == TargetLocation.stationCode).Any()) continue;
                                var stationinfo = stationinfoRepository.Find(x => x.stationCode == task.agv_fromaddress).FirstOrDefault();
                                task.agv_taskstate = "Create";
                                task.agv_toaddress = TargetLocation.stationCode;
                                TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
                                TargetLocation.billetID = stationinfo.billetID;
                                TargetLocation.stationType = task.agv_materielid;
                                TargetLocation.heatNumber = stationinfo.heatNumber;
                                TargetLocation.Number = task.jobID;
                                stationinfoRepository.Update(TargetLocation, true);
                                agvtaskService.Update(task, true);
                            }
                        }
                    }
                    else if (task.agv_tasktype == "TaskType_OutsourceOutbound" || task.agv_tasktype == "TaskType_Outbound")//外协库出库/AB库出库
                    {
                        if (task.agv_toaddress == "")
´úÂë¹ÜÀí/WMS/WMS_Client/src/extension/widesea_wms/system/dt_stationinfo.js
@@ -110,14 +110,14 @@
              });
          }
      })
        this.buttons.splice(1, 0, {
          name: "移库",
          icon: 'el-icon-document',
          type: 'danger',
          onClick: function () {
              this.$refs.gridHeader.detialBox = true;
          }
      })
      //   this.buttons.splice(1, 0, {
      //     name: "移库",
      //     icon: 'el-icon-document',
      //     type: 'danger',
      //     onClick: function () {
      //         this.$refs.gridHeader.detialBox = true;
      //     }
      // })
    },
    onInited() {
      //框架初始化配置后
´úÂë¹ÜÀí/WMS/WMS_Client/src/views/Task/widesea_wms/taskinfo/dt_agvtask.vue
@@ -30,10 +30,23 @@
                sortName: "ID"
            });
            const editFormFields = ref({"agv_fromaddress":"","agv_toaddress":"","agv_tasktype":"","agv_grades":"","agv_code":""});
            const editFormOptions = ref([[{"title":"起点地址","field":"agv_fromaddress","type":"text","required":true}],
                              [{"title":"终点地址","field":"agv_toaddress","type":"text","required":true}],
                              [{"dataKey":"task_grade","data":[],"title":"任务等级","required":true,"field":"agv_grade","type":"select"}],
                              [{"dataKey":"agv_tasktypes","data":[],"title":"任务类型","required":true,"field":"agv_tasktype","type":"select"}]
            const editFormOptions = ref([[{
        title: "NG下料位",
        required: false,
        field: "agv_fromaddress",
        type: "select",
        data: [
          { key: "X01001003", value: "1单元NG下料位" },
          { key: "X02001003", value: "2单元NG下料位" },
          { key: "X03001002", value: "3单元NG下料位" }
        ]
      },
    //   {"title":"NG下料位","field":"agv_fromaddress","type":"text","required":true}
    ],
                            //   [{"title":"终点地址","field":"agv_toaddress","type":"text","required":true}],
                            //   [{"dataKey":"task_grade","data":[],"title":"任务等级","required":true,"field":"agv_grade","type":"select"}],
                            //   [{"dataKey":"agv_tasktypes","data":[],"title":"任务类型","required":true,"field":"agv_tasktype","type":"select"}]
                            //   [{"dataKey":"agv_code","data":[],"title":"AGV编号","required":true,"field":"agv_code","type":"select"}]
                            ]);
            const searchFormFields = ref({"agv_tasknum":"","agv_fromaddress":"","agv_toaddress":"","agv_tasktype":[],"agv_taskstate":[],"agv_materielid":"","agv_createtime":"","agv_barcode":"","agv_materbarcode":""});
´úÂë¹ÜÀí/WMS/WMS_Client/src/views/dialog/addTask.vue
@@ -51,8 +51,9 @@
            detialBox: false,
            inType: "handle",
            rules: {
                from_address: [{ required: true, message: '请选择起始地址', trigger: 'blur' }],
                to_address: [{ required: true, message: '请选择目的地址', trigger: 'blur' }]
                from_address: [{ required: true, message: '请选择NG下料位', trigger: 'blur' }],
                // from_address: [{ required: true, message: '请选择起始地址', trigger: 'blur' }],
                // to_address: [{ required: true, message: '请选择目的地址', trigger: 'blur' }]
            },
            formdata: {
                from_address: "",
@@ -67,9 +68,9 @@
            var _this = this;
            this.$refs.ruleFormRef.validate((valid) => {
                if (valid) {
                    _this.http.post("/api/ToMes/AddToFloat3", _this.formdata, "正在移库....").then(x => {
                    _this.http.post("/api/ToMes/AddToFloat3", _this.formdata, "正在添加....").then(x => {
                        if (!x.status) return _this.$Message.error(x.message);
                        _this.$Message.success("移库成功!");
                        _this.$Message.success("添加成功!");
                        _this.refresh();
                    });
                }
´úÂë¹ÜÀí/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js
@@ -39,7 +39,7 @@
        this.buttons.forEach(x => {
          if(x.value == 'Add')
          {
            x.name = '添加任务'
            x.name = 'NG任务'
          }
        });
        //示例:设置修改新建、编辑弹出框字段标签的长度
´úÂë¹ÜÀí/WMS/WMS_Client/src/views/widesea_wms/system/dt_stationinfo.vue
@@ -40,7 +40,7 @@
                              [{"title":"炉号","field":"heatNumber","type":"text"}],
                              [{"title":"备注","field":"remark"}]]);
            const searchFormFields = ref({"stationCode":"","stationType":"","area":"","enable":"","location_state":[],"bindSN":""});
            const searchFormOptions = ref([[{"title":"缓存架编号","field":"stationCode","type":"like"},{"title":"车轮SN号","field":"bindSN","type":"like"},{"dataKey":"materielinfos","data":[],"title":"物料类型","field":"stationType","type":"select"}],[{"dataKey":"area_name","data":[],"title":"区域","field":"area","type":"select"},{"dataKey":"location_states","data":[],"title":"货位状态","field":"location_state","type":"selectList"},{"dataKey":"status","data":[],"title":"是否启用","field":"enable","type":"select"}]]);
            const searchFormOptions = ref([[{"title":"缓存架编号","field":"stationCode","type":"like"},{"title":"车轮SN号","field":"bindSN","type":"like"},{"dataKey":"materielinfos","data":[],"title":"物料类型","field":"stationType","type":"select"}],[{"dataKey":"area_name","data":[],"title":"区域","field":"area","type":"selectList"},{"dataKey":"location_states","data":[],"title":"货位状态","field":"location_state","type":"selectList"},{"dataKey":"status","data":[],"title":"是否启用","field":"enable","type":"select"}]]);
            const columns = ref([{field:'id',title:'id',type:'guid',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'stationCode',title:'缓存架编号',type:'string',width:110,align:'left',sort:true},
                       {field:'stationType',title:'图号',type:'string',bind:{ key:'materielinfos',data:[]},width:110,align:'left'},
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/IServices/system/Partial/Idt_stationinfoService.cs
@@ -10,5 +10,6 @@
    public partial interface Idt_stationinfoService
    {
        WebResponseContent SetStationEnable(object parm);
        WebResponseContent SendAGVTask(object parm);
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs
@@ -25,6 +25,7 @@
using WIDESEA_Core.ManageUser;
using WIDESEA_Comm.LogInfo;
using StackExchange.Redis;
using WIDESEA_Comm;
namespace WIDESEA_WMS.Services
{
@@ -45,63 +46,118 @@
            //多租户会用到这init代码,其他情况可以不用
            //base.Init(dbRepository);
        }
        /// <summary>
        /// æ·»åŠ ä»»åŠ¡
        /// </summary>
        /// <param name="saveDataModel"></param>
        /// <returns></returns>
        #region æ·»åŠ NG任务
        public override WebResponseContent Add(SaveModel saveDataModel)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var fromaddress = saveDataModel.MainData["agv_fromaddress"].ToString();
                VOLContext context = new VOLContext();
                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
                var fromaddress = saveDataModel.MainData["agv_fromaddress"].ToString();
                var toaddress = saveDataModel.MainData["agv_toaddress"].ToString();
                var tasktype = saveDataModel.MainData["agv_tasktype"].ToString();
                var grade = saveDataModel.MainData["agv_grade"].ToInt();
                var worktype = saveDataModel.MainData["agv_worktype"].ToInt();
                var station1 = stationinfoRepository.FindFirst(x => x.stationCode == fromaddress);
                var station2 = stationinfoRepository.FindFirst(x => x.stationCode == toaddress);
                if (station1 == null || station2 == null)
                    throw new Exception($"起点地址{fromaddress}或终点地址{toaddress}不存在!");
                if (string.IsNullOrEmpty(station1.stationType))
                    throw new Exception($"起点{fromaddress}未绑定物料类型!");
                var task = _repository.Find(t => t.agv_fromaddress == fromaddress
                       || t.agv_fromaddress == toaddress
                       || t.agv_toaddress == fromaddress
                       || t.agv_toaddress == toaddress
                       ).Any();
                if (task)
                    throw new Exception("起始或目的地址,已存在任务中!");
                dt_agvtask agvtask = new dt_agvtask();
                agvtask.agv_id = Guid.NewGuid();
                agvtask.agv_fromaddress = fromaddress;
                agvtask.agv_toaddress = toaddress;
                agvtask.agv_tasknum = IdenxManager.GetTaskNo("KH-");
                agvtask.agv_TrayStatus = station1.tray_status;
                agvtask.agv_Traytype = station1.tray_type;
                agvtask.agv_taskstate = AGVTaskStateEnum.Create.ToString();
                agvtask.agv_tasktype = tasktype;
                agvtask.agv_worktype = worktype;//工作类型
                agvtask.bindSN = station1.bindSN;
                agvtask.agv_materielid = station1.stationType;//物料类型
                agvtask.agv_qty = station1.quantity;
                agvtask.agv_createtime = DateTime.Now;
                agvtask.agv_grade = grade;//任务优先级
                agvtask.agv_userid = UserContext.Current.UserName;
                IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
                var station = stationinfoRepository.Find(x => x.stationCode == fromaddress).FirstOrDefault();
                if (_repository.Find(x => x.agv_fromaddress == fromaddress || x.agv_toaddress == fromaddress).Any())
                    throw new Exception($"货位{fromaddress}已存在任务!");
                if (station == null) throw new Exception($"未找到货位{fromaddress}!");
                if (!station.enable) throw new Exception($"货位{fromaddress}未启用!");
                if (station.quantity < 1) throw new Exception($"货位{fromaddress}无车轮!");
                var Work = workinfoRepository.Find(x => x.workOrder == station.Number && x.processCode == "17").FirstOrDefault();
                if (Work == null) throw new Exception($"未找到货位{fromaddress}的机加工工单信息");
                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 = "Queue",
                    agv_materielid = station.stationType,
                    agv_qty = station.quantity,
                    agv_tasktype = "TaskType_OutsourceInbound",
                    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
                };
                _repository.Add(agvtask, true);
                station.location_state = LocationStateEnum.InBusy.ToString();
                stationinfoRepository.Update(station, true);
                content.OK();
                WriteDBLog.Success($"手动添加任务", new { æ•°æ® = saveDataModel }, "WMS", UserContext.Current.UserName);
            }
            catch (Exception ex)
            {
                WriteDBLog.Error($"手动添加任务", new { æ•°æ® = saveDataModel, å¼‚常信息 = ex.Message }, "WMS", UserContext.Current.UserName);
                content.Error(ex.Message);
                content.Message = ex.Message;
            }
            return content;
        }
        #endregion
        #region æ·»åŠ ä»»åŠ¡
        /// <summary>
        /// æ·»åŠ ä»»åŠ¡
        /// </summary>
        /// <param name="saveDataModel"></param>
        /// <returns></returns>
        //public override WebResponseContent Add(SaveModel saveDataModel)
        //{
        //    WebResponseContent content = new WebResponseContent();
        //    try
        //    {
        //        VOLContext context = new VOLContext();
        //        Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
        //        var fromaddress = saveDataModel.MainData["agv_fromaddress"].ToString();
        //        var toaddress = saveDataModel.MainData["agv_toaddress"].ToString();
        //        var tasktype = saveDataModel.MainData["agv_tasktype"].ToString();
        //        var grade = saveDataModel.MainData["agv_grade"].ToInt();
        //        var worktype = saveDataModel.MainData["agv_worktype"].ToInt();
        //        var station1 = stationinfoRepository.FindFirst(x => x.stationCode == fromaddress);
        //        var station2 = stationinfoRepository.FindFirst(x => x.stationCode == toaddress);
        //        if (station1 == null || station2 == null)
        //            throw new Exception($"起点地址{fromaddress}或终点地址{toaddress}不存在!");
        //        if (string.IsNullOrEmpty(station1.stationType))
        //            throw new Exception($"起点{fromaddress}未绑定物料类型!");
        //        var task = _repository.Find(t => t.agv_fromaddress == fromaddress
        //               || t.agv_fromaddress == toaddress
        //               || t.agv_toaddress == fromaddress
        //               || t.agv_toaddress == toaddress
        //               ).Any();
        //        if (task)
        //            throw new Exception("起始或目的地址,已存在任务中!");
        //        dt_agvtask agvtask = new dt_agvtask();
        //        agvtask.agv_id = Guid.NewGuid();
        //        agvtask.agv_fromaddress = fromaddress;
        //        agvtask.agv_toaddress = toaddress;
        //        agvtask.agv_tasknum = IdenxManager.GetTaskNo("KH-");
        //        agvtask.agv_TrayStatus = station1.tray_status;
        //        agvtask.agv_Traytype = station1.tray_type;
        //        agvtask.agv_taskstate = AGVTaskStateEnum.Create.ToString();
        //        agvtask.agv_tasktype = tasktype;
        //        agvtask.agv_worktype = worktype;//工作类型
        //        agvtask.bindSN = station1.bindSN;
        //        agvtask.agv_materielid = station1.stationType;//物料类型
        //        agvtask.agv_qty = station1.quantity;
        //        agvtask.agv_createtime = DateTime.Now;
        //        agvtask.agv_grade = grade;//任务优先级
        //        agvtask.agv_userid = UserContext.Current.UserName;
        //        _repository.Add(agvtask, true);
        //        content.OK();
        //        WriteDBLog.Success($"手动添加任务", new { æ•°æ® = saveDataModel }, "WMS", UserContext.Current.UserName);
        //    }
        //    catch (Exception ex)
        //    {
        //        WriteDBLog.Error($"手动添加任务", new { æ•°æ® = saveDataModel, å¼‚常信息 = ex.Message }, "WMS", UserContext.Current.UserName);
        //        content.Error(ex.Message);
        //    }
        //    return content;
        //}
        #endregion
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_inventoryService.cs
@@ -17,6 +17,10 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using WIDESEA_WMS.IRepositories;
using System.Configuration;
using WIDESEA_Comm.LogInfo;
using WIDESEA_Core.ManageUser;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
namespace WIDESEA_WMS.Services
{
@@ -37,5 +41,29 @@
            //多租户会用到这init代码,其他情况可以不用
            //base.Init(dbRepository);
        }
  }
        public override WebResponseContent Del(object[] keys, bool delList = true)
        {
            WebResponseContent content = new WebResponseContent();
            string str = "";
            try
            {
                List<string> KeyList = new List<string>();
                foreach ( string key in keys )
                {
                    KeyList.Add(key);
                }
                var inventoryList= _repository.Find(x=>KeyList.Contains(x.ID.ToString())).ToList();
                 str = $"{string.Join('、', inventoryList.Select(t => t.SN).ToArray())}";
                content = base.Del(keys, delList);
                WriteDBLog.Write($"手动删除库存 ", str, LogState.Sucess, "WMS", UserContext.Current.UserName);
            }
            catch (Exception ex)
            {
                WriteDBLog.Write($"手动删除库存 ", new { é”™è¯¯ä¿¡æ¯ = ex.Message, æ•°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName);
            }
            return content;
        }
    }
}
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WMS/Services/system/Partial/dt_stationinfoService.cs
@@ -59,7 +59,7 @@
            WebResponseContent webResponse = new WebResponseContent();
            try
            {
                var Tel = UserContext.Current.UserInfo.Tel;//缓存架权限
                var Tel = UserContext.Current.UserInfo.Tel;
                var data = JsonConvert.DeserializeObject<Parm>(json.ToString());
                //var updateList = FreeDB.DB.Select<dt_stationinfo>().Where(t => data.data.Contains(t.id.ToString())).ToList();
                var updateList = _repository.Find(x => data.data.Contains(x.id.ToString())).ToList();
@@ -95,11 +95,28 @@
            }
            return webResponse;
        }
        public WebResponseContent SendAGVTask(object json)
        {
            WebResponseContent webResponse = new WebResponseContent();
            try
            {
            }
            catch (Exception ex)
            {
            }
            return webResponse;
        }
        public override WebResponseContent Add(SaveModel saveDataModel)
        {
            return base.Add(saveDataModel);
        }
        public override WebResponseContent Update(SaveModel saveModel)
        {
@@ -135,6 +152,7 @@
                station.stationType = string.Empty;
                station.heatNumber = string.Empty;
                station.Number = string.Empty;
                station.billetID = string.Empty;
                station.tray_status = string.Empty;
                station.bindSN = string.Empty;
                station.quantity = 0;
´úÂë¹ÜÀí/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_stationinfoController.cs
@@ -41,5 +41,16 @@
        {
            return dt_stationinfoService.Instance.SetStationEnable(parm);
        }
        /// <summary>
        /// ä¸‹å‘NG任务
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        [HttpPost, Route("SendAGVTask")]
        public WebResponseContent SendAGVTask([FromBody] object parm)
        {
            return dt_stationinfoService.Instance.SendAGVTask(parm);
        }
    }
}