/*
 Navicat Premium Data Transfer

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 80012
 Source Host           : localhost:3306
 Source Schema         : eas_db

 Target Server Type    : MySQL
 Target Server Version : 80012
 File Encoding         : 65001

 Date: 13/06/2026 13:25:09
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for v_uc_cgrk06
-- ----------------------------
DROP TABLE IF EXISTS `v_uc_cgrk06`;
CREATE TABLE `v_uc_cgrk06`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `orderNo` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单号',
  `orderType` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '单据类型',
  `supplierCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '供应商编码',
  `supplierName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '供应商名称',
  `creator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '操作人',
  `createTime` datetime(0) NOT NULL COMMENT '单据日期',
  `modifyDate` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '修改时间',
  `billid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '单据id',
  `status` int(11) NOT NULL DEFAULT 0 COMMENT '单据状态 (0-草稿,1-已提交,2-已审核,3-已作废)',
  `red` int(11) NOT NULL DEFAULT 0 COMMENT '红蓝字 (0-蓝字,1-红字)',
  `entryid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '分录id',
  `itemNo` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '行号',
  `categoryCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '品类编码',
  `categoryName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '品类名称',
  `skuCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '物料编码',
  `skuName` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '物料名称',
  `model` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '物料规格',
  `houseCode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '仓库号',
  `batchNo` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '批次号',
  `qty` decimal(18, 4) NOT NULL DEFAULT 0.0000 COMMENT '数量',
  `unitCode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '单位编码',
  `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '单位',
  `trackNo` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '跟踪号',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_bill_entry`(`billid`, `entryid`) USING BTREE,
  INDEX `idx_orderNo`(`orderNo`) USING BTREE,
  INDEX `idx_supplierCode`(`supplierCode`) USING BTREE,
  INDEX `idx_skuCode`(`skuCode`) USING BTREE,
  INDEX `idx_createTime`(`createTime`) USING BTREE,
  INDEX `idx_batchNo`(`batchNo`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '订单明细表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of v_uc_cgrk06
-- ----------------------------
INSERT INTO `v_uc_cgrk06` VALUES (1, 'PO20240001', '采购订单', 'SUP001', '宏达电子有限公司', '张三', '2024-03-15 09:30:00', '2024-03-15 14:20:00', 'BILL20240001', 0, 0, 'ENT001', '1', 'CAT01', '电子元件', 'SKU1001', '贴片电阻', '10kΩ ±1% 0603', 'WH001', 'B202403001', 5000.0000, 'PCS', '个', 'TRK240315001');
INSERT INTO `v_uc_cgrk06` VALUES (2, 'PO20240001', '采购订单', 'SUP001', '宏达电子有限公司', '张三', '2024-03-15 09:30:00', '2024-03-15 14:20:00', 'BILL20240001', 0, 0, 'ENT002', '2', 'CAT01', '电子元件', 'SKU1002', '贴片电容', '10µF 16V X5R 0805', 'WH001', 'B202403002', 3000.0000, 'PCS', '个', 'TRK240315001');
INSERT INTO `v_uc_cgrk06` VALUES (3, 'PO20240002', '采购订单', 'SUP002', '宏达电子有限公司', '李四', '2024-03-16 10:15:00', '2024-03-16 16:45:00', 'BILL20240002', 0, 0, 'ENT003', '1', 'CAT02', '五金工具', 'SKU2001', '十字螺丝刀', 'PH2 × 100mm', 'WH002', 'B202403005', 100.0000, 'PC', '把', 'TRK240316002');
INSERT INTO `v_uc_cgrk06` VALUES (4, 'PO20240003', '采购退单', 'SUP003', '华威精密机械', '王芳', '2024-03-18 14:00:00', '2024-03-19 09:10:00', 'BILL20240003', 0, 1, 'ENT004', '1', 'CAT03', '机械配件', 'SKU3001', '轴承', '6204ZZ', 'WH003', 'B202402100', -50.0000, 'PCS', '个', 'TRK240318003');
INSERT INTO `v_uc_cgrk06` VALUES (5, 'PO20240004', '采购订单', 'SUP004', '宏达电子有限公司', '赵明', '2024-03-20 11:20:00', '2024-03-20 11:20:00', 'BILL20240004', 0, 0, 'ENT005', '1', 'CAT04', '包装材料', 'SKU4001', '瓦楞纸箱', '400×300×200mm', 'WH004', NULL, 200.0000, 'PCS', '个', NULL);
INSERT INTO `v_uc_cgrk06` VALUES (6, 'PO20240005', '采购订单', 'SUP005', '长江化工', '孙丽', '2024-03-22 08:45:00', '2024-03-23 10:30:00', 'BILL20240005', 0, 0, 'ENT006', '1', 'CAT05', '化工原料', 'SKU5001', '工业酒精', '95% 工业级', 'WH005', 'B202403010', 150.0000, 'L', '升', 'TRK240322005');

SET FOREIGN_KEY_CHECKS = 1;
