1
This commit is contained in:
@@ -3,337 +3,7 @@
|
||||
* @param {Object} models - 所有模型对象
|
||||
*/
|
||||
module.exports = (models) => {
|
||||
// ========== 仓库主数据 ==========
|
||||
// models["war_warehouse"].hasMany(models["war_laneway"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "laneways",
|
||||
// });
|
||||
// models["war_laneway"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// models["war_warehouse"].hasMany(models["war_rack"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "racks",
|
||||
// });
|
||||
// models["war_rack"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// models["war_warehouse"].hasMany(models["war_area"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "areas",
|
||||
// });
|
||||
// models["war_area"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// models["war_warehouse"].hasMany(models["war_location"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// // 货位从属(可选)
|
||||
// models["war_area"].hasMany(models["war_location"], {
|
||||
// foreignKey: "area_id",
|
||||
// sourceKey: "id",
|
||||
// as: "area_locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_area"], {
|
||||
// foreignKey: "area_id",
|
||||
// targetKey: "id",
|
||||
// as: "area",
|
||||
// });
|
||||
|
||||
// models["war_laneway"].hasMany(models["war_location"], {
|
||||
// foreignKey: "laneway_id",
|
||||
// sourceKey: "id",
|
||||
// as: "laneway_locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_laneway"], {
|
||||
// foreignKey: "laneway_id",
|
||||
// targetKey: "id",
|
||||
// as: "laneway",
|
||||
// });
|
||||
|
||||
// models["war_rack"].hasMany(models["war_location"], {
|
||||
// foreignKey: "rack_id",
|
||||
// sourceKey: "id",
|
||||
// as: "rack_locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_rack"], {
|
||||
// foreignKey: "rack_id",
|
||||
// targetKey: "id",
|
||||
// as: "rack",
|
||||
// });
|
||||
|
||||
// // ========== 托盘主数据 ==========
|
||||
// models["try_tray_type"].hasMany(models["try_tray"], {
|
||||
// foreignKey: "tray_type_id",
|
||||
// sourceKey: "id",
|
||||
// as: "trays",
|
||||
// });
|
||||
// models["try_tray"].belongsTo(models["try_tray_type"], {
|
||||
// foreignKey: "tray_type_id",
|
||||
// targetKey: "id",
|
||||
// as: "tray_type",
|
||||
// });
|
||||
|
||||
// // ========== 合作方与物料主数据 ==========
|
||||
// models["par_customer"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "customer_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["par_customer"], {
|
||||
// foreignKey: "customer_id",
|
||||
// targetKey: "id",
|
||||
// as: "customer",
|
||||
// });
|
||||
|
||||
// models["par_supplier"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "supplier_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["par_supplier"], {
|
||||
// foreignKey: "supplier_id",
|
||||
// targetKey: "id",
|
||||
// as: "supplier",
|
||||
// });
|
||||
|
||||
// models["mat_type"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "material_type_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["mat_type"], {
|
||||
// foreignKey: "material_type_id",
|
||||
// targetKey: "id",
|
||||
// as: "material_type",
|
||||
// });
|
||||
|
||||
// models["mat_measure"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "measure_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["mat_measure"], {
|
||||
// foreignKey: "measure_id",
|
||||
// targetKey: "id",
|
||||
// as: "measure",
|
||||
// });
|
||||
|
||||
// // ========== 条码主数据 ==========
|
||||
// models["mat_material"].hasMany(models["bar_code"], {
|
||||
// foreignKey: "material_id",
|
||||
// sourceKey: "id",
|
||||
// as: "barcodes",
|
||||
// });
|
||||
// models["bar_code"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// models["bar_type"].hasMany(models["bar_code"], {
|
||||
// foreignKey: "bar_type_id",
|
||||
// sourceKey: "id",
|
||||
// as: "barcodes",
|
||||
// });
|
||||
// models["bar_code"].belongsTo(models["bar_type"], {
|
||||
// foreignKey: "bar_type_id",
|
||||
// targetKey: "id",
|
||||
// as: "bar_type",
|
||||
// });
|
||||
|
||||
// if (models["sys_user"]) {
|
||||
// models["bar_code"].belongsTo(models["sys_user"], {
|
||||
// foreignKey: "created_by_user_id",
|
||||
// targetKey: "id",
|
||||
// as: "created_by_user",
|
||||
// });
|
||||
// }
|
||||
|
||||
// // ========== 收货/发货业务 ==========
|
||||
// models["rec_receiving"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["rec_receiving"].hasMany(models["rec_receiving_item"], {
|
||||
// foreignKey: "receiving_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["rec_receiving_item"].belongsTo(models["rec_receiving"], {
|
||||
// foreignKey: "receiving_id",
|
||||
// targetKey: "id",
|
||||
// as: "receiving",
|
||||
// });
|
||||
// models["rec_receiving_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// models["rec_send"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["rec_send"].hasMany(models["rec_send_item"], {
|
||||
// foreignKey: "send_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["rec_send_item"].belongsTo(models["rec_send"], {
|
||||
// foreignKey: "send_id",
|
||||
// targetKey: "id",
|
||||
// as: "send",
|
||||
// });
|
||||
// models["rec_send_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 入库作业 ==========
|
||||
// models["job_inbound"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_inbound"].hasMany(models["job_inbound_item"], {
|
||||
// foreignKey: "inbound_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_inbound_item"].belongsTo(models["job_inbound"], {
|
||||
// foreignKey: "inbound_id",
|
||||
// targetKey: "id",
|
||||
// as: "inbound",
|
||||
// });
|
||||
// models["job_inbound_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 出库作业 ==========
|
||||
// models["job_outbound"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_outbound"].hasMany(models["job_outbound_item"], {
|
||||
// foreignKey: "outbound_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_outbound_item"].belongsTo(models["job_outbound"], {
|
||||
// foreignKey: "outbound_id",
|
||||
// targetKey: "id",
|
||||
// as: "outbound",
|
||||
// });
|
||||
// models["job_outbound_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 移库 ==========
|
||||
// models["job_move"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_move"].hasMany(models["job_move_item"], {
|
||||
// foreignKey: "move_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_move_item"].belongsTo(models["job_move"], {
|
||||
// foreignKey: "move_id",
|
||||
// targetKey: "id",
|
||||
// as: "move",
|
||||
// });
|
||||
// models["job_move_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 调拨 ==========
|
||||
// models["job_allocate"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "from_warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "from_warehouse",
|
||||
// });
|
||||
// models["job_allocate"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "to_warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "to_warehouse",
|
||||
// });
|
||||
// models["job_allocate"].hasMany(models["job_allocate_item"], {
|
||||
// foreignKey: "allocate_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_allocate_item"].belongsTo(models["job_allocate"], {
|
||||
// foreignKey: "allocate_id",
|
||||
// targetKey: "id",
|
||||
// as: "allocate",
|
||||
// });
|
||||
// models["job_allocate_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 报损 ==========
|
||||
// models["job_damage"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_damage"].hasMany(models["job_damage_item"], {
|
||||
// foreignKey: "damage_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_damage_item"].belongsTo(models["job_damage"], {
|
||||
// foreignKey: "damage_id",
|
||||
// targetKey: "id",
|
||||
// as: "damage",
|
||||
// });
|
||||
// models["job_damage_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 盘点 ==========
|
||||
// models["job_count"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
|
||||
// ========== 订阅模块(biz_*)==========
|
||||
const m = models;
|
||||
|
||||
Reference in New Issue
Block a user