create table WHS_OTHER_DTL
(
    WHS_OTHER_UUID VARCHAR2(32),
    AUTO_ID NUMBER not null
        constraint WHS_OTHER_DTL_PK
            primary key,
    ROW_ID NUMBER,
    BOX_NOTE VARCHAR2(50),
    MATERIAL_NO VARCHAR2(40),
    OPERATE_QTY NUMBER,
    BASIC_UNIT VARCHAR2(6),
    PACKAGE_UNIT VARCHAR2(16),
    PACKAGE_LIST VARCHAR2(20),
    PACKAGE_ROW_ID NUMBER,
    PACKAGE_QTY NUMBER,
    COST_CENTER VARCHAR2(16),
    SUPPLIER_NO VARCHAR2(16),
    SUPPLIER_DESC VARCHAR2(128),
    MATERIAL_NO_OUT VARCHAR2(40),
    QTY_OUT NUMBER,
    MATERIAL_NO_IN VARCHAR2(40),
    QTY_IN NUMBER,
    WERKS VARCHAR2(6),
    WHS_LOCATION_CODE VARCHAR2(6),
    ROW_REMARKS VARCHAR2(255),
    TEMP_STORAGE VARCHAR2(4000),
    DELIVERY_NOTE_SAP VARCHAR2(10),
    DELIVERY_NOTE_SAP_ITEM NUMBER,
    PURCHASE_GROUP VARCHAR2(6),
    PURCHASE_GROUP_NAME VARCHAR2(64),
    DELIVERY_QTY NUMBER(13,3),
    DELIVERY_UNIT VARCHAR2(3),
    RECEIVED_QTY NUMBER(13,3),
    OVER_DELIVERY_LIMIT NUMBER,
    UNDER_DELIVERY_LIMIT NUMBER,
    UNLIMITED VARCHAR2(2),
    WERKS_XQ VARCHAR2(6),
    QTY_SALES NUMBER(13,3),
    UNIT_SALES VARCHAR2(3),
    CABINET_SERIAL_NUMBER VARCHAR2(2),
    GOODS_TYPE VARCHAR2(30),
    RECEIVING_WERKS VARCHAR2(6),
    ACTUAL_RECEIVING_WERKS VARCHAR2(6),
    CABINET_NUMBER VARCHAR2(16),
    LEAD_SEAL VARCHAR2(16),
    SHIPMENT_CATEGORY VARCHAR2(64),
    PLANNED_PACKING_QTY NUMBER(17,3),
    ITEM VARCHAR2(6),
    DATE_OF_LOADING VARCHAR2(10),
    LOADING_WERKS VARCHAR2(6),
    LOADING_WHS_LOCATION_CODE VARCHAR2(4),
    PLANNED_PACKING_NUMBER NUMBER(17,3),
    PACKING_UNIT VARCHAR2(3),
    CABINET_WEIGHT NUMBER(17,6),
    WEIGHT_UNIT VARCHAR2(6),
    CABINET_VOLUME NUMBER(17,6),
    VOLUME_UNIT VARCHAR2(6),
    TRAILER_LINE VARCHAR2(6),
    TRAILER_LINE_DESC VARCHAR2(40),
    SPMS_STATUS VARCHAR2(2) default 0,
    UNPLANNED VARCHAR2(2),
    ACTUAL_OPERATE_QTY NUMBER(17,3),
    CONTAINER_BRAND VARCHAR2(64),
    COLOR_NUMBER VARCHAR2(32),
    THICKNESS NUMBER(7,3),
    ACTUAL_AVG_GROSS_WEIGHT NUMBER(7,3),
    ACTUAL_PACKING_NUMBER NUMBER(17,3),
    CUSTOMS_DECLARATION_NUMBER NUMBER(17,3),
    PACKING_SPEC VARCHAR2(128),
    LOADING_TYPE VARCHAR2(128),
    STORAGE_OUT VARCHAR2(4000),
    STORAGE_IN VARCHAR2(4000)
)
/

comment on table WHS_OTHER_DTL is '异常出入库明细表'
/

comment on column WHS_OTHER_DTL.WHS_OTHER_UUID is '异常出入库主键'
/

comment on column WHS_OTHER_DTL.AUTO_ID is '自增ID'
/

comment on column WHS_OTHER_DTL.ROW_ID is '行ID'
/

comment on column WHS_OTHER_DTL.BOX_NOTE is '箱码'
/

comment on column WHS_OTHER_DTL.MATERIAL_NO is '物料编码'
/

comment on column WHS_OTHER_DTL.OPERATE_QTY is '出入库操作数量'
/

comment on column WHS_OTHER_DTL.BASIC_UNIT is '基本单位'
/

comment on column WHS_OTHER_DTL.PACKAGE_UNIT is '包装单位'
/

comment on column WHS_OTHER_DTL.PACKAGE_LIST is '装箱单号'
/

comment on column WHS_OTHER_DTL.PACKAGE_ROW_ID is '装箱单行号'
/

comment on column WHS_OTHER_DTL.PACKAGE_QTY is '包装数量'
/

comment on column WHS_OTHER_DTL.COST_CENTER is '成本中心'
/

comment on column WHS_OTHER_DTL.SUPPLIER_NO is '供应商代码'
/

comment on column WHS_OTHER_DTL.SUPPLIER_DESC is '供应商描述'
/

comment on column WHS_OTHER_DTL.MATERIAL_NO_OUT is '出库物料编码'
/

comment on column WHS_OTHER_DTL.QTY_OUT is '出库数量'
/

comment on column WHS_OTHER_DTL.MATERIAL_NO_IN is '入库物料编码'
/

comment on column WHS_OTHER_DTL.QTY_IN is '入库数量'
/

comment on column WHS_OTHER_DTL.WERKS is '工厂'
/

comment on column WHS_OTHER_DTL.WHS_LOCATION_CODE is '仓库代码'
/

comment on column WHS_OTHER_DTL.ROW_REMARKS is '行备注'
/

comment on column WHS_OTHER_DTL.TEMP_STORAGE is '储位信息'
/

comment on column WHS_OTHER_DTL.DELIVERY_NOTE_SAP is 'SAP交货单号'
/

comment on column WHS_OTHER_DTL.DELIVERY_NOTE_SAP_ITEM is 'SAP交货单行号'
/

comment on column WHS_OTHER_DTL.PURCHASE_GROUP is '采购组'
/

comment on column WHS_OTHER_DTL.PURCHASE_GROUP_NAME is '采购组名称'
/

comment on column WHS_OTHER_DTL.DELIVERY_QTY is '交货数量'
/

comment on column WHS_OTHER_DTL.DELIVERY_UNIT is '销售单位'
/

comment on column WHS_OTHER_DTL.RECEIVED_QTY is '实际收货数量'
/

comment on column WHS_OTHER_DTL.OVER_DELIVERY_LIMIT is '过量交货限度'
/

comment on column WHS_OTHER_DTL.UNDER_DELIVERY_LIMIT is '交货不足限度'
/

comment on column WHS_OTHER_DTL.UNLIMITED is '无限制'
/

comment on column WHS_OTHER_DTL.WERKS_XQ is '需求工厂'
/

comment on column WHS_OTHER_DTL.QTY_SALES is '销售数量'
/

comment on column WHS_OTHER_DTL.UNIT_SALES is '销售单位'
/

comment on column WHS_OTHER_DTL.CABINET_SERIAL_NUMBER is '柜序号'
/

comment on column WHS_OTHER_DTL.GOODS_TYPE is '货物类型/产品层次'
/

comment on column WHS_OTHER_DTL.RECEIVING_WERKS is '收货工厂'
/

comment on column WHS_OTHER_DTL.ACTUAL_RECEIVING_WERKS is '实际收货工厂'
/

comment on column WHS_OTHER_DTL.CABINET_NUMBER is '柜号'
/

comment on column WHS_OTHER_DTL.LEAD_SEAL is '铅封号'
/

comment on column WHS_OTHER_DTL.SHIPMENT_CATEGORY is '出货品类'
/

comment on column WHS_OTHER_DTL.PLANNED_PACKING_QTY is '计划装箱数量(基本单位)'
/

comment on column WHS_OTHER_DTL.ITEM is '装箱单行号'
/

comment on column WHS_OTHER_DTL.DATE_OF_LOADING is '可装柜日期'
/

comment on column WHS_OTHER_DTL.LOADING_WERKS is '装柜工厂代码'
/

comment on column WHS_OTHER_DTL.LOADING_WHS_LOCATION_CODE is '装柜仓库代码'
/

comment on column WHS_OTHER_DTL.PLANNED_PACKING_NUMBER is '计划装箱件数'
/

comment on column WHS_OTHER_DTL.PACKING_UNIT is '包装单位'
/

comment on column WHS_OTHER_DTL.CABINET_WEIGHT is '柜重量'
/

comment on column WHS_OTHER_DTL.WEIGHT_UNIT is '重量单位'
/

comment on column WHS_OTHER_DTL.CABINET_VOLUME is '柜体积'
/

comment on column WHS_OTHER_DTL.VOLUME_UNIT is '体积单位'
/

comment on column WHS_OTHER_DTL.TRAILER_LINE is '出发国拖车线路'
/

comment on column WHS_OTHER_DTL.TRAILER_LINE_DESC is '出发国拖车线路名称'
/

comment on column WHS_OTHER_DTL.SPMS_STATUS is '装箱单行项目在SPMS状态'
/

comment on column WHS_OTHER_DTL.UNPLANNED is '是否为计划外的明细。默认空，额外出库的贸易货需传值1'
/

comment on column WHS_OTHER_DTL.ACTUAL_OPERATE_QTY is '贸易货实际装箱数量(基本单位)'
/

comment on column WHS_OTHER_DTL.CONTAINER_BRAND is '外箱品牌'
/

comment on column WHS_OTHER_DTL.COLOR_NUMBER is '色号（砖类）'
/

comment on column WHS_OTHER_DTL.THICKNESS is '砖厚'
/

comment on column WHS_OTHER_DTL.ACTUAL_AVG_GROSS_WEIGHT is '产品实际平均毛重'
/

comment on column WHS_OTHER_DTL.ACTUAL_PACKING_NUMBER is '实际装箱件数（销售单位）'
/

comment on column WHS_OTHER_DTL.CUSTOMS_DECLARATION_NUMBER is '报关件数'
/

comment on column WHS_OTHER_DTL.PACKING_SPEC is '包装规格'
/

comment on column WHS_OTHER_DTL.LOADING_TYPE is '装柜方式'
/

comment on column WHS_OTHER_DTL.STORAGE_OUT is '串货调整调出储位'
/

comment on column WHS_OTHER_DTL.STORAGE_IN is '串货调整调入储位'
/

create or replace trigger TR_WHS_OTHER_DTL_BEF
    before insert
    on WHS_OTHER_DTL
    for each row
DECLARE
    V_NUM1 NUMBER := 0;
BEGIN
    SELECT NVL(TO_NUMBER(MAX(WOD.AUTO_ID)), 0) INTO V_NUM1 FROM WHS_OTHER_DTL WOD;
    :NEW.AUTO_ID := V_NUM1 + 1;
END;
/


INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('c56bfccad07943c8b1ac223d25c174ad', 'mobileType', '移动类型', '311', '卸货入库', 'In-House(Unload)', '1', 1000, '4');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('731adbf0c9d446858d08beb67a641dca', 'mobileType', '移动类型', '511', '赠品入库', 'In-House(Presenter)', '1', 1000, '2');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('eef62bd185454a3da068269ce79d3568', 'mobileType', '移动类型', '512', '赠品入库(冲消)', 'In-HousePresenter(Withdraw)', '1', 1000, '3');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('22494c8fd6d94e4aa30f284316b24608', 'mobileType', '移动类型', '309', '串货调整', 'Part Adjustment', '1', 1000, '5');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('8f23adbd9da3452a8b023f7b886c7dee', 'mobileType', '移动类型', '310', '串货调整(冲消)', 'Part Adjustment(Withdraw)', '1', 1000, '6');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('0a94a639d7c54a2b93c3f14d0aa462af', 'mobileType', '移动类型', '551', '报废出库', 'Out-House(Scrap)', '1', 1000, '7');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('530bfebd699948baa88998cf30f5039e', 'mobileType', '移动类型', '552', '报废出库(冲消)', 'Out-HouseScrap(Withdraw)', '1', 1000, '8');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('e8f115d365de44459d4244354fd35dcf', 'mobileType', '移动类型', 'Z09', '样品领用', 'Sample Acquisition', '1', 1000, '9');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('f74bf2ce0ed64ae5a454f00c894179cf', 'mobileType', '移动类型', 'Z10', '样品领用(冲消)', 'Sample Acquisition(Withdraw)', '1', 1000, 'update');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('dd83a079c89d4139825d75a46d20267e', 'mobileType', '移动类型', 'Z21', '仓库工具领用', 'Tools Acquistion', '1', 1000, 'update');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('88e4a2a3cb9645bb984686a17d8c7e7c', 'mobileType', '移动类型', 'Z22', '仓库工具领用(冲消)', 'Tools Acquistion(Withdraw)', '1', 1000, '4');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('35a23d53771144378643ab92940f1cf1', 'mobileType', '移动类型', 'Z23', '其他公司领用', 'Other Acquistion', '1', 1000, '2');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('f02bb26a1cbc4570b63090f18262e06a', 'mobileType', '移动类型', 'Z24', '其他公司领用(冲消)', 'Other Acquistion(Withdraw)', '1', 1000, '3');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('c0f223df6ab5480ea03c730165a5cb2c', 'mobileType', '移动类型', '161', '退货出库', 'Out-House Return', '1', 1000, '5');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('c9ca95a20bff4d8788dbc0e4bddf5204', 'mobileType', '移动类型', '162', '退货出库(冲消)', 'Out-House Return(Withdraw)', '1', 1000, '6');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('bc2cdfb7febe4b2e8dcda4fa04b53ad3', 'mobileType', '移动类型', '541', '委外加工出库', 'Out-House OEM', '1', 1000, '7');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('abd085652f994779bc3ad234fd74f7e9', 'mobileType', '移动类型', '542', '委外加工出库(冲消)', 'Out-House OEM(Withdraw)', '1', 1000, '8');
-- on June 30
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('2f81ae2ec465436aa10db5b261bb732f', 'mobileType', '移动类型', 'MoveIn311', '其它移入', 'MoveIn(Other)', '1', 1000, '7');
INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('c4b383befdd9486aac41d1b06037dcf5', 'mobileType', '移动类型', 'MoveOut311', '其它移出', 'MoveOut(Other)', '1', 1000, '8');

INSERT INTO SPMS.ORDER_KEY_VALUE_CONFIG (UUID, FIELD_KEY, FIELD_NAME, KEY_CODE, KEY_CODE_DESC, KEY_CODE_EN_DESC, ENABLED, SORT_NO, REMARK) VALUES ('9c91a26f5e364c31b076be4b9e9e963b', 'whsOutStatus', '出库任务状态', '5', '提交SAP失败', 'Failed SAP', '1', 1000, '8');
