From 607746595235b4c91fff2c58bcf7b9b54632cc7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=99=94?= Date: Wed, 26 Jul 2023 15:23:55 +0800 Subject: [PATCH] =?UTF-8?q?SAP=E5=BA=93=E5=AD=98=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=20SAP=E5=B7=B2=E9=85=8D?= =?UTF-8?q?=E6=96=99=E6=9C=AA=E8=BF=87=E8=B4=A6=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Root/ICSSoft.Frame.Data.Entity.dll | Bin 143360 -> 143360 bytes .../ICSSoft.DataProject/ICSSubmitService.cs | 30 ++++- .../ICSWareHouseLotInfoService.cs | 117 +++++++++++++++++- 3 files changed, 142 insertions(+), 5 deletions(-) diff --git a/ICSSoft.FromERP/Root/ICSSoft.Frame.Data.Entity.dll b/ICSSoft.FromERP/Root/ICSSoft.Frame.Data.Entity.dll index a51f1c06bd78401324eb6533c97a25f35ec7d262..21f94c461a5e6d898efd327743e5ba8a6d05b533 100644 GIT binary patch delta 74 zcmZp8z|ru4V?qaW)}8~6-CMgE1+NR_@7lfXN^FbIl(!WUX1$MoZ(nnr@q#Z%#q@er eCP@L2_fuyEZB_Hx`z(c*y|Slh`wCU22rd9iULr04 delta 74 zcmZp8z|ru4V?qbBISNULL(TransferQuantity, 0) order by Transfer } if (!string.IsNullOrEmpty(JsonData.WHCode)) { - sql += $@" AND A.WarehouseCode='{JsonData.WHCode}'"; + string strWhCode = ""; + string[] WHCodeList = JsonData.WHCode.Split(','); + foreach (string WHCode in WHCodeList) + { + if (strWhCode == "") + { + strWhCode += "'" + WHCode + "'"; + } + else + { + strWhCode += ",'" + WHCode + "'"; + } + } + sql += $@" AND A.WarehouseCode IN ({strWhCode})"; } if (!string.IsNullOrEmpty(JsonData.WorkPoint)) { @@ -8326,7 +8339,20 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer } if (!string.IsNullOrEmpty(JsonData.WHCode)) { - sql += $@" AND A.FromWarehouseCode='{JsonData.WHCode}'"; + string strWhCode = ""; + string[] WHCodeList = JsonData.WHCode.Split(','); + foreach (string WHCode in WHCodeList) + { + if (strWhCode == "") + { + strWhCode += "'" + WHCode + "'"; + } + else + { + strWhCode += ",'" + WHCode + "'"; + } + } + sql += $@" AND A.FromWarehouseCode IN ({strWhCode})"; } if (!string.IsNullOrEmpty(JsonData.WorkPoint)) { diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs index 70d2de3..a2aaf61 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs @@ -3203,14 +3203,21 @@ namespace ICSSoft.DataProject /// /// /// - public static void ActionSaveAGVTaskCode(string TaskCode, string ContainerCode, string Location,bool IsOverLoad, string User, string WorkPoint, SqlCommand cmd, Dictionary language) + public static void ActionSaveAGVTaskCode(string TaskCode, string ContainerCode, string Location, bool IsOverLoad, string User, string WorkPoint, SqlCommand cmd, Dictionary language) { try { string sql = @"Insert into ICSAGVTaskLog (ID,TaskCode,ContainerCode,LocationCode,IsOverLoad,UserCode,MTIME,WorkPoint) select NEWID(),'{0}','{1}','{2}','{3}','{4}',GETDATE(),'{5}'"; - sql = string.Format(sql, TaskCode, ContainerCode, Location, IsOverLoad, User, WorkPoint); + if (IsOverLoad == true) + { + sql = string.Format(sql, TaskCode, ContainerCode, Location, "是", User, WorkPoint); + } + else + { + sql = string.Format(sql, TaskCode, ContainerCode, Location, "否", User, WorkPoint); + } DataTable dt = DBHelper.SQlReturnData(sql, cmd); if (dt.Rows.Count == 0) { @@ -3235,8 +3242,112 @@ namespace ICSSoft.DataProject try { #region 根据任务ID查询是否需要超托入库 - string sql = @""; + bool OverLoad = false; + string ContainerCode = ""; + string InWHCode = ""; + string InLocationCode = ""; + string sql = @"select ContainerCode,LocationCode,IsOverLoad from ICSAGVTaskLog + where TaskCode='{0}'"; + sql = string.Format(sql, reqCode); DataTable dt = DBHelper.SQlReturnData(sql, cmd); + if (dt.Rows.Count == 0) + { + throw new Exception("未查询到对应的任务ID:" + reqCode + "!"); + } + else + { + if (dt.Rows[0]["IsOverLoad"].ToString() == "是") + { + OverLoad = true; + } + ContainerCode = dt.Rows[0]["IsOverLoad"].ToString(); + #region 查询料架中条码对应单据的仓库及条码对应物料的区域(绑定时已做卡控,一个料架只能绑定同仓库区域的条码,故只要通过其中一个条码来判断) + sql = @"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A + INNER JOIN ICSDeliveryNotice B ON B.DNCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint + INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint + WHERE A.LotNo=(select top 1 LotNo from ICSContainerLot A + INNER JOIN ICSContainer B ON B.ID=A.ContainerID + WHERE B.ContainerCode='{0}') + UNION ALL + SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A + INNER JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint + INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint + WHERE A.LotNo=(select top 1 LotNo from ICSContainerLot A + INNER JOIN ICSContainer B ON B.ID=A.ContainerID + WHERE B.ContainerCode='{0}')"; + sql = string.Format(sql, ContainerCode); + dt = DBHelper.SQlReturnData(sql, cmd); + if (dt.Rows.Count == 0) + { + throw new Exception("未查询到料架:" + ContainerCode + ",对应的入库区域和仓库!"); + } + else + { + InWHCode = dt.Rows[0]["WHCode"].ToString(); + InLocationCode = dt.Rows[0]["LocationCode"].ToString(); + #region 根据入库仓库和区域获取按库位编码排序后可以入库的下一个库位 + if (OverLoad == false) + { + #region 正常入库 + sql = @"select TOP 1 A.LocationCode from ICSLocation A + LEFT JOIN ICSWareHouseLotInfo B ON B.LocationCode=A.LocationCode AND B.WorkPoint=A.WorkPoint AND B.Quantity>0 + where B.LocationCode IS NULL AND A.LocationCode like ('{0}'+'-'+'{1}%') + ORDER BY A.LocationCode"; + sql = string.Format(sql, InWHCode, InLocationCode); + dt = DBHelper.SQlReturnData(sql, cmd); + if (dt.Rows.Count == 0) + { + throw new Exception("仓库:" + InWHCode + ",区域:" + InLocationCode + "无可用库位,无法入库!"); + } + else + { + if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadForkLift"])) + { + string ForkLiftUrl = System.Configuration.ConfigurationManager.AppSettings["ForkLiftUrl"]; + string Year = DateTime.Now.Year.ToString(); + string Month = DateTime.Now.Month.ToString().PadLeft(2, '0'); + string Day = DateTime.Now.Day.ToString().PadLeft(2, '0'); + string Pre = "CC" + Year + Month + Day; + string serialsql = "EXEC Addins_GetSerialCode '{0}','{1}','{2}','{3}',{4}"; + serialsql = string.Format(serialsql, "1701", "ICSForkLiftTaskLog", "TaskCode", Pre, 4); + string TaskCode = DBHelper.SQlReturnData(serialsql, cmd).Rows[0][0].ToString(); + string SerialNum = DateTime.Now.Hour.ToString().PadLeft(2, '0'); + string InspectJosn = "{"; + InspectJosn += "\"ID\":\"" + TaskCode + "\",";//任务编号 + InspectJosn += "\"PalletID\": \"" + ContainerCode + "\",";//料架号 + //InspectJosn += "\"LaneCode\": \"\","; + InspectJosn += "\"TaskType\": \"PTWY\",";//任务类型 + InspectJosn += "\"SourceBin\": \""+ currentPositionCode + "\",";//起始点位 + InspectJosn += "\"DestBin\": \"" + dt.Rows[0]["LocationCode"].ToString() + "\"";//目标点位 + InspectJosn += "}"; + RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST); + rest.PostData = InspectJosn; + string strResult = rest.MakeRequest(); + //string resultstr = HTTPHelper.Post(ERPUrl.AGVBineURL, InspectJosn); + ForkLiftStartTaskResultModel result = JsonConvert.DeserializeObject(strResult); + if (result.Ret == 1) + { + #region 记录叉车的任务编号及相关信息 + #endregion + sql = @"update ICSContainer set LocationCode='{2}',EATTRIBUTE1='已搬运' where ContainerCode='{0}' AND WorkPoint='{1}'"; + //sql = string.Format(sql, ContainerCode, WorkPoint, LocationCode); + if (!DBHelper.ExecuteNonQuery(sql, cmd)) + { + throw new Exception(language.GetNameByCode("WMSAPIInfo207"));//料架状态更新失败 + } + } + else + { + throw new Exception(result.RetMsg); + } + } + } + #endregion + } + #endregion + } + #endregion + } #endregion } catch (Exception ex)