From a2dc4c688ed5e98dcaae0768d20d4ba0e5730a84 Mon Sep 17 00:00:00 2001 From: hao <1836460075@qq.com> Date: 星期二, 03 六月 2025 15:52:10 +0800 Subject: [PATCH] 调拨出库测试 --- StandardInterface/MES.Service/service/CgthSqDetailManager.cs | 78 +++ StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderSubDto.cs | 4 StandardInterface/MES.Service/service/DbckaManager.cs | 131 +++++ StandardInterface/MES.Service/Dto/webApi/ERPCGTH.cs | 7 StandardInterface/MES.Service/Dto/webApi/ErpCGTHA.cs | 28 + StandardInterface/MES.Service/Dto/webApi/ErpCGTHB.cs | 21 StandardInterface/MESApplication/Controllers/DbckaController.cs | 97 ++++ StandardInterface/MES.Service/Dto/webApi/ERPDBCK.cs | 47 + StandardInterface/MES.Service/Modes/CgthSqDetail.cs | 119 ++++ StandardInterface/MES.Service/service/BasicData/Production/ProductionOrderManager.cs | 6 StandardInterface/MES.Service/Modes/Dbcka.cs | 27 + StandardInterface/MES.Service/service/CgthSqManager.cs | 220 +++++++++ StandardInterface/MES.Service/Modes/Dbckb.cs | 24 + StandardInterface/MES.Service/Modes/Womcaa.cs | 18 StandardInterface/MESApplication/Controllers/CgthSqController.cs | 266 +++++++++++ StandardInterface/MESApplication/Controllers/CgthSqDetailController.cs | 169 +++++++ StandardInterface/MES.Service/Modes/CgthSq.cs | 164 ++++++ StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderDto.cs | 10 18 files changed, 1,426 insertions(+), 10 deletions(-) diff --git a/StandardInterface/MES.Service/Dto/webApi/ERPCGTH.cs b/StandardInterface/MES.Service/Dto/webApi/ERPCGTH.cs new file mode 100644 index 0000000..4b6a554 --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ERPCGTH.cs @@ -0,0 +1,7 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ERPCGTH +{ + public ErpCGTHA ErpCgtha { get; set; } + public List<ErpCGTHB> ErpCgthB { get; set; } +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ERPDBCK.cs b/StandardInterface/MES.Service/Dto/webApi/ERPDBCK.cs new file mode 100644 index 0000000..e9b98d7 --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ERPDBCK.cs @@ -0,0 +1,47 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MES.Service.Dto.webApi +{ + public class ERPDBCK + { + public ErpDBCKA erpDbcka { get; set; } + public List<ErpDBCKB> erpDbckB { get; set; } + } + public class ErpDBCKA + { + public string billno { get; set; } + public string dj_lx { get; set; } + public string db_lx1 { get; set; } + public string db_fx { get; set; } + public string db_lx { get; set; } + public string yw_lx { get; set; } + public string dj_zt { get; set; } + public string sq_bm { get; set; } + public string sq_zz { get; set; } + public string sq_time { get; set; } + public string dc_hz { get; set; } + public string bz { get; set; } + public string type { get; set; } + public string erpid { get; set; } + } + + public class ErpDBCKB + { + public string itemid { get; set; } + public string unit { get; set; } + public string quantity { get; set; } + public string dc_org { get; set; } + public string dc_depot { get; set; } + public string dr_org { get; set; } + public string dr_depot { get; set; } + public string dc_hz { get; set; } + public string dr_hz { get; set; } + public string bz { get; set; } + public string erpid { get; set; } + public string eid { get; set; } + } +} diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpCGTHA.cs b/StandardInterface/MES.Service/Dto/webApi/ErpCGTHA.cs new file mode 100644 index 0000000..4a9ad1d --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpCGTHA.cs @@ -0,0 +1,28 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ErpCGTHA +{ + + public string? Type { get; set; } + public string? BillNo { get; set; } //鍗曟嵁缂栧彿 + public string? Suppid { get; set; } //渚涘簲鍟咺D + public string? SuppNo { get; set; } //渚涘簲鍟嗙紪鐮� + public string? BillNo_type { get; set; } //鍗曟嵁绫诲瀷 + public string? Yw_lx { get; set; } //涓氬姟绫诲瀷 + public string? th_fs { get; set; } //閫�璐ф柟寮� + public string? th_yy { get; set; } //閫�璐у師鍥� + public string? is_ww { get; set; } //鏄惁濮斿 + public string? createby { get; set; } //鍒涘缓浜哄悕绉� + public string? cg_org { get; set; } //閲囪喘缁勭粐 + public string? tl_org { get; set; } //閫�鏂欑粍缁� + public string? xq_org { get; set; } //闇�姹傜粍缁� + public string? cg_bm { get; set; } //閲囪喘閮ㄩ棬 + public string? tl_bm { get; set; } //閫�鏂欓儴闂� + public string? cgy { get; set; } //浠撶鍛樺悕绉� + public string? cg { get; set; } //閲囪喘鍛樺悕绉� + public string? kc_dpot { get; set; } //搴撳瓨缁勫悕绉� + public string? cg_depot { get; set; } //閲囪喘缁勫悕绉� + public string? Ys_fs { get; set; } //楠屾敹鏂瑰紡 + public string? bz { get; set; } //澶囨敞 + public string? ERPID { get; set; } //鍗曟嵁澶磇d +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpCGTHB.cs b/StandardInterface/MES.Service/Dto/webApi/ErpCGTHB.cs new file mode 100644 index 0000000..ab0c12d --- /dev/null +++ b/StandardInterface/MES.Service/Dto/webApi/ErpCGTHB.cs @@ -0,0 +1,21 @@ +锘縩amespace MES.Service.Dto.webApi; + +public class ErpCGTHB +{ + public string? ebeln { get; set; } //閲囪喘璁㈠崟 + public string? itemid { get; set; } //寰呴��鐗╂枡ID + public string? unit { get; set; } //鍗曚綅 + public string? ebeln_id { get; set; } //閲囪喘璁㈠崟id + public string? line_id { get; set; } //閲囪喘璁㈠崟琛宨d + public string? depot_id { get; set; } //浠撳簱ID + public string? depot_code { get; set; } //浠撳簱缂栫爜 + public string? erpid { get; set; } //鍗曟嵁浣搃d + public string? eid { get; set; } //鍗曟嵁澶磇d + public string? flot { get; set; } //鎵瑰彿 + public string? fmoto { get; set; } //璁″垝璺熻釜鍙� + public string? quantity { get; set; } //鏁伴噺 + + + + +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderDto.cs index b28dd32..19bcbe9 100644 --- a/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderDto.cs +++ b/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderDto.cs @@ -51,12 +51,8 @@ //public string? FReqSrc { get; set; } public string? TypeA { get; set; } - // public string? FSUPPLIERID { get; set; } // 渚涘簲鍟咺D + public string? FSUPPLIERID { get; set; } // 渚涘簲鍟咺D - //娌冨皵鑷畾涔夊瓧娈� - public string? F_WWDD_SCTZD { get; set; } - public string? F_WWDD_XH { get; set; } - public string? F_XIFG_Text_tzk { get; set; } - - public string? ppbombillno { get; set; } + public string? WW_ZZ { get; set; } //濮斿缁勭粐 + public string? CG_ZZ { get; set; } //閲囪喘缁勭粐 } \ No newline at end of file diff --git a/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderSubDto.cs b/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderSubDto.cs index 53ac681..396c67c 100644 --- a/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderSubDto.cs +++ b/StandardInterface/MES.Service/Dto/webApi/ErpProductionOrderSubDto.cs @@ -41,6 +41,6 @@ public string? TypeB { get; set; } - public string? F_XIFG_Base_re5 { get; set; } - public string? F_XIFG_Base_apv { get; set; } + /* public string? F_XIFG_Base_re5 { get; set; } + public string? F_XIFG_Base_apv { get; set; }*/ } \ No newline at end of file diff --git a/StandardInterface/MES.Service/Modes/CgthSq.cs b/StandardInterface/MES.Service/Modes/CgthSq.cs new file mode 100644 index 0000000..28d56d1 --- /dev/null +++ b/StandardInterface/MES.Service/Modes/CgthSq.cs @@ -0,0 +1,164 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace MES.Service.Modes +{ + /// <summary> + /// 閲囪喘閫�璐х敵璇蜂富琛� + ///</summary> + [SugarTable("CGTH_SQ")] + public class CgthSq + { + /// <summary> + /// 鍗曟嵁缂栫爜 + ///</summary> + [SugarColumn(ColumnName="BILL_NO" )] + public string BillNo { get; set; } + /// <summary> + /// 鍒涘缓鏃堕棿 + ///</summary> + [SugarColumn(ColumnName="CREATE_DATE" )] + public DateTime? CreateDate { get; set; } + /// <summary> + /// 鍒涘缓浜� + ///</summary> + [SugarColumn(ColumnName="CREATE_BY" )] + public string CreateBy { get; set; } + /// <summary> + /// 瀹℃牳鏃堕棿 + ///</summary> + [SugarColumn(ColumnName="CHECK_DATE" )] + public DateTime? CheckDate { get; set; } + /// <summary> + /// 瀹℃牳浜� + ///</summary> + [SugarColumn(ColumnName="CHECK_USER" )] + public string CheckUser { get; set; } + /// <summary> + /// 瀹℃牳鐘舵�� + ///</summary> + [SugarColumn(ColumnName="STATUS" )] + public decimal? Status { get; set; } + /// <summary> + /// 浠撳簱缂栫爜 + ///</summary> + [SugarColumn(ColumnName="DEPOT_CODE" )] + public string DepotCode { get; set; } + /// <summary> + /// 鏄惁濮斿 + ///</summary> + [SugarColumn(ColumnName="F_TYPE" )] + public decimal? FType { get; set; } + /// <summary> + /// 渚涘簲鍟嗙紪鐮� + ///</summary> + [SugarColumn(ColumnName="SUPP_NO" )] + public string SuppNo { get; set; } + /// <summary> + /// 缁勭粐id + ///</summary> + [SugarColumn(ColumnName="ORG_ID" )] + public decimal? OrgId { get; set; } + /// <summary> + /// 閫�璐ф柟寮� + ///</summary> + [SugarColumn(ColumnName="TH_FS" )] + public string ThFs { get; set; } + /// <summary> + /// 閫�璐у師鍥� + ///</summary> + [SugarColumn(ColumnName="TH_YY" )] + public string ThYy { get; set; } + /// <summary> + /// 澶囨敞 + ///</summary> + [SugarColumn(ColumnName="BZ" )] + public string Bz { get; set; } + /// <summary> + /// + ///</summary> + [SugarColumn(ColumnName="ID", IsPrimaryKey = true, OracleSequenceName = "SEQ_CGTH_SQ")] + public decimal? Id { get; set; } + /// <summary> + /// 鏄惁瀹屾垚 + ///</summary> + [SugarColumn(ColumnName="IS_WC" )] + public decimal? IsWc { get; set; } + /// <summary> + /// 渚涘簲鍟咺D + ///</summary> + [SugarColumn(ColumnName="SUPP_ID" )] + public string SuppId { get; set; } + /// <summary> + /// 鍗曟嵁绫诲瀷 + ///</summary> + [SugarColumn(ColumnName="DJ_LX" )] + public string DjLx { get; set; } + /// <summary> + /// 涓氬姟绫诲瀷 + ///</summary> + [SugarColumn(ColumnName="YW_FS" )] + public string YwFs { get; set; } + /// <summary> + /// ERP鍒涘缓浜� + ///</summary> + [SugarColumn(ColumnName="ERP_CREATE_BY" )] + public string ErpCreateBy { get; set; } + /// <summary> + /// 閲囪喘缁勭粐 + ///</summary> + [SugarColumn(ColumnName="CG_ORG" )] + public string CgOrg { get; set; } + /// <summary> + /// 閫�鏂欑粍缁� + ///</summary> + [SugarColumn(ColumnName="TL_ORG" )] + public string TlOrg { get; set; } + /// <summary> + /// 闇�姹傜粍缁� + ///</summary> + [SugarColumn(ColumnName="XQ_ORG" )] + public string XqOrg { get; set; } + /// <summary> + /// 閲囪喘閮ㄩ棬 + ///</summary> + [SugarColumn(ColumnName="CG_BM" )] + public string CgBm { get; set; } + /// <summary> + /// 閫�鏂欓儴闂� + ///</summary> + [SugarColumn(ColumnName="TL_BM" )] + public string TlBm { get; set; } + /// <summary> + /// 浠撶鍛樺悕绉� + ///</summary> + [SugarColumn(ColumnName="CGY_MC" )] + public string CgyMc { get; set; } + /// <summary> + /// 閲囪喘鍛樺悕绉� + ///</summary> + [SugarColumn(ColumnName="CG_MC" )] + public string CgMc { get; set; } + /// <summary> + /// 搴撳瓨缁勫悕绉� + ///</summary> + [SugarColumn(ColumnName="KC_DEPOT" )] + public string KcDepot { get; set; } + /// <summary> + /// 閲囪喘缁勫悕绉� + ///</summary> + [SugarColumn(ColumnName="CG_DEPOT" )] + public string CgDepot { get; set; } + /// <summary> + /// 楠屾敹鏂瑰紡 + ///</summary> + [SugarColumn(ColumnName="YS_FS" )] + public string YsFs { get; set; } + /// <summary> + /// ERPID + ///</summary> + [SugarColumn(ColumnName="ERPID" )] + public string Erpid { get; set; } + } +} diff --git a/StandardInterface/MES.Service/Modes/CgthSqDetail.cs b/StandardInterface/MES.Service/Modes/CgthSqDetail.cs new file mode 100644 index 0000000..28f63ac --- /dev/null +++ b/StandardInterface/MES.Service/Modes/CgthSqDetail.cs @@ -0,0 +1,119 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace MES.Service.Modes +{ + /// <summary> + /// 閲囪喘閫�璐х敵璇锋槑缁� + ///</summary> + [SugarTable("CGTH_SQ_DETAIL")] + public class CgthSqDetail + { + /// <summary> + /// + ///</summary> + [SugarColumn(ColumnName="ID", IsPrimaryKey = true, OracleSequenceName = "SEQ_CGTH_SQ_DETAIL")] + public decimal? Id { get; set; } + /// <summary> + /// + ///</summary> + [SugarColumn(ColumnName="PID" )] + public decimal? Pid { get; set; } + /// <summary> + /// 閲囪喘鍗曞彿 + ///</summary> + [SugarColumn(ColumnName="WORK_NO" )] + public string WorkNo { 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="QUANTITY" )] + public decimal? Quantity { get; set; } + /// <summary> + /// 宸叉壂鏁� + ///</summary> + [SugarColumn(ColumnName="TL_QTY" )] + public decimal? TlQty { get; set; } + /// <summary> + /// 鐗╂枡ID + ///</summary> + [SugarColumn(ColumnName="ITEM_ID" )] + public decimal? ItemId { get; set; } + /// <summary> + /// mes琛宨d + ///</summary> + [SugarColumn(ColumnName="RK_LINE" )] + public decimal? RkLine { get; set; } + /// <summary> + /// 閲囪喘澶磇d + ///</summary> + [SugarColumn(ColumnName="EBELN_K3ID" )] + public decimal? EbelnK3id { get; set; } + /// <summary> + /// 閲囪喘琛宨d + ///</summary> + [SugarColumn(ColumnName = "LINE_K3ID")] + public decimal? LineK3id { get; set; } + /// <summary> + /// ERPID + ///</summary> + [SugarColumn(ColumnName = "ERPID")] + public string? Erpid { get; set; } + /// <summary> + /// EID + ///</summary> + [SugarColumn(ColumnName= "EID")] + public string? Eid { get; set; } + /// <summary> + /// 琛屽彿 + ///</summary> + [SugarColumn(ColumnName="WORK_LINE" )] + public decimal? WorkLine { get; set; } + /// <summary> + /// 鍗曚綅 + ///</summary> + [SugarColumn(ColumnName="UNIT" )] + public string Unit { get; set; } + /// <summary> + /// 鍒拌揣鍗曞彿 + ///</summary> + [SugarColumn(ColumnName="PBILL_NO" )] + public string PbillNo { get; set; } + /// <summary> + /// 瀹屾垚鏍囪瘑 + ///</summary> + [SugarColumn(ColumnName="STATUS" )] + public decimal? Status { get; set; } + /// <summary> + /// 浠撳簱id + ///</summary> + [SugarColumn(ColumnName="DEPOT_ID" )] + public string DepotId { get; set; } + /// <summary> + /// 浠撳簱缂栫爜 + ///</summary> + [SugarColumn(ColumnName = "DEPOT_CODE")] + public string DepotCode { get; set; } + /// <summary> + /// 鎵瑰彿 + ///</summary> + [SugarColumn(ColumnName="FLOT" )] + public string Flot { get; set; } + /// <summary> + /// 璁″垝璺熻釜鍙� + ///</summary> + [SugarColumn(ColumnName="FMTO" )] + public string Fmto { get; set; } + } +} diff --git a/StandardInterface/MES.Service/Modes/Dbcka.cs b/StandardInterface/MES.Service/Modes/Dbcka.cs new file mode 100644 index 0000000..8d51762 --- /dev/null +++ b/StandardInterface/MES.Service/Modes/Dbcka.cs @@ -0,0 +1,27 @@ +锘縰sing SqlSugar; +using System; + +namespace MES.Service.Modes +{ + [SugarTable("DBCKA")] + public class Dbcka + { + [SugarColumn(IsPrimaryKey = true)] + public decimal? Id { get; set; } + public string Billno { get; set; } + public string DjLx { get; set; } + public string DbLx1 { get; set; } + public string DbFx { get; set; } + public string DbLx { get; set; } + public string YwLx { get; set; } + public string DjZt { get; set; } + public string SqBm { get; set; } + public string SqZz { get; set; } + public DateTime? SqTime { get; set; } + public string DcHz { get; set; } + public string Bz { get; set; } + public string Type { get; set; } + public string Erpid { get; set; } + public DateTime? CreateDate { get; set; } + } +} diff --git a/StandardInterface/MES.Service/Modes/Dbckb.cs b/StandardInterface/MES.Service/Modes/Dbckb.cs new file mode 100644 index 0000000..729d8f5 --- /dev/null +++ b/StandardInterface/MES.Service/Modes/Dbckb.cs @@ -0,0 +1,24 @@ +锘縰sing SqlSugar; + +namespace MES.Service.Modes +{ + [SugarTable("DBCKB")] + public class Dbckb + { + [SugarColumn(IsPrimaryKey = true)] + public decimal? Id { get; set; } + public decimal? Pid { get; set; } + public string Itemid { get; set; } + public string Unit { get; set; } + public decimal? Quantity { get; set; } + public string DcOrg { get; set; } + public string DcDepot { get; set; } + public string DrOrg { get; set; } + public string DrDepot { get; set; } + public string DcHz { get; set; } + public string DrHz { get; set; } + public string Bz { get; set; } + public string Erpid { get; set; } + public string Eid { get; set; } + } +} diff --git a/StandardInterface/MES.Service/Modes/Womcaa.cs b/StandardInterface/MES.Service/Modes/Womcaa.cs index 50d680f..312db20 100644 --- a/StandardInterface/MES.Service/Modes/Womcaa.cs +++ b/StandardInterface/MES.Service/Modes/Womcaa.cs @@ -425,5 +425,23 @@ ///</summary> [SugarColumn(ColumnName= "CG_LINE_ID")] public string Cglineid { get; set; } + + /// <summary> + /// 濮斿缁勭粐 + ///</summary> + [SugarColumn(ColumnName = "WW_ORG")] + public string WwOrg { get; set; } + /// <summary> + /// 閲囪喘缁勭粐 + ///</summary> + [SugarColumn(ColumnName = "CG_ORG")] + public string CgOrg { get; set; } + /// <summary> + /// 渚涘簲鍟唅d + ///</summary> + [SugarColumn(ColumnName = "SUPP_ID")] + public string SuppId { get; set; } + + } } diff --git a/StandardInterface/MES.Service/service/BasicData/Production/ProductionOrderManager.cs b/StandardInterface/MES.Service/service/BasicData/Production/ProductionOrderManager.cs index ae89557..d4da44a 100644 --- a/StandardInterface/MES.Service/service/BasicData/Production/ProductionOrderManager.cs +++ b/StandardInterface/MES.Service/service/BasicData/Production/ProductionOrderManager.cs @@ -113,7 +113,7 @@ var entity = new Womcaa { - Caa001 = erpDto.ppbombillno, /// 鍗曞彿 + Caa001 = erpDto.FBillNo, /// 鍗曞彿 //Caa001 = erpDto.FBillNo, DepotCode = erpDto.FStockID, CreateDate = erpDto.FDate, // ParseDateTime(erpDto.FDate) ?? null, @@ -171,6 +171,10 @@ // F_WWDD_SCTZD = erpDto.F_WWDD_SCTZD, // F_WWDD_XH = erpDto.F_WWDD_XH, //F_XIFG_TEXT_TZK = erpDto.F_XIFG_Text_tzk + WwOrg=erpDto.WW_ZZ, + CgOrg=erpDto.CG_ZZ, + SuppId=erpDto.FSUPPLIERID, + }; var single = base.GetSingle(it => it.Erpid == entity.Erpid); diff --git a/StandardInterface/MES.Service/service/CgthSqDetailManager.cs b/StandardInterface/MES.Service/service/CgthSqDetailManager.cs new file mode 100644 index 0000000..6b38e14 --- /dev/null +++ b/StandardInterface/MES.Service/service/CgthSqDetailManager.cs @@ -0,0 +1,78 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using MES.Service.DB; +using MES.Service.Modes; + +namespace MES.Service.service +{ +public class CgthSqDetailManager : Repository<CgthSqDetail> +{ + + //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉� + + //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 CgthSqDetailManager.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(), OrderByType.Asc);// 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount);//杩斿洖鎬绘暟 + + List<IConditionalModel> conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel() { FieldName= typeof(CgthSqDetail).GetProperties()[0].Name, ConditionalType = ConditionalType.Equal, FieldValue = "1" });//id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom(), OrderByType.Asc); + + base.AsQueryable().Where(x => 1 == 1).ToList();//鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + + /*********鎻掑叆*********/ + var insertData = new CgthSqDetail() { };//娴嬭瘯鍙傛暟 + var insertArray = new CgthSqDetail[] { insertData }; + base.Insert(insertData);//鎻掑叆 + base.InsertRange(insertArray);//鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData);//鎻掑叆杩斿洖鑷鍒� + base.AsInsertable(insertData).ExecuteCommand();//鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + + /*********鏇存柊*********/ + var updateData = new CgthSqDetail() { };//娴嬭瘯鍙傛暟 + var updateArray = new CgthSqDetail[] { updateData };//娴嬭瘯鍙傛暟 + base.Update(updateData);//鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray);//鎵归噺鏇存柊 + //base.Update(it => new CgthSqDetail() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + base.AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + + /*********鍒犻櫎*********/ + var deldata = new CgthSqDetail() { };//娴嬭瘯鍙傛暟 + base.Delete(deldata);//鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1);//鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new int[] { 1,2});//鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it=>1==2);//鏍规嵁鏉′欢鍒犻櫎 + base.AsDeleteable().Where(it=>1==2).ExecuteCommand();//杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + #endregion + + + } +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/service/CgthSqManager.cs b/StandardInterface/MES.Service/service/CgthSqManager.cs new file mode 100644 index 0000000..da29100 --- /dev/null +++ b/StandardInterface/MES.Service/service/CgthSqManager.cs @@ -0,0 +1,220 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using MES.Service.DB; +using MES.Service.Modes; +using MES.Service.Dto.webApi; + +namespace MES.Service.service +{ +public class CgthSqManager : Repository<CgthSq> +{ + + private readonly CgthSqDetailManager _CgthSqManager = new(); + public bool SaveList(List<ERPCGTH> rohIns) + { + var result = rohIns.Select(Save).ToList(); + return result.All(b => b); + } + public bool Save(ERPCGTH wom) + { + var ErpCgtha = wom.ErpCgtha; + var mesWomCgth = MapErpCgthatoCGTHA(ErpCgtha); + var mesWomcabs = + MapErpCgthBtoCGTHA(wom.ErpCgthB); + + return UseTransaction(db => + { + switch (ErpCgtha.Type) + { + case "3": + return UpdateData(db, mesWomCgth, mesWomcabs) ? 1 : 0; + case "2": + case "4": + case "5": + return SaveOrUpdateData(db, mesWomCgth, mesWomcabs) + ? 1 + : 0; + default: + throw new NotImplementedException( + $"type娌℃湁{ErpCgtha.Type}杩欎釜绫诲瀷"); + } + }) > 0; + } + private CgthSq MapErpCgthatoCGTHA(ErpCGTHA dto) + { + + var entity = new CgthSq + { + BillNo = dto.BillNo, //鍗曟嵁缂栧彿 + SuppId = dto.Suppid, //渚涘簲鍟咺D + SuppNo = dto.SuppNo, //渚涘簲鍟嗙紪鐮� + DjLx = dto.BillNo_type, //鍗曟嵁绫诲瀷 + YwFs = dto.Yw_lx, //涓氬姟绫诲瀷 + ThFs = dto.th_fs, //閫�璐ф柟寮� + ThYy = dto.th_yy, //閫�璐у師鍥� + FType = decimal.TryParse(dto.is_ww, out var itemIdVal) ? itemIdVal : null, //鏄惁濮斿 + ErpCreateBy = dto.createby, //鍒涘缓浜哄悕绉� + CgOrg = dto.cg_org, //閲囪喘缁勭粐 + TlOrg = dto.tl_org, //閫�鏂欑粍缁� + XqOrg = dto.xq_org, //闇�姹傜粍缁� + CgBm = dto.cg_bm, //閲囪喘閮ㄩ棬 + TlBm = dto.tl_bm, //閫�鏂欓儴闂� + CgMc = dto.cg, //浠撶鍛樺悕绉� + CgyMc = dto.cgy, //閲囪喘鍛樺悕绉� + KcDepot = dto.kc_dpot, //搴撳瓨缁勫悕绉� + CgDepot = dto.cg_depot, //閲囪喘缁勫悕绉� + YsFs = dto.Ys_fs, //楠屾敹鏂瑰紡 + Bz = dto.bz, //澶囨敞 + Erpid = dto.ERPID, //鍗曟嵁澶磇d + CreateDate=DateTime.Now, + }; + var single = base.GetSingle(it => it.Erpid == entity.Erpid); + if (single != null) entity.Id = single.Id; + return entity; + } + private List<CgthSqDetail> MapErpCgthBtoCGTHA(List<ErpCGTHB> dtoList) + { + var CgthSqDetailList = new List<CgthSqDetail>(); + + foreach (var dto in dtoList) + { + var CgthSqDetail = new CgthSqDetail + { + WorkNo=dto.ebeln, //閲囪喘璁㈠崟 + ItemId = decimal.TryParse(dto.itemid, out var itemIdVal) ? itemIdVal : null, //寰呴��鐗╂枡ID + Unit =dto.unit, //鍗曚綅 + EbelnK3id = decimal.TryParse(dto.ebeln_id, out var ebelnIdVal) ? ebelnIdVal : null, //閲囪喘璁㈠崟id + LineK3id = decimal.TryParse(dto.line_id, out var lineIdVal) ? lineIdVal : null, //閲囪喘璁㈠崟琛宨d + DepotId =dto.depot_id, //浠撳簱ID + DepotCode=dto.depot_code, //浠撳簱缂栫爜 + Erpid=dto.erpid, //鍗曟嵁浣搃d + Eid = dto.eid, //鍗曟嵁澶磇d + Flot=dto.flot, //鎵瑰彿 + Fmto=dto.fmoto, //璁″垝璺熻釜鍙� + Quantity = decimal.TryParse(dto.quantity, out var qtyVal) ? qtyVal : null, //鏁伴噺 + + }; + + var entity = Db.Queryable<CgthSqDetail>() + .Where(s => s.Erpid == CgthSqDetail.Erpid).Single(); + if (entity != null) + { + // 鍒犻櫎宸叉湁鐨� Erpid 鐩稿叧鐨� Womcab 鏁版嵁 + // Db.Deleteable<Womcab>().Where(s => s.Erpid == womcab.Erpid).ExecuteCommand(); + CgthSqDetail.Id = entity.Id; + } + CgthSqDetailList.Add(CgthSqDetail); + } + + return CgthSqDetailList; + } + + private bool UpdateData(SqlSugarScope db, CgthSq mesWomCgth, + List<CgthSqDetail> mesWomcabs) + { + var decimals = mesWomcabs.Select(s => s.Id).ToArray(); + var update = base.DeleteById(mesWomCgth.Id); + var insertOrUpdate = db + .Deleteable<CgthSqDetail>().In(decimals) + .ExecuteCommand() > 0; + + + if (update && insertOrUpdate) return true; + throw new NotImplementedException("鏇存柊澶辫触"); + } + private bool SaveOrUpdateData(SqlSugarScope db, CgthSq mesWomcaa, + List<CgthSqDetail> mesWomcabs) + { + if (mesWomcaa.Id != null) base.DeleteById(mesWomcaa.Id); + + if (mesWomcabs.Count > 0) + db.Deleteable<CgthSqDetail>() + .Where(s => s.Eid == mesWomcaa.Erpid).ExecuteCommand(); + + //鍗曟潯鎻掑叆蹇界暐绌哄瓧娈� + /* var orUpdate = db.Insertable(mesWomcaa) + .IgnoreColumns(true).ExecuteCommand() > 0;*/ + // 鎻掑叆涓昏〃骞惰繑鍥炲畬鏁村疄浣擄紙鍚富閿� Id锛� + var insertedId = db.Insertable(mesWomcaa) + .IgnoreColumns(true) + .ExecuteReturnBigIdentity(); // 杩斿洖 decimal 绫诲瀷 ID + + mesWomcaa.Id = insertedId; // 濉叆涓昏〃瀹炰綋 + + // 璧嬪�兼瘡鏉℃槑缁嗙殑 Pid = 涓昏〃.Id + foreach (var detail in mesWomcabs) + { + detail.Pid = insertedId; + } + //鎵归噺鎻掑叆蹇界暐绌哄瓧娈� + var baOrUpdate = db.Insertable(mesWomcabs).PageSize(10) + .IgnoreColumnsNull() + .ExecuteCommand() > 0; + + //if (orUpdate && baOrUpdate) return true; + if (insertedId != null && baOrUpdate) return true; + throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�"); + } + #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(), OrderByType.Asc);// 鍒嗛〉鏌ヨ鍔犳帓搴� + Console.Write(p.TotalCount);//杩斿洖鎬绘暟 + + List<IConditionalModel> conModels = new List<IConditionalModel>(); //缁勮鏉′欢鏌ヨ浣滀负鏉′欢瀹炵幇 鍒嗛〉鏌ヨ鍔犳帓搴� + conModels.Add(new ConditionalModel() { FieldName= typeof(CgthSq).GetProperties()[0].Name, ConditionalType = ConditionalType.Equal, FieldValue = "1" });//id=1 + var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom(), OrderByType.Asc); + + base.AsQueryable().Where(x => 1 == 1).ToList();//鏀寔浜嗚浆鎹㈡垚queryable,鎴戜滑鍙互鐢╭ueryable瀹炵幇澶嶆潅鍔熻兘 + + + + /*********鎻掑叆*********/ + var insertData = new CgthSq() { };//娴嬭瘯鍙傛暟 + var insertArray = new CgthSq[] { insertData }; + base.Insert(insertData);//鎻掑叆 + base.InsertRange(insertArray);//鎵归噺鎻掑叆 + var id = base.InsertReturnIdentity(insertData);//鎻掑叆杩斿洖鑷鍒� + base.AsInsertable(insertData).ExecuteCommand();//鎴戜滑鍙互杞垚 Insertable瀹炵幇澶嶆潅鎻掑叆 + + + + /*********鏇存柊*********/ + var updateData = new CgthSq() { };//娴嬭瘯鍙傛暟 + var updateArray = new CgthSq[] { updateData };//娴嬭瘯鍙傛暟 + base.Update(updateData);//鏍规嵁瀹炰綋鏇存柊 + base.UpdateRange(updateArray);//鎵归噺鏇存柊 + //base.Update(it => new CgthSq() { ClassName = "a", CreateTime = DateTime.Now }, it => it.id==1);// 鍙洿鏂癈lassName鍒楀拰CreateTime鍒楋紝鍏跺畠鍒椾笉鏇存柊锛屾潯浠秈d=1 + base.AsUpdateable(updateData).ExecuteCommand(); //杞垚Updateable鍙互瀹炵幇澶嶆潅鐨勬彃鍏� + + + + /*********鍒犻櫎*********/ + var deldata = new CgthSq() { };//娴嬭瘯鍙傛暟 + base.Delete(deldata);//鏍规嵁瀹炰綋鍒犻櫎 + base.DeleteById(1);//鏍规嵁涓婚敭鍒犻櫎 + base.DeleteById(new int[] { 1,2});//鏍规嵁涓婚敭鏁扮粍鍒犻櫎 + base.Delete(it=>1==2);//鏍规嵁鏉′欢鍒犻櫎 + base.AsDeleteable().Where(it=>1==2).ExecuteCommand();//杞垚Deleteable瀹炵幇澶嶆潅鐨勬搷浣� + } + #endregion + + + } +} \ No newline at end of file diff --git a/StandardInterface/MES.Service/service/DbckaManager.cs b/StandardInterface/MES.Service/service/DbckaManager.cs new file mode 100644 index 0000000..6cfdb48 --- /dev/null +++ b/StandardInterface/MES.Service/service/DbckaManager.cs @@ -0,0 +1,131 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using MES.Service.DB; +using MES.Service.Dto.webApi; +using MES.Service.Modes; + +namespace MES.Service.service +{ + public class DbckaManager : Repository<Dbcka> + { + public bool SaveList(List<ERPDBCK> list) + { + var result = list.Select(Save).ToList(); + return result.All(b => b); + } + + public bool Save(ERPDBCK data) + { + var head = MapErpDbckaToDbcka(data.erpDbcka); + var details = MapErpDbckbToDbckb(data.erpDbckB); + + return UseTransaction(db => + { + switch (data.erpDbcka.type) + { + case "3": + return UpdateData(db, head, details) ? 1 : 0; + case "2": + case "4": + case "5": + return SaveOrUpdateData(db, head, details) ? 1 : 0; + default: + throw new NotImplementedException($"type娌℃湁 {data.erpDbcka.type} 杩欎釜绫诲瀷"); + } + }) > 0; + } + + private Dbcka MapErpDbckaToDbcka(ErpDBCKA dto) + { + var entity = new Dbcka + { + Billno = dto.billno, + DjLx = dto.dj_lx, + DbLx1 = dto.db_lx1, + DbFx = dto.db_fx, + DbLx = dto.db_lx, + YwLx = dto.yw_lx, + DjZt = dto.dj_zt, + SqBm = dto.sq_bm, + SqZz = dto.sq_zz, + SqTime = DateTime.TryParse(dto.sq_time, out var d) ? d : null, + DcHz = dto.dc_hz, + Bz = dto.bz, + Type = dto.type, + Erpid = dto.erpid, + CreateDate = DateTime.Now + }; + + var single = base.GetSingle(it => it.Erpid == entity.Erpid); + if (single != null) entity.Id = single.Id; + + return entity; + } + + private List<Dbckb> MapErpDbckbToDbckb(List<ErpDBCKB> list) + { + var result = new List<Dbckb>(); + + foreach (var dto in list) + { + var item = new Dbckb + { + Itemid = dto.itemid, + Unit = dto.unit, + Quantity = decimal.TryParse(dto.quantity, out var qty) ? qty : null, + DcOrg = dto.dc_org, + DcDepot = dto.dc_depot, + DrOrg = dto.dr_org, + DrDepot = dto.dr_depot, + DcHz = dto.dc_hz, + DrHz = dto.dr_hz, + Bz = dto.bz, + Erpid = dto.erpid, + Eid = dto.eid + }; + + var existing = Db.Queryable<Dbckb>().Where(s => s.Erpid == item.Erpid).Single(); + if (existing != null) item.Id = existing.Id; + + result.Add(item); + } + + return result; + } + + private bool SaveOrUpdateData(SqlSugarScope db, Dbcka head, List<Dbckb> details) + { + if (head.Id != null) + base.DeleteById(head.Id); + + db.Deleteable<Dbckb>() + .Where(d => d.Eid == head.Erpid) + .ExecuteCommand(); + + var insertedHead = db.Insertable(head) + .IgnoreColumns(true) + .ExecuteReturnEntity(); + + foreach (var item in details) + item.Pid = Convert.ToDecimal(insertedHead.Id); + + var success = db.Insertable(details) + .PageSize(10) + .IgnoreColumnsNull() + .ExecuteCommand() > 0; + + return insertedHead.Id != null && success; + } + + private bool UpdateData(SqlSugarScope db, Dbcka head, List<Dbckb> details) + { + var ids = details.Select(d => d.Id).ToArray(); + var deletedHead = base.DeleteById(head.Id); + var deletedDetails = db.Deleteable<Dbckb>().In(ids).ExecuteCommand() > 0; + + return deletedHead && deletedDetails; + } + } +} diff --git a/StandardInterface/MESApplication/Controllers/CgthSqController.cs b/StandardInterface/MESApplication/Controllers/CgthSqController.cs new file mode 100644 index 0000000..75d2f35 --- /dev/null +++ b/StandardInterface/MESApplication/Controllers/CgthSqController.cs @@ -0,0 +1,266 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Dynamic; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.util; +using MES.Service.Dto.webApi; +using Newtonsoft.Json; + +namespace MESApplication.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class CgthSqController : ControllerBase + { + + private CgthSqManager m = new CgthSqManager(); + + private readonly MessageCenterManager _manager = new(); + + private readonly CgthSqManager Tz = new(); + + private readonly string METHOD = "POST"; + + private readonly string TableName = "CgthSq"; + + private readonly string URL = "http://localhost:10054/api/CgthSq/"; + [HttpPost("Save")] + public ResponseResult Save(ERPCGTH CGTH) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "Save"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(CGTH); + entity.Status = 1; + entity.CreateBy = "PL017"; + entity.Route = CGTH.ErpCgtha.BillNo; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.Save(CGTH); + + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList(List<ERPCGTH> units) + { + var entity = new MessageCenter(); + entity.TableName = TableName; + entity.Url = URL + "SaveList"; + entity.Method = METHOD; + entity.Data = JsonConvert.SerializeObject(units); + entity.Status = 1; + entity.CreateBy = "PL017"; + try + { + dynamic resultInfos = new ExpandoObject(); + var save = m.SaveList(units); + resultInfos.tbBillList = save; + + entity.Result = 0; + if (save) entity.Result = 1; + + entity.DealWith = 1; + _manager.save(entity); + + return new ResponseResult + { + status = 0, + message = "OK", + data = resultInfos + }; + } + catch (Exception ex) + { + entity.Result = 0; + + entity.DealWith = 0; + + entity.ResultData = ex.Message; + + _manager.save(entity); + + 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] CgthSq 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] CgthSq 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] CgthSq 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); + } + } + } +} diff --git a/StandardInterface/MESApplication/Controllers/CgthSqDetailController.cs b/StandardInterface/MESApplication/Controllers/CgthSqDetailController.cs new file mode 100644 index 0000000..629fa6b --- /dev/null +++ b/StandardInterface/MESApplication/Controllers/CgthSqDetailController.cs @@ -0,0 +1,169 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Dynamic; +using MES.Service.Modes; +using MES.Service.service; +using MES.Service.util; + +namespace MESApplication.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class CgthSqDetailController : ControllerBase + { + + private CgthSqDetailManager m = new CgthSqDetailManager(); + + + /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/ + + /// <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] CgthSqDetail 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] CgthSqDetail 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] CgthSqDetail 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); + } + } + } +} diff --git a/StandardInterface/MESApplication/Controllers/DbckaController.cs b/StandardInterface/MESApplication/Controllers/DbckaController.cs new file mode 100644 index 0000000..a180844 --- /dev/null +++ b/StandardInterface/MESApplication/Controllers/DbckaController.cs @@ -0,0 +1,97 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Dynamic; +using MES.Service.service; +using MES.Service.Dto.webApi; +using MES.Service.util; +using Newtonsoft.Json; +using MES.Service.Modes; + +namespace MESApplication.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class DbckaController : ControllerBase + { + private readonly DbckaManager _manager = new(); + private readonly MessageCenterManager _messageManager = new(); + + private const string METHOD = "POST"; + private const string TableName = "Dbcka"; + private const string URL = "http://localhost:10054/api/Dbcka/"; + + [HttpPost("Save")] + public ResponseResult Save([FromBody] ERPDBCK data) + { + var msg = new MessageCenter + { + TableName = TableName, + Url = URL + "Save", + Method = METHOD, + Data = JsonConvert.SerializeObject(data), + Status = 1, + CreateBy = "PL017", + Route = data.erpDbcka.billno + }; + + try + { + dynamic resultInfos = new ExpandoObject(); + var success = _manager.Save(data); + resultInfos.tbBillList = success; + + msg.Result = success ? (short?)1 : (short?)0; + msg.DealWith = 1; + _messageManager.save(msg); + + return new ResponseResult { status = 0, message = "OK", data = resultInfos }; + } + catch (Exception ex) + { + msg.Result = 0; + msg.DealWith = 0; + msg.ResultData = ex.Message; + _messageManager.save(msg); + + return ResponseResult.ResponseError(ex); + } + } + + [HttpPost("SaveList")] + public ResponseResult SaveList([FromBody] List<ERPDBCK> dataList) + { + var msg = new MessageCenter + { + TableName = TableName, + Url = URL + "SaveList", + Method = METHOD, + Data = JsonConvert.SerializeObject(dataList), + Status = 1, + CreateBy = "PL017" + }; + + try + { + dynamic resultInfos = new ExpandoObject(); + var success = _manager.SaveList(dataList); + resultInfos.tbBillList = success; + + msg.Result = success ? (short?)1 : (short?)0; + msg.DealWith = 1; + _messageManager.save(msg); + + return new ResponseResult { status = 0, message = "OK", data = resultInfos }; + } + catch (Exception ex) + { + msg.Result = 0; + msg.DealWith = 0; + msg.ResultData = ex.Message; + _messageManager.save(msg); + + return ResponseResult.ResponseError(ex); + } + } + } +} -- Gitblit v1.9.3