From 03c74ae770f67b38e48875065cc53cb3bd7161d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=99=94?= Date: Mon, 14 Aug 2023 16:01:26 +0800 Subject: [PATCH] =?UTF-8?q?AGV=E7=94=9F=E4=BA=A7=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E9=A2=86=E6=96=99=E8=A7=A3=E9=99=A4=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ICSManufactureService.cs | 4 +- .../ICSSoft.DataProject/ICSSubmitService.cs | 43 +++++++++++++++++++ .../ICSWareHouseLotInfoService.cs | 4 +- .../Controllers/WMSBarCoreController.cs | 37 ++++++++++++++++ 4 files changed, 85 insertions(+), 3 deletions(-) diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs index 2d9beb7..9bceecf 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs @@ -310,7 +310,9 @@ namespace ICSSoft.DataProject END UPDATE a SET MUSERNAME='{2}' FROM ICSMOApply a - WHERE a.ApplyCode='{0}' AND a.WorkPoint='{1}'"; + WHERE a.ApplyCode='{0}' AND a.WorkPoint='{1}' + update ICSContainerReceiptsNumber set EATTRIBUTE5='已解除' + where TransCode='{0}'"; sql = string.Format(sql, TransCode, WorkPoint, MuserName); diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs index 288642d..7d80b48 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs @@ -8717,5 +8717,48 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer } } #endregion + + #region 验证料架关联单据是否全部扫完 + public static DataTable ChkAGVDocStatus(OccupyDocModel JsonData) + { + var language = LanguageHelper.GetName("WMSAPIInfo"); + using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString)) + { + conn.Open(); + SqlCommand cmd = new SqlCommand(); + cmd.Connection = conn; + try + { + if (string.IsNullOrEmpty(JsonData.TransCode)) + { + throw new Exception(language.GetNameByCode("WMSAPIInfo001"));//"单据号不能为空!" + } + else if (string.IsNullOrEmpty(JsonData.WorkPoint)) + { + throw new Exception(language.GetNameByCode("WMSAPIInfo004"));//"站点不能为空!" + } + string sql = @"select EATTRIBUTE5 from ICSContainerReceiptsNumber + where ContainerCode=(select TOP 1 ContainerCode from ICSContainerReceiptsNumber + where TransCode='{0}' order by MTIME desc)"; + sql = string.Format(sql, JsonData.TransCode); + DataTable table = DBHelper.SQlReturnData(sql, cmd); + return table; + } + catch (Exception ex) + { + log.Error(ex.Message); + throw new Exception(ex.Message); + } + finally + { + if (conn.State == ConnectionState.Open) + { + conn.Close(); + } + conn.Dispose(); + } + } + } + #endregion } } diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs index fe4fd60..dc19c8c 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs @@ -3785,12 +3785,12 @@ namespace ICSSoft.DataProject RAISERROR('" + language.GetNameByCode("WMSAPIInfo477") + @"',16,1); RETURN END; - IF EXISTS(select ID from ICSContainerReceiptsNumber where ContainerCode='{2}' AND TransCode='{0}') + IF EXISTS(select ID from ICSContainerReceiptsNumber where TransCode='{0}' AND EATTRIBUTE5='关联中') BEGIN RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo479"), "{0}", "{2}") + @"',16,1); RETURN END; - INSERT INTO ICSContainerReceiptsNumber SELECT NEWID(),'{0}','{2}',F_Account,F_RealName,GETDATE(),NULL,NULL,NULL,NULL,NULL FROM Sys_SRM_User WHERE F_Account='{3}' "; + INSERT INTO ICSContainerReceiptsNumber SELECT NEWID(),'{0}','{2}',F_Account,F_RealName,GETDATE(),NULL,NULL,NULL,NULL,'关联中' FROM Sys_SRM_User WHERE F_Account='{3}' "; sqlCheck = string.Format(sqlCheck, tranCode, table.Rows[0]["Desks"].ToString(), containerCode, User); if (!DBHelper.ExecuteNonQuery(sqlCheck, cmd)) { diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs index dc8eec3..5917e95 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs @@ -3048,5 +3048,42 @@ namespace ICSSoft.WebAPI.Controllers return result; } #endregion + + #region 验证料架关联单据是否全部扫完 + [HttpPost] + [Route("api/ChkAGVDocStatus/Get")] + public HttpResponseMessage ChkAGVDocStatus([FromBody] object JsonData) + { + log.Info("获取单据料架关联传入值" + JsonData); + try + { + if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]") + { + OccupyDocModel model = new OccupyDocModel(); + model = JsonConvert.DeserializeObject(JsonData.ToString()); + var resultStr = ICSSubmitService.ChkAGVDocStatus(model); + res.Success = true; + res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!"; + if (resultStr != null && resultStr.Rows.Count > 0 && resultStr.ToString() != "[]") + { + res.Data = resultStr; + } + } + } + catch (Exception ex) + { + log.Error("转换失败:" + ex.ToString()); + res.Success = false; + res.Message = ex.Message; + } + finally + { + str = JsonConvert.SerializeObject(res); + result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json"); + } + log.Debug("获取单据料架关联传入值:" + str); + return result; + } + #endregion } }