-- auto-generated definition create table kwt_logistics_order_unit ( id bigint not null comment '主键' primary key, l_order_id bigint not null comment '物流订单id(kwt_logistics_order的主键id)', unit_type int not null comment '单位类型(1托运企业、2承运企业)', top_ent_id bigint null comment '顶级企业ID', ent_id bigint not null comment '企业id', firm_name varchar(100) not null comment '企业名称', contacts_id bigint null comment '联系人ID', contacts varchar(40) null comment '联系人姓名', phone varchar(40) null comment '联系电话', remark varchar(400) null comment '备注', status int default 0 not null comment '用户状态(0正常、1已锁)', create_by bigint not null, create_time datetime not null, update_by bigint not null, update_time datetime not null comment '更新时间', del_flag int default 0 not null comment '是否删除(0未删除,1删除)' ) comment '物流订单-托运企业/承运企业' row_format = DYNAMIC; -- auto-generated definition create table kwt_waybill_order ( id bigint not null comment '主键' primary key, ent_id bigint not null comment '企业id', l_order_id bigint not null comment '物流订单id', w_order_no varchar(30) not null comment '编号', type int not null comment '派车类型(1:趟次:2:循环)', truck_id bigint null comment '车辆档案ID', truck_no varchar(20) not null comment '车牌号', driver_id bigint null comment '司机id', driver_name varchar(40) null comment '司机姓名', driver_phone varchar(20) null comment '司机手机号', driver_idcard varchar(20) null comment '司机身份证号码', remark varchar(400) null comment '备注', status int default 0 not null comment '状态(1-接单,5-到达装货点,10-已装货,15-已离场,20-已卸货,25-已完成,30-审核驳回,99-已作废)', create_by bigint not null, create_time datetime default CURRENT_TIMESTAMP not null, update_by bigint default -1 not null, update_time datetime default CURRENT_TIMESTAMP not null comment '更新时间', del_flag int default 0 not null comment '是否删除(0未删除,1删除)', task_start_time datetime default '1000-01-01 00:00:00' not null comment '任务开始时间', task_end_time datetime default '1000-01-01 00:00:00' not null comment '任务结束时间' ) comment '车辆运单' row_format = DYNAMIC; -- auto-generated definition create table kwt_waybill_order_subtask ( id bigint not null comment '主键' primary key, ent_id bigint not null comment '企业id', l_order_id bigint not null comment '物流订单id(kwt_logistics_order)', w_order_id bigint not null comment '物流订单id', w_order_no varchar(30) not null comment '编号', unit varchar(10) null comment '托量单位', entrust_amount decimal(10, 6) null comment '已委托量', unload_amount decimal(10, 6) null comment '卸货重量', unload_time datetime null comment '卸货时间', load_amount decimal(10, 6) null comment '装货重量', load_time datetime null comment '装货时间', deficit_amount decimal(10, 6) null comment '亏吨重量', deficit_price decimal(10, 4) null comment '亏吨扣款', remark varchar(400) null comment '备注', status int default 0 not null comment '状态(1-接单,5-到达装货点,10-已装货,15-已离场,20-已卸货,25-已完成,30-审核驳回,99-已作废)', create_by bigint not null, create_time datetime not null, update_by bigint default -1 not null, update_time datetime default CURRENT_TIMESTAMP not null comment '更新时间', del_flag int default 0 not null comment '是否删除(0未删除,1删除)', unload_url varchar(255) null comment '卸货凭证', unload_upload_time datetime null comment '凭证上传时间', unload_operator varchar(255) null comment '凭证上传操作人' ) comment '车辆运单-子运单' row_format = DYNAMIC; -- auto-generated definition create table kwt_logistics_order_goods ( id bigint not null comment '主键' primary key, l_order_id bigint not null comment '物流订单id', l_order_no varchar(64) not null comment '物流订单编号', goods_id bigint null comment '商品id', goods_name varchar(100) null comment '商品名称', goods_type varchar(32) null comment '商品类型', sku_id bigint null comment 'sku', remark varchar(400) null comment '备注', status int default 0 not null comment '用户状态(0正常、1已锁)', create_by bigint not null, create_time datetime not null, update_by bigint not null, update_time datetime not null comment '更新时间', del_flag int default 0 not null comment '是否删除(0未删除,1删除)' ) comment '物流订单-商品信息' row_format = DYNAMIC; -- auto-generated definition create table kwt_logistics_order ( id bigint not null comment '主键' primary key, ent_id bigint not null comment '企业id', t_order_id bigint null comment '交易订单id(kwo_trade_order)', t_order_no varchar(30) null comment '交易订单编号(kwo_trade_order)', l_order_no varchar(30) not null comment '物流订单编号', pid bigint null comment '分包上级物流订单id', pids varchar(100) null comment '存放分包所有物流订单id使用“;”分隔', type varchar(10) not null comment '物流订单类型(1 贸易订单生成物流订单、2 自建物流订单)', level varchar(255) null comment '代表分包等级', bind_status varchar(255) charset utf8 null comment '对账绑定状态(0未绑定/解绑:1绑定)', settlement_cycle bigint null comment '结算周期(周结、月结、季结)', billing_mode varchar(255) null comment '计费方式', price decimal(8, 2) null comment '运价', price_type bigint null comment '运价方式(元/吨、元/车)', amount decimal(10, 6) not null comment '已委托量(上游给他分配的量)', unit varchar(10) not null comment '单位(吨、方、箱、件)', loss decimal(8, 2) null comment '合理损耗', loss_unit varchar(20) null comment '合理损耗单位(‰/kG)', goods_price decimal(11, 2) null comment '商品价值(扣亏货值)((实装-实卸)-合理损耗)如果为负数,则为零', goods_price_unit varchar(20) null comment '商品价值(扣亏货值)单位', start_time datetime null comment '计划开始时间', end_time datetime null comment '计划结束时间', subcontract_amount decimal(11, 6) null comment '分包量(给下游承运商分包的量)', entrust_amount decimal(11, 6) null comment '已委托量(自己承运,给下游司机分配的量)', unload_amount decimal(11, 6) null comment '卸货量(自己承运总卸货量)', load_amount decimal(11, 6) null comment '装货量(自己承运总装货量)', ignore_amount decimal(11, 6) null comment '忽略剩余量', deficit_amount decimal(11, 6) null comment '亏吨量(自己承运总亏吨量:装货量-卸货量)', deficit_price decimal(11, 2) null comment '亏吨扣款(自己承运总亏吨扣款)', load_time datetime null comment '实际开始时间(装货)', unload_time datetime null comment '实际结束时间(卸货)', total_take int null comment '趟次(自己+下游承运总卸货量,算方式为趟次时,最终值以完结输入值为准)', total_load_amount decimal(11, 6) null comment '装货-履约量(自己+下游承运总装货量)', total_unload_amount decimal(11, 6) null comment '卸货-履约量(自己+下游承运总卸货量)', payment bigint null comment '付款方式(预付款、线下支付、第三方支付)', tax_rate decimal(6) null comment '发票税率(%)', remark varchar(200) null comment '备注', status int default 0 not null comment '0,待签约,1待接单', create_by bigint not null, create_time datetime not null, update_by bigint not null, update_time datetime not null comment '更新时间', del_flag int default 0 not null comment '是否删除(0未删除,1删除)' ) comment '物流订单' row_format = DYNAMIC;