dengjunjie
2026-03-10 4d0371aa548eb7b5e1678b2036da95bb322d2cf1
优化出入库完成反馈WMS
已修改2个文件
98 ■■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSInOutBoundCompleteFeedback.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSInOutBoundCompleteFeedback.cs
@@ -15,6 +15,18 @@
        /// ä»»åŠ¡å·
        /// </summary>
        public string taskCode { get; set; }
        /// <summary>
        /// ä¸Šæ¸¸é”™è¯¯æè¿°
        /// </summary>
        public string memo { get; set; }
        /// <summary>
        /// ä¸Šæ¸¸çŠ¶æ€ç 
        /// </summary>
        public string custStatus { get; set; }
        /// <summary>
        /// ä»»åŠ¡çŠ¶æ€ï¼š1-执行中,2-完成,3-失败 4-起点完成
        /// </summary>
        public int status { get; set; }
        /// <summary>
        /// å®¹å™¨ç¼–码
@@ -35,12 +47,12 @@
        /// ä¸šåŠ¡ç±»åž‹
        /// 1-面料;2-成品;3-裁剪;4-配套
        /// </summary>
        public int? businessType { get; set; }
        //public int? businessType { get; set; }
        /// <summary>
        /// å®Œæˆç±»åž‹
        /// 1-自动完成;2-手动完成
        /// </summary>
        public int completeType { get; set; } = 1;
        //public int completeType { get; set; } = 1;
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs
@@ -59,7 +59,8 @@
                            break;
                        default:
                            task.TaskState = ReturnTaskStatus(gALAXIS.taskStatus, deviceTypeEnum);
                            BaseDal.UpdateData(task);
                            if (gALAXIS.taskStatus == 10) TaskFeedback(task, 1);
                            else BaseDal.UpdateData(task);
                            break;
                    }
                }
@@ -215,10 +216,11 @@
            try
            {
                dt_Task.TaskState = TaskStatusEnum.TakeFinish.ObjToInt();
                Db.Ado.BeginTran();
                TaskFeedback(dt_Task, 4);
                //Db.Ado.BeginTran();
                UpdateLocationStatus(dt_Task.SourceAddress, dt_Task.PalletCode, deviceTypeEnum, LocationStatusEnum.Free);
                BaseDal.UpdateData(dt_Task);
                Db.Ado.CommitTran();
                //BaseDal.UpdateData(dt_Task);
                //Db.Ado.CommitTran();
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
@@ -240,45 +242,17 @@
        {
            try
            {
                WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
                WMSReturn agvContent = null;
                dt_Task.TaskState = TaskStatusEnum.Finish.ObjToInt();
                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
                if (apiInfo == null) dt_Task.ExceptionMessage = "未找到出入库完成反馈WMS接口配置信息!请检查接口配置";
                else
                {
                    boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
                    boundCompleteFeedback.containerCode = dt_Task.PalletCode;
                    boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
                    boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
                    switch (deviceTypeEnum)
                    {
                        case DeviceTypeEnum.GALAXIS:
                            boundCompleteFeedback.businessType = 1;
                            break;
                        case DeviceTypeEnum.YuanLiJuHe:
                            boundCompleteFeedback.businessType = 2;
                            break;
                    }
                    boundCompleteFeedback.completeType = 1;
                    string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
                    agvContent = response.DeserializeObject<WMSReturn>();
                    if (agvContent.code != 0) dt_Task.ExceptionMessage = agvContent.msg;
                }
                Db.Ado.BeginTran();
                TaskFeedback(dt_Task, 2);
                //Db.Ado.BeginTran();
                UpdateLocationStatus(dt_Task.TargetAddress, dt_Task.PalletCode, deviceTypeEnum, LocationStatusEnum.InStock);
                if (agvContent != null && agvContent.code == 0)
                    BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.自动完成);
                else
                    BaseDal.UpdateData(dt_Task);
                Db.Ado.CommitTran();
                //Db.Ado.CommitTran();
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                Db.Ado.RollbackTran();
                //Db.Ado.RollbackTran();
                throw new Exception(ex.Message);
            }
        }
@@ -361,5 +335,39 @@
            }
        }
        #endregion
        #region ä¸ŠæŠ¥WMS
        public WebResponseContent TaskFeedback(Dt_Task dt_Task, int Status)
        {
            WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
            WMSReturn agvContent = null;
            try
            {
                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
                if (apiInfo == null) dt_Task.ExceptionMessage = "未找到出入库完成反馈WMS接口配置信息!请检查接口配置";
                else
                {
                    boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
                    boundCompleteFeedback.containerCode = dt_Task.PalletCode;
                    boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
                    boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
                    boundCompleteFeedback.status = Status;
                    boundCompleteFeedback.custStatus = "";
                    string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
                    agvContent = response.DeserializeObject<WMSReturn>();
                    if (agvContent.code != 0) dt_Task.ExceptionMessage = agvContent.msg;
                }
            }
            catch (Exception ex)
            {
                dt_Task.ExceptionMessage = ex.Message;
            }
            if (agvContent != null && agvContent.code == 0 && Status == 2)
                BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.自动完成);
            else
                BaseDal.UpdateData(dt_Task);
            return WebResponseContent.Instance.OK();
        }
        #endregion
    }
}