From 6912d8235648a51e2e7b7e93d0f5b5e868511462 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期二, 06 八月 2024 12:45:59 +0800 Subject: [PATCH] 添加读取配置的类。将数据库连接,接口地址写入到配置文件中,获取时通过配置文件获取 --- MESApplication/bin/Release/net8.0/MESApplication.exe | 0 MESApplication/bin/Release/net8.0/publish/MESApplication.pdb | 0 MES.Service/Dto/service/OutItemDto.cs | 10 MESApplication/bin/Debug/net8.0/MES.Service.pdb | 0 MES.Service/Dto/service/InventoryItemDetail.cs | 40 + MESApplication/bin/Release/net8.0/publish/MESApplication.dll | 0 MES.Service/Dto/service/PurchaseInventory.cs | 2 MESApplication/bin/Debug/net8.0/MES.Service.dll | 0 MES.Service/Modes/MesInvItemInCItems.cs | 148 ++++ MES.Service/service/Warehouse/MesInvItemOutsManager.cs | 372 ++++++++++ MESApplication/Controllers/Warehouse/MesInvItemOutItemsController.cs | 163 ++++ MESApplication/Controllers/Warehouse/MesInvItemInCItemsController.cs | 163 ++++ MESApplication/bin/Debug/net8.0/MESApplication.pdb | 0 MESApplication/bin/Release/net8.0/MES.Service.dll | 0 MESApplication/bin/Release/net8.0/MESApplication.dll | 0 MES.Service/service/Warehouse/MesInvItemOutItemsManager.cs | 78 ++ MESApplication/bin/Release/net8.0/publish/MES.Service.pdb | 0 MES.Service/Modes/MesInvItemOutItems.cs | 210 +++++ MESApplication/bin/Release/net8.0/MES.Service.pdb | 0 MESApplication/bin/Release/net8.0/publish/MESApplication.exe | 0 MES.Service/Dto/base/AppSettings.cs | 8 MES.Service/DB/SqlSugarHelper.cs | 6 MESApplication/bin/Debug/net8.0/appsettings.json | 7 MESApplication/bin/Release/net8.0/MESApplication.pdb | 0 MES.Service/DB/OracleSQLHelper.cs | 4 MES.Service/bin/Debug/net8.0/MES.Service.pdb | 0 MESApplication/bin/Release/net8.0/publish/MES.Service.dll | 0 MES.Service/DB/Repository.cs | 6 MES.Service/Modes/MesInvItemOuts.cs | 307 ++++++++ MES.Service/service/Warehouse/MesInvItemInCItemsManager.cs | 82 ++ MESApplication/bin/Debug/net8.0/MESApplication.dll | 0 MES.Service/bin/Debug/net8.0/MES.Service.dll | 0 MES.Service/Dto/service/MESInvItemOutItems.cs | 44 + MES.Service/service/Warehouse/MesInvItemInCDetailsManager.cs | 46 MES.Service/Dto/service/InventoryItem.cs | 19 MESApplication/Startup.cs | 11 MES.Service/util/AppsettingsUtility.cs | 24 MESApplication/bin/Debug/net8.0/MESApplication.exe | 0 MES.Service/bin/Release/net8.0/MES.Service.dll | 0 MES.Service/service/Warehouse/MesInvItemArnManager.cs | 14 MESApplication/Controllers/Warehouse/MesInvItemOutsController.cs | 308 ++++++++ MES.Service/bin/Release/net8.0/MES.Service.pdb | 0 MES.Service/Dto/service/WarehouseQuery.cs | 2 MESApplication/Controllers/Warehouse/MesInvItemArnController.cs | 21 MES.Service/DB/DbContext.cs | 5 MESApplication/appsettings.json | 7 46 files changed, 2,058 insertions(+), 49 deletions(-) diff --git a/MES.Service/DB/DbContext.cs b/MES.Service/DB/DbContext.cs index cdaad87..a2650e2 100644 --- a/MES.Service/DB/DbContext.cs +++ b/MES.Service/DB/DbContext.cs @@ -1,4 +1,5 @@ -锘縰sing SqlSugar; +锘縰sing MES.Service.util; +using SqlSugar; namespace MES.Service.DB; @@ -12,7 +13,7 @@ //mesQaItemXj02Context.Db.Queryable<MesQaItemXj02>().ToList(); private static readonly string connectionString = - "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.251)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = sg_prd; Password=sgprd"; // 杩欓噷鏇挎崲鎴愪綘鐨勫疄闄呰繛鎺ュ瓧绗︿覆; + AppsettingsUtility.Settings.DataBaseConn; // 杩欓噷鏇挎崲鎴愪綘鐨勫疄闄呰繛鎺ュ瓧绗︿覆; /// <summary> /// 娉ㄦ剰锛氫笉鑳藉啓鎴愰潤鎬佺殑 //鐢ㄦ潵澶勭悊浜嬪姟澶氳〃鏌ヨ鍜屽鏉傜殑鎿嶄綔 diff --git a/MES.Service/DB/OracleSQLHelper.cs b/MES.Service/DB/OracleSQLHelper.cs index 65b0219..471d205 100644 --- a/MES.Service/DB/OracleSQLHelper.cs +++ b/MES.Service/DB/OracleSQLHelper.cs @@ -1,4 +1,5 @@ 锘縰sing System.Data; +using MES.Service.util; using Oracle.ManagedDataAccess.Client; namespace MES.Service.DB; @@ -8,8 +9,7 @@ /// </summary> public class OracleSQLHelper { - public const string ConnectionString = - "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.251)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = sg_prd; Password=sgprd"; + public readonly string ConnectionString =AppsettingsUtility.Settings.DataBaseConn; private readonly string _connectionString; diff --git a/MES.Service/DB/Repository.cs b/MES.Service/DB/Repository.cs index 366f787..c84a136 100644 --- a/MES.Service/DB/Repository.cs +++ b/MES.Service/DB/Repository.cs @@ -1,4 +1,5 @@ -锘縰sing SqlSugar; +锘縰sing MES.Service.util; +using SqlSugar; namespace MES.Service.DB; @@ -7,8 +8,7 @@ public static SqlSugarScope Db = new(new ConnectionConfig { DbType = DbType.Oracle, - ConnectionString = - @"Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.251)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = sg_prd; Password=sgprd", + ConnectionString = AppsettingsUtility.Settings.DataBaseConn, IsAutoCloseConnection = true }, db => diff --git a/MES.Service/DB/SqlSugarHelper.cs b/MES.Service/DB/SqlSugarHelper.cs index baedcea..ea1415a 100644 --- a/MES.Service/DB/SqlSugarHelper.cs +++ b/MES.Service/DB/SqlSugarHelper.cs @@ -1,11 +1,11 @@ -锘縰sing SqlSugar; +锘縰sing MES.Service.util; +using SqlSugar; namespace MES.Service.DB; public class SqlSugarHelper { - private static readonly string _connectionString = - "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.251)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = sg_prd; Password=sgprd"; // 杩欓噷鏇挎崲鎴愪綘鐨勫疄闄呰繛鎺ュ瓧绗︿覆 + private static readonly string _connectionString =AppsettingsUtility.Settings.DataBaseConn; // 杩欓噷鏇挎崲鎴愪綘鐨勫疄闄呰繛鎺ュ瓧绗︿覆 public static SqlSugarClient GetInstance() { diff --git a/MES.Service/Dto/base/AppSettings.cs b/MES.Service/Dto/base/AppSettings.cs new file mode 100644 index 0000000..3989c37 --- /dev/null +++ b/MES.Service/Dto/base/AppSettings.cs @@ -0,0 +1,8 @@ +锘縩amespace MES.Service.Dto.@base; + +public class AppSettings +{ + public string TestErpUrl { get; set; } + public string ProductionErpUrl { get; set; } + public string DataBaseConn { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Dto/service/InventoryItem.cs b/MES.Service/Dto/service/InventoryItem.cs new file mode 100644 index 0000000..ca5767f --- /dev/null +++ b/MES.Service/Dto/service/InventoryItem.cs @@ -0,0 +1,19 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Dto.service; + +public class InventoryItem +{ + [SugarColumn(ColumnName = "DEPOT")] public string Depot { get; set; } + + [SugarColumn(ColumnName = "ITEM_NO")] public string ItemNo { get; set; } + + [SugarColumn(ColumnName = "ITEM_MODEL")] + public string ItemModel { get; set; } + + [SugarColumn(ColumnName = "ITEM_NAME")] + public string ItemName { get; set; } + + [SugarColumn(ColumnName = "QTY")] + public decimal Qty { get; set; } // 浣跨敤 decimal 鏉ヨ〃绀烘暟閲� +} \ No newline at end of file diff --git a/MES.Service/Dto/service/InventoryItemDetail.cs b/MES.Service/Dto/service/InventoryItemDetail.cs new file mode 100644 index 0000000..360126b --- /dev/null +++ b/MES.Service/Dto/service/InventoryItemDetail.cs @@ -0,0 +1,40 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Dto.service; + +public class InventoryItemDetail +{ + [SugarColumn(ColumnName = "WORK_NO")] public string WorkNo { get; set; } + + [SugarColumn(ColumnName = "WORK_LINE")] + public string WorkLine { get; set; } + + [SugarColumn(ColumnName = "ITEM_NO")] public string ItemNo { get; set; } + + [SugarColumn(ColumnName = "ITEM_NAME")] + public string ItemName { get; set; } + + [SugarColumn(ColumnName = "ITEM_MODEL")] + public string ItemModel { get; set; } + + [SugarColumn(ColumnName = "SUM_QUANTITY")] + public decimal SumQuantity { get; set; } + + [SugarColumn(ColumnName = "UNIT")] public string Unit { get; set; } + + [SugarColumn(ColumnName = "SUPP_NO")] public string SuppNo { get; set; } + + [SugarColumn(ColumnName = "QUANTITY")] public decimal Quantity { get; set; } + + [SugarColumn(ColumnName = "REFUNDABLE_QUANTITY")] + public decimal RefundableQuantity { get; set; } + + [SugarColumn(ColumnName = "CBILL_NO")] public string CbillNo { get; set; } + + [SugarColumn(ColumnName = "TASK_NO")] public string TaskNo { get; set; } + + [SugarColumn(ColumnName = "BILL_NO")] public string BillNo { get; set; } + + [SugarColumn(ColumnName = "CREATE_DATE")] + public string CreateDate { get; set; } // 濡傛灉闇�瑕佹棩鏈熷鐞嗭紝鍙互鑰冭檻浣跨敤 DateTime 绫诲瀷 +} \ No newline at end of file diff --git a/MES.Service/Dto/service/MESInvItemOutItems.cs b/MES.Service/Dto/service/MESInvItemOutItems.cs new file mode 100644 index 0000000..e399091 --- /dev/null +++ b/MES.Service/Dto/service/MESInvItemOutItems.cs @@ -0,0 +1,44 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Dto.service; + +public class MESInvItemOutItems +{ + [SugarColumn(ColumnName = "REMARK")] public string Remark { get; set; } + + [SugarColumn(ColumnName = "PBILL_NO")] public string PbillNo { get; set; } + + [SugarColumn(ColumnName = "ITEM_OUT_ID")] + public string ItemOutId { get; set; } + + [SugarColumn(ColumnName = "RK_QTY")] public decimal RkQty { get; set; } + + [SugarColumn(ColumnName = "TL_QTY")] public decimal TlQty { get; set; } + + [SugarColumn(ColumnName = "WORK_LINE")] + public string WorkLine { get; set; } + + [SugarColumn(ColumnName = "QUANTITY")] public decimal Quantity { get; set; } + + [SugarColumn(ColumnName = "ITEM_NO")] public string ItemNo { get; set; } + + [SugarColumn(ColumnName = "KT_QTY")] + public decimal KtQty { get; set; } // 鍓╀綑鍙�� + + [SugarColumn(ColumnName = "DEPOT_SECTION_CODE")] + public string DepotSectionCode { get; set; } + + [SugarColumn(ColumnName = "ITEM_MODEL")] + public string ItemModel { get; set; } + + [SugarColumn(ColumnName = "ITEM_NAME")] + public string ItemName { get; set; } + + [SugarColumn(ColumnName = "CGB014")] public string Cgb014 { get; set; } + + [SugarColumn(ColumnName = "STAFF_NAME")] + public string StaffName { get; set; } + + [SugarColumn(ColumnName = "DEPOT_CODE")] + public string DepotCode { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Dto/service/OutItemDto.cs b/MES.Service/Dto/service/OutItemDto.cs new file mode 100644 index 0000000..06a755f --- /dev/null +++ b/MES.Service/Dto/service/OutItemDto.cs @@ -0,0 +1,10 @@ +锘縰sing MES.Service.Modes; + +namespace MES.Service.Dto.service; + +public class OutItemDto +{ + public MesInvItemOuts Form { get; set; } + public List<MesInvItemOutItems> SaveItems { get; set; } + public List<MESInvItemOutItems> SelectItems { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Dto/service/PurchaseInventory.cs b/MES.Service/Dto/service/PurchaseInventory.cs index ebf10d8..bb590d6 100644 --- a/MES.Service/Dto/service/PurchaseInventory.cs +++ b/MES.Service/Dto/service/PurchaseInventory.cs @@ -11,5 +11,5 @@ public MesInvItemIns? ItemIns { get; set; } public List<MesInvItemInCDetails>? InvItemInCDetails { get; set; } - public List<MesInvItemInCDetails>? ItemInDetails { get; set; } + public List<MesInvItemInCItems>? ItemInDetails { get; set; } } \ No newline at end of file diff --git a/MES.Service/Dto/service/WarehouseQuery.cs b/MES.Service/Dto/service/WarehouseQuery.cs index 7e019e6..ea3e707 100644 --- a/MES.Service/Dto/service/WarehouseQuery.cs +++ b/MES.Service/Dto/service/WarehouseQuery.cs @@ -17,4 +17,6 @@ public short? status { get; set; } public DateTime? date { get; set; } public string? Type { get; set; } + public string? DepotCode { get; set; } + public string? SuppNo { get; set; } } \ No newline at end of file diff --git a/MES.Service/Modes/MesInvItemInCItems.cs b/MES.Service/Modes/MesInvItemInCItems.cs new file mode 100644 index 0000000..05e3293 --- /dev/null +++ b/MES.Service/Modes/MesInvItemInCItems.cs @@ -0,0 +1,148 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 鐗╂枡鍏ュ簱鏄庣粏 +/// </summary> +[SugarTable("MES_INV_ITEM_IN_C_ITEMS")] +public class MesInvItemInCItems +{ + /// <summary> + /// SEQ_OUT + /// </summary> + [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍏ュ簱鍗昳d + /// </summary> + [SugarColumn(ColumnName = "ITEM_IN_ID", IsPrimaryKey = true)] + public decimal ItemInId { get; set; } + + /// <summary> + /// 楠屾敹鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "QUANTITY")] + public decimal? Quantity { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string LastupdateBy { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂版椂闂� + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 鐗╂枡缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "ITEM_NO")] + public string ItemNo { get; set; } + + /// <summary> + /// 浠撳簱缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "DEPOT_CODE")] + public string DepotCode { get; set; } + + /// <summary> + /// 璐т綅缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "DEPOT_SECTION_CODE")] + public string DepotSectionCode { get; set; } + + /// <summary> + /// 鐗硅浜嬮」 + /// </summary> + [SugarColumn(ColumnName = "REMARK")] + public string Remark { get; set; } + + /// <summary> + /// 鐗╂枡绠�绉� + /// </summary> + [SugarColumn(ColumnName = "ITEM_SNAME")] + public string ItemSname { get; set; } + + /// <summary> + /// 鍗曚綅 + /// </summary> + [SugarColumn(ColumnName = "UNIT")] + public string Unit { get; set; } + + /// <summary> + /// 閲囪喘璁㈠崟 + /// </summary> + [SugarColumn(ColumnName = "EBELN")] + public string Ebeln { get; set; } + + /// <summary> + /// 鍏ュ簱鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "BILL_NO")] + public string BillNo { get; set; } + + /// <summary> + /// 鍒嗗巶缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "FACTORY")] + public string Factory { get; set; } + + /// <summary> + /// 鍏徃浠g爜 + /// </summary> + [SugarColumn(ColumnName = "COMPANY")] + public string Company { get; set; } + + /// <summary> + /// 浠诲姟鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "WORK_NO")] + public string WorkNo { get; set; } + + /// <summary> + /// 琛屽彿 + /// </summary> + [SugarColumn(ColumnName = "EBELN_LINE_NO")] + public decimal? EbelnLineNo { get; set; } + + /// <summary> + /// 鍒拌揣鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "CBILL_NO")] + public string CbillNo { get; set; } + + /// <summary> + /// 浠诲姟鍗曡鍙� + /// </summary> + [SugarColumn(ColumnName = "WORK_LINE")] + public decimal? WorkLine { get; set; } + + /// <summary> + /// 鐢熶骇宸ュ崟 + /// </summary> + [SugarColumn(ColumnName = "TASK_NO")] + public string TaskNo { get; set; } + + /// <summary> + /// 渚涘簲鍟� + /// </summary> + [SugarColumn(ColumnName = "SUPP_NO")] + public string SuppNo { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesInvItemOutItems.cs b/MES.Service/Modes/MesInvItemOutItems.cs new file mode 100644 index 0000000..1e640a8 --- /dev/null +++ b/MES.Service/Modes/MesInvItemOutItems.cs @@ -0,0 +1,210 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 鍑哄簱鐢宠鐗╂枡琛� +/// </summary> +[SugarTable("MES_INV_ITEM_OUT_ITEMS")] +public class MesInvItemOutItems +{ + /// <summary> + /// SEQ_ITEM_ID + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_INV_ID", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍑哄簱ID + /// </summary> + [SugarColumn(ColumnName = "ITEM_OUT_ID")] + public decimal? ItemOutId { get; set; } + + /// <summary> + /// 鐗╂枡缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "ITEM_NO")] + public string? ItemNo { get; set; } + + /// <summary> + /// 鐢宠鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "QUANTITY")] + public decimal? Quantity { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string? CreateBy { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 澶囨敞淇℃伅 + /// </summary> + [SugarColumn(ColumnName = "REMARK")] + public string? Remark { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "FACTORY")] + public string? Factory { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "COMPANY")] + public string? Company { get; set; } + + /// <summary> + /// 鎺ㄤ粙浠撳簱 + /// </summary> + [SugarColumn(ColumnName = "DEPOT_CODE")] + public string? DepotCode { get; set; } + + /// <summary> + /// 鎺ㄤ粙搴撲綅 + /// </summary> + [SugarColumn(ColumnName = "DEPOT_SECTION_CODE")] + public string? DepotSectionCode { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "TASK_NO")] + public string? TaskNo { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "WORK_NO")] + public string? WorkNo { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "WORK_LINE")] + public decimal? WorkLine { get; set; } + + /// <summary> + /// ERP 涓昏〃ID + /// </summary> + [SugarColumn(ColumnName = "ERP_ID")] + public decimal? ErpId { get; set; } + + /// <summary> + /// ERP 浠庤〃ID + /// </summary> + [SugarColumn(ColumnName = "ERP_AUTOID")] + public decimal? ErpAutoid { get; set; } + + /// <summary> + /// ERP_鏂欏彿 + /// </summary> + [SugarColumn(ColumnName = "ERP_ITEM_NO")] + public string? ErpItemNo { get; set; } + + /// <summary> + /// 棰滆壊 + /// </summary> + [SugarColumn(ColumnName = "COLOR_NAME")] + public string? ColorName { get; set; } + + /// <summary> + /// 鏈�鏂颁笅杞芥洿鏂版爣璇� + /// </summary> + [SugarColumn(ColumnName = "UPDATE_FLG")] + public decimal? UpdateFlg { get; set; } + + /// <summary> + /// 閲囪喘鍗旾D + /// </summary> + [SugarColumn(ColumnName = "EBELN_K3ID")] + public decimal? EbelnK3id { get; set; } + + /// <summary> + /// 閲囪喘鍗曡ID + /// </summary> + [SugarColumn(ColumnName = "LINE_K3ID")] + public decimal? LineK3id { get; set; } + + /// <summary> + /// 閲囪喘鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "EBELN")] + public string? Ebeln { get; set; } + + /// <summary> + /// 閲囪喘璁㈠崟琛屽彿 + /// </summary> + [SugarColumn(ColumnName = "EBELN_LINE")] + public decimal? EbelnLine { get; set; } + + /// <summary> + /// 閲囪喘璁㈠崟鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "EBELN_QTY")] + public decimal? EbelnQty { get; set; } + + /// <summary> + /// 浜у搧缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "BOARD_ITEM")] + public string? BoardItem { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "F_TYPE")] + public decimal? FType { get; set; } + + /// <summary> + /// </summary> + [SugarColumn(ColumnName = "STATUS")] + public decimal? Status { get; set; } + + /// <summary> + /// 瀛愬瓙琛↖D + /// </summary> + [SugarColumn(ColumnName = "ALLOCATEID")] + public decimal? Allocateid { get; set; } + + /// <summary> + /// 棰嗘枡缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "PBILL_NO")] + public string? PbillNo { get; set; } + + /// <summary> + /// erp鎺ュ彛杩斿洖 + /// </summary> + [SugarColumn(ColumnName = "ERP_MARK")] + public string? ErpMark { get; set; } + + /// <summary> + /// 鍏ュ簱鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "RK_NO")] + public string? RkNo { get; set; } + + /// <summary> + /// 宸插叆搴撴暟 + /// </summary> + [SugarColumn(ColumnName = "RK_QTY")] + public decimal? RkQty { get; set; } + + /// <summary> + /// 宸叉壂鏁伴噺 + /// </summary> + [SugarColumn(ColumnName = "TL_QTY")] + public decimal? TlQty { get; set; } +} \ No newline at end of file diff --git a/MES.Service/Modes/MesInvItemOuts.cs b/MES.Service/Modes/MesInvItemOuts.cs new file mode 100644 index 0000000..eeae84c --- /dev/null +++ b/MES.Service/Modes/MesInvItemOuts.cs @@ -0,0 +1,307 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes; + +/// <summary> +/// 鐗╂枡鍑哄簱琛� +/// </summary> +[SugarTable("MES_INV_ITEM_OUTS")] +public class MesInvItemOuts +{ + /// <summary> + /// SEQ_INV_ID + /// </summary> + [SugarColumn(ColumnName = "ID", OracleSequenceName = "SEQ_INV_ID", + IsPrimaryKey = true)] + public decimal Id { get; set; } + + /// <summary> + /// 鍑哄簱鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "ITEM_OUT_NO")] + public string? ItemOutNo { get; set; } + + /// <summary> + /// 鐢熶骇璁㈠崟 + /// </summary> + [SugarColumn(ColumnName = "TASK_NO")] + public string? TaskNo { get; set; } + + /// <summary> + /// 宸ュ簭鍙� + /// </summary> + [SugarColumn(ColumnName = "PROC_NO")] + public string? ProcNo { get; set; } + + /// <summary> + /// 鐘舵�亅0-鏈鏍�1-瀹℃牳 + /// </summary> + [SugarColumn(ColumnName = "STATUS")] + public decimal? Status { get; set; } + + /// <summary> + /// 鍒涘缓浜� + /// </summary> + [SugarColumn(ColumnName = "CREATE_BY")] + public string? CreateBy { get; set; } + + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + [SugarColumn(ColumnName = "CREATE_DATE")] + public DateTime? CreateDate { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂颁汉 + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_BY")] + public string? LastupdateBy { get; set; } + + /// <summary> + /// 鏈�鍚庢洿鏂版椂闂� + /// </summary> + [SugarColumn(ColumnName = "LASTUPDATE_DATE")] + public DateTime? LastupdateDate { get; set; } + + /// <summary> + /// 鍗曟嵁绫诲瀷ID + /// </summary> + [SugarColumn(ColumnName = "BILL_TYPE_ID")] + public decimal? BillTypeId { get; set; } + + /// <summary> + /// 浜嬪姟绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "TRANSACTION_NO")] + public decimal? TransactionNo { get; set; } + + /// <summary> + /// 澶囨敞淇℃伅 + /// </summary> + [SugarColumn(ColumnName = "REMARK")] + public string? Remark { get; set; } + + /// <summary> + /// 鍑哄簱鍘熷洜 + /// </summary> + [SugarColumn(ColumnName = "REASON")] + public string? Reason { get; set; } + + /// <summary> + /// 鐢熶骇绾跨紪鐮� + /// </summary> + [SugarColumn(ColumnName = "PRODUCE_LINE_NO")] + public string? ProduceLineNo { get; set; } + + /// <summary> + /// 瀹℃牳浜� + /// </summary> + [SugarColumn(ColumnName = "CHECK_USER")] + public string? CheckUser { get; set; } + + /// <summary> + /// 瀹℃牳鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "CHECK_DATE")] + public DateTime? CheckDate { get; set; } + + /// <summary> + /// 棰嗘枡鏃ユ湡 + /// </summary> + [SugarColumn(ColumnName = "OUT_DATE")] + public DateTime? OutDate { get; set; } + + /// <summary> + /// 棰嗘枡宸ユ + /// </summary> + [SugarColumn(ColumnName = "MMLIST")] + public string? Mmlist { get; set; } + + /// <summary> + /// 瀛愬簱CODE + /// </summary> + [SugarColumn(ColumnName = "DEPOT_CODE")] + public string? DepotCode { get; set; } + + /// <summary> + /// SAP杩斿洖鍗曟嵁 + /// </summary> + [SugarColumn(ColumnName = "SAPNO")] + public string? Sapno { get; set; } + + /// <summary> + /// 鏄惁宸插洖鍐橲AP + /// </summary> + [SugarColumn(ColumnName = "SAPSTATUS")] + public short? Sapstatus { get; set; } + + /// <summary> + /// SAP杩斿洖骞翠唤 + /// </summary> + [SugarColumn(ColumnName = "SAPYEAR")] + public short? Sapyear { get; set; } + + /// <summary> + /// SAP杩斿洖淇℃伅 + /// </summary> + [SugarColumn(ColumnName = "SAPTEXT")] + public string? Saptext { get; set; } + + /// <summary> + /// 宸ュ簭绾夸綋 + /// </summary> + [SugarColumn(ColumnName = "PROC_LINE_NO")] + public string? ProcLineNo { get; set; } + + /// <summary> + /// 棰嗘枡閮ㄩ棬 + /// </summary> + [SugarColumn(ColumnName = "OUT_PART")] + public string? OutPart { get; set; } + + /// <summary> + /// 0 鐢熶骇,1 濮斿 + /// </summary> + [SugarColumn(ColumnName = "F_TYPE")] + public long? FType { get; set; } + + /// <summary> + /// 褰曞叆鎻愪氦 + /// </summary> + [SugarColumn(ColumnName = "OUT_STATUS")] + public decimal? OutStatus { get; set; } + + /// <summary> + /// 鏄惁鍙 + /// </summary> + [SugarColumn(ColumnName = "IS_VISUAL")] + public decimal? IsVisual { get; set; } + + /// <summary> + /// 鎺ユ敹浜� + /// </summary> + [SugarColumn(ColumnName = "RECEIVER")] + public string? Receiver { get; set; } + + /// <summary> + /// 宸ュ巶缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "FACTORY")] + public string? Factory { get; set; } + + /// <summary> + /// 鍏徃缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "COMPANY")] + public string? Company { get; set; } + + /// <summary> + /// 鍐查攢浜嬪姟绫诲瀷缂栫爜 + /// </summary> + [SugarColumn(ColumnName = "MTRANSCTION_NO")] + public decimal? MtransctionNo { get; set; } + + /// <summary> + /// 浠诲姟鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "WORK_NO")] + public string? WorkNo { get; set; } + + /// <summary> + /// 浠诲姟鍗曞彿琛屽彿 + /// </summary> + [SugarColumn(ColumnName = "WORK_LINE")] + public decimal? WorkLine { get; set; } + + /// <summary> + /// 渚涘簲鍟嗙紪鍙� + /// </summary> + [SugarColumn(ColumnName = "SUPP_NO")] + public string? SuppNo { get; set; } + + /// <summary> + /// 璁㈠崟鍙� + /// </summary> + [SugarColumn(ColumnName = "CMPOCODE")] + public string? Cmpocode { get; set; } + + /// <summary> + /// 鍘熺墿鏂欏嚭璐ф爣璇� + /// </summary> + [SugarColumn(ColumnName = "ITEM_FLAG")] + public decimal? ItemFlag { get; set; } + + /// <summary> + /// 1=鍗婃垚鍝佸嚭璐� + /// </summary> + [SugarColumn(ColumnName = "BOARD_FLAG")] + public decimal? BoardFlag { get; set; } + + /// <summary> + /// 鍑哄簱绫诲埆 + /// </summary> + [SugarColumn(ColumnName = "OUT_TYPE")] + public string? OutType { get; set; } + + /// <summary> + /// 涓氬姟绫诲瀷 + /// </summary> + [SugarColumn(ColumnName = "BUSINESS_TYPE")] + public string? BusinessType { get; set; } + + /// <summary> + /// 浜у搧缂栧彿 + /// </summary> + [SugarColumn(ColumnName = "BOARD_ITEM")] + public string? BoardItem { get; set; } + + /// <summary> + /// 浜ч噺 + /// </summary> + [SugarColumn(ColumnName = "PLAN_QTY")] + public decimal? PlanQty { get; set; } + + /// <summary> + /// 棰嗘枡缂栧彿/濮斿璁㈠崟 + /// </summary> + [SugarColumn(ColumnName = "PBILL_NO")] + public string? PbillNo { get; set; } + + /// <summary> + /// 琛ユ枡鐢宠鍗曞彿 + /// </summary> + [SugarColumn(ColumnName = "BBILL_NO")] + public string? BbillNo { get; set; } + + /// <summary> + /// 鏍囪瘑 /1宸叉帹閫� + /// </summary> + [SugarColumn(ColumnName = "NFLAG")] + public short? Nflag { get; set; } + + /// <summary> + /// 閫�鏂欐柟寮� + /// </summary> + [SugarColumn(ColumnName = "FMRMODE")] + public string? Fmrmode { get; set; } + + /// <summary> + /// erp杩斿洖淇℃伅 + /// </summary> + [SugarColumn(ColumnName = "MSG")] + public string? Msg { get; set; } + + /// <summary> + /// 鐘舵�� + /// </summary> + [SugarColumn(ColumnName = "STATES")] + public string? States { get; set; } + + [SugarColumn(IsIgnore = true)] public string? DepotName { get; set; } + + [SugarColumn(IsIgnore = true)] public string? SuppName { get; set; } + + [SugarColumn(IsIgnore = true)] public string? CreateByFname { get; set; } + + [SugarColumn(IsIgnore = true)] public string? CheckUserFname { get; set; } +} \ No newline at end of file diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.dll b/MES.Service/bin/Debug/net8.0/MES.Service.dll index a7c8bdc..66f28a5 100644 --- a/MES.Service/bin/Debug/net8.0/MES.Service.dll +++ b/MES.Service/bin/Debug/net8.0/MES.Service.dll Binary files differ diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.pdb b/MES.Service/bin/Debug/net8.0/MES.Service.pdb index 817f8a7..264ed84 100644 --- a/MES.Service/bin/Debug/net8.0/MES.Service.pdb +++ b/MES.Service/bin/Debug/net8.0/MES.Service.pdb Binary files differ diff --git a/MES.Service/bin/Release/net8.0/MES.Service.dll b/MES.Service/bin/Release/net8.0/MES.Service.dll index 693e2b7..310bae0 100644 --- a/MES.Service/bin/Release/net8.0/MES.Service.dll +++ b/MES.Service/bin/Release/net8.0/MES.Service.dll Binary files differ diff --git a/MES.Service/bin/Release/net8.0/MES.Service.pdb b/MES.Service/bin/Release/net8.0/MES.Service.pdb index 4b05908..003c8cc 100644 --- a/MES.Service/bin/Release/net8.0/MES.Service.pdb +++ b/MES.Service/bin/Release/net8.0/MES.Service.pdb Binary files differ diff --git a/MES.Service/service/Warehouse/MesInvItemArnManager.cs b/MES.Service/service/Warehouse/MesInvItemArnManager.cs index 81d0c48..c382c5c 100644 --- a/MES.Service/service/Warehouse/MesInvItemArnManager.cs +++ b/MES.Service/service/Warehouse/MesInvItemArnManager.cs @@ -49,4 +49,18 @@ return result; } + + public List<MesSupplier> GetSuppliers() + { + return Db.Queryable<MesInvItemArn, MesSupplier>((a, b) => + new JoinQueryInfos(JoinType.Left, a.SuppNo == b.SuppNo)) + .GroupBy((a, b) => new { b.Id, a.SuppNo, b.SuppName }) + .Select((a, b) => new MesSupplier + { + SuppNo = a.SuppNo, + SuppName = b.SuppName, + Id = b.Id + }) + .ToList(); + } } \ No newline at end of file diff --git a/MES.Service/service/Warehouse/MesInvItemInCDetailsManager.cs b/MES.Service/service/Warehouse/MesInvItemInCDetailsManager.cs index c27ff9a..d2b4515 100644 --- a/MES.Service/service/Warehouse/MesInvItemInCDetailsManager.cs +++ b/MES.Service/service/Warehouse/MesInvItemInCDetailsManager.cs @@ -1,7 +1,10 @@ 锘縰sing System.Data; using MES.Service.DB; +using MES.Service.Dto.@base; using MES.Service.Dto.service; using MES.Service.Modes; +using MES.Service.util; +using Microsoft.Extensions.Options; using Newtonsoft.Json; using SqlSugar; using DbType = System.Data.DbType; @@ -11,8 +14,6 @@ public class MesInvItemInCDetailsManager : Repository<MesInvItemInCDetails> { //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� - - private readonly MessageCenterManager _messageCenterManager = new(); public PurchaseInventory SaveBarCodes(WarehouseQuery entity) { @@ -27,7 +28,7 @@ // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼ Db.Ado.ExecuteCommand( - "BEGIN prc_rf_pda_scan_in_barcode(:c_in_str, :c_result); END;", + "BEGIN prc_rf_pda_scan_in_barcode_N(:c_in_str, :c_result); END;", new SugarParameter("c_in_str", inputParam, DbType.String), outputParam); @@ -108,36 +109,10 @@ }).ToPageList(query.PageIndex, query.Limit); } - public List<MesInvItemInCDetails> GetItemInDetails(decimal? pid) + public List<MesInvItemInCItems> GetItemInDetails(decimal? pid) { - var result = Db.Queryable<MesInvItemInCDetails, MesItems>( - (g, c) => new JoinQueryInfos( - JoinType.Left, - g.ItemNo == c.ItemNo && g.Company == c.Company && - g.Factory == c.Factory - ) - ) - .WhereIF(pid > 0, (g, c) => g.ItemInId == pid) - .GroupBy((g, c) => new - { - g.Company, g.Factory, g.ItemInId, g.WorkNo, g.ItemNo, - g.BoardStyle, g.WorkLine, c.ItemName, c.ItemModel, c.ItemUnit - }) - .Select((g, c) => new MesInvItemInCDetails - { - Company = g.Company, - Factory = g.Factory, - ItemInId = g.ItemInId, - WorkNo = g.WorkNo, - ItemNo = g.ItemNo, - ItemName = c.ItemName, - ItemModel = c.ItemModel, - ItemUnit = c.ItemUnit, - BoardStyle = g.BoardStyle, - WorkLine = g.WorkLine, - SumQuantity = SqlFunc.AggregateSum(g.Quantity) // 鑱氬悎璁$畻 - }) - .ToList(); + var result = Db.Queryable<MesInvItemInCItems>() + .WhereIF(pid > 0, g => g.ItemInId == pid).ToList(); return result; } @@ -170,7 +145,7 @@ return result; } - + public MessageCenter MesToErpParam(WarehouseQuery query) { var erpParameters = ""; @@ -187,10 +162,11 @@ title = "閲囪喘鍏ュ簱鍗�" + query.billNo + "鍙嶅鏍�"; } + string ErpUrl = AppsettingsUtility.Settings.TestErpUrl; var message = new MessageCenter { TableName = tableName, - Url = "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfo", + Url = ErpUrl, Status = 1, CreateBy = query.userName, Route = query.billNo, @@ -255,7 +231,7 @@ if (invItemIns.Status == 1) throw new Exception("鍏ュ簱鍗曞凡瀹℃牳锛屼笉鑳介噸澶嶆帹閫�"); - var materials = Db.Queryable<MesInvItemInCDetails, MesItems, MesUnit, + var materials = Db.Queryable<MesInvItemInCItems, MesItems, MesUnit, MesInvItemArnDetail>( (g, c, d, a) => new JoinQueryInfos( JoinType.Left, diff --git a/MES.Service/service/Warehouse/MesInvItemInCItemsManager.cs b/MES.Service/service/Warehouse/MesInvItemInCItemsManager.cs new file mode 100644 index 0000000..fee3845 --- /dev/null +++ b/MES.Service/service/Warehouse/MesInvItemInCItemsManager.cs @@ -0,0 +1,82 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.Warehouse; + +public class MesInvItemInCItemsManager : Repository<MesInvItemInCItems> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 MesInvItemInCItemsManager.cs + + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = base.GetPageList(it => 1 == 1, p, + it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var + conModels = + new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel + { + FieldName = typeof(MesInvItemInCItems).GetProperties()[0].Name, + ConditionalType = ConditionalType.Equal, FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, + it => SqlFunc.GetRandom()); + + AsQueryable().Where(x => 1 == 1) + .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new MesInvItemInCItems(); //娴嬭瘯鍙傛暟 + var insertArray = new[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData) + .ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new MesInvItemInCItems(); //娴嬭瘯鍙傛暟 + var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new MesInvItemInCItems() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData) + .ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new MesInvItemInCItems(); //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2) + .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/Warehouse/MesInvItemOutItemsManager.cs b/MES.Service/service/Warehouse/MesInvItemOutItemsManager.cs new file mode 100644 index 0000000..ec0d8cd --- /dev/null +++ b/MES.Service/service/Warehouse/MesInvItemOutItemsManager.cs @@ -0,0 +1,78 @@ +锘縰sing MES.Service.DB; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.Warehouse; + +public class MesInvItemOutItemsManager : Repository<MesInvItemOutItems> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 MesInvItemOutItemsManager.cs + + + #region 鏁欏鏂规硶 + + /// <summary> + /// 浠撳偍鏂规硶婊¤冻涓嶄簡澶嶆潅涓氬姟闇�姹傦紝涓氬姟浠g爜璇峰湪杩欓噷闈㈠畾涔夋柟娉� + /// </summary> + public void Study() + { + /*********鏌ヨ*********/ + + var data1 = base.GetById(1); //鏍规嵁ID鏌ヨ + var data2 = base.GetList(); //鏌ヨ鎵�鏈� + var data3 = base.GetList(it => 1 == 1); //鏍规嵁鏉′欢鏌ヨ + //var data4 = base.GetSingle(it => 1 == 1);//鏍规嵁鏉′欢鏌ヨ涓�鏉�,濡傛灉瓒呰繃涓�鏉′細鎶ラ敊 + + var p = new PageModel { PageIndex = 1, PageSize = 2 }; // 鍒嗛〉鏌ヨ + var data5 = base.GetPageList(it => 1 == 1, p); + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var data6 = + base.GetPageList(it => 1 == 1, p, + it => SqlFunc.GetRandom()); // 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount); //杩斿洖鎬绘暟 + + var conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel + { + FieldName = typeof(MesInvItemOutItems).GetProperties()[0].Name, + ConditionalType = ConditionalType.Equal, FieldValue = "1" + }); //id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom()); + + AsQueryable().Where(x => 1 == 1) + .ToList(); //鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + /*********鎻掑叆*********/ + var insertData = new MesInvItemOutItems(); //娴嬭瘯鍙傛暟 + var insertArray = new[] { insertData }; + base.Insert(insertData); //鎻掑叆 + base.InsertRange(insertArray); //鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData); //鎻掑叆杩斿洖鑷鍒� + AsInsertable(insertData).ExecuteCommand(); //鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + /*********鏇存柊*********/ + var updateData = new MesInvItemOutItems(); //娴嬭瘯鍙傛暟 + var updateArray = new[] { updateData }; //娴嬭瘯鍙傛暟 + base.Update(updateData); //鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray); //鎵归噺鏇存柊 + //base.Update(it => new MesInvItemOutItems() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + /*********鍒犻櫎*********/ + var deldata = new MesInvItemOutItems(); //娴嬭瘯鍙傛暟 + base.Delete(deldata); //鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1); //鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new[] { 1, 2 }); //鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it => 1 == 2); //鏍规嵁鏉′欢鍒犻櫎 + AsDeleteable().Where(it => 1 == 2) + .ExecuteCommand(); //杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + + #endregion +} \ No newline at end of file diff --git a/MES.Service/service/Warehouse/MesInvItemOutsManager.cs b/MES.Service/service/Warehouse/MesInvItemOutsManager.cs new file mode 100644 index 0000000..db0ca42 --- /dev/null +++ b/MES.Service/service/Warehouse/MesInvItemOutsManager.cs @@ -0,0 +1,372 @@ +锘縰sing MES.Service.DB; +using MES.Service.Dto.service; +using MES.Service.Modes; +using SqlSugar; + +namespace MES.Service.service.Warehouse; + +public class MesInvItemOutsManager : Repository<MesInvItemOuts> +{ + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 MesInvItemOutsManager.cs + + public bool Audit(WarehouseQuery query) + { + // 瀹℃牳鍓嶆牎楠� + Validate(query); + //瀹℃牳 + return Db.Updateable<MesInvItemOuts>() + .SetColumns(s => s.Status == 1) + .SetColumns(s => s.CheckUser == query.userName) + .SetColumns(s => s.CheckDate == DateTime.Now) + .Where(s => s.Id == query.id).ExecuteCommand() > 0; + } + + + public void Validate(WarehouseQuery query) + { + // 鏍¢獙鍗曞彿鏄惁姝g‘ + var mesInvItemOuts = Db.Queryable<MesInvItemOuts>() + .Where(o => o.ItemOutNo == query.billNo) + .Single(); + + if (mesInvItemOuts == null) + throw new Exception("娌℃壘鍒�" + query.billNo + " 瀵瑰簲鐨勯噰璐��璐у崟锛岃妫�鏌�"); + + // 鏍¢獙瀛愯〃鏁版嵁 + var itemOutItems = Db.Queryable<MesInvItemOutItems>() + .Where(o => o.ItemOutId == mesInvItemOuts.Id) + .ToList(); + + var sql = string.Empty; + var P_Msg = string.Empty; + + foreach (var item in itemOutItems) + { + // 鍒ゆ柇鐢宠鏁伴噺鏄惁澶т簬鍓╀綑鍙��鏁伴噺 + sql = string.Format( + @"SELECT NVL(s1.RK_QTY, 0) - NVL(KT_QTY, 0) KT_QTY --鍓╀綑鍙�� + FROM MES_INV_ITEM_OUT_ITEMS C + LEFT JOIN (SELECT SUM(QUANTITY) KT_QTY, + ITEM_NO, + PBILL_NO, + RK_NO, + WORK_LINE + FROM MES_INV_ITEM_OUT_ITEMS + GROUP BY ITEM_NO, PBILL_NO, WORK_LINE,RK_NO) U + ON U.ITEM_NO = C.ITEM_NO + AND U.WORK_LINE = C.WORK_LINE + AND U.PBILL_NO = C.PBILL_NO + AND U.RK_NO = C.RK_NO + LEFT JOIN (SELECT SUM(QUANTITY) RK_QTY, + ITEM_NO, + EBELN, + WORK_LINE,BILL_NO + FROM MES_INV_ITEM_IN_C_ITEMS + GROUP BY ITEM_NO, EBELN, WORK_LINE,BILL_NO) s1 + ON S1.ITEM_NO = C.ITEM_NO + AND S1.WORK_LINE = C.WORK_LINE + AND S1.EBELN = C.PBILL_NO + AND S1.BILL_NO = C.RK_NO + WHERE C.ID = {0}", item.Id); + var sy_Qty = Db.Ado.SqlQuery<decimal>(sql); + + if (sy_Qty != null && sy_Qty[0] < 0) + { + P_Msg = + $"閲囪喘璁㈠崟锛歿item.PbillNo}锛岃锛歿item.WorkLine}锛岀墿鏂欙細{item.ItemNo} 鐢宠鏁伴噺澶т簬鍓╀綑鍙敹鏁伴噺"; + throw new Exception(P_Msg); + } + + // 鍒ゆ柇琛屾槸鍚﹂噸澶� + var cf_Num = Db.Queryable<MesInvItemOutItems>() + .Where(s1 => s1.ItemNo == item.ItemNo && + s1.WorkLine == item.WorkLine && + s1.PbillNo == item.PbillNo && + s1.ItemOutId == mesInvItemOuts.Id && + s1.RkNo == item.RkNo) + .Count(); + + if (cf_Num > 1) + { + P_Msg = + $"閲囪喘璁㈠崟锛歿item.PbillNo}锛岃锛歿item.WorkLine}锛岀墿鏂欙細{item.ItemNo}閲嶅璇峰垹闄ゅ叾涓竴鏉℃暟鎹�"; + throw new Exception(P_Msg); + } + } + + // 鏍¢獙涓昏〃鍐呭鏄惁琚垹鎺� + // 涓昏〃浠撳簱缂栫爜 + if (string.IsNullOrEmpty(mesInvItemOuts.DepotCode)) + { + P_Msg = "浠撳簱缂栫爜涓虹┖锛岃妫�鏌�"; + throw new Exception(P_Msg); + } + + var supplierExists = Db.Queryable<MesSupplier>() + .Any(supplier => supplier.SuppNo == mesInvItemOuts.SuppNo); + + if (!supplierExists) + { + P_Msg = $"渚涘簲鍟嗙紪鐮� {mesInvItemOuts.SuppNo} 鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇锋鏌�"; + throw new Exception(P_Msg); + } + + // 瀛愯〃琛屼笌涓昏〃绗﹀悎鎬ф牎楠� + foreach (var j in itemOutItems) + { + // 鏍¢獙瀛愯〃瀵瑰簲閲囪喘璁㈠崟鐨勪緵搴斿晢缂栫爜 + var c_SuppNo = Db.Queryable<MesRohIn, MesSupplier>( + (roh, supp) => new JoinQueryInfos( + JoinType.Left, + roh.Supplier == supp.Id.ToString() + )) + .Where(roh => roh.BillNo == j.PbillNo) + .Select((roh, supp) => supp.SuppNo) + .Single(); + + if (c_SuppNo == null) + { + P_Msg = $"瀛愯〃琛屼緵搴斿晢缂栫爜 {c_SuppNo} 鍦ㄧ郴缁熶腑鏈壘鍒�"; + throw new Exception(P_Msg); + } + + if (mesInvItemOuts.SuppNo != c_SuppNo) + { + P_Msg = + $"瀛愯〃閲囪喘璁㈠崟琛岀殑渚涘簲鍟嗙紪鐮� {c_SuppNo} 涓庝富琛ㄤ緵搴斿晢缂栫爜 {mesInvItemOuts.SuppNo} 涓嶄竴鑷达紝璇锋鏌�"; + throw new Exception(P_Msg); + } + + // 鏍¢獙瀛愯〃濮斿閲囪喘绫诲瀷鍜屼富琛ㄧ被鍨嬫槸鍚︿竴鑷� + if (j.FType != mesInvItemOuts.FType) + { + P_Msg = + $"瀛愯〃濮斿绫诲瀷锛歿j.FType}锛屼笌涓昏〃濮斿绫诲瀷锛歿mesInvItemOuts.FType}锛屼笉涓�鑷达紝璇锋鏌�"; + throw new Exception(P_Msg); + } + + // 妫�鏌ュ瓙琛ㄤ粨搴撴槸鍚﹀拰涓昏〃浠撳簱涓�鑷� + if (j.DepotCode != mesInvItemOuts.DepotCode) + { + P_Msg = + $"瀛愯〃浠撳簱缂栫爜锛歿j.DepotCode} 涓庝富琛ㄤ粨搴撶紪鐮侊細{mesInvItemOuts.DepotCode}锛屼笉涓�鑷达紝璇锋鏌�"; + throw new Exception(P_Msg); + } + } + } + + public OutItemDto SaveCombination(OutItemDto dto) + { + var mesInvItemOuts = dto.Form; + mesInvItemOuts.Status = 0; + mesInvItemOuts.BoardFlag = 0; + mesInvItemOuts.Sapstatus = 0; + mesInvItemOuts.OutStatus = 0; + mesInvItemOuts.ItemFlag = 0; + mesInvItemOuts.IsVisual = 1; + mesInvItemOuts.TransactionNo = 203; + mesInvItemOuts.Factory = "1000"; + mesInvItemOuts.Company = "1000"; + + //杩斿洖ID + var id = Db.Insertable(mesInvItemOuts) + .ExecuteReturnIdentity(); + + if (id <= 0) throw new Exception("鎻掑叆閿欒"); + + mesInvItemOuts.Id = id; + dto.SaveItems.ForEach(s => + { + s.ItemOutId = id; + s.Factory = "1000"; + s.Company = "1000"; + s.Status = 0; + s.DepotCode = mesInvItemOuts.DepotCode; + s.FType = mesInvItemOuts.FType; + s.CreateBy = mesInvItemOuts.CreateBy; + s.CreateDate = mesInvItemOuts.CreateDate; + }); + + var insertable = Db.Insertable(dto.SaveItems) + .ExecuteCommand(); + + if (insertable < 0) throw new Exception("鎻掑叆閿欒"); + + var query = new WarehouseQuery(); + query.id = id; + dto.SelectItems = GetItems(query); + + return dto; + } + + public List<MesInvItemOuts> GetPage(WarehouseQuery query) + { + return + Db.Queryable<MesInvItemOuts, MesDepots, MesSupplier, SysUser, + SysUser>((a, e, i, u1, u3) => + new JoinQueryInfos( + JoinType.Left, + a.DepotCode == e.DepotCode + && e.Factory == a.Factory + && e.Company == a.Company, + JoinType.Left, + a.SuppNo == i.SuppNo, + JoinType.Left, + a.CreateBy == u1.Fcode, + JoinType.Left, + a.CheckUser == u3.Fcode)) + .WhereIF(query.id > 0, + (a, e, i, u1, u3) => a.Id == query.id) + .Select((a, e, i, u1, u3) => new MesInvItemOuts + { + Id = a.Id, + DepotCode = a.DepotCode, + Fmrmode = a.Fmrmode, + CheckDate = a.CheckDate, + CheckUser = a.CheckUser, + States = a.States, + Reason = a.Reason, + Remark = a.Remark, + Nflag = a.Nflag, + FType = a.FType, + SuppNo = a.SuppNo, + DepotName = e.DepotName, + SuppName = i.SuppName, + CreateByFname = u1.Fname, + CheckUserFname = u3.Fname, + CreateDate = a.CreateDate, + CreateBy = a.CreateBy, + Status = a.Status, + ItemOutNo = a.ItemOutNo + }).ToPageList(query.PageIndex, query.Limit); + } + + //MESInvItemOutItems + public List<MESInvItemOutItems> GetItems(WarehouseQuery query) + { + var where = "and 1=1"; + if (query.id != null) where = "and ITEM_OUT_ID = '" + query.id + "'"; + + var sql = string.Format(@"select * from ( + SELECT C.REMARK, C.PBILL_NO, C.ITEM_OUT_ID, C.RK_QTY, + C.TL_QTY, C.WORK_LINE, C.QUANTITY, C.ITEM_NO, + NVL(s1.RK_QTY, 0) - NVL(KT_QTY, 0) KT_QTY, + R.DEPOT_SECTION_CODE, S.ITEM_MODEL, S.ITEM_NAME, + K.CGB014, Q.STAFF_NAME, R.DEPOT_CODE + FROM MES_INV_ITEM_OUT_ITEMS C JOIN MES_ITEMS S ON C.ITEM_NO = S.ITEM_NO + LEFT JOIN (SELECT SUM(QUANTITY) KT_QTY, ITEM_NO, PBILL_NO, WORK_LINE, RK_NO + FROM MES_INV_ITEM_OUT_ITEMS + GROUP BY ITEM_NO, PBILL_NO, WORK_LINE, RK_NO) U + ON U.ITEM_NO = C.ITEM_NO AND U.WORK_LINE = C.WORK_LINE + AND U.PBILL_NO = C.PBILL_NO AND U.RK_NO = C.RK_NO + LEFT JOIN (SELECT SUM(QUANTITY) RK_QTY, ITEM_NO, EBELN, WORK_LINE, BILL_NO + FROM mes_inv_item_in_c_details + GROUP BY ITEM_NO, EBELN, WORK_LINE, BILL_NO) s1 + ON S1.ITEM_NO = C.ITEM_NO AND S1.WORK_LINE = C.WORK_LINE + AND S1.EBELN = C.PBILL_NO AND S1.BILL_NO = C.RK_NO + LEFT JOIN MES_ROH_IN_DATA K + ON K.BILL_NO = C.PBILL_NO AND C.WORK_LINE = K.PURCHASE_ORDER_LINE_NUMBER + left join MES_ROH_IN H on H.BILL_NO = K.BILL_NO + left join MES_STAFF Q on H.PURCHASER = Q.STAFF_NAME + LEFT JOIN MES_SUPPLIER T ON H.SUPPLIER = T.ID + LEFT JOIN (select * + from (SELECT row_number() over (partition by DEPOT_CODE, ITEM_NO, EBELN order by CREATE_DATE) rn, DEPOT_CODE, DEPOT_SECTION_CODE, ITEM_NO, + EBELN FROM mes_inv_item_in_c_details + where EBELN is not null) + where rn = 1 and ROWNUM = 1) R ON R.ITEM_NO = C.ITEM_NO) where 1=1 {0}", + where); + var results = Db.Ado.SqlQuery<MESInvItemOutItems>(sql); + return results; + } + + public List<InventoryItem> GetSumItem(WarehouseQuery query) + { + var sql = string.Format(@"SELECT DEPOT ,ITEM_NO,ITEM_MODEL, + ITEM_NAME,QTY FROM (SELECT SUM(QTY) QTY, DEPOT, ITEM_NO, ITEM_MODEL, ITEM_NAME + FROM (SELECT f_get_section_code2('1000', '1000', b.ITEM_NO,'{0}') DEPOT, + B.ITEM_NO, A.ITEM_MODEL,A.ITEM_NAME,to_char(nvl(b.QUANTITY, 0) - nvl(D.QUANTITY_OK, 0),'FM9999999990.00') QTY + FROM MES_INV_ITEM_OUT_ITEMS B LEFT JOIN mes_ITEMS A + ON B.ITEM_NO = A.ITEM_NO LEFT JOIN (SELECT ITEM_OUT_ID, + ITEM_NO,PBILL_NO,SUM(QUANTITY) QUANTITY_OK,RK_NO + FROM MES_INV_ITEM_OUT_C_DETAILS + WHERE ITEM_OUT_ID = {1} + GROUP BY ITEM_OUT_ID,ITEM_NO,PBILL_NO,RK_NO) D + ON D.ITEM_OUT_ID = B.ITEM_OUT_ID + AND D.ITEM_NO = B.ITEM_NO + AND D.PBILL_NO = B.PBILL_NO + AND D.RK_NO = B.RK_NO + WHERE B.ITEM_OUT_ID = {1} + AND nvl(b.QUANTITY, 0) - nvl(D.QUANTITY_OK, 0) > 0 + ORDER BY f_get_section_code2('1000','1000',b.ITEM_NO,'{0}'), + A.ITEM_MODEL,A.ITEM_NAME) + GROUP BY DEPOT, ITEM_NO, ITEM_MODEL, ITEM_NAME)", query.DepotCode, + query.id); + + var results = Db.Ado.SqlQuery<InventoryItem>(sql); + return results; + } + + public List<InventoryItemDetail> SelectMaterials(WarehouseQuery query) + { + var sql = string.Format(@"select B.WORK_NO, b.work_line, + b.item_no, s2.item_name, s2.item_model, + sum(b.quantity) sum_Quantity, + b.unit, b.supp_no, + nvl(s1.quantity, 0) quantity, + sum(b.quantity) - nvl(U.KT_QTY, 0) Refundable_Quantity, + B.cbill_no, B.task_no, A.BILL_NO, + to_char(b.CREATE_DATE, 'yyyy-mm-dd') as CREATE_DATE + from mes_inv_item_in_c_details b + left join mes_inv_item_ins a on b.item_in_id = a.id + LEFT JOIN (select s.item_no, s.work_line, s.Work_no, + sum(s.quantity) quantity, S.RK_NO + from mes_inv_item_out_c_details s + group by s.item_no, s.work_line, s.work_no, S.RK_NO) s1 + ON NVL(B.work_LINE, '0') = NVL(s1.work_LINE, '0') + and B.work_no = s1.work_no + and B.item_no = s1.item_no + AND B.BILL_NO = S1.RK_NO + LEFT JOIN (SELECT SUM(QUANTITY) KT_QTY, ITEM_NO, PBILL_NO, WORK_LINE, RK_NO + FROM MES_INV_ITEM_OUT_ITEMS + GROUP BY ITEM_NO, PBILL_NO, WORK_LINE, RK_NO) U + ON U.ITEM_NO = B.ITEM_NO + AND U.WORK_LINE = B.WORK_LINE + AND U.PBILL_NO = B.WORK_NO AND U.RK_NO = B.BILL_NO + left join mes_items s2 on b.item_no = s2.item_no + left join purdha da on da.dha001 = b.cbill_no + WHERE A.BILL_NO LIKE 'Q%' + AND A.CBILL_NO like 'L%' + group by b.item_no, b.work_line, b.supp_no, b.remark, s1.quantity, b.unit, + s2.item_name, s2.item_model, da.dha003, B.WORK_NO, B.cbill_no, B.task_no, + to_char(b.CREATE_DATE, 'yyyy-mm-dd'), A.BILL_NO, U.KT_QTY, A.CBILL_NO + having b.remark = '閲囪喘鍏ュ簱' + and sum(b.quantity) - nvl(U.KT_QTY, 0) > 0 + and b.supp_no = '{0}' + order by to_char(b.CREATE_DATE, 'yyyy-mm-dd')", + query.SuppNo); + + var results = Db.Ado.SqlQuery<InventoryItemDetail>(sql); + return results; + } + + public string GetMaxItemOutNo() + { + var date = DateTime.Now.ToString("yyyyMMdd"); + var par = "NTL" + date; + var sql = + $"select max(ITEM_OUT_NO) from MES_INV_ITEM_OUTS where ITEM_OUT_NO like '{par}%'"; + var maxBillNo = Db.Ado.SqlQuerySingle<string>(sql); + + var number = "0001"; + if (maxBillNo != null) + { + maxBillNo = maxBillNo.Substring(11); + var no = Convert.ToInt32(maxBillNo); + no++; + number = no.ToString().PadLeft(4, '0'); + } + + return "NTL" + date + number; + } +} \ No newline at end of file diff --git a/MES.Service/util/AppsettingsUtility.cs b/MES.Service/util/AppsettingsUtility.cs new file mode 100644 index 0000000..f769cc0 --- /dev/null +++ b/MES.Service/util/AppsettingsUtility.cs @@ -0,0 +1,24 @@ +锘縰sing MES.Service.Dto.@base; +using Microsoft.Extensions.Configuration; + +namespace MES.Service.util; + +public class AppsettingsUtility +{ + private static AppSettings _appSettings; + + public static AppSettings Settings + { + get { return _appSettings; } + } + + public void Initial(IConfiguration configuration) + { + AppSettings myOwn = new AppSettings(); + //娉ㄦ剰锛氬彲浠ヤ娇鐢ㄥ啋鍙锋潵鑾峰彇鍐呭眰鐨勯厤缃」 + myOwn.TestErpUrl = configuration["AppSettings:TestErpUrl"]; + myOwn.ProductionErpUrl = configuration["AppSettings:ProductionErpUrl"]; + myOwn.DataBaseConn = configuration["AppSettings:DataBaseConn"]; + _appSettings = myOwn; + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/Warehouse/MesInvItemArnController.cs b/MESApplication/Controllers/Warehouse/MesInvItemArnController.cs index 007d9f9..ab5eb43 100644 --- a/MESApplication/Controllers/Warehouse/MesInvItemArnController.cs +++ b/MESApplication/Controllers/Warehouse/MesInvItemArnController.cs @@ -34,6 +34,27 @@ } } + //GetSuppliers() + [HttpPost("GetSuppliers")] + public ResponseResult GetSuppliers() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetSuppliers(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + /// <summary> /// 鑾峰彇鎵�鏈� /// </summary> diff --git a/MESApplication/Controllers/Warehouse/MesInvItemInCItemsController.cs b/MESApplication/Controllers/Warehouse/MesInvItemInCItemsController.cs new file mode 100644 index 0000000..e849ce3 --- /dev/null +++ b/MESApplication/Controllers/Warehouse/MesInvItemInCItemsController.cs @@ -0,0 +1,163 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.Warehouse; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.Warehouse; + +[ApiController] +[Route("api/[controller]")] +public class MesInvItemInCItemsController : ControllerBase +{ + private readonly MesInvItemInCItemsManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesInvItemInCItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity( + [FromBody] MesInvItemInCItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesInvItemInCItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/Warehouse/MesInvItemOutItemsController.cs b/MESApplication/Controllers/Warehouse/MesInvItemOutItemsController.cs new file mode 100644 index 0000000..405bdb7 --- /dev/null +++ b/MESApplication/Controllers/Warehouse/MesInvItemOutItemsController.cs @@ -0,0 +1,163 @@ +锘縰sing System.Dynamic; +using MES.Service.Modes; +using MES.Service.service.Warehouse; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.Warehouse; + +[ApiController] +[Route("api/[controller]")] +public class MesInvItemOutItemsController : ControllerBase +{ + private readonly MesInvItemOutItemsManager m = new(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesInvItemOutItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity( + [FromBody] MesInvItemOutItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesInvItemOutItems data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Controllers/Warehouse/MesInvItemOutsController.cs b/MESApplication/Controllers/Warehouse/MesInvItemOutsController.cs new file mode 100644 index 0000000..75de3a1 --- /dev/null +++ b/MESApplication/Controllers/Warehouse/MesInvItemOutsController.cs @@ -0,0 +1,308 @@ +锘縰sing System.Dynamic; +using MES.Service.Dto.service; +using MES.Service.Modes; +using MES.Service.service.Warehouse; +using MES.Service.util; +using Microsoft.AspNetCore.Mvc; + +namespace MESApplication.Controllers.Warehouse; + +[ApiController] +[Route("api/[controller]")] +public class MesInvItemOutsController : ControllerBase +{ + private readonly MesInvItemOutsManager m = new(); + + //Audit + [HttpPost("Audit")] + public ResponseResult Audit(WarehouseQuery query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Audit(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + //SaveCombination + [HttpPost("SaveCombination")] + public ResponseResult SaveCombination(OutItemDto dto) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.SaveCombination(dto); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + //GetMaxItemOutNo + [HttpPost("GetMaxItemOutNo")] + public ResponseResult GetMaxItemOutNo() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetMaxItemOutNo(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("GetPage")] + public ResponseResult GetPage(WarehouseQuery query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetPage(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + //GetItems + [HttpPost("GetItems")] + public ResponseResult GetItems(WarehouseQuery query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetItems(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("GetSumItem")] + public ResponseResult GetSumItem(WarehouseQuery query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetSumItem(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + //SelectMaterials + [HttpPost("SelectMaterials")] + public ResponseResult SelectMaterials(WarehouseQuery query) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.SelectMaterials(query); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + /// <returns></returns> + [HttpPost("GetList")] + public ResponseResult GetList() + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetList(); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + + /// <summary> + /// 鏍规嵁涓婚敭鑾峰彇 + /// </summary> + /// <returns></returns> + [HttpPost("GetById")] + public ResponseResult GetById(int id) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.GetById(id); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 鏍规嵁涓婚敭鍒犻櫎 + /// </summary> + /// <returns></returns> + [HttpPost("DeleteByIds")] + public ResponseResult DeleteByIds([FromBody] object[] ids) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.DeleteByIds(ids); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞 + /// </summary> + /// <returns></returns> + [HttpPost("Insert")] + public ResponseResult Add([FromBody] MesInvItemOuts data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Insert(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 娣诲姞杩斿洖鑷 + /// </summary> + /// <returns></returns> + [HttpPost("InsertReturnIdentity")] + public ResponseResult InsertReturnIdentity( + [FromBody] MesInvItemOuts data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.InsertReturnIdentity(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } + + /// <summary> + /// 淇敼 + /// </summary> + /// <returns></returns> + [HttpPost("Update")] + public ResponseResult Update([FromBody] MesInvItemOuts data) + { + try + { + dynamic resultInfos = new ExpandoObject(); + resultInfos.tbBillList = m.Update(data); + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + return ResponseResult.ResponseError(ex); + } + } +} \ No newline at end of file diff --git a/MESApplication/Startup.cs b/MESApplication/Startup.cs index 20a55e3..f506f0e 100644 --- a/MESApplication/Startup.cs +++ b/MESApplication/Startup.cs @@ -1,4 +1,6 @@ -锘縰sing Microsoft.OpenApi.Models; +锘縰sing MES.Service.Dto.@base; +using MES.Service.util; +using Microsoft.OpenApi.Models; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Swashbuckle.AspNetCore.SwaggerUI; @@ -13,6 +15,8 @@ public Startup(IConfiguration configuration) { Configuration = configuration; + + new AppsettingsUtility().Initial(configuration); } public IConfiguration Configuration { get; } @@ -21,6 +25,11 @@ public void ConfigureServices(IServiceCollection services) { services.AddControllers(); + + // 璇诲彇 绯荤粺 璁剧疆骞舵敞鍏ュ埌鏈嶅姟涓� + services.Configure<AppSettings>( + Configuration.GetSection("AppSettings")); + services.AddSwaggerGen(c => { c.SwaggerDoc("v1", diff --git a/MESApplication/appsettings.json b/MESApplication/appsettings.json index 93b64d3..41c8e8b 100644 --- a/MESApplication/appsettings.json +++ b/MESApplication/appsettings.json @@ -6,5 +6,10 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "AppSettings": { + "TestErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfo", + "ProductionErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfoFormal", + "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.251)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = sg_prd; Password=sgprd" + } } diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.dll b/MESApplication/bin/Debug/net8.0/MES.Service.dll index a7c8bdc..66f28a5 100644 --- a/MESApplication/bin/Debug/net8.0/MES.Service.dll +++ b/MESApplication/bin/Debug/net8.0/MES.Service.dll Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.pdb b/MESApplication/bin/Debug/net8.0/MES.Service.pdb index 817f8a7..264ed84 100644 --- a/MESApplication/bin/Debug/net8.0/MES.Service.pdb +++ b/MESApplication/bin/Debug/net8.0/MES.Service.pdb Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.dll b/MESApplication/bin/Debug/net8.0/MESApplication.dll index 79f41d2..175b841 100644 --- a/MESApplication/bin/Debug/net8.0/MESApplication.dll +++ b/MESApplication/bin/Debug/net8.0/MESApplication.dll Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.exe b/MESApplication/bin/Debug/net8.0/MESApplication.exe index ce8751a..d1f929e 100644 --- a/MESApplication/bin/Debug/net8.0/MESApplication.exe +++ b/MESApplication/bin/Debug/net8.0/MESApplication.exe Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.pdb b/MESApplication/bin/Debug/net8.0/MESApplication.pdb index f9d6ff7..7b3eb85 100644 --- a/MESApplication/bin/Debug/net8.0/MESApplication.pdb +++ b/MESApplication/bin/Debug/net8.0/MESApplication.pdb Binary files differ diff --git a/MESApplication/bin/Debug/net8.0/appsettings.json b/MESApplication/bin/Debug/net8.0/appsettings.json index 93b64d3..41c8e8b 100644 --- a/MESApplication/bin/Debug/net8.0/appsettings.json +++ b/MESApplication/bin/Debug/net8.0/appsettings.json @@ -6,5 +6,10 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "AppSettings": { + "TestErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfo", + "ProductionErpUrl": "http://192.168.11.120:8098/WebService1.asmx/mesToErpinfoFormal", + "DataBaseConn": "Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.11.251)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = ORCL))); Persist Security Info=True;User ID = sg_prd; Password=sgprd" + } } diff --git a/MESApplication/bin/Release/net8.0/MES.Service.dll b/MESApplication/bin/Release/net8.0/MES.Service.dll index 693e2b7..310bae0 100644 --- a/MESApplication/bin/Release/net8.0/MES.Service.dll +++ b/MESApplication/bin/Release/net8.0/MES.Service.dll Binary files differ diff --git a/MESApplication/bin/Release/net8.0/MES.Service.pdb b/MESApplication/bin/Release/net8.0/MES.Service.pdb index 4b05908..003c8cc 100644 --- a/MESApplication/bin/Release/net8.0/MES.Service.pdb +++ b/MESApplication/bin/Release/net8.0/MES.Service.pdb Binary files differ diff --git a/MESApplication/bin/Release/net8.0/MESApplication.dll b/MESApplication/bin/Release/net8.0/MESApplication.dll index b0b5ed2..d28e8f6 100644 --- a/MESApplication/bin/Release/net8.0/MESApplication.dll +++ b/MESApplication/bin/Release/net8.0/MESApplication.dll Binary files differ diff --git a/MESApplication/bin/Release/net8.0/MESApplication.exe b/MESApplication/bin/Release/net8.0/MESApplication.exe index ce8751a..681a2b8 100644 --- a/MESApplication/bin/Release/net8.0/MESApplication.exe +++ b/MESApplication/bin/Release/net8.0/MESApplication.exe Binary files differ diff --git a/MESApplication/bin/Release/net8.0/MESApplication.pdb b/MESApplication/bin/Release/net8.0/MESApplication.pdb index 035c9eb..48c28f8 100644 --- a/MESApplication/bin/Release/net8.0/MESApplication.pdb +++ b/MESApplication/bin/Release/net8.0/MESApplication.pdb Binary files differ diff --git a/MESApplication/bin/Release/net8.0/publish/MES.Service.dll b/MESApplication/bin/Release/net8.0/publish/MES.Service.dll index 693e2b7..310bae0 100644 --- a/MESApplication/bin/Release/net8.0/publish/MES.Service.dll +++ b/MESApplication/bin/Release/net8.0/publish/MES.Service.dll Binary files differ diff --git a/MESApplication/bin/Release/net8.0/publish/MES.Service.pdb b/MESApplication/bin/Release/net8.0/publish/MES.Service.pdb index 4b05908..003c8cc 100644 --- a/MESApplication/bin/Release/net8.0/publish/MES.Service.pdb +++ b/MESApplication/bin/Release/net8.0/publish/MES.Service.pdb Binary files differ diff --git a/MESApplication/bin/Release/net8.0/publish/MESApplication.dll b/MESApplication/bin/Release/net8.0/publish/MESApplication.dll index b0b5ed2..d28e8f6 100644 --- a/MESApplication/bin/Release/net8.0/publish/MESApplication.dll +++ b/MESApplication/bin/Release/net8.0/publish/MESApplication.dll Binary files differ diff --git a/MESApplication/bin/Release/net8.0/publish/MESApplication.exe b/MESApplication/bin/Release/net8.0/publish/MESApplication.exe index ce8751a..681a2b8 100644 --- a/MESApplication/bin/Release/net8.0/publish/MESApplication.exe +++ b/MESApplication/bin/Release/net8.0/publish/MESApplication.exe Binary files differ diff --git a/MESApplication/bin/Release/net8.0/publish/MESApplication.pdb b/MESApplication/bin/Release/net8.0/publish/MESApplication.pdb index 035c9eb..48c28f8 100644 --- a/MESApplication/bin/Release/net8.0/publish/MESApplication.pdb +++ b/MESApplication/bin/Release/net8.0/publish/MESApplication.pdb Binary files differ -- Gitblit v1.9.3