From f7a87c41ff271cce676a39d85bec45c4fec0c919 Mon Sep 17 00:00:00 2001 From: jl Date: Tue, 17 Jun 2025 16:40:02 +0800 Subject: [PATCH] --- Epost.BLL/OrderBLL.cs | 6 + Epost.DAL/OrdersDAL.cs | 5 + Epost.Model/WmsOrderModel.cs | 52 ++++--- .../Controllers/TaskAPIController.cs | 135 ++++++++++++++++++ Epost.TestToolsWeb/Epost.DPS.csproj | 1 + .../PublishProfiles/Toolsweb.pubxml.user | 30 ++-- 6 files changed, 192 insertions(+), 37 deletions(-) create mode 100644 Epost.TestToolsWeb/Controllers/TaskAPIController.cs diff --git a/Epost.BLL/OrderBLL.cs b/Epost.BLL/OrderBLL.cs index 1ca1f22..aacb72d 100644 --- a/Epost.BLL/OrderBLL.cs +++ b/Epost.BLL/OrderBLL.cs @@ -945,5 +945,11 @@ namespace Epost.BLL return dal.GetOrderList_echo(matchid, sku, sarea, sblock); } #endregion + + public bool UpdateData(DataTable dt, Dictionary diclist, string tablename) + { + + return dal.UpdateData(dt, diclist, tablename); + } } } diff --git a/Epost.DAL/OrdersDAL.cs b/Epost.DAL/OrdersDAL.cs index 27ef1ef..7e9ca7c 100644 --- a/Epost.DAL/OrdersDAL.cs +++ b/Epost.DAL/OrdersDAL.cs @@ -2585,5 +2585,10 @@ namespace Epost.DAL } #endregion + public bool UpdateData(DataTable dt, Dictionary diclist, string tablename) + { + return db.UpdateData(dt, tablename, diclist); + } + } } diff --git a/Epost.Model/WmsOrderModel.cs b/Epost.Model/WmsOrderModel.cs index 1b662b1..b2fd92d 100644 --- a/Epost.Model/WmsOrderModel.cs +++ b/Epost.Model/WmsOrderModel.cs @@ -8,28 +8,36 @@ namespace Epost.Model { public class WmsOrderModel { - private string orderid = string.Empty; - private int truequantity = 0; - private string oprationtime = string.Empty; - private string batchid = string.Empty; - private string sku = string.Empty; - private string matchid = string.Empty; - private string fromlocation = string.Empty; - private string boxcode = string.Empty; - private string oprationcode = string.Empty; - private int quantity = 0; - private string workblock = string.Empty; - public string Orderid { get => orderid; set => orderid = value; } - public int Truequantity { get => truequantity; set => truequantity = value; } - public string Oprationtime { get => oprationtime; set => oprationtime = value; } - public string Batchid { get => batchid; set => batchid = value; } - public string Sku { get => sku; set => sku = value; } - public string Matchid { get => matchid; set => matchid = value; } - public string Fromlocation { get => fromlocation; set => fromlocation = value; } - public string Boxcode { get => boxcode; set => boxcode = value; } - public int Quantity { get => quantity; set => quantity = value; } - public string Oprationcode { get => oprationcode; set => oprationcode = value; } - public string Workblock { get => workblock; set => workblock = value; } + + public class PutOrderReq + { + public string WAVENO { get; set; } + public string SHOPID { get; set; } + public string SHOPNAME { get; set; } + public string ORDERWAY { get; set; } + public string PRINO { get; set; } + public string LOCATION { get; set; } + public string WAREHOUSEID { get; set; } + public List ITEMS { get; set; } + } + + public class ORDERITEM + { + public string UUID { get; set; } + public string DOCNO { get; set; } + public string SKU { get; set; } + public string BARCODE { get; set; } + public object BATCHNO { get; set; } + public int ISBATCH { get; set; } + public int QUANTITY { get; set; } + public string DESCR_C { get; set; } + public string UDF01 { get; set; } + public string UDF02 { get; set; } + public string UDF03 { get; set; } + public string UDF04 { get; set; } + public string UDF05 { get; set; } + } + } } diff --git a/Epost.TestToolsWeb/Controllers/TaskAPIController.cs b/Epost.TestToolsWeb/Controllers/TaskAPIController.cs new file mode 100644 index 0000000..a662f27 --- /dev/null +++ b/Epost.TestToolsWeb/Controllers/TaskAPIController.cs @@ -0,0 +1,135 @@ +using Epost.BLL; +using Epost.Common; +using Epost.Model; +using System; +using System.Collections.Generic; +using System.Data; +using System.Globalization; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Runtime.Remoting.Metadata.W3cXsd2001; +using System.Web.Http; +using static Epost.Model.WmsOrderModel; + +namespace Epost.DPS.Controllers +{ + [RoutePrefix("api/WebAPI")] + public class TaskAPIController : ApiController + { + private static object apiobj = new object(); + OrderBLL orderbll = new OrderBLL(); + + [Route("PutOrderInfoRequest")] + [HttpPost] + public ResultModel PutOrderInfoRequest(List data) + { + ResultModel result = new ResultModel(); + try + { + string isdel = string.Empty; + lock (apiobj) + { + LogHelper.WriteLogInfo("PutOrderInfoRequest:" + JsonHelper.SerializeObject(data)); + if (data.Any()) + { + #region 创建datatable + DataTable dataTable = new DataTable(); + dataTable.TableName = "orders"; + dataTable.Columns.Add(new DataColumn("matchid", typeof(string))); + dataTable.Columns.Add(new DataColumn("orderid", typeof(string))); + dataTable.Columns.Add(new DataColumn("shopid", typeof(string))); + dataTable.Columns.Add(new DataColumn("shopname", typeof(string))); + dataTable.Columns.Add(new DataColumn("orderway", typeof(string))); + dataTable.Columns.Add(new DataColumn("prino", typeof(string))); + dataTable.Columns.Add(new DataColumn("tolocation", typeof(string))); + dataTable.Columns.Add(new DataColumn("warehouseid", typeof(string))); + dataTable.Columns.Add(new DataColumn("batchid", typeof(string))); + dataTable.Columns.Add(new DataColumn("sku", typeof(string))); + dataTable.Columns.Add(new DataColumn("barcode", typeof(string))); + dataTable.Columns.Add(new DataColumn("goodscode", typeof(string)));//批次 + dataTable.Columns.Add(new DataColumn("goodsname", typeof(string))); + dataTable.Columns.Add(new DataColumn("quantity", typeof(int))); + dataTable.Columns.Add(new DataColumn("downdate", typeof(string))); + #endregion + foreach (PutOrderReq item in data) + { + foreach (ORDERITEM detailitem in item.ITEMS) + { + #region datatable + DataRow dataRow = dataTable.NewRow(); + dataRow["matchid"] = item.WAVENO;//波次 + dataRow["orderid"] = detailitem.DOCNO;//订单编号 + dataRow["shopid"] = item.SHOPID;//货主 + dataRow["shopname"] = item.SHOPNAME; + dataRow["orderway"] = item.ORDERWAY; + dataRow["prino"] = item.PRINO; + dataRow["tolocation"] = item.LOCATION; + dataRow["warehouseid"] = item.WAREHOUSEID; + dataRow["batchid"] = detailitem.UUID; + dataRow["sku"] = detailitem.SKU; + dataRow["barcode"] = detailitem.BARCODE; + dataRow["goodscode"] = detailitem.BATCHNO; + dataRow["goodsname"] = detailitem.DESCR_C; + dataRow["quantity"] = detailitem.QUANTITY; + dataRow["downdate"] = DateTime.Now.ToString(); + dataTable.Rows.Add(dataRow); + } + + #endregion + } + #region Dic + Dictionary diclist = new Dictionary(); + diclist.Add("matchid", "matchid"); + diclist.Add("orderid", "orderid"); + diclist.Add("shopid", "shopid"); + diclist.Add("shopname", "shopname"); + diclist.Add("orderway", "orderway"); + diclist.Add("prino", "prino"); + diclist.Add("tolocation", "tolocation"); + diclist.Add("warehouseid", "warehouseid"); + diclist.Add("batchid", "batchid"); + diclist.Add("sku", "sku"); + diclist.Add("barcode", "barcode"); + diclist.Add("goodscode", "goodscode"); + diclist.Add("goodsname", "goodsname"); + diclist.Add("quantity", "quantity"); + diclist.Add("downdate", "downdate"); + #endregion + bool bo = orderbll.UpdateData(dataTable, diclist, "orders"); + if (bo) + { + result.msg = "成功!"; + result.result = "0"; + } + else + { + result.msg = "请求失败!"; + result.result = "-1"; + } + } + else + { + result.msg = "参数异常!"; + result.result = "-1"; + } + + + + } + } + catch (Exception ex) + { + LogHelper.WriteLogInfo("PutOrderInfoRequest:" + ex.ToString(), LogHelper.Log_Type.ERROR); + result.result = "-1"; + result.msg = "请求接口异常!"; + } + + + return result; + } + + + + } +} diff --git a/Epost.TestToolsWeb/Epost.DPS.csproj b/Epost.TestToolsWeb/Epost.DPS.csproj index 529f751..788359c 100644 --- a/Epost.TestToolsWeb/Epost.DPS.csproj +++ b/Epost.TestToolsWeb/Epost.DPS.csproj @@ -224,6 +224,7 @@ + Global.asax diff --git a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user index 7424d3c..3e5c50e 100644 --- a/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user +++ b/Epost.TestToolsWeb/Properties/PublishProfiles/Toolsweb.pubxml.user @@ -7,7 +7,7 @@ <_PublishTargetUrl>D:\驿传\GuangzhouHuiFeng_DAS - True|2025-06-04T07:01:49.8008687Z||;True|2025-01-16T15:37:40.8814043+08:00||;True|2024-12-19T15:11:44.2536385+08:00||;True|2024-12-10T19:10:26.6514077+08:00||;True|2024-12-10T18:30:34.7211512+08:00||;True|2024-12-09T14:06:46.4112259+08:00||;True|2024-12-03T14:23:26.2134334+08:00||;True|2024-11-27T18:53:48.7373661+08:00||;True|2024-11-27T14:27:33.0840789+08:00||;True|2024-11-27T14:08:15.6442660+08:00||;True|2024-11-27T12:10:03.9412549+08:00||;True|2024-11-27T11:45:31.3775097+08:00||;True|2024-11-27T11:32:00.8297320+08:00||;True|2024-11-23T20:50:04.5476409+08:00||;False|2024-11-04T17:48:25.2781696+08:00||;True|2024-11-01T16:04:56.3535724+08:00||;True|2024-09-01T10:13:37.1598955+08:00||;True|2024-08-31T17:27:57.5375469+08:00||;True|2022-07-15T16:41:13.9750291+08:00||;True|2022-07-14T14:02:20.7983427+08:00||;True|2022-07-13T17:40:22.7531000+08:00||;True|2022-07-13T17:34:22.9908701+08:00||;True|2022-07-13T17:30:06.3588502+08:00||;True|2022-07-11T10:32:06.9053981+08:00||;True|2021-04-26T10:07:37.4889549+08:00||;True|2021-04-09T10:32:51.9130162+08:00||;True|2021-04-09T10:31:50.4974012+08:00||; + True|2025-06-16T08:39:46.1896351Z||;True|2025-06-04T15:01:49.8008687+08:00||;True|2025-01-16T15:37:40.8814043+08:00||;True|2024-12-19T15:11:44.2536385+08:00||;True|2024-12-10T19:10:26.6514077+08:00||;True|2024-12-10T18:30:34.7211512+08:00||;True|2024-12-09T14:06:46.4112259+08:00||;True|2024-12-03T14:23:26.2134334+08:00||;True|2024-11-27T18:53:48.7373661+08:00||;True|2024-11-27T14:27:33.0840789+08:00||;True|2024-11-27T14:08:15.6442660+08:00||;True|2024-11-27T12:10:03.9412549+08:00||;True|2024-11-27T11:45:31.3775097+08:00||;True|2024-11-27T11:32:00.8297320+08:00||;True|2024-11-23T20:50:04.5476409+08:00||;False|2024-11-04T17:48:25.2781696+08:00||;True|2024-11-01T16:04:56.3535724+08:00||;True|2024-09-01T10:13:37.1598955+08:00||;True|2024-08-31T17:27:57.5375469+08:00||;True|2022-07-15T16:41:13.9750291+08:00||;True|2022-07-14T14:02:20.7983427+08:00||;True|2022-07-13T17:40:22.7531000+08:00||;True|2022-07-13T17:34:22.9908701+08:00||;True|2022-07-13T17:30:06.3588502+08:00||;True|2022-07-11T10:32:06.9053981+08:00||;True|2021-04-26T10:07:37.4889549+08:00||;True|2021-04-09T10:32:51.9130162+08:00||;True|2021-04-09T10:31:50.4974012+08:00||; @@ -33,19 +33,19 @@ 04/04/2018 15:45:12 - 06/05/2025 15:04:03 + 06/16/2025 16:39:42 - 06/05/2025 15:04:03 + 06/16/2025 16:39:42 02/24/2020 15:29:24 - 06/04/2025 18:11:41 + 06/16/2025 16:29:30 - 06/04/2025 18:11:41 + 06/16/2025 16:29:30 04/29/2020 16:50:14 @@ -63,31 +63,31 @@ 10/23/2017 13:15:20 - 06/05/2025 15:03:46 + 06/16/2025 16:29:31 - 06/05/2025 15:03:46 + 06/16/2025 16:29:31 08/26/2020 18:09:48 - 06/05/2025 15:03:45 + 06/16/2025 16:29:30 - 06/05/2025 15:03:45 + 06/16/2025 16:29:30 - 06/05/2025 15:03:50 + 06/16/2025 16:39:25 - 06/05/2025 15:03:50 + 06/16/2025 16:39:25 - 06/04/2025 18:11:40 + 06/16/2025 16:29:29 - 06/04/2025 18:11:40 + 06/16/2025 16:29:29 09/06/2018 11:57:11 @@ -5652,7 +5652,7 @@ 05/30/2022 16:58:47 - 06/05/2025 15:03:52 + 06/16/2025 16:39:28 04/04/2018 15:45:12 @@ -7572,7 +7572,7 @@ 07/04/2022 14:22:38 - 06/04/2025 15:01:24 + 06/16/2025 16:39:26 \ No newline at end of file