更新代码,取消MES出库单号同步标识,平库转立库功能,寄售周期判断取消,精品标识等
| | |
| | | var newTasksIn = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType>=TaskTypeEnum.Inbound.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | if (newTasksIn.Count>0) |
| | | { |
| | | foreach (var task in newTasksIn) |
| | | { |
| | | try |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | task.CurrentAddress = GetAGVAddress(task.CurrentAddress); |
| | | else |
| | | task.NextAddress = GetAGVAddress(task.NextAddress); |
| | | AgvTaskDTO taskDTO = new AgvTaskDTO() |
| | | { |
| | | TaskCode = task.AgvTaskNum, |
| | | ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, |
| | | TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", |
| | | ctnrCode = task.PalletCode, |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.CurrentAddress |
| | | }, |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.NextAddress |
| | | } |
| | | } |
| | | }; |
| | | if (taskDTO.TaskTyp== "CPC") |
| | | { |
| | | taskDTO.Priority = task.Grade.ToString(); |
| | | } |
| | | if (task.GroupId.IsNotEmptyOrNull()) |
| | | { |
| | | taskDTO.GroupId=task.GroupId; |
| | | } |
| | | if (task.TaskType==TaskTypeEnum.OutMesRworkProduct.ObjToInt()) |
| | | { |
| | | taskDTO.Priority = "127"; |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); |
| | | } |
| | | Thread.Sleep(500); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | } |
| | | } |
| | | if (newTasksIn.Count > 0) |
| | | { |
| | | _taskService.UpdateData(newTasksIn); |
| | | } |
| | | SendAgvTasks(newTasksIn); |
| | | } |
| | | } |
| | | #endregion |
| | | DateTime _taskStartTime = DateTime.Today; |
| | | #region åºåºæ¨éä»»å¡1线 |
| | | { |
| | | var newTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress=="5236").OrderByDescending(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); |
| | | //ææ¶é´æ¥æ¾ |
| | | var timeTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5236" && x.CreateDate<= _taskStartTime).OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList(); |
| | | |
| | | //æ°åå»ºä»»å¡ |
| | | var newTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress=="5236").OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList(); |
| | | |
| | | var pushTasks1= timeTasksOut1.Count<=0 ? newTasksOut1 : timeTasksOut1; |
| | | //å½å线ä½ä»»å¡ |
| | | var downTasksOut1 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5236").ToList(); |
| | | |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5236"); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | short stationCurrentStatus = device.Communicator.Read<short>("DB29.112"); |
| | | if (newTasksOut1.Count > 0 && downTasksOut1.Count <= 0 && stationCurrentStatus == 1) |
| | | if (pushTasks1.Count > 0 && downTasksOut1.Count <= 0 && stationCurrentStatus == 1) |
| | | { |
| | | foreach (var task in newTasksOut1) |
| | | { |
| | | try |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | task.CurrentAddress = GetAGVAddress(task.CurrentAddress); |
| | | else |
| | | task.NextAddress = GetAGVAddress(task.NextAddress); |
| | | AgvTaskDTO taskDTO = new AgvTaskDTO() |
| | | { |
| | | TaskCode = task.AgvTaskNum, |
| | | ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, |
| | | TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", |
| | | ctnrCode = task.PalletCode, |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.CurrentAddress |
| | | }, |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.NextAddress |
| | | } |
| | | } |
| | | }; |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | taskDTO.Priority = task.Grade.ToString(); |
| | | } |
| | | if (task.GroupId.IsNotEmptyOrNull()) |
| | | { |
| | | taskDTO.GroupId = task.GroupId; |
| | | } |
| | | if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) |
| | | { |
| | | taskDTO.Priority = "127"; |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | } |
| | | } |
| | | if (newTasksOut1.Count > 0) |
| | | { |
| | | _taskService.UpdateData(newTasksOut1); |
| | | } |
| | | WriteInfo("5236", $"1线5236æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}å¯ä¸åï¼ä¸åä»»å¡ï¼{newTasksOut1.Select(x => x.TaskNum)}"); |
| | | SendAgvTasks(pushTasks1); |
| | | WriteInfo("5236", $"1线5236æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}å¯ä¸åï¼ä¸åä»»å¡ï¼{pushTasks1.Select(x => x.TaskNum)}"); |
| | | } |
| | | } |
| | | |
| | |
| | | #endregion |
| | | #region åºåºæ¨éä»»å¡2线 |
| | | { |
| | | var newTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").OrderByDescending(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); |
| | | //ææ¶é´æ¥æ¾ |
| | | var timeTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243" && x.CreateDate <= _taskStartTime).OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList(); |
| | | |
| | | //æ°åå»ºä»»å¡ |
| | | var newTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList(); |
| | | |
| | | var pushTasks2 = timeTasksOut2.Count <= 0 ? newTasksOut2 : timeTasksOut2; |
| | | |
| | | //å½å线ä½ä»»å¡ |
| | | var downTasksOut2 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").ToList(); |
| | | |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5243"); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | short stationCurrentStatus = device.Communicator.Read<short>("DB29.126"); |
| | | if (newTasksOut2.Count > 0 && downTasksOut2.Count <= 0 && stationCurrentStatus == 1) |
| | | if (pushTasks2.Count > 0 && downTasksOut2.Count <= 0 && stationCurrentStatus == 1) |
| | | { |
| | | foreach (var task in newTasksOut2) |
| | | { |
| | | try |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | task.CurrentAddress = GetAGVAddress(task.CurrentAddress); |
| | | else |
| | | task.NextAddress = GetAGVAddress(task.NextAddress); |
| | | AgvTaskDTO taskDTO = new AgvTaskDTO() |
| | | { |
| | | TaskCode = task.AgvTaskNum, |
| | | ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, |
| | | TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", |
| | | ctnrCode = task.PalletCode, |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.CurrentAddress |
| | | }, |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.NextAddress |
| | | SendAgvTasks(pushTasks2); |
| | | WriteInfo("5243", $"2线5243æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}å¯ä¸åï¼ä¸åä»»å¡ï¼{pushTasks2.Select(x => x.TaskNum)}"); |
| | | } |
| | | } |
| | | }; |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | taskDTO.Priority = task.Grade.ToString(); |
| | | } |
| | | if (task.GroupId.IsNotEmptyOrNull()) |
| | | { |
| | | taskDTO.GroupId = task.GroupId; |
| | | } |
| | | if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) |
| | | { |
| | | taskDTO.Priority = "127"; |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | } |
| | | } |
| | | if (newTasksOut2.Count > 0) |
| | | { |
| | | _taskService.UpdateData(newTasksOut2); |
| | | } |
| | | WriteInfo("5243", $"2线5243æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}å¯ä¸åï¼ä¸åä»»å¡ï¼{newTasksOut2.Select(x => x.TaskNum)}"); |
| | | } |
| | | //else |
| | | //{ |
| | | // WriteInfo(nameof(AGV_CPJob), $"2线æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}"); |
| | | //} |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | #region åºåºæ¨éä»»å¡3线 |
| | | { |
| | | var newTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").OrderByDescending(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); |
| | | //ææ¶é´æ¥æ¾ |
| | | var timeTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250" && x.CreateDate <= _taskStartTime).OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList(); |
| | | |
| | | //æ°åå»ºä»»å¡ |
| | | var newTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").OrderByDescending(x => x.Grade).ThenBy(x => x.CreateDate).Take(5).ToList(); |
| | | |
| | | var pushTasks3 = timeTasksOut3.Count <= 0 ? newTasksOut3 : timeTasksOut3; |
| | | |
| | | //å½å线ä½ä»»å¡ |
| | | var downTasksOut3 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").ToList(); |
| | | |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5250"); |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device != null) |
| | | { |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | short stationCurrentStatus = device.Communicator.Read<short>("DB29.140"); |
| | | if (newTasksOut3.Count > 0 && downTasksOut3.Count <= 0 && stationCurrentStatus == 1) |
| | | if (pushTasks3.Count > 0 && downTasksOut3.Count <= 0 && stationCurrentStatus == 1) |
| | | { |
| | | foreach (var task in newTasksOut3) |
| | | { |
| | | try |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | task.CurrentAddress = GetAGVAddress(task.CurrentAddress); |
| | | else |
| | | task.NextAddress = GetAGVAddress(task.NextAddress); |
| | | AgvTaskDTO taskDTO = new AgvTaskDTO() |
| | | { |
| | | TaskCode = task.AgvTaskNum, |
| | | ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, |
| | | TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", |
| | | ctnrCode = task.PalletCode, |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.CurrentAddress |
| | | }, |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.NextAddress |
| | | SendAgvTasks(pushTasks3); |
| | | WriteInfo("5250", $"3线5250æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}å¯ä¸åï¼ä¸åä»»å¡ï¼{pushTasks3.Select(x => x.TaskNum)}"); |
| | | } |
| | | } |
| | | }; |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | taskDTO.Priority = task.Grade.ToString(); |
| | | } |
| | | if (task.GroupId.IsNotEmptyOrNull()) |
| | | { |
| | | taskDTO.GroupId = task.GroupId; |
| | | } |
| | | if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) |
| | | { |
| | | taskDTO.Priority = "127"; |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | } |
| | | } |
| | | if (newTasksOut3.Count > 0) |
| | | { |
| | | _taskService.UpdateData(newTasksOut3); |
| | | } |
| | | WriteInfo("5250", $"3线5250æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}å¯ä¸åï¼ä¸åä»»å¡ï¼{newTasksOut3.Select(x => x.TaskNum)}"); |
| | | } |
| | | //else |
| | | //{ |
| | | // WriteInfo(nameof(AGV_CPJob), $"3线æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}"); |
| | | //} |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// ä¸åAGVä»»å¡ |
| | | /// </summary> |
| | | /// <param name="tasks"></param> |
| | | public void SendAgvTasks(List<Dt_Task> tasks) |
| | | { |
| | | foreach (var task in tasks) |
| | | { |
| | | try |
| | | { |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | task.CurrentAddress = GetAGVAddress(task.CurrentAddress); |
| | | else |
| | | task.NextAddress = GetAGVAddress(task.NextAddress); |
| | | AgvTaskDTO taskDTO = new AgvTaskDTO() |
| | | { |
| | | TaskCode = task.AgvTaskNum, |
| | | ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, |
| | | TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", |
| | | ctnrCode = task.PalletCode, |
| | | PositionCodePath = new List<CodePath>() |
| | | { |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.CurrentAddress |
| | | }, |
| | | new CodePath() |
| | | { |
| | | type = "05", |
| | | positionCode = task.NextAddress |
| | | } |
| | | } |
| | | }; |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | taskDTO.Priority = task.Grade.ToString(); |
| | | } |
| | | if (task.GroupId.IsNotEmptyOrNull()) |
| | | { |
| | | taskDTO.GroupId = task.GroupId; |
| | | } |
| | | if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) |
| | | { |
| | | taskDTO.Priority = "127"; |
| | | } |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | if (taskDTO.TaskTyp == "CPC") |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | task.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | task.ExceptionMessage = ex.Message; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Exception); |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è·åAGVå°å |
| | | /// </summary> |
| | | /// <param name="Address"></param> |
| | |
| | | v-model="dialogFormVisible" |
| | | :on-model-close="closeCustomModel" |
| | | :lazy="true" |
| | | width="20%" |
| | | :padding="15" |
| | | width="25%" |
| | | :padding="20" |
| | | title="éæ©åºåºçº¿ä½" |
| | | > |
| | | <div> |
| | |
| | | formFields1: { |
| | | LineCode: "", |
| | | Grade: "0", |
| | | IsFineWorks: "0", |
| | | }, |
| | | formRules1:[[ |
| | | { |
| | |
| | | { |
| | | title: "æ¯å¦ä¼å
", |
| | | field: "Grade", |
| | | data: [], |
| | | required: false, |
| | | type: "switch", |
| | | }, |
| | | ], |
| | | [ |
| | | { |
| | | title: "æå®ç²¾å", |
| | | field: "IsFineWorks", |
| | | data: [], |
| | | required: false, |
| | | type: "switch", |
| | |
| | | var keys = this.selection.map((item) => item.id); // è·åéä¸è¡çid |
| | | |
| | | this.http |
| | | .post("api/Task/OutProductTask?stationCode="+this.formFields1.LineCode +"&grade="+this.formFields1.Grade, keys, "æ°æ®å¤çä¸") |
| | | .post("api/Task/OutProductTask?stationCode="+this.formFields1.LineCode +"&grade="+this.formFields1.Grade+"&isFineWorks="+this.formFields1.isFineWorks, keys, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.formFields1.LineCode=""; |
| | | this.formFields1.Grade="0"; |
| | | this.formFields1.isFineWorks="0"; |
| | | this.dialogFormVisible=false; |
| | | this.$parent.refresh(); |
| | | this.showDetialBox = false; |
| | |
| | | closeCustomModel() { |
| | | this.formFields1.LineCode=""; |
| | | this.formFields1.Grade="0"; |
| | | this.formFields1.isFineWorks="0"; |
| | | this.dialogFormVisible=false; |
| | | this.$parent.refresh(); |
| | | }, |
| | |
| | | :lazy="true" |
| | | width="600px" |
| | | :padding="15" |
| | | title="æå°" |
| | | title="æå¨ç§»åº" |
| | | > |
| | | <div> |
| | | <el-form> |
| | |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "isFineWorks", |
| | | title: "æ¯å¦ç²¾å", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | bind: { key: "enableEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "overInQuantity", |
| | | title: "䏿¶æ°é", |
| | | type: "string", |
| | |
| | | sortName: "id", |
| | | }); |
| | | const editFormFields = ref({ |
| | | deviceCode: "", |
| | | deviceName: "", |
| | | deviceType: "", |
| | | deviceStatus: "", |
| | | deviceIp: "", |
| | | devicePort: "", |
| | | devicePlcType: "", |
| | | deviceRemark: "", |
| | | |
| | | }); |
| | | const editFormOptions = ref([ |
| | | [ |
| | | { |
| | | title: "ç©æç¼å·", |
| | | required: true, |
| | | field: "materielCode", |
| | | type: "string", |
| | | }, |
| | | { |
| | | title: "åæ®ç¼å·", |
| | | required: true, |
| | | field: "materielName", |
| | | type: "string", |
| | | }, |
| | | { |
| | | title: "æ¹æ¬¡å·", |
| | | required: true, |
| | | field: "orderNo", |
| | | type: "string", |
| | | }, |
| | | { |
| | | title: "åºåå·", |
| | | required: true, |
| | | field: "serialNumber", |
| | | type: "string", |
| | | }, |
| | | ], |
| | | |
| | | ] |
| | | ]); |
| | | const searchFormFields = ref({ |
| | | materielCode: "", |
| | | materielName: "", |
| | | orderNo: "", |
| | | bagNo: "", |
| | | productCode: "", |
| | | isFineWorks: "", |
| | | productVersion: "", |
| | | dateCode: "", |
| | | lotNumber: "", |
| | | saleOrder: "", |
| | | createDate: "", |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "ç©æç¼å·", field: "materielCode" }, |
| | | { title: "ç©æåç§°", field: "materielName" }, |
| | | { title: "åæ®ç¼å·", field: "orderNo" }, |
| | | { title: "å
å
å·", field: "bagNo",type:"like" }, |
| | | { title: "产åç¼ç ", field: "productCode", type: "like" }, |
| | | { title: "æ¯å¦ç²¾å", field: "isFineWorks" ,type: "select", |
| | | dataKey: "enableEnum", |
| | | data: [],}, |
| | | { title: "çæ¬", field: "productVersion",type:"like" }, |
| | | ], |
| | | [ |
| | | |
| | | { title: "卿", field: "dateCode", type: "like" }, |
| | | { title: "æ¹æ¬¡", field: "lotNumber" , type: "like"}, |
| | | { title: "ERPå·¥å", field: "saleOrder" , type: "like"}, |
| | | { title: "å建æ¶é´", field: "createDate", type: "datetime" }, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "orderId", |
| | | title: "å
¥åºå主é®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "bagNo", |
| | | title: "å
å
å·", |
| | | type: "string", |
| | | width: 150, |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "isFineWorks", |
| | | title: "æ¯å¦ç²¾å", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | bind: { key: "enableEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "overInQuantity", |
| | |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | }, { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "creater", |
| | |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "modifyDate", |
| | |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "remark", |
| | |
| | | ], |
| | | ]); |
| | | const searchFormFields = ref({ |
| | | deviceCode: "", |
| | | pCode: "", |
| | | deviceType: "", |
| | | deviceStatus: "", |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "设å¤ç¼å·", field: "deviceCode" }, |
| | | { title: "产åç¼ç ", field: "pCode", type: "like" }, |
| | | { title: "设å¤ç±»å", field: "deviceType" }, |
| | | { title: "设å¤ç¶æ", field: "deviceStatus" }, |
| | | ], |
| | |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "rowId", |
| | | title: "åºåºåè¡å·", |
| | | type: "int", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "proOrderDetailStatus", |
| | | title: "订åæç»ç¶æ", |
| | | type: "int", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "saleOrder", |
| | | title: "éå®è®¢åå·", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "customer", |
| | | title: "客æ·", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "factoryCode", |
| | | title: "å·¥å", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "pCode", |
| | | title: "产åç¼ç ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "dateCode", |
| | | title: "产å卿", |
| | | type: "string", |
| | | width: 120, |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "pVer", |
| | | title: "产åçæ¬", |
| | | type: "string", |
| | | width: 200, |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "pLot", |
| | | title: "äº§åæ¹æ¬¡", |
| | | field: "saleOrder", |
| | | title: "éå®è®¢åå·", |
| | | type: "string", |
| | | width: 200, |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "qtyPcs", |
| | | title: "åæ ¼PCSæ°", |
| | | field: "orderQuantity", |
| | | title: "åæ®æ°é", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | edit: { type: "number" }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "rowNo", |
| | | title: "è¡å·", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | edit: { type: "number" }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "lockQuantity", |
| | | title: "é宿°é", |
| | | type: "int", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "overQtyPcs", |
| | | field: "overOutQuantity", |
| | | title: "å·²åºæ°é", |
| | | type: "string", |
| | | width: 120, |
| | | width: 200, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "xQty", |
| | | title: "xæ¿æ°", |
| | | field: "proOrderDetailStatus", |
| | | title: "订åæç»ç¶æ", |
| | | type: "string", |
| | | width: 120, |
| | | width: 180, |
| | | align: "left", |
| | | bind: { key: "orderDetailStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "xSite", |
| | | title: "xæ¿ä½", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "unit", |
| | | title: "åä½", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "spareQty", |
| | | title: "å¤åæ°", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | |
| | | align: "left", |
| | | bind: { key: "proStockAttributeEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "isFineWorks", |
| | | title: "æ¯å¦ç²¾å", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | bind: { key: "enableEnum", data: [] }, |
| | | }, |
| | | // { |
| | | // field: "roadwayNo", |
| | | // title: "å··éç¼å·", |
| | |
| | | public List<MESBagDetail> BagDetails { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// MESå
å
å
¥åº |
| | | /// MESå¤å
å
¥åº |
| | | /// </summary> |
| | | public class MesBoxInfoModel |
| | | { |
| | |
| | | /// å
å
æç» |
| | | /// </summary> |
| | | public List<MESBagItem> BagItems { get; set; } |
| | | /// <summary> |
| | | /// æ¯å¦ç²¾å |
| | | /// </summary> |
| | | public int IsFineWorks { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// å
å
æç» |
| | |
| | | /// <summary> |
| | | /// åé
åºåå¤çè´§ä½æ°æ® |
| | | /// </summary> |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails); |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails, bool isFineWorks = false); |
| | | /// <summary> |
| | | /// åºåºä»»å¡æ°æ®å¤ç |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// æ¥æ¾å¯ç¨åºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos); |
| | | List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos, bool isFineWorks = false); |
| | | /// <summary> |
| | | /// è·åæååºå |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// æ¥æ¾å¯ç¨åºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ProOutOrderDetail proOutOrderDetail); |
| | | List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ProOutOrderDetail proOutOrderDetail, bool isFineWorks = false); |
| | | /// <summary> |
| | | /// è·ååºåºåºå |
| | | /// </summary> |
| | |
| | | /// MESæåå
å
ä¿¡æ¯æ¥æ¶ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel); |
| | | MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel, string formSign = ""); |
| | | /// <summary> |
| | | /// MESæåå¤å
ä¿¡æ¯æ¥æ¶ |
| | | /// </summary> |
| | |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade); |
| | | Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade, bool isFineWorks = false); |
| | | Task<WebResponseContent> OutProScrapTask(int[] keys, string StationCode, int Grade); |
| | | /// <summary> |
| | | /// æå使éåºå
¥ä» |
| | |
| | | { |
| | | //float stockMaxQty = stockInfo.Details.Max(x => x.StockQuantity); |
| | | //float stockMinQty = stockInfo.Details.Min(x => x.StockQuantity); |
| | | Dt_StockInfoDetail? addstockInfoDetail = stockInfo.Details?.FirstOrDefault(); |
| | | addstockInfoDetail.Id = 0; |
| | | addstockInfoDetail.StockQuantity = (takeStockOrderDetail.Qty - takeStockOrderDetail.SysQty); |
| | | addStockDetails.Add(addstockInfoDetail); |
| | | Dt_StockInfoDetail addstockInfoDetail = stockInfo.Details.OrderByDescending(x=>x.Id).FirstOrDefault(); |
| | | addstockInfoDetail.StockQuantity = takeStockOrderDetail.Qty; |
| | | updateStockDetails.Add(addstockInfoDetail); |
| | | } |
| | | else if (takeStockOrderDetail.Qty==0) //çäº |
| | | { |
| | |
| | | { |
| | | _stockInfoDetailRepository.DeleteAndMoveIntoHty(delStockDetails, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | } |
| | | if (addStockDetails.Count>0) |
| | | { |
| | | addStockDetails.ForEach(x => |
| | | { |
| | | x.Status = StockStatusEmun.çç¹åºå宿.ObjToInt(); |
| | | }); |
| | | _stockInfoDetailRepository.AddData(addStockDetails); |
| | | } |
| | | if (updateStockDetails.Count>0) |
| | | { |
| | | updateStockDetails.ForEach(x => |
| | |
| | | Createtime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Details = new List<TakeDetailsItem>() |
| | | }; |
| | | foreach (var item in takeStockOrderDetails) |
| | | foreach (var item in takeStockOrderDetails.Where(x=>x.Qty!=x.SysQty)) |
| | | { |
| | | TakeDetailsItem takeDetailsItem = new TakeDetailsItem() |
| | | { |
| | | MaterialsCode = item.MaterielCode, |
| | | LocationCode = item.LocationCode, |
| | | LocationCode = warehouse.WarehouseCode, |
| | | Lotno = item.BatchNo, |
| | | Sysqty = item.SysQty.ObjToDecimal(), |
| | | Qty = item.Qty.ObjToDecimal() |
| | |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "å
è£
æ¶é´")] |
| | | public DateTime PackingDate { get; set; } |
| | | /// <summary> |
| | | /// æ¯å¦ç²¾å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "æ¯å¦ç²¾å")] |
| | | public int IsFineWorks { get; set; } |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "éå®ææ´¾çæ¬")] |
| | | public string SpecifyVer { get; set; } |
| | | /// <summary> |
| | | /// æ¯å¦ç²¾å |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "æ¯å¦ç²¾å")] |
| | | public int IsFineWorks { get; set; } |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | |
| | | /// <summary> |
| | | /// åé
åºåå¤çè´§ä½æ°æ® |
| | | /// </summary> |
| | | public (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails) |
| | | public (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(List<Dt_ProOutOrderDetail> proOutOrderDetails, bool isFineWorks = false) |
| | | { |
| | | List<Dt_ProStockInfo> outStocks = new List<Dt_ProStockInfo>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | |
| | | { |
| | | float needQty = item.QtyPcs; |
| | | //æ¥æ¾å¯ç¨åºå |
| | | List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(proOutOrder.WarehouseId, item); |
| | | List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(proOutOrder.WarehouseId, item, isFineWorks); |
| | | if (!stockInfoss.Any()) |
| | | { |
| | | throw new Exception("æªæ¾å°å¯åé
åºå"); |
| | |
| | | _basicRepository = basicRepository; |
| | | } |
| | | //æ ¹æ®æç»æ°æ®æ¥æ¾å¯ç¨åºååºå |
| | | public List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos) |
| | | public List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos, bool isFineWorks = false) |
| | | { |
| | | List<Dt_ProStockInfo>? proStockInfos = null; |
| | | bool isCanLot= string.IsNullOrEmpty(proOutOrderDetail.PLot); |
| | | bool isCanDate = string.IsNullOrEmpty(proOutOrderDetail.DateCode); |
| | | bool isCanVer = string.IsNullOrEmpty(proOutOrderDetail.OutSpecifyVer); |
| | | ////夿客æ·åºå
¥è§å |
| | | //Dt_CustomerInfo customerInfo = _basicRepository.CustomerInfoRepository.QueryFirst(x=>x.Code== proOutOrderDetail.Customer); |
| | |
| | | v.ProductCode == proOutOrderDetail.PCode |
| | | && v.ProductVersion.StartsWith(proOutOrderDetail.PVer.Substring(0,1)) |
| | | && (isCanLot ? isCanLot : v.ProductCode == proOutOrderDetail.PLot) |
| | | && (isCanDate ? isCanDate : v.DateCode == proOutOrderDetail.DateCode) |
| | | && (isFineWorks ? !isCanLot : v.IsFineWorks == 1) |
| | | )) |
| | | .ToList(); |
| | | //} |
| | |
| | | return content; |
| | | } |
| | | //æ¥æ¾å¯ç¨åºå |
| | | public List<Dt_ProStockInfo> GetUseableStocks(int warehoseId,Dt_ProOutOrderDetail proOutOrderDetail) |
| | | public List<Dt_ProStockInfo> GetUseableStocks(int warehoseId,Dt_ProOutOrderDetail proOutOrderDetail, bool isFineWorks = false) |
| | | { |
| | | List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId); |
| | | return BaseDal.GetProStocks(proOutOrderDetail,locationCodes); |
| | | return BaseDal.GetProStocks(proOutOrderDetail,locationCodes, isFineWorks); |
| | | } |
| | | /// <summary> |
| | | /// MESæåºå¯ç¨åºå |
| | |
| | | { |
| | | List<Dt_ProStockInfo> assignOutStocks =new List<Dt_ProStockInfo>(); |
| | | bool isCanLot = string.IsNullOrEmpty(outOrderDetail.PLot); |
| | | bool isCanDate = string.IsNullOrEmpty(outOrderDetail.DateCode); |
| | | float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) |
| | | && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)) |
| | | .Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); |
| | | //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); |
| | | |
| | |
| | | Dt_ProStockInfo stockInfo = stockInfos[index]; |
| | | float useableStockQuantity = stockInfo.proStockInfoDetails |
| | | .Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0,1)) |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) |
| | | && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)) |
| | | .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity && useableStockQuantity >0) |
| | | { |
| | | stockInfo.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) |
| | | && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)).ToList().ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)).ToList().ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | needQuantity -= useableStockQuantity; |
| | | } |
| | | else |
| | |
| | | //满足æ¡ä»¶è¿è¡åé
|
| | | if ((x.StockPcsQty > x.OutboundQuantity) |
| | | && x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1)) |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot) |
| | | && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) |
| | | && (isCanLot ? isCanLot : x.ProductCode == outOrderDetail.PLot)) |
| | | { |
| | | if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) |
| | | { |
| | |
| | | index++; |
| | | } |
| | | } |
| | | #region æåå¯ç¨åºåä¸è¶³ä¸è¿è¡åé
|
| | | //else |
| | | //{ |
| | | // for (int i = 0; i < stockInfos.Count; i++) |
| | | // { |
| | | // Dt_ProStockInfo stockInfo = stockInfos[i]; |
| | | // float useableStockQuantity = stockInfo.proStockInfoDetails |
| | | // .Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion == outOrderDetail.PVer |
| | | // && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) |
| | | // && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) |
| | | // .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | // if (useableStockQuantity < needQuantity) |
| | | // { |
| | | // stockInfo.proStockInfoDetails.ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | // needQuantity -= useableStockQuantity; |
| | | // } |
| | | // else |
| | | // { |
| | | // stockInfo.proStockInfoDetails.ForEach(x => |
| | | // { |
| | | // if (x.StockPcsQty > x.OutboundQuantity && x.ProductCode == outOrderDetail.PCode && x.ProductVersion == outOrderDetail.PVer |
| | | // && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot) |
| | | // && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode)) |
| | | // { |
| | | // if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) |
| | | // { |
| | | // x.OutboundQuantity += needQuantity; |
| | | // needQuantity = 0; |
| | | // } |
| | | // else |
| | | // { |
| | | // needQuantity -= (x.StockPcsQty - x.OutboundQuantity); |
| | | // x.OutboundQuantity = x.StockPcsQty; |
| | | // } |
| | | // } |
| | | // }); |
| | | // } |
| | | // stockInfo.proStockInfoDetails.ForEach(x => |
| | | // { |
| | | // x.OutDetailSaleNo = outOrderDetail.SaleOrder; |
| | | // x.OutDetailId = outOrderDetail.Id; |
| | | // }); |
| | | // assignOutStocks.Add(stockInfo); |
| | | // } |
| | | //} |
| | | #endregion |
| | | residueQuantity = needQuantity; |
| | | return assignOutStocks; |
| | | } |
| | |
| | | /// MESæåå
¥åºåæ¥æ¶ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel) |
| | | public MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel, string formSign = "") |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | |
| | | ERPOrder = child.ERPOrder, |
| | | SaleOrder = child.SaleOrder, |
| | | MoNumber = child.MoNumber, |
| | | IsFineWorks=item.IsFineWorks, |
| | | }; |
| | | mesProInOrderDetails.Add(mesProInOrderDetail); |
| | | } |
| | |
| | | newTask.TaskId = taskId; |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | //ä¸ä¼ ERP |
| | | if (string.IsNullOrEmpty(formSign)) |
| | | { |
| | | WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); |
| | | _proInStatisticsService.SaveStatic(bagInfoModel); |
| | | if (!responseContent.Status) |
| | | { |
| | | //mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); |
| | |
| | | { |
| | | mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt(); |
| | | } |
| | | } |
| | | _proInStatisticsService.SaveStatic(bagInfoModel); |
| | | Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //æ¨éä»»å¡ |
| | |
| | | mesShipOrderDetails.Add(orderDetail); |
| | | MesShipmentOrderSync shipmentOrderSync = new MesShipmentOrderSync() |
| | | { |
| | | ShipmentOrder = proOutOrder.ProOutOrderNo+"-"+ outProStockInfo.TaskNum, |
| | | ShipmentOrder = proOutOrder.ProOutOrderNo, |
| | | PlantShipDate = proOutOrder.PlantShipDate.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Customer = proOutOrderDetail.EndCustomer, |
| | | FactoryCode = proOutOrderDetail.FactoryCode, |
| | |
| | | }); |
| | | //æ´æ°ä»»å¡ç¶æ |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | |
| | | FeedBackWCSTaskCompleted(taskNum); |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | |
| | | _inboundOrderService.FeedbackInboundOrder(inboundOrder.Id); |
| | | } |
| | | } |
| | | FeedBackWCSTaskCompleted(taskNum); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | x.ProOutDetailStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | }); |
| | | |
| | | #region todo:ä¸´æ¶æ´æ°ææç å转æå |
| | | if (proStockInfo.ProStockAttribute == ProStockAttributeEnum.ç å.ObjToInt()) |
| | | #region todo:ä¸´æ¶æ´æ°ææç åæå°¾æ°è½¬æå |
| | | if (proStockInfo.ProStockAttribute == ProStockAttributeEnum.ç å.ObjToInt() || proStockInfo.ProStockAttribute == ProStockAttributeEnum.å°¾æ°.ObjToInt()) |
| | | { |
| | | proStockInfo.ProStockAttribute = ProStockAttributeEnum.æå.ObjToInt(); |
| | | proStockInfo.WarehouseId = locationInfo.WarehouseId; |
| | |
| | | } |
| | | |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | |
| | | FeedBackWCSTaskCompleted(taskNum); |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutQuality.ObjToInt() || task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandPickOutbound.ObjToInt() || task.TaskType == TaskTypeEnum.MesHandOutbound.ObjToInt()) |
| | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | //PPåºåºä»»å¡å®æå¤æããããããããããããããããã |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA58.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | _outboundService.MesPPOutboundOrderService.Repository.UpdateData(mesPPOutboundOrders); |
| | | MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesPPOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesPPOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity)); |
| | | UploadMesMaterialLotaAcept(model); |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | } |
| | | //if (warehouse.WarehouseCode == WarehouseEnum.HA58.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | //{ |
| | | // _outboundService.MesPPOutboundOrderService.Repository.UpdateData(mesPPOutboundOrders); |
| | | // MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesPPOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesPPOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity)); |
| | | // UploadMesMaterialLotaAcept(model); |
| | | // _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | // _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | //} |
| | | if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString() && task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) |
| | | { |
| | | _outboundService.OutboundOrderService.TestOutUpload(outboundOrderDetails.FirstOrDefault().OrderId, outStockLockInfos); |
| | |
| | | MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, stockInfo.Details.Where(x => x.MaterielCode == mesOutboundOrders.FirstOrDefault().MaterialCode).Sum(x => x.StockQuantity)); |
| | | UploadMesMaterialLotaAcept(model); |
| | | } |
| | | FeedBackWCSTaskCompleted(taskNum); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | return content; |
| | | } |
| | | //æ¥åºåºåºå®æ |
| | | public WebResponseContent OutProScrapCompleted(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | return content.Error("æªæ¾å°æååºåºè¯¦æ
"); |
| | | } |
| | | //è·åæåæ¥åºå |
| | | |
| | | Dt_ErpProScrapSheet erpProScrapSheet = _outboundRepository.ErpProScrapSheetRepository.Db.Queryable<Dt_ErpProScrapSheet>().Where(x => x.ProScrapSheetOrderNo == outProStockInfo.OrderNo).Includes(x=>x.Details).First(); |
| | | if (erpProScrapSheet == null) |
| | | { |
| | |
| | | { |
| | | return content.Error($"æåæ¥åºåæç»è¡{erpProScrapSheetDetail.Id}已宿"); |
| | | } |
| | | erpProScrapSheetDetail.ScrapProDetailStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | |
| | | //è·åå½ååºå |
| | | Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.proStockInfoDetails).First(); |
| | | if (proStockInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°{task.PalletCode}åºåä¿¡æ¯"); |
| | | } |
| | | if (((int)outProStockInfo.AssignQuantity+erpProScrapSheetDetail.OverScrapPcsQty) == erpProScrapSheetDetail.ScrapPcsQty) |
| | | { |
| | | erpProScrapSheetDetail.OverScrapPcsQty += (int)outProStockInfo.AssignQuantity; |
| | | erpProScrapSheetDetail.ScrapProDetailStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | erpProScrapSheetDetail.OverScrapPcsQty += (int)outProStockInfo.AssignQuantity; |
| | | } |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = proStockInfo.proStockInfoDetails; |
| | | if (proStockInfoDetails.Count <= 0) |
| | | { |
| | |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade) |
| | | public async Task<WebResponseContent> OutProductTask(int[] keys, string StationCode, int Grade,bool isFineWorks=false) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) result = |
| | | OutProductTaskDataHandle(_ProOutOrderDetails); |
| | | OutProductTaskDataHandle(_ProOutOrderDetails, isFineWorks); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | proStockInfos.AddRange(result.Item2); |
| | |
| | | /// å¤çæååºåºæ°æ® |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(List<Dt_ProOutOrderDetail> proOutOrderDetails) |
| | | public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(List<Dt_ProOutOrderDetail> proOutOrderDetails, bool isFineWorks = false) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | |
| | | List<Dt_OutProStockInfo> outProStockInfos=new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | //åé
åºå |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProOutOrderDetailService.AssignProStockOut(proOutOrderDetails); |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProOutOrderDetailService.AssignProStockOut(proOutOrderDetails, isFineWorks); |
| | | if (result.Item1!=null&&result.Item1.Count>0) |
| | | { |
| | | //è·åæåå |
| | |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | |
| | | FeedBackWCSTaskCompleted(task.TaskNum); |
| | | _unitOfWorkManage.BeginTran(); |
| | | stockInfo.LocationCode = locationInfoEnd.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfoEnd, stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? WIDESEA_Core.Enums.OperateTypeEnum.äººå·¥å®æ : WIDESEA_Core.Enums.OperateTypeEnum.èªå¨å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | FeedBackWCSTaskCompleted(task.TaskNum); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | [HttpPost, Route("BagInfoSync"), AllowAnonymous] |
| | | public MesResponseContent BagInfoSync([FromBody] Root<MesBagInfoModel> model) |
| | | { |
| | | return _taskService.BagInfoSync(model.Content); |
| | | return _taskService.BagInfoSync(model.Content, model.From!="PK" ? "" : model.From); |
| | | } |
| | | /// <summary> |
| | | /// MESæåå¤å
ä¿¡æ¯æ¥æ¶ |
| | |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("OutProductTask"), AllowAnonymous] |
| | | public async Task<WebResponseContent> OutProductTask([FromBody] int[] keys, string StationCode, int Grade) |
| | | public async Task<WebResponseContent> OutProductTask([FromBody] int[] keys, string StationCode, int Grade,int isFineWorks=0) |
| | | { |
| | | return await Service.OutProductTask(keys, StationCode, Grade); |
| | | return await Service.OutProductTask(keys, StationCode, Grade,Convert.ToBoolean(isFineWorks)); |
| | | } |
| | | /// <summary> |
| | | /// æå使éåºå
¥ä» |