Files
RBMESAPICore/Controllers/Projectinfo/RBContextInfoEnpower.cs

255 lines
11 KiB
C#
Raw Normal View History

2025-09-09 22:41:29 +08:00
using Microsoft.EntityFrameworkCore;
using RB_MES_API.Context;
using RB_MES_API.Models;
namespace RBMESAPI.Controllers
{
public class RBContextInfoEnpower
{
public static async void Initialize(IServiceProvider serviceProvider)
{
var _context = new RBContext(
serviceProvider.GetRequiredService<
DbContextOptions<RBContext>>());
if (_context.r_SystemProfiles!.Any() == false)
{
_context.r_SystemProfiles!.AddRange(
new SystemProfile
{
FCategoryID = 1,
FKey = "CustName",
FName = "授权用户",
FValue = "珠海英搏尔电气股份有限公司",
FDescription = "经沃比授权使用本系统的用户名称",
FReadonly = true,
FDetail = true
}, new SystemProfile
{
FCategoryID = 4,
FKey = "TokenUserName",
FName = "令牌用户",
FValue = "administrator",
FDescription = "数据对接Token用户名",
FDetail = true
},
new SystemProfile
{
FCategoryID = 4,
FKey = "TokenPWD",
FName = "Token密钥",
FValue = AESHelp.Encrypt("enpower2022"),
FDescription = "Token密钥MD5加密",
FDetail = true,
FFormatID = 512
}
);
await _context.SaveChangesAsync();
}
if (_context.r_FunctionList!.Any() == false)
{
_context.r_FunctionList!.AddRange(
new FunctionList
{
FGoupID = 8,
FFunctionName = "updateIMSDataBase64", //我方推送此FFunctionName使用了盘古基础资料接收的接口名称具体推送哪些要在PushType中查
FUrl = "http://i.enpower.com:8600/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc",
FUsing = true
}, new FunctionList
{
FGoupID = 8,
FFunctionName = "DataSave_Batch", //我方批量保存单据的接口名称
FUrl = "http://i.enpower.com:8600/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.BatchSave.common.kdsvc",
FUsing = true
}, new FunctionList
{
FGoupID = 8,
FFunctionName = "GetERPData", //我方提供给盘古查询数据的接口名称具体查询哪些要在SelectJoinID中查
FUrl = "http://i.enpower.com:8600/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc",
FUsing = true
}, new FunctionList
{
FGoupID = 8,
FFunctionName = "UpdateErpBill", //盘古反推数据更新接口
FUrl = "http://i.enpower.com:8600/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.BatchSave.common.kdsvc",
FUsing = true
}
);
await _context.SaveChangesAsync();
}
if (_context.r_FormIDType!.Any() == false)
{
//以下是updateIMSDataBase64需要的
_context.r_FormIDType.AddRange(
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_BS_SUP",
FDBName = "BD_Supplier", //Cloud里的数据表名也是CloudBillQuery的FFormID
FDescription = "供应商基本资料",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_BS_CUST",
FDBName = "BD_Customer",
FDescription = "客户基本资料",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_BS_MTRL",
FDBName = "BD_MATERIAL",
FDescription = "物料基本资料",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_SYS_DEPT",
FDBName = "BD_Department",
FDescription = "部门基本资料",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_BS_STORE",
FDBName = "BD_STOCK",
FDescription = "仓库基本资料",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_PP_DN",
FDBName = "SAL_DELIVERYNOTICE",
FDescription = "销售发货通知",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_EI_SRTYPE",
FDBName = "BAS_BILLTYPE",
FDescription = "杂收杂发类别", //单据类型的其他出库分组下
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "UPDATE_WPLAN_MN",
FDBName = "PRD_PPBOM",
FDescription = "生产用料清单",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "TB_PP_WPLAN",
FDBName = "BD_Customer",
FDescription = "生产订单",
FUsing = true
},
new FormIDType
{
FFunctionID = 1,
FDocType = "MTRL_PRIORITY",
FDBName = "BD_Customer",
FDescription = "替代方案",
FUsing = true
}
);
await _context.SaveChangesAsync();
}
if (_context.r_ClumnConvert!.Any() == false)
{
_context.r_ClumnConvert!.AddRange(
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FBillNo",
FDesName = "AUDIT_ID",
FKDCaption = "通知单号"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FCustomerID",
FDesName = "CUST_ID",
FKDCaption = "客户编码"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FMaterialID", //明细信息
FDesName = "MTRL_ID",
FKDCaption = "成品编码"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FDeliveryDate", //明细信息
FDesName = "H_DATE",
FKDCaption = "预计发货时间"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FStockID", //明细信息
FDesName = "STORE_ID",
FKDCaption = "仓库编码"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FQty", //明细信息
FDesName = "QUANTITY",
FKDCaption = "数量"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FNoteEntry", //明细信息
FDesName = "REMARK",
FKDCaption = "备注"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FEntity_FEntryId", //明细信息
FDesName = "MTRL_SEQ",
FKDCaption = "物料行号"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FOrderNo", //明细信息
FDesName = "SO_ID",
FKDCaption = "销售订单号"
},
new SelectClumnConvert
{
FFunctionID = 1,
FDesTableName = "SAL_DELIVERYNOTICE",
FSourceName = "FOrderSeq", //明细信息
FDesName = "SO_SEQ",
FKDCaption = "销售订单行号"
}
);
await _context.SaveChangesAsync();
}
}
}
}