-- MySQL dump 10.13  Distrib 8.0.40, for Win64 (x86_64)
--
-- Host: 127.0.0.1    Database: vfsale
-- ------------------------------------------------------
-- Server version	8.0.40

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `chain_cargo`
--

DROP TABLE IF EXISTS `chain_cargo`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_cargo` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `createdate` date DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_cargo`
--

LOCK TABLES `chain_cargo` WRITE;
/*!40000 ALTER TABLE `chain_cargo` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_cargo` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_cargo_detailed`
--

DROP TABLE IF EXISTS `chain_cargo_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_cargo_detailed` (
  `orderid` bigint NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `scalar` decimal(18,4) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_cargo_detailed`
--

LOCK TABLES `chain_cargo_detailed` WRITE;
/*!40000 ALTER TABLE `chain_cargo_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_cargo_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_hange`
--

DROP TABLE IF EXISTS `chain_hange`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_hange` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `writetime` datetime DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `memid` bigint DEFAULT NULL,
  `remark` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_hange`
--

LOCK TABLES `chain_hange` WRITE;
/*!40000 ALTER TABLE `chain_hange` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_hange` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_hange_detailed`
--

DROP TABLE IF EXISTS `chain_hange_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_hange_detailed` (
  `orderid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,2) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `copys` int DEFAULT NULL,
  `split` tinyint DEFAULT NULL,
  `isspec` tinyint DEFAULT NULL,
  `retailprice` decimal(18,4) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `discount` decimal(18,2) DEFAULT NULL,
  `shopid` bigint DEFAULT NULL,
  `unit` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_hange_detailed`
--

LOCK TABLES `chain_hange_detailed` WRITE;
/*!40000 ALTER TABLE `chain_hange_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_hange_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_invoice_detailed`
--

DROP TABLE IF EXISTS `chain_invoice_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_invoice_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint NOT NULL COMMENT '产品ID',
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `return_scalar` decimal(18,3) DEFAULT NULL,
  `new_price` decimal(18,4) DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  `reject_scalar` decimal(18,3) DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_invoice_detailed`
--

LOCK TABLES `chain_invoice_detailed` WRITE;
/*!40000 ALTER TABLE `chain_invoice_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_invoice_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_invoice_head`
--

DROP TABLE IF EXISTS `chain_invoice_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_invoice_head` (
  `orderid` int NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `saleman` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalbyname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `remarks` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `cost` decimal(18,2) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `payway` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `fetch_way` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `rovalby` bigint DEFAULT NULL,
  `rovaldate` datetime DEFAULT NULL,
  `issettled` tinyint DEFAULT '0',
  `print_times` int DEFAULT '0',
  `print_man` bigint DEFAULT NULL,
  `related_typeid` int DEFAULT '0',
  `reson` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_return` int DEFAULT '0',
  `related_price` int DEFAULT '0',
  `ysb_order_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `platform` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_invoice_head`
--

LOCK TABLES `chain_invoice_head` WRITE;
/*!40000 ALTER TABLE `chain_invoice_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_invoice_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_menu`
--

DROP TABLE IF EXISTS `chain_menu`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_menu` (
  `menuid` bigint NOT NULL,
  `menu_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `parentid` bigint DEFAULT NULL,
  `winname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `assemblyname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `recno` int DEFAULT NULL,
  PRIMARY KEY (`menuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_menu`
--

LOCK TABLES `chain_menu` WRITE;
/*!40000 ALTER TABLE `chain_menu` DISABLE KEYS */;
INSERT INTO `chain_menu` VALUES (617186790723653,'门店业务',0,'','',0),(617187558285381,'请货申请',617186790723653,'CarGo','Kern_Basis',1),(617187904024645,'配送单确认',617186790723653,'CargoStorage','Kern_Basis',2),(617189290696773,'零售管理',0,'','',0),(617189525504069,'零售收款',617189290696773,'ChainRetail','Kern_Basis',1),(617189814276165,'会员日管理',617189290696773,'MemberDay','Kern_Basis',2),(617190031577157,'药品拆零',617189290696773,'SplitWares','Kern_Basis',3),(619375037419589,'查询业务',0,'','',0),(619375249039429,'零售收款查询',619375037419589,'QueryRetail','Kern_Query',1),(622240781570117,'批次库存查询',619375037419589,'QueryBatchStocks','Kern_Query',2),(623576972697669,'拆零记录',619375037419589,'QuerySplit','Kern_Query',3),(623951749320773,'积分兑换',617189290696773,'MemberRedeem','Kern_Basis',4),(624266089738309,'效期药品',619375037419589,'QueryExpireWares','Kern_Query',5),(624668541096005,'处方审核',617189290696773,'RecipelLocalCheck','Kern_Basis',5),(626037799972933,'门店调拨',617186790723653,'Transfer','Kern_Basis',3),(626393884307525,'调拨单确认',617186790723653,'AllocateCheck','Kern_Basis',5),(651584136044613,'自定价格管理',617189290696773,'AdjustPrice','Kern_Basis',6),(739686944571461,'门店请货单查询',619375037419589,'QueryCarGo','Kern_Query',5),(739722897473605,'门店配送单查询',619375037419589,'QueryDelivery','Kern_Query',6);
/*!40000 ALTER TABLE `chain_menu` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_msc_code`
--

DROP TABLE IF EXISTS `chain_msc_code`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_msc_code` (
  `serialid` bigint NOT NULL,
  `recno` int NOT NULL,
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `drugcode` varchar(30) DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `writetime` datetime DEFAULT NULL,
  PRIMARY KEY (`serialid`,`recno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_msc_code`
--

LOCK TABLES `chain_msc_code` WRITE;
/*!40000 ALTER TABLE `chain_msc_code` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_msc_code` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_msc_head`
--

DROP TABLE IF EXISTS `chain_msc_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_msc_head` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_msc_head`
--

LOCK TABLES `chain_msc_head` WRITE;
/*!40000 ALTER TABLE `chain_msc_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_msc_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_params`
--

DROP TABLE IF EXISTS `chain_params`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_params` (
  `id` int NOT NULL AUTO_INCREMENT,
  `params` varchar(20) DEFAULT NULL,
  `valuesby` tinyint DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_params`
--

LOCK TABLES `chain_params` WRITE;
/*!40000 ALTER TABLE `chain_params` DISABLE KEYS */;
INSERT INTO `chain_params` VALUES (1,'sync_price',0);
/*!40000 ALTER TABLE `chain_params` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_recipel`
--

DROP TABLE IF EXISTS `chain_recipel`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_recipel` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `createdate` date DEFAULT NULL,
  `writetime` date DEFAULT NULL,
  `nickname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `sex` varchar(10) DEFAULT NULL,
  `age` int DEFAULT NULL,
  `doctor` varchar(20) DEFAULT NULL,
  `hospital` varchar(100) DEFAULT NULL,
  `diagnosis` varchar(100) DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `remark` varchar(100) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `path` varchar(255) DEFAULT NULL,
  `rovalid` bigint DEFAULT NULL,
  `rovaldate` datetime DEFAULT NULL,
  `localpath` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_recipel`
--

LOCK TABLES `chain_recipel` WRITE;
/*!40000 ALTER TABLE `chain_recipel` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_recipel` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_recipel_detailed`
--

DROP TABLE IF EXISTS `chain_recipel_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_recipel_detailed` (
  `orderid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,2) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `copys` int DEFAULT NULL,
  `split` tinyint DEFAULT NULL,
  `isspec` tinyint DEFAULT NULL,
  `retailprice` decimal(18,4) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `discount` decimal(18,2) DEFAULT NULL,
  `shopid` bigint DEFAULT NULL,
  `rx` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_recipel_detailed`
--

LOCK TABLES `chain_recipel_detailed` WRITE;
/*!40000 ALTER TABLE `chain_recipel_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_recipel_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_retail`
--

DROP TABLE IF EXISTS `chain_retail`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_retail` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `writetime` datetime DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `alipay` decimal(18,2) DEFAULT NULL,
  `weixin` decimal(18,2) DEFAULT NULL,
  `cash` decimal(18,2) DEFAULT NULL,
  `bag` decimal(18,2) DEFAULT NULL,
  `medic` decimal(18,2) DEFAULT NULL,
  `bank` decimal(18,2) DEFAULT NULL,
  `cher` decimal(18,2) DEFAULT NULL,
  `other` decimal(18,2) DEFAULT NULL,
  `wipe` decimal(18,2) DEFAULT NULL,
  `change` decimal(18,2) DEFAULT NULL,
  `pocket` decimal(18,2) DEFAULT NULL,
  `memid` bigint DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `cost` decimal(18,2) DEFAULT NULL,
  `discount` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_retail`
--

LOCK TABLES `chain_retail` WRITE;
/*!40000 ALTER TABLE `chain_retail` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_retail` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_retail_detailed`
--

DROP TABLE IF EXISTS `chain_retail_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_retail_detailed` (
  `orderid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,2) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `copys` int DEFAULT NULL,
  `split` tinyint DEFAULT NULL,
  `isspec` tinyint DEFAULT NULL,
  `retailprice` decimal(18,4) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `discount` decimal(18,2) DEFAULT NULL,
  `shopid` bigint DEFAULT NULL,
  `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_retail_detailed`
--

LOCK TABLES `chain_retail_detailed` WRITE;
/*!40000 ALTER TABLE `chain_retail_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_retail_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_role`
--

DROP TABLE IF EXISTS `chain_role`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_role` (
  `post_role_id` bigint NOT NULL,
  `postid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `isroval` tinyint DEFAULT '0',
  `rovalby` bigint DEFAULT NULL,
  `rovaldate` date DEFAULT NULL,
  PRIMARY KEY (`post_role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_role`
--

LOCK TABLES `chain_role` WRITE;
/*!40000 ALTER TABLE `chain_role` DISABLE KEYS */;
INSERT INTO `chain_role` VALUES (624722520342597,624716122124357,611179262582853,0,0,'2024-12-20'),(625683948265541,624716028411973,616910577668165,0,0,'2024-12-23'),(625684385615941,624716122124357,619688834428997,0,0,'2024-12-23'),(625684810899525,624716028411973,619688834428997,0,0,'2024-12-23'),(736534240768069,624716122124357,611179262582853,0,0,'2025-11-01'),(738591105298501,624716122124357,619688834428997,0,0,'2025-11-07');
/*!40000 ALTER TABLE `chain_role` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_role_menu`
--

DROP TABLE IF EXISTS `chain_role_menu`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_role_menu` (
  `postid` bigint NOT NULL,
  `menuid` bigint NOT NULL,
  `isview` tinyint DEFAULT '1',
  PRIMARY KEY (`postid`,`menuid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_role_menu`
--

LOCK TABLES `chain_role_menu` WRITE;
/*!40000 ALTER TABLE `chain_role_menu` DISABLE KEYS */;
INSERT INTO `chain_role_menu` VALUES (624716028411973,617186790723653,1),(624716028411973,617187558285381,1),(624716028411973,617187904024645,1),(624716028411973,617189290696773,1),(624716028411973,617189525504069,1),(624716028411973,617189814276165,0),(624716028411973,617190031577157,0),(624716028411973,619375037419589,1),(624716028411973,619375249039429,0),(624716028411973,622240781570117,0),(624716028411973,623576972697669,0),(624716028411973,623951749320773,0),(624716028411973,624266089738309,0),(624716028411973,624668541096005,0),(624716122124357,617186790723653,1),(624716122124357,617187558285381,1),(624716122124357,617187904024645,1),(624716122124357,617189290696773,1),(624716122124357,617189525504069,1),(624716122124357,617189814276165,1),(624716122124357,617190031577157,1),(624716122124357,619375037419589,1),(624716122124357,619375249039429,1),(624716122124357,622240781570117,1),(624716122124357,623576972697669,1),(624716122124357,623951749320773,1),(624716122124357,624266089738309,1),(624716122124357,624668541096005,1),(624716122124357,626037799972933,1),(624716122124357,626393884307525,1),(624716122124357,651584136044613,1),(624716122124357,739686944571461,1),(624716122124357,739722897473605,1);
/*!40000 ALTER TABLE `chain_role_menu` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_sale_detailed`
--

DROP TABLE IF EXISTS `chain_sale_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_sale_detailed` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,2) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `split` tinyint DEFAULT NULL,
  `memid` bigint DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`,`recno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_sale_detailed`
--

LOCK TABLES `chain_sale_detailed` WRITE;
/*!40000 ALTER TABLE `chain_sale_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_sale_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_split_stocks`
--

DROP TABLE IF EXISTS `chain_split_stocks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_split_stocks` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `scalar` decimal(18,2) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `rate` int DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_split_stocks`
--

LOCK TABLES `chain_split_stocks` WRITE;
/*!40000 ALTER TABLE `chain_split_stocks` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_split_stocks` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_split_wares`
--

DROP TABLE IF EXISTS `chain_split_wares`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_split_wares` (
  `busiid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `scalar` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `batchid` int NOT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `unit` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `retailprice` decimal(18,3) DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `rate` int DEFAULT NULL,
  `sale` decimal(18,2) DEFAULT NULL,
  `calcscalar` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`busiid`,`id`,`batchid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_split_wares`
--

LOCK TABLES `chain_split_wares` WRITE;
/*!40000 ALTER TABLE `chain_split_wares` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_split_wares` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_store_batch`
--

DROP TABLE IF EXISTS `chain_store_batch`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_store_batch` (
  `busiid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `batchid` int NOT NULL,
  `batch` varchar(20) NOT NULL,
  `scalar` decimal(18,4) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`busiid`,`id`,`batchid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_store_batch`
--

LOCK TABLES `chain_store_batch` WRITE;
/*!40000 ALTER TABLE `chain_store_batch` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_store_batch` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_store_stocks`
--

DROP TABLE IF EXISTS `chain_store_stocks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_store_stocks` (
  `busiid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `scalar` decimal(18,4) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `retailprice` decimal(18,4) DEFAULT NULL,
  `memberprice` decimal(18,4) DEFAULT NULL,
  `specprice` decimal(18,4) DEFAULT NULL,
  `isspec` tinyint DEFAULT NULL,
  `spec_scalar` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`busiid`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_store_stocks`
--

LOCK TABLES `chain_store_stocks` WRITE;
/*!40000 ALTER TABLE `chain_store_stocks` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_store_stocks` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_transfer`
--

DROP TABLE IF EXISTS `chain_transfer`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_transfer` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `inbusiid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_transfer`
--

LOCK TABLES `chain_transfer` WRITE;
/*!40000 ALTER TABLE `chain_transfer` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_transfer` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chain_transfer_detailed`
--

DROP TABLE IF EXISTS `chain_transfer_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chain_transfer_detailed` (
  `orderid` bigint NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `scalar` decimal(18,4) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chain_transfer_detailed`
--

LOCK TABLES `chain_transfer_detailed` WRITE;
/*!40000 ALTER TABLE `chain_transfer_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `chain_transfer_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chainmember`
--

DROP TABLE IF EXISTS `chainmember`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chainmember` (
  `memid` bigint NOT NULL,
  `code` varchar(20) DEFAULT NULL,
  `member_name` varchar(20) DEFAULT NULL,
  `sex` tinyint DEFAULT NULL,
  `idcard` varchar(32) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`memid`),
  UNIQUE KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chainmember`
--

LOCK TABLES `chainmember` WRITE;
/*!40000 ALTER TABLE `chainmember` DISABLE KEYS */;
/*!40000 ALTER TABLE `chainmember` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chainmember_day`
--

DROP TABLE IF EXISTS `chainmember_day`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chainmember_day` (
  `busiid` bigint NOT NULL,
  `discount` decimal(10,2) DEFAULT NULL,
  `member_day` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chainmember_day`
--

LOCK TABLES `chainmember_day` WRITE;
/*!40000 ALTER TABLE `chainmember_day` DISABLE KEYS */;
/*!40000 ALTER TABLE `chainmember_day` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chainmember_expan`
--

DROP TABLE IF EXISTS `chainmember_expan`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chainmember_expan` (
  `busiid` bigint NOT NULL,
  `memid` bigint NOT NULL,
  `way` decimal(10,2) DEFAULT NULL,
  `integral` decimal(18,2) DEFAULT NULL,
  `pocket` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`busiid`,`memid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chainmember_expan`
--

LOCK TABLES `chainmember_expan` WRITE;
/*!40000 ALTER TABLE `chainmember_expan` DISABLE KEYS */;
/*!40000 ALTER TABLE `chainmember_expan` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chainmember_pocket`
--

DROP TABLE IF EXISTS `chainmember_pocket`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chainmember_pocket` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `memid` bigint DEFAULT NULL,
  `pocket` decimal(18,2) DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chainmember_pocket`
--

LOCK TABLES `chainmember_pocket` WRITE;
/*!40000 ALTER TABLE `chainmember_pocket` DISABLE KEYS */;
/*!40000 ALTER TABLE `chainmember_pocket` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chainmember_pocket_add`
--

DROP TABLE IF EXISTS `chainmember_pocket_add`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chainmember_pocket_add` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `memid` bigint DEFAULT NULL,
  `pocket` decimal(18,2) DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  PRIMARY KEY (`orderid`,`busiid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chainmember_pocket_add`
--

LOCK TABLES `chainmember_pocket_add` WRITE;
/*!40000 ALTER TABLE `chainmember_pocket_add` DISABLE KEYS */;
/*!40000 ALTER TABLE `chainmember_pocket_add` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chainmember_redeem`
--

DROP TABLE IF EXISTS `chainmember_redeem`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chainmember_redeem` (
  `orderid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `memid` bigint NOT NULL,
  `integral` decimal(18,2) DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `remark` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chainmember_redeem`
--

LOCK TABLES `chainmember_redeem` WRITE;
/*!40000 ALTER TABLE `chainmember_redeem` DISABLE KEYS */;
/*!40000 ALTER TABLE `chainmember_redeem` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `chainuser`
--

DROP TABLE IF EXISTS `chainuser`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `chainuser` (
  `userid` bigint NOT NULL,
  `nickcode` varchar(10) DEFAULT NULL,
  `nickname` varchar(20) DEFAULT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `password` varchar(200) DEFAULT NULL,
  `busiid` bigint NOT NULL,
  `issignin` tinyint DEFAULT NULL,
  PRIMARY KEY (`userid`,`busiid`),
  UNIQUE KEY `nickcode` (`nickcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `chainuser`
--

LOCK TABLES `chainuser` WRITE;
/*!40000 ALTER TABLE `chainuser` DISABLE KEYS */;
INSERT INTO `chainuser` VALUES (611179262582853,'10001','王增勇','','Xeew5A2LzNo=',729088726982725,1),(616910577668165,'10002','小张','','Xeew5A2LzNo=',552113820491845,1),(619688834428997,'10003','小王','','Xeew5A2LzNo=',737929393430597,1);
/*!40000 ALTER TABLE `chainuser` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `client_menu`
--

DROP TABLE IF EXISTS `client_menu`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `client_menu` (
  `menuid` bigint NOT NULL,
  `menu_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `parentid` bigint DEFAULT NULL,
  `isactive` tinyint DEFAULT '0',
  `roleid` bigint DEFAULT NULL,
  `winname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `assemblyname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `recno` int DEFAULT NULL,
  PRIMARY KEY (`menuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `client_menu`
--

LOCK TABLES `client_menu` WRITE;
/*!40000 ALTER TABLE `client_menu` DISABLE KEYS */;
INSERT INTO `client_menu` VALUES (350319144476741,'基础资料',-1,1,NULL,'','',1),(350319502905413,'人员资料',350319144476741,1,NULL,'UserManage','BasicData',0),(350319746887749,'系统管理',-1,1,NULL,NULL,NULL,2),(350319997386821,'菜单管理',350319746887749,1,NULL,'SysManage.MenuManage','BasicData',NULL),(350329030950981,'产品资料',350319144476741,1,NULL,'WaresManage','BasicData',NULL),(350711514681413,'采购管理',-1,1,NULL,NULL,NULL,3),(350760421969989,'往来企业资料',350319144476741,1,NULL,'BusinessManage','BasicData',0),(350814580559941,'质量管理',-1,1,NULL,NULL,NULL,5),(356433909219397,'采购订单',350711514681413,1,NULL,'PurcharseOrder','PurCharse',1),(386175860801605,'区域维护',350319144476741,1,NULL,'DepartMent','BasicData',0),(386806338961477,'岗位角色维护',350319746887749,1,NULL,'SysManage.RoleManage','BasicData',NULL),(386872483029061,'功能授权',350319746887749,1,NULL,'SysManage.RoleMenu','BasicData',NULL),(387651954790469,'权限审核',350814580559941,1,NULL,'RoleChecked','Quality',NULL),(387867091468357,'首营企业审核',350814580559941,1,NULL,'FirstEnterpriseChecked','Quality',NULL),(388231110082629,'销售管理',-1,1,NULL,NULL,NULL,4),(388576086491205,'首营企业审核',350711514681413,1,NULL,'FirstEnterpriseChecked','Quality',5),(388589783679045,'报表设计',350319746887749,1,NULL,'SysManage.ReportDesign','BasicData',NULL),(388952401489989,'首营品种审核',388231110082629,1,NULL,'FirstWaresChecked','Quality',6),(390017503703109,'采购订单目录',350711514681413,1,NULL,'OrderList','PurCharse',4),(390365563023429,'仓库管理',-1,1,NULL,NULL,NULL,7),(390379219169349,'收货管理',390365563023429,1,NULL,'','',0),(390379420971077,'采购订单收货',390379219169349,1,NULL,'WareHouse.ReceiptOrder','PurCharse',1),(390683309232197,'仓库维护',390365563023429,1,NULL,'StoreHouse','WareHouse',1),(391794621440069,'收货验收',350814580559941,1,NULL,'','',0),(391795012055109,'质检收货验收',391794621440069,1,NULL,'ReceivedQAList','Quality',1),(393179484540997,'查询业务',-1,1,NULL,NULL,NULL,8),(393179790262341,'采购查询',393179484540997,1,NULL,'','',1),(393179965894725,'商品流水查询',393179484540997,1,NULL,'QueryWater','Query',3),(393888227835973,'入库验收记录',391794621440069,1,NULL,'QueryRovalRecord','Query',2),(393976842055749,'仓库查询',393179484540997,1,NULL,'','',2),(393977012068421,'总库存查询',393976842055749,1,NULL,'QueryTotalStocks','Query',1),(394218796888133,'销售开票',388231110082629,1,NULL,'SaleInvoice','SellManage',1),(394263000277061,'业务员管理',350319144476741,1,NULL,'SaleManManage','BasicData',0),(394735503269957,'草拟目录',388231110082629,1,NULL,'QueryTempInvoice','Query',10),(394735735132229,'销售查询',393179484540997,1,NULL,'','',1),(395352937218117,'采购退货申请',350711514681413,1,NULL,'PurcharseReturn','PurCharse',2),(395980920393797,'财务管理',-1,1,NULL,NULL,NULL,6),(395981193437253,'审核业务',395980920393797,1,NULL,'','',0),(396000422096965,'采购退货及调价审核',395981193437253,1,NULL,'PurCharseCheck','Finance',3),(396095898533957,'采购调价',350711514681413,1,NULL,'PurcharseDifferPrice','PurCharse',3),(396440525283397,'采购目录',393179790262341,1,NULL,'QueryRovalPutIn','Query',1),(396716301967429,'销售限价审核',388231110082629,1,NULL,'SaleCheckPrice','SellManage',5),(396802676584517,'销售记账审核',395981193437253,1,NULL,'SaleCheck','Finance',2),(397799893286981,'销售现金审核',395981193437253,1,NULL,'SaleCashCheck','Finance',1),(397831578427461,'销售目录',394735735132229,1,NULL,'QuerySaleList','Query',1),(398552053096517,'销售含麻审核',350814580559941,1,NULL,'SaleHempCheck','Quality',3),(398830096781381,'销售冲票',388231110082629,1,NULL,'SaleOffSet','SellManage',2),(399260447285317,'销售退货开票',388231110082629,1,NULL,'SaleReturn','SellManage',3),(400302969512005,'销售退货验收',391794621440069,1,NULL,'SaleReturnQAList','Quality',0),(400682855579717,'销售调价',388231110082629,1,NULL,'SaleDifferPrice','SellManage',4),(401297404596293,'销售退货确认',390379219169349,1,NULL,'SaleReturnConfig','WareHouse',0),(401304358813765,'销售退货验收记录',391794621440069,1,NULL,'QueryReturnRecord','Query',0),(401384295735365,'价格调整',388231110082629,1,NULL,'SaleAdjustPrice','SellManage',7),(402019306315845,'应付管理',395980920393797,1,NULL,'','',2),(402040330711109,'采购预付款',402019306315845,1,NULL,'PurCharsePayMent','Finance',0),(402779245244485,'财务查询',393179484540997,1,NULL,'','',0),(402786457477189,'预付款审核',402019306315845,1,NULL,'PayMentCheck','Finance',0),(402800000127045,'预付款查询',402779245244485,1,NULL,'QueryPayMent','Query',1),(403163626639429,'付款勾对',402019306315845,1,NULL,'PayOrderCheck','Finance',0),(404138768605253,'发票管理',395980920393797,1,NULL,'','',0),(404150295687237,'采购发票',404138768605253,1,NULL,'ReceiptByPurcharse','Finance',0),(405222288228421,'采购发票查询',402779245244485,1,NULL,'QueryReceiptByPurCharse','Query',3),(405265011572805,'销售发票',404138768605253,1,NULL,'ReceiptBySale','Finance',0),(406962776219717,'应收管理',395980920393797,1,NULL,'','',0),(407692656095301,'销售预收款',406962776219717,1,NULL,'SalePayMent','Finance',0),(407743909081157,'预收款审核',406962776219717,1,NULL,'SalePayMentCheck','Finance',0),(407755946913861,'收款勾对',406962776219717,1,NULL,'SaleOrderCheck','Finance',0),(407764843655237,'预收款查询',402779245244485,1,NULL,'QuerySalePayMent','Query',2),(407774573572165,'销售发票查询',402779245244485,1,NULL,'QueryReceiptBySale','Query',4),(408470717399109,'质量查询',393179484540997,1,NULL,'','',0),(408479633985605,'特殊药品销售记录',408470717399109,1,NULL,'QueryHempRecord','Query',0),(409189449064517,'养护管理',350814580559941,1,NULL,'','',0),(409205529047109,'重点养护',409189449064517,1,NULL,'KeyCuring','Quality',1),(410246906474565,'普通养护',409189449064517,1,NULL,'SameCuring','Quality',2),(410508335784005,'养护目录',409189449064517,1,NULL,'CuringList','Quality',3),(410857018314821,'批次库存',393976842055749,1,NULL,'QueryBatchStocks','Query',0),(410938767388741,'架位号管理',390365563023429,1,NULL,'RackPosition','WareHouse',0),(413714545074245,'销售收款查询',402779245244485,1,NULL,'QuerySaleSettled','Query',0),(414123197493317,'盘点管理',390365563023429,1,NULL,'','',0),(414143489278021,'盘点表',414123197493317,1,NULL,'CountSheet','WareHouse',0),(414490665119813,'盘点信息',414123197493317,1,NULL,'InventoryType','WareHouse',0),(417651039825989,'区域库存',393976842055749,1,NULL,'QueryDepartStocks','Query',0),(417968081133637,'设备管理',350814580559941,1,NULL,'','',0),(417968316293189,'设备维护',417968081133637,1,NULL,'Device','Quality',0),(418292150693957,'开票员统计',394735735132229,1,NULL,'QueryInvoicer','Query',0),(422551794278469,'导入商品',350319746887749,1,NULL,'SysManage.ExportWares','BasicData',0),(425801211584581,'导入企业',350319746887749,1,NULL,'SysManage.ExportEnterPrise','BasicData',0),(426433675124805,'业务员统计',394735735132229,1,NULL,'QueryBuyer','Query',0),(427591854809157,'采购付款查询',402779245244485,1,NULL,'QueryPurcharseSettled','Query',0),(427892476207173,'商品跟踪',393179484540997,1,NULL,'QueryTrace','Query',0),(428267468935237,'药品效期预警',408470717399109,1,NULL,'QueryExpireWares','Query',0),(428298154057797,'往来企业预警',408470717399109,1,NULL,'QueryExpireEnterPrise','Query',0),(430064107622469,'第三方接口',-1,1,NULL,NULL,NULL,9),(430064819351621,'小药药客户接口',430064107622469,1,NULL,'FetchEnterPrise','ThirdInterface',0),(430405248741445,'小药药订单',430064107622469,1,NULL,'YSB_Order','ThirdInterface',0),(434307062059077,'设备记录',417968081133637,1,NULL,'DeviceRecord','Quality',0),(435337452683333,'报损申请',390365563023429,1,NULL,'OverFlowAndLoss','WareHouse',0),(436061537726533,'报损质检审核',350814580559941,1,NULL,'OverFlowLossCheck','Quality',0),(436330373873733,'报损总经理审核',350814580559941,1,NULL,'OverFlowLossCheck','Quality',0),(436330589519941,'报损财务审核',395980920393797,1,NULL,'OverFlowLossCheck','Quality',0),(437460597170245,'物流管理',-1,1,NULL,NULL,NULL,10),(437460926718021,'承运单位管理 ',437460597170245,1,NULL,'Carrier','Logistics',0),(437780690186309,'权限审核查询',408470717399109,1,NULL,'QueryRoleCheck','Query',0),(438123829514309,'销售限价审核查询',394735735132229,1,NULL,'QueryLimitPrice','Query',0),(450524141760581,'药士帮客户',430064107622469,1,NULL,'YSB_EnterPrise','ThirdInterface',0),(450566819622981,'药士帮订单',430064107622469,1,NULL,'YSB_ERP_DDHZ','ThirdInterface',0),(473576979251269,'档案文件上传',350814580559941,1,NULL,'DocFile','FileLoad',0),(507482944892997,'缺货查询',393179790262341,1,NULL,'QueryLackStock','Query',3),(508553704648773,'销售出库复核',390365563023429,1,NULL,'SaleOutCheck','WareHouse',0),(509640154947653,'销售出库复核查询',393976842055749,1,NULL,'QuerySaleOutCheck','Query',0),(510009692016709,'预留数量查询',393976842055749,1,NULL,'QueryReserve','Query',0),(510681350004805,'采购退货(不需原票号）',350711514681413,1,NULL,'PurcharseByType','PurCharse',6),(516339654807621,'供货商品种',393179790262341,1,NULL,'QuerySuplies','Query',3),(517099840761925,'销售退货(不按原票号)',388231110082629,1,NULL,'SaleReturnType','SellManage',8),(517822667731013,'应收余额查询',402779245244485,1,NULL,'QueryBalance','Query',8),(518095186239557,'应付余额查询',402779245244485,1,NULL,'QueryBalancePayer','Query',9),(519860665954373,'商品锁定',350814580559941,1,NULL,'WaresLock','Quality',15),(519878336757829,'商品锁定审核',350814580559941,1,NULL,'WaresLockCheck','Quality',16),(545007920996421,'报损目录查询',393976842055749,1,NULL,'QueryOverFlowLoss','Query',6),(551727536681029,'采购退货出库复核',730438294675525,1,NULL,'PurcharseOutMsc','Quality',2),(551806691668037,'采购退货仓库审核',390365563023429,1,NULL,'PurCharseOutByStore','WareHouse',9),(558800173555781,'积压商品',393976842055749,1,NULL,'BackLogWares','Query',12),(558853166243909,'销售记录',394735735132229,1,NULL,'QuerySaleDetails','Query',6),(564468795818053,'收款员汇总查询',402779245244485,1,NULL,'QuerySumBySale','Query',12),(571629017473093,'单品详情',393179484540997,1,NULL,'QueryNewWater','Query',0),(609133958979653,'配送中心',-1,1,NULL,NULL,NULL,0),(609134357602373,'配送开票',609133958979653,1,NULL,'ChainInvoice','Delivery',0),(609409106239557,'草拟配送单',609133958979653,1,NULL,'QueryInvoiceChain','Delivery',2),(609467029659717,'连锁业务',-1,1,NULL,NULL,NULL,0),(609467282370629,'连锁审核',609467029659717,1,NULL,'','',0),(609467745579077,'配送现金审核',609467282370629,1,NULL,'ChainInvoiceCash','Catena',0),(609491208532037,'配送记账审核',609467282370629,1,NULL,'ChainInvoiceBook','Catena',0),(610880122613829,'连锁价格管理',609467029659717,1,NULL,'','',0),(610880463814725,'基本价格',610880122613829,1,NULL,'ChainPrice','Catena',1),(611168588853317,'连锁用户',609467029659717,1,NULL,'ChainUser','Catena',0),(611951761903685,'门店请货单',609133958979653,1,NULL,'QueryCargo','Delivery',3),(612597216956485,'配送退货单',612627594821701,1,NULL,'SaleReturn','Delivery',0),(612627594821701,'配送退货管理',609133958979653,1,NULL,'','',0),(612628119191621,'配送退货验收',612627594821701,1,NULL,'SaleReturnQAList','Delivery',0),(617185830465605,'连锁菜单管理',609467029659717,1,NULL,'MenuAdmin','Catena',0),(618701123739717,'处方审核',609467029659717,1,NULL,'RecipelCheck','Catena',0),(619672027877445,'连锁查询',609467029659717,1,NULL,'','',0),(619672271188037,'门店收银查询',619672027877445,1,NULL,'QueryChainRetail','Query',1),(619684614815813,'门店销售明细',619672027877445,1,NULL,'QueryChainDetailed','Query',0),(619743728435269,'门店库存',619672027877445,1,NULL,'QueryChainBatch','Query',0),(624711464177733,'连锁零售授权',609467029659717,1,NULL,'RoleMenu','Catena',0),(635691276189765,'国家局药品查询',430064107622469,1,NULL,'DrugStandard','ThirdInterface',6),(642008463822917,'盘点审核',414123197493317,1,NULL,'InventoryCheck','WareHouse',0),(724436677247045,'销售复核码上传',730438294675525,1,NULL,'SaleMscOut','WareHouse',1),(730438294675525,'出库复核',350814580559941,1,NULL,'','',3),(740042728820805,'首营品种审核',350814580559941,1,NULL,'FirstWaresChecked','Quality',4);
/*!40000 ALTER TABLE `client_menu` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `client_users`
--

DROP TABLE IF EXISTS `client_users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `client_users` (
  `user_id` bigint NOT NULL,
  `user_code` varchar(20) DEFAULT NULL,
  `user_name` varchar(20) DEFAULT NULL,
  `user_pwd` varchar(100) DEFAULT NULL,
  `user_phone` varchar(20) DEFAULT NULL,
  `ispurcharse` tinyint DEFAULT '0',
  `isadmin` tinyint DEFAULT '0',
  `issignin` tinyint DEFAULT '0',
  `isleave` tinyint DEFAULT '0',
  `roleid` bigint DEFAULT NULL,
  `deptid` bigint DEFAULT NULL,
  `departno` varchar(20) DEFAULT NULL,
  `createby` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `sex` tinyint DEFAULT '0',
  `spell` varchar(50) DEFAULT NULL,
  `isexp_data` tinyint DEFAULT '0',
  `issee_price` tinyint DEFAULT '0',
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `user_code` (`user_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `client_users`
--

LOCK TABLES `client_users` WRITE;
/*!40000 ALTER TABLE `client_users` DISABLE KEYS */;
INSERT INTO `client_users` VALUES (1,'01','Admin','1','13574869206',1,0,1,0,NULL,NULL,'1',NULL,'2025-11-05',0,'ADMIN',0,1),(386790080102469,'admin','管理员','C5zG3MH8sHQ=','',0,0,1,0,NULL,NULL,'1',NULL,'2024-05-07',0,'GLY',1,1),(418356061474885,'WZ002','采购/销售','Xeew5A2LzNo=','',0,0,1,0,NULL,NULL,'999',NULL,'2023-06-20',0,'CG/XS',0,1),(418356662693957,'WZ003','质量经理','Xeew5A2LzNo=','',0,0,1,0,NULL,NULL,'999',NULL,'2023-06-20',0,'ZLJL',0,0),(436328024711237,'WZ888','总经理','Xeew5A2LzNo=','',0,0,1,0,NULL,NULL,'999',NULL,'2023-07-07',0,'ZJL',0,0),(436330892095557,'WZ004','财务','Xeew5A2LzNo=','',0,0,1,0,NULL,NULL,'999',NULL,'2023-07-07',0,'CW',0,0);
/*!40000 ALTER TABLE `client_users` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_account`
--

DROP TABLE IF EXISTS `tb_account`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_account` (
  `busiid` bigint NOT NULL,
  `payer` decimal(18,2) DEFAULT '0.00',
  `party` decimal(18,2) DEFAULT '0.00',
  `settled_payer` decimal(18,2) DEFAULT '0.00',
  `settled_party` decimal(18,2) DEFAULT '0.00',
  `balance_payer` decimal(18,2) DEFAULT '0.00',
  `balance_party` decimal(18,2) DEFAULT '0.00',
  PRIMARY KEY (`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_account`
--

LOCK TABLES `tb_account` WRITE;
/*!40000 ALTER TABLE `tb_account` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_account` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_account_detailed`
--

DROP TABLE IF EXISTS `tb_account_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_account_detailed` (
  `billid` bigint NOT NULL,
  `orderid` int DEFAULT NULL,
  `order_type` tinyint NOT NULL,
  `busiid` bigint NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `saleman` varchar(20) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT '0.00',
  `unamount` decimal(18,2) DEFAULT '0.00',
  `this_amount` decimal(18,2) DEFAULT '0.00',
  `user_id` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `issettled` tinyint DEFAULT '0',
  `payway` varchar(10) DEFAULT NULL,
  `direction` tinyint DEFAULT NULL,
  `transferid` bigint DEFAULT NULL,
  PRIMARY KEY (`billid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_account_detailed`
--

LOCK TABLES `tb_account_detailed` WRITE;
/*!40000 ALTER TABLE `tb_account_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_account_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_adjust_price`
--

DROP TABLE IF EXISTS `tb_adjust_price`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_adjust_price` (
  `priceid` bigint NOT NULL,
  `id` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `old_minprice` decimal(18,4) DEFAULT NULL,
  `old_saleprice` decimal(18,4) DEFAULT NULL,
  `old_bidprice` decimal(18,4) DEFAULT NULL,
  `old_retailprice` decimal(18,4) DEFAULT NULL,
  `old_costprice` decimal(18,4) DEFAULT NULL,
  `minprice` decimal(18,4) DEFAULT NULL,
  `saleprice` decimal(18,4) DEFAULT NULL,
  `bidprice` decimal(18,4) DEFAULT NULL,
  `retailprice` decimal(18,4) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  PRIMARY KEY (`priceid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_adjust_price`
--

LOCK TABLES `tb_adjust_price` WRITE;
/*!40000 ALTER TABLE `tb_adjust_price` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_adjust_price` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_areas`
--

DROP TABLE IF EXISTS `tb_areas`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_areas` (
  `id` varchar(100) NOT NULL COMMENT 'Id',
  `description` varchar(100) DEFAULT NULL COMMENT '描述',
  `modifier` varchar(100) DEFAULT NULL COMMENT '修改人',
  `dept_belong_id` varchar(100) DEFAULT NULL COMMENT '数据归属部门',
  `update_datetime` datetime(6) DEFAULT NULL COMMENT '修改时间',
  `create_datetime` datetime(6) DEFAULT NULL COMMENT '创建时间',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `status` tinyint(1) DEFAULT NULL,
  `creator_id` varchar(100) DEFAULT NULL COMMENT '创建人',
  `parent_id` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `tb_areas_parent_id_bae67575_fk_tb_areas_id` (`parent_id`),
  KEY `tb_areas_creator_id_d3691ab2` (`creator_id`),
  CONSTRAINT `tb_areas_parent_id_bae67575_fk_tb_areas_id` FOREIGN KEY (`parent_id`) REFERENCES `tb_areas` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='省市区';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_areas`
--

LOCK TABLES `tb_areas` WRITE;
/*!40000 ALTER TABLE `tb_areas` DISABLE KEYS */;
INSERT INTO `tb_areas` VALUES ('110000','北京市',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('110100','北京市','110000','1',NULL,NULL,NULL,NULL,NULL,NULL),('110101','东城区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110102','西城区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110105','朝阳区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110106','丰台区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110107','石景山区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110108','海淀区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110109','门头沟区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110111','房山区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110112','通州区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110113','顺义区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110114','昌平区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110115','大兴区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110116','怀柔区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110117','平谷区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110118','密云区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('110119','延庆区','110100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120000','天津市',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('120100','天津市','120000','1',NULL,NULL,NULL,NULL,NULL,NULL),('120101','和平区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120102','河东区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120103','河西区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120104','南开区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120105','河北区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120106','红桥区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120110','东丽区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120111','西青区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120112','津南区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120113','北辰区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120114','武清区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120115','宝坻区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120116','滨海新区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120117','宁河区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120118','静海区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('120119','蓟州区','120100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130000','河北省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('130100','石家庄市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130102','长安区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130104','桥西区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130105','新华区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130107','井陉矿区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130108','裕华区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130109','藁城区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130110','鹿泉区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130111','栾城区','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130121','井陉县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130123','正定县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130125','行唐县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130126','灵寿县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130127','高邑县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130128','深泽县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130129','赞皇县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130130','无极县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130131','平山县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130132','元氏县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130133','赵县','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130181','辛集市','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130183','晋州市','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130184','新乐市','130100','1',NULL,NULL,NULL,NULL,NULL,NULL),('130200','唐山市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130202','路南区','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130203','路北区','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130204','古冶区','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130205','开平区','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130207','丰南区','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130208','丰润区','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130209','曹妃甸区','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130223','滦县','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130224','滦南县','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130225','乐亭县','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130227','迁西县','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130229','玉田县','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130281','遵化市','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130283','迁安市','130200','1',NULL,NULL,NULL,NULL,NULL,NULL),('130300','秦皇岛市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130302','海港区','130300','1',NULL,NULL,NULL,NULL,NULL,NULL),('130303','山海关区','130300','1',NULL,NULL,NULL,NULL,NULL,NULL),('130304','北戴河区','130300','1',NULL,NULL,NULL,NULL,NULL,NULL),('130306','抚宁区','130300','1',NULL,NULL,NULL,NULL,NULL,NULL),('130321','青龙满族自治县','130300','1',NULL,NULL,NULL,NULL,NULL,NULL),('130322','昌黎县','130300','1',NULL,NULL,NULL,NULL,NULL,NULL),('130324','卢龙县','130300','1',NULL,NULL,NULL,NULL,NULL,NULL),('130400','邯郸市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130402','邯山区','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130403','丛台区','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130404','复兴区','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130406','峰峰矿区','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130421','邯郸县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130423','临漳县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130424','成安县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130425','大名县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130426','涉县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130427','磁县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130428','肥乡县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130429','永年县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130430','邱县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130431','鸡泽县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130432','广平县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130433','馆陶县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130434','魏县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130435','曲周县','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130481','武安市','130400','1',NULL,NULL,NULL,NULL,NULL,NULL),('130500','邢台市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130502','桥东区','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130503','桥西区','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130521','邢台县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130522','临城县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130523','内丘县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130524','柏乡县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130525','隆尧县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130526','任县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130527','南和县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130528','宁晋县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130529','巨鹿县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130530','新河县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130531','广宗县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130532','平乡县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130533','威县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130534','清河县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130535','临西县','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130581','南宫市','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130582','沙河市','130500','1',NULL,NULL,NULL,NULL,NULL,NULL),('130600','保定市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130602','竞秀区','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130606','莲池区','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130607','满城区','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130608','清苑区','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130609','徐水区','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130623','涞水县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130624','阜平县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130626','定兴县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130627','唐县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130628','高阳县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130629','容城县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130630','涞源县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130631','望都县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130632','安新县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130633','易县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130634','曲阳县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130635','蠡县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130636','顺平县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130637','博野县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130638','雄县','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130681','涿州市','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130682','定州市','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130683','安国市','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130684','高碑店市','130600','1',NULL,NULL,NULL,NULL,NULL,NULL),('130700','张家口市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130702','桥东区','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130703','桥西区','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130705','宣化区','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130706','下花园区','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130708','万全区','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130709','崇礼区','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130722','张北县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130723','康保县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130724','沽源县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130725','尚义县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130726','蔚县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130727','阳原县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130728','怀安县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130730','怀来县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130731','涿鹿县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130732','赤城县','130700','1',NULL,NULL,NULL,NULL,NULL,NULL),('130800','承德市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130802','双桥区','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130803','双滦区','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130804','鹰手营子矿区','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130821','承德县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130822','兴隆县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130823','平泉县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130824','滦平县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130825','隆化县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130826','丰宁满族自治县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130827','宽城满族自治县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130828','围场满族蒙古族自治县','130800','1',NULL,NULL,NULL,NULL,NULL,NULL),('130900','沧州市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('130902','新华区','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130903','运河区','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130921','沧县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130922','青县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130923','东光县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130924','海兴县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130925','盐山县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130926','肃宁县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130927','南皮县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130928','吴桥县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130929','献县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130930','孟村回族自治县','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130981','泊头市','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130982','任丘市','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130983','黄骅市','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('130984','河间市','130900','1',NULL,NULL,NULL,NULL,NULL,NULL),('131000','廊坊市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131002','安次区','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131003','广阳区','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131022','固安县','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131023','永清县','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131024','香河县','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131025','大城县','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131026','文安县','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131028','大厂回族自治县','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131081','霸州市','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131082','三河市','131000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131100','衡水市','130000','1',NULL,NULL,NULL,NULL,NULL,NULL),('131102','桃城区','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131103','冀州区','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131121','枣强县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131122','武邑县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131123','武强县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131124','饶阳县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131125','安平县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131126','故城县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131127','景县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131128','阜城县','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('131182','深州市','131100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140000','山西省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('140100','太原市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140105','小店区','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140106','迎泽区','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140107','杏花岭区','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140108','尖草坪区','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140109','万柏林区','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140110','晋源区','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140121','清徐县','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140122','阳曲县','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140123','娄烦县','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140181','古交市','140100','1',NULL,NULL,NULL,NULL,NULL,NULL),('140200','大同市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140202','城区','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140203','矿区','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140211','南郊区','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140212','新荣区','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140221','阳高县','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140222','天镇县','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140223','广灵县','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140224','灵丘县','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140225','浑源县','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140226','左云县','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140227','大同县','140200','1',NULL,NULL,NULL,NULL,NULL,NULL),('140300','阳泉市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140302','城区','140300','1',NULL,NULL,NULL,NULL,NULL,NULL),('140303','矿区','140300','1',NULL,NULL,NULL,NULL,NULL,NULL),('140311','郊区','140300','1',NULL,NULL,NULL,NULL,NULL,NULL),('140321','平定县','140300','1',NULL,NULL,NULL,NULL,NULL,NULL),('140322','盂县','140300','1',NULL,NULL,NULL,NULL,NULL,NULL),('140400','长治市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140402','城区','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140411','郊区','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140421','长治县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140423','襄垣县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140424','屯留县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140425','平顺县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140426','黎城县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140427','壶关县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140428','长子县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140429','武乡县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140430','沁县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140431','沁源县','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140481','潞城市','140400','1',NULL,NULL,NULL,NULL,NULL,NULL),('140500','晋城市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140502','城区','140500','1',NULL,NULL,NULL,NULL,NULL,NULL),('140521','沁水县','140500','1',NULL,NULL,NULL,NULL,NULL,NULL),('140522','阳城县','140500','1',NULL,NULL,NULL,NULL,NULL,NULL),('140524','陵川县','140500','1',NULL,NULL,NULL,NULL,NULL,NULL),('140525','泽州县','140500','1',NULL,NULL,NULL,NULL,NULL,NULL),('140581','高平市','140500','1',NULL,NULL,NULL,NULL,NULL,NULL),('140600','朔州市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140602','朔城区','140600','1',NULL,NULL,NULL,NULL,NULL,NULL),('140603','平鲁区','140600','1',NULL,NULL,NULL,NULL,NULL,NULL),('140621','山阴县','140600','1',NULL,NULL,NULL,NULL,NULL,NULL),('140622','应县','140600','1',NULL,NULL,NULL,NULL,NULL,NULL),('140623','右玉县','140600','1',NULL,NULL,NULL,NULL,NULL,NULL),('140624','怀仁县','140600','1',NULL,NULL,NULL,NULL,NULL,NULL),('140700','晋中市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140702','榆次区','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140721','榆社县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140722','左权县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140723','和顺县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140724','昔阳县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140725','寿阳县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140726','太谷县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140727','祁县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140728','平遥县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140729','灵石县','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140781','介休市','140700','1',NULL,NULL,NULL,NULL,NULL,NULL),('140800','运城市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140802','盐湖区','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140821','临猗县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140822','万荣县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140823','闻喜县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140824','稷山县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140825','新绛县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140826','绛县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140827','垣曲县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140828','夏县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140829','平陆县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140830','芮城县','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140881','永济市','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140882','河津市','140800','1',NULL,NULL,NULL,NULL,NULL,NULL),('140900','忻州市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('140902','忻府区','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140921','定襄县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140922','五台县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140923','代县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140924','繁峙县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140925','宁武县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140926','静乐县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140927','神池县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140928','五寨县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140929','岢岚县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140930','河曲县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140931','保德县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140932','偏关县','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('140981','原平市','140900','1',NULL,NULL,NULL,NULL,NULL,NULL),('141000','临汾市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141002','尧都区','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141021','曲沃县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141022','翼城县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141023','襄汾县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141024','洪洞县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141025','古县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141026','安泽县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141027','浮山县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141028','吉县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141029','乡宁县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141030','大宁县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141031','隰县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141032','永和县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141033','蒲县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141034','汾西县','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141081','侯马市','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141082','霍州市','141000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141100','吕梁市','140000','1',NULL,NULL,NULL,NULL,NULL,NULL),('141102','离石区','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141121','文水县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141122','交城县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141123','兴县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141124','临县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141125','柳林县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141126','石楼县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141127','岚县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141128','方山县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141129','中阳县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141130','交口县','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141181','孝义市','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('141182','汾阳市','141100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150000','内蒙古自治区',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('150100','呼和浩特市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150102','新城区','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150103','回民区','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150104','玉泉区','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150105','赛罕区','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150121','土默特左旗','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150122','托克托县','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150123','和林格尔县','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150124','清水河县','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150125','武川县','150100','1',NULL,NULL,NULL,NULL,NULL,NULL),('150200','包头市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150202','东河区','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150203','昆都仑区','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150204','青山区','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150205','石拐区','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150206','白云鄂博矿区','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150207','九原区','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150221','土默特右旗','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150222','固阳县','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150223','达尔罕茂明安联合旗','150200','1',NULL,NULL,NULL,NULL,NULL,NULL),('150300','乌海市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150302','海勃湾区','150300','1',NULL,NULL,NULL,NULL,NULL,NULL),('150303','海南区','150300','1',NULL,NULL,NULL,NULL,NULL,NULL),('150304','乌达区','150300','1',NULL,NULL,NULL,NULL,NULL,NULL),('150400','赤峰市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150402','红山区','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150403','元宝山区','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150404','松山区','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150421','阿鲁科尔沁旗','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150422','巴林左旗','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150423','巴林右旗','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150424','林西县','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150425','克什克腾旗','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150426','翁牛特旗','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150428','喀喇沁旗','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150429','宁城县','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150430','敖汉旗','150400','1',NULL,NULL,NULL,NULL,NULL,NULL),('150500','通辽市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150502','科尔沁区','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150521','科尔沁左翼中旗','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150522','科尔沁左翼后旗','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150523','开鲁县','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150524','库伦旗','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150525','奈曼旗','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150526','扎鲁特旗','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150581','霍林郭勒市','150500','1',NULL,NULL,NULL,NULL,NULL,NULL),('150600','鄂尔多斯市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150602','东胜区','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150603','康巴什区','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150621','达拉特旗','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150622','准格尔旗','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150623','鄂托克前旗','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150624','鄂托克旗','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150625','杭锦旗','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150626','乌审旗','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150627','伊金霍洛旗','150600','1',NULL,NULL,NULL,NULL,NULL,NULL),('150700','呼伦贝尔市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150702','海拉尔区','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150703','扎赉诺尔区','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150721','阿荣旗','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150722','莫力达瓦达斡尔族自治旗','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150723','鄂伦春自治旗','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150724','鄂温克族自治旗','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150725','陈巴尔虎旗','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150726','新巴尔虎左旗','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150727','新巴尔虎右旗','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150781','满洲里市','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150782','牙克石市','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150783','扎兰屯市','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150784','额尔古纳市','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150785','根河市','150700','1',NULL,NULL,NULL,NULL,NULL,NULL),('150800','巴彦淖尔市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150802','临河区','150800','1',NULL,NULL,NULL,NULL,NULL,NULL),('150821','五原县','150800','1',NULL,NULL,NULL,NULL,NULL,NULL),('150822','磴口县','150800','1',NULL,NULL,NULL,NULL,NULL,NULL),('150823','乌拉特前旗','150800','1',NULL,NULL,NULL,NULL,NULL,NULL),('150824','乌拉特中旗','150800','1',NULL,NULL,NULL,NULL,NULL,NULL),('150825','乌拉特后旗','150800','1',NULL,NULL,NULL,NULL,NULL,NULL),('150826','杭锦后旗','150800','1',NULL,NULL,NULL,NULL,NULL,NULL),('150900','乌兰察布市','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('150902','集宁区','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150921','卓资县','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150922','化德县','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150923','商都县','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150924','兴和县','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150925','凉城县','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150926','察哈尔右翼前旗','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150927','察哈尔右翼中旗','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150928','察哈尔右翼后旗','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150929','四子王旗','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('150981','丰镇市','150900','1',NULL,NULL,NULL,NULL,NULL,NULL),('152200','兴安盟','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('152201','乌兰浩特市','152200','1',NULL,NULL,NULL,NULL,NULL,NULL),('152202','阿尔山市','152200','1',NULL,NULL,NULL,NULL,NULL,NULL),('152221','科尔沁右翼前旗','152200','1',NULL,NULL,NULL,NULL,NULL,NULL),('152222','科尔沁右翼中旗','152200','1',NULL,NULL,NULL,NULL,NULL,NULL),('152223','扎赉特旗','152200','1',NULL,NULL,NULL,NULL,NULL,NULL),('152224','突泉县','152200','1',NULL,NULL,NULL,NULL,NULL,NULL),('152500','锡林郭勒盟','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('152501','二连浩特市','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152502','锡林浩特市','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152522','阿巴嘎旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152523','苏尼特左旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152524','苏尼特右旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152525','东乌珠穆沁旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152526','西乌珠穆沁旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152527','太仆寺旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152528','镶黄旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152529','正镶白旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152530','正蓝旗','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152531','多伦县','152500','1',NULL,NULL,NULL,NULL,NULL,NULL),('152900','阿拉善盟','150000','1',NULL,NULL,NULL,NULL,NULL,NULL),('152921','阿拉善左旗','152900','1',NULL,NULL,NULL,NULL,NULL,NULL),('152922','阿拉善右旗','152900','1',NULL,NULL,NULL,NULL,NULL,NULL),('152923','额济纳旗','152900','1',NULL,NULL,NULL,NULL,NULL,NULL),('210000','辽宁省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('210100','沈阳市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210102','和平区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210103','沈河区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210104','大东区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210105','皇姑区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210106','铁西区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210111','苏家屯区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210112','浑南区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210113','沈北新区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210114','于洪区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210115','辽中区','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210123','康平县','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210124','法库县','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210181','新民市','210100','1',NULL,NULL,NULL,NULL,NULL,NULL),('210200','大连市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210202','中山区','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210203','西岗区','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210204','沙河口区','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210211','甘井子区','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210212','旅顺口区','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210213','金州区','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210214','普兰店区','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210224','长海县','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210281','瓦房店市','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210283','庄河市','210200','1',NULL,NULL,NULL,NULL,NULL,NULL),('210300','鞍山市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210302','铁东区','210300','1',NULL,NULL,NULL,NULL,NULL,NULL),('210303','铁西区','210300','1',NULL,NULL,NULL,NULL,NULL,NULL),('210304','立山区','210300','1',NULL,NULL,NULL,NULL,NULL,NULL),('210311','千山区','210300','1',NULL,NULL,NULL,NULL,NULL,NULL),('210321','台安县','210300','1',NULL,NULL,NULL,NULL,NULL,NULL),('210323','岫岩满族自治县','210300','1',NULL,NULL,NULL,NULL,NULL,NULL),('210381','海城市','210300','1',NULL,NULL,NULL,NULL,NULL,NULL),('210400','抚顺市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210402','新抚区','210400','1',NULL,NULL,NULL,NULL,NULL,NULL),('210403','东洲区','210400','1',NULL,NULL,NULL,NULL,NULL,NULL),('210404','望花区','210400','1',NULL,NULL,NULL,NULL,NULL,NULL),('210411','顺城区','210400','1',NULL,NULL,NULL,NULL,NULL,NULL),('210421','抚顺县','210400','1',NULL,NULL,NULL,NULL,NULL,NULL),('210422','新宾满族自治县','210400','1',NULL,NULL,NULL,NULL,NULL,NULL),('210423','清原满族自治县','210400','1',NULL,NULL,NULL,NULL,NULL,NULL),('210500','本溪市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210502','平山区','210500','1',NULL,NULL,NULL,NULL,NULL,NULL),('210503','溪湖区','210500','1',NULL,NULL,NULL,NULL,NULL,NULL),('210504','明山区','210500','1',NULL,NULL,NULL,NULL,NULL,NULL),('210505','南芬区','210500','1',NULL,NULL,NULL,NULL,NULL,NULL),('210521','本溪满族自治县','210500','1',NULL,NULL,NULL,NULL,NULL,NULL),('210522','桓仁满族自治县','210500','1',NULL,NULL,NULL,NULL,NULL,NULL),('210600','丹东市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210602','元宝区','210600','1',NULL,NULL,NULL,NULL,NULL,NULL),('210603','振兴区','210600','1',NULL,NULL,NULL,NULL,NULL,NULL),('210604','振安区','210600','1',NULL,NULL,NULL,NULL,NULL,NULL),('210624','宽甸满族自治县','210600','1',NULL,NULL,NULL,NULL,NULL,NULL),('210681','东港市','210600','1',NULL,NULL,NULL,NULL,NULL,NULL),('210682','凤城市','210600','1',NULL,NULL,NULL,NULL,NULL,NULL),('210700','锦州市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210702','古塔区','210700','1',NULL,NULL,NULL,NULL,NULL,NULL),('210703','凌河区','210700','1',NULL,NULL,NULL,NULL,NULL,NULL),('210711','太和区','210700','1',NULL,NULL,NULL,NULL,NULL,NULL),('210726','黑山县','210700','1',NULL,NULL,NULL,NULL,NULL,NULL),('210727','义县','210700','1',NULL,NULL,NULL,NULL,NULL,NULL),('210781','凌海市','210700','1',NULL,NULL,NULL,NULL,NULL,NULL),('210782','北镇市','210700','1',NULL,NULL,NULL,NULL,NULL,NULL),('210800','营口市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210802','站前区','210800','1',NULL,NULL,NULL,NULL,NULL,NULL),('210803','西市区','210800','1',NULL,NULL,NULL,NULL,NULL,NULL),('210804','鲅鱼圈区','210800','1',NULL,NULL,NULL,NULL,NULL,NULL),('210811','老边区','210800','1',NULL,NULL,NULL,NULL,NULL,NULL),('210881','盖州市','210800','1',NULL,NULL,NULL,NULL,NULL,NULL),('210882','大石桥市','210800','1',NULL,NULL,NULL,NULL,NULL,NULL),('210900','阜新市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('210902','海州区','210900','1',NULL,NULL,NULL,NULL,NULL,NULL),('210903','新邱区','210900','1',NULL,NULL,NULL,NULL,NULL,NULL),('210904','太平区','210900','1',NULL,NULL,NULL,NULL,NULL,NULL),('210905','清河门区','210900','1',NULL,NULL,NULL,NULL,NULL,NULL),('210911','细河区','210900','1',NULL,NULL,NULL,NULL,NULL,NULL),('210921','阜新蒙古族自治县','210900','1',NULL,NULL,NULL,NULL,NULL,NULL),('210922','彰武县','210900','1',NULL,NULL,NULL,NULL,NULL,NULL),('211000','辽阳市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211002','白塔区','211000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211003','文圣区','211000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211004','宏伟区','211000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211005','弓长岭区','211000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211011','太子河区','211000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211021','辽阳县','211000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211081','灯塔市','211000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211100','盘锦市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211102','双台子区','211100','1',NULL,NULL,NULL,NULL,NULL,NULL),('211103','兴隆台区','211100','1',NULL,NULL,NULL,NULL,NULL,NULL),('211104','大洼区','211100','1',NULL,NULL,NULL,NULL,NULL,NULL),('211122','盘山县','211100','1',NULL,NULL,NULL,NULL,NULL,NULL),('211200','铁岭市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211202','银州区','211200','1',NULL,NULL,NULL,NULL,NULL,NULL),('211204','清河区','211200','1',NULL,NULL,NULL,NULL,NULL,NULL),('211221','铁岭县','211200','1',NULL,NULL,NULL,NULL,NULL,NULL),('211223','西丰县','211200','1',NULL,NULL,NULL,NULL,NULL,NULL),('211224','昌图县','211200','1',NULL,NULL,NULL,NULL,NULL,NULL),('211281','调兵山市','211200','1',NULL,NULL,NULL,NULL,NULL,NULL),('211282','开原市','211200','1',NULL,NULL,NULL,NULL,NULL,NULL),('211300','朝阳市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211302','双塔区','211300','1',NULL,NULL,NULL,NULL,NULL,NULL),('211303','龙城区','211300','1',NULL,NULL,NULL,NULL,NULL,NULL),('211321','朝阳县','211300','1',NULL,NULL,NULL,NULL,NULL,NULL),('211322','建平县','211300','1',NULL,NULL,NULL,NULL,NULL,NULL),('211324','喀喇沁左翼蒙古族自治县','211300','1',NULL,NULL,NULL,NULL,NULL,NULL),('211381','北票市','211300','1',NULL,NULL,NULL,NULL,NULL,NULL),('211382','凌源市','211300','1',NULL,NULL,NULL,NULL,NULL,NULL),('211400','葫芦岛市','210000','1',NULL,NULL,NULL,NULL,NULL,NULL),('211402','连山区','211400','1',NULL,NULL,NULL,NULL,NULL,NULL),('211403','龙港区','211400','1',NULL,NULL,NULL,NULL,NULL,NULL),('211404','南票区','211400','1',NULL,NULL,NULL,NULL,NULL,NULL),('211421','绥中县','211400','1',NULL,NULL,NULL,NULL,NULL,NULL),('211422','建昌县','211400','1',NULL,NULL,NULL,NULL,NULL,NULL),('211481','兴城市','211400','1',NULL,NULL,NULL,NULL,NULL,NULL),('220000','吉林省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('220100','长春市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220102','南关区','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220103','宽城区','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220104','朝阳区','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220105','二道区','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220106','绿园区','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220112','双阳区','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220113','九台区','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220122','农安县','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220182','榆树市','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220183','德惠市','220100','1',NULL,NULL,NULL,NULL,NULL,NULL),('220200','吉林市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220202','昌邑区','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220203','龙潭区','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220204','船营区','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220211','丰满区','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220221','永吉县','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220281','蛟河市','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220282','桦甸市','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220283','舒兰市','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220284','磐石市','220200','1',NULL,NULL,NULL,NULL,NULL,NULL),('220300','四平市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220302','铁西区','220300','1',NULL,NULL,NULL,NULL,NULL,NULL),('220303','铁东区','220300','1',NULL,NULL,NULL,NULL,NULL,NULL),('220322','梨树县','220300','1',NULL,NULL,NULL,NULL,NULL,NULL),('220323','伊通满族自治县','220300','1',NULL,NULL,NULL,NULL,NULL,NULL),('220381','公主岭市','220300','1',NULL,NULL,NULL,NULL,NULL,NULL),('220382','双辽市','220300','1',NULL,NULL,NULL,NULL,NULL,NULL),('220400','辽源市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220402','龙山区','220400','1',NULL,NULL,NULL,NULL,NULL,NULL),('220403','西安区','220400','1',NULL,NULL,NULL,NULL,NULL,NULL),('220421','东丰县','220400','1',NULL,NULL,NULL,NULL,NULL,NULL),('220422','东辽县','220400','1',NULL,NULL,NULL,NULL,NULL,NULL),('220500','通化市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220502','东昌区','220500','1',NULL,NULL,NULL,NULL,NULL,NULL),('220503','二道江区','220500','1',NULL,NULL,NULL,NULL,NULL,NULL),('220521','通化县','220500','1',NULL,NULL,NULL,NULL,NULL,NULL),('220523','辉南县','220500','1',NULL,NULL,NULL,NULL,NULL,NULL),('220524','柳河县','220500','1',NULL,NULL,NULL,NULL,NULL,NULL),('220581','梅河口市','220500','1',NULL,NULL,NULL,NULL,NULL,NULL),('220582','集安市','220500','1',NULL,NULL,NULL,NULL,NULL,NULL),('220600','白山市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220602','浑江区','220600','1',NULL,NULL,NULL,NULL,NULL,NULL),('220605','江源区','220600','1',NULL,NULL,NULL,NULL,NULL,NULL),('220621','抚松县','220600','1',NULL,NULL,NULL,NULL,NULL,NULL),('220622','靖宇县','220600','1',NULL,NULL,NULL,NULL,NULL,NULL),('220623','长白朝鲜族自治县','220600','1',NULL,NULL,NULL,NULL,NULL,NULL),('220681','临江市','220600','1',NULL,NULL,NULL,NULL,NULL,NULL),('220700','松原市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220702','宁江区','220700','1',NULL,NULL,NULL,NULL,NULL,NULL),('220721','前郭尔罗斯蒙古族自治县','220700','1',NULL,NULL,NULL,NULL,NULL,NULL),('220722','长岭县','220700','1',NULL,NULL,NULL,NULL,NULL,NULL),('220723','乾安县','220700','1',NULL,NULL,NULL,NULL,NULL,NULL),('220781','扶余市','220700','1',NULL,NULL,NULL,NULL,NULL,NULL),('220800','白城市','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('220802','洮北区','220800','1',NULL,NULL,NULL,NULL,NULL,NULL),('220821','镇赉县','220800','1',NULL,NULL,NULL,NULL,NULL,NULL),('220822','通榆县','220800','1',NULL,NULL,NULL,NULL,NULL,NULL),('220881','洮南市','220800','1',NULL,NULL,NULL,NULL,NULL,NULL),('220882','大安市','220800','1',NULL,NULL,NULL,NULL,NULL,NULL),('222400','延边朝鲜族自治州','220000','1',NULL,NULL,NULL,NULL,NULL,NULL),('222401','延吉市','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('222402','图们市','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('222403','敦化市','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('222404','珲春市','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('222405','龙井市','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('222406','和龙市','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('222424','汪清县','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('222426','安图县','222400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230000','黑龙江省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('230100','哈尔滨市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230102','道里区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230103','南岗区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230104','道外区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230108','平房区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230109','松北区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230110','香坊区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230111','呼兰区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230112','阿城区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230113','双城区','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230123','依兰县','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230124','方正县','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230125','宾县','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230126','巴彦县','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230127','木兰县','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230128','通河县','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230129','延寿县','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230183','尚志市','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230184','五常市','230100','1',NULL,NULL,NULL,NULL,NULL,NULL),('230200','齐齐哈尔市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230202','龙沙区','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230203','建华区','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230204','铁锋区','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230205','昂昂溪区','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230206','富拉尔基区','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230207','碾子山区','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230208','梅里斯达斡尔族区','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230221','龙江县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230223','依安县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230224','泰来县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230225','甘南县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230227','富裕县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230229','克山县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230230','克东县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230231','拜泉县','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230281','讷河市','230200','1',NULL,NULL,NULL,NULL,NULL,NULL),('230300','鸡西市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230302','鸡冠区','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230303','恒山区','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230304','滴道区','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230305','梨树区','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230306','城子河区','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230307','麻山区','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230321','鸡东县','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230381','虎林市','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230382','密山市','230300','1',NULL,NULL,NULL,NULL,NULL,NULL),('230400','鹤岗市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230402','向阳区','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230403','工农区','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230404','南山区','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230405','兴安区','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230406','东山区','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230407','兴山区','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230421','萝北县','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230422','绥滨县','230400','1',NULL,NULL,NULL,NULL,NULL,NULL),('230500','双鸭山市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230502','尖山区','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230503','岭东区','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230505','四方台区','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230506','宝山区','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230521','集贤县','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230522','友谊县','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230523','宝清县','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230524','饶河县','230500','1',NULL,NULL,NULL,NULL,NULL,NULL),('230600','大庆市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230602','萨尔图区','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230603','龙凤区','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230604','让胡路区','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230605','红岗区','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230606','大同区','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230621','肇州县','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230622','肇源县','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230623','林甸县','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230624','杜尔伯特蒙古族自治县','230600','1',NULL,NULL,NULL,NULL,NULL,NULL),('230700','伊春市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230702','伊春区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230703','南岔区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230704','友好区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230705','西林区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230706','翠峦区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230707','新青区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230708','美溪区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230709','金山屯区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230710','五营区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230711','乌马河区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230712','汤旺河区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230713','带岭区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230714','乌伊岭区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230715','红星区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230716','上甘岭区','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230722','嘉荫县','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230781','铁力市','230700','1',NULL,NULL,NULL,NULL,NULL,NULL),('230800','佳木斯市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230803','向阳区','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230804','前进区','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230805','东风区','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230811','郊区','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230822','桦南县','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230826','桦川县','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230828','汤原县','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230881','同江市','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230882','富锦市','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230883','抚远市','230800','1',NULL,NULL,NULL,NULL,NULL,NULL),('230900','七台河市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('230902','新兴区','230900','1',NULL,NULL,NULL,NULL,NULL,NULL),('230903','桃山区','230900','1',NULL,NULL,NULL,NULL,NULL,NULL),('230904','茄子河区','230900','1',NULL,NULL,NULL,NULL,NULL,NULL),('230921','勃利县','230900','1',NULL,NULL,NULL,NULL,NULL,NULL),('231000','牡丹江市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231002','东安区','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231003','阳明区','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231004','爱民区','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231005','西安区','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231025','林口县','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231081','绥芬河市','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231083','海林市','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231084','宁安市','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231085','穆棱市','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231086','东宁市','231000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231100','黑河市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231102','爱辉区','231100','1',NULL,NULL,NULL,NULL,NULL,NULL),('231121','嫩江县','231100','1',NULL,NULL,NULL,NULL,NULL,NULL),('231123','逊克县','231100','1',NULL,NULL,NULL,NULL,NULL,NULL),('231124','孙吴县','231100','1',NULL,NULL,NULL,NULL,NULL,NULL),('231181','北安市','231100','1',NULL,NULL,NULL,NULL,NULL,NULL),('231182','五大连池市','231100','1',NULL,NULL,NULL,NULL,NULL,NULL),('231200','绥化市','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('231202','北林区','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231221','望奎县','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231222','兰西县','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231223','青冈县','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231224','庆安县','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231225','明水县','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231226','绥棱县','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231281','安达市','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231282','肇东市','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('231283','海伦市','231200','1',NULL,NULL,NULL,NULL,NULL,NULL),('232700','大兴安岭地区','230000','1',NULL,NULL,NULL,NULL,NULL,NULL),('232721','呼玛县','232700','1',NULL,NULL,NULL,NULL,NULL,NULL),('232722','塔河县','232700','1',NULL,NULL,NULL,NULL,NULL,NULL),('232723','漠河县','232700','1',NULL,NULL,NULL,NULL,NULL,NULL),('310000','上海市',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('310100','上海市','310000','1',NULL,NULL,NULL,NULL,NULL,NULL),('310101','黄浦区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310104','徐汇区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310105','长宁区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310106','静安区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310107','普陀区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310109','虹口区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310110','杨浦区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310112','闵行区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310113','宝山区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310114','嘉定区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310115','浦东新区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310116','金山区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310117','松江区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310118','青浦区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310120','奉贤区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('310151','崇明区','310100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320000','江苏省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('320100','南京市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320102','玄武区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320104','秦淮区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320105','建邺区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320106','鼓楼区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320111','浦口区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320113','栖霞区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320114','雨花台区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320115','江宁区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320116','六合区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320117','溧水区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320118','高淳区','320100','1',NULL,NULL,NULL,NULL,NULL,NULL),('320200','无锡市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320205','锡山区','320200','1',NULL,NULL,NULL,NULL,NULL,NULL),('320206','惠山区','320200','1',NULL,NULL,NULL,NULL,NULL,NULL),('320211','滨湖区','320200','1',NULL,NULL,NULL,NULL,NULL,NULL),('320213','梁溪区','320200','1',NULL,NULL,NULL,NULL,NULL,NULL),('320214','新吴区','320200','1',NULL,NULL,NULL,NULL,NULL,NULL),('320281','江阴市','320200','1',NULL,NULL,NULL,NULL,NULL,NULL),('320282','宜兴市','320200','1',NULL,NULL,NULL,NULL,NULL,NULL),('320300','徐州市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320302','鼓楼区','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320303','云龙区','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320305','贾汪区','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320311','泉山区','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320312','铜山区','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320321','丰县','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320322','沛县','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320324','睢宁县','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320381','新沂市','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320382','邳州市','320300','1',NULL,NULL,NULL,NULL,NULL,NULL),('320400','常州市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320402','天宁区','320400','1',NULL,NULL,NULL,NULL,NULL,NULL),('320404','钟楼区','320400','1',NULL,NULL,NULL,NULL,NULL,NULL),('320411','新北区','320400','1',NULL,NULL,NULL,NULL,NULL,NULL),('320412','武进区','320400','1',NULL,NULL,NULL,NULL,NULL,NULL),('320413','金坛区','320400','1',NULL,NULL,NULL,NULL,NULL,NULL),('320481','溧阳市','320400','1',NULL,NULL,NULL,NULL,NULL,NULL),('320500','苏州市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320505','虎丘区','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320506','吴中区','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320507','相城区','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320508','姑苏区','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320509','吴江区','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320581','常熟市','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320582','张家港市','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320583','昆山市','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320585','太仓市','320500','1',NULL,NULL,NULL,NULL,NULL,NULL),('320600','南通市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320602','崇川区','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320611','港闸区','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320612','通州区','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320621','海安县','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320623','如东县','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320681','启东市','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320682','如皋市','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320684','海门市','320600','1',NULL,NULL,NULL,NULL,NULL,NULL),('320700','连云港市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320703','连云区','320700','1',NULL,NULL,NULL,NULL,NULL,NULL),('320706','海州区','320700','1',NULL,NULL,NULL,NULL,NULL,NULL),('320707','赣榆区','320700','1',NULL,NULL,NULL,NULL,NULL,NULL),('320722','东海县','320700','1',NULL,NULL,NULL,NULL,NULL,NULL),('320723','灌云县','320700','1',NULL,NULL,NULL,NULL,NULL,NULL),('320724','灌南县','320700','1',NULL,NULL,NULL,NULL,NULL,NULL),('320800','淮安市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320803','淮安区','320800','1',NULL,NULL,NULL,NULL,NULL,NULL),('320804','淮阴区','320800','1',NULL,NULL,NULL,NULL,NULL,NULL),('320812','清江浦区','320800','1',NULL,NULL,NULL,NULL,NULL,NULL),('320813','洪泽区','320800','1',NULL,NULL,NULL,NULL,NULL,NULL),('320826','涟水县','320800','1',NULL,NULL,NULL,NULL,NULL,NULL),('320830','盱眙县','320800','1',NULL,NULL,NULL,NULL,NULL,NULL),('320831','金湖县','320800','1',NULL,NULL,NULL,NULL,NULL,NULL),('320900','盐城市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('320902','亭湖区','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320903','盐都区','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320904','大丰区','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320921','响水县','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320922','滨海县','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320923','阜宁县','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320924','射阳县','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320925','建湖县','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('320981','东台市','320900','1',NULL,NULL,NULL,NULL,NULL,NULL),('321000','扬州市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321002','广陵区','321000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321003','邗江区','321000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321012','江都区','321000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321023','宝应县','321000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321081','仪征市','321000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321084','高邮市','321000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321100','镇江市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321102','京口区','321100','1',NULL,NULL,NULL,NULL,NULL,NULL),('321111','润州区','321100','1',NULL,NULL,NULL,NULL,NULL,NULL),('321112','丹徒区','321100','1',NULL,NULL,NULL,NULL,NULL,NULL),('321181','丹阳市','321100','1',NULL,NULL,NULL,NULL,NULL,NULL),('321182','扬中市','321100','1',NULL,NULL,NULL,NULL,NULL,NULL),('321183','句容市','321100','1',NULL,NULL,NULL,NULL,NULL,NULL),('321200','泰州市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321202','海陵区','321200','1',NULL,NULL,NULL,NULL,NULL,NULL),('321203','高港区','321200','1',NULL,NULL,NULL,NULL,NULL,NULL),('321204','姜堰区','321200','1',NULL,NULL,NULL,NULL,NULL,NULL),('321281','兴化市','321200','1',NULL,NULL,NULL,NULL,NULL,NULL),('321282','靖江市','321200','1',NULL,NULL,NULL,NULL,NULL,NULL),('321283','泰兴市','321200','1',NULL,NULL,NULL,NULL,NULL,NULL),('321300','宿迁市','320000','1',NULL,NULL,NULL,NULL,NULL,NULL),('321302','宿城区','321300','1',NULL,NULL,NULL,NULL,NULL,NULL),('321311','宿豫区','321300','1',NULL,NULL,NULL,NULL,NULL,NULL),('321322','沭阳县','321300','1',NULL,NULL,NULL,NULL,NULL,NULL),('321323','泗阳县','321300','1',NULL,NULL,NULL,NULL,NULL,NULL),('321324','泗洪县','321300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330000','浙江省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('330100','杭州市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330102','上城区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330103','下城区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330104','江干区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330105','拱墅区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330106','西湖区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330108','滨江区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330109','萧山区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330110','余杭区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330111','富阳区','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330122','桐庐县','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330127','淳安县','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330182','建德市','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330185','临安市','330100','1',NULL,NULL,NULL,NULL,NULL,NULL),('330200','宁波市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330203','海曙区','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330204','江东区','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330205','江北区','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330206','北仑区','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330211','镇海区','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330212','鄞州区','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330225','象山县','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330226','宁海县','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330281','余姚市','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330282','慈溪市','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330283','奉化市','330200','1',NULL,NULL,NULL,NULL,NULL,NULL),('330300','温州市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330302','鹿城区','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330303','龙湾区','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330304','瓯海区','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330305','洞头区','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330324','永嘉县','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330326','平阳县','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330327','苍南县','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330328','文成县','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330329','泰顺县','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330381','瑞安市','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330382','乐清市','330300','1',NULL,NULL,NULL,NULL,NULL,NULL),('330400','嘉兴市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330402','南湖区','330400','1',NULL,NULL,NULL,NULL,NULL,NULL),('330411','秀洲区','330400','1',NULL,NULL,NULL,NULL,NULL,NULL),('330421','嘉善县','330400','1',NULL,NULL,NULL,NULL,NULL,NULL),('330424','海盐县','330400','1',NULL,NULL,NULL,NULL,NULL,NULL),('330481','海宁市','330400','1',NULL,NULL,NULL,NULL,NULL,NULL),('330482','平湖市','330400','1',NULL,NULL,NULL,NULL,NULL,NULL),('330483','桐乡市','330400','1',NULL,NULL,NULL,NULL,NULL,NULL),('330500','湖州市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330502','吴兴区','330500','1',NULL,NULL,NULL,NULL,NULL,NULL),('330503','南浔区','330500','1',NULL,NULL,NULL,NULL,NULL,NULL),('330521','德清县','330500','1',NULL,NULL,NULL,NULL,NULL,NULL),('330522','长兴县','330500','1',NULL,NULL,NULL,NULL,NULL,NULL),('330523','安吉县','330500','1',NULL,NULL,NULL,NULL,NULL,NULL),('330600','绍兴市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330602','越城区','330600','1',NULL,NULL,NULL,NULL,NULL,NULL),('330603','柯桥区','330600','1',NULL,NULL,NULL,NULL,NULL,NULL),('330604','上虞区','330600','1',NULL,NULL,NULL,NULL,NULL,NULL),('330624','新昌县','330600','1',NULL,NULL,NULL,NULL,NULL,NULL),('330681','诸暨市','330600','1',NULL,NULL,NULL,NULL,NULL,NULL),('330683','嵊州市','330600','1',NULL,NULL,NULL,NULL,NULL,NULL),('330700','金华市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330702','婺城区','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330703','金东区','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330723','武义县','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330726','浦江县','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330727','磐安县','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330781','兰溪市','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330782','义乌市','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330783','东阳市','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330784','永康市','330700','1',NULL,NULL,NULL,NULL,NULL,NULL),('330800','衢州市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330802','柯城区','330800','1',NULL,NULL,NULL,NULL,NULL,NULL),('330803','衢江区','330800','1',NULL,NULL,NULL,NULL,NULL,NULL),('330822','常山县','330800','1',NULL,NULL,NULL,NULL,NULL,NULL),('330824','开化县','330800','1',NULL,NULL,NULL,NULL,NULL,NULL),('330825','龙游县','330800','1',NULL,NULL,NULL,NULL,NULL,NULL),('330881','江山市','330800','1',NULL,NULL,NULL,NULL,NULL,NULL),('330900','舟山市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('330902','定海区','330900','1',NULL,NULL,NULL,NULL,NULL,NULL),('330903','普陀区','330900','1',NULL,NULL,NULL,NULL,NULL,NULL),('330921','岱山县','330900','1',NULL,NULL,NULL,NULL,NULL,NULL),('330922','嵊泗县','330900','1',NULL,NULL,NULL,NULL,NULL,NULL),('331000','台州市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331002','椒江区','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331003','黄岩区','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331004','路桥区','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331021','玉环县','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331022','三门县','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331023','天台县','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331024','仙居县','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331081','温岭市','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331082','临海市','331000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331100','丽水市','330000','1',NULL,NULL,NULL,NULL,NULL,NULL),('331102','莲都区','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331121','青田县','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331122','缙云县','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331123','遂昌县','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331124','松阳县','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331125','云和县','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331126','庆元县','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331127','景宁畲族自治县','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('331181','龙泉市','331100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340000','安徽省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('340100','合肥市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340102','瑶海区','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340103','庐阳区','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340104','蜀山区','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340111','包河区','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340121','长丰县','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340122','肥东县','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340123','肥西县','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340124','庐江县','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340181','巢湖市','340100','1',NULL,NULL,NULL,NULL,NULL,NULL),('340200','芜湖市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340202','镜湖区','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340203','弋江区','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340207','鸠江区','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340208','三山区','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340221','芜湖县','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340222','繁昌县','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340223','南陵县','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340225','无为县','340200','1',NULL,NULL,NULL,NULL,NULL,NULL),('340300','蚌埠市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340302','龙子湖区','340300','1',NULL,NULL,NULL,NULL,NULL,NULL),('340303','蚌山区','340300','1',NULL,NULL,NULL,NULL,NULL,NULL),('340304','禹会区','340300','1',NULL,NULL,NULL,NULL,NULL,NULL),('340311','淮上区','340300','1',NULL,NULL,NULL,NULL,NULL,NULL),('340321','怀远县','340300','1',NULL,NULL,NULL,NULL,NULL,NULL),('340322','五河县','340300','1',NULL,NULL,NULL,NULL,NULL,NULL),('340323','固镇县','340300','1',NULL,NULL,NULL,NULL,NULL,NULL),('340400','淮南市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340402','大通区','340400','1',NULL,NULL,NULL,NULL,NULL,NULL),('340403','田家庵区','340400','1',NULL,NULL,NULL,NULL,NULL,NULL),('340404','谢家集区','340400','1',NULL,NULL,NULL,NULL,NULL,NULL),('340405','八公山区','340400','1',NULL,NULL,NULL,NULL,NULL,NULL),('340406','潘集区','340400','1',NULL,NULL,NULL,NULL,NULL,NULL),('340421','凤台县','340400','1',NULL,NULL,NULL,NULL,NULL,NULL),('340422','寿县','340400','1',NULL,NULL,NULL,NULL,NULL,NULL),('340500','马鞍山市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340503','花山区','340500','1',NULL,NULL,NULL,NULL,NULL,NULL),('340504','雨山区','340500','1',NULL,NULL,NULL,NULL,NULL,NULL),('340506','博望区','340500','1',NULL,NULL,NULL,NULL,NULL,NULL),('340521','当涂县','340500','1',NULL,NULL,NULL,NULL,NULL,NULL),('340522','含山县','340500','1',NULL,NULL,NULL,NULL,NULL,NULL),('340523','和县','340500','1',NULL,NULL,NULL,NULL,NULL,NULL),('340600','淮北市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340602','杜集区','340600','1',NULL,NULL,NULL,NULL,NULL,NULL),('340603','相山区','340600','1',NULL,NULL,NULL,NULL,NULL,NULL),('340604','烈山区','340600','1',NULL,NULL,NULL,NULL,NULL,NULL),('340621','濉溪县','340600','1',NULL,NULL,NULL,NULL,NULL,NULL),('340700','铜陵市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340705','铜官区','340700','1',NULL,NULL,NULL,NULL,NULL,NULL),('340706','义安区','340700','1',NULL,NULL,NULL,NULL,NULL,NULL),('340711','郊区','340700','1',NULL,NULL,NULL,NULL,NULL,NULL),('340722','枞阳县','340700','1',NULL,NULL,NULL,NULL,NULL,NULL),('340800','安庆市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('340802','迎江区','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340803','大观区','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340811','宜秀区','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340822','怀宁县','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340824','潜山县','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340825','太湖县','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340826','宿松县','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340827','望江县','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340828','岳西县','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('340881','桐城市','340800','1',NULL,NULL,NULL,NULL,NULL,NULL),('341000','黄山市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341002','屯溪区','341000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341003','黄山区','341000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341004','徽州区','341000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341021','歙县','341000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341022','休宁县','341000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341023','黟县','341000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341024','祁门县','341000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341100','滁州市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341102','琅琊区','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341103','南谯区','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341122','来安县','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341124','全椒县','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341125','定远县','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341126','凤阳县','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341181','天长市','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341182','明光市','341100','1',NULL,NULL,NULL,NULL,NULL,NULL),('341200','阜阳市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341202','颍州区','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341203','颍东区','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341204','颍泉区','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341221','临泉县','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341222','太和县','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341225','阜南县','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341226','颍上县','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341282','界首市','341200','1',NULL,NULL,NULL,NULL,NULL,NULL),('341300','宿州市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341302','埇桥区','341300','1',NULL,NULL,NULL,NULL,NULL,NULL),('341321','砀山县','341300','1',NULL,NULL,NULL,NULL,NULL,NULL),('341322','萧县','341300','1',NULL,NULL,NULL,NULL,NULL,NULL),('341323','灵璧县','341300','1',NULL,NULL,NULL,NULL,NULL,NULL),('341324','泗县','341300','1',NULL,NULL,NULL,NULL,NULL,NULL),('341500','六安市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341502','金安区','341500','1',NULL,NULL,NULL,NULL,NULL,NULL),('341503','裕安区','341500','1',NULL,NULL,NULL,NULL,NULL,NULL),('341504','叶集区','341500','1',NULL,NULL,NULL,NULL,NULL,NULL),('341522','霍邱县','341500','1',NULL,NULL,NULL,NULL,NULL,NULL),('341523','舒城县','341500','1',NULL,NULL,NULL,NULL,NULL,NULL),('341524','金寨县','341500','1',NULL,NULL,NULL,NULL,NULL,NULL),('341525','霍山县','341500','1',NULL,NULL,NULL,NULL,NULL,NULL),('341600','亳州市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341602','谯城区','341600','1',NULL,NULL,NULL,NULL,NULL,NULL),('341621','涡阳县','341600','1',NULL,NULL,NULL,NULL,NULL,NULL),('341622','蒙城县','341600','1',NULL,NULL,NULL,NULL,NULL,NULL),('341623','利辛县','341600','1',NULL,NULL,NULL,NULL,NULL,NULL),('341700','池州市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341702','贵池区','341700','1',NULL,NULL,NULL,NULL,NULL,NULL),('341721','东至县','341700','1',NULL,NULL,NULL,NULL,NULL,NULL),('341722','石台县','341700','1',NULL,NULL,NULL,NULL,NULL,NULL),('341723','青阳县','341700','1',NULL,NULL,NULL,NULL,NULL,NULL),('341800','宣城市','340000','1',NULL,NULL,NULL,NULL,NULL,NULL),('341802','宣州区','341800','1',NULL,NULL,NULL,NULL,NULL,NULL),('341821','郎溪县','341800','1',NULL,NULL,NULL,NULL,NULL,NULL),('341822','广德县','341800','1',NULL,NULL,NULL,NULL,NULL,NULL),('341823','泾县','341800','1',NULL,NULL,NULL,NULL,NULL,NULL),('341824','绩溪县','341800','1',NULL,NULL,NULL,NULL,NULL,NULL),('341825','旌德县','341800','1',NULL,NULL,NULL,NULL,NULL,NULL),('341881','宁国市','341800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350000','福建省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('350100','福州市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350102','鼓楼区','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350103','台江区','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350104','仓山区','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350105','马尾区','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350111','晋安区','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350121','闽侯县','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350122','连江县','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350123','罗源县','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350124','闽清县','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350125','永泰县','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350128','平潭县','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350181','福清市','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350182','长乐市','350100','1',NULL,NULL,NULL,NULL,NULL,NULL),('350200','厦门市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350203','思明区','350200','1',NULL,NULL,NULL,NULL,NULL,NULL),('350205','海沧区','350200','1',NULL,NULL,NULL,NULL,NULL,NULL),('350206','湖里区','350200','1',NULL,NULL,NULL,NULL,NULL,NULL),('350211','集美区','350200','1',NULL,NULL,NULL,NULL,NULL,NULL),('350212','同安区','350200','1',NULL,NULL,NULL,NULL,NULL,NULL),('350213','翔安区','350200','1',NULL,NULL,NULL,NULL,NULL,NULL),('350300','莆田市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350302','城厢区','350300','1',NULL,NULL,NULL,NULL,NULL,NULL),('350303','涵江区','350300','1',NULL,NULL,NULL,NULL,NULL,NULL),('350304','荔城区','350300','1',NULL,NULL,NULL,NULL,NULL,NULL),('350305','秀屿区','350300','1',NULL,NULL,NULL,NULL,NULL,NULL),('350322','仙游县','350300','1',NULL,NULL,NULL,NULL,NULL,NULL),('350400','三明市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350402','梅列区','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350403','三元区','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350421','明溪县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350423','清流县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350424','宁化县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350425','大田县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350426','尤溪县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350427','沙县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350428','将乐县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350429','泰宁县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350430','建宁县','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350481','永安市','350400','1',NULL,NULL,NULL,NULL,NULL,NULL),('350500','泉州市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350502','鲤城区','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350503','丰泽区','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350504','洛江区','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350505','泉港区','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350521','惠安县','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350524','安溪县','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350525','永春县','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350526','德化县','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350527','金门县','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350581','石狮市','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350582','晋江市','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350583','南安市','350500','1',NULL,NULL,NULL,NULL,NULL,NULL),('350600','漳州市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350602','芗城区','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350603','龙文区','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350622','云霄县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350623','漳浦县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350624','诏安县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350625','长泰县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350626','东山县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350627','南靖县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350628','平和县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350629','华安县','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350681','龙海市','350600','1',NULL,NULL,NULL,NULL,NULL,NULL),('350700','南平市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350702','延平区','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350703','建阳区','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350721','顺昌县','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350722','浦城县','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350723','光泽县','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350724','松溪县','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350725','政和县','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350781','邵武市','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350782','武夷山市','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350783','建瓯市','350700','1',NULL,NULL,NULL,NULL,NULL,NULL),('350800','龙岩市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350802','新罗区','350800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350803','永定区','350800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350821','长汀县','350800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350823','上杭县','350800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350824','武平县','350800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350825','连城县','350800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350881','漳平市','350800','1',NULL,NULL,NULL,NULL,NULL,NULL),('350900','宁德市','350000','1',NULL,NULL,NULL,NULL,NULL,NULL),('350902','蕉城区','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350921','霞浦县','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350922','古田县','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350923','屏南县','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350924','寿宁县','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350925','周宁县','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350926','柘荣县','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350981','福安市','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('350982','福鼎市','350900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360000','江西省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('360100','南昌市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360102','东湖区','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360103','西湖区','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360104','青云谱区','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360105','湾里区','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360111','青山湖区','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360112','新建区','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360121','南昌县','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360123','安义县','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360124','进贤县','360100','1',NULL,NULL,NULL,NULL,NULL,NULL),('360200','景德镇市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360202','昌江区','360200','1',NULL,NULL,NULL,NULL,NULL,NULL),('360203','珠山区','360200','1',NULL,NULL,NULL,NULL,NULL,NULL),('360222','浮梁县','360200','1',NULL,NULL,NULL,NULL,NULL,NULL),('360281','乐平市','360200','1',NULL,NULL,NULL,NULL,NULL,NULL),('360300','萍乡市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360302','安源区','360300','1',NULL,NULL,NULL,NULL,NULL,NULL),('360313','湘东区','360300','1',NULL,NULL,NULL,NULL,NULL,NULL),('360321','莲花县','360300','1',NULL,NULL,NULL,NULL,NULL,NULL),('360322','上栗县','360300','1',NULL,NULL,NULL,NULL,NULL,NULL),('360323','芦溪县','360300','1',NULL,NULL,NULL,NULL,NULL,NULL),('360400','九江市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360402','濂溪区','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360403','浔阳区','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360421','九江县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360423','武宁县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360424','修水县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360425','永修县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360426','德安县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360428','都昌县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360429','湖口县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360430','彭泽县','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360481','瑞昌市','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360482','共青城市','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360483','庐山市','360400','1',NULL,NULL,NULL,NULL,NULL,NULL),('360500','新余市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360502','渝水区','360500','1',NULL,NULL,NULL,NULL,NULL,NULL),('360521','分宜县','360500','1',NULL,NULL,NULL,NULL,NULL,NULL),('360600','鹰潭市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360602','月湖区','360600','1',NULL,NULL,NULL,NULL,NULL,NULL),('360622','余江县','360600','1',NULL,NULL,NULL,NULL,NULL,NULL),('360681','贵溪市','360600','1',NULL,NULL,NULL,NULL,NULL,NULL),('360700','赣州市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360702','章贡区','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360703','南康区','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360721','赣县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360722','信丰县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360723','大余县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360724','上犹县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360725','崇义县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360726','安远县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360727','龙南县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360728','定南县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360729','全南县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360730','宁都县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360731','于都县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360732','兴国县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360733','会昌县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360734','寻乌县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360735','石城县','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360781','瑞金市','360700','1',NULL,NULL,NULL,NULL,NULL,NULL),('360800','吉安市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360802','吉州区','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360803','青原区','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360821','吉安县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360822','吉水县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360823','峡江县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360824','新干县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360825','永丰县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360826','泰和县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360827','遂川县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360828','万安县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360829','安福县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360830','永新县','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360881','井冈山市','360800','1',NULL,NULL,NULL,NULL,NULL,NULL),('360900','宜春市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('360902','袁州区','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360921','奉新县','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360922','万载县','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360923','上高县','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360924','宜丰县','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360925','靖安县','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360926','铜鼓县','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360981','丰城市','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360982','樟树市','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('360983','高安市','360900','1',NULL,NULL,NULL,NULL,NULL,NULL),('361000','抚州市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361002','临川区','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361021','南城县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361022','黎川县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361023','南丰县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361024','崇仁县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361025','乐安县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361026','宜黄县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361027','金溪县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361028','资溪县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361029','东乡县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361030','广昌县','361000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361100','上饶市','360000','1',NULL,NULL,NULL,NULL,NULL,NULL),('361102','信州区','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361103','广丰区','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361121','上饶县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361123','玉山县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361124','铅山县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361125','横峰县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361126','弋阳县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361127','余干县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361128','鄱阳县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361129','万年县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361130','婺源县','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('361181','德兴市','361100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370000','山东省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('370100','济南市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370102','历下区','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370103','市中区','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370104','槐荫区','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370105','天桥区','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370112','历城区','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370113','长清区','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370124','平阴县','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370125','济阳县','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370126','商河县','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370181','章丘市','370100','1',NULL,NULL,NULL,NULL,NULL,NULL),('370200','青岛市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370202','市南区','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370203','市北区','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370211','黄岛区','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370212','崂山区','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370213','李沧区','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370214','城阳区','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370281','胶州市','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370282','即墨市','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370283','平度市','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370285','莱西市','370200','1',NULL,NULL,NULL,NULL,NULL,NULL),('370300','淄博市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370302','淄川区','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370303','张店区','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370304','博山区','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370305','临淄区','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370306','周村区','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370321','桓台县','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370322','高青县','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370323','沂源县','370300','1',NULL,NULL,NULL,NULL,NULL,NULL),('370400','枣庄市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370402','市中区','370400','1',NULL,NULL,NULL,NULL,NULL,NULL),('370403','薛城区','370400','1',NULL,NULL,NULL,NULL,NULL,NULL),('370404','峄城区','370400','1',NULL,NULL,NULL,NULL,NULL,NULL),('370405','台儿庄区','370400','1',NULL,NULL,NULL,NULL,NULL,NULL),('370406','山亭区','370400','1',NULL,NULL,NULL,NULL,NULL,NULL),('370481','滕州市','370400','1',NULL,NULL,NULL,NULL,NULL,NULL),('370500','东营市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370502','东营区','370500','1',NULL,NULL,NULL,NULL,NULL,NULL),('370503','河口区','370500','1',NULL,NULL,NULL,NULL,NULL,NULL),('370505','垦利区','370500','1',NULL,NULL,NULL,NULL,NULL,NULL),('370522','利津县','370500','1',NULL,NULL,NULL,NULL,NULL,NULL),('370523','广饶县','370500','1',NULL,NULL,NULL,NULL,NULL,NULL),('370600','烟台市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370602','芝罘区','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370611','福山区','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370612','牟平区','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370613','莱山区','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370634','长岛县','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370681','龙口市','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370682','莱阳市','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370683','莱州市','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370684','蓬莱市','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370685','招远市','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370686','栖霞市','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370687','海阳市','370600','1',NULL,NULL,NULL,NULL,NULL,NULL),('370700','潍坊市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370702','潍城区','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370703','寒亭区','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370704','坊子区','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370705','奎文区','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370724','临朐县','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370725','昌乐县','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370781','青州市','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370782','诸城市','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370783','寿光市','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370784','安丘市','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370785','高密市','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370786','昌邑市','370700','1',NULL,NULL,NULL,NULL,NULL,NULL),('370800','济宁市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370811','任城区','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370812','兖州区','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370826','微山县','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370827','鱼台县','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370828','金乡县','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370829','嘉祥县','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370830','汶上县','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370831','泗水县','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370832','梁山县','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370881','曲阜市','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370883','邹城市','370800','1',NULL,NULL,NULL,NULL,NULL,NULL),('370900','泰安市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('370902','泰山区','370900','1',NULL,NULL,NULL,NULL,NULL,NULL),('370911','岱岳区','370900','1',NULL,NULL,NULL,NULL,NULL,NULL),('370921','宁阳县','370900','1',NULL,NULL,NULL,NULL,NULL,NULL),('370923','东平县','370900','1',NULL,NULL,NULL,NULL,NULL,NULL),('370982','新泰市','370900','1',NULL,NULL,NULL,NULL,NULL,NULL),('370983','肥城市','370900','1',NULL,NULL,NULL,NULL,NULL,NULL),('371000','威海市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371002','环翠区','371000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371003','文登区','371000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371082','荣成市','371000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371083','乳山市','371000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371100','日照市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371102','东港区','371100','1',NULL,NULL,NULL,NULL,NULL,NULL),('371103','岚山区','371100','1',NULL,NULL,NULL,NULL,NULL,NULL),('371121','五莲县','371100','1',NULL,NULL,NULL,NULL,NULL,NULL),('371122','莒县','371100','1',NULL,NULL,NULL,NULL,NULL,NULL),('371200','莱芜市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371202','莱城区','371200','1',NULL,NULL,NULL,NULL,NULL,NULL),('371203','钢城区','371200','1',NULL,NULL,NULL,NULL,NULL,NULL),('371300','临沂市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371302','兰山区','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371311','罗庄区','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371312','河东区','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371321','沂南县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371322','郯城县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371323','沂水县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371324','兰陵县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371325','费县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371326','平邑县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371327','莒南县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371328','蒙阴县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371329','临沭县','371300','1',NULL,NULL,NULL,NULL,NULL,NULL),('371400','德州市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371402','德城区','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371403','陵城区','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371422','宁津县','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371423','庆云县','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371424','临邑县','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371425','齐河县','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371426','平原县','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371427','夏津县','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371428','武城县','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371481','乐陵市','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371482','禹城市','371400','1',NULL,NULL,NULL,NULL,NULL,NULL),('371500','聊城市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371502','东昌府区','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371521','阳谷县','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371522','莘县','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371523','茌平县','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371524','东阿县','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371525','冠县','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371526','高唐县','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371581','临清市','371500','1',NULL,NULL,NULL,NULL,NULL,NULL),('371600','滨州市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371602','滨城区','371600','1',NULL,NULL,NULL,NULL,NULL,NULL),('371603','沾化区','371600','1',NULL,NULL,NULL,NULL,NULL,NULL),('371621','惠民县','371600','1',NULL,NULL,NULL,NULL,NULL,NULL),('371622','阳信县','371600','1',NULL,NULL,NULL,NULL,NULL,NULL),('371623','无棣县','371600','1',NULL,NULL,NULL,NULL,NULL,NULL),('371625','博兴县','371600','1',NULL,NULL,NULL,NULL,NULL,NULL),('371626','邹平县','371600','1',NULL,NULL,NULL,NULL,NULL,NULL),('371700','菏泽市','370000','1',NULL,NULL,NULL,NULL,NULL,NULL),('371702','牡丹区','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371703','定陶区','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371721','曹县','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371722','单县','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371723','成武县','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371724','巨野县','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371725','郓城县','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371726','鄄城县','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('371728','东明县','371700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410000','河南省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('410100','郑州市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410102','中原区','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410103','二七区','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410104','管城回族区','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410105','金水区','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410106','上街区','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410108','惠济区','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410122','中牟县','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410181','巩义市','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410182','荥阳市','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410183','新密市','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410184','新郑市','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410185','登封市','410100','1',NULL,NULL,NULL,NULL,NULL,NULL),('410200','开封市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410202','龙亭区','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410203','顺河回族区','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410204','鼓楼区','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410205','禹王台区','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410211','金明区','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410212','祥符区','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410221','杞县','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410222','通许县','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410223','尉氏县','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410225','兰考县','410200','1',NULL,NULL,NULL,NULL,NULL,NULL),('410300','洛阳市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410302','老城区','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410303','西工区','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410304','瀍河回族区','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410305','涧西区','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410306','吉利区','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410311','洛龙区','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410322','孟津县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410323','新安县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410324','栾川县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410325','嵩县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410326','汝阳县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410327','宜阳县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410328','洛宁县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410329','伊川县','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410381','偃师市','410300','1',NULL,NULL,NULL,NULL,NULL,NULL),('410400','平顶山市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410402','新华区','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410403','卫东区','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410404','石龙区','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410411','湛河区','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410421','宝丰县','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410422','叶县','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410423','鲁山县','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410425','郏县','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410481','舞钢市','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410482','汝州市','410400','1',NULL,NULL,NULL,NULL,NULL,NULL),('410500','安阳市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410502','文峰区','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410503','北关区','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410505','殷都区','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410506','龙安区','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410522','安阳县','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410523','汤阴县','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410526','滑县','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410527','内黄县','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410581','林州市','410500','1',NULL,NULL,NULL,NULL,NULL,NULL),('410600','鹤壁市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410602','鹤山区','410600','1',NULL,NULL,NULL,NULL,NULL,NULL),('410603','山城区','410600','1',NULL,NULL,NULL,NULL,NULL,NULL),('410611','淇滨区','410600','1',NULL,NULL,NULL,NULL,NULL,NULL),('410621','浚县','410600','1',NULL,NULL,NULL,NULL,NULL,NULL),('410622','淇县','410600','1',NULL,NULL,NULL,NULL,NULL,NULL),('410700','新乡市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410702','红旗区','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410703','卫滨区','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410704','凤泉区','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410711','牧野区','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410721','新乡县','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410724','获嘉县','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410725','原阳县','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410726','延津县','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410727','封丘县','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410728','长垣县','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410781','卫辉市','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410782','辉县市','410700','1',NULL,NULL,NULL,NULL,NULL,NULL),('410800','焦作市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410802','解放区','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410803','中站区','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410804','马村区','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410811','山阳区','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410821','修武县','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410822','博爱县','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410823','武陟县','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410825','温县','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410882','沁阳市','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410883','孟州市','410800','1',NULL,NULL,NULL,NULL,NULL,NULL),('410900','濮阳市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('410902','华龙区','410900','1',NULL,NULL,NULL,NULL,NULL,NULL),('410922','清丰县','410900','1',NULL,NULL,NULL,NULL,NULL,NULL),('410923','南乐县','410900','1',NULL,NULL,NULL,NULL,NULL,NULL),('410926','范县','410900','1',NULL,NULL,NULL,NULL,NULL,NULL),('410927','台前县','410900','1',NULL,NULL,NULL,NULL,NULL,NULL),('410928','濮阳县','410900','1',NULL,NULL,NULL,NULL,NULL,NULL),('411000','许昌市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411002','魏都区','411000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411023','许昌县','411000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411024','鄢陵县','411000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411025','襄城县','411000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411081','禹州市','411000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411082','长葛市','411000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411100','漯河市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411102','源汇区','411100','1',NULL,NULL,NULL,NULL,NULL,NULL),('411103','郾城区','411100','1',NULL,NULL,NULL,NULL,NULL,NULL),('411104','召陵区','411100','1',NULL,NULL,NULL,NULL,NULL,NULL),('411121','舞阳县','411100','1',NULL,NULL,NULL,NULL,NULL,NULL),('411122','临颍县','411100','1',NULL,NULL,NULL,NULL,NULL,NULL),('411200','三门峡市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411202','湖滨区','411200','1',NULL,NULL,NULL,NULL,NULL,NULL),('411203','陕州区','411200','1',NULL,NULL,NULL,NULL,NULL,NULL),('411221','渑池县','411200','1',NULL,NULL,NULL,NULL,NULL,NULL),('411224','卢氏县','411200','1',NULL,NULL,NULL,NULL,NULL,NULL),('411281','义马市','411200','1',NULL,NULL,NULL,NULL,NULL,NULL),('411282','灵宝市','411200','1',NULL,NULL,NULL,NULL,NULL,NULL),('411300','南阳市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411302','宛城区','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411303','卧龙区','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411321','南召县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411322','方城县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411323','西峡县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411324','镇平县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411325','内乡县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411326','淅川县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411327','社旗县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411328','唐河县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411329','新野县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411330','桐柏县','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411381','邓州市','411300','1',NULL,NULL,NULL,NULL,NULL,NULL),('411400','商丘市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411402','梁园区','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411403','睢阳区','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411421','民权县','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411422','睢县','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411423','宁陵县','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411424','柘城县','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411425','虞城县','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411426','夏邑县','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411481','永城市','411400','1',NULL,NULL,NULL,NULL,NULL,NULL),('411500','信阳市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411502','浉河区','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411503','平桥区','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411521','罗山县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411522','光山县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411523','新县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411524','商城县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411525','固始县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411526','潢川县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411527','淮滨县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411528','息县','411500','1',NULL,NULL,NULL,NULL,NULL,NULL),('411600','周口市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411602','川汇区','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411621','扶沟县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411622','西华县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411623','商水县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411624','沈丘县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411625','郸城县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411626','淮阳县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411627','太康县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411628','鹿邑县','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411681','项城市','411600','1',NULL,NULL,NULL,NULL,NULL,NULL),('411700','驻马店市','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('411702','驿城区','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411721','西平县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411722','上蔡县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411723','平舆县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411724','正阳县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411725','确山县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411726','泌阳县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411727','汝南县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411728','遂平县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('411729','新蔡县','411700','1',NULL,NULL,NULL,NULL,NULL,NULL),('419000','省直辖县级行政区划','410000','1',NULL,NULL,NULL,NULL,NULL,NULL),('419001','济源市','419000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420000','湖北省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('420100','武汉市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420102','江岸区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420103','江汉区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420104','硚口区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420105','汉阳区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420106','武昌区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420107','青山区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420111','洪山区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420112','东西湖区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420113','汉南区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420114','蔡甸区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420115','江夏区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420116','黄陂区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420117','新洲区','420100','1',NULL,NULL,NULL,NULL,NULL,NULL),('420200','黄石市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420202','黄石港区','420200','1',NULL,NULL,NULL,NULL,NULL,NULL),('420203','西塞山区','420200','1',NULL,NULL,NULL,NULL,NULL,NULL),('420204','下陆区','420200','1',NULL,NULL,NULL,NULL,NULL,NULL),('420205','铁山区','420200','1',NULL,NULL,NULL,NULL,NULL,NULL),('420222','阳新县','420200','1',NULL,NULL,NULL,NULL,NULL,NULL),('420281','大冶市','420200','1',NULL,NULL,NULL,NULL,NULL,NULL),('420300','十堰市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420302','茅箭区','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420303','张湾区','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420304','郧阳区','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420322','郧西县','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420323','竹山县','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420324','竹溪县','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420325','房县','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420381','丹江口市','420300','1',NULL,NULL,NULL,NULL,NULL,NULL),('420500','宜昌市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420502','西陵区','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420503','伍家岗区','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420504','点军区','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420505','猇亭区','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420506','夷陵区','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420525','远安县','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420526','兴山县','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420527','秭归县','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420528','长阳土家族自治县','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420529','五峰土家族自治县','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420581','宜都市','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420582','当阳市','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420583','枝江市','420500','1',NULL,NULL,NULL,NULL,NULL,NULL),('420600','襄阳市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420602','襄城区','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420606','樊城区','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420607','襄州区','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420624','南漳县','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420625','谷城县','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420626','保康县','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420682','老河口市','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420683','枣阳市','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420684','宜城市','420600','1',NULL,NULL,NULL,NULL,NULL,NULL),('420700','鄂州市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420702','梁子湖区','420700','1',NULL,NULL,NULL,NULL,NULL,NULL),('420703','华容区','420700','1',NULL,NULL,NULL,NULL,NULL,NULL),('420704','鄂城区','420700','1',NULL,NULL,NULL,NULL,NULL,NULL),('420800','荆门市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420802','东宝区','420800','1',NULL,NULL,NULL,NULL,NULL,NULL),('420804','掇刀区','420800','1',NULL,NULL,NULL,NULL,NULL,NULL),('420821','京山县','420800','1',NULL,NULL,NULL,NULL,NULL,NULL),('420822','沙洋县','420800','1',NULL,NULL,NULL,NULL,NULL,NULL),('420881','钟祥市','420800','1',NULL,NULL,NULL,NULL,NULL,NULL),('420900','孝感市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('420902','孝南区','420900','1',NULL,NULL,NULL,NULL,NULL,NULL),('420921','孝昌县','420900','1',NULL,NULL,NULL,NULL,NULL,NULL),('420922','大悟县','420900','1',NULL,NULL,NULL,NULL,NULL,NULL),('420923','云梦县','420900','1',NULL,NULL,NULL,NULL,NULL,NULL),('420981','应城市','420900','1',NULL,NULL,NULL,NULL,NULL,NULL),('420982','安陆市','420900','1',NULL,NULL,NULL,NULL,NULL,NULL),('420984','汉川市','420900','1',NULL,NULL,NULL,NULL,NULL,NULL),('421000','荆州市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421002','沙市区','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421003','荆州区','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421022','公安县','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421023','监利县','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421024','江陵县','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421081','石首市','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421083','洪湖市','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421087','松滋市','421000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421100','黄冈市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421102','黄州区','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421121','团风县','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421122','红安县','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421123','罗田县','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421124','英山县','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421125','浠水县','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421126','蕲春县','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421127','黄梅县','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421181','麻城市','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421182','武穴市','421100','1',NULL,NULL,NULL,NULL,NULL,NULL),('421200','咸宁市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421202','咸安区','421200','1',NULL,NULL,NULL,NULL,NULL,NULL),('421221','嘉鱼县','421200','1',NULL,NULL,NULL,NULL,NULL,NULL),('421222','通城县','421200','1',NULL,NULL,NULL,NULL,NULL,NULL),('421223','崇阳县','421200','1',NULL,NULL,NULL,NULL,NULL,NULL),('421224','通山县','421200','1',NULL,NULL,NULL,NULL,NULL,NULL),('421281','赤壁市','421200','1',NULL,NULL,NULL,NULL,NULL,NULL),('421300','随州市','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('421303','曾都区','421300','1',NULL,NULL,NULL,NULL,NULL,NULL),('421321','随县','421300','1',NULL,NULL,NULL,NULL,NULL,NULL),('421381','广水市','421300','1',NULL,NULL,NULL,NULL,NULL,NULL),('422800','恩施土家族苗族自治州','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('422801','恩施市','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('422802','利川市','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('422822','建始县','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('422823','巴东县','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('422825','宣恩县','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('422826','咸丰县','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('422827','来凤县','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('422828','鹤峰县','422800','1',NULL,NULL,NULL,NULL,NULL,NULL),('429000','省直辖县级行政区划','420000','1',NULL,NULL,NULL,NULL,NULL,NULL),('429004','仙桃市','429000','1',NULL,NULL,NULL,NULL,NULL,NULL),('429005','潜江市','429000','1',NULL,NULL,NULL,NULL,NULL,NULL),('429006','天门市','429000','1',NULL,NULL,NULL,NULL,NULL,NULL),('429021','神农架林区','429000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430000','湖南省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('430100','长沙市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430102','芙蓉区','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430103','天心区','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430104','岳麓区','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430105','开福区','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430111','雨花区','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430112','望城区','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430121','长沙县','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430124','宁乡县','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430181','浏阳市','430100','1',NULL,NULL,NULL,NULL,NULL,NULL),('430200','株洲市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430202','荷塘区','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430203','芦淞区','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430204','石峰区','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430211','天元区','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430221','株洲县','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430223','攸县','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430224','茶陵县','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430225','炎陵县','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430281','醴陵市','430200','1',NULL,NULL,NULL,NULL,NULL,NULL),('430300','湘潭市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430302','雨湖区','430300','1',NULL,NULL,NULL,NULL,NULL,NULL),('430304','岳塘区','430300','1',NULL,NULL,NULL,NULL,NULL,NULL),('430321','湘潭县','430300','1',NULL,NULL,NULL,NULL,NULL,NULL),('430381','湘乡市','430300','1',NULL,NULL,NULL,NULL,NULL,NULL),('430382','韶山市','430300','1',NULL,NULL,NULL,NULL,NULL,NULL),('430400','衡阳市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430405','珠晖区','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430406','雁峰区','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430407','石鼓区','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430408','蒸湘区','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430412','南岳区','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430421','衡阳县','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430422','衡南县','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430423','衡山县','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430424','衡东县','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430426','祁东县','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430481','耒阳市','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430482','常宁市','430400','1',NULL,NULL,NULL,NULL,NULL,NULL),('430500','邵阳市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430502','双清区','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430503','大祥区','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430511','北塔区','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430521','邵东县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430522','新邵县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430523','邵阳县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430524','隆回县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430525','洞口县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430527','绥宁县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430528','新宁县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430529','城步苗族自治县','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430581','武冈市','430500','1',NULL,NULL,NULL,NULL,NULL,NULL),('430600','岳阳市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430602','岳阳楼区','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430603','云溪区','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430611','君山区','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430621','岳阳县','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430623','华容县','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430624','湘阴县','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430626','平江县','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430681','汨罗市','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430682','临湘市','430600','1',NULL,NULL,NULL,NULL,NULL,NULL),('430700','常德市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430702','武陵区','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430703','鼎城区','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430721','安乡县','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430722','汉寿县','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430723','澧县','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430724','临澧县','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430725','桃源县','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430726','石门县','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430781','津市市','430700','1',NULL,NULL,NULL,NULL,NULL,NULL),('430800','张家界市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430802','永定区','430800','1',NULL,NULL,NULL,NULL,NULL,NULL),('430811','武陵源区','430800','1',NULL,NULL,NULL,NULL,NULL,NULL),('430821','慈利县','430800','1',NULL,NULL,NULL,NULL,NULL,NULL),('430822','桑植县','430800','1',NULL,NULL,NULL,NULL,NULL,NULL),('430900','益阳市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('430902','资阳区','430900','1',NULL,NULL,NULL,NULL,NULL,NULL),('430903','赫山区','430900','1',NULL,NULL,NULL,NULL,NULL,NULL),('430921','南县','430900','1',NULL,NULL,NULL,NULL,NULL,NULL),('430922','桃江县','430900','1',NULL,NULL,NULL,NULL,NULL,NULL),('430923','安化县','430900','1',NULL,NULL,NULL,NULL,NULL,NULL),('430981','沅江市','430900','1',NULL,NULL,NULL,NULL,NULL,NULL),('431000','郴州市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431002','北湖区','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431003','苏仙区','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431021','桂阳县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431022','宜章县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431023','永兴县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431024','嘉禾县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431025','临武县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431026','汝城县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431027','桂东县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431028','安仁县','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431081','资兴市','431000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431100','永州市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431102','零陵区','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431103','冷水滩区','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431121','祁阳县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431122','东安县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431123','双牌县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431124','道县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431125','江永县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431126','宁远县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431127','蓝山县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431128','新田县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431129','江华瑶族自治县','431100','1',NULL,NULL,NULL,NULL,NULL,NULL),('431200','怀化市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431202','鹤城区','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431221','中方县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431222','沅陵县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431223','辰溪县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431224','溆浦县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431225','会同县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431226','麻阳苗族自治县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431227','新晃侗族自治县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431228','芷江侗族自治县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431229','靖州苗族侗族自治县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431230','通道侗族自治县','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431281','洪江市','431200','1',NULL,NULL,NULL,NULL,NULL,NULL),('431300','娄底市','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('431302','娄星区','431300','1',NULL,NULL,NULL,NULL,NULL,NULL),('431321','双峰县','431300','1',NULL,NULL,NULL,NULL,NULL,NULL),('431322','新化县','431300','1',NULL,NULL,NULL,NULL,NULL,NULL),('431381','冷水江市','431300','1',NULL,NULL,NULL,NULL,NULL,NULL),('431382','涟源市','431300','1',NULL,NULL,NULL,NULL,NULL,NULL),('433100','湘西土家族苗族自治州','430000','1',NULL,NULL,NULL,NULL,NULL,NULL),('433101','吉首市','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('433122','泸溪县','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('433123','凤凰县','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('433124','花垣县','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('433125','保靖县','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('433126','古丈县','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('433127','永顺县','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('433130','龙山县','433100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440000','广东省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('440100','广州市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440103','荔湾区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440104','越秀区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440105','海珠区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440106','天河区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440111','白云区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440112','黄埔区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440113','番禺区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440114','花都区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440115','南沙区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440117','从化区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440118','增城区','440100','1',NULL,NULL,NULL,NULL,NULL,NULL),('440200','韶关市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440203','武江区','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440204','浈江区','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440205','曲江区','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440222','始兴县','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440224','仁化县','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440229','翁源县','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440232','乳源瑶族自治县','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440233','新丰县','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440281','乐昌市','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440282','南雄市','440200','1',NULL,NULL,NULL,NULL,NULL,NULL),('440300','深圳市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440303','罗湖区','440300','1',NULL,NULL,NULL,NULL,NULL,NULL),('440304','福田区','440300','1',NULL,NULL,NULL,NULL,NULL,NULL),('440305','南山区','440300','1',NULL,NULL,NULL,NULL,NULL,NULL),('440306','宝安区','440300','1',NULL,NULL,NULL,NULL,NULL,NULL),('440307','龙岗区','440300','1',NULL,NULL,NULL,NULL,NULL,NULL),('440308','盐田区','440300','1',NULL,NULL,NULL,NULL,NULL,NULL),('440400','珠海市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440402','香洲区','440400','1',NULL,NULL,NULL,NULL,NULL,NULL),('440403','斗门区','440400','1',NULL,NULL,NULL,NULL,NULL,NULL),('440404','金湾区','440400','1',NULL,NULL,NULL,NULL,NULL,NULL),('440500','汕头市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440507','龙湖区','440500','1',NULL,NULL,NULL,NULL,NULL,NULL),('440511','金平区','440500','1',NULL,NULL,NULL,NULL,NULL,NULL),('440512','濠江区','440500','1',NULL,NULL,NULL,NULL,NULL,NULL),('440513','潮阳区','440500','1',NULL,NULL,NULL,NULL,NULL,NULL),('440514','潮南区','440500','1',NULL,NULL,NULL,NULL,NULL,NULL),('440515','澄海区','440500','1',NULL,NULL,NULL,NULL,NULL,NULL),('440523','南澳县','440500','1',NULL,NULL,NULL,NULL,NULL,NULL),('440600','佛山市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440604','禅城区','440600','1',NULL,NULL,NULL,NULL,NULL,NULL),('440605','南海区','440600','1',NULL,NULL,NULL,NULL,NULL,NULL),('440606','顺德区','440600','1',NULL,NULL,NULL,NULL,NULL,NULL),('440607','三水区','440600','1',NULL,NULL,NULL,NULL,NULL,NULL),('440608','高明区','440600','1',NULL,NULL,NULL,NULL,NULL,NULL),('440700','江门市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440703','蓬江区','440700','1',NULL,NULL,NULL,NULL,NULL,NULL),('440704','江海区','440700','1',NULL,NULL,NULL,NULL,NULL,NULL),('440705','新会区','440700','1',NULL,NULL,NULL,NULL,NULL,NULL),('440781','台山市','440700','1',NULL,NULL,NULL,NULL,NULL,NULL),('440783','开平市','440700','1',NULL,NULL,NULL,NULL,NULL,NULL),('440784','鹤山市','440700','1',NULL,NULL,NULL,NULL,NULL,NULL),('440785','恩平市','440700','1',NULL,NULL,NULL,NULL,NULL,NULL),('440800','湛江市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440802','赤坎区','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440803','霞山区','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440804','坡头区','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440811','麻章区','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440823','遂溪县','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440825','徐闻县','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440881','廉江市','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440882','雷州市','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440883','吴川市','440800','1',NULL,NULL,NULL,NULL,NULL,NULL),('440900','茂名市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('440902','茂南区','440900','1',NULL,NULL,NULL,NULL,NULL,NULL),('440904','电白区','440900','1',NULL,NULL,NULL,NULL,NULL,NULL),('440981','高州市','440900','1',NULL,NULL,NULL,NULL,NULL,NULL),('440982','化州市','440900','1',NULL,NULL,NULL,NULL,NULL,NULL),('440983','信宜市','440900','1',NULL,NULL,NULL,NULL,NULL,NULL),('441200','肇庆市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('441202','端州区','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441203','鼎湖区','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441204','高要区','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441223','广宁县','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441224','怀集县','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441225','封开县','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441226','德庆县','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441284','四会市','441200','1',NULL,NULL,NULL,NULL,NULL,NULL),('441300','惠州市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('441302','惠城区','441300','1',NULL,NULL,NULL,NULL,NULL,NULL),('441303','惠阳区','441300','1',NULL,NULL,NULL,NULL,NULL,NULL),('441322','博罗县','441300','1',NULL,NULL,NULL,NULL,NULL,NULL),('441323','惠东县','441300','1',NULL,NULL,NULL,NULL,NULL,NULL),('441324','龙门县','441300','1',NULL,NULL,NULL,NULL,NULL,NULL),('441400','梅州市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('441402','梅江区','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441403','梅县区','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441422','大埔县','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441423','丰顺县','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441424','五华县','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441426','平远县','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441427','蕉岭县','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441481','兴宁市','441400','1',NULL,NULL,NULL,NULL,NULL,NULL),('441500','汕尾市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('441502','城区','441500','1',NULL,NULL,NULL,NULL,NULL,NULL),('441521','海丰县','441500','1',NULL,NULL,NULL,NULL,NULL,NULL),('441523','陆河县','441500','1',NULL,NULL,NULL,NULL,NULL,NULL),('441581','陆丰市','441500','1',NULL,NULL,NULL,NULL,NULL,NULL),('441600','河源市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('441602','源城区','441600','1',NULL,NULL,NULL,NULL,NULL,NULL),('441621','紫金县','441600','1',NULL,NULL,NULL,NULL,NULL,NULL),('441622','龙川县','441600','1',NULL,NULL,NULL,NULL,NULL,NULL),('441623','连平县','441600','1',NULL,NULL,NULL,NULL,NULL,NULL),('441624','和平县','441600','1',NULL,NULL,NULL,NULL,NULL,NULL),('441625','东源县','441600','1',NULL,NULL,NULL,NULL,NULL,NULL),('441700','阳江市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('441702','江城区','441700','1',NULL,NULL,NULL,NULL,NULL,NULL),('441704','阳东区','441700','1',NULL,NULL,NULL,NULL,NULL,NULL),('441721','阳西县','441700','1',NULL,NULL,NULL,NULL,NULL,NULL),('441781','阳春市','441700','1',NULL,NULL,NULL,NULL,NULL,NULL),('441800','清远市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('441802','清城区','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441803','清新区','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441821','佛冈县','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441823','阳山县','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441825','连山壮族瑶族自治县','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441826','连南瑶族自治县','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441881','英德市','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441882','连州市','441800','1',NULL,NULL,NULL,NULL,NULL,NULL),('441900','东莞市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('442000','中山市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('445100','潮州市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('445102','湘桥区','445100','1',NULL,NULL,NULL,NULL,NULL,NULL),('445103','潮安区','445100','1',NULL,NULL,NULL,NULL,NULL,NULL),('445122','饶平县','445100','1',NULL,NULL,NULL,NULL,NULL,NULL),('445200','揭阳市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('445202','榕城区','445200','1',NULL,NULL,NULL,NULL,NULL,NULL),('445203','揭东区','445200','1',NULL,NULL,NULL,NULL,NULL,NULL),('445222','揭西县','445200','1',NULL,NULL,NULL,NULL,NULL,NULL),('445224','惠来县','445200','1',NULL,NULL,NULL,NULL,NULL,NULL),('445281','普宁市','445200','1',NULL,NULL,NULL,NULL,NULL,NULL),('445300','云浮市','440000','1',NULL,NULL,NULL,NULL,NULL,NULL),('445302','云城区','445300','1',NULL,NULL,NULL,NULL,NULL,NULL),('445303','云安区','445300','1',NULL,NULL,NULL,NULL,NULL,NULL),('445321','新兴县','445300','1',NULL,NULL,NULL,NULL,NULL,NULL),('445322','郁南县','445300','1',NULL,NULL,NULL,NULL,NULL,NULL),('445381','罗定市','445300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450000','广西壮族自治区',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('450100','南宁市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450102','兴宁区','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450103','青秀区','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450105','江南区','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450107','西乡塘区','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450108','良庆区','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450109','邕宁区','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450110','武鸣区','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450123','隆安县','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450124','马山县','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450125','上林县','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450126','宾阳县','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450127','横县','450100','1',NULL,NULL,NULL,NULL,NULL,NULL),('450200','柳州市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450202','城中区','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450203','鱼峰区','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450204','柳南区','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450205','柳北区','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450206','柳江区','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450222','柳城县','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450223','鹿寨县','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450224','融安县','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450225','融水苗族自治县','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450226','三江侗族自治县','450200','1',NULL,NULL,NULL,NULL,NULL,NULL),('450300','桂林市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450302','秀峰区','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450303','叠彩区','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450304','象山区','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450305','七星区','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450311','雁山区','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450312','临桂区','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450321','阳朔县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450323','灵川县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450324','全州县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450325','兴安县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450326','永福县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450327','灌阳县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450328','龙胜各族自治县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450329','资源县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450330','平乐县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450331','荔浦县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450332','恭城瑶族自治县','450300','1',NULL,NULL,NULL,NULL,NULL,NULL),('450400','梧州市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450403','万秀区','450400','1',NULL,NULL,NULL,NULL,NULL,NULL),('450405','长洲区','450400','1',NULL,NULL,NULL,NULL,NULL,NULL),('450406','龙圩区','450400','1',NULL,NULL,NULL,NULL,NULL,NULL),('450421','苍梧县','450400','1',NULL,NULL,NULL,NULL,NULL,NULL),('450422','藤县','450400','1',NULL,NULL,NULL,NULL,NULL,NULL),('450423','蒙山县','450400','1',NULL,NULL,NULL,NULL,NULL,NULL),('450481','岑溪市','450400','1',NULL,NULL,NULL,NULL,NULL,NULL),('450500','北海市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450502','海城区','450500','1',NULL,NULL,NULL,NULL,NULL,NULL),('450503','银海区','450500','1',NULL,NULL,NULL,NULL,NULL,NULL),('450512','铁山港区','450500','1',NULL,NULL,NULL,NULL,NULL,NULL),('450521','合浦县','450500','1',NULL,NULL,NULL,NULL,NULL,NULL),('450600','防城港市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450602','港口区','450600','1',NULL,NULL,NULL,NULL,NULL,NULL),('450603','防城区','450600','1',NULL,NULL,NULL,NULL,NULL,NULL),('450621','上思县','450600','1',NULL,NULL,NULL,NULL,NULL,NULL),('450681','东兴市','450600','1',NULL,NULL,NULL,NULL,NULL,NULL),('450700','钦州市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450702','钦南区','450700','1',NULL,NULL,NULL,NULL,NULL,NULL),('450703','钦北区','450700','1',NULL,NULL,NULL,NULL,NULL,NULL),('450721','灵山县','450700','1',NULL,NULL,NULL,NULL,NULL,NULL),('450722','浦北县','450700','1',NULL,NULL,NULL,NULL,NULL,NULL),('450800','贵港市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450802','港北区','450800','1',NULL,NULL,NULL,NULL,NULL,NULL),('450803','港南区','450800','1',NULL,NULL,NULL,NULL,NULL,NULL),('450804','覃塘区','450800','1',NULL,NULL,NULL,NULL,NULL,NULL),('450821','平南县','450800','1',NULL,NULL,NULL,NULL,NULL,NULL),('450881','桂平市','450800','1',NULL,NULL,NULL,NULL,NULL,NULL),('450900','玉林市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('450902','玉州区','450900','1',NULL,NULL,NULL,NULL,NULL,NULL),('450903','福绵区','450900','1',NULL,NULL,NULL,NULL,NULL,NULL),('450921','容县','450900','1',NULL,NULL,NULL,NULL,NULL,NULL),('450922','陆川县','450900','1',NULL,NULL,NULL,NULL,NULL,NULL),('450923','博白县','450900','1',NULL,NULL,NULL,NULL,NULL,NULL),('450924','兴业县','450900','1',NULL,NULL,NULL,NULL,NULL,NULL),('450981','北流市','450900','1',NULL,NULL,NULL,NULL,NULL,NULL),('451000','百色市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451002','右江区','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451021','田阳县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451022','田东县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451023','平果县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451024','德保县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451026','那坡县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451027','凌云县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451028','乐业县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451029','田林县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451030','西林县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451031','隆林各族自治县','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451081','靖西市','451000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451100','贺州市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451102','八步区','451100','1',NULL,NULL,NULL,NULL,NULL,NULL),('451103','平桂区','451100','1',NULL,NULL,NULL,NULL,NULL,NULL),('451121','昭平县','451100','1',NULL,NULL,NULL,NULL,NULL,NULL),('451122','钟山县','451100','1',NULL,NULL,NULL,NULL,NULL,NULL),('451123','富川瑶族自治县','451100','1',NULL,NULL,NULL,NULL,NULL,NULL),('451200','河池市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451202','金城江区','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451221','南丹县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451222','天峨县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451223','凤山县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451224','东兰县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451225','罗城仫佬族自治县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451226','环江毛南族自治县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451227','巴马瑶族自治县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451228','都安瑶族自治县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451229','大化瑶族自治县','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451281','宜州市','451200','1',NULL,NULL,NULL,NULL,NULL,NULL),('451300','来宾市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451302','兴宾区','451300','1',NULL,NULL,NULL,NULL,NULL,NULL),('451321','忻城县','451300','1',NULL,NULL,NULL,NULL,NULL,NULL),('451322','象州县','451300','1',NULL,NULL,NULL,NULL,NULL,NULL),('451323','武宣县','451300','1',NULL,NULL,NULL,NULL,NULL,NULL),('451324','金秀瑶族自治县','451300','1',NULL,NULL,NULL,NULL,NULL,NULL),('451381','合山市','451300','1',NULL,NULL,NULL,NULL,NULL,NULL),('451400','崇左市','450000','1',NULL,NULL,NULL,NULL,NULL,NULL),('451402','江州区','451400','1',NULL,NULL,NULL,NULL,NULL,NULL),('451421','扶绥县','451400','1',NULL,NULL,NULL,NULL,NULL,NULL),('451422','宁明县','451400','1',NULL,NULL,NULL,NULL,NULL,NULL),('451423','龙州县','451400','1',NULL,NULL,NULL,NULL,NULL,NULL),('451424','大新县','451400','1',NULL,NULL,NULL,NULL,NULL,NULL),('451425','天等县','451400','1',NULL,NULL,NULL,NULL,NULL,NULL),('451481','凭祥市','451400','1',NULL,NULL,NULL,NULL,NULL,NULL),('460000','海南省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('460100','海口市','460000','1',NULL,NULL,NULL,NULL,NULL,NULL),('460105','秀英区','460100','1',NULL,NULL,NULL,NULL,NULL,NULL),('460106','龙华区','460100','1',NULL,NULL,NULL,NULL,NULL,NULL),('460107','琼山区','460100','1',NULL,NULL,NULL,NULL,NULL,NULL),('460108','美兰区','460100','1',NULL,NULL,NULL,NULL,NULL,NULL),('460200','三亚市','460000','1',NULL,NULL,NULL,NULL,NULL,NULL),('460202','海棠区','460200','1',NULL,NULL,NULL,NULL,NULL,NULL),('460203','吉阳区','460200','1',NULL,NULL,NULL,NULL,NULL,NULL),('460204','天涯区','460200','1',NULL,NULL,NULL,NULL,NULL,NULL),('460205','崖州区','460200','1',NULL,NULL,NULL,NULL,NULL,NULL),('460300','三沙市','460000','1',NULL,NULL,NULL,NULL,NULL,NULL),('460400','儋州市','460000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469000','省直辖县级行政区划','460000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469001','五指山市','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469002','琼海市','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469005','文昌市','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469006','万宁市','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469007','东方市','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469021','定安县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469022','屯昌县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469023','澄迈县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469024','临高县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469025','白沙黎族自治县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469026','昌江黎族自治县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469027','乐东黎族自治县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469028','陵水黎族自治县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469029','保亭黎族苗族自治县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('469030','琼中黎族苗族自治县','469000','1',NULL,NULL,NULL,NULL,NULL,NULL),('500000','重庆市',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('500100','重庆市','500000','1',NULL,NULL,NULL,NULL,NULL,NULL),('500101','万州区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500102','涪陵区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500103','渝中区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500104','大渡口区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500105','江北区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500106','沙坪坝区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500107','九龙坡区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500108','南岸区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500109','北碚区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500110','綦江区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500111','大足区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500112','渝北区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500113','巴南区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500114','黔江区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500115','长寿区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500116','江津区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500117','合川区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500118','永川区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500119','南川区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500120','璧山区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500151','铜梁区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500152','潼南区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500153','荣昌区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500154','开州区','500100','1',NULL,NULL,NULL,NULL,NULL,NULL),('500200','县','500000','1',NULL,NULL,NULL,NULL,NULL,NULL),('500228','梁平县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500229','城口县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500230','丰都县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500231','垫江县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500232','武隆县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500233','忠县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500235','云阳县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500236','奉节县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500237','巫山县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500238','巫溪县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500240','石柱土家族自治县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500241','秀山土家族苗族自治县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500242','酉阳土家族苗族自治县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('500243','彭水苗族土家族自治县','500200','1',NULL,NULL,NULL,NULL,NULL,NULL),('510000','四川省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('510100','成都市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510104','锦江区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510105','青羊区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510106','金牛区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510107','武侯区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510108','成华区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510112','龙泉驿区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510113','青白江区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510114','新都区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510115','温江区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510116','双流区','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510121','金堂县','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510124','郫县','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510129','大邑县','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510131','蒲江县','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510132','新津县','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510181','都江堰市','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510182','彭州市','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510183','邛崃市','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510184','崇州市','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510185','简阳市','510100','1',NULL,NULL,NULL,NULL,NULL,NULL),('510300','自贡市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510302','自流井区','510300','1',NULL,NULL,NULL,NULL,NULL,NULL),('510303','贡井区','510300','1',NULL,NULL,NULL,NULL,NULL,NULL),('510304','大安区','510300','1',NULL,NULL,NULL,NULL,NULL,NULL),('510311','沿滩区','510300','1',NULL,NULL,NULL,NULL,NULL,NULL),('510321','荣县','510300','1',NULL,NULL,NULL,NULL,NULL,NULL),('510322','富顺县','510300','1',NULL,NULL,NULL,NULL,NULL,NULL),('510400','攀枝花市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510402','东区','510400','1',NULL,NULL,NULL,NULL,NULL,NULL),('510403','西区','510400','1',NULL,NULL,NULL,NULL,NULL,NULL),('510411','仁和区','510400','1',NULL,NULL,NULL,NULL,NULL,NULL),('510421','米易县','510400','1',NULL,NULL,NULL,NULL,NULL,NULL),('510422','盐边县','510400','1',NULL,NULL,NULL,NULL,NULL,NULL),('510500','泸州市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510502','江阳区','510500','1',NULL,NULL,NULL,NULL,NULL,NULL),('510503','纳溪区','510500','1',NULL,NULL,NULL,NULL,NULL,NULL),('510504','龙马潭区','510500','1',NULL,NULL,NULL,NULL,NULL,NULL),('510521','泸县','510500','1',NULL,NULL,NULL,NULL,NULL,NULL),('510522','合江县','510500','1',NULL,NULL,NULL,NULL,NULL,NULL),('510524','叙永县','510500','1',NULL,NULL,NULL,NULL,NULL,NULL),('510525','古蔺县','510500','1',NULL,NULL,NULL,NULL,NULL,NULL),('510600','德阳市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510603','旌阳区','510600','1',NULL,NULL,NULL,NULL,NULL,NULL),('510623','中江县','510600','1',NULL,NULL,NULL,NULL,NULL,NULL),('510626','罗江县','510600','1',NULL,NULL,NULL,NULL,NULL,NULL),('510681','广汉市','510600','1',NULL,NULL,NULL,NULL,NULL,NULL),('510682','什邡市','510600','1',NULL,NULL,NULL,NULL,NULL,NULL),('510683','绵竹市','510600','1',NULL,NULL,NULL,NULL,NULL,NULL),('510700','绵阳市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510703','涪城区','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510704','游仙区','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510705','安州区','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510722','三台县','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510723','盐亭县','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510725','梓潼县','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510726','北川羌族自治县','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510727','平武县','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510781','江油市','510700','1',NULL,NULL,NULL,NULL,NULL,NULL),('510800','广元市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510802','利州区','510800','1',NULL,NULL,NULL,NULL,NULL,NULL),('510811','昭化区','510800','1',NULL,NULL,NULL,NULL,NULL,NULL),('510812','朝天区','510800','1',NULL,NULL,NULL,NULL,NULL,NULL),('510821','旺苍县','510800','1',NULL,NULL,NULL,NULL,NULL,NULL),('510822','青川县','510800','1',NULL,NULL,NULL,NULL,NULL,NULL),('510823','剑阁县','510800','1',NULL,NULL,NULL,NULL,NULL,NULL),('510824','苍溪县','510800','1',NULL,NULL,NULL,NULL,NULL,NULL),('510900','遂宁市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('510903','船山区','510900','1',NULL,NULL,NULL,NULL,NULL,NULL),('510904','安居区','510900','1',NULL,NULL,NULL,NULL,NULL,NULL),('510921','蓬溪县','510900','1',NULL,NULL,NULL,NULL,NULL,NULL),('510922','射洪县','510900','1',NULL,NULL,NULL,NULL,NULL,NULL),('510923','大英县','510900','1',NULL,NULL,NULL,NULL,NULL,NULL),('511000','内江市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511002','市中区','511000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511011','东兴区','511000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511024','威远县','511000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511025','资中县','511000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511028','隆昌县','511000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511100','乐山市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511102','市中区','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511111','沙湾区','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511112','五通桥区','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511113','金口河区','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511123','犍为县','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511124','井研县','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511126','夹江县','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511129','沐川县','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511132','峨边彝族自治县','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511133','马边彝族自治县','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511181','峨眉山市','511100','1',NULL,NULL,NULL,NULL,NULL,NULL),('511300','南充市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511302','顺庆区','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511303','高坪区','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511304','嘉陵区','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511321','南部县','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511322','营山县','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511323','蓬安县','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511324','仪陇县','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511325','西充县','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511381','阆中市','511300','1',NULL,NULL,NULL,NULL,NULL,NULL),('511400','眉山市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511402','东坡区','511400','1',NULL,NULL,NULL,NULL,NULL,NULL),('511403','彭山区','511400','1',NULL,NULL,NULL,NULL,NULL,NULL),('511421','仁寿县','511400','1',NULL,NULL,NULL,NULL,NULL,NULL),('511423','洪雅县','511400','1',NULL,NULL,NULL,NULL,NULL,NULL),('511424','丹棱县','511400','1',NULL,NULL,NULL,NULL,NULL,NULL),('511425','青神县','511400','1',NULL,NULL,NULL,NULL,NULL,NULL),('511500','宜宾市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511502','翠屏区','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511503','南溪区','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511521','宜宾县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511523','江安县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511524','长宁县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511525','高县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511526','珙县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511527','筠连县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511528','兴文县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511529','屏山县','511500','1',NULL,NULL,NULL,NULL,NULL,NULL),('511600','广安市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511602','广安区','511600','1',NULL,NULL,NULL,NULL,NULL,NULL),('511603','前锋区','511600','1',NULL,NULL,NULL,NULL,NULL,NULL),('511621','岳池县','511600','1',NULL,NULL,NULL,NULL,NULL,NULL),('511622','武胜县','511600','1',NULL,NULL,NULL,NULL,NULL,NULL),('511623','邻水县','511600','1',NULL,NULL,NULL,NULL,NULL,NULL),('511681','华蓥市','511600','1',NULL,NULL,NULL,NULL,NULL,NULL),('511700','达州市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511702','通川区','511700','1',NULL,NULL,NULL,NULL,NULL,NULL),('511703','达川区','511700','1',NULL,NULL,NULL,NULL,NULL,NULL),('511722','宣汉县','511700','1',NULL,NULL,NULL,NULL,NULL,NULL),('511723','开江县','511700','1',NULL,NULL,NULL,NULL,NULL,NULL),('511724','大竹县','511700','1',NULL,NULL,NULL,NULL,NULL,NULL),('511725','渠县','511700','1',NULL,NULL,NULL,NULL,NULL,NULL),('511781','万源市','511700','1',NULL,NULL,NULL,NULL,NULL,NULL),('511800','雅安市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511802','雨城区','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511803','名山区','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511822','荥经县','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511823','汉源县','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511824','石棉县','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511825','天全县','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511826','芦山县','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511827','宝兴县','511800','1',NULL,NULL,NULL,NULL,NULL,NULL),('511900','巴中市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('511902','巴州区','511900','1',NULL,NULL,NULL,NULL,NULL,NULL),('511903','恩阳区','511900','1',NULL,NULL,NULL,NULL,NULL,NULL),('511921','通江县','511900','1',NULL,NULL,NULL,NULL,NULL,NULL),('511922','南江县','511900','1',NULL,NULL,NULL,NULL,NULL,NULL),('511923','平昌县','511900','1',NULL,NULL,NULL,NULL,NULL,NULL),('512000','资阳市','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('512002','雁江区','512000','1',NULL,NULL,NULL,NULL,NULL,NULL),('512021','安岳县','512000','1',NULL,NULL,NULL,NULL,NULL,NULL),('512022','乐至县','512000','1',NULL,NULL,NULL,NULL,NULL,NULL),('513200','阿坝藏族羌族自治州','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('513201','马尔康市','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513221','汶川县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513222','理县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513223','茂县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513224','松潘县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513225','九寨沟县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513226','金川县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513227','小金县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513228','黑水县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513230','壤塘县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513231','阿坝县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513232','若尔盖县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513233','红原县','513200','1',NULL,NULL,NULL,NULL,NULL,NULL),('513300','甘孜藏族自治州','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('513301','康定市','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513322','泸定县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513323','丹巴县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513324','九龙县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513325','雅江县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513326','道孚县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513327','炉霍县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513328','甘孜县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513329','新龙县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513330','德格县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513331','白玉县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513332','石渠县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513333','色达县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513334','理塘县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513335','巴塘县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513336','乡城县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513337','稻城县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513338','得荣县','513300','1',NULL,NULL,NULL,NULL,NULL,NULL),('513400','凉山彝族自治州','510000','1',NULL,NULL,NULL,NULL,NULL,NULL),('513401','西昌市','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513422','木里藏族自治县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513423','盐源县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513424','德昌县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513425','会理县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513426','会东县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513427','宁南县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513428','普格县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513429','布拖县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513430','金阳县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513431','昭觉县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513432','喜德县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513433','冕宁县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513434','越西县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513435','甘洛县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513436','美姑县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('513437','雷波县','513400','1',NULL,NULL,NULL,NULL,NULL,NULL),('520000','贵州省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('520100','贵阳市','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('520102','南明区','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520103','云岩区','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520111','花溪区','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520112','乌当区','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520113','白云区','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520115','观山湖区','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520121','开阳县','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520122','息烽县','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520123','修文县','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520181','清镇市','520100','1',NULL,NULL,NULL,NULL,NULL,NULL),('520200','六盘水市','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('520201','钟山区','520200','1',NULL,NULL,NULL,NULL,NULL,NULL),('520203','六枝特区','520200','1',NULL,NULL,NULL,NULL,NULL,NULL),('520221','水城县','520200','1',NULL,NULL,NULL,NULL,NULL,NULL),('520222','盘县','520200','1',NULL,NULL,NULL,NULL,NULL,NULL),('520300','遵义市','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('520302','红花岗区','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520303','汇川区','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520304','播州区','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520322','桐梓县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520323','绥阳县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520324','正安县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520325','道真仡佬族苗族自治县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520326','务川仡佬族苗族自治县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520327','凤冈县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520328','湄潭县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520329','余庆县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520330','习水县','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520381','赤水市','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520382','仁怀市','520300','1',NULL,NULL,NULL,NULL,NULL,NULL),('520400','安顺市','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('520402','西秀区','520400','1',NULL,NULL,NULL,NULL,NULL,NULL),('520403','平坝区','520400','1',NULL,NULL,NULL,NULL,NULL,NULL),('520422','普定县','520400','1',NULL,NULL,NULL,NULL,NULL,NULL),('520423','镇宁布依族苗族自治县','520400','1',NULL,NULL,NULL,NULL,NULL,NULL),('520424','关岭布依族苗族自治县','520400','1',NULL,NULL,NULL,NULL,NULL,NULL),('520425','紫云苗族布依族自治县','520400','1',NULL,NULL,NULL,NULL,NULL,NULL),('520500','毕节市','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('520502','七星关区','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520521','大方县','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520522','黔西县','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520523','金沙县','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520524','织金县','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520525','纳雍县','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520526','威宁彝族回族苗族自治县','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520527','赫章县','520500','1',NULL,NULL,NULL,NULL,NULL,NULL),('520600','铜仁市','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('520602','碧江区','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520603','万山区','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520621','江口县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520622','玉屏侗族自治县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520623','石阡县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520624','思南县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520625','印江土家族苗族自治县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520626','德江县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520627','沿河土家族自治县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('520628','松桃苗族自治县','520600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522300','黔西南布依族苗族自治州','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('522301','兴义市','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522322','兴仁县','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522323','普安县','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522324','晴隆县','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522325','贞丰县','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522326','望谟县','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522327','册亨县','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522328','安龙县','522300','1',NULL,NULL,NULL,NULL,NULL,NULL),('522600','黔东南苗族侗族自治州','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('522601','凯里市','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522622','黄平县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522623','施秉县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522624','三穗县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522625','镇远县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522626','岑巩县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522627','天柱县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522628','锦屏县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522629','剑河县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522630','台江县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522631','黎平县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522632','榕江县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522633','从江县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522634','雷山县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522635','麻江县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522636','丹寨县','522600','1',NULL,NULL,NULL,NULL,NULL,NULL),('522700','黔南布依族苗族自治州','520000','1',NULL,NULL,NULL,NULL,NULL,NULL),('522701','都匀市','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522702','福泉市','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522722','荔波县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522723','贵定县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522725','瓮安县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522726','独山县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522727','平塘县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522728','罗甸县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522729','长顺县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522730','龙里县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522731','惠水县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('522732','三都水族自治县','522700','1',NULL,NULL,NULL,NULL,NULL,NULL),('530000','云南省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('530100','昆明市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530102','五华区','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530103','盘龙区','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530111','官渡区','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530112','西山区','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530113','东川区','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530114','呈贡区','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530122','晋宁县','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530124','富民县','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530125','宜良县','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530126','石林彝族自治县','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530127','嵩明县','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530128','禄劝彝族苗族自治县','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530129','寻甸回族彝族自治县','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530181','安宁市','530100','1',NULL,NULL,NULL,NULL,NULL,NULL),('530300','曲靖市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530302','麒麟区','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530303','沾益区','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530321','马龙县','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530322','陆良县','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530323','师宗县','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530324','罗平县','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530325','富源县','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530326','会泽县','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530381','宣威市','530300','1',NULL,NULL,NULL,NULL,NULL,NULL),('530400','玉溪市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530402','红塔区','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530403','江川区','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530422','澄江县','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530423','通海县','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530424','华宁县','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530425','易门县','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530426','峨山彝族自治县','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530427','新平彝族傣族自治县','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530428','元江哈尼族彝族傣族自治县','530400','1',NULL,NULL,NULL,NULL,NULL,NULL),('530500','保山市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530502','隆阳区','530500','1',NULL,NULL,NULL,NULL,NULL,NULL),('530521','施甸县','530500','1',NULL,NULL,NULL,NULL,NULL,NULL),('530523','龙陵县','530500','1',NULL,NULL,NULL,NULL,NULL,NULL),('530524','昌宁县','530500','1',NULL,NULL,NULL,NULL,NULL,NULL),('530581','腾冲市','530500','1',NULL,NULL,NULL,NULL,NULL,NULL),('530600','昭通市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530602','昭阳区','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530621','鲁甸县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530622','巧家县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530623','盐津县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530624','大关县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530625','永善县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530626','绥江县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530627','镇雄县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530628','彝良县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530629','威信县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530630','水富县','530600','1',NULL,NULL,NULL,NULL,NULL,NULL),('530700','丽江市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530702','古城区','530700','1',NULL,NULL,NULL,NULL,NULL,NULL),('530721','玉龙纳西族自治县','530700','1',NULL,NULL,NULL,NULL,NULL,NULL),('530722','永胜县','530700','1',NULL,NULL,NULL,NULL,NULL,NULL),('530723','华坪县','530700','1',NULL,NULL,NULL,NULL,NULL,NULL),('530724','宁蒗彝族自治县','530700','1',NULL,NULL,NULL,NULL,NULL,NULL),('530800','普洱市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530802','思茅区','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530821','宁洱哈尼族彝族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530822','墨江哈尼族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530823','景东彝族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530824','景谷傣族彝族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530825','镇沅彝族哈尼族拉祜族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530826','江城哈尼族彝族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530827','孟连傣族拉祜族佤族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530828','澜沧拉祜族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530829','西盟佤族自治县','530800','1',NULL,NULL,NULL,NULL,NULL,NULL),('530900','临沧市','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('530902','临翔区','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('530921','凤庆县','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('530922','云县','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('530923','永德县','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('530924','镇康县','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('530925','双江拉祜族佤族布朗族傣族自治县','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('530926','耿马傣族佤族自治县','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('530927','沧源佤族自治县','530900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532300','楚雄彝族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('532301','楚雄市','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532322','双柏县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532323','牟定县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532324','南华县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532325','姚安县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532326','大姚县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532327','永仁县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532328','元谋县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532329','武定县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532331','禄丰县','532300','1',NULL,NULL,NULL,NULL,NULL,NULL),('532500','红河哈尼族彝族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('532501','个旧市','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532502','开远市','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532503','蒙自市','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532504','弥勒市','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532523','屏边苗族自治县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532524','建水县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532525','石屏县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532527','泸西县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532528','元阳县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532529','红河县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532530','金平苗族瑶族傣族自治县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532531','绿春县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532532','河口瑶族自治县','532500','1',NULL,NULL,NULL,NULL,NULL,NULL),('532600','文山壮族苗族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('532601','文山市','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532622','砚山县','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532623','西畴县','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532624','麻栗坡县','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532625','马关县','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532626','丘北县','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532627','广南县','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532628','富宁县','532600','1',NULL,NULL,NULL,NULL,NULL,NULL),('532800','西双版纳傣族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('532801','景洪市','532800','1',NULL,NULL,NULL,NULL,NULL,NULL),('532822','勐海县','532800','1',NULL,NULL,NULL,NULL,NULL,NULL),('532823','勐腊县','532800','1',NULL,NULL,NULL,NULL,NULL,NULL),('532900','大理白族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('532901','大理市','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532922','漾濞彝族自治县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532923','祥云县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532924','宾川县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532925','弥渡县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532926','南涧彝族自治县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532927','巍山彝族回族自治县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532928','永平县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532929','云龙县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532930','洱源县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532931','剑川县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('532932','鹤庆县','532900','1',NULL,NULL,NULL,NULL,NULL,NULL),('533100','德宏傣族景颇族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('533102','瑞丽市','533100','1',NULL,NULL,NULL,NULL,NULL,NULL),('533103','芒市','533100','1',NULL,NULL,NULL,NULL,NULL,NULL),('533122','梁河县','533100','1',NULL,NULL,NULL,NULL,NULL,NULL),('533123','盈江县','533100','1',NULL,NULL,NULL,NULL,NULL,NULL),('533124','陇川县','533100','1',NULL,NULL,NULL,NULL,NULL,NULL),('533300','怒江傈僳族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('533301','泸水市','533300','1',NULL,NULL,NULL,NULL,NULL,NULL),('533323','福贡县','533300','1',NULL,NULL,NULL,NULL,NULL,NULL),('533324','贡山独龙族怒族自治县','533300','1',NULL,NULL,NULL,NULL,NULL,NULL),('533325','兰坪白族普米族自治县','533300','1',NULL,NULL,NULL,NULL,NULL,NULL),('533400','迪庆藏族自治州','530000','1',NULL,NULL,NULL,NULL,NULL,NULL),('533401','香格里拉市','533400','1',NULL,NULL,NULL,NULL,NULL,NULL),('533422','德钦县','533400','1',NULL,NULL,NULL,NULL,NULL,NULL),('533423','维西傈僳族自治县','533400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540000','西藏自治区',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('540100','拉萨市','540000','1',NULL,NULL,NULL,NULL,NULL,NULL),('540102','城关区','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540103','堆龙德庆区','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540121','林周县','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540122','当雄县','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540123','尼木县','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540124','曲水县','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540126','达孜县','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540127','墨竹工卡县','540100','1',NULL,NULL,NULL,NULL,NULL,NULL),('540200','日喀则市','540000','1',NULL,NULL,NULL,NULL,NULL,NULL),('540202','桑珠孜区','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540221','南木林县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540222','江孜县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540223','定日县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540224','萨迦县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540225','拉孜县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540226','昂仁县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540227','谢通门县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540228','白朗县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540229','仁布县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540230','康马县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540231','定结县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540232','仲巴县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540233','亚东县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540234','吉隆县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540235','聂拉木县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540236','萨嘎县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540237','岗巴县','540200','1',NULL,NULL,NULL,NULL,NULL,NULL),('540300','昌都市','540000','1',NULL,NULL,NULL,NULL,NULL,NULL),('540302','卡若区','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540321','江达县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540322','贡觉县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540323','类乌齐县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540324','丁青县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540325','察雅县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540326','八宿县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540327','左贡县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540328','芒康县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540329','洛隆县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540330','边坝县','540300','1',NULL,NULL,NULL,NULL,NULL,NULL),('540400','林芝市','540000','1',NULL,NULL,NULL,NULL,NULL,NULL),('540402','巴宜区','540400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540421','工布江达县','540400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540422','米林县','540400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540423','墨脱县','540400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540424','波密县','540400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540425','察隅县','540400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540426','朗县','540400','1',NULL,NULL,NULL,NULL,NULL,NULL),('540500','山南市','540000','1',NULL,NULL,NULL,NULL,NULL,NULL),('540502','乃东区','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540521','扎囊县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540522','贡嘎县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540523','桑日县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540524','琼结县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540525','曲松县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540526','措美县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540527','洛扎县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540528','加查县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540529','隆子县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540530','错那县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('540531','浪卡子县','540500','1',NULL,NULL,NULL,NULL,NULL,NULL),('542400','那曲地区','540000','1',NULL,NULL,NULL,NULL,NULL,NULL),('542421','那曲县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542422','嘉黎县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542423','比如县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542424','聂荣县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542425','安多县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542426','申扎县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542427','索县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542428','班戈县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542429','巴青县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542430','尼玛县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542431','双湖县','542400','1',NULL,NULL,NULL,NULL,NULL,NULL),('542500','阿里地区','540000','1',NULL,NULL,NULL,NULL,NULL,NULL),('542521','普兰县','542500','1',NULL,NULL,NULL,NULL,NULL,NULL),('542522','札达县','542500','1',NULL,NULL,NULL,NULL,NULL,NULL),('542523','噶尔县','542500','1',NULL,NULL,NULL,NULL,NULL,NULL),('542524','日土县','542500','1',NULL,NULL,NULL,NULL,NULL,NULL),('542525','革吉县','542500','1',NULL,NULL,NULL,NULL,NULL,NULL),('542526','改则县','542500','1',NULL,NULL,NULL,NULL,NULL,NULL),('542527','措勤县','542500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610000','陕西省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('610100','西安市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610102','新城区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610103','碑林区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610104','莲湖区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610111','灞桥区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610112','未央区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610113','雁塔区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610114','阎良区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610115','临潼区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610116','长安区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610117','高陵区','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610122','蓝田县','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610124','周至县','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610125','户县','610100','1',NULL,NULL,NULL,NULL,NULL,NULL),('610200','铜川市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610202','王益区','610200','1',NULL,NULL,NULL,NULL,NULL,NULL),('610203','印台区','610200','1',NULL,NULL,NULL,NULL,NULL,NULL),('610204','耀州区','610200','1',NULL,NULL,NULL,NULL,NULL,NULL),('610222','宜君县','610200','1',NULL,NULL,NULL,NULL,NULL,NULL),('610300','宝鸡市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610302','渭滨区','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610303','金台区','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610304','陈仓区','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610322','凤翔县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610323','岐山县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610324','扶风县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610326','眉县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610327','陇县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610328','千阳县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610329','麟游县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610330','凤县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610331','太白县','610300','1',NULL,NULL,NULL,NULL,NULL,NULL),('610400','咸阳市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610402','秦都区','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610403','杨陵区','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610404','渭城区','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610422','三原县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610423','泾阳县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610424','乾县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610425','礼泉县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610426','永寿县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610427','彬县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610428','长武县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610429','旬邑县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610430','淳化县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610431','武功县','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610481','兴平市','610400','1',NULL,NULL,NULL,NULL,NULL,NULL),('610500','渭南市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610502','临渭区','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610503','华州区','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610522','潼关县','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610523','大荔县','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610524','合阳县','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610525','澄城县','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610526','蒲城县','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610527','白水县','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610528','富平县','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610581','韩城市','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610582','华阴市','610500','1',NULL,NULL,NULL,NULL,NULL,NULL),('610600','延安市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610602','宝塔区','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610603','安塞区','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610621','延长县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610622','延川县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610623','子长县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610625','志丹县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610626','吴起县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610627','甘泉县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610628','富县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610629','洛川县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610630','宜川县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610631','黄龙县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610632','黄陵县','610600','1',NULL,NULL,NULL,NULL,NULL,NULL),('610700','汉中市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610702','汉台区','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610721','南郑县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610722','城固县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610723','洋县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610724','西乡县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610725','勉县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610726','宁强县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610727','略阳县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610728','镇巴县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610729','留坝县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610730','佛坪县','610700','1',NULL,NULL,NULL,NULL,NULL,NULL),('610800','榆林市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610802','榆阳区','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610803','横山区','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610821','神木县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610822','府谷县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610824','靖边县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610825','定边县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610826','绥德县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610827','米脂县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610828','佳县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610829','吴堡县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610830','清涧县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610831','子洲县','610800','1',NULL,NULL,NULL,NULL,NULL,NULL),('610900','安康市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('610902','汉滨区','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610921','汉阴县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610922','石泉县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610923','宁陕县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610924','紫阳县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610925','岚皋县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610926','平利县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610927','镇坪县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610928','旬阳县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('610929','白河县','610900','1',NULL,NULL,NULL,NULL,NULL,NULL),('611000','商洛市','610000','1',NULL,NULL,NULL,NULL,NULL,NULL),('611002','商州区','611000','1',NULL,NULL,NULL,NULL,NULL,NULL),('611021','洛南县','611000','1',NULL,NULL,NULL,NULL,NULL,NULL),('611022','丹凤县','611000','1',NULL,NULL,NULL,NULL,NULL,NULL),('611023','商南县','611000','1',NULL,NULL,NULL,NULL,NULL,NULL),('611024','山阳县','611000','1',NULL,NULL,NULL,NULL,NULL,NULL),('611025','镇安县','611000','1',NULL,NULL,NULL,NULL,NULL,NULL),('611026','柞水县','611000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620000','甘肃省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('620100','兰州市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620102','城关区','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620103','七里河区','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620104','西固区','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620105','安宁区','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620111','红古区','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620121','永登县','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620122','皋兰县','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620123','榆中县','620100','1',NULL,NULL,NULL,NULL,NULL,NULL),('620200','嘉峪关市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620300','金昌市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620302','金川区','620300','1',NULL,NULL,NULL,NULL,NULL,NULL),('620321','永昌县','620300','1',NULL,NULL,NULL,NULL,NULL,NULL),('620400','白银市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620402','白银区','620400','1',NULL,NULL,NULL,NULL,NULL,NULL),('620403','平川区','620400','1',NULL,NULL,NULL,NULL,NULL,NULL),('620421','靖远县','620400','1',NULL,NULL,NULL,NULL,NULL,NULL),('620422','会宁县','620400','1',NULL,NULL,NULL,NULL,NULL,NULL),('620423','景泰县','620400','1',NULL,NULL,NULL,NULL,NULL,NULL),('620500','天水市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620502','秦州区','620500','1',NULL,NULL,NULL,NULL,NULL,NULL),('620503','麦积区','620500','1',NULL,NULL,NULL,NULL,NULL,NULL),('620521','清水县','620500','1',NULL,NULL,NULL,NULL,NULL,NULL),('620522','秦安县','620500','1',NULL,NULL,NULL,NULL,NULL,NULL),('620523','甘谷县','620500','1',NULL,NULL,NULL,NULL,NULL,NULL),('620524','武山县','620500','1',NULL,NULL,NULL,NULL,NULL,NULL),('620525','张家川回族自治县','620500','1',NULL,NULL,NULL,NULL,NULL,NULL),('620600','武威市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620602','凉州区','620600','1',NULL,NULL,NULL,NULL,NULL,NULL),('620621','民勤县','620600','1',NULL,NULL,NULL,NULL,NULL,NULL),('620622','古浪县','620600','1',NULL,NULL,NULL,NULL,NULL,NULL),('620623','天祝藏族自治县','620600','1',NULL,NULL,NULL,NULL,NULL,NULL),('620700','张掖市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620702','甘州区','620700','1',NULL,NULL,NULL,NULL,NULL,NULL),('620721','肃南裕固族自治县','620700','1',NULL,NULL,NULL,NULL,NULL,NULL),('620722','民乐县','620700','1',NULL,NULL,NULL,NULL,NULL,NULL),('620723','临泽县','620700','1',NULL,NULL,NULL,NULL,NULL,NULL),('620724','高台县','620700','1',NULL,NULL,NULL,NULL,NULL,NULL),('620725','山丹县','620700','1',NULL,NULL,NULL,NULL,NULL,NULL),('620800','平凉市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620802','崆峒区','620800','1',NULL,NULL,NULL,NULL,NULL,NULL),('620821','泾川县','620800','1',NULL,NULL,NULL,NULL,NULL,NULL),('620822','灵台县','620800','1',NULL,NULL,NULL,NULL,NULL,NULL),('620823','崇信县','620800','1',NULL,NULL,NULL,NULL,NULL,NULL),('620824','华亭县','620800','1',NULL,NULL,NULL,NULL,NULL,NULL),('620825','庄浪县','620800','1',NULL,NULL,NULL,NULL,NULL,NULL),('620826','静宁县','620800','1',NULL,NULL,NULL,NULL,NULL,NULL),('620900','酒泉市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('620902','肃州区','620900','1',NULL,NULL,NULL,NULL,NULL,NULL),('620921','金塔县','620900','1',NULL,NULL,NULL,NULL,NULL,NULL),('620922','瓜州县','620900','1',NULL,NULL,NULL,NULL,NULL,NULL),('620923','肃北蒙古族自治县','620900','1',NULL,NULL,NULL,NULL,NULL,NULL),('620924','阿克塞哈萨克族自治县','620900','1',NULL,NULL,NULL,NULL,NULL,NULL),('620981','玉门市','620900','1',NULL,NULL,NULL,NULL,NULL,NULL),('620982','敦煌市','620900','1',NULL,NULL,NULL,NULL,NULL,NULL),('621000','庆阳市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621002','西峰区','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621021','庆城县','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621022','环县','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621023','华池县','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621024','合水县','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621025','正宁县','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621026','宁县','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621027','镇原县','621000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621100','定西市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621102','安定区','621100','1',NULL,NULL,NULL,NULL,NULL,NULL),('621121','通渭县','621100','1',NULL,NULL,NULL,NULL,NULL,NULL),('621122','陇西县','621100','1',NULL,NULL,NULL,NULL,NULL,NULL),('621123','渭源县','621100','1',NULL,NULL,NULL,NULL,NULL,NULL),('621124','临洮县','621100','1',NULL,NULL,NULL,NULL,NULL,NULL),('621125','漳县','621100','1',NULL,NULL,NULL,NULL,NULL,NULL),('621126','岷县','621100','1',NULL,NULL,NULL,NULL,NULL,NULL),('621200','陇南市','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('621202','武都区','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621221','成县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621222','文县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621223','宕昌县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621224','康县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621225','西和县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621226','礼县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621227','徽县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('621228','两当县','621200','1',NULL,NULL,NULL,NULL,NULL,NULL),('622900','临夏回族自治州','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('622901','临夏市','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('622921','临夏县','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('622922','康乐县','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('622923','永靖县','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('622924','广河县','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('622925','和政县','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('622926','东乡族自治县','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('622927','积石山保安族东乡族撒拉族自治县','622900','1',NULL,NULL,NULL,NULL,NULL,NULL),('623000','甘南藏族自治州','620000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623001','合作市','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623021','临潭县','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623022','卓尼县','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623023','舟曲县','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623024','迭部县','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623025','玛曲县','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623026','碌曲县','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('623027','夏河县','623000','1',NULL,NULL,NULL,NULL,NULL,NULL),('630000','青海省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('630100','西宁市','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('630102','城东区','630100','1',NULL,NULL,NULL,NULL,NULL,NULL),('630103','城中区','630100','1',NULL,NULL,NULL,NULL,NULL,NULL),('630104','城西区','630100','1',NULL,NULL,NULL,NULL,NULL,NULL),('630105','城北区','630100','1',NULL,NULL,NULL,NULL,NULL,NULL),('630121','大通回族土族自治县','630100','1',NULL,NULL,NULL,NULL,NULL,NULL),('630122','湟中县','630100','1',NULL,NULL,NULL,NULL,NULL,NULL),('630123','湟源县','630100','1',NULL,NULL,NULL,NULL,NULL,NULL),('630200','海东市','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('630202','乐都区','630200','1',NULL,NULL,NULL,NULL,NULL,NULL),('630203','平安区','630200','1',NULL,NULL,NULL,NULL,NULL,NULL),('630222','民和回族土族自治县','630200','1',NULL,NULL,NULL,NULL,NULL,NULL),('630223','互助土族自治县','630200','1',NULL,NULL,NULL,NULL,NULL,NULL),('630224','化隆回族自治县','630200','1',NULL,NULL,NULL,NULL,NULL,NULL),('630225','循化撒拉族自治县','630200','1',NULL,NULL,NULL,NULL,NULL,NULL),('632200','海北藏族自治州','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('632221','门源回族自治县','632200','1',NULL,NULL,NULL,NULL,NULL,NULL),('632222','祁连县','632200','1',NULL,NULL,NULL,NULL,NULL,NULL),('632223','海晏县','632200','1',NULL,NULL,NULL,NULL,NULL,NULL),('632224','刚察县','632200','1',NULL,NULL,NULL,NULL,NULL,NULL),('632300','黄南藏族自治州','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('632321','同仁县','632300','1',NULL,NULL,NULL,NULL,NULL,NULL),('632322','尖扎县','632300','1',NULL,NULL,NULL,NULL,NULL,NULL),('632323','泽库县','632300','1',NULL,NULL,NULL,NULL,NULL,NULL),('632324','河南蒙古族自治县','632300','1',NULL,NULL,NULL,NULL,NULL,NULL),('632500','海南藏族自治州','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('632521','共和县','632500','1',NULL,NULL,NULL,NULL,NULL,NULL),('632522','同德县','632500','1',NULL,NULL,NULL,NULL,NULL,NULL),('632523','贵德县','632500','1',NULL,NULL,NULL,NULL,NULL,NULL),('632524','兴海县','632500','1',NULL,NULL,NULL,NULL,NULL,NULL),('632525','贵南县','632500','1',NULL,NULL,NULL,NULL,NULL,NULL),('632600','果洛藏族自治州','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('632621','玛沁县','632600','1',NULL,NULL,NULL,NULL,NULL,NULL),('632622','班玛县','632600','1',NULL,NULL,NULL,NULL,NULL,NULL),('632623','甘德县','632600','1',NULL,NULL,NULL,NULL,NULL,NULL),('632624','达日县','632600','1',NULL,NULL,NULL,NULL,NULL,NULL),('632625','久治县','632600','1',NULL,NULL,NULL,NULL,NULL,NULL),('632626','玛多县','632600','1',NULL,NULL,NULL,NULL,NULL,NULL),('632700','玉树藏族自治州','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('632701','玉树市','632700','1',NULL,NULL,NULL,NULL,NULL,NULL),('632722','杂多县','632700','1',NULL,NULL,NULL,NULL,NULL,NULL),('632723','称多县','632700','1',NULL,NULL,NULL,NULL,NULL,NULL),('632724','治多县','632700','1',NULL,NULL,NULL,NULL,NULL,NULL),('632725','囊谦县','632700','1',NULL,NULL,NULL,NULL,NULL,NULL),('632726','曲麻莱县','632700','1',NULL,NULL,NULL,NULL,NULL,NULL),('632800','海西蒙古族藏族自治州','630000','1',NULL,NULL,NULL,NULL,NULL,NULL),('632801','格尔木市','632800','1',NULL,NULL,NULL,NULL,NULL,NULL),('632802','德令哈市','632800','1',NULL,NULL,NULL,NULL,NULL,NULL),('632821','乌兰县','632800','1',NULL,NULL,NULL,NULL,NULL,NULL),('632822','都兰县','632800','1',NULL,NULL,NULL,NULL,NULL,NULL),('632823','天峻县','632800','1',NULL,NULL,NULL,NULL,NULL,NULL),('640000','宁夏回族自治区',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('640100','银川市','640000','1',NULL,NULL,NULL,NULL,NULL,NULL),('640104','兴庆区','640100','1',NULL,NULL,NULL,NULL,NULL,NULL),('640105','西夏区','640100','1',NULL,NULL,NULL,NULL,NULL,NULL),('640106','金凤区','640100','1',NULL,NULL,NULL,NULL,NULL,NULL),('640121','永宁县','640100','1',NULL,NULL,NULL,NULL,NULL,NULL),('640122','贺兰县','640100','1',NULL,NULL,NULL,NULL,NULL,NULL),('640181','灵武市','640100','1',NULL,NULL,NULL,NULL,NULL,NULL),('640200','石嘴山市','640000','1',NULL,NULL,NULL,NULL,NULL,NULL),('640202','大武口区','640200','1',NULL,NULL,NULL,NULL,NULL,NULL),('640205','惠农区','640200','1',NULL,NULL,NULL,NULL,NULL,NULL),('640221','平罗县','640200','1',NULL,NULL,NULL,NULL,NULL,NULL),('640300','吴忠市','640000','1',NULL,NULL,NULL,NULL,NULL,NULL),('640302','利通区','640300','1',NULL,NULL,NULL,NULL,NULL,NULL),('640303','红寺堡区','640300','1',NULL,NULL,NULL,NULL,NULL,NULL),('640323','盐池县','640300','1',NULL,NULL,NULL,NULL,NULL,NULL),('640324','同心县','640300','1',NULL,NULL,NULL,NULL,NULL,NULL),('640381','青铜峡市','640300','1',NULL,NULL,NULL,NULL,NULL,NULL),('640400','固原市','640000','1',NULL,NULL,NULL,NULL,NULL,NULL),('640402','原州区','640400','1',NULL,NULL,NULL,NULL,NULL,NULL),('640422','西吉县','640400','1',NULL,NULL,NULL,NULL,NULL,NULL),('640423','隆德县','640400','1',NULL,NULL,NULL,NULL,NULL,NULL),('640424','泾源县','640400','1',NULL,NULL,NULL,NULL,NULL,NULL),('640425','彭阳县','640400','1',NULL,NULL,NULL,NULL,NULL,NULL),('640500','中卫市','640000','1',NULL,NULL,NULL,NULL,NULL,NULL),('640502','沙坡头区','640500','1',NULL,NULL,NULL,NULL,NULL,NULL),('640521','中宁县','640500','1',NULL,NULL,NULL,NULL,NULL,NULL),('640522','海原县','640500','1',NULL,NULL,NULL,NULL,NULL,NULL),('650000','新疆维吾尔自治区',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('650100','乌鲁木齐市','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('650102','天山区','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650103','沙依巴克区','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650104','新市区','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650105','水磨沟区','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650106','头屯河区','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650107','达坂城区','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650109','米东区','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650121','乌鲁木齐县','650100','1',NULL,NULL,NULL,NULL,NULL,NULL),('650200','克拉玛依市','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('650202','独山子区','650200','1',NULL,NULL,NULL,NULL,NULL,NULL),('650203','克拉玛依区','650200','1',NULL,NULL,NULL,NULL,NULL,NULL),('650204','白碱滩区','650200','1',NULL,NULL,NULL,NULL,NULL,NULL),('650205','乌尔禾区','650200','1',NULL,NULL,NULL,NULL,NULL,NULL),('650400','吐鲁番市','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('650402','高昌区','650400','1',NULL,NULL,NULL,NULL,NULL,NULL),('650421','鄯善县','650400','1',NULL,NULL,NULL,NULL,NULL,NULL),('650422','托克逊县','650400','1',NULL,NULL,NULL,NULL,NULL,NULL),('650500','哈密市','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('650502','伊州区','650500','1',NULL,NULL,NULL,NULL,NULL,NULL),('650521','巴里坤哈萨克自治县','650500','1',NULL,NULL,NULL,NULL,NULL,NULL),('650522','伊吾县','650500','1',NULL,NULL,NULL,NULL,NULL,NULL),('652300','昌吉回族自治州','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('652301','昌吉市','652300','1',NULL,NULL,NULL,NULL,NULL,NULL),('652302','阜康市','652300','1',NULL,NULL,NULL,NULL,NULL,NULL),('652323','呼图壁县','652300','1',NULL,NULL,NULL,NULL,NULL,NULL),('652324','玛纳斯县','652300','1',NULL,NULL,NULL,NULL,NULL,NULL),('652325','奇台县','652300','1',NULL,NULL,NULL,NULL,NULL,NULL),('652327','吉木萨尔县','652300','1',NULL,NULL,NULL,NULL,NULL,NULL),('652328','木垒哈萨克自治县','652300','1',NULL,NULL,NULL,NULL,NULL,NULL),('652700','博尔塔拉蒙古自治州','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('652701','博乐市','652700','1',NULL,NULL,NULL,NULL,NULL,NULL),('652702','阿拉山口市','652700','1',NULL,NULL,NULL,NULL,NULL,NULL),('652722','精河县','652700','1',NULL,NULL,NULL,NULL,NULL,NULL),('652723','温泉县','652700','1',NULL,NULL,NULL,NULL,NULL,NULL),('652800','巴音郭楞蒙古自治州','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('652801','库尔勒市','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652822','轮台县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652823','尉犁县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652824','若羌县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652825','且末县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652826','焉耆回族自治县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652827','和静县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652828','和硕县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652829','博湖县','652800','1',NULL,NULL,NULL,NULL,NULL,NULL),('652900','阿克苏地区','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('652901','阿克苏市','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652922','温宿县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652923','库车县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652924','沙雅县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652925','新和县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652926','拜城县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652927','乌什县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652928','阿瓦提县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('652929','柯坪县','652900','1',NULL,NULL,NULL,NULL,NULL,NULL),('653000','克孜勒苏柯尔克孜自治州','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('653001','阿图什市','653000','1',NULL,NULL,NULL,NULL,NULL,NULL),('653022','阿克陶县','653000','1',NULL,NULL,NULL,NULL,NULL,NULL),('653023','阿合奇县','653000','1',NULL,NULL,NULL,NULL,NULL,NULL),('653024','乌恰县','653000','1',NULL,NULL,NULL,NULL,NULL,NULL),('653100','喀什地区','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('653101','喀什市','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653121','疏附县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653122','疏勒县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653123','英吉沙县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653124','泽普县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653125','莎车县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653126','叶城县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653127','麦盖提县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653128','岳普湖县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653129','伽师县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653130','巴楚县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653131','塔什库尔干塔吉克自治县','653100','1',NULL,NULL,NULL,NULL,NULL,NULL),('653200','和田地区','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('653201','和田市','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('653221','和田县','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('653222','墨玉县','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('653223','皮山县','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('653224','洛浦县','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('653225','策勒县','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('653226','于田县','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('653227','民丰县','653200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654000','伊犁哈萨克自治州','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654002','伊宁市','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654003','奎屯市','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654004','霍尔果斯市','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654021','伊宁县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654022','察布查尔锡伯自治县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654023','霍城县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654024','巩留县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654025','新源县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654026','昭苏县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654027','特克斯县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654028','尼勒克县','654000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654200','塔城地区','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654201','塔城市','654200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654202','乌苏市','654200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654221','额敏县','654200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654223','沙湾县','654200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654224','托里县','654200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654225','裕民县','654200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654226','和布克赛尔蒙古自治县','654200','1',NULL,NULL,NULL,NULL,NULL,NULL),('654300','阿勒泰地区','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('654301','阿勒泰市','654300','1',NULL,NULL,NULL,NULL,NULL,NULL),('654321','布尔津县','654300','1',NULL,NULL,NULL,NULL,NULL,NULL),('654322','富蕴县','654300','1',NULL,NULL,NULL,NULL,NULL,NULL),('654323','福海县','654300','1',NULL,NULL,NULL,NULL,NULL,NULL),('654324','哈巴河县','654300','1',NULL,NULL,NULL,NULL,NULL,NULL),('654325','青河县','654300','1',NULL,NULL,NULL,NULL,NULL,NULL),('654326','吉木乃县','654300','1',NULL,NULL,NULL,NULL,NULL,NULL),('659000','自治区直辖县级行政区划','650000','1',NULL,NULL,NULL,NULL,NULL,NULL),('659001','石河子市','659000','1',NULL,NULL,NULL,NULL,NULL,NULL),('659002','阿拉尔市','659000','1',NULL,NULL,NULL,NULL,NULL,NULL),('659003','图木舒克市','659000','1',NULL,NULL,NULL,NULL,NULL,NULL),('659004','五家渠市','659000','1',NULL,NULL,NULL,NULL,NULL,NULL),('659006','铁门关市','659000','1',NULL,NULL,NULL,NULL,NULL,NULL),('710000','台湾省',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('810000','香港特别行政区',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL),('820000','澳门特别行政区',NULL,'1',NULL,NULL,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `tb_areas` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_backlog`
--

DROP TABLE IF EXISTS `tb_backlog`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_backlog` (
  `id` bigint NOT NULL,
  `batchid` int NOT NULL,
  `age` int DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `scalar` decimal(18,4) DEFAULT NULL,
  `createat` date DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `stocks_scalar` decimal(18,4) DEFAULT NULL,
  `lastprice` decimal(18,4) DEFAULT NULL,
  `busiid` bigint DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_backlog`
--

LOCK TABLES `tb_backlog` WRITE;
/*!40000 ALTER TABLE `tb_backlog` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_backlog` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_batch`
--

DROP TABLE IF EXISTS `tb_batch`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_batch` (
  `batchid` int NOT NULL,
  `storeid` bigint NOT NULL,
  `id` bigint NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `bidprice` decimal(18,4) DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `lastprice` decimal(18,4) DEFAULT NULL,
  `curdate` date DEFAULT NULL,
  `age` int DEFAULT NULL,
  `cycle` int DEFAULT NULL,
  `isdrug` tinyint DEFAULT NULL,
  PRIMARY KEY (`batchid`,`storeid`) USING BTREE,
  KEY `batchid` (`batchid`,`storeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_batch`
--

LOCK TABLES `tb_batch` WRITE;
/*!40000 ALTER TABLE `tb_batch` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_batch` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_batch_info`
--

DROP TABLE IF EXISTS `tb_batch_info`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_batch_info` (
  `batchid` int NOT NULL AUTO_INCREMENT,
  `id` bigint NOT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `recno` int DEFAULT NULL,
  `shelfno` varchar(50) DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `whole` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`batchid`) USING BTREE,
  KEY `batchid` (`batchid`,`id`,`batch`),
  KEY `id` (`id`,`batch`)
) ENGINE=InnoDB AUTO_INCREMENT=76234 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_batch_info`
--

LOCK TABLES `tb_batch_info` WRITE;
/*!40000 ALTER TABLE `tb_batch_info` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_batch_info` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_below`
--

DROP TABLE IF EXISTS `tb_below`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_below` (
  `id` bigint NOT NULL,
  `batchid` int NOT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `departno` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`,`batchid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_below`
--

LOCK TABLES `tb_below` WRITE;
/*!40000 ALTER TABLE `tb_below` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_below` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_carrier`
--

DROP TABLE IF EXISTS `tb_carrier`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_carrier` (
  `carrierid` bigint NOT NULL,
  `carrier_code` varchar(10) DEFAULT NULL,
  `carrier_no` varchar(10) DEFAULT NULL,
  `carrier_name` varchar(50) DEFAULT NULL,
  `transport` varchar(50) DEFAULT NULL,
  `transportno` varchar(50) DEFAULT NULL,
  `permit` varchar(50) DEFAULT NULL,
  `head_name` varchar(20) DEFAULT NULL,
  `phone` varchar(50) DEFAULT NULL,
  `transportdrug` varchar(50) DEFAULT NULL,
  `address` varchar(100) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `spell` varchar(50) DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  PRIMARY KEY (`carrierid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_carrier`
--

LOCK TABLES `tb_carrier` WRITE;
/*!40000 ALTER TABLE `tb_carrier` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_carrier` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_category`
--

DROP TABLE IF EXISTS `tb_category`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_category` (
  `category_id` bigint NOT NULL,
  `category_name` varchar(50) DEFAULT NULL,
  `parentid` bigint DEFAULT NULL,
  PRIMARY KEY (`category_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_category`
--

LOCK TABLES `tb_category` WRITE;
/*!40000 ALTER TABLE `tb_category` DISABLE KEYS */;
INSERT INTO `tb_category` VALUES (386125012168773,'中药',-1),(386125065736261,'西药',-1),(386125132476485,'中成药',386125012168773),(386125196234821,'中药饮片',386125012168773),(386125239218245,'中药材',386125012168773),(386125328912453,'中药超微颗粒',386125012168773),(386125407715397,'抗生素制剂',386125065736261),(386140022534213,'生化药品',386125065736261),(386140083544133,'生物制剂',386125065736261),(386140164943941,'消毒用品',-1),(386140230008901,'保健食品',-1),(398230954602565,'含特殊药品复方制剂',-1);
/*!40000 ALTER TABLE `tb_category` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_curing`
--

DROP TABLE IF EXISTS `tb_curing`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_curing` (
  `orderid` int NOT NULL,
  `user_id` bigint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `curing_type` tinyint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `cycle` int DEFAULT NULL,
  PRIMARY KEY (`orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_curing`
--

LOCK TABLES `tb_curing` WRITE;
/*!40000 ALTER TABLE `tb_curing` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_curing` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_curing_detailed`
--

DROP TABLE IF EXISTS `tb_curing_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_curing_detailed` (
  `orderid` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `recno` int NOT NULL,
  `storeid` bigint DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `scalar` decimal(18,2) DEFAULT NULL,
  `quality_condition` varchar(10) DEFAULT NULL,
  `verdict` varchar(10) DEFAULT NULL,
  `opinion` varchar(10) DEFAULT NULL,
  `stop_scalar` decimal(18,2) DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_curing_detailed`
--

LOCK TABLES `tb_curing_detailed` WRITE;
/*!40000 ALTER TABLE `tb_curing_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_curing_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_curing_record`
--

DROP TABLE IF EXISTS `tb_curing_record`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_curing_record` (
  `id` bigint NOT NULL,
  `batchid` int DEFAULT NULL,
  `curing_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `createdate` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_curing_record`
--

LOCK TABLES `tb_curing_record` WRITE;
/*!40000 ALTER TABLE `tb_curing_record` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_curing_record` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_department`
--

DROP TABLE IF EXISTS `tb_department`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_department` (
  `departid` bigint NOT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `depart_name` varchar(50) DEFAULT NULL,
  `parentid` bigint DEFAULT NULL,
  `isactive` tinyint DEFAULT '1',
  PRIMARY KEY (`departid`),
  UNIQUE KEY `departno` (`departno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_department`
--

LOCK TABLES `tb_department` WRITE;
/*!40000 ALTER TABLE `tb_department` DISABLE KEYS */;
INSERT INTO `tb_department` VALUES (389332817969221,'000001','一部',999,1),(389332860600389,'000002','二部',999,1),(416160983089221,'000003','三部',389332817969221,1);
/*!40000 ALTER TABLE `tb_department` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_device`
--

DROP TABLE IF EXISTS `tb_device`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_device` (
  `devid` bigint NOT NULL,
  `devcode` varchar(20) DEFAULT NULL,
  `devno` varchar(10) DEFAULT NULL,
  `devname` varchar(50) DEFAULT NULL,
  `devmodel` varchar(50) DEFAULT NULL,
  `producer` varchar(50) DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,2) DEFAULT NULL,
  `unit` varchar(10) DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `position` varchar(50) DEFAULT NULL,
  `keeper` varchar(20) DEFAULT NULL,
  `remarks` varchar(255) DEFAULT NULL,
  `states` tinyint DEFAULT '1',
  `receivdate` date DEFAULT NULL,
  PRIMARY KEY (`devid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_device`
--

LOCK TABLES `tb_device` WRITE;
/*!40000 ALTER TABLE `tb_device` DISABLE KEYS */;
INSERT INTO `tb_device` VALUES (418007620599877,'A-001','000001','空调','23','格力',2.000,8000.00,'0','2023-05-16','仓库','小王','备注',0,'2023-05-16'),(418009252384837,'B-002','000002','电脑22222','AB','联想',1.000,5000.00,'台','2023-05-01','办公室','小张','备注',0,'2023-05-16');
/*!40000 ALTER TABLE `tb_device` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_device_record`
--

DROP TABLE IF EXISTS `tb_device_record`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_device_record` (
  `recordid` bigint NOT NULL,
  `devid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `begin_time` time DEFAULT NULL,
  `stop_time` time DEFAULT NULL,
  `reson` varchar(100) DEFAULT NULL,
  `content` varchar(100) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  PRIMARY KEY (`recordid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_device_record`
--

LOCK TABLES `tb_device_record` WRITE;
/*!40000 ALTER TABLE `tb_device_record` DISABLE KEYS */;
INSERT INTO `tb_device_record` VALUES (435272823390277,418007620599877,'2023-07-01','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272825466949,418007620599877,'2023-07-02','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272827523141,418007620599877,'2023-07-03','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272829632581,418007620599877,'2023-07-04','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272831733829,418007620599877,'2023-07-05','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272833843269,418007620599877,'2023-07-06','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272835940421,418007620599877,'2023-07-07','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272838049861,418007620599877,'2023-07-08','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272840151109,418007620599877,'2023-07-09','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272842252357,418007620599877,'2023-07-10','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272844308549,418007620599877,'2023-07-11','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272846409797,418007620599877,'2023-07-12','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272848478277,418007620599877,'2023-07-13','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272850575429,418007620599877,'2023-07-14','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272852684869,418007620599877,'2023-07-15','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272854790213,418007620599877,'2023-07-16','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272856899653,418007620599877,'2023-07-17','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272858996805,418007620599877,'2023-07-18','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272861089861,418007620599877,'2023-07-19','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272863199301,418007620599877,'2023-07-20','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272865308741,418007620599877,'2023-07-21','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272867360837,418007620599877,'2023-07-22','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272869474373,418007620599877,'2023-07-23','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272871522373,418007620599877,'2023-07-24','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272873615429,418007620599877,'2023-07-25','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272875728965,418007620599877,'2023-07-26','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272877830213,418007620599877,'2023-07-27','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272879923269,418007620599877,'2023-07-28','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272882028613,418007620599877,'2023-07-29','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272884080709,418007620599877,'2023-07-30','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272886190149,418007620599877,'2023-07-31','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272888299589,418009252384837,'2023-07-01','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272890413125,418009252384837,'2023-07-02','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272892465221,418009252384837,'2023-07-03','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272894570565,418009252384837,'2023-07-04','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272896675909,418009252384837,'2023-07-05','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272898728005,418009252384837,'2023-07-06','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272900792389,418009252384837,'2023-07-07','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272902901829,418009252384837,'2023-07-08','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272904994885,418009252384837,'2023-07-09','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272907087941,418009252384837,'2023-07-10','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272909180997,418009252384837,'2023-07-11','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272911269957,418009252384837,'2023-07-12','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272913363013,418009252384837,'2023-07-13','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272915419205,418009252384837,'2023-07-14','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272917532741,418009252384837,'2023-07-15','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272919588933,418009252384837,'2023-07-16','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272921681989,418009252384837,'2023-07-17','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272923734085,418009252384837,'2023-07-18','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272925835333,418009252384837,'2023-07-19','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272927940677,418009252384837,'2023-07-20','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272929992773,418009252384837,'2023-07-21','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272932044869,418009252384837,'2023-07-22','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272934101061,418009252384837,'2023-07-23','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272936210501,418009252384837,'2023-07-24','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272938262597,418009252384837,'2023-07-25','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272940372037,418009252384837,'2023-07-26','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272942481477,418009252384837,'2023-07-27','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272944578629,418009252384837,'2023-07-28','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272946671685,418009252384837,'2023-07-29','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272948736069,418009252384837,'2023-07-30','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435272950833221,418009252384837,'2023-07-31','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(435273180532805,418009252384837,'2023-07-01','08:00:00','17:30:00','阴凉库温度高于20度','开启空调','每天开启',386790080102469),(476440247050309,418007620599877,'2023-10-28','08:00:00','17:30:00','','','',386790080102469),(476440249126981,418007620599877,'2023-10-29','08:00:00','17:30:00','','','',386790080102469),(476440251191365,418007620599877,'2023-10-30','08:00:00','17:30:00','','','',386790080102469),(476440253268037,418007620599877,'2023-10-31','08:00:00','17:30:00','','','',386790080102469);
/*!40000 ALTER TABLE `tb_device_record` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise`
--

DROP TABLE IF EXISTS `tb_enterprise`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise` (
  `busiid` bigint NOT NULL,
  `ecode` varchar(10) DEFAULT NULL,
  `ename` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `linkman` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `phone` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `bank` varchar(20) DEFAULT NULL,
  `bankcode` varchar(30) DEFAULT NULL,
  `tel` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `busipermit` varchar(30) DEFAULT NULL,
  `drugspermit` varchar(30) DEFAULT NULL,
  `drugsdate` date DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `busicope` varchar(255) DEFAULT NULL,
  `spell` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `partyamount` decimal(18,2) DEFAULT '0.00',
  `payeramount` decimal(18,2) DEFAULT '0.00',
  `taxno` varchar(50) DEFAULT NULL,
  `storeaddress` varchar(255) DEFAULT NULL,
  `shipaddress` varchar(255) DEFAULT NULL,
  `receiver` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `recphone` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `category` tinyint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `createby` bigint DEFAULT NULL,
  `isroval` tinyint DEFAULT NULL,
  `docuno` varchar(50) DEFAULT NULL,
  `isfor` tinyint DEFAULT NULL,
  `issale` tinyint DEFAULT NULL,
  `ispro` tinyint DEFAULT NULL,
  `frontamount` decimal(18,2) DEFAULT NULL,
  `gmppermit` varchar(50) DEFAULT NULL,
  `gmpdate` date DEFAULT NULL,
  `headbyname` varchar(20) DEFAULT NULL,
  `head_phone` varchar(20) DEFAULT NULL,
  `qualitybyname` varchar(20) DEFAULT NULL,
  `quality_phone` varchar(20) DEFAULT NULL,
  `gradeid` bigint DEFAULT NULL,
  `region_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legal_person` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalby` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalbyname` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `salecard` varchar(20) DEFAULT NULL,
  `salephone` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legaldate` date DEFAULT NULL,
  `qualityby` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `qualitydate` date DEFAULT NULL,
  `zipcode` varchar(10) DEFAULT NULL,
  `busi_check` varchar(50) DEFAULT NULL,
  `busi_year` date DEFAULT NULL,
  `province_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `city_name` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `typeid` bigint DEFAULT NULL,
  `islock` tinyint DEFAULT NULL,
  `nature` tinyint DEFAULT NULL,
  `chaincode` varchar(10) DEFAULT NULL,
  `regioncode` varchar(10) DEFAULT NULL,
  `seal_path` varchar(100) DEFAULT NULL,
  `medcode` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`busiid`),
  UNIQUE KEY `ecode` (`ecode`) USING BTREE,
  KEY `ename` (`ename`),
  KEY `spellcode` (`spell`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise`
--

LOCK TABLES `tb_enterprise` WRITE;
/*!40000 ALTER TABLE `tb_enterprise` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_enterprise` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise_cope`
--

DROP TABLE IF EXISTS `tb_enterprise_cope`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise_cope` (
  `copeid` bigint NOT NULL,
  `copeno` varchar(10) DEFAULT NULL,
  `busicope` varchar(50) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`copeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise_cope`
--

LOCK TABLES `tb_enterprise_cope` WRITE;
/*!40000 ALTER TABLE `tb_enterprise_cope` DISABLE KEYS */;
INSERT INTO `tb_enterprise_cope` VALUES (384332470353989,'1','中成药',''),(384332544569413,'2','中药材',''),(384333951946821,'3','中药饮片',''),(384333985550405,'4','中药配方颗粒',''),(384334014861381,'5','化学药制剂',''),(384334049034309,'6','抗生素制剂',''),(384334075146309,'7','生化药品',''),(384334189715525,'8','生物制品',''),(384334216781893,'9','蛋白同化制剂',''),(384334246850629,'10','肽类激素',''),(384334277750853,'11','含麻磺碱复方制剂',''),(384334300012613,'12','消毒用品',''),(384334328123461,'13','保健食品','');
/*!40000 ALTER TABLE `tb_enterprise_cope` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise_cope_used`
--

DROP TABLE IF EXISTS `tb_enterprise_cope_used`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise_cope_used` (
  `copeid` bigint NOT NULL,
  `copeno` varchar(10) DEFAULT NULL,
  `busicope` varchar(50) DEFAULT NULL,
  `busiid` bigint NOT NULL,
  `isused` tinyint DEFAULT '0',
  `remarks` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`copeid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise_cope_used`
--

LOCK TABLES `tb_enterprise_cope_used` WRITE;
/*!40000 ALTER TABLE `tb_enterprise_cope_used` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_enterprise_cope_used` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise_doc`
--

DROP TABLE IF EXISTS `tb_enterprise_doc`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise_doc` (
  `docid` bigint NOT NULL,
  `docname` varchar(50) DEFAULT NULL,
  `docno` varchar(20) DEFAULT NULL,
  `for_need` tinyint DEFAULT NULL,
  `sale_need` tinyint DEFAULT NULL,
  `pro_need` tinyint DEFAULT NULL,
  `busiid` bigint NOT NULL,
  `startdate` varchar(10) DEFAULT NULL,
  `enddate` varchar(10) DEFAULT NULL,
  `permitno` varchar(100) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `islack` tinyint DEFAULT NULL,
  PRIMARY KEY (`docid`,`busiid`),
  KEY `enddate` (`enddate`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise_doc`
--

LOCK TABLES `tb_enterprise_doc` WRITE;
/*!40000 ALTER TABLE `tb_enterprise_doc` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_enterprise_doc` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise_doc_list`
--

DROP TABLE IF EXISTS `tb_enterprise_doc_list`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise_doc_list` (
  `docid` bigint NOT NULL,
  `docno` varchar(20) DEFAULT NULL,
  `docname` varchar(50) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `for_need` tinyint DEFAULT '0',
  `sale_need` tinyint DEFAULT '0',
  `pro_need` tinyint DEFAULT '0',
  PRIMARY KEY (`docid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise_doc_list`
--

LOCK TABLES `tb_enterprise_doc_list` WRITE;
/*!40000 ALTER TABLE `tb_enterprise_doc_list` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_enterprise_doc_list` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise_first_check`
--

DROP TABLE IF EXISTS `tb_enterprise_first_check`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise_first_check` (
  `checkid` bigint NOT NULL,
  `user_id` bigint DEFAULT NULL,
  `isdrugs` tinyint DEFAULT NULL,
  `isapparatus` tinyint DEFAULT NULL,
  `isother` tinyint DEFAULT NULL,
  `content` varchar(100) DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `isgmp` tinyint DEFAULT NULL,
  `issale` tinyint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  PRIMARY KEY (`checkid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise_first_check`
--

LOCK TABLES `tb_enterprise_first_check` WRITE;
/*!40000 ALTER TABLE `tb_enterprise_first_check` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_enterprise_first_check` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise_grade`
--

DROP TABLE IF EXISTS `tb_enterprise_grade`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise_grade` (
  `gradeid` bigint NOT NULL,
  `grade_name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `limit_scalar` decimal(18,3) DEFAULT NULL,
  PRIMARY KEY (`gradeid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise_grade`
--

LOCK TABLES `tb_enterprise_grade` WRITE;
/*!40000 ALTER TABLE `tb_enterprise_grade` DISABLE KEYS */;
INSERT INTO `tb_enterprise_grade` VALUES (740055669960773,'A',1000.000);
/*!40000 ALTER TABLE `tb_enterprise_grade` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_enterprise_type`
--

DROP TABLE IF EXISTS `tb_enterprise_type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_enterprise_type` (
  `typeid` bigint NOT NULL,
  `type_name` varchar(50) DEFAULT NULL,
  `limit_scalar` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`typeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_enterprise_type`
--

LOCK TABLES `tb_enterprise_type` WRITE;
/*!40000 ALTER TABLE `tb_enterprise_type` DISABLE KEYS */;
INSERT INTO `tb_enterprise_type` VALUES (740055720423493,'药品批发企业',1000.00);
/*!40000 ALTER TABLE `tb_enterprise_type` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_expdata`
--

DROP TABLE IF EXISTS `tb_expdata`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_expdata` (
  `id` bigint NOT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `bidprice` decimal(18,3) DEFAULT NULL,
  `retailprice` decimal(18,3) DEFAULT NULL,
  `minprice` decimal(18,3) DEFAULT NULL,
  `saleprice` decimal(18,3) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  PRIMARY KEY (`id`,`recno`) USING BTREE,
  KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_expdata`
--

LOCK TABLES `tb_expdata` WRITE;
/*!40000 ALTER TABLE `tb_expdata` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_expdata` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_finance_detailed`
--

DROP TABLE IF EXISTS `tb_finance_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_finance_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_finance_detailed`
--

LOCK TABLES `tb_finance_detailed` WRITE;
/*!40000 ALTER TABLE `tb_finance_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_finance_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_finance_head`
--

DROP TABLE IF EXISTS `tb_finance_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_finance_head` (
  `orderid` int NOT NULL,
  `order_type` tinyint NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `rovalby` bigint DEFAULT NULL,
  `rovaldate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `payway` varchar(10) DEFAULT NULL,
  `saleman` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_finance_head`
--

LOCK TABLES `tb_finance_head` WRITE;
/*!40000 ALTER TABLE `tb_finance_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_finance_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_gsp_saleout`
--

DROP TABLE IF EXISTS `tb_gsp_saleout`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_gsp_saleout` (
  `orderid` int NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`recno`,`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_gsp_saleout`
--

LOCK TABLES `tb_gsp_saleout` WRITE;
/*!40000 ALTER TABLE `tb_gsp_saleout` DISABLE KEYS */;
INSERT INTO `tb_gsp_saleout` VALUES (350,630657137184837,'2025-09-29 13:53:17',386790080102469,630651202912325,1,30.000,'240608',0.03),(350,630657137184837,'2025-09-29 13:53:17',386790080102469,630651207131205,2,50.000,'20260305',1.25);
/*!40000 ALTER TABLE `tb_gsp_saleout` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_gsp_toout`
--

DROP TABLE IF EXISTS `tb_gsp_toout`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_gsp_toout` (
  `orderid` int NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`recno`,`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_gsp_toout`
--

LOCK TABLES `tb_gsp_toout` WRITE;
/*!40000 ALTER TABLE `tb_gsp_toout` DISABLE KEYS */;
INSERT INTO `tb_gsp_toout` VALUES (149,630657141473349,'2025-10-08 09:22:08',386790080102469,630651202912325,1,-20.000,'20250809',0.00);
/*!40000 ALTER TABLE `tb_gsp_toout` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_hemp_check`
--

DROP TABLE IF EXISTS `tb_hemp_check`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_hemp_check` (
  `orderid` int NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `rovalby` bigint DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_hemp_check`
--

LOCK TABLES `tb_hemp_check` WRITE;
/*!40000 ALTER TABLE `tb_hemp_check` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_hemp_check` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_inventory`
--

DROP TABLE IF EXISTS `tb_inventory`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_inventory` (
  `orderid` int NOT NULL,
  `user_id` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `states` tinyint DEFAULT '0',
  `departno` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_inventory`
--

LOCK TABLES `tb_inventory` WRITE;
/*!40000 ALTER TABLE `tb_inventory` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_inventory` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_inventory_detailed`
--

DROP TABLE IF EXISTS `tb_inventory_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_inventory_detailed` (
  `enterid` bigint NOT NULL,
  `recno` int NOT NULL,
  `orderid` int DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(20) DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `book_scalar` decimal(18,3) DEFAULT NULL,
  `book_amount` decimal(18,2) DEFAULT NULL,
  `differ_scalar` decimal(18,3) DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`enterid`,`recno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_inventory_detailed`
--

LOCK TABLES `tb_inventory_detailed` WRITE;
/*!40000 ALTER TABLE `tb_inventory_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_inventory_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_inventory_sheet`
--

DROP TABLE IF EXISTS `tb_inventory_sheet`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_inventory_sheet` (
  `recno` int NOT NULL,
  `orderid` int NOT NULL,
  `user_id` bigint DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `book_scalar` decimal(18,3) DEFAULT NULL,
  `book_amount` decimal(18,2) DEFAULT NULL,
  `differ_scalar` decimal(18,3) DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`recno`,`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_inventory_sheet`
--

LOCK TABLES `tb_inventory_sheet` WRITE;
/*!40000 ALTER TABLE `tb_inventory_sheet` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_inventory_sheet` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_inventory_update`
--

DROP TABLE IF EXISTS `tb_inventory_update`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_inventory_update` (
  `enterid` bigint NOT NULL,
  `recno` int NOT NULL,
  `orderid` int DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `book_scalar` decimal(18,3) DEFAULT NULL,
  `book_amount` decimal(18,2) DEFAULT NULL,
  `differ_scalar` decimal(18,3) DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`enterid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_inventory_update`
--

LOCK TABLES `tb_inventory_update` WRITE;
/*!40000 ALTER TABLE `tb_inventory_update` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_inventory_update` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_invoice`
--

DROP TABLE IF EXISTS `tb_invoice`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_invoice` (
  `orderid` int NOT NULL,
  `storeid` bigint DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `id` bigint NOT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `rateprice` decimal(18,4) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `saleprice` decimal(18,4) DEFAULT NULL COMMENT '建议售价',
  `minprice` decimal(18,4) DEFAULT NULL COMMENT '最低限价',
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `states` tinyint DEFAULT '0',
  `ishemp` tinyint DEFAULT '0',
  `ysb_order_no` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_invoice`
--

LOCK TABLES `tb_invoice` WRITE;
/*!40000 ALTER TABLE `tb_invoice` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_invoice` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_invoice_detailed`
--

DROP TABLE IF EXISTS `tb_invoice_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_invoice_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint NOT NULL COMMENT '产品ID',
  `scalar` decimal(18,3) DEFAULT NULL,
  `rateprice` decimal(18,4) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `return_scalar` decimal(18,3) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `reject_scalar` decimal(18,3) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  `ysb_order_no` varchar(32) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_invoice_detailed`
--

LOCK TABLES `tb_invoice_detailed` WRITE;
/*!40000 ALTER TABLE `tb_invoice_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_invoice_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_invoice_head`
--

DROP TABLE IF EXISTS `tb_invoice_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_invoice_head` (
  `orderid` int NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `saleman` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalbyname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `remarks` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `cost` decimal(18,2) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `rateamount` decimal(18,2) DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `payway` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `fetch_way` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `rovalby` bigint DEFAULT NULL,
  `rovaldate` datetime DEFAULT NULL,
  `reson` varchar(50) DEFAULT NULL,
  `ysb_order_no` varchar(32) DEFAULT NULL,
  `platform` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_invoice_head`
--

LOCK TABLES `tb_invoice_head` WRITE;
/*!40000 ALTER TABLE `tb_invoice_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_invoice_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_invoice_lastprice`
--

DROP TABLE IF EXISTS `tb_invoice_lastprice`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_invoice_lastprice` (
  `orderid` int NOT NULL,
  `createdate` datetime DEFAULT NULL,
  `id` bigint NOT NULL,
  `batchid` int NOT NULL,
  `busiid` bigint NOT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  PRIMARY KEY (`id`,`batchid`,`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_invoice_lastprice`
--

LOCK TABLES `tb_invoice_lastprice` WRITE;
/*!40000 ALTER TABLE `tb_invoice_lastprice` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_invoice_lastprice` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_invoice_refer_detailed`
--

DROP TABLE IF EXISTS `tb_invoice_refer_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_invoice_refer_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint NOT NULL COMMENT '产品ID',
  `scalar` decimal(18,3) DEFAULT NULL,
  `rateprice` decimal(18,4) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `return_scalar` decimal(18,3) DEFAULT NULL,
  `new_price` decimal(18,4) DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  `reject_scalar` decimal(18,3) DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_invoice_refer_detailed`
--

LOCK TABLES `tb_invoice_refer_detailed` WRITE;
/*!40000 ALTER TABLE `tb_invoice_refer_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_invoice_refer_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_invoice_refer_head`
--

DROP TABLE IF EXISTS `tb_invoice_refer_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_invoice_refer_head` (
  `orderid` int NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `saleman` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalbyname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `remarks` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `cost` decimal(18,2) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `rateamount` decimal(18,2) DEFAULT NULL,
  `rate` decimal(10,2) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `payway` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `fetch_way` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `rovalby` bigint DEFAULT NULL,
  `rovaldate` datetime DEFAULT NULL,
  `issettled` tinyint DEFAULT '0',
  `print_times` int DEFAULT '0',
  `print_man` bigint DEFAULT NULL,
  `related_typeid` int DEFAULT '0',
  `reson` varchar(100) DEFAULT NULL,
  `related_return` int DEFAULT '0',
  `related_price` int DEFAULT '0',
  `ysb_order_no` varchar(32) DEFAULT NULL,
  `platform` tinyint DEFAULT NULL,
  `isdrug` tinyint DEFAULT NULL,
  `isconfig` tinyint DEFAULT NULL,
  `isscan` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_invoice_refer_head`
--

LOCK TABLES `tb_invoice_refer_head` WRITE;
/*!40000 ALTER TABLE `tb_invoice_refer_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_invoice_refer_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_invoice_ysb`
--

DROP TABLE IF EXISTS `tb_invoice_ysb`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_invoice_ysb` (
  `id` bigint DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `total_scalar` decimal(18,3) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `lastprice` decimal(18,4) DEFAULT NULL,
  `saleprice` decimal(18,4) DEFAULT NULL,
  `minprice` decimal(18,4) DEFAULT NULL,
  `retailprice` decimal(18,4) DEFAULT NULL,
  `history_price` decimal(18,4) DEFAULT NULL,
  `bidprice` decimal(18,4) DEFAULT NULL,
  `hemp_max` decimal(18,3) DEFAULT NULL,
  `hemp_scalar` decimal(18,3) DEFAULT NULL,
  `ishemp` tinyint DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_invoice_ysb`
--

LOCK TABLES `tb_invoice_ysb` WRITE;
/*!40000 ALTER TABLE `tb_invoice_ysb` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_invoice_ysb` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_lock`
--

DROP TABLE IF EXISTS `tb_lock`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_lock` (
  `lock_id` bigint NOT NULL,
  `orderid` int NOT NULL,
  `order_type` tinyint DEFAULT NULL,
  `recno` int NOT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `reviewer` bigint DEFAULT NULL,
  `reviewdate` datetime DEFAULT NULL,
  `remark` varchar(50) DEFAULT NULL,
  `isroval` tinyint DEFAULT NULL,
  PRIMARY KEY (`lock_id`,`recno`,`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_lock`
--

LOCK TABLES `tb_lock` WRITE;
/*!40000 ALTER TABLE `tb_lock` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_lock` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_material`
--

DROP TABLE IF EXISTS `tb_material`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_material` (
  `id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'Id',
  `description` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述',
  `modifier` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '修改人',
  `dept_belong_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '数据归属部门',
  `update_datetime` datetime(6) DEFAULT NULL COMMENT '修改时间',
  `create_datetime` datetime(6) DEFAULT NULL COMMENT '创建时间',
  `tradename` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '商品名称',
  `specs` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '规格',
  `enterprise` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产企业',
  `unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '单位',
  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '商品编码',
  `drugnumber` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '国药准字',
  `category` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '原料类别',
  `holder` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产许可持有人',
  `entrust` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '委托生产企业',
  `entrust_address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '委托地址',
  `filingno` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '器械备案号',
  `temperature` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '储存温度',
  `humidity` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '湿度',
  `property` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '原料属性',
  `piece` smallint DEFAULT NULL COMMENT '件装数',
  `barcode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '条码',
  `spell` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '首字母',
  `states` tinyint(1) DEFAULT '1' COMMENT 'false禁销true启用',
  `curing` smallint DEFAULT NULL COMMENT '养护类型',
  `quality_standard` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '质量标准',
  `address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产地址',
  `creator_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人',
  `composition` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '成份',
  `character` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '性状',
  `functions` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '功能主治',
  `usage` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '用法用量',
  `storage` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '贮藏',
  `adverse` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '不良反应',
  `prohibit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '禁忌',
  `attention` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '注意事项',
  `manual` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '说明书',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `tb_material_creator_id_eab5404e` (`creator_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='原料药表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_material`
--

LOCK TABLES `tb_material` WRITE;
/*!40000 ALTER TABLE `tb_material` DISABLE KEYS */;
INSERT INTO `tb_material` VALUES ('350709929041989',NULL,NULL,NULL,NULL,'2022-11-07 10:22:23.290719','枸杞','Kg','三湘中药饮片有限公司','KG','000001','','中药饮片','',NULL,NULL,'','','','原料药',0,'','GQ',1,NULL,'','',NULL,'','','','',NULL,'','','',''),('350710164369477',NULL,NULL,NULL,NULL,'2022-11-07 10:23:20.743541','党参','kg','振兴中药','KG','000002','','中药饮片','',NULL,NULL,'','','','原料药',0,'','DS',1,NULL,'','',NULL,'','','','',NULL,'','','',''),('350710499700805',NULL,NULL,NULL,NULL,'2022-11-07 10:24:42.611532','黄芪','kg','三湘中药','KG','000003','','中药材','',NULL,NULL,'','','','原料药',0,'','HQ',1,NULL,'','',NULL,'','','','',NULL,'','','','');
/*!40000 ALTER TABLE `tb_material` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_code_return`
--

DROP TABLE IF EXISTS `tb_msc_code_return`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_code_return` (
  `serialid` bigint NOT NULL,
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `drugcode` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `bztype` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`serialid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_code_return`
--

LOCK TABLES `tb_msc_code_return` WRITE;
/*!40000 ALTER TABLE `tb_msc_code_return` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_code_return` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_code_saleout`
--

DROP TABLE IF EXISTS `tb_msc_code_saleout`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_code_saleout` (
  `serialid` bigint NOT NULL,
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `drugcode` varchar(30) DEFAULT NULL,
  `bztype` varchar(10) DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`serialid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_code_saleout`
--

LOCK TABLES `tb_msc_code_saleout` WRITE;
/*!40000 ALTER TABLE `tb_msc_code_saleout` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_code_saleout` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_code_storage`
--

DROP TABLE IF EXISTS `tb_msc_code_storage`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_code_storage` (
  `serialid` bigint NOT NULL,
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `drugcode` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `bztype` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`serialid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_code_storage`
--

LOCK TABLES `tb_msc_code_storage` WRITE;
/*!40000 ALTER TABLE `tb_msc_code_storage` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_code_storage` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_code_toout`
--

DROP TABLE IF EXISTS `tb_msc_code_toout`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_code_toout` (
  `serialid` bigint NOT NULL,
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint DEFAULT NULL,
  `drugcode` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `bztype` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`serialid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_code_toout`
--

LOCK TABLES `tb_msc_code_toout` WRITE;
/*!40000 ALTER TABLE `tb_msc_code_toout` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_code_toout` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_head_return`
--

DROP TABLE IF EXISTS `tb_msc_head_return`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_head_return` (
  `orderid` int NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_head_return`
--

LOCK TABLES `tb_msc_head_return` WRITE;
/*!40000 ALTER TABLE `tb_msc_head_return` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_head_return` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_head_saleout`
--

DROP TABLE IF EXISTS `tb_msc_head_saleout`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_head_saleout` (
  `orderid` int NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_head_saleout`
--

LOCK TABLES `tb_msc_head_saleout` WRITE;
/*!40000 ALTER TABLE `tb_msc_head_saleout` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_head_saleout` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_head_storage`
--

DROP TABLE IF EXISTS `tb_msc_head_storage`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_head_storage` (
  `orderid` int NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_head_storage`
--

LOCK TABLES `tb_msc_head_storage` WRITE;
/*!40000 ALTER TABLE `tb_msc_head_storage` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_head_storage` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_msc_head_toout`
--

DROP TABLE IF EXISTS `tb_msc_head_toout`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_msc_head_toout` (
  `orderid` int NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `userid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_msc_head_toout`
--

LOCK TABLES `tb_msc_head_toout` WRITE;
/*!40000 ALTER TABLE `tb_msc_head_toout` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_msc_head_toout` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_order_detailed`
--

DROP TABLE IF EXISTS `tb_order_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_order_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint NOT NULL COMMENT '产品ID',
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `received_scalar` decimal(18,3) DEFAULT NULL,
  `accept_scalar` decimal(18,3) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_order_detailed`
--

LOCK TABLES `tb_order_detailed` WRITE;
/*!40000 ALTER TABLE `tb_order_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_order_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_order_head`
--

DROP TABLE IF EXISTS `tb_order_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_order_head` (
  `orderid` int NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `buyer` varchar(20) DEFAULT NULL,
  `legalbyname` varchar(20) DEFAULT NULL,
  `carrier` varchar(100) DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `received_id` int DEFAULT NULL,
  `roval_id` int DEFAULT NULL,
  PRIMARY KEY (`orderid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_order_head`
--

LOCK TABLES `tb_order_head` WRITE;
/*!40000 ALTER TABLE `tb_order_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_order_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_order_number`
--

DROP TABLE IF EXISTS `tb_order_number`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_order_number` (
  `order_type` tinyint NOT NULL,
  `order_number` int DEFAULT NULL,
  PRIMARY KEY (`order_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_order_number`
--

LOCK TABLES `tb_order_number` WRITE;
/*!40000 ALTER TABLE `tb_order_number` DISABLE KEYS */;
INSERT INTO `tb_order_number` VALUES (1,0),(2,0),(3,0),(4,2),(5,0),(6,0),(7,0),(8,0),(9,0);
/*!40000 ALTER TABLE `tb_order_number` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_organ`
--

DROP TABLE IF EXISTS `tb_organ`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_organ` (
  `orgid` bigint NOT NULL COMMENT 'Id',
  `description` varchar(100) DEFAULT NULL COMMENT '描述',
  `modifier` varchar(100) DEFAULT NULL COMMENT '修改人',
  `dept_belong_id` varchar(100) DEFAULT NULL COMMENT '数据归属部门',
  `update_datetime` datetime(6) DEFAULT NULL COMMENT '修改时间',
  `create_datetime` datetime(6) DEFAULT NULL COMMENT '创建时间',
  `orgcode` varchar(10) DEFAULT NULL COMMENT '机构编号',
  `orgname` varchar(100) DEFAULT NULL COMMENT '机构名称',
  `leader` varchar(20) DEFAULT NULL COMMENT '负责人',
  `phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
  `states` tinyint(1) DEFAULT NULL COMMENT '1启用0禁用',
  `address` varchar(100) DEFAULT NULL COMMENT '机构地址',
  `creator_id` varchar(100) DEFAULT NULL COMMENT '创建人',
  `id` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`orgid`) USING BTREE,
  UNIQUE KEY `orgcode` (`orgcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='机构信息';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_organ`
--

LOCK TABLES `tb_organ` WRITE;
/*!40000 ALTER TABLE `tb_organ` DISABLE KEYS */;
INSERT INTO `tb_organ` VALUES (389332746158149,NULL,NULL,NULL,NULL,NULL,'999','药品销售有限公司','','',1,'',NULL,NULL);
/*!40000 ALTER TABLE `tb_organ` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_overflowloss_check`
--

DROP TABLE IF EXISTS `tb_overflowloss_check`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_overflowloss_check` (
  `checkid` bigint NOT NULL,
  `user_id` bigint DEFAULT NULL,
  `orderid` int DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `content` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`checkid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_overflowloss_check`
--

LOCK TABLES `tb_overflowloss_check` WRITE;
/*!40000 ALTER TABLE `tb_overflowloss_check` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_overflowloss_check` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_overflowloss_detailed`
--

DROP TABLE IF EXISTS `tb_overflowloss_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_overflowloss_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint NOT NULL COMMENT '产品ID',
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `return_scalar` decimal(18,3) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `reject_scalar` decimal(18,3) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_overflowloss_detailed`
--

LOCK TABLES `tb_overflowloss_detailed` WRITE;
/*!40000 ALTER TABLE `tb_overflowloss_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_overflowloss_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_overflowloss_head`
--

DROP TABLE IF EXISTS `tb_overflowloss_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_overflowloss_head` (
  `orderid` int NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `saleman` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalbyname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `remarks` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `cost` decimal(18,2) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `profit` decimal(18,2) DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `payway` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `fetch_way` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `rovalby` bigint DEFAULT NULL,
  `rovaldate` datetime DEFAULT NULL,
  `reson` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_overflowloss_head`
--

LOCK TABLES `tb_overflowloss_head` WRITE;
/*!40000 ALTER TABLE `tb_overflowloss_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_overflowloss_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_payment`
--

DROP TABLE IF EXISTS `tb_payment`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_payment` (
  `frontid` bigint NOT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `rovalby` varchar(20) DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `bankcode` varchar(20) DEFAULT NULL,
  `remarks` varchar(50) DEFAULT NULL,
  `saleman` varchar(20) DEFAULT NULL,
  `payway` varchar(10) DEFAULT NULL,
  `states` tinyint DEFAULT '0',
  `direction` tinyint DEFAULT NULL,
  PRIMARY KEY (`frontid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_payment`
--

LOCK TABLES `tb_payment` WRITE;
/*!40000 ALTER TABLE `tb_payment` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_payment` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_post`
--

DROP TABLE IF EXISTS `tb_post`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_post` (
  `postid` bigint NOT NULL,
  `postno` varchar(20) DEFAULT NULL,
  `post_role_name` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`postid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_post`
--

LOCK TABLES `tb_post` WRITE;
/*!40000 ALTER TABLE `tb_post` DISABLE KEYS */;
INSERT INTO `tb_post` VALUES (386806575284293,'01','总经理'),(386806839242821,'02','副总经理'),(386806947659845,'03','质量负责人'),(386807026982981,'04','质量经理'),(386807108583493,'05','验收员'),(386807185936453,'06','养护员'),(386807306580037,'07','财务总监'),(386807404765253,'08','财务出纳'),(386807477416005,'09','开票员'),(386807691108421,'10','销售总监'),(386807770193989,'11','销售经理'),(386813146013765,'12','系统管理员'),(624716028411973,'13','连锁收银员'),(624716122124357,'14','连锁执业药师');
/*!40000 ALTER TABLE `tb_post` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_post_role`
--

DROP TABLE IF EXISTS `tb_post_role`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_post_role` (
  `post_role_id` bigint NOT NULL,
  `postid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `isroval` tinyint DEFAULT '0',
  `rovalby` bigint DEFAULT NULL,
  `rovaldate` date DEFAULT NULL,
  PRIMARY KEY (`post_role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_post_role`
--

LOCK TABLES `tb_post_role` WRITE;
/*!40000 ALTER TABLE `tb_post_role` DISABLE KEYS */;
INSERT INTO `tb_post_role` VALUES (386813146013765,386813146013765,386790080102469,1,NULL,NULL),(387268521517125,386806575284293,386790080102469,1,NULL,NULL),(387573282394181,386806575284293,1,1,386790080102469,'2023-02-19'),(387573284503621,386806839242821,1,1,386790080102469,'2023-02-19'),(411642059087941,386806575284293,386790080102469,1,386790080102469,'2023-04-28'),(411642061189189,386806839242821,386790080102469,1,386790080102469,'2023-04-28'),(411642063302725,386813146013765,386790080102469,1,386790080102469,'2023-04-28'),(418359123591237,386813146013765,418356662693957,1,386790080102469,'2023-05-17'),(430384947769413,386807770193989,418356061474885,1,386790080102469,'2023-06-20'),(430384998715461,386807026982981,418356662693957,1,386790080102469,'2023-06-20'),(436328119935045,386806575284293,436328024711237,1,418356662693957,'2023-07-07'),(436330951069765,386807306580037,436330892095557,1,418356662693957,'2023-07-07'),(509962625994821,386807306580037,436330892095557,1,386790080102469,'2024-01-31'),(509962673180741,386806575284293,436328024711237,1,386790080102469,'2024-01-31'),(520310501081157,386807770193989,418356061474885,1,386790080102469,'2024-04-03');
/*!40000 ALTER TABLE `tb_post_role` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_post_role_menu`
--

DROP TABLE IF EXISTS `tb_post_role_menu`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_post_role_menu` (
  `postid` bigint NOT NULL,
  `menuid` bigint NOT NULL,
  `isview` tinyint DEFAULT '1',
  PRIMARY KEY (`postid`,`menuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_post_role_menu`
--

LOCK TABLES `tb_post_role_menu` WRITE;
/*!40000 ALTER TABLE `tb_post_role_menu` DISABLE KEYS */;
INSERT INTO `tb_post_role_menu` VALUES (386806575284293,350319144476741,1),(386806575284293,350319502905413,0),(386806575284293,350319746887749,1),(386806575284293,350319997386821,0),(386806575284293,350329030950981,0),(386806575284293,350711514681413,1),(386806575284293,350760421969989,0),(386806575284293,350814580559941,1),(386806575284293,356433909219397,0),(386806575284293,386175860801605,0),(386806575284293,386806338961477,0),(386806575284293,386872483029061,0),(386806575284293,387651954790469,0),(386806575284293,387867091468357,0),(386806575284293,388231110082629,1),(386806575284293,388576086491205,0),(386806575284293,388589783679045,0),(386806575284293,388952308244549,0),(386806575284293,388952401489989,0),(386806575284293,390017503703109,0),(386806575284293,390365563023429,1),(386806575284293,390379219169349,0),(386806575284293,390379420971077,0),(386806575284293,390683309232197,0),(386806575284293,391794621440069,0),(386806575284293,391795012055109,0),(386806575284293,393179484540997,1),(386806575284293,393179790262341,1),(386806575284293,393179965894725,1),(386806575284293,393888227835973,0),(386806575284293,393976842055749,1),(386806575284293,393977012068421,1),(386806575284293,394218796888133,0),(386806575284293,394263000277061,0),(386806575284293,394735503269957,0),(386806575284293,394735735132229,1),(386806575284293,395352937218117,0),(386806575284293,395980920393797,1),(386806575284293,395981193437253,0),(386806575284293,396000422096965,0),(386806575284293,396095898533957,0),(386806575284293,396440525283397,1),(386806575284293,396716301967429,0),(386806575284293,396802676584517,0),(386806575284293,397799893286981,0),(386806575284293,397831578427461,1),(386806575284293,398552053096517,0),(386806575284293,398830096781381,0),(386806575284293,399260447285317,0),(386806575284293,400302969512005,0),(386806575284293,400682855579717,0),(386806575284293,401297404596293,0),(386806575284293,401304358813765,0),(386806575284293,401384295735365,0),(386806575284293,402019306315845,0),(386806575284293,402040330711109,0),(386806575284293,402779245244485,1),(386806575284293,402786457477189,0),(386806575284293,402800000127045,1),(386806575284293,403163626639429,0),(386806575284293,404138768605253,0),(386806575284293,404150295687237,0),(386806575284293,405222288228421,1),(386806575284293,405265011572805,0),(386806575284293,406962776219717,0),(386806575284293,407692656095301,0),(386806575284293,407743909081157,0),(386806575284293,407755946913861,0),(386806575284293,407764843655237,1),(386806575284293,407774573572165,1),(386806575284293,408470717399109,1),(386806575284293,408479633985605,1),(386806575284293,409189449064517,0),(386806575284293,409205529047109,0),(386806575284293,410246906474565,0),(386806575284293,410508335784005,0),(386806575284293,410857018314821,1),(386806575284293,410938767388741,0),(386806575284293,413714545074245,1),(386806575284293,414123197493317,0),(386806575284293,414143489278021,0),(386806575284293,414490665119813,0),(386806575284293,417651039825989,1),(386806575284293,417968081133637,0),(386806575284293,417968316293189,0),(386806575284293,418292150693957,1),(386806575284293,422551794278469,0),(386806575284293,425801211584581,0),(386806575284293,426433675124805,1),(386806575284293,427591854809157,1),(386806575284293,427892476207173,1),(386806575284293,428267468935237,1),(386806575284293,428298154057797,1),(386806575284293,430064107622469,1),(386806575284293,430064819351621,0),(386806575284293,430405248741445,0),(386806575284293,434307062059077,0),(386806575284293,435337452683333,0),(386806575284293,436061537726533,0),(386806575284293,436330373873733,1),(386806575284293,436330589519941,0),(386806575284293,437460597170245,1),(386806575284293,437460926718021,0),(386806575284293,437780690186309,1),(386806575284293,438123829514309,1),(386806575284293,450524141760581,0),(386806575284293,450566819622981,0),(386806575284293,473576979251269,0),(386806575284293,507482944892997,1),(386806575284293,508553704648773,0),(386806575284293,509640154947653,1),(386807026982981,350319144476741,1),(386807026982981,350319502905413,1),(386807026982981,350319746887749,1),(386807026982981,350319997386821,1),(386807026982981,350329030950981,1),(386807026982981,350711514681413,1),(386807026982981,350760421969989,1),(386807026982981,350814580559941,1),(386807026982981,356433909219397,1),(386807026982981,386175860801605,1),(386807026982981,386806338961477,1),(386807026982981,386872483029061,1),(386807026982981,387651954790469,1),(386807026982981,387867091468357,1),(386807026982981,388231110082629,1),(386807026982981,388576086491205,1),(386807026982981,388589783679045,1),(386807026982981,388952308244549,1),(386807026982981,388952401489989,1),(386807026982981,390017503703109,1),(386807026982981,390365563023429,1),(386807026982981,390379219169349,1),(386807026982981,390379420971077,1),(386807026982981,390683309232197,1),(386807026982981,391794621440069,1),(386807026982981,391795012055109,1),(386807026982981,393179484540997,1),(386807026982981,393179790262341,1),(386807026982981,393179965894725,1),(386807026982981,393888227835973,1),(386807026982981,393976842055749,1),(386807026982981,393977012068421,1),(386807026982981,394218796888133,1),(386807026982981,394263000277061,1),(386807026982981,394735503269957,1),(386807026982981,394735735132229,1),(386807026982981,395352937218117,1),(386807026982981,395980920393797,1),(386807026982981,395981193437253,1),(386807026982981,396000422096965,1),(386807026982981,396095898533957,1),(386807026982981,396440525283397,1),(386807026982981,396716301967429,1),(386807026982981,396802676584517,1),(386807026982981,397799893286981,1),(386807026982981,397831578427461,1),(386807026982981,398552053096517,1),(386807026982981,398830096781381,1),(386807026982981,399260447285317,1),(386807026982981,400302969512005,1),(386807026982981,400682855579717,1),(386807026982981,401297404596293,1),(386807026982981,401304358813765,1),(386807026982981,401384295735365,1),(386807026982981,402019306315845,1),(386807026982981,402040330711109,1),(386807026982981,402779245244485,1),(386807026982981,402786457477189,1),(386807026982981,402800000127045,1),(386807026982981,403163626639429,1),(386807026982981,404138768605253,1),(386807026982981,404150295687237,1),(386807026982981,405222288228421,1),(386807026982981,405265011572805,1),(386807026982981,406962776219717,1),(386807026982981,407692656095301,1),(386807026982981,407743909081157,1),(386807026982981,407755946913861,1),(386807026982981,407764843655237,1),(386807026982981,407774573572165,1),(386807026982981,408470717399109,1),(386807026982981,408479633985605,1),(386807026982981,409189449064517,1),(386807026982981,409205529047109,1),(386807026982981,410246906474565,1),(386807026982981,410508335784005,1),(386807026982981,410857018314821,1),(386807026982981,410938767388741,1),(386807026982981,413714545074245,1),(386807026982981,414123197493317,1),(386807026982981,414143489278021,1),(386807026982981,414490665119813,1),(386807026982981,417651039825989,1),(386807026982981,417968081133637,1),(386807026982981,417968316293189,1),(386807026982981,418292150693957,1),(386807026982981,422551794278469,1),(386807026982981,425801211584581,1),(386807026982981,426433675124805,1),(386807026982981,427591854809157,1),(386807026982981,427892476207173,1),(386807026982981,428267468935237,1),(386807026982981,428298154057797,1),(386807026982981,430064107622469,1),(386807026982981,430064819351621,1),(386807306580037,350319144476741,1),(386807306580037,350319502905413,0),(386807306580037,350319746887749,1),(386807306580037,350319997386821,0),(386807306580037,350329030950981,0),(386807306580037,350711514681413,1),(386807306580037,350760421969989,0),(386807306580037,350814580559941,1),(386807306580037,356433909219397,0),(386807306580037,386175860801605,0),(386807306580037,386806338961477,0),(386807306580037,386872483029061,0),(386807306580037,387651954790469,0),(386807306580037,387867091468357,0),(386807306580037,388231110082629,1),(386807306580037,388576086491205,0),(386807306580037,388589783679045,0),(386807306580037,388952308244549,0),(386807306580037,388952401489989,0),(386807306580037,390017503703109,0),(386807306580037,390365563023429,1),(386807306580037,390379219169349,0),(386807306580037,390379420971077,0),(386807306580037,390683309232197,0),(386807306580037,391794621440069,0),(386807306580037,391795012055109,0),(386807306580037,393179484540997,1),(386807306580037,393179790262341,1),(386807306580037,393179965894725,1),(386807306580037,393888227835973,0),(386807306580037,393976842055749,1),(386807306580037,393977012068421,1),(386807306580037,394218796888133,0),(386807306580037,394263000277061,0),(386807306580037,394735503269957,0),(386807306580037,394735735132229,1),(386807306580037,395352937218117,0),(386807306580037,395980920393797,1),(386807306580037,395981193437253,1),(386807306580037,396000422096965,1),(386807306580037,396095898533957,0),(386807306580037,396440525283397,1),(386807306580037,396716301967429,0),(386807306580037,396802676584517,1),(386807306580037,397799893286981,1),(386807306580037,397831578427461,1),(386807306580037,398552053096517,0),(386807306580037,398830096781381,0),(386807306580037,399260447285317,0),(386807306580037,400302969512005,0),(386807306580037,400682855579717,0),(386807306580037,401297404596293,0),(386807306580037,401304358813765,0),(386807306580037,401384295735365,0),(386807306580037,402019306315845,0),(386807306580037,402040330711109,0),(386807306580037,402779245244485,1),(386807306580037,402786457477189,0),(386807306580037,402800000127045,1),(386807306580037,403163626639429,0),(386807306580037,404138768605253,1),(386807306580037,404150295687237,1),(386807306580037,405222288228421,1),(386807306580037,405265011572805,1),(386807306580037,406962776219717,0),(386807306580037,407692656095301,0),(386807306580037,407743909081157,0),(386807306580037,407755946913861,0),(386807306580037,407764843655237,1),(386807306580037,407774573572165,1),(386807306580037,408470717399109,1),(386807306580037,408479633985605,1),(386807306580037,409189449064517,0),(386807306580037,409205529047109,0),(386807306580037,410246906474565,0),(386807306580037,410508335784005,0),(386807306580037,410857018314821,1),(386807306580037,410938767388741,0),(386807306580037,413714545074245,1),(386807306580037,414123197493317,0),(386807306580037,414143489278021,0),(386807306580037,414490665119813,0),(386807306580037,417651039825989,1),(386807306580037,417968081133637,0),(386807306580037,417968316293189,0),(386807306580037,418292150693957,1),(386807306580037,422551794278469,0),(386807306580037,425801211584581,0),(386807306580037,426433675124805,1),(386807306580037,427591854809157,1),(386807306580037,427892476207173,1),(386807306580037,428267468935237,1),(386807306580037,428298154057797,1),(386807306580037,430064107622469,1),(386807306580037,430064819351621,0),(386807306580037,430405248741445,0),(386807306580037,434307062059077,0),(386807306580037,435337452683333,0),(386807306580037,436061537726533,0),(386807306580037,436330373873733,0),(386807306580037,436330589519941,1),(386807306580037,437460597170245,1),(386807306580037,437460926718021,0),(386807306580037,437780690186309,1),(386807306580037,438123829514309,1),(386807306580037,450524141760581,0),(386807306580037,450566819622981,0),(386807306580037,473576979251269,0),(386807306580037,507482944892997,1),(386807306580037,508553704648773,0),(386807306580037,509640154947653,1),(386807770193989,350319144476741,1),(386807770193989,350319502905413,0),(386807770193989,350319746887749,1),(386807770193989,350319997386821,0),(386807770193989,350329030950981,0),(386807770193989,350711514681413,1),(386807770193989,350760421969989,0),(386807770193989,350814580559941,1),(386807770193989,356433909219397,1),(386807770193989,386175860801605,0),(386807770193989,386806338961477,0),(386807770193989,386872483029061,0),(386807770193989,387651954790469,0),(386807770193989,387867091468357,0),(386807770193989,388231110082629,1),(386807770193989,388576086491205,1),(386807770193989,388589783679045,0),(386807770193989,388952308244549,0),(386807770193989,388952401489989,1),(386807770193989,390017503703109,1),(386807770193989,390365563023429,1),(386807770193989,390379219169349,1),(386807770193989,390379420971077,1),(386807770193989,390683309232197,1),(386807770193989,391794621440069,0),(386807770193989,391795012055109,0),(386807770193989,393179484540997,1),(386807770193989,393179790262341,1),(386807770193989,393179965894725,1),(386807770193989,393888227835973,0),(386807770193989,393976842055749,1),(386807770193989,393977012068421,1),(386807770193989,394218796888133,1),(386807770193989,394263000277061,0),(386807770193989,394735503269957,1),(386807770193989,394735735132229,1),(386807770193989,395352937218117,1),(386807770193989,395980920393797,1),(386807770193989,395981193437253,1),(386807770193989,396000422096965,1),(386807770193989,396095898533957,1),(386807770193989,396440525283397,1),(386807770193989,396716301967429,1),(386807770193989,396802676584517,1),(386807770193989,397799893286981,1),(386807770193989,397831578427461,1),(386807770193989,398552053096517,0),(386807770193989,398830096781381,1),(386807770193989,399260447285317,1),(386807770193989,400302969512005,0),(386807770193989,400682855579717,1),(386807770193989,401297404596293,1),(386807770193989,401304358813765,0),(386807770193989,401384295735365,1),(386807770193989,402019306315845,1),(386807770193989,402040330711109,1),(386807770193989,402779245244485,1),(386807770193989,402786457477189,1),(386807770193989,402800000127045,1),(386807770193989,403163626639429,1),(386807770193989,404138768605253,1),(386807770193989,404150295687237,1),(386807770193989,405222288228421,1),(386807770193989,405265011572805,1),(386807770193989,406962776219717,1),(386807770193989,407692656095301,1),(386807770193989,407743909081157,1),(386807770193989,407755946913861,1),(386807770193989,407764843655237,1),(386807770193989,407774573572165,1),(386807770193989,408470717399109,1),(386807770193989,408479633985605,1),(386807770193989,409189449064517,0),(386807770193989,409205529047109,0),(386807770193989,410246906474565,0),(386807770193989,410508335784005,0),(386807770193989,410857018314821,1),(386807770193989,410938767388741,1),(386807770193989,413714545074245,1),(386807770193989,414123197493317,1),(386807770193989,414143489278021,1),(386807770193989,414490665119813,1),(386807770193989,417651039825989,1),(386807770193989,417968081133637,0),(386807770193989,417968316293189,0),(386807770193989,418292150693957,1),(386807770193989,422551794278469,0),(386807770193989,425801211584581,0),(386807770193989,426433675124805,1),(386807770193989,427591854809157,1),(386807770193989,427892476207173,1),(386807770193989,428267468935237,1),(386807770193989,428298154057797,1),(386807770193989,430064107622469,1),(386807770193989,430064819351621,1),(386807770193989,430405248741445,1),(386807770193989,434307062059077,0),(386807770193989,435337452683333,1),(386807770193989,436061537726533,0),(386807770193989,436330373873733,0),(386807770193989,436330589519941,1),(386807770193989,437460597170245,1),(386807770193989,437460926718021,1),(386807770193989,437780690186309,1),(386807770193989,438123829514309,1),(386807770193989,450524141760581,1),(386807770193989,450566819622981,1),(386807770193989,473576979251269,0),(386807770193989,507482944892997,1),(386807770193989,508553704648773,1),(386807770193989,509640154947653,1),(386807770193989,510009692016709,1),(386807770193989,510681350004805,1),(386807770193989,516339654807621,1),(386807770193989,517099840761925,1),(386807770193989,517822667731013,1),(386807770193989,518095186239557,1),(386807770193989,519860665954373,0),(386807770193989,519878336757829,0),(386807770193989,545007920996421,1),(386807770193989,551727536681029,0),(386807770193989,551806691668037,1),(386807770193989,558800173555781,1),(386807770193989,558853166243909,1),(386807770193989,564468795818053,1),(386807770193989,571629017473093,1),(386813146013765,350319144476741,1),(386813146013765,350319502905413,1),(386813146013765,350319746887749,1),(386813146013765,350319997386821,1),(386813146013765,350329030950981,1),(386813146013765,350711514681413,1),(386813146013765,350760421969989,1),(386813146013765,350814580559941,1),(386813146013765,356433909219397,1),(386813146013765,386175860801605,1),(386813146013765,386806338961477,1),(386813146013765,386872483029061,1),(386813146013765,387651954790469,1),(386813146013765,387867091468357,1),(386813146013765,388231110082629,1),(386813146013765,388576086491205,1),(386813146013765,388589783679045,1),(386813146013765,388952401489989,1),(386813146013765,390017503703109,1),(386813146013765,390365563023429,1),(386813146013765,390379219169349,1),(386813146013765,390379420971077,1),(386813146013765,390683309232197,1),(386813146013765,391794621440069,1),(386813146013765,391795012055109,1),(386813146013765,393179484540997,1),(386813146013765,393179790262341,1),(386813146013765,393179965894725,1),(386813146013765,393888227835973,1),(386813146013765,393976842055749,1),(386813146013765,393977012068421,1),(386813146013765,394218796888133,1),(386813146013765,394263000277061,1),(386813146013765,394735503269957,1),(386813146013765,394735735132229,1),(386813146013765,395352937218117,1),(386813146013765,395980920393797,1),(386813146013765,395981193437253,1),(386813146013765,396000422096965,1),(386813146013765,396095898533957,1),(386813146013765,396440525283397,1),(386813146013765,396716301967429,1),(386813146013765,396802676584517,1),(386813146013765,397799893286981,1),(386813146013765,397831578427461,1),(386813146013765,398552053096517,1),(386813146013765,398830096781381,1),(386813146013765,399260447285317,1),(386813146013765,400302969512005,1),(386813146013765,400682855579717,1),(386813146013765,401297404596293,1),(386813146013765,401304358813765,1),(386813146013765,401384295735365,1),(386813146013765,402019306315845,1),(386813146013765,402040330711109,1),(386813146013765,402779245244485,1),(386813146013765,402786457477189,1),(386813146013765,402800000127045,1),(386813146013765,403163626639429,1),(386813146013765,404138768605253,1),(386813146013765,404150295687237,1),(386813146013765,405222288228421,1),(386813146013765,405265011572805,1),(386813146013765,406962776219717,1),(386813146013765,407692656095301,1),(386813146013765,407743909081157,1),(386813146013765,407755946913861,1),(386813146013765,407764843655237,1),(386813146013765,407774573572165,1),(386813146013765,408470717399109,1),(386813146013765,408479633985605,1),(386813146013765,409189449064517,1),(386813146013765,409205529047109,1),(386813146013765,410246906474565,1),(386813146013765,410508335784005,1),(386813146013765,410857018314821,1),(386813146013765,410938767388741,1),(386813146013765,413714545074245,1),(386813146013765,414123197493317,1),(386813146013765,414143489278021,1),(386813146013765,414490665119813,1),(386813146013765,417651039825989,1),(386813146013765,417968081133637,1),(386813146013765,417968316293189,1),(386813146013765,418292150693957,1),(386813146013765,422551794278469,1),(386813146013765,425801211584581,1),(386813146013765,426433675124805,1),(386813146013765,427591854809157,1),(386813146013765,427892476207173,1),(386813146013765,428267468935237,1),(386813146013765,428298154057797,1),(386813146013765,430064107622469,1),(386813146013765,430064819351621,1),(386813146013765,430405248741445,1),(386813146013765,434307062059077,1),(386813146013765,435337452683333,1),(386813146013765,436061537726533,1),(386813146013765,436330373873733,1),(386813146013765,436330589519941,1),(386813146013765,437460597170245,1),(386813146013765,437460926718021,1),(386813146013765,437780690186309,1),(386813146013765,438123829514309,1),(386813146013765,450524141760581,1),(386813146013765,450566819622981,1),(386813146013765,473576979251269,1),(386813146013765,507482944892997,1),(386813146013765,508553704648773,1),(386813146013765,509640154947653,1),(386813146013765,510009692016709,1),(386813146013765,510681350004805,1),(386813146013765,516339654807621,1),(386813146013765,517099840761925,1),(386813146013765,517822667731013,1),(386813146013765,518095186239557,1),(386813146013765,519860665954373,1),(386813146013765,519878336757829,1),(386813146013765,545007920996421,1),(386813146013765,551727536681029,1),(386813146013765,551806691668037,1),(386813146013765,558800173555781,1),(386813146013765,558853166243909,1),(386813146013765,564468795818053,1),(386813146013765,571629017473093,1),(386813146013765,609133958979653,1),(386813146013765,609134357602373,1),(386813146013765,609409106239557,1),(386813146013765,609467029659717,1),(386813146013765,609467282370629,1),(386813146013765,609467745579077,1),(386813146013765,609491208532037,1),(386813146013765,610880122613829,1),(386813146013765,610880463814725,1),(386813146013765,611168588853317,1),(386813146013765,611951761903685,1),(386813146013765,612597216956485,1),(386813146013765,612627594821701,1),(386813146013765,612628119191621,1),(386813146013765,617185830465605,1),(386813146013765,618701123739717,1),(386813146013765,619672027877445,1),(386813146013765,619672271188037,1),(386813146013765,619684614815813,1),(386813146013765,619743728435269,1),(386813146013765,624711464177733,1),(386813146013765,635691276189765,1),(386813146013765,642008463822917,1),(386813146013765,724436677247045,1),(386813146013765,730438294675525,1),(386813146013765,740042728820805,1);
/*!40000 ALTER TABLE `tb_post_role_menu` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_receipt_detailed`
--

DROP TABLE IF EXISTS `tb_receipt_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_receipt_detailed` (
  `receipt_id` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `orderid` int NOT NULL,
  `order_type` tinyint DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `receivdate` date DEFAULT NULL COMMENT '单据日期',
  `sale_buyer_man` varchar(20) DEFAULT NULL COMMENT '业务员--采购员',
  `receipt_party` decimal(18,2) DEFAULT NULL,
  `unreceipt_party` decimal(18,2) DEFAULT NULL,
  `this_party` decimal(18,2) DEFAULT NULL,
  `receipt_payer` decimal(18,2) DEFAULT NULL,
  `unreceipt_payer` decimal(18,2) DEFAULT NULL,
  `this_payer` decimal(18,2) DEFAULT NULL,
  `createdate` date DEFAULT NULL COMMENT '发票登日期',
  `user_id` bigint DEFAULT NULL COMMENT '操作人',
  `taxno` varchar(15) DEFAULT NULL,
  `taxcode` varchar(15) DEFAULT NULL,
  `tax_type` tinyint DEFAULT NULL,
  `direction` tinyint DEFAULT NULL,
  `taxdate` date DEFAULT NULL,
  `remarks` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`receipt_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_receipt_detailed`
--

LOCK TABLES `tb_receipt_detailed` WRITE;
/*!40000 ALTER TABLE `tb_receipt_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_receipt_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_receipt_head`
--

DROP TABLE IF EXISTS `tb_receipt_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_receipt_head` (
  `busiid` bigint NOT NULL,
  `total_payer` decimal(18,2) DEFAULT NULL COMMENT '应付总金额',
  `total_party` decimal(18,2) DEFAULT NULL COMMENT '应收总金额',
  `receipt_payer` decimal(18,2) DEFAULT NULL COMMENT '已开应付发票金额',
  `unreceipt_payer` decimal(18,2) DEFAULT NULL COMMENT '未开应付发票金额',
  `receipt_party` decimal(18,2) DEFAULT NULL COMMENT '已收到应收发票金额',
  `unreceipt_party` decimal(18,2) DEFAULT NULL COMMENT '未收到应收发票金额',
  PRIMARY KEY (`busiid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_receipt_head`
--

LOCK TABLES `tb_receipt_head` WRITE;
/*!40000 ALTER TABLE `tb_receipt_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_receipt_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_receipt_single_detailed`
--

DROP TABLE IF EXISTS `tb_receipt_single_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_receipt_single_detailed` (
  `receipt_id` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  `orderid` int NOT NULL,
  `order_type` tinyint DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `receivdate` date DEFAULT NULL COMMENT '单据日期',
  `sale_buyer_man` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '业务员--采购员',
  `createdate` date DEFAULT NULL COMMENT '发票登日期',
  `user_id` bigint DEFAULT NULL COMMENT '操作人',
  `taxno` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `taxcode` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `tax_type` tinyint DEFAULT NULL,
  `direction` tinyint DEFAULT NULL,
  `taxdate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `remarks` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  PRIMARY KEY (`receipt_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_receipt_single_detailed`
--

LOCK TABLES `tb_receipt_single_detailed` WRITE;
/*!40000 ALTER TABLE `tb_receipt_single_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_receipt_single_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_received_detailed`
--

DROP TABLE IF EXISTS `tb_received_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_received_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint NOT NULL COMMENT '产品ID',
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `received_scalar` decimal(18,3) DEFAULT NULL,
  `reject_scalar` decimal(18,3) DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `indate` varchar(10) DEFAULT NULL,
  `prodate` varchar(10) DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `related_recno` int DEFAULT NULL,
  `isdo` tinyint DEFAULT '1',
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_received_detailed`
--

LOCK TABLES `tb_received_detailed` WRITE;
/*!40000 ALTER TABLE `tb_received_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_received_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_received_head`
--

DROP TABLE IF EXISTS `tb_received_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_received_head` (
  `orderid` int NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `buyer` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalbyname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `carrier` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `remarks` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `transport` varchar(50) DEFAULT NULL,
  `temperature` varchar(50) DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_received_head`
--

LOCK TABLES `tb_received_head` WRITE;
/*!40000 ALTER TABLE `tb_received_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_received_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_region`
--

DROP TABLE IF EXISTS `tb_region`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_region` (
  `region_id` bigint NOT NULL,
  `region_name` varchar(50) DEFAULT NULL,
  `parentid` bigint DEFAULT NULL,
  PRIMARY KEY (`region_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_region`
--

LOCK TABLES `tb_region` WRITE;
/*!40000 ALTER TABLE `tb_region` DISABLE KEYS */;
INSERT INTO `tb_region` VALUES (385396110467141,'湖南省',-1),(385411140591685,'长沙市',385396110467141),(385411573399621,'株洲',385396110467141),(385414025482309,'衡阳市',385396110467141),(385416493637701,'湘潭',385396110467141),(385417431523397,'永州',385396110467141),(385418360586309,'益阳市',385396110467141),(385420788641861,'常德市',385396110467141);
/*!40000 ALTER TABLE `tb_region` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_register`
--

DROP TABLE IF EXISTS `tb_register`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_register` (
  `userdate` date DEFAULT NULL,
  `days` int DEFAULT NULL,
  `indays` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_register`
--

LOCK TABLES `tb_register` WRITE;
/*!40000 ALTER TABLE `tb_register` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_register` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_report`
--

DROP TABLE IF EXISTS `tb_report`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_report` (
  `reportid` bigint NOT NULL,
  `report_type` int DEFAULT NULL,
  `report_name` varchar(50) DEFAULT NULL,
  `report_path` varchar(255) DEFAULT NULL,
  `report_file` blob,
  PRIMARY KEY (`reportid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_report`
--

LOCK TABLES `tb_report` WRITE;
/*!40000 ALTER TABLE `tb_report` DISABLE KEYS */;
INSERT INTO `tb_report` VALUES (388671078363205,1,'首营品种审批表',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"09/28/2022 10:16:30\" ReportInfo.Modified=\"05/07/2024 11:07:40\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"indate\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"return_scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" Watermark.Font=\"宋体, 60pt\">\r\n    <DataBand Name=\"Data1\" Width=\"718.2\" Height=\"1030.05\">\r\n      <TextObject Name=\"Text1\" Left=\"217.35\" Top=\"9.45\" Width=\"368.55\" Height=\"28.35\" Text=\"XXXX药品有限公司\" Font=\"宋体, 16pt, style=Bold\"/>\r\n      <ShapeObject Name=\"Shape1\" Left=\"9.45\" Top=\"103.95\" Width=\"699.3\" Height=\"888.3\"/>\r\n      <LineObject Name=\"Line1\" Left=\"9.45\" Top=\"37.8\" Width=\"699.3\" Border.Width=\"2\"/>\r\n      <TextObject Name=\"Text2\" Left=\"236.25\" Top=\"47.25\" Width=\"274.05\" Height=\"18.9\" Text=\"首次经营药品审批表\" Font=\"宋体, 16pt, style=Bold\"/>\r\n      <TextObject Name=\"Text3\" Left=\"264.6\" Top=\"75.6\" Width=\"236.25\" Height=\"18.9\" Text=\"日期：[Date]\" Font=\"宋体, 10pt\"/>\r\n      <LineObject Name=\"Line2\" Left=\"9.45\" Top=\"141.75\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line3\" Left=\"9.45\" Top=\"179.55\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line4\" Left=\"9.45\" Top=\"217.35\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line5\" Left=\"9.45\" Top=\"255.15\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line6\" Left=\"9.45\" Top=\"292.95\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line7\" Left=\"9.45\" Top=\"330.75\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line8\" Left=\"9.45\" Top=\"368.55\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line9\" Left=\"9.45\" Top=\"406.35\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line10\" Left=\"9.45\" Top=\"444.15\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line11\" Left=\"9.45\" Top=\"481.95\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line12\" Left=\"9.45\" Top=\"519.75\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line13\" Left=\"9.45\" Top=\"670.95\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line14\" Left=\"9.45\" Top=\"831.6\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line15\" Left=\"151.2\" Top=\"103.95\" Height=\"888.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line16\" Left=\"340.2\" Top=\"103.95\" Height=\"113.4\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line17\" Left=\"444.15\" Top=\"103.95\" Height=\"113.4\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line18\" Left=\"529.2\" Top=\"103.95\" Height=\"75.6\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line19\" Left=\"576.45\" Top=\"217.35\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line20\" Left=\"245.7\" Top=\"255.15\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line21\" Left=\"340.2\" Top=\"255.15\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line22\" Left=\"444.15\" Top=\"255.15\" Height=\"264.6\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line23\" Left=\"576.45\" Top=\"255.15\" Height=\"189\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line24\" Left=\"349.65\" Top=\"481.95\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <TextObject Name=\"Text4\" Left=\"37.8\" Top=\"113.4\" Width=\"94.5\" Height=\"18.9\" Text=\"档案号\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"340.2\" Top=\"113.4\" Width=\"94.5\" Height=\"18.9\" Text=\"规格\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text6\" Left=\"444.15\" Top=\"113.4\" Width=\"94.5\" Height=\"18.9\" Text=\"单位\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text7\" Left=\"576.45\" Top=\"113.4\" Width=\"94.5\" Height=\"18.9\" Text=\"包装规格\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"37.8\" Top=\"151.2\" Width=\"94.5\" Height=\"18.9\" Text=\"药品通用名称\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text9\" Left=\"37.8\" Top=\"189\" Width=\"94.5\" Height=\"18.9\" Text=\"质量标准\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text10\" Left=\"37.8\" Top=\"226.8\" Width=\"94.5\" Height=\"18.9\" Text=\"批准文号\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text11\" Left=\"444.15\" Top=\"226.8\" Width=\"122.85\" Height=\"18.9\" Text=\"药品批件有效期\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <LineObject Name=\"Line25\" Left=\"444.15\" Top=\"217.35\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <TextObject Name=\"Text12\" Left=\"340.2\" Top=\"189\" Width=\"94.5\" Height=\"18.9\" Text=\"剂型\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"37.8\" Top=\"264.6\" Width=\"94.5\" Height=\"18.9\" Text=\"装箱规格\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text14\" Left=\"245.7\" Top=\"264.6\" Width=\"94.5\" Height=\"18.9\" Text=\"有效期\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"463.05\" Top=\"264.6\" Width=\"94.5\" Height=\"18.9\" Text=\"存储条件\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"37.8\" Top=\"302.4\" Width=\"94.5\" Height=\"18.9\" Text=\"生产地址\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"37.8\" Top=\"340.2\" Width=\"94.5\" Height=\"18.9\" Text=\"生产企业\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"463.05\" Top=\"302.4\" Width=\"94.5\" Height=\"18.9\" Text=\"建议零售价\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text19\" Left=\"463.05\" Top=\"340.2\" Width=\"94.5\" Height=\"18.9\" Text=\"供货企业\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text20\" Left=\"37.8\" Top=\"378\" Width=\"94.5\" Height=\"18.9\" Text=\"受委托企业\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text21\" Left=\"463.05\" Top=\"378\" Width=\"94.5\" Height=\"18.9\" Text=\"委托地址\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text22\" Left=\"37.8\" Top=\"415.8\" Width=\"94.5\" Height=\"18.9\" Text=\"联系地址\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text23\" Left=\"463.05\" Top=\"415.8\" Width=\"94.5\" Height=\"18.9\" Text=\"联系人\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text24\" Left=\"37.8\" Top=\"453.6\" Width=\"94.5\" Height=\"18.9\" Text=\"随附资料\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text25\" Left=\"37.8\" Top=\"491.4\" Width=\"94.5\" Height=\"18.9\" Text=\"核查方式\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text26\" Left=\"349.65\" Top=\"491.4\" Width=\"94.5\" Height=\"18.9\" Text=\"核查内容\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text27\" Left=\"37.8\" Top=\"576.45\" Width=\"75.6\" Height=\"37.8\" Text=\"采购部门意见\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text28\" Left=\"28.35\" Top=\"737.1\" Width=\"85.05\" Height=\"37.8\" Text=\"质量管理部意见\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text29\" Left=\"37.8\" Top=\"897.75\" Width=\"94.5\" Height=\"18.9\" Text=\"审批意见\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox1\" Left=\"170.1\" Top=\"557.55\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Checked=\"false\"/>\r\n      <CheckBoxObject Name=\"CheckBox2\" Left=\"170.1\" Top=\"585.9\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text30\" Left=\"198.45\" Top=\"557.55\" Width=\"189\" Height=\"18.9\" Text=\"市场需求，建议采购此品种\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text31\" Left=\"198.45\" Top=\"585.9\" Width=\"189\" Height=\"18.9\" Text=\"市场无需求，建议无需采购此品种\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text32\" Left=\"311.85\" Top=\"642.6\" Width=\"56.7\" Height=\"18.9\" Text=\"签名：\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox3\" Left=\"170.1\" Top=\"718.2\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Checked=\"false\"/>\r\n      <CheckBoxObject Name=\"CheckBox4\" Left=\"170.1\" Top=\"746.55\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text33\" Left=\"198.45\" Top=\"718.2\" Width=\"189\" Height=\"18.9\" Text=\"经审核资料齐全，合法有效\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text34\" Left=\"198.45\" Top=\"746.55\" Width=\"189\" Height=\"18.9\" Text=\"经审核资质不符合规定\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text35\" Left=\"311.85\" Top=\"803.25\" Width=\"56.7\" Height=\"18.9\" Text=\"签名：\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox5\" Left=\"170.1\" Top=\"878.85\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Checked=\"false\"/>\r\n      <CheckBoxObject Name=\"CheckBox6\" Left=\"170.1\" Top=\"907.2\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text36\" Left=\"198.45\" Top=\"878.85\" Width=\"189\" Height=\"18.9\" Text=\"同意购进此品种\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text37\" Left=\"198.45\" Top=\"907.2\" Width=\"189\" Height=\"18.9\" Text=\"不同意购进此品种\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text38\" Left=\"311.85\" Top=\"963.9\" Width=\"56.7\" Height=\"18.9\" Text=\"签名：\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text40\" Left=\"189\" Top=\"151.2\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.tradename]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text41\" Left=\"349.65\" Top=\"151.2\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.specs]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text42\" Left=\"444.15\" Top=\"151.2\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.unit]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text43\" Left=\"510.3\" Top=\"189\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text44\" Left=\"189\" Top=\"189\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.quality_standard]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text45\" Left=\"189\" Top=\"226.8\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.drugnumber]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text46\" Left=\"151.2\" Top=\"264.6\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.piece]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text47\" Left=\"585.9\" Top=\"264.6\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.storage_conditions]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text48\" Left=\"585.9\" Top=\"226.8\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.validity]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text49\" Left=\"160.65\" Top=\"302.4\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.address]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text50\" Left=\"585.9\" Top=\"302.4\" Width=\"94.5\" Height=\"18.9\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text51\" Left=\"160.65\" Top=\"340.2\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.enterprise]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text52\" Left=\"160.65\" Top=\"378\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.entrust]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text53\" Left=\"585.9\" Top=\"378\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.entrust_address]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text54\" Left=\"387.45\" Top=\"642.6\" Width=\"103.95\" Height=\"18.9\" Text=\"[t_fileds.userbypur]\" VertAlign=\"Center\" WordWrap=\"false\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text56\" Left=\"387.45\" Top=\"803.25\" Width=\"113.4\" Height=\"18.9\" Text=\"[t_fileds.userbyqa]\" VertAlign=\"Center\" WordWrap=\"false\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text58\" Left=\"387.45\" Top=\"963.9\" Width=\"122.85\" Height=\"18.9\" Text=\"[t_fileds.userbyhead]\" VertAlign=\"Center\" WordWrap=\"false\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text60\" Left=\"189\" Top=\"113.4\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.docuno]\" VertAlign=\"Center\" Font=\"宋体, 10pt\"/>\r\n      <TextObject Name=\"Text61\" Left=\"491.4\" Top=\"642.6\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.purdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text62\" Left=\"500.85\" Top=\"803.25\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.qadate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text63\" Left=\"510.3\" Top=\"963.9\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.headdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text64\" Left=\"340.2\" Top=\"264.6\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.indate]\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(388675594117189,0,'首营企业审批表',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"09/30/2022 15:29:53\" ReportInfo.Modified=\"10/27/2025 13:51:24\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"indate\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"return_scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n      <Column Name=\"rateamount\" DataType=\"System.Decimal\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" Watermark.Font=\"宋体, 60pt\">\r\n    <DataBand Name=\"Data1\" Width=\"718.2\" Height=\"1020.6\">\r\n      <TextObject Name=\"Text1\" Left=\"207.9\" Top=\"9.45\" Width=\"340.2\" Height=\"28.35\" Text=\"XXXX药品有限公司\" Font=\"宋体, 16pt, style=Bold\"/>\r\n      <LineObject Name=\"Line1\" Left=\"9.45\" Top=\"37.8\" Width=\"699.3\" Border.Width=\"2\"/>\r\n      <TextObject Name=\"Text2\" Left=\"255.15\" Top=\"47.25\" Width=\"217.35\" Height=\"18.9\" Text=\"首营企业审批表\" Font=\"宋体, 16pt, style=Bold\"/>\r\n      <ShapeObject Name=\"Shape1\" Left=\"9.45\" Top=\"94.5\" Width=\"699.3\" Height=\"907.2\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line2\" Left=\"9.45\" Top=\"132.3\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line3\" Left=\"9.45\" Top=\"170.1\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line4\" Left=\"9.45\" Top=\"207.9\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line5\" Left=\"9.45\" Top=\"245.7\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line6\" Left=\"9.45\" Top=\"349.65\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line7\" Left=\"9.45\" Top=\"396.9\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line8\" Left=\"9.45\" Top=\"444.15\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line9\" Left=\"9.45\" Top=\"585.9\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line10\" Left=\"9.45\" Top=\"727.65\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line11\" Left=\"9.45\" Top=\"869.4\" Width=\"699.3\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line12\" Left=\"160.65\" Top=\"94.5\" Height=\"907.2\" Border.Width=\"0.25\"/>\r\n      <TextObject Name=\"Text3\" Left=\"37.8\" Top=\"103.95\" Width=\"94.5\" Height=\"18.9\" Text=\"企业名称\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text4\" Left=\"37.8\" Top=\"141.75\" Width=\"94.5\" Height=\"18.9\" Text=\"注册地址\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"37.8\" Top=\"217.35\" Width=\"94.5\" Height=\"18.9\" Text=\"企业类别\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text6\" Left=\"37.8\" Top=\"179.55\" Width=\"94.5\" Height=\"18.9\" Text=\"仓库地址\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <LineObject Name=\"Line13\" Left=\"292.95\" Top=\"207.9\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line14\" Left=\"396.9\" Top=\"207.9\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line15\" Left=\"491.4\" Top=\"207.9\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <LineObject Name=\"Line16\" Left=\"585.9\" Top=\"207.9\" Height=\"37.8\" Border.Width=\"0.25\"/>\r\n      <TextObject Name=\"Text7\" Left=\"292.95\" Top=\"217.35\" Width=\"94.5\" Height=\"18.9\" Text=\"联系人\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"491.4\" Top=\"217.35\" Width=\"94.5\" Height=\"18.9\" Text=\"联系电话\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text9\" Left=\"37.8\" Top=\"274.05\" Width=\"94.5\" Height=\"37.8\" Text=\"药品经营许可证\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <LineObject Name=\"Line17\" Left=\"160.65\" Top=\"283.5\" Width=\"548.1\" Border.Width=\"0.25\"/>\r\n      <TextObject Name=\"Text10\" Left=\"170.1\" Top=\"255.15\" Width=\"75.6\" Height=\"18.9\" Text=\"许可证号\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text11\" Left=\"481.95\" Top=\"255.15\" Width=\"94.5\" Height=\"18.9\" Text=\"有效期\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text12\" Left=\"170.1\" Top=\"292.95\" Width=\"94.5\" Height=\"18.9\" Text=\"经营范围\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"37.8\" Top=\"368.55\" Width=\"94.5\" Height=\"18.9\" Text=\"营业执照\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text14\" Left=\"170.1\" Top=\"368.55\" Width=\"94.5\" Height=\"18.9\" Text=\"注册号\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"37.8\" Top=\"415.8\" Width=\"94.5\" Height=\"18.9\" Text=\"银行开户信息\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"170.1\" Top=\"415.8\" Width=\"94.5\" Height=\"18.9\" Text=\"开户行\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"453.6\" Top=\"415.8\" Width=\"94.5\" Height=\"18.9\" Text=\"开户账号\" HorzAlign=\"Center\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"37.8\" Top=\"500.85\" Width=\"122.85\" Height=\"18.9\" Text=\"首营企业必备资料\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox1\" Left=\"576.45\" Top=\"538.65\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text19\" Left=\"604.8\" Top=\"538.65\" Width=\"94.5\" Height=\"18.9\" Text=\"药品经营许可证\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox2\" Left=\"170.1\" Top=\"481.95\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text20\" Left=\"198.45\" Top=\"538.65\" Width=\"94.5\" Height=\"18.9\" Text=\"营业执照\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox3\" Left=\"170.1\" Top=\"510.3\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text21\" Left=\"453.6\" Top=\"453.6\" Width=\"94.5\" Height=\"18.9\" Text=\"税务登记证\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox4\" Left=\"425.25\" Top=\"453.6\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text22\" Left=\"198.45\" Top=\"481.95\" Width=\"94.5\" Height=\"18.9\" Text=\"质量保证协议\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox5\" Left=\"425.25\" Top=\"481.95\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text23\" Left=\"198.45\" Top=\"510.3\" Width=\"94.5\" Height=\"18.9\" Text=\"法人委托书\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox6\" Left=\"425.25\" Top=\"510.3\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text24\" Left=\"453.6\" Top=\"510.3\" Width=\"94.5\" Height=\"18.9\" Text=\"身份证复印件\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox7\" Left=\"576.45\" Top=\"453.6\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text25\" Left=\"604.8\" Top=\"453.6\" Width=\"94.5\" Height=\"18.9\" Text=\"质量体系调查表\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox8\" Left=\"576.45\" Top=\"481.95\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text26\" Left=\"604.8\" Top=\"481.95\" Width=\"94.5\" Height=\"18.9\" Text=\"随货同行单样本\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox9\" Left=\"576.45\" Top=\"510.3\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text27\" Left=\"604.8\" Top=\"510.3\" Width=\"94.5\" Height=\"18.9\" Text=\"印章备案\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox10\" Left=\"170.1\" Top=\"538.65\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text28\" Left=\"453.6\" Top=\"481.95\" Width=\"94.5\" Height=\"18.9\" Text=\"开票信息\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox11\" Left=\"425.25\" Top=\"538.65\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text29\" Left=\"453.6\" Top=\"538.65\" Width=\"94.5\" Height=\"18.9\" Text=\"开户许可证\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text30\" Left=\"37.8\" Top=\"633.15\" Width=\"94.5\" Height=\"18.9\" Text=\"采购部门意见\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox12\" Left=\"170.1\" Top=\"633.15\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text31\" Left=\"198.45\" Top=\"633.15\" Width=\"189\" Height=\"18.9\" Text=\"市场需求，建议发生业务往来\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text32\" Left=\"321.3\" Top=\"689.85\" Width=\"56.7\" Height=\"18.9\" Text=\"签名\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text33\" Left=\"37.8\" Top=\"784.35\" Width=\"94.5\" Height=\"18.9\" Text=\"质量管理部意见\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox13\" Left=\"170.1\" Top=\"746.55\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text34\" Left=\"198.45\" Top=\"746.55\" Width=\"292.95\" Height=\"18.9\" Text=\"经审核，资料齐全、合法有效，建议发生业务往来\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox14\" Left=\"170.1\" Top=\"784.35\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text35\" Left=\"198.45\" Top=\"784.35\" Width=\"292.95\" Height=\"18.9\" Text=\"经审核，资质不符合规定，建议不发生业务往来\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text36\" Left=\"321.3\" Top=\"841.05\" Width=\"66.15\" Height=\"18.9\" Text=\"签名\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text37\" Left=\"37.8\" Top=\"926.1\" Width=\"94.5\" Height=\"18.9\" Text=\"审批意见\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox15\" Left=\"170.1\" Top=\"888.3\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text38\" Left=\"198.45\" Top=\"888.3\" Width=\"292.95\" Height=\"18.9\" Text=\"同意作业合格供货方\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox16\" Left=\"170.1\" Top=\"926.1\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text39\" Left=\"198.45\" Top=\"926.1\" Width=\"292.95\" Height=\"18.9\" Text=\"不同意作为合格供货方\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text40\" Left=\"321.3\" Top=\"973.35\" Width=\"75.6\" Height=\"18.9\" Text=\"质量负责人\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text41\" Left=\"9.45\" Top=\"75.6\" Width=\"198.45\" Height=\"18.9\" Text=\"[t_fileds.docuno]\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text42\" Left=\"557.55\" Top=\"75.6\" Width=\"151.2\" Height=\"18.9\" Text=\"日期：[Date]\" Format=\"Date\" Format.Format=\"d\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text43\" Left=\"179.55\" Top=\"103.95\" Width=\"387.45\" Height=\"18.9\" Text=\"[t_fileds.ename]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text44\" Left=\"179.55\" Top=\"141.75\" Width=\"444.15\" Height=\"18.9\" Text=\"[t_fileds.address]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text45\" Left=\"179.55\" Top=\"179.55\" Width=\"444.15\" Height=\"18.9\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text46\" Left=\"179.55\" Top=\"217.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.category]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text47\" Left=\"396.9\" Top=\"217.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.legalbyname]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text48\" Left=\"595.35\" Top=\"217.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.salephone]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text49\" Left=\"245.7\" Top=\"255.15\" Width=\"236.25\" Height=\"18.9\" Text=\"[t_fileds.drugspermit]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text50\" Left=\"576.45\" Top=\"255.15\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.drugsdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text51\" Left=\"264.6\" Top=\"292.95\" Width=\"434.7\" Height=\"47.25\" Text=\"[t_fileds.busicope]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text52\" Left=\"264.6\" Top=\"368.55\" Width=\"198.45\" Height=\"18.9\" Text=\"[t_fileds.busipermit]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text53\" Left=\"274.05\" Top=\"415.8\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.bank]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text54\" Left=\"548.1\" Top=\"415.8\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.bankcode]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text55\" Left=\"387.45\" Top=\"689.85\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.userbypur]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text57\" Left=\"396.9\" Top=\"973.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.userbyhead]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <CheckBoxObject Name=\"CheckBox17\" Left=\"170.1\" Top=\"453.6\" Width=\"18.9\" Height=\"18.9\" Border.Lines=\"All\" Border.Width=\"0.25\" Checked=\"false\"/>\r\n      <TextObject Name=\"Text58\" Left=\"198.45\" Top=\"453.6\" Width=\"94.5\" Height=\"18.9\" Text=\"上年度工商年检\" VertAlign=\"Center\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text59\" Left=\"302.4\" Top=\"453.6\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.busi_year]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text60\" Left=\"302.4\" Top=\"481.95\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.qualitydate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text61\" Left=\"302.4\" Top=\"510.3\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.legaldate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text62\" Left=\"481.95\" Top=\"689.85\" Width=\"71.82\" Height=\"18.9\" Text=\"[t_fileds.purdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text63\" Left=\"491.4\" Top=\"841.05\" Width=\"62.37\" Height=\"18.9\" Text=\"[t_fileds.qadate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text64\" Left=\"491.4\" Top=\"973.35\" Width=\"62.37\" Height=\"18.9\" Text=\"[t_fileds.headdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text65\" Left=\"387.45\" Top=\"841.05\" Width=\"94.5\" Height=\"22.68\" Text=\"[t_fileds.userbyqa]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <LineObject Name=\"Line18\" Left=\"463.05\" Top=\"349.65\" Height=\"47.25\"/>\r\n      <LineObject Name=\"Line19\" Left=\"538.65\" Top=\"349.65\" Height=\"47.25\"/>\r\n      <TextObject Name=\"Text66\" Left=\"472.5\" Top=\"368.55\" Width=\"66.15\" Height=\"18.9\" Text=\"法人\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text67\" Left=\"557.55\" Top=\"368.55\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.legal_person]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(397841669546053,2,'销售开票单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"03/20/2023 14:42:06\" ReportInfo.Modified=\"11/07/2025 11:20:03\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    string jx=&quot;&quot;;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n        jx=Report.GetColumnValue(&quot;t_fileds.dosage&quot;).ToString();\r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n            \r\n      if ((counter&gt;=5)||!jx.Equals(Report.GetColumnValue(&quot;t_fileds.dosage&quot;).ToString().Trim()))\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n       // jx=Report.GetColumnValue(&quot;t_fileds.dosage&quot;).ToString();\r\n        \r\n      }\r\n      counter++;\r\n       \r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        jx=Report.GetColumnValue(&quot;t_fileds.dosage&quot;).ToString();\r\n        qty+=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.amount&quot;));        \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"indate\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n      <Column Name=\"return_scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"rateamount\" DataType=\"System.Decimal\"/>\r\n    </TableDataSource>\r\n    <Total Name=\"Total\" Expression=\"[t_fileds.amount]\" Evaluator=\"Data1\" PrintOn=\"PageFooter1\"/>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"300\" PaperHeight=\"93.3\" LeftMargin=\"0\" TopMargin=\"12\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1134\" Height=\"75.6\">\r\n      <TextObject Name=\"Text2\" Left=\"56.7\" Top=\"28.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.ecode]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text3\" Left=\"56.7\" Top=\"47.25\" Width=\"444.15\" Height=\"18.9\" Text=\"[t_fileds.ename]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text5\" Left=\"302.4\" Top=\"28.35\" Width=\"141.75\" Height=\"18.9\" Text=\"销售日期:[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 10pt, style=Bold\"/>\r\n      <TextObject Name=\"Text6\" Left=\"510.3\" Top=\"9.45\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt, style=Bold\"/>\r\n      <TextObject Name=\"Text7\" Left=\"510.3\" Top=\"28.35\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.saleman]\" WordWrap=\"false\" Font=\"宋体, 9pt, style=Bold\"/>\r\n      <TextObject Name=\"Text8\" Left=\"510.3\" Top=\"47.25\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text9\" Left=\"859.95\" Top=\"37.8\" Width=\"245.7\" Height=\"28.35\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt, style=Bold\"/>\r\n      <TextObject Name=\"Text10\" Left=\"859.95\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text11\" Left=\"302.4\" Top=\"9.45\" Width=\"198.45\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 10pt, style=Bold\"/>\r\n      <TextObject Name=\"Text30\" Left=\"718.2\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text31\" Left=\"652.05\" Top=\"47.25\" Width=\"207.9\" Height=\"18.9\" Text=\"折前金额：[t_fileds.rateamount]\" Font=\"宋体, 12pt, style=Bold\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1134\" Height=\"37.8\" BeforePrintEvent=\"Data1_BeforePrint\" DataSource=\"t_fileds\">\r\n      <TextObject Name=\"Text12\" Left=\"9.45\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.shelfno]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"75.6\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.tradename]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text14\" Left=\"75.6\" Top=\"18.9\" Width=\"189\" Height=\"18.9\" Text=\"[t_fileds.drugnumber]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"340.2\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"425.25\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.unit]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"472.5\" Width=\"113.4\" Height=\"37.8\" Text=\"[t_fileds.specs]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"264.6\" Top=\"18.9\" Width=\"340.2\" Height=\"18.9\" Text=\"[t_fileds.enterprise]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text19\" Left=\"604.8\" Top=\"18.9\" Width=\"368.55\" Height=\"18.9\" Text=\"[t_fileds.holder]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text20\" Left=\"585.9\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.scalar]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text21\" Left=\"652.05\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.packages]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text22\" Left=\"699.3\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.openprice]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text23\" Left=\"784.35\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text24\" Left=\"869.4\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.batch]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text25\" Left=\"963.9\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.indate]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text26\" Left=\"1039.5\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.prodate]\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"121.4\" Width=\"1134\" Height=\"18.9\">\r\n      <TextObject Name=\"Text27\" Left=\"179.55\" Width=\"264.6\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text29\" Left=\"774.9\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text28\" Left=\"538.65\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(401023964332101,3,'销售调价冲差单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"03/29/2023 14:31:50\" ReportInfo.Modified=\"02/29/2024 17:17:24\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n       \r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n      \r\n      \r\n      if (counter &gt;= 5)\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n      }\r\n      counter++;\r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        \r\n        qty=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.total_amount&quot;));       \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"indate\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n      <Column Name=\"return_scalar\" DataType=\"System.Decimal\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"300\" PaperHeight=\"83.3\" LeftMargin=\"0\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1134\" Height=\"75.6\">\r\n      <TextObject Name=\"Text1\" Left=\"47.25\" Top=\"9.45\" Width=\"151.2\" Height=\"18.9\" Text=\"[t_fileds.rovaldate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text2\" Left=\"47.25\" Top=\"28.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.ecode]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text3\" Left=\"47.25\" Top=\"47.25\" Width=\"245.7\" Height=\"18.9\" Text=\"[t_fileds.ename]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text4\" Left=\"292.95\" Top=\"9.45\" Width=\"170.1\" Height=\"18.9\" Text=\"打印日期[Date]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"292.95\" Top=\"28.35\" Width=\"170.1\" Height=\"18.9\" Text=\"开票日期[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text6\" Left=\"500.85\" Top=\"9.45\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text7\" Left=\"500.85\" Top=\"28.35\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.saleman]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"500.85\" Top=\"47.25\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text9\" Left=\"850.5\" Top=\"37.8\" Width=\"264.6\" Height=\"37.8\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text10\" Left=\"850.5\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text11\" Left=\"292.95\" Top=\"47.25\" Width=\"170.1\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1134\" Height=\"32.35\" BeforePrintEvent=\"Data1_BeforePrint\">\r\n      <TextObject Name=\"Text30\" Left=\"680.4\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.total_amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text31\" Left=\"47.25\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"冲差\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"115.95\" Width=\"1134\" Height=\"26.9\">\r\n      <TextObject Name=\"Text27\" Left=\"170.1\" Top=\"8\" Width=\"207.9\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text28\" Left=\"529.2\" Top=\"8\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text29\" Left=\"765.45\" Top=\"8\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(411673552490565,4,'采购入库单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"03/20/2023 14:42:06\" ReportInfo.Modified=\"03/07/2024 11:12:17\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n       \r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n      \r\n      \r\n      if (counter &gt;= 5)\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n      }\r\n      counter++;\r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        \r\n        qty+=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.amount&quot;));       \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"indate\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n      <Column Name=\"return_scalar\" DataType=\"System.Decimal\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"300\" PaperHeight=\"93.3\" LeftMargin=\"0\" TopMargin=\"12\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1134\" Height=\"75.6\">\r\n      <TextObject Name=\"Text1\" Left=\"56.7\" Top=\"9.45\" Width=\"151.2\" Height=\"18.9\" Text=\"[t_fileds.rovaldate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text2\" Left=\"56.7\" Top=\"28.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.ecode]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text3\" Left=\"56.7\" Top=\"47.25\" Width=\"245.7\" Height=\"18.9\" Text=\"[t_fileds.ename]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text4\" Left=\"302.4\" Top=\"9.45\" Width=\"170.1\" Height=\"18.9\" Text=\"打印日期[Date]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"302.4\" Top=\"28.35\" Width=\"170.1\" Height=\"18.9\" Text=\"开票日期[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text6\" Left=\"510.3\" Top=\"9.45\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text7\" Left=\"510.3\" Top=\"28.35\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.saleman]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"510.3\" Top=\"47.25\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text9\" Left=\"859.95\" Top=\"37.8\" Width=\"245.7\" Height=\"28.35\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text10\" Left=\"859.95\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text11\" Left=\"302.4\" Top=\"47.25\" Width=\"170.1\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text30\" Left=\"746.55\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.order_type]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1134\" Height=\"37.8\" BeforePrintEvent=\"Data1_BeforePrint\" DataSource=\"t_fileds\">\r\n      <TextObject Name=\"Text12\" Left=\"9.45\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.shelfno]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"75.6\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.tradename]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text14\" Left=\"75.6\" Top=\"18.9\" Width=\"189\" Height=\"18.9\" Text=\"[t_fileds.drugnumber]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"340.2\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"425.25\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.unit]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"472.5\" Width=\"113.4\" Height=\"18.9\" Text=\"[t_fileds.specs]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"264.6\" Top=\"18.9\" Width=\"340.2\" Height=\"18.9\" Text=\"[t_fileds.enterprise]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text19\" Left=\"604.8\" Top=\"18.9\" Width=\"368.55\" Height=\"18.9\" Text=\"[t_fileds.holder]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text20\" Left=\"585.9\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.scalar]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text21\" Left=\"652.05\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.packages]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text22\" Left=\"699.3\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.openprice]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text23\" Left=\"784.35\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text24\" Left=\"869.4\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.batch]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text25\" Left=\"963.9\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.indate]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text26\" Left=\"1039.5\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.prodate]\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"121.4\" Width=\"1134\" Height=\"18.9\">\r\n      <TextObject Name=\"Text27\" Left=\"179.55\" Width=\"207.9\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text28\" Left=\"538.65\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text29\" Left=\"774.9\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(411673590804549,5,'采购调价单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"03/29/2023 14:31:50\" ReportInfo.Modified=\"03/29/2023 15:29:08\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n       \r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n      \r\n      \r\n      if (counter &gt;= 5)\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n      }\r\n      counter++;\r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        \r\n        qty=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.total_amount&quot;));       \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"indate\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"300\" PaperHeight=\"83.3\" LeftMargin=\"0\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1134\" Height=\"75.6\">\r\n      <TextObject Name=\"Text1\" Left=\"47.25\" Top=\"9.45\" Width=\"151.2\" Height=\"18.9\" Text=\"[t_fileds.rovaldate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text2\" Left=\"47.25\" Top=\"28.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.ecode]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text3\" Left=\"47.25\" Top=\"47.25\" Width=\"245.7\" Height=\"18.9\" Text=\"[t_fileds.ename]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text4\" Left=\"292.95\" Top=\"9.45\" Width=\"170.1\" Height=\"18.9\" Text=\"打印日期[Date]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"292.95\" Top=\"28.35\" Width=\"170.1\" Height=\"18.9\" Text=\"开票日期[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text6\" Left=\"500.85\" Top=\"9.45\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text7\" Left=\"500.85\" Top=\"28.35\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.saleman]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"500.85\" Top=\"47.25\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text9\" Left=\"850.5\" Top=\"37.8\" Width=\"245.7\" Height=\"18.9\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text10\" Left=\"850.5\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text11\" Left=\"292.95\" Top=\"47.25\" Width=\"170.1\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1134\" Height=\"32.35\" BeforePrintEvent=\"Data1_BeforePrint\">\r\n      <TextObject Name=\"Text30\" Left=\"680.4\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.total_amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text31\" Left=\"47.25\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"冲差\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"115.95\" Width=\"1134\" Height=\"26.9\">\r\n      <TextObject Name=\"Text27\" Left=\"170.1\" Top=\"8\" Width=\"207.9\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text28\" Left=\"529.2\" Top=\"8\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text29\" Left=\"765.45\" Top=\"8\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(474579737833541,6,'采购退货单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"03/20/2023 14:42:06\" ReportInfo.Modified=\"10/23/2023 11:06:59\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n       \r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n      \r\n      \r\n      if (counter &gt;= 5)\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n      }\r\n      counter++;\r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        \r\n        qty+=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.amount&quot;));       \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"indate\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"300\" PaperHeight=\"93.3\" LeftMargin=\"0\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1134\" Height=\"75.6\">\r\n      <TextObject Name=\"Text1\" Left=\"56.7\" Top=\"9.45\" Width=\"151.2\" Height=\"18.9\" Text=\"[t_fileds.rovaldate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text2\" Left=\"56.7\" Top=\"28.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.ecode]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text3\" Left=\"56.7\" Top=\"47.25\" Width=\"245.7\" Height=\"18.9\" Text=\"[t_fileds.ename]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text4\" Left=\"302.4\" Top=\"9.45\" Width=\"170.1\" Height=\"18.9\" Text=\"打印日期[Date]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"302.4\" Top=\"28.35\" Width=\"170.1\" Height=\"18.9\" Text=\"开票日期[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text6\" Left=\"510.3\" Top=\"9.45\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text7\" Left=\"510.3\" Top=\"28.35\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.saleman]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"510.3\" Top=\"47.25\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text9\" Left=\"859.95\" Top=\"37.8\" Width=\"245.7\" Height=\"28.35\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text10\" Left=\"859.95\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text11\" Left=\"302.4\" Top=\"47.25\" Width=\"170.1\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text30\" Left=\"746.55\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.order_type]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1134\" Height=\"37.8\" BeforePrintEvent=\"Data1_BeforePrint\" DataSource=\"t_fileds\">\r\n      <TextObject Name=\"Text12\" Left=\"9.45\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.shelfno]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"75.6\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.tradename]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text14\" Left=\"75.6\" Top=\"18.9\" Width=\"189\" Height=\"18.9\" Text=\"[t_fileds.drugnumber]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"378\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"425.25\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.unit]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"472.5\" Width=\"113.4\" Height=\"18.9\" Text=\"[t_fileds.specs]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"264.6\" Top=\"18.9\" Width=\"340.2\" Height=\"18.9\" Text=\"[t_fileds.enterprise]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text19\" Left=\"604.8\" Top=\"18.9\" Width=\"368.55\" Height=\"18.9\" Text=\"[t_fileds.holder]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text20\" Left=\"585.9\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.return_scalar]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text21\" Left=\"652.05\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.packages]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text22\" Left=\"699.3\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.openprice]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text23\" Left=\"784.35\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text24\" Left=\"869.4\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.batch]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text25\" Left=\"963.9\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.indate]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text26\" Left=\"1039.5\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.prodate]\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"121.4\" Width=\"1134\" Height=\"18.9\">\r\n      <TextObject Name=\"Text27\" Left=\"179.55\" Width=\"207.9\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text28\" Left=\"538.65\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text29\" Left=\"774.9\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(510400561565765,7,'销售退货单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"02/01/2024 16:05:16\" ReportInfo.Modified=\"09/18/2025 13:36:32\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n       \r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n      \r\n      \r\n      if (counter &gt;= 5)\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n      }\r\n      counter++;\r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        \r\n        qty+=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.amount&quot;));       \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"return_scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"indate\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n      <Column Name=\"rateamount\" DataType=\"System.Decimal\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"279.9\" PaperHeight=\"93.2\" RawPaperSize=\"125\" LeftMargin=\"0\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1058.02\" Height=\"75.6\">\r\n      <TextObject Name=\"Text2\" Left=\"37.8\" Top=\"37.8\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.ecode]\" WordWrap=\"false\" Font=\"宋体, 9pt, style=Bold\"/>\r\n      <TextObject Name=\"Text3\" Left=\"37.8\" Top=\"56.7\" Width=\"245.7\" Height=\"18.9\" Text=\"[t_fileds.ename]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text5\" Left=\"255.15\" Top=\"37.8\" Width=\"137.97\" Height=\"18.9\" Text=\"开票日期[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 10pt, style=Bold\"/>\r\n      <TextObject Name=\"Text6\" Left=\"434.7\" Top=\"18.9\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt, style=Bold\"/>\r\n      <TextObject Name=\"Text7\" Left=\"434.7\" Top=\"37.8\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.saleman]\" WordWrap=\"false\" Font=\"宋体, 9pt, style=Bold\"/>\r\n      <TextObject Name=\"Text8\" Left=\"434.7\" Top=\"56.7\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text9\" Left=\"784.35\" Top=\"47.25\" Width=\"245.7\" Height=\"28.35\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt, style=Bold\"/>\r\n      <TextObject Name=\"Text10\" Left=\"784.35\" Top=\"18.9\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text11\" Left=\"255.15\" Top=\"56.7\" Width=\"170.1\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 10pt, style=Bold\"/>\r\n      <TextObject Name=\"Text30\" Left=\"670.95\" Top=\"18.9\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.order_type]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1058.02\" Height=\"37.8\" BeforePrintEvent=\"Data1_BeforePrint\" DataSource=\"t_fileds\">\r\n      <TextObject Name=\"Text12\" Left=\"-9.45\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.shelfno]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"37.8\" Width=\"264.6\" Height=\"18.9\" Text=\"[t_fileds.tradename]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text14\" Left=\"37.8\" Top=\"18.9\" Width=\"170.1\" Height=\"18.9\" Text=\"[t_fileds.drugnumber]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"255.15\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"349.65\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.unit]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"396.9\" Width=\"141.75\" Height=\"18.9\" Text=\"[t_fileds.specs]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"207.9\" Top=\"18.9\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.enterprise]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text19\" Left=\"548.1\" Top=\"18.9\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.holder]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text20\" Left=\"529.2\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.scalar]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text21\" Left=\"595.35\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.packages]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text22\" Left=\"661.5\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.openprice]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text23\" Left=\"737.1\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text24\" Left=\"812.7\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.batch]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text25\" Left=\"897.75\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.indate]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text26\" Left=\"982.8\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.prodate]\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"121.4\" Width=\"1058.02\" Height=\"18.9\">\r\n      <TextObject Name=\"Text27\" Left=\"160.65\" Width=\"207.9\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text28\" Left=\"519.75\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text29\" Left=\"784.35\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(510401715478597,8,'销售冲票单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"02/01/2024 16:27:58\" ReportInfo.Modified=\"09/18/2025 13:37:40\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n       \r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n      \r\n      \r\n      if (counter &gt;= 5)\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n      }\r\n      counter++;\r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        \r\n        qty+=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.amount&quot;));       \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary/>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"279.9\" PaperHeight=\"93.2\" RawPaperSize=\"125\" LeftMargin=\"0\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1058.02\" Height=\"75.6\">\r\n      <TextObject Name=\"Text2\" Left=\"28.35\" Top=\"28.35\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.ecode]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text3\" Left=\"28.35\" Top=\"47.25\" Width=\"245.7\" Height=\"18.9\" Text=\"[t_fileds.ename]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text4\" Left=\"217.35\" Top=\"9.45\" Width=\"170.1\" Height=\"18.9\" Text=\"打印日期[Date]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"217.35\" Top=\"28.35\" Width=\"170.1\" Height=\"18.9\" Text=\"开票日期[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text6\" Left=\"425.25\" Top=\"9.45\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text7\" Left=\"425.25\" Top=\"28.35\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.saleman]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"425.25\" Top=\"47.25\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text9\" Left=\"774.9\" Top=\"37.8\" Width=\"245.7\" Height=\"28.35\" Text=\"[t_fileds.shipaddress]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text10\" Left=\"774.9\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text11\" Left=\"217.35\" Top=\"47.25\" Width=\"170.1\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text30\" Left=\"661.5\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.order_type]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1058.02\" Height=\"37.8\" BeforePrintEvent=\"Data1_BeforePrint\">\r\n      <TextObject Name=\"Text14\" Left=\"37.8\" Top=\"18.9\" Width=\"170.1\" Height=\"18.9\" Text=\"[t_fileds.drugnumber]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"207.9\" Top=\"18.9\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.enterprise]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text19\" Left=\"548.1\" Top=\"18.9\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.holder]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text12\" Left=\"-9.45\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.shelfno]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"37.8\" Width=\"264.6\" Height=\"18.9\" Text=\"[t_fileds.tradename]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"264.6\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"349.65\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.unit]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"396.9\" Width=\"141.75\" Height=\"18.9\" Text=\"[t_fileds.specs]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text20\" Left=\"529.2\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.scalar]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text21\" Left=\"595.35\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.packages]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text22\" Left=\"661.5\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.openprice]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text23\" Left=\"737.1\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text24\" Left=\"812.7\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.batch]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text25\" Left=\"897.75\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.indate]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text26\" Left=\"982.8\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.prodate]\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"121.4\" Width=\"1058.02\" Height=\"18.9\">\r\n      <TextObject Name=\"Text27\" Left=\"179.55\" Width=\"207.9\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text28\" Left=\"538.65\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text29\" Left=\"803.25\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n'),(545011121496133,9,'报损报溢单',NULL,_binary '﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"03/20/2023 14:42:06\" ReportInfo.Modified=\"05/09/2024 11:29:27\" ReportInfo.CreatorVersion=\"2022.2.12.0\">\r\n  <ScriptText>using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Windows.Forms;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing FastReport;\r\nusing FastReport.Data;\r\nusing FastReport.Dialog;\r\nusing FastReport.Barcode;\r\nusing FastReport.Table;\r\nusing FastReport.Utils;\r\n\r\nnamespace FastReport\r\n{\r\n  public class ReportScript\r\n  {\r\n    #region 人民币转换\r\n    decimal amount=0;\r\n    private static string StrTran(string s, string oldv, string newv)\r\n    {\r\n      return s.Replace(oldv, newv);\r\n    }\r\n\r\n    /// &lt;summary&gt;\r\n    /// 转换大写人民币\r\n    /// &lt;/summary&gt;\r\n    /// &lt;param name=&quot;r&quot;&gt;&lt;/param&gt;\r\n    /// &lt;returns&gt;&lt;/returns&gt;\r\n    public static string RMBToString(decimal r)\r\n    {\r\n      decimal r1;\r\n      string s1 = &quot;零壹贰叁肆伍陆柒捌玖&quot;;\r\n      string s2 = &quot;分角元拾佰仟万拾佰仟亿拾佰仟万&quot;;\r\n      string dx, s;\r\n      r1 = r;\r\n      dx = &quot;&quot;;\r\n      if (r1 &lt; 0)\r\n      {\r\n        r1 *= -1;\r\n        dx = &quot;负&quot;;\r\n      }\r\n      s = String.Format(&quot;{0:f0}&quot;, r1 * 100);\r\n      int len = s.Length;\r\n      for (int i = 0; i &lt; len; i++)\r\n      {\r\n        dx = dx + s1.Substring(s[i] - \'0\', 1) + s2.Substring(len - i - 1, 1);\r\n      }\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零仟&quot;, &quot;零&quot;), &quot;零佰&quot;, &quot;零&quot;), &quot;零拾&quot;, &quot;零&quot;), &quot;零角&quot;, &quot;零&quot;), &quot;零分&quot;, &quot;整&quot;);\r\n      dx = StrTran(StrTran(StrTran(StrTran(StrTran(dx, &quot;零零&quot;, &quot;零&quot;), &quot;零零&quot;, &quot;零&quot;), &quot;零亿&quot;, &quot;亿&quot;), &quot;零万&quot;, &quot;万&quot;), &quot;零元&quot;, &quot;元&quot;);\r\n      if (dx == &quot;整&quot;)\r\n        return &quot;零元整&quot;;\r\n      else\r\n        return StrTran(StrTran(StrTran(dx, &quot;亿万&quot;, &quot;亿零&quot;), &quot;零整&quot;, &quot;整&quot;), &quot;零零&quot;, &quot;零&quot;);\r\n    }\r\n    #endregion\r\n    \r\n    decimal qty=0m;\r\n    int counter=0;\r\n    private void Page1_StartPage(object sender, EventArgs e)\r\n    {\r\n      if(Engine.FinalPass)\r\n      {\r\n       \r\n        qty=0;     \r\n      }\r\n    }\r\n\r\n    private void Data1_BeforePrint(object sender, EventArgs e)\r\n    {\r\n      \r\n      \r\n      if (counter &gt;= 5)\r\n      {\r\n        \r\n        Engine.StartNewPage();\r\n        qty=0;\r\n        counter = 0;\r\n      }\r\n      counter++;\r\n         \r\n     \r\n      if(Engine.FinalPass)\r\n      { \r\n        \r\n        \r\n        qty+=Convert.ToDecimal(Report.GetColumnValue(&quot;t_fileds.amount&quot;));       \r\n        Text28.Text=qty.ToString(&quot;F2&quot;);\r\n        Text27.Text=RMBToString(qty);                    \r\n        \r\n      }\r\n    }\r\n  }\r\n}\r\n</ScriptText>\r\n  <Dictionary>\r\n    <TableDataSource Name=\"t_fileds\" ReferenceName=\"t_fileds\" DataType=\"System.Int32\" Enabled=\"true\">\r\n      <Column Name=\"busiid\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"ecode\" DataType=\"System.String\"/>\r\n      <Column Name=\"ename\" DataType=\"System.String\"/>\r\n      <Column Name=\"docuno\" DataType=\"System.String\"/>\r\n      <Column Name=\"address\" DataType=\"System.String\"/>\r\n      <Column Name=\"shipaddress\" DataType=\"System.String\"/>\r\n      <Column Name=\"recphone\" DataType=\"System.String\"/>\r\n      <Column Name=\"receiver\" DataType=\"System.String\"/>\r\n      <Column Name=\"category\" DataType=\"System.String\"/>\r\n      <Column Name=\"legalbyname\" DataType=\"System.String\"/>\r\n      <Column Name=\"salephone\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugspermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"busicope\" DataType=\"System.String\"/>\r\n      <Column Name=\"busipermit\" DataType=\"System.String\"/>\r\n      <Column Name=\"bank\" DataType=\"System.String\"/>\r\n      <Column Name=\"bankcode\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugsdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qualitydate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"gmpdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"busi_year\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"legal_person\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbypur\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyqa\" DataType=\"System.String\"/>\r\n      <Column Name=\"userbyhead\" DataType=\"System.String\"/>\r\n      <Column Name=\"purdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"qadate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"headdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"id\" DataType=\"System.Int64\"/>\r\n      <Column Name=\"code\" DataType=\"System.String\"/>\r\n      <Column Name=\"tradename\" DataType=\"System.String\"/>\r\n      <Column Name=\"specs\" DataType=\"System.String\"/>\r\n      <Column Name=\"unit\" DataType=\"System.String\"/>\r\n      <Column Name=\"enterprise\" DataType=\"System.String\"/>\r\n      <Column Name=\"quality_standard\" DataType=\"System.String\"/>\r\n      <Column Name=\"dosage\" DataType=\"System.String\"/>\r\n      <Column Name=\"drugnumber\" DataType=\"System.String\"/>\r\n      <Column Name=\"validity\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"piece\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"indate\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"storage_conditions\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust\" DataType=\"System.String\"/>\r\n      <Column Name=\"entrust_address\" DataType=\"System.String\"/>\r\n      <Column Name=\"holder\" DataType=\"System.String\"/>\r\n      <Column Name=\"total_amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"amount\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"scalar\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"openprice\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"batch\" DataType=\"System.String\"/>\r\n      <Column Name=\"prodate\" DataType=\"System.String\"/>\r\n      <Column Name=\"packages\" DataType=\"System.Decimal\"/>\r\n      <Column Name=\"saleman\" DataType=\"System.String\"/>\r\n      <Column Name=\"user_name\" DataType=\"System.String\"/>\r\n      <Column Name=\"orderid\" DataType=\"System.Int32\"/>\r\n      <Column Name=\"order_type\" DataType=\"System.Int16\"/>\r\n      <Column Name=\"rovaldate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"createdate\" DataType=\"System.DateTime\"/>\r\n      <Column Name=\"shelfno\" DataType=\"System.String\"/>\r\n      <Column Name=\"return_scalar\" DataType=\"System.Decimal\"/>\r\n    </TableDataSource>\r\n  </Dictionary>\r\n  <ReportPage Name=\"Page1\" PaperWidth=\"300\" PaperHeight=\"93.3\" LeftMargin=\"0\" TopMargin=\"12\" RightMargin=\"0\" BottomMargin=\"5\" FirstPageSource=\"15\" OtherPagesSource=\"15\" LastPageSource=\"15\" Watermark.Font=\"宋体, 60pt\" StartPageEvent=\"Page1_StartPage\">\r\n    <PageHeaderBand Name=\"PageHeader1\" Width=\"1134\" Height=\"75.6\">\r\n      <TextObject Name=\"Text1\" Left=\"56.7\" Top=\"9.45\" Width=\"151.2\" Height=\"18.9\" Text=\"[t_fileds.rovaldate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text4\" Left=\"302.4\" Top=\"9.45\" Width=\"170.1\" Height=\"18.9\" Text=\"打印日期[Date]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text5\" Left=\"302.4\" Top=\"28.35\" Width=\"170.1\" Height=\"18.9\" Text=\"开票日期[t_fileds.createdate]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text6\" Left=\"510.3\" Top=\"9.45\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.user_name]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text8\" Left=\"510.3\" Top=\"47.25\" Width=\"132.3\" Height=\"18.9\" Text=\"[t_fileds.orderid]\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text10\" Left=\"859.95\" Top=\"9.45\" Width=\"141.75\" Height=\"18.9\" Text=\"总金额:[t_fileds.total_amount]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text11\" Left=\"302.4\" Top=\"47.25\" Width=\"170.1\" Height=\"18.9\" Text=\"第[Page]页/共[TotalPages#]页\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text30\" Left=\"746.55\" Top=\"9.45\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.order_type]\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n    </PageHeaderBand>\r\n    <DataBand Name=\"Data1\" Top=\"79.6\" Width=\"1134\" Height=\"37.8\" BeforePrintEvent=\"Data1_BeforePrint\" DataSource=\"t_fileds\">\r\n      <TextObject Name=\"Text12\" Left=\"9.45\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.shelfno]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text13\" Left=\"75.6\" Width=\"302.4\" Height=\"18.9\" Text=\"[t_fileds.tradename]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text14\" Left=\"75.6\" Top=\"18.9\" Width=\"189\" Height=\"18.9\" Text=\"[t_fileds.drugnumber]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text15\" Left=\"340.2\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.dosage]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text16\" Left=\"425.25\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.unit]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text17\" Left=\"472.5\" Width=\"113.4\" Height=\"18.9\" Text=\"[t_fileds.specs]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text18\" Left=\"264.6\" Top=\"18.9\" Width=\"340.2\" Height=\"18.9\" Text=\"[t_fileds.enterprise]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text19\" Left=\"604.8\" Top=\"18.9\" Width=\"368.55\" Height=\"18.9\" Text=\"[t_fileds.holder]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text20\" Left=\"585.9\" Width=\"66.15\" Height=\"18.9\" Text=\"[t_fileds.scalar]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text21\" Left=\"652.05\" Width=\"47.25\" Height=\"18.9\" Text=\"[t_fileds.packages]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text22\" Left=\"699.3\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.openprice]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text23\" Left=\"784.35\" Width=\"85.05\" Height=\"18.9\" Text=\"[t_fileds.amount]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text24\" Left=\"869.4\" Width=\"94.5\" Height=\"18.9\" Text=\"[t_fileds.batch]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text25\" Left=\"963.9\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.indate]\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text26\" Left=\"1039.5\" Width=\"75.6\" Height=\"18.9\" Text=\"[t_fileds.prodate]\" Font=\"宋体, 9pt\"/>\r\n    </DataBand>\r\n    <PageFooterBand Name=\"PageFooter1\" Top=\"121.4\" Width=\"1134\" Height=\"18.9\">\r\n      <TextObject Name=\"Text27\" Left=\"179.55\" Width=\"207.9\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 12pt, style=Bold\"/>\r\n      <TextObject Name=\"Text28\" Left=\"538.65\" Width=\"132.3\" Height=\"18.9\" WordWrap=\"false\" Font=\"宋体, 9pt\"/>\r\n      <TextObject Name=\"Text29\" Left=\"774.9\" Width=\"94.5\" Height=\"18.9\" Text=\"合格\" Font=\"宋体, 9pt\"/>\r\n    </PageFooterBand>\r\n  </ReportPage>\r\n</Report>\r\n');
/*!40000 ALTER TABLE `tb_report` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_reserve`
--

DROP TABLE IF EXISTS `tb_reserve`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_reserve` (
  `reserve_id` bigint NOT NULL,
  `orderid` int NOT NULL,
  `order_type` tinyint DEFAULT NULL,
  `recno` int NOT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`reserve_id`,`recno`,`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_reserve`
--

LOCK TABLES `tb_reserve` WRITE;
/*!40000 ALTER TABLE `tb_reserve` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_reserve` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_roval_detailed`
--

DROP TABLE IF EXISTS `tb_roval_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_roval_detailed` (
  `orderid` int NOT NULL,
  `recno` int NOT NULL,
  `id` bigint NOT NULL COMMENT '产品ID',
  `scalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `piece` int DEFAULT NULL,
  `roval_scalar` decimal(18,3) DEFAULT NULL,
  `received_scalar` decimal(18,3) DEFAULT NULL,
  `reject_scalar` decimal(18,3) DEFAULT NULL,
  `return_scalar` decimal(18,3) DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `indate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `prodate` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `related_recno` int DEFAULT NULL,
  `isdo` tinyint DEFAULT '1',
  `new_price` decimal(18,4) DEFAULT NULL,
  `differ_amount` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_roval_detailed`
--

LOCK TABLES `tb_roval_detailed` WRITE;
/*!40000 ALTER TABLE `tb_roval_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_roval_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_roval_head`
--

DROP TABLE IF EXISTS `tb_roval_head`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_roval_head` (
  `orderid` int NOT NULL,
  `orgid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `buyer` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `legalbyname` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `carrier` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `remarks` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `transport` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `temperature` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `related_id` int DEFAULT NULL,
  `related_orderid` int DEFAULT NULL,
  `reson` varchar(100) DEFAULT NULL,
  `related_typeid` int DEFAULT '0' COMMENT '退货关联ID',
  `related_price` int DEFAULT '0' COMMENT '是否调过价',
  `isdrug` tinyint DEFAULT NULL,
  `isscan` tinyint DEFAULT NULL,
  PRIMARY KEY (`orderid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_roval_head`
--

LOCK TABLES `tb_roval_head` WRITE;
/*!40000 ALTER TABLE `tb_roval_head` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_roval_head` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_sale_pick`
--

DROP TABLE IF EXISTS `tb_sale_pick`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_sale_pick` (
  `orderid` int DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `fetch_way` varchar(50) DEFAULT NULL,
  `pick` int DEFAULT NULL,
  `carton` int DEFAULT NULL,
  `bags` int DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `recno` int NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `batch` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `batchid` int DEFAULT NULL,
  `pickid` bigint NOT NULL,
  `packages` decimal(18,2) DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `isroval` tinyint DEFAULT NULL,
  PRIMARY KEY (`pickid`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_sale_pick`
--

LOCK TABLES `tb_sale_pick` WRITE;
/*!40000 ALTER TABLE `tb_sale_pick` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_sale_pick` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_saleman`
--

DROP TABLE IF EXISTS `tb_saleman`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_saleman` (
  `manid` bigint NOT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `saleman` varchar(20) DEFAULT NULL,
  `mancode` varchar(10) DEFAULT NULL,
  `region_id` bigint DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `spell` varchar(50) DEFAULT NULL,
  `sex` tinyint DEFAULT NULL,
  PRIMARY KEY (`manid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_saleman`
--

LOCK TABLES `tb_saleman` WRITE;
/*!40000 ALTER TABLE `tb_saleman` DISABLE KEYS */;
INSERT INTO `tb_saleman` VALUES (394274351132741,'','小张','WZ001',385411140591685,'999','XZ',0);
/*!40000 ALTER TABLE `tb_saleman` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_saleman_enterprise`
--

DROP TABLE IF EXISTS `tb_saleman_enterprise`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_saleman_enterprise` (
  `manid` bigint NOT NULL,
  `busiid` bigint NOT NULL,
  PRIMARY KEY (`manid`,`busiid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_saleman_enterprise`
--

LOCK TABLES `tb_saleman_enterprise` WRITE;
/*!40000 ALTER TABLE `tb_saleman_enterprise` DISABLE KEYS */;
INSERT INTO `tb_saleman_enterprise` VALUES (394274351132741,350775972712517),(394274351132741,387864721395781),(394278360354885,350775972712517),(394278360354885,387864721395781),(394278360354885,426144179023941),(394278360354885,426154007060549),(394278360354885,426154019516485),(394278360354885,426154029756485),(394278360354885,426154039730245),(394278360354885,426154049888325),(394278360354885,426154062819397),(394278360354885,426154073022533),(394278360354885,426154083029061),(394278360354885,426154096230469),(394278360354885,426154106277957),(394278360354885,426154119295045),(394278360354885,426154129543237),(394278360354885,426154139582533),(394278360354885,426154152181829),(394278360354885,426168439693381),(394281275387973,350775972712517),(394281275387973,426144920866885);
/*!40000 ALTER TABLE `tb_saleman_enterprise` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_settled`
--

DROP TABLE IF EXISTS `tb_settled`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_settled` (
  `settled_id` bigint NOT NULL,
  `busiid` bigint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `receivdate` date DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `remarks` varchar(50) DEFAULT NULL,
  `direction` tinyint DEFAULT NULL,
  `payway` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`settled_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_settled`
--

LOCK TABLES `tb_settled` WRITE;
/*!40000 ALTER TABLE `tb_settled` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_settled` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_settled_detailed`
--

DROP TABLE IF EXISTS `tb_settled_detailed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_settled_detailed` (
  `settled_id` bigint NOT NULL,
  `recno` int NOT NULL,
  `billid` bigint DEFAULT NULL,
  `orderid` int DEFAULT NULL,
  `order_type` tinyint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `direction` tinyint DEFAULT NULL,
  `saleman` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`settled_id`,`recno`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_settled_detailed`
--

LOCK TABLES `tb_settled_detailed` WRITE;
/*!40000 ALTER TABLE `tb_settled_detailed` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_settled_detailed` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_stocks`
--

DROP TABLE IF EXISTS `tb_stocks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_stocks` (
  `id` bigint NOT NULL,
  `storeid` bigint NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `bidprice` decimal(18,4) DEFAULT NULL,
  `lastprice` decimal(18,4) DEFAULT NULL,
  `saleprice` decimal(18,4) DEFAULT NULL,
  `minprice` decimal(18,4) DEFAULT NULL,
  `retailprice` decimal(18,4) DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `createdate` date DEFAULT NULL,
  `shelfno` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `whole` varchar(50) DEFAULT NULL,
  PRIMARY KEY (`id`,`storeid`) USING BTREE,
  KEY `id` (`id`,`storeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_stocks`
--

LOCK TABLES `tb_stocks` WRITE;
/*!40000 ALTER TABLE `tb_stocks` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_stocks` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_stocks_depart`
--

DROP TABLE IF EXISTS `tb_stocks_depart`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_stocks_depart` (
  `batchid` int NOT NULL,
  `id` bigint NOT NULL,
  `scalar` decimal(18,3) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  `departno` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `lastprice` decimal(18,4) DEFAULT NULL,
  PRIMARY KEY (`batchid`,`departno`) USING BTREE,
  KEY `batchid` (`batchid`,`departno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_stocks_depart`
--

LOCK TABLES `tb_stocks_depart` WRITE;
/*!40000 ALTER TABLE `tb_stocks_depart` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_stocks_depart` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_storehouse`
--

DROP TABLE IF EXISTS `tb_storehouse`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_storehouse` (
  `storeid` bigint NOT NULL,
  `store_name` varchar(50) DEFAULT NULL,
  `inuse` tinyint DEFAULT NULL,
  `unuse` tinyint DEFAULT NULL,
  PRIMARY KEY (`storeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_storehouse`
--

LOCK TABLES `tb_storehouse` WRITE;
/*!40000 ALTER TABLE `tb_storehouse` DISABLE KEYS */;
INSERT INTO `tb_storehouse` VALUES (390684011802693,'合格品库',0,0);
/*!40000 ALTER TABLE `tb_storehouse` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_warehouse`
--

DROP TABLE IF EXISTS `tb_warehouse`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_warehouse` (
  `id` varchar(100) NOT NULL COMMENT 'Id',
  `description` varchar(100) DEFAULT NULL COMMENT '描述',
  `modifier` varchar(100) DEFAULT NULL COMMENT '修改人',
  `dept_belong_id` varchar(100) DEFAULT NULL COMMENT '数据归属部门',
  `update_datetime` datetime(6) DEFAULT NULL COMMENT '修改时间',
  `create_datetime` datetime(6) DEFAULT NULL COMMENT '创建时间',
  `warehouse_name` varchar(100) DEFAULT NULL COMMENT '仓库名称',
  `warehouse_code` varchar(10) DEFAULT NULL COMMENT '仓库编号',
  `address` varchar(100) DEFAULT NULL COMMENT '仓库地址',
  `states` tinyint(1) DEFAULT NULL COMMENT '0禁用1启用',
  `creator_id` varchar(100) DEFAULT NULL COMMENT '创建人',
  PRIMARY KEY (`id`),
  KEY `tb_warehouse_creator_id_3e94e844` (`creator_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='仓库设置';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_warehouse`
--

LOCK TABLES `tb_warehouse` WRITE;
/*!40000 ALTER TABLE `tb_warehouse` DISABLE KEYS */;
INSERT INTO `tb_warehouse` VALUES ('1be024461efa4a0f838cef44d9ccaac7',NULL,'d1431450-5068-4461-b57e-7862c005a547',NULL,'2023-08-26 14:16:10.936830','2022-10-16 19:42:26.655999','待处理库','000003','5栋B区',1,'d1431450-5068-4461-b57e-7862c005a547'),('3e8e1b9b23e64683a3022b462e0444a2',NULL,'d1431450-5068-4461-b57e-7862c005a547',NULL,'2023-10-17 16:32:55.314587','2022-10-09 11:02:21.099521','合格品库','000001','5栋楼A区',1,'d1431450-5068-4461-b57e-7862c005a547'),('6972cef8fb3146588c9c22374faa4803',NULL,'d1431450-5068-4461-b57e-7862c005a547',NULL,'2023-02-03 16:41:13.504945','2022-10-09 11:05:25.705243','不合格品库','000002','5栋楼C区',1,'d1431450-5068-4461-b57e-7862c005a547');
/*!40000 ALTER TABLE `tb_warehouse` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_wares`
--

DROP TABLE IF EXISTS `tb_wares`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_wares` (
  `id` bigint NOT NULL COMMENT 'Id',
  `description` varchar(100) DEFAULT NULL COMMENT '描述',
  `modifier` varchar(100) DEFAULT NULL COMMENT '修改人',
  `dept_belong_id` varchar(100) DEFAULT NULL COMMENT '数据归属部门',
  `update_datetime` datetime(6) DEFAULT NULL COMMENT '修改时间',
  `create_datetime` datetime(6) DEFAULT NULL COMMENT '创建时间',
  `tradename` varchar(100) DEFAULT NULL COMMENT '商品名称',
  `specs` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '规格',
  `enterprise` varchar(100) DEFAULT NULL COMMENT '生产企业',
  `unit` varchar(20) DEFAULT NULL COMMENT '单位',
  `code` varchar(20) DEFAULT NULL COMMENT '商品编码',
  `drugnumber` varchar(50) DEFAULT NULL COMMENT '国药准字',
  `dosage` varchar(20) DEFAULT NULL COMMENT '剂型',
  `holder` varchar(100) DEFAULT NULL COMMENT '生产许可持有人',
  `entrust` varchar(100) DEFAULT NULL COMMENT '委托生产企业',
  `entrust_address` varchar(100) DEFAULT NULL COMMENT '委托地址',
  `filingno` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '器械备案号',
  `temperature` varchar(50) DEFAULT NULL COMMENT '储存温度',
  `humidity` varchar(50) DEFAULT NULL COMMENT '湿度',
  `indate` tinyint DEFAULT NULL COMMENT '有效期',
  `piece` int DEFAULT NULL COMMENT '件装数',
  `barcode` varchar(20) DEFAULT NULL COMMENT '条码',
  `spell` varchar(50) DEFAULT NULL COMMENT '首字母',
  `states` tinyint(1) DEFAULT '1' COMMENT 'false禁销true启用',
  `curing` smallint DEFAULT NULL COMMENT '养护类型',
  `quality_standard` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '质量标准',
  `address` varchar(100) DEFAULT NULL COMMENT '生产地址',
  `creator_id` varchar(100) DEFAULT NULL COMMENT '创建人',
  `composition` varchar(255) DEFAULT NULL COMMENT '成份',
  `character` varchar(255) DEFAULT NULL COMMENT '性状',
  `functions` varchar(255) DEFAULT NULL COMMENT '功能主治',
  `usage` varchar(255) DEFAULT NULL COMMENT '用法用量',
  `storage` varchar(255) DEFAULT NULL COMMENT '贮藏',
  `adverse` varchar(255) DEFAULT NULL COMMENT '不良反应',
  `prohibit` varchar(255) DEFAULT NULL COMMENT '禁忌',
  `attention` varchar(255) DEFAULT NULL COMMENT '注意事项',
  `manual` varchar(255) DEFAULT NULL COMMENT '说明书',
  `category` varchar(50) DEFAULT NULL COMMENT '药品分类',
  `storage_conditions` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '存储条件',
  `docuno` varchar(20) DEFAULT NULL COMMENT '档案号',
  `isroval` tinyint DEFAULT '0' COMMENT '审核否',
  `validity` date DEFAULT NULL COMMENT '批件有效期',
  `lockprice` decimal(18,4) DEFAULT NULL COMMENT '连锁开票统一价',
  `retailprice` decimal(18,4) DEFAULT NULL,
  `bidprice` decimal(18,4) DEFAULT NULL,
  `minprice` decimal(18,4) DEFAULT NULL,
  `saleprice` decimal(18,4) DEFAULT NULL,
  `memberprice` decimal(18,4) DEFAULT NULL,
  `specprice` decimal(18,4) DEFAULT NULL,
  `isspec` tinyint DEFAULT NULL,
  `spec_scalar` decimal(18,2) DEFAULT NULL,
  `ment` tinyint DEFAULT NULL,
  `rx` tinyint DEFAULT NULL,
  `ypbwm` varchar(50) DEFAULT NULL,
  `isscan` tinyint DEFAULT NULL,
  `midpiece` int DEFAULT NULL,
  `medcode` varchar(20) DEFAULT NULL,
  `medcata` varchar(20) DEFAULT NULL,
  `medrx` varchar(20) DEFAULT NULL,
  `medname` varchar(50) DEFAULT NULL,
  `mincnt` int DEFAULT NULL,
  `minunit` varchar(10) DEFAULT NULL,
  `prop` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`) USING BTREE,
  KEY `tb_wares_creator_id_eab5404e` (`creator_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商品档案表';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_wares`
--

LOCK TABLES `tb_wares` WRITE;
/*!40000 ALTER TABLE `tb_wares` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_wares` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_wares_doc`
--

DROP TABLE IF EXISTS `tb_wares_doc`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_wares_doc` (
  `docid` bigint NOT NULL,
  `docno` varchar(10) DEFAULT NULL,
  `docname` varchar(50) DEFAULT NULL,
  `startdate` varchar(10) DEFAULT NULL,
  `enddate` varchar(10) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `id` bigint NOT NULL,
  `islack` tinyint DEFAULT NULL,
  PRIMARY KEY (`docid`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_wares_doc`
--

LOCK TABLES `tb_wares_doc` WRITE;
/*!40000 ALTER TABLE `tb_wares_doc` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_wares_doc` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_wares_doc_list`
--

DROP TABLE IF EXISTS `tb_wares_doc_list`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_wares_doc_list` (
  `docid` bigint NOT NULL,
  `docno` varchar(10) DEFAULT NULL,
  `docname` varchar(50) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`docid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_wares_doc_list`
--

LOCK TABLES `tb_wares_doc_list` WRITE;
/*!40000 ALTER TABLE `tb_wares_doc_list` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_wares_doc_list` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_wares_first_check`
--

DROP TABLE IF EXISTS `tb_wares_first_check`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_wares_first_check` (
  `checkid` bigint NOT NULL,
  `user_id` bigint DEFAULT NULL,
  `isdrugs` tinyint DEFAULT NULL,
  `isapparatus` tinyint DEFAULT NULL,
  `isother` tinyint DEFAULT NULL,
  `content` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `states` tinyint DEFAULT NULL,
  `isgmp` tinyint DEFAULT NULL,
  `issale` tinyint DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  PRIMARY KEY (`checkid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_wares_first_check`
--

LOCK TABLES `tb_wares_first_check` WRITE;
/*!40000 ALTER TABLE `tb_wares_first_check` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_wares_first_check` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_water`
--

DROP TABLE IF EXISTS `tb_water`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tb_water` (
  `orderid` bigint NOT NULL,
  `order_type` tinyint NOT NULL,
  `createdate` date DEFAULT NULL,
  `id` bigint DEFAULT NULL,
  `storeid` bigint DEFAULT NULL,
  `busiid` bigint DEFAULT NULL,
  `inscalar` decimal(18,3) DEFAULT NULL,
  `outscalar` decimal(18,3) DEFAULT NULL,
  `openprice` decimal(18,4) DEFAULT NULL,
  `costprice` decimal(18,4) DEFAULT NULL,
  `batchid` bigint DEFAULT NULL,
  `batch` varchar(20) DEFAULT NULL,
  `remarks` varchar(100) DEFAULT NULL,
  `total` decimal(18,3) DEFAULT NULL,
  `total_batch` decimal(18,3) DEFAULT NULL,
  `recno` int NOT NULL,
  `enterid` bigint DEFAULT NULL,
  `user_id` bigint DEFAULT NULL,
  `departno` varchar(10) DEFAULT NULL,
  `amount` decimal(18,2) DEFAULT NULL,
  PRIMARY KEY (`orderid`,`order_type`,`recno`),
  KEY `orderid` (`orderid`,`order_type`,`recno`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_water`
--

LOCK TABLES `tb_water` WRITE;
/*!40000 ALTER TABLE `tb_water` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_water` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `xyy_seller_order_detail`
--

DROP TABLE IF EXISTS `xyy_seller_order_detail`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `xyy_seller_order_detail` (
  `ORDER_NO` varchar(32) DEFAULT NULL,
  `ORDER_DETAIL_ID` decimal(20,0) DEFAULT NULL,
  `ERP_CODE` varchar(32) DEFAULT NULL,
  `SKU_NAME` varchar(128) DEFAULT NULL,
  `SKU_PRICE` decimal(14,2) DEFAULT NULL,
  `PURCHASE_NUM` decimal(10,0) DEFAULT NULL,
  `DISCOUNT_AMOUNT` decimal(14,2) DEFAULT NULL,
  `PLATFORM_AMOUNT` decimal(14,2) DEFAULT NULL,
  `SHOP_AMOUNT` decimal(14,2) DEFAULT NULL,
  `PAY_AMOUNT` decimal(14,2) DEFAULT NULL,
  `SKU_PURCHASE_PRICE` decimal(14,2) DEFAULT NULL,
  `ORDER_ID` decimal(20,0) DEFAULT NULL,
  `PROMO_TYPE` decimal(10,0) DEFAULT NULL,
  `SKU_PAY_PRICE` decimal(14,6) DEFAULT NULL,
  UNIQUE KEY `XYY_A3_IDX` (`ORDER_DETAIL_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `xyy_seller_order_detail`
--

LOCK TABLES `xyy_seller_order_detail` WRITE;
/*!40000 ALTER TABLE `xyy_seller_order_detail` DISABLE KEYS */;
/*!40000 ALTER TABLE `xyy_seller_order_detail` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `xyy_seller_order_info`
--

DROP TABLE IF EXISTS `xyy_seller_order_info`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `xyy_seller_order_info` (
  `VENDER_CODE` varchar(32) DEFAULT NULL,
  `ORDER_NO` varchar(32) DEFAULT NULL,
  `ORDER_CREATE_TIME` datetime DEFAULT NULL,
  `PAY_TYPE` decimal(10,0) DEFAULT NULL,
  `PAY_CHANNEL` decimal(10,0) DEFAULT NULL,
  `TOTAL_AMOUNT` decimal(14,2) DEFAULT NULL,
  `DISCOUNT_AMOUNT` decimal(14,2) DEFAULT NULL,
  `PLATFORM_AMOUNT` decimal(14,2) DEFAULT NULL,
  `SHOP_AMOUNT` decimal(14,2) DEFAULT NULL,
  `FREIGHT` decimal(14,2) DEFAULT NULL,
  `PAY_AMOUNT` decimal(14,2) DEFAULT NULL,
  `PICK_NAME` varchar(32) DEFAULT NULL,
  `PICK_ADDRESS` text,
  `PICK_PHONE` varchar(32) DEFAULT NULL,
  `REMARK` text,
  `ORDER_STATE` decimal(1,0) DEFAULT NULL,
  `MERCHANT_NAME` varchar(64) DEFAULT NULL,
  `PROVINCE_NAME` varchar(32) DEFAULT NULL,
  `CITY_NAME` varchar(32) DEFAULT NULL,
  `AREA_NAME` varchar(128) DEFAULT NULL,
  `FIRST_ORDER` decimal(2,0) DEFAULT NULL,
  `ORDER_TYPE` decimal(2,0) DEFAULT NULL,
  `ORG_ID` varchar(32) DEFAULT NULL,
  `ORDER_ID` decimal(20,0) DEFAULT NULL,
  `ERP_ORDER_NO` varchar(64) DEFAULT NULL,
  UNIQUE KEY `XYY_A1_IDX` (`ORDER_NO`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `xyy_seller_order_info`
--

LOCK TABLES `xyy_seller_order_info` WRITE;
/*!40000 ALTER TABLE `xyy_seller_order_info` DISABLE KEYS */;
/*!40000 ALTER TABLE `xyy_seller_order_info` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `ysb_ddhz`
--

DROP TABLE IF EXISTS `ysb_ddhz`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ysb_ddhz` (
  `DJBH` varchar(15) NOT NULL,
  `RQ` varchar(10) DEFAULT NULL,
  `ONTIME` varchar(8) DEFAULT NULL,
  `DRUGSTOREBRANCHID` decimal(20,0) DEFAULT NULL,
  `CUSTOMERID` varchar(120) NOT NULL,
  `DRUGSTORENAME` text,
  `STATUS` varchar(20) DEFAULT NULL,
  `JE` decimal(14,4) DEFAULT NULL,
  `XGDJBH` varchar(40) DEFAULT NULL,
  `BEIZHU` text,
  `IS_ZX` varchar(10) DEFAULT NULL,
  `INVOICETYPE` varchar(10) DEFAULT NULL,
  `ADDRESS` text,
  `RECVNAME` varchar(80) DEFAULT NULL,
  `RECVPHONE` varchar(80) DEFAULT NULL,
  `PROVINCENAME` varchar(80) DEFAULT NULL,
  `CITYNAME` varchar(80) DEFAULT NULL,
  `DISTRICTNAME` varchar(120) DEFAULT NULL,
  `STREETNAME` varchar(120) DEFAULT NULL,
  PRIMARY KEY (`DJBH`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ysb_ddhz`
--

LOCK TABLES `ysb_ddhz` WRITE;
/*!40000 ALTER TABLE `ysb_ddhz` DISABLE KEYS */;
/*!40000 ALTER TABLE `ysb_ddhz` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `ysb_ddmx`
--

DROP TABLE IF EXISTS `ysb_ddmx`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ysb_ddmx` (
  `DJBH` varchar(15) NOT NULL,
  `DJ_SN` decimal(5,0) NOT NULL,
  `DRUGCODE` varchar(120) NOT NULL,
  `SHL` decimal(14,2) DEFAULT NULL,
  `DJ` decimal(14,4) DEFAULT NULL,
  `JE` decimal(14,4) DEFAULT NULL,
  `BATCHNUM` varchar(20) DEFAULT NULL,
  `PRODDATE` varchar(10) DEFAULT NULL,
  `VALIDITY` varchar(10) DEFAULT NULL,
  `STATUS` varchar(20) DEFAULT NULL,
  `WHOLESALE_TYPE` decimal(5,0) DEFAULT NULL COMMENT '活动类型:0-返现活动, 1-一口价, 2-限量秒杀, 3-折扣活动 4-一口价特价产品(不可用商家优惠券) 5-限时特价不可用商家券 6-限时特价可用商家券 7-药慧拼（拼团） 8-批购包邮 9-乐药分销 10-赠品',
  `IS_ZX` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`DJBH`,`DJ_SN`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ysb_ddmx`
--

LOCK TABLES `ysb_ddmx` WRITE;
/*!40000 ALTER TABLE `ysb_ddmx` DISABLE KEYS */;
/*!40000 ALTER TABLE `ysb_ddmx` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `ysb_ddmx_writeback`
--

DROP TABLE IF EXISTS `ysb_ddmx_writeback`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ysb_ddmx_writeback` (
  `ORDERID` varchar(15) NOT NULL,
  `ORDERCODE` varchar(40) DEFAULT NULL,
  `DJ_SN` decimal(5,0) DEFAULT NULL,
  `DRUGCODE` varchar(40) DEFAULT NULL,
  `AMOUNT` decimal(14,2) DEFAULT NULL,
  `PRICE` decimal(14,4) DEFAULT NULL,
  `JE` decimal(14,4) DEFAULT NULL,
  `BATCHNUM` varchar(20) DEFAULT NULL,
  `PRODDATE` varchar(10) DEFAULT NULL,
  `VALIDITY` varchar(10) DEFAULT NULL,
  `STATUS` decimal(5,0) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `ysb_ddmx_writeback`
--

LOCK TABLES `ysb_ddmx_writeback` WRITE;
/*!40000 ALTER TABLE `ysb_ddmx_writeback` DISABLE KEYS */;
/*!40000 ALTER TABLE `ysb_ddmx_writeback` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Dumping events for database 'vfsale'
--

--
-- Dumping routines for database 'vfsale'
--
/*!50003 DROP PROCEDURE IF EXISTS `chain_cargo_erp_invoice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_cargo_erp_invoice`( IN ysb_orderid VARCHAR ( 32 ), IN userid BIGINT, OUT erp_order INT, OUT erp_busiid BIGINT )
BEGIN

	DECLARE

		flag INT DEFAULT 0;

	DECLARE

		order_id INT;

	DECLARE

		busi_id BIGINT;

	DECLARE

		relateid INT;

	DECLARE

		tmp_recno INT DEFAULT 1;

	DECLARE

		tmp_batchid INT;

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_id BIGINT;

	DECLARE

		var_id BIGINT;

	DECLARE

		var_scalar DECIMAL ( 18, 3 );

	DECLARE

		var_price DECIMAL ( 18, 4 );

	DECLARE

		mx CURSOR FOR SELECT

		id AS var_id,

		scalar AS var_scalar,

		openprice AS var_price 

	FROM

		chain_cargo_detailed a 

	WHERE

		orderid = ysb_orderid 

	ORDER BY

		id;

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET flag = 1;

	SELECT

		order_number + 1 INTO ORDER_ID 

	FROM

		tb_order_number 

	WHERE

		order_type = 4;

	UPDATE tb_order_number 

	SET order_number = order_number + 1 

	WHERE

		order_type = 4;

	

	SET erp_order = order_id;

	

	SELECT

		busiid INTO busi_id 

	FROM

		chain_cargo

	WHERE

		orderid=ysb_orderid;

	

	-- SET erp_busiid = busi_id;

	OPEN mx;

	FETCH mx INTO var_id,

	var_scalar,

	var_price;

	WHILE

			flag <> 1 DO

			CALL chain_fetch_cargo_wares ( var_id, busi_id, '999' );

		INSERT INTO tb_invoice (

			orderid,

			storeid,

			departno,

			user_id,

			busiid,

			id,

			recno,

			scalar,

			rateprice,

			openprice,

			batchid,

			batch,

			prodate,

			indate,

			costprice,

			saleprice,

			minprice,

			states,

			ishemp,

			related_id,

			ysb_order_no 

		) SELECT

		order_id,

		storeid,

		'999',

		userid,

		busi_id,

		id,

		tmp_recno,

		var_scalar,

		var_price,

		var_price,

		batchid,

		batch,

		prodate,

		indate,

		costprice,

		saleprice,

		minprice,

		0,

		ishemp,

		0,

		ysb_orderid 

		FROM

			tb_invoice_qhd a 

		WHERE

			id = var_id 

			AND scalar >= var_scalar 

			AND total_scalar > 0 

			order by indate

			LIMIT 1;

		

		SET tmp_recno = tmp_recno + 1;

		

		DELETE FROM tb_invoice_qhd; -- 删除临时表数据

		

		FETCH mx INTO var_id,

		var_scalar,

		var_price;

		

	END WHILE;

	CLOSE mx;

	UPDATE tb_invoice a

	INNER JOIN tb_stocks b ON a.orderid = order_id 

	AND a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.amount = a.scalar * a.openprice,

	a.profit = a.scalar *(

		a.openprice - b.costprice 

	);

	UPDATE tb_invoice a

	INNER JOIN tb_wares b ON a.orderid = order_id 

	AND a.id = b.id 

	SET a.piece = b.piece,

	a.packages = a.scalar / COALESCE ( b.piece, 999 );

	

	INSERT INTO tb_invoice_head (

		orderid,

		busiid,

		user_id,

		departno,

		cost,

		amount,

		profit,

		order_type,

		states,

		payway,

		fetch_way,

		related_id,

		createdate,

		receivdate,

		ysb_order_no 

	) SELECT DISTINCT

	orderid,

	busiid,

	user_id,

	'999',(

		SELECT

			sum( scalar * costprice ) AS cost 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

			),(

		SELECT

			sum( amount ) AS amount 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

			),(

		SELECT

			sum( profit ) AS profit 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

		),

		4,

		0,

		'记账',

		'托运',

		related_id,

		CURRENT_DATE,

		CURRENT_DATE,

		ysb_order_no 

	FROM

		tb_invoice 

	WHERE

		orderid = order_id;

	INSERT INTO tb_invoice_detailed (

		orderid,

		recno,

		id,

		scalar,

		rateprice,

		openprice,

		amount,		

		costprice,

		profit,

		packages,

		piece,

		departno,

		batchid,

		batch,

		indate,

		prodate,

		storeid,

		related_id,

		ysb_order_no 

	) SELECT

	orderid,

	recno,

	id,

	scalar,

	openprice,

	openprice,

	amount,

	costprice,

	profit,

	packages,

	piece,

	departno,

	batchid,

	batch,

	indate,

	prodate,

	storeid,

	related_id,

	ysb_order_no 

	FROM

		tb_invoice 

	WHERE

		orderid = order_id;

SET erp_busiid = busi_id;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_cargo_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_cargo_wares`(

	IN abc VARCHAR ( 50 )	

	)
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_cargo_wares (

			id BIGINT,

			scalar DECIMAL ( 18, 3 ),-- 批次数量

			batchid INT,-- 批次序号

			batch VARCHAR ( 20 ),

			indate VARCHAR ( 10 ),

			prodate VARCHAR ( 10 ),

			storeid BIGINT,

			total_scalar DECIMAL ( 18, 3 ),-- 总库存

			costprice DECIMAL ( 18, 4 ),

			lastprice DECIMAL ( 18, 4 ),

			saleprice DECIMAL ( 18, 4 ),

			minprice DECIMAL ( 18, 4 ),

			retailprice DECIMAL ( 18, 4 ),

			history_price DECIMAL ( 18, 4 ),

			bidprice DECIMAL ( 18, 4 ),

			hemp_max DECIMAL ( 18, 3 ),

			hemp_scalar DECIMAL ( 18, 3 ),

			ishemp TINYINT DEFAULT 0,

			lockprice DECIMAL(18,4), -- 连锁开票统一价格

			memberprice DECIMAL(18,4),

			specprice DECIMAL(18,4),

			isspec TINYINT DEFAULT 0 

		) ENGINE = INNODB;

	INSERT INTO temp_cargo_wares ( id, batchid, batch, indate, prodate, scalar, storeid, lastprice ) SELECT

	a.id,

	a.batchid,

	a.batch,

	a.indate,

	a.prodate,

	b.scalar,

	c.storeid,

	c.lastprice 

	FROM

		tb_batch_info a,

		tb_stocks_depart b,

		tb_batch c 

	WHERE

		a.batchid = b.batchid 

		AND b.batchid = c.batchid 

		AND b.departno = '999'

		AND b.scalar > 0 

		AND EXISTS (

		SELECT

			id 

		FROM

			tb_wares 

		WHERE

			id = a.id 

			AND ( CODE LIKE abc OR tradename LIKE abc OR spell LIKE abc OR barcode like abc ) 

			AND isroval = 3 

			AND states = 1 

		);

	START TRANSACTION;-- 最近历史售价

	

	UPDATE temp_cargo_wares a

	INNER JOIN tb_stocks b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = b.scalar,

	a.costprice = b.costprice,

	a.bidprice = b.bidprice,

	a.minprice = b.minprice,	

	a.retailprice = b.retailprice,

	a.saleprice = b.saleprice;-- 需要减去总库存

	UPDATE temp_cargo_wares a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_invoice WHERE departno = '999' GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 减总库存 采购退货、报损申请预留(未审核)

	UPDATE temp_cargo_wares a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_reserve WHERE (order_type = 6 or order_type=14) AND departno = '999' GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 已经开票的批次数量

	UPDATE temp_cargo_wares a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, batchid, storeid FROM tb_invoice WHERE departno = '999' GROUP BY id, batchid, storeid ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	AND a.storeid = b.storeid 

	SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 减批次库存 采购退货、报损申请预留(未审核)

	UPDATE temp_cargo_wares a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id,

			batchid,

			storeid 

		FROM

			tb_reserve 

		WHERE

			(order_type = 6 or order_type=14) 

			AND departno = '999' 

		GROUP BY

			id,

			batchid,

			storeid 

		) b ON a.id = b.id 

		AND a.batchid = b.batchid 

		AND a.storeid = b.storeid 

		SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 含麻处理	

	

	COMMIT;

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,

		a.piece,

		a.barcode,

		a.validity,

		b.scalar,

		b.batchid,

		b.batch,

		b.indate,

		b.prodate,

		b.storeid,

		b.total_scalar,

		b.costprice,

		b.lastprice,

		b.bidprice,

		b.history_price,

		b.saleprice,

		a.lockprice as minprice,

		a.lockprice,

		a.retailprice,

		a.memberprice,

		a.specprice,

		a.isspec,

		a.spec_scalar,

		b.hemp_max,

		b.hemp_scalar,

		b.ishemp,

		( SELECT store_name FROM tb_storehouse WHERE storeid = b.storeid ) AS store_name 

	FROM

		tb_wares a,

		temp_cargo_wares b 

	WHERE

		a.id = b.id 

		AND b.scalar > 0 

	ORDER BY

		a.id,

		b.indate;

	DROP TABLE temp_cargo_wares;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_check_transfer_detailed` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_check_transfer_detailed`( IN var_orderid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.piece,

		a.barcode,

		a.holder,

		a.drugnumber,		

		b.scalar,

		b.openprice,

		b.amount,

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,		

		b.orderid,

		b.recno			 

	FROM

		tb_wares a,

		chain_transfer_detailed b 

	WHERE

	  a.id=b.id and b.orderid=var_orderid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_check_transfer_head` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_check_transfer_head`( IN var_inbusiid BIGINT )
BEGIN

	SELECT

		a.orderid,

		a.createdate,

		a.amount,

		a.userid,

		a.states,

		a.busiid,

		a.inbusiid,(

		SELECT

			ename 

		FROM

			tb_enterprise 

		WHERE

			busiid = a.busiid 

		) AS outname,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.inbusiid ) AS inname,

		(select nickname from chainuser where userid=a.userid) as nickname 

	FROM

		chain_transfer a 

	WHERE

	  inbusiid=var_inbusiid and

		states = 1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_fetch_cargo_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_fetch_cargo_wares`(

	IN wareid varchar(32),

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS tb_invoice_qhd (

			id BIGINT,

			scalar DECIMAL ( 18, 3 ),-- 批次数量

			batchid INT,-- 批次序号

			batch VARCHAR ( 20 ),

			indate VARCHAR ( 10 ),

			prodate VARCHAR ( 10 ),

			storeid BIGINT,

			total_scalar DECIMAL ( 18, 3 ),-- 总库存

			costprice DECIMAL ( 18, 4 ),

			lastprice DECIMAL ( 18, 4 ),

			saleprice DECIMAL ( 18, 4 ),

			minprice DECIMAL ( 18, 4 ),

			retailprice DECIMAL ( 18, 4 ),

			history_price DECIMAL ( 18, 4 ),

			bidprice DECIMAL ( 18, 4 ),

			hemp_max DECIMAL ( 18, 3 ),

			hemp_scalar DECIMAL ( 18, 3 ),

			ishemp TINYINT DEFAULT 0 

		) ENGINE = INNODB;

	INSERT INTO tb_invoice_qhd ( id, batchid, batch, indate, prodate, scalar, storeid, lastprice ) SELECT

	a.id,

	a.batchid,

	a.batch,

	a.indate,

	a.prodate,

	b.scalar,

	c.storeid,

	c.lastprice 

	FROM

		tb_batch_info a,

		tb_stocks_depart b,

		tb_batch c 

	WHERE

		a.batchid = b.batchid 

		AND b.batchid = c.batchid 

		AND b.departno = depart_no 

		AND b.scalar > 0 

		AND EXISTS (

		SELECT

			id 

		FROM

			tb_wares 

		WHERE

			id = a.id

			AND id=wareid			

			AND isroval = 3 

			AND states = 1 

		);

	START TRANSACTION;-- 最近历史售价

	UPDATE tb_invoice_qhd a

	INNER JOIN ( SELECT id, batchid, openprice FROM tb_invoice_lastprice WHERE busiid = busi_id ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	SET a.history_price = b.openprice;

	UPDATE tb_invoice_qhd a

	INNER JOIN tb_stocks b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = b.scalar,

	a.costprice = b.costprice,

	a.bidprice = b.bidprice,

	a.minprice = b.minprice,

	a.retailprice = b.retailprice,

	a.saleprice = b.saleprice;-- 需要减去总库存

	UPDATE tb_invoice_qhd a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 减总库存 采购退货、报损申请预留(未审核)

	UPDATE tb_invoice_qhd a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_reserve WHERE (order_type = 6 or order_type=14) AND departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 已经开票的批次数量

	UPDATE tb_invoice_qhd a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, batchid, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, batchid, storeid ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	AND a.storeid = b.storeid 

	SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 减批次库存 采购退货、报损申请预留(未审核)

	UPDATE tb_invoice_qhd a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id,

			batchid,

			storeid 

		FROM

			tb_reserve 

		WHERE

			(order_type = 6 or order_type=14) 

			AND departno = depart_no 

		GROUP BY

			id,

			batchid,

			storeid 

		) b ON a.id = b.id 

		AND a.batchid = b.batchid 

		AND a.storeid = b.storeid 

		SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 含麻处理

	UPDATE tb_invoice_qhd a

	INNER JOIN ( SELECT id FROM tb_wares WHERE category LIKE '含特殊药品%' ) b ON a.id = b.id 

	SET a.ishemp = 1;

	UPDATE tb_invoice_qhd 

	SET hemp_max =(

		SELECT

			limit_scalar 

		FROM

			tb_enterprise_type 

		WHERE

			typeid =(

			SELECT

				typeid 

			FROM

				tb_enterprise 

			WHERE

				busiid = busi_id 

			)) 

	WHERE

		ishemp = 1;

	UPDATE tb_invoice_qhd a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id 

		FROM

			tb_invoice_detailed a 

		WHERE

			EXISTS (

			SELECT

				orderid 

			FROM

				tb_invoice_head 

			WHERE

				orderid = a.orderid 

				AND busiid = busi_id 

				AND MONTH ( receivdate )= MONTH (

				CURDATE())) 

		GROUP BY

			id 

		) b ON a.id = b.id 

		SET a.hemp_scalar = b.scalar;

	UPDATE tb_invoice_qhd a

	INNER JOIN ( SELECT id, sum( scalar ) AS scalar FROM tb_invoice WHERE busiid = busi_id GROUP BY id ) b ON a.id = b.id 

	SET a.hemp_scalar = COALESCE ( a.hemp_scalar, 0 )+ COALESCE ( b.scalar, 0 );

	COMMIT;

	

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_grpc_delivery_detailed` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_grpc_delivery_detailed`( IN var_orderid INT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,

		a.piece,

		a.barcode,

		b.scalar,

		b.batchid,

		b.batch,

		b.indate,

		b.prodate,

		b.storeid,		

		b.openprice,

		b.orderid,

		b.recno,

		b.amount,		

		a.lockprice,

		a.retailprice,

		a.memberprice,

		a.specprice,

		a.isspec,

		a.spec_scalar,

		a.ment				 

	FROM

		tb_wares a,

		chain_invoice_detailed b 

	WHERE

		a.id = b.id 

		AND b.orderid=var_orderid 

	ORDER BY

		a.id;		



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_parent_batch_stocks` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_parent_batch_stocks`(IN var_chaincode varchar(10),in abc varchar(20))
BEGIN



	if CHAR_LENGTH(var_chaincode)>0 then

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,		

		b.scalar,

		b.openprice,

		b.amount,				

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,			

		(select ename from tb_enterprise where busiid=b.busiid) as orgname		 

	FROM

		tb_wares a,

		chain_store_batch b 

	WHERE

	  (a.`code`=abc or a.barcode=abc or a.tradename like concat('%',abc,'%') or a.spell like concat('%',abc,'%')) and 

	  a.id=b.id and b.busiid=(select busiid from tb_enterprise where chaincode=var_chaincode);

	end if;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_parent_retail` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_parent_retail`( IN startdate date, IN enddate date, IN var_chaincode varchar(10),in var_regioncode varchar(10) )
BEGIN

 if(CHAR_LENGTH(var_chaincode)>0) then

	SELECT

		a.orderid,

		a.busiid,

		a.userid,

		a.createdate,

		a.writetime,

		a.amount,

		a.alipay,

		a.weixin,

		a.bag,

		a.medic,

		a.bank,

		a.cher,

		a.pocket,

		a.wipe,

		a.other,

		a.`change`,

		a.cash,

		a.discount,	

		a.cost,

		a.profit,

		a.states,

		a.memid,	

		( SELECT nickname FROM chainuser WHERE userid = a.userid ) AS nickname,		

		(select ename from tb_enterprise where busiid=a.busiid) as orgname

	FROM

		chain_retail a 

	WHERE

		a.createdate >=startdate and a.createdate<=enddate 

		AND a.busiid =(select busiid from tb_enterprise where chaincode=var_chaincode);

	end if;

	

	if(CHAR_LENGTH(var_regioncode)>0) then

	SELECT

		a.orderid,

		a.busiid,

		a.userid,

		a.createdate,

		a.writetime,

		a.amount,

		a.alipay,

		a.weixin,

		a.bag,

		a.medic,

		a.bank,

		a.cher,

		a.pocket,

		a.wipe,

		a.other,

		a.`change`,

		a.cash,

		a.discount,	

		a.cost,

		a.profit,

		a.states,

		a.memid,	

		( SELECT nickname FROM chainuser WHERE userid = a.userid ) AS nickname,		

		(select ename from tb_enterprise where busiid=a.busiid) as orgname

	FROM

		chain_retail a 

	WHERE

		a.createdate >=startdate and a.createdate<=enddate 

		AND EXISTS(select busiid from tb_enterprise where regioncode=var_regioncode and busiid=a.busiid);

	end if;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_parent_retail_detailed` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_parent_retail_detailed`(in startdate date,in enddate date, IN var_chaincode varchar(10),in var_regioncode varchar(10))
BEGIN

if CHAR_LENGTH(var_chaincode)>0 then

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,		

		b.scalar,

		b.openprice,

		b.amount,

		b.costprice,

		b.profit,		

		b.split,		

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,		

		b.orderid,

		b.recno,

		b.createdate,		

		(select ename from tb_enterprise where busiid=b.busiid) as orgname		 

	FROM

		tb_wares a,

		chain_sale_detailed b 

	WHERE

	  b.createdate>=startdate and b.createdate<=enddate and 

	  a.id=b.id and b.busiid=(select busiid from tb_enterprise where chaincode=var_chaincode);

	end if;

	if CHAR_LENGTH(var_regioncode)>0 then

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,		

		b.scalar,

		b.openprice,

		b.amount,

		b.costprice,

		b.profit,		

		b.split,		

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,		

		b.orderid,

		b.recno,

		b.createdate,		

		(select ename from tb_enterprise where busiid=b.busiid) as orgname		 

	FROM

		tb_wares a,

		chain_sale_detailed b 

	WHERE

	  b.createdate>=startdate and b.createdate<=enddate and 

	  a.id=b.id and EXISTS(select busiid from tb_enterprise where regioncode=var_regioncode and busiid=b.busiid);

	end if;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_batchstocks` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_batchstocks`( IN abc varchar(20) ,IN var_busiid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,		

		a.barcode,

		b.scalar,

		b.openprice,

		b.amount,

		b.batch,

		b.indate,

		b.prodate,

		b.batchid,		

		a.retailprice				 

	FROM

		tb_wares a,

		chain_store_batch b 

	WHERE

	  (a.`code`=abc or a.barcode=abc or a.tradename like concat('%',abc,'%') or a.spell like concat('%',abc,'%'))  and 

		a.id = b.id  and b.busiid=var_busiid  

		AND b.scalar>0

	ORDER BY

		a.id;		



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_cargo` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_cargo`( IN startdate DATE, IN enddate DATE,in var_chaincode varchar(10),in var_regioncode varchar(10))
BEGIN

  if(CHAR_LENGTH(var_chaincode)>0) then

	SELECT

		a.orderid,

		a.busiid,

		a.userid,

		a.createdate,

		a.amount,

		(select ename from tb_enterprise where busiid=a.busiid) as ename,

		(select nickname from chainuser where userid=a.userid) as username 

	FROM

		chain_cargo a

	WHERE

		createdate >= startdate 

		AND createdate <= enddate

		and states=1 and busiid=(select busiid from tb_enterprise where chaincode=var_chaincode);

	end if;

	if(CHAR_LENGTH(var_regioncode)>0) then

	SELECT

		a.orderid,

		a.busiid,

		a.userid,

		a.createdate,

		a.amount,

		(select ename from tb_enterprise where busiid=a.busiid) as ename,

		(select nickname from chainuser where userid=a.userid) as username 

	FROM

		chain_cargo a

	WHERE

		createdate >= startdate 

		AND createdate <= enddate

		and states=1 and EXISTS(select busiid from tb_enterprise where regioncode=var_regioncode and busiid=a.busiid);

	end if;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_price` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_price`( IN abc varchar(20) ,IN var_busiid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,		

		a.barcode,

		b.busiid,		

		b.spec_scalar,

		b.isspec,

		b.specprice,

		b.memberprice,		

		b.retailprice				 

	FROM

		tb_wares a,

		chain_store_stocks b 

	WHERE

	  (a.`code`=abc or a.barcode=abc or a.tradename like concat('%',abc,'%') or a.spell like concat('%',abc,'%'))  and 

		a.id = b.id  and b.busiid=var_busiid  

		AND b.scalar>0

	ORDER BY

		a.id;		



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_recipel_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_recipel_wares`(IN var_orderid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,		

		a.barcode,

		a.memberprice,

		b.scalar,

		b.openprice,

		b.amount,		

		b.retailprice,

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,

		b.copys,

		b.orderid,

		b.recno,

		b.rx				 

	FROM

		tb_wares a,

		chain_recipel_detailed b 

	WHERE	  

		a.id = b.id  and b.orderid=var_orderid

		

	ORDER BY

		b.recno;		



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_reprinthead` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_reprinthead`( IN var_orderid BIGINT, IN var_busiid BIGINT )
BEGIN

	SELECT

		a.orderid,

		a.busiid,

		a.userid,

		a.writetime,

		a.amount,

		a.cher,

		a.`change`,

		a.cash,

		a.discount,

		( SELECT nickcode FROM chainuser WHERE userid = a.userid AND busiid = var_busiid ) AS nickcode,

		( SELECT nickname FROM chainuser WHERE userid = a.userid AND busiid = var_busiid ) AS nickname,

		( SELECT CODE FROM chainmember WHERE memid = a.memid ) AS CODE,

		( SELECT integral FROM chainmember_expan WHERE memid = a.memid AND busiid = var_busiid ) AS integral,

		( SELECT sum( scalar ) AS scalar FROM chain_retail_detailed WHERE orderid = var_orderid ) AS sumscalar 

	FROM

		chain_retail a 

	WHERE

		orderid = var_orderid 

		AND busiid = var_busiid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_retail_detailed` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_retail_detailed`( IN var_orderid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		b.unit,-- 有拆零单位

		a.holder,		

		b.scalar,

		b.openprice,

		b.amount,

		b.costprice,

		b.profit,

		b.discount,

		b.split,		

		b.retailprice,

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,

		b.copys,

		b.orderid,

		b.recno,

		b.isspec,

		b.shopid			 

	FROM

		tb_wares a,

		chain_retail_detailed b 

	WHERE

	  a.id=b.id and b.orderid=var_orderid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_retail_head` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_retail_head`( IN startdate date, IN enddate date, IN var_busiid BIGINT )
BEGIN

	SELECT

		a.orderid,

		a.busiid,

		a.userid,

		a.createdate,

		a.writetime,

		a.amount,

		a.alipay,

		a.weixin,

		a.bag,

		a.medic,

		a.bank,

		a.cher,

		a.pocket,

		a.wipe,

		a.other,

		a.`change`,

		a.cash,

		a.discount,	

		a.cost,

		a.profit,

		a.states,

		a.memid,	

		( SELECT nickname FROM chainuser WHERE userid = a.userid AND busiid = var_busiid ) AS nickname		

		

	FROM

		chain_retail a 

	WHERE

		a.createdate >=startdate and a.createdate<=enddate 

		AND a.busiid = var_busiid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_split_record` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_split_record`(in startdate date,in enddate date, IN var_busiid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,		

		b.scalar,		

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,		

		b.orderid,

		b.createdate,

		b.rate,

		(select nickname from chainuser where userid=b.userid) as nickname 			 

	FROM

		tb_wares a,

		chain_split_stocks b 

	WHERE

	  b.createdate>=startdate and b.createdate<=enddate and

	  a.id=b.id and b.busiid=var_busiid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_query_transfer` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_query_transfer`( IN abc varchar(20) ,IN var_busiid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,		

		a.barcode,

		a.piece,

		b.scalar,

		b.openprice,		

		b.batch,

		b.indate,

		b.prodate,

		b.batchid,		

		a.retailprice				 

	FROM

		tb_wares a,

		chain_store_batch b 

	WHERE

	  (a.`code`=abc or a.barcode=abc or a.tradename like concat('%',abc,'%') or a.spell like concat('%',abc,'%'))  and 

		a.id = b.id  and b.busiid=var_busiid  

		AND b.scalar>0

	ORDER BY

		a.id;		



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_recipel_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_recipel_check`(IN startdate date,in enddate date,in var_chaincode varchar(10),in var_regioncode varchar(10))
BEGIN

  if CHAR_LENGTH(var_chaincode)>0 then

	SELECT

		a.orderid,

		a.busiid,

		a.createdate,

		a.nickname,

		a.sex,

		a.age,

		a.doctor,

		a.hospital,

		a.diagnosis,

		a.`path`,		

		(select ename from tb_enterprise where busiid=a.busiid) as organ_name

		FROM

		chain_recipel a

		where a.writetime>=startdate and a.writetime<=enddate and a.states=2

		and busiid=(select busiid from tb_enterprise where chaincode=var_chaincode);

	end if;

	

	if CHAR_LENGTH(var_regioncode)>0 then

	SELECT

		a.orderid,

		a.busiid,

		a.createdate,

		a.nickname,

		a.sex,

		a.age,

		a.doctor,

		a.hospital,

		a.diagnosis,

		a.`path`,		

		(select ename from tb_enterprise where busiid=a.busiid) as organ_name

		FROM

		chain_recipel a

		where a.writetime>=startdate and a.writetime<=enddate and a.states=2

		and exists(select busiid from tb_enterprise where regioncode=var_regioncode and busiid=a.busiid);

	end if;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_reprint_detailed` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_reprint_detailed`( IN var_orderid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,		

		b.scalar,

		b.openprice,

		b.amount,		

		b.retailprice,

		b.batch,

		b.batchid,

		b.indate,

		b.prodate,

		b.copys,

		b.orderid,

		b.recno			 

	FROM

		tb_wares a,

		chain_retail_detailed b 

	WHERE

	  a.id=b.id and b.orderid=var_orderid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_retail_settled_posting` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_retail_settled_posting`( IN newid BIGINT, IN busi_id BIGINT )
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_split TINYINT;

	DECLARE

	  tmp_memid BIGINT;	

	DECLARE

	   tmp_pocket DECIMAL(18,2);

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		openprice,

		scalar * costprice AS amount,

		recno,

		split 

	FROM

		chain_retail_detailed a 

	WHERE

		orderid = newid 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 明细表

	INSERT INTO chain_sale_detailed (

		orderid,

		busiid,

		recno,

		id,

		scalar,

		openprice,

		amount,

		profit,

		costprice,

		createdate,

		batchid,

		batch,

		indate,

		prodate,

		split 

	) SELECT

	orderid,

	busi_id,

	recno,

	id,

	scalar,

	openprice,

	amount,

	profit,

	costprice,

	CURRENT_DATE,

	batchid,

	batch,

	indate,

	prodate,

	split 

	FROM

		chain_retail_detailed a 

	WHERE

		orderid = newid;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batchid,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno,

		tmp_split;-- 如果发生异常

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ) INTO old_scalar 

		FROM

			chain_store_stocks 

		WHERE

			id = tmp_id 

			AND busiid = busi_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			chain_store_batch 

		WHERE

		  id=tmp_id and

			batchid = tmp_batchid 

			AND busiid = busi_id;-- 不拆零

		IF

			( tmp_split = 0 ) THEN

				UPDATE chain_store_batch a 

				SET scalar = old_batch_scalar - tmp_scalar 

			WHERE

			  id=tmp_id and 

				batchid = tmp_batchid 

				AND busiid = busi_id;

			UPDATE chain_store_stocks a 

			SET scalar = old_scalar - tmp_scalar 

			WHERE

				id = tmp_id 

				AND busiid = busi_id;-- 拆零

			

			ELSEIF tmp_split = 1 THEN

			UPDATE chain_split_wares 

			SET sale = COALESCE ( sale, 0 )+ tmp_scalar 

			WHERE

				busiid = busi_id 

				AND id = tmp_id 

				AND batchid = tmp_batchid;

			

		END IF;

		

	END LOOP;

	CLOSE valid_batch;

	SELECT memid,pocket into tmp_memid,tmp_pocket FROM chain_retail where orderid=newid and busiid=busi_id;

	UPDATE chain_store_stocks a 

	SET amount = scalar * costprice 

	WHERE

		busiid = busi_id 

		AND EXISTS ( SELECT DISTINCT id FROM chain_retail_detailed WHERE orderid = newid AND id = a.id );

	UPDATE chain_store_batch a 

	SET amount = scalar * openprice 

	WHERE

		busiid = busi_id 

		AND EXISTS ( SELECT DISTINCT id FROM chain_retail_detailed WHERE orderid = newid AND id = a.id );

	UPDATE chain_sale_detailed a

	JOIN chain_retail b ON a.orderid=newid and a.orderid = b.orderid 

	AND b.busiid = busi_id 

	SET a.memid = b.memid,

	a.userid=b.userid;

	-- 处理积分与零钱

	IF(tmp_memid>0) THEN

	INSERT into chainmember_expan (busiid,memid,way,integral,pocket)select busi_id,tmp_memid,1,0,0 where not EXISTS(select busiid,memid from chainmember_expan a where busiid=busi_id and memid=tmp_memid); 

	UPDATE chainmember_expan a join chain_retail b on a.memid=tmp_memid and a.busiid=b.busiid and b.orderid=newid and b.busiid=busi_id set a.integral=COALESCE(a.integral,0)+b.amount*a.way,a.pocket=COALESCE(a.pocket,0)-b.pocket;

	end IF;

	IF(tmp_pocket>0 and tmp_memid>0) THEN

	INSERT into chainmember_pocket(orderid,busiid,memid,pocket,userid,createdate)select newid,busi_id,tmp_memid,tmp_pocket,b.userid,CURRENT_DATE from chain_retail b where orderid=newid and busiid=busi_id;

	END IF;

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_retail_transfer_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_retail_transfer_check`( IN newid BIGINT, IN busi_id BIGINT, IN var_userid BIGINT, IN var_inbusiid BIGINT, IN var_billid BIGINT )
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_split TINYINT;

	DECLARE

		tmp_memid BIGINT;

	DECLARE

		tmp_pocket DECIMAL ( 18, 2 );

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		tmp_indate VARCHAR ( 10 );

	DECLARE

		tmp_prodate VARCHAR ( 10 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		openprice,

		amount,

		recno,

		indate,

		prodate 

	FROM

		chain_transfer_detailed a 

	WHERE

		orderid = newid 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 明细表

-- 调入

	INSERT INTO tb_account_detailed ( billid, orderid, ORDER_TYPE, busiid, amount, unamount, this_amount, user_id, createdate, receivdate, issettled, payway, direction,transferid ) SELECT

	newid,

	0,

	0,

	inbusiid,

	amount,

	amount,

	0,

	var_userid,

	CURRENT_DATE,

	CURRENT_DATE,

	0,

	'记账',

	1,

	orderid 

	FROM

		chain_transfer a 

	WHERE

		orderid = newid;-- 调出

	INSERT INTO tb_account_detailed ( billid, orderid, ORDER_TYPE, busiid, amount, unamount, this_amount, user_id, createdate, receivdate, issettled, payway, direction,transferid) SELECT

	var_billid,

	0,

	0,

	busiid,

	- 1 * amount,

	- 1 * amount,

	0,

	var_userid,

	CURRENT_DATE,

	CURRENT_DATE,

	0,

	'记账',

	1,

	orderid 

	FROM

		chain_transfer a 

	WHERE

		orderid = newid;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batchid,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno,-- 如果发生异常

		tmp_indate,

		tmp_prodate;

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ) INTO old_scalar 

		FROM

			chain_store_stocks 

		WHERE

			id = tmp_id 

			AND busiid = busi_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			chain_store_batch 

		WHERE

			id = tmp_id 

			AND batchid = tmp_batchid 

			AND busiid = busi_id;-- 调拨出库

		UPDATE chain_store_batch a 

		SET scalar = old_batch_scalar - tmp_scalar 

		WHERE

			id = tmp_id 

			AND batchid = tmp_batchid 

			AND busiid = busi_id;

		UPDATE chain_store_stocks a 

		SET scalar = old_scalar - tmp_scalar 

		WHERE

			id = tmp_id 

			AND busiid = busi_id;-- 调拨入库

		INSERT INTO chain_store_batch ( busiid, id, batchid, batch, indate, prodate, openprice ) SELECT

		var_inbusiid,

		tmp_id,

		tmp_batchid,

		tmp_batch,

		tmp_indate,

		tmp_prodate,

		tmp_openprice 

		WHERE

			NOT EXISTS ( SELECT id, batchid FROM chain_store_batch WHERE busiid = var_inbusiid AND id = tmp_id AND batchid = tmp_batchid );

		INSERT INTO chain_store_stocks ( busiid, id,costprice ) SELECT

		var_inbusiid,

		tmp_id,

		tmp_openprice 

		WHERE

			NOT EXISTS ( SELECT id FROM chain_store_stocks WHERE busiid = var_inbusiid AND id = tmp_id );

		SELECT COALESCE

			( scalar, 0 ) INTO old_scalar 

		FROM

			chain_store_stocks 

		WHERE

			id = tmp_id 

			AND busiid = var_inbusiid;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			chain_store_batch 

		WHERE

			id = tmp_id 

			AND batchid = tmp_batchid 

			AND busiid = var_inbusiid;

		UPDATE chain_store_batch a 

		SET scalar = old_batch_scalar + tmp_scalar 

		WHERE

			id = tmp_id 

			AND batchid = tmp_batchid 

			AND busiid = var_inbusiid;

		UPDATE chain_store_stocks a 

		SET scalar = old_scalar + tmp_scalar 

		WHERE

			id = tmp_id 

			AND busiid = var_inbusiid;

		

	END LOOP;

	CLOSE valid_batch;-- 处理应收(调出）

	UPDATE tb_account a

	INNER JOIN chain_transfer b ON a.busiid = b.busiid 

	AND a.busiid = busi_id 

	AND b.orderid = newid 

	SET a.party = COALESCE ( a.party, 0 )- b.amount;-- 调入

	UPDATE tb_account a

	INNER JOIN chain_transfer b ON a.busiid = b.inbusiid 

	AND a.busiid = var_inbusiid 

	AND b.orderid = newid 

	SET a.party = COALESCE ( a.party, 0 )+ b.amount;

	UPDATE chain_store_stocks a 

	SET amount = scalar * costprice 

	WHERE

		busiid = busi_id 

		AND EXISTS ( SELECT DISTINCT id FROM chain_transfer_detailed WHERE orderid = newid AND id = a.id );

	UPDATE chain_store_batch a 

	SET amount = scalar * openprice 

	WHERE

		busiid = busi_id 

		AND EXISTS ( SELECT DISTINCT id FROM chain_transfer_detailed WHERE orderid = newid AND id = a.id );

	UPDATE chain_store_stocks a 

	SET amount = scalar * costprice 

	WHERE

		busiid = var_inbusiid 

		AND EXISTS ( SELECT DISTINCT id FROM chain_transfer_detailed WHERE orderid = newid AND id = a.id );

	UPDATE chain_store_batch a 

	SET amount = scalar * openprice 

	WHERE

		busiid = var_inbusiid 

		AND EXISTS ( SELECT DISTINCT id FROM chain_transfer_detailed WHERE orderid = newid AND id = a.id );

	UPDATE chain_transfer 

	SET states = 2 

	WHERE

		orderid = newid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_retail_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_retail_wares`( IN abc VARCHAR ( 20 ), IN var_busiid BIGINT )
BEGIN

	DECLARE

		var_price INT;

	SELECT

		valuesby INTO var_price 

	FROM

		chain_params 

	WHERE

		params = 'sync_price';

	IF

		( var_price = 0 ) THEN

		SELECT

			a.id,

			a.CODE,

			a.tradename,

			a.specs,

			a.enterprise,

			a.unit,

			a.holder,

			a.drugnumber,

			a.barcode,

			b.scalar,

			b.costprice,

			a.retailprice,

			a.memberprice,

			a.specprice,

			a.isspec,

			a.spec_scalar,

			a.ment,

			a.rx,

			a.isscan 

		FROM

			tb_wares a,

			chain_store_stocks b 

		WHERE

			(

				a.`code` = abc 

				OR a.barcode = abc 

				OR a.tradename LIKE concat( '%', abc, '%' ) 

			OR a.spell LIKE concat( '%', abc, '%' )) 

			AND a.id = b.id 

			AND b.busiid = var_busiid 

			AND b.scalar > 0 

		ORDER BY

			a.id;

		

	END IF;

	IF

		( var_price = 1 ) THEN

		SELECT

			a.id,

			a.CODE,

			a.tradename,

			a.specs,

			a.enterprise,

			a.unit,

			a.holder,

			a.drugnumber,

			a.barcode,

			b.scalar,

			b.costprice,

			b.retailprice,

			b.memberprice,

			b.specprice,

			b.isspec,

			b.spec_scalar,

			a.ment,

			a.rx,

			a.isscan 

		FROM

			tb_wares a,

			chain_store_stocks b 

		WHERE

			(

				a.`code` = abc 

				OR a.barcode = abc 

				OR a.tradename LIKE concat( '%', abc, '%' ) 

			OR a.spell LIKE concat( '%', abc, '%' )) 

			AND a.id = b.id 

			AND b.busiid = var_busiid 

			AND b.scalar > 0 

		ORDER BY

			a.id;

		

	END IF;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_sale_return_list` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_sale_return_list`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,		

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		fetch_way,		

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待质检' 

			WHEN states = 2 THEN

			'已入库' 

		END states 

FROM

	tb_invoice_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate AND states = 1 and order_type=9 and platform=3;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_split_posting` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_split_posting`( IN var_newid BIGINT, IN var_busiid BIGINT,IN var_id BIGINT,IN var_batchid INT )
BEGIN

	INSERT INTO chain_split_stocks(orderid,busiid,id,scalar,batchid,batch,indate,prodate,rate,userid,createdate)

	SELECT var_newid,var_busiid,id,calcscalar/rate,batchid,batch,indate,prodate,rate,userid,createdate FROM chain_split_wares where busiid=var_busiid and id=var_id and batchid=var_batchid;

	-- 计算拆零库存

	update chain_split_wares a join chain_split_stocks b on a.id=b.id and a.batchid=b.batchid and a.busiid=b.busiid and a.busiid=var_busiid and b.orderid=var_newid

	set a.scalar=coalesce(a.scalar,0)+b.scalar*b.rate;

	-- 处理批次数量

	update chain_store_batch a join chain_split_stocks b on a.busiid=var_busiid and a.id=b.id and a.batchid=b.batchid and b.orderid=var_newid and a.busiid=b.busiid

set a.scalar=a.scalar-b.scalar;	

  -- 处理总库存

update chain_store_stocks a join chain_split_stocks b on a.busiid=var_busiid and a.id=b.id and  b.orderid=var_newid and a.busiid=b.busiid

set a.scalar=a.scalar-b.scalar;

-- 重新计算金额

update chain_store_batch set amount=scalar*openprice where busiid=var_busiid and id=var_id and batchid=var_batchid;



update chain_store_stocks set amount=scalar*costprice where busiid=var_busiid and id=var_id;		



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `chain_sys_enter_checked` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `chain_sys_enter_checked`(

	IN var_userid VARCHAR ( 20 ))
BEGIN

	DECLARE

		flag INT DEFAULT 0;

	DECLARE

		tmp_postid BIGINT;

	DECLARE

		tmp_rovaled TINYINT;

	DECLARE

		auditer CURSOR FOR SELECT

		postid,

		isroval 

	FROM

		chain_role a 

	WHERE

		EXISTS ( SELECT userid FROM chainuser WHERE userid = a.user_id AND userid = var_userid ); 

		-- AND a.isroval = 1;-- 经过质量管理权限审核

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET flag = 1;

	CREATE TEMPORARY TABLE if not exists chain_menu_post ( menuid BIGINT, menu_name VARCHAR ( 50 ), winname VARCHAR ( 50 ), assemblyname VARCHAR ( 50 ), parentid BIGINT ,recno int) ENGINE = INNODB;

	OPEN auditer;

	FETCH auditer INTO tmp_postid,

	tmp_rovaled;

	WHILE

			flag <> 1 DO

			INSERT INTO chain_menu_post ( menuid, menu_name, winname, assemblyname, parentid,recno ) SELECT

			menuid,

			menu_name,

			winname,

			assemblyname,

			parentid,

			recno 

		FROM

			chain_menu a 

		WHERE

			EXISTS ( SELECT DISTINCT menuid FROM chain_role_menu WHERE postid = tmp_postid AND menuid = a.menuid AND isview = 1 );-- 授予功能权限的菜单

		FETCH auditer INTO tmp_postid,

		tmp_rovaled;

		

	END WHILE;

	CLOSE auditer;

	SELECT DISTINCT

		menuid,

		menu_name,

		winname,

		assemblyname,

		parentid,

		recno 

	FROM

		chain_menu_post order by parentid,recno;

	DROP TABLE chain_menu_post;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_backlog` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_backlog`(param_days int,param_rate DECIMAL,param_abc varchar(20))
BEGIN

  DECLARE tmp_id BIGINT;

	DECLARE tmp_batchid int;

	DECLARE tmp_createat date;

	DECLARE tmp_storeid BIGINT;

  DECLARE done int DEFAULT 0;

	

	DECLARE my_cur CURSOR FOR select id,batchid,createat,storeid from tb_backlog;

	-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;

	DELETE from tb_backlog;

	#积压天数大于param_days的商品

	UPDATE tb_batch set age=DATEDIFF(CURRENT_DATE,createdate);

	INSERT INTO tb_backlog(id,batchid,age,createat,storeid,stocks_scalar)SELECT id,batchid,age,createdate,storeid,scalar from tb_batch

	where scalar>0 and age>=param_days;

	

	OPEN my_cur;

	www:

	LOOP

	FETCH my_cur INTO

	tmp_id,

	tmp_batchid,

	tmp_createat,

	tmp_storeid;



	IF done=1 THEN

		LEAVE www; 

	END IF;

	update tb_backlog a INNER JOIN (select id,storeid,batchid,sum(outscalar) as scalar from tb_water where createdate>=tmp_createat and (ORDER_TYPE=5 or ORDER_TYPE=8 or ORDER_TYPE=9) and id=tmp_id and storeid=tmp_storeid and batchid=tmp_batchid and busiid>0 group by id,storeid,batchid) b on a.id=b.id and a.storeid=b.storeid and a.batchid=b.batchid

	set a.scalar=b.scalar;

	

END LOOP www;

CLOSE my_cur;

update tb_backlog set rate=scalar/(scalar+stocks_scalar)*100;

update tb_backlog a INNER JOIN tb_stocks b on a.id=b.id set a.lastprice=b.lastprice,a.busiid=b.busiid;

 

select a.id,a.code,a.tradename,a.specs,a.unit,a.enterprise,a.holder,a.piece,b.age,b.rate,b.scalar,c.indate,c.batch,b.lastprice,(select ename from tb_enterprise k where k.busiid=b.busiid LIMIT 1) as ename

from tb_wares a,tb_backlog b,tb_batch_info c  

where a.id=b.id and a.id=c.id and b.id=c.id and b.batchid=c.batchid and b.age>=param_days and b.rate<=param_rate

and (a.code like param_abc or a.tradename like param_abc or a.spell like param_abc);

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_countsheet_differ` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_countsheet_differ`( IN var_orderid INT )
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS tmp_sheet_differ (

			id BIGINT,

			storeid BIGINT,

			batch VARCHAR ( 20 ),

			batchid INT,

			scalar DECIMAL ( 18, 3 ),

			costprice DECIMAL ( 18, 4 ),

			differ_amount DECIMAL ( 18, 2 ),

			differ_scalar DECIMAL ( 18, 3 ),

		book_scalar DECIMAL ( 18, 3 )) ENGINE = innodb;

	INSERT INTO tmp_sheet_differ ( id, storeid, batch, batchid, scalar ) SELECT

	id,

	storeid,

	batch,

	batchid,

	sum( scalar ) 

	FROM

		tb_inventory_detailed 

	WHERE

		orderid = var_orderid 

	GROUP BY

		id,

		storeid,

		batch,

		batchid;

	UPDATE tmp_sheet_differ a

	INNER JOIN tb_inventory_detailed b ON b.orderid=var_orderid and a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.costprice = b.costprice;

	UPDATE tmp_sheet_differ a

	INNER JOIN tb_inventory_detailed b ON b.orderid=var_orderid and a.id = b.id 

	AND a.storeid = b.storeid 

	AND a.batchid = b.batchid 

	SET a.book_scalar = b.book_scalar;

	UPDATE tmp_sheet_differ 

	SET differ_scalar = scalar - book_scalar;

	UPDATE tmp_sheet_differ 

	SET differ_amount = differ_scalar * costprice;

	SELECT

	  a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,

		a.piece,

		b.scalar,

		b.differ_scalar,

		b.differ_amount,

		b.book_scalar,

		b.batch,

		b.batchid,

		b.costprice,

		b.storeid 

	FROM

		tb_wares a,

		tmp_sheet_differ b 

	WHERE

		a.id = b.id and b.differ_scalar<>0;

	DROP TABLE tmp_sheet_differ;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_countsheet_total` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_countsheet_total`( IN var_orderid INT )
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS tmp_sheet (

			id BIGINT,

			storeid BIGINT,

			batch VARCHAR ( 20 ),

			batchid INT,

			scalar DECIMAL ( 18, 3 ),

			costprice DECIMAL ( 18, 4 ),

			differ_amount DECIMAL ( 18, 2 ),

			differ_scalar DECIMAL ( 18, 3 ),

		book_scalar DECIMAL ( 18, 3 )) ENGINE = innodb;

	INSERT INTO tmp_sheet ( id, storeid, batch, batchid, scalar ) SELECT

	id,

	storeid,

	batch,

	batchid,

	sum( scalar ) 

	FROM

		tb_inventory_detailed 

	WHERE

		orderid = var_orderid 

	GROUP BY

		id,

		storeid,

		batch,

		batchid;

	UPDATE tmp_sheet a

	INNER JOIN tb_inventory_detailed b ON b.orderid=var_orderid and  a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.costprice = b.costprice;

	UPDATE tmp_sheet a

	INNER JOIN tb_inventory_detailed b ON b.orderid=var_orderid and  a.id = b.id 

	AND a.storeid = b.storeid 

	AND a.batchid = b.batchid 

	SET a.book_scalar = b.book_scalar;

	UPDATE tmp_sheet 

	SET differ_scalar = scalar - book_scalar;

	UPDATE tmp_sheet 

	SET differ_amount = differ_scalar * costprice;

	SELECT

	  a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,

		a.piece,

		b.scalar,

		b.differ_scalar,

		b.differ_amount,

		b.book_scalar,

		b.batch,

		b.batchid,

		b.costprice,

		b.storeid 

	FROM

		tb_wares a,

		tmp_sheet b 

	WHERE

		a.id = b.id;

	DROP TABLE tmp_sheet;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_curing_key` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_curing_key`( IN param_cycle INT, IN param_storeid BIGINT )
BEGIN
	DELETE 
	FROM
		tb_curing_record;-- 计算批次在库天数库龄及养护周期
	UPDATE tb_batch 
	SET age = DATEDIFF( CURRENT_DATE, createdate ),
	cycle = datediff( CURRENT_DATE, curdate );-- 首营不满一年及含麻药品及近6个月效期的药品视为重点养护
	INSERT INTO tb_curing_record ( id, batchid ) SELECT
	id,
	batchid 
	FROM
		tb_batch a 
	WHERE
		EXISTS ( SELECT DISTINCT id FROM tb_wares_first_check WHERE DATE_ADD( createdate, INTERVAL 1 YEAR )>= CURRENT_DATE AND id = a.id ) 
		AND a.scalar > 0;
	INSERT INTO tb_curing_record ( id, batchid ) SELECT
	id,
	batchid 
	FROM
		tb_batch a 
	WHERE
		EXISTS ( SELECT DISTINCT id FROM tb_wares WHERE category = '含特殊药品复方制剂' AND id = a.id ) 
		AND a.scalar > 0;
	INSERT INTO tb_curing_record ( id, batchid ) SELECT DISTINCT
	id,
	batchid 
	FROM
		tb_batch a 
	WHERE
		EXISTS (
		SELECT
			batchid 
		FROM
			tb_batch_info 
		WHERE
		DATE_SUB( STR_TO_DATE( indate, '%Y-%m-%d' ), INTERVAL 180 DAY ) <= CURRENT_DATE AND id = a.id AND batchid = a.batchid ) AND a.scalar > 0;
	SELECT
		a.id,
		a.CODE,
		a.tradename,
		a.unit,
		a.enterprise,
		a.specs,
		a.holder,
		a.drugnumber,
		a.piece,
		b.batchid,
		b.batch,
		b.indate,
		c.scalar,
		c.age,
		c.createdate,
		c.curdate,
		c.storeid,(
		SELECT
			store_name 
		FROM
			tb_storehouse 
		WHERE
			storeid = c.storeid 
		) AS store_name,
		'合格' AS quality_condition,
		'合格' AS verdict,
		'继续销售' AS opinion 
	FROM
		tb_wares a,
		tb_batch_info b,
		tb_batch c 
	WHERE
		a.id = b.id 
		AND a.id = c.id 
		AND b.id = c.id 
		AND b.batchid = c.batchid 
		AND c.scalar > 0 
		AND ( COALESCE ( cycle, 0 )>= param_cycle OR c.curdate IS NULL ) 
		AND c.storeid = param_storeid 
		AND EXISTS ( SELECT DISTINCT batchid FROM tb_curing_record WHERE batchid = c.batchid ) 
	ORDER BY
		a.id;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_curing_same` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_curing_same`( IN param_cycle INT, IN param_storeid BIGINT )
BEGIN
	DELETE 
	FROM
		tb_curing_record;-- 计算批次在库天数库龄及养护周期
	UPDATE tb_batch 
	SET age = DATEDIFF( CURRENT_DATE, createdate ),
	cycle = datediff( CURRENT_DATE, curdate );-- 首营不满一年及含麻药品及近6个月效期的药品视为重点养护
	INSERT INTO tb_curing_record ( id, batchid ) SELECT
	id,
	batchid 
	FROM
		tb_batch a 
	WHERE
		EXISTS ( SELECT DISTINCT id FROM tb_wares_first_check WHERE DATE_ADD( createdate, INTERVAL 1 YEAR )>= CURRENT_DATE AND id = a.id ) 
		AND a.scalar > 0;
	INSERT INTO tb_curing_record ( id, batchid ) SELECT
	id,
	batchid 
	FROM
		tb_batch a 
	WHERE
		EXISTS ( SELECT DISTINCT id FROM tb_wares WHERE category = '含特殊药品复方制剂' AND id = a.id ) 
		AND a.scalar > 0;
	INSERT INTO tb_curing_record ( id, batchid ) SELECT DISTINCT
	id,
	batchid 
	FROM
		tb_batch a 
	WHERE
		EXISTS (
		SELECT
			batchid 
		FROM
			tb_batch_info 
		WHERE
		DATE_SUB( STR_TO_DATE( indate, '%Y-%m-%d' ), INTERVAL 180 DAY ) <= CURRENT_DATE AND id = a.id AND batchid = a.batchid ) AND a.scalar > 0;
	SELECT
		a.id,
		a.CODE,
		a.tradename,
		a.unit,
		a.enterprise,
		a.specs,
		a.holder,
		a.drugnumber,
		a.piece,
		b.batchid,
		b.batch,
		b.indate,
		c.scalar,
		c.age,
		c.createdate,
		c.curdate,
		c.storeid,(
		SELECT
			store_name 
		FROM
			tb_storehouse 
		WHERE
			storeid = c.storeid 
		) AS store_name,
		'合格' AS quality_condition,
		'合格' AS verdict,
		'继续销售' AS opinion 
	FROM
		tb_wares a,
		tb_batch_info b,
		tb_batch c 
	WHERE
		a.id = b.id 
		AND a.id = c.id 
		AND b.id = c.id 
		AND b.batchid = c.batchid 
		AND c.scalar > 0 
		AND ( COALESCE ( cycle, 0 )>= param_cycle OR c.curdate IS NULL ) 
		AND c.storeid = param_storeid 
		AND NOT EXISTS ( SELECT DISTINCT batchid FROM tb_curing_record WHERE batchid = c.batchid ) 
	ORDER BY
		a.id;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_drug_transfer_instore` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_drug_transfer_instore`()
BEGIN 

  

 CREATE TEMPORARY TABLE if NOT EXISTS tmp_orderid_store(orderid int4) ENGINE=innodb;

 insert into tmp_orderid_store select orderid from tb_invoice_refer_head where isdrug=1 and order_type=9 and states=2 LIMIT 10;

			 

	select a.orderid as shdbh,'' as fhdbh,'' as dhdbh, '02' as shlx,a.createdate as shsj,b.drugnumber as yppzwh,b.ypbwm,b.tradename as yptymc,c.batch as ypscph,c.prodate as ypscrq,c.indate as ypyxqjzrq,b.piece as bzgg,b.unit as jldw,b.dosage as jx,cast(-1*c.scalar as decimal(10)) as shsl,(select busipermit from tb_enterprise where busiid=a.busiid) as tyshxydmfhqy,(select ename from tb_enterprise where busiid=a.busiid) as fhqymc,'91430103765611' as tyshxydmshqy,'湖南药品销售有限公司' as shqymc,'' as tyshxydmpsqy,'' as psqymc,'' as tyshxydmscqy,b.enterprise as scqymc,b.category as ypfl,b.entrust as wtdwmc,'' as tyshxydmwtdw

	from tb_invoice_refer_head a,tb_wares b,tb_invoice_refer_detailed c where a.orderid=c.orderid and c.id=b.id and a.states=2 and a.orderid in (select orderid from tmp_orderid_store) ORDER BY a.orderid;

	update tb_invoice_refer_head a INNER JOIN tmp_orderid_store b on a.orderid=b.orderid set a.isdrug=2; 

	DROP TABLE tmp_orderid_store;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_drug_transfer_outbound` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_drug_transfer_outbound`()
BEGIN 

  

 CREATE TEMPORARY TABLE if NOT EXISTS tmp_orderid(orderid int4) ENGINE=innodb;

 insert into tmp_orderid select orderid from tb_invoice_refer_head where isdrug=1 and order_type=5 and states=2 LIMIT 10;

			 

	select a.orderid as fhdbh,'' as dhdbh, '01' as fhlx,a.createdate as fhsj,b.drugnumber as yppzwh,b.ypbwm,b.tradename as yptymc,c.batch as ypscph,c.prodate as ypscrq,c.indate as ypyxqjzrq,b.piece as bzgg,b.unit as jldw,b.dosage as jx,cast(c.scalar as decimal(10)) as fhsl,(select busipermit from tb_enterprise where busiid=a.busiid) as tyshxydmshqy,(select ename from tb_enterprise where busiid=a.busiid) as shqymc,'91430103765611' as tyshxydmfhqy,'湖南药品销售有限公司' as fhqymc,'' as tyshxydmpsqy,'' as psqymc,'' as tyshxydmscqy,b.enterprise as scqymc,b.category as ypfl,b.entrust as wtdwmc,'' as tyshxydmwtdw

	from tb_invoice_refer_head a,tb_wares b,tb_invoice_refer_detailed c where a.orderid=c.orderid and c.id=b.id and a.states=2 and a.orderid in (select orderid from tmp_orderid) ORDER BY a.orderid;

	update tb_invoice_refer_head a INNER JOIN tmp_orderid b on a.orderid=b.orderid set a.isdrug=2; 

	DROP TABLE tmp_orderid;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_drug_transfer_out_purcharse` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_drug_transfer_out_purcharse`()
BEGIN 

  

 CREATE TEMPORARY TABLE if NOT EXISTS tmp_orderid_out(orderid int4) ENGINE=innodb;

 insert into tmp_orderid_out select orderid from tb_roval_head where isdrug=1 and order_type=6 and states=4 LIMIT 10;

			 

	select a.orderid as fhdbh,'' as dhdbh, '04' as fhlx,a.createdate as fhsj,b.drugnumber as yppzwh,b.ypbwm,b.tradename as yptymc,c.batch as ypscph,c.prodate as ypscrq,c.indate as ypyxqjzrq,b.piece as bzgg,b.unit as jldw,b.dosage as jx,cast(-1*c.scalar as decimal(10)) as fhsl,(select busipermit from tb_enterprise where busiid=a.busiid) as tyshxydmshqy,(select ename from tb_enterprise where busiid=a.busiid) as shqymc,'91430103765611' as tyshxydmfhqy,'湖南药品销售有限公司' as fhqymc,'' as tyshxydmpsqy,'' as psqymc,'' as tyshxydmscqy,b.enterprise as scqymc,b.category as ypfl,b.entrust as wtdwmc,'' as tyshxydmwtdw

	from tb_roval_head a,tb_wares b,tb_roval_detailed c where a.orderid=c.orderid and c.id=b.id and a.states=4 and a.orderid in (select orderid from tmp_orderid_out) ORDER BY a.orderid;

	update tb_roval_head a INNER JOIN tmp_orderid_out b on a.orderid=b.orderid set a.isdrug=2; 

	DROP TABLE tmp_orderid_out;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_drug_transfer_purcharse_store` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_drug_transfer_purcharse_store`()
BEGIN 

  

 CREATE TEMPORARY TABLE if NOT EXISTS tmp_orderid_pur(orderid int4) ENGINE=innodb;

 insert into tmp_orderid_pur select orderid from tb_roval_head where isdrug=1 and order_type=3 and states=1 LIMIT 10;

			 

	select a.orderid as shdbh,'' as fhdbh,'' as dhdbh, '01' as shlx,a.createdate as shsj,b.drugnumber as yppzwh,b.ypbwm,b.tradename as yptymc,c.batch as ypscph,c.prodate as ypscrq,c.indate as ypyxqjzrq,b.piece as bzgg,b.unit as jldw,b.dosage as jx,cast(c.scalar as decimal(10)) as shsl,(select busipermit from tb_enterprise where busiid=a.busiid) as tyshxydmfhqy,(select ename from tb_enterprise where busiid=a.busiid) as fhqymc,'91430103765611' as tyshxydmshqy,'湖南药品销售有限公司' as shqymc,'' as tyshxydmpsqy,'' as psqymc,'' as tyshxydmscqy,b.enterprise as scqymc,b.category as ypfl,b.entrust as wtdwmc,'' as tyshxydmwtdw

	from tb_roval_head a,tb_wares b,tb_roval_detailed c where a.orderid=c.orderid and c.id=b.id and a.states=1 and a.orderid in (select orderid from tmp_orderid_pur) ORDER BY a.orderid;

	update tb_roval_head a INNER JOIN tmp_orderid_pur b on a.orderid=b.orderid set a.isdrug=2; 

	DROP TABLE tmp_orderid_pur;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_drug_transfer_stocks` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_drug_transfer_stocks`()
BEGIN  

	select a.drugnumber as yppzwh,a.ypbwm,a.tradename as yptymc,'湖南药品销售有限公司' as kcqymc,'91430103765611' as tyshxydmkcqy,b.batch as ypscph,b.prodate as ypscrq,b.indate as ypyxqjzrq,a.piece as bzgg,a.dosage as jx,a.unit as jldw,CURRENT_TIMESTAMP as kcsbsj,'01' as kcsblx,c.scalar as kcsl,a.category as ypfl from tb_wares a,tb_batch_info b,tb_batch c

	where a.id=b.id and a.id=c.id and b.id=c.id and b.batchid=c.batchid and c.isdrug=1;

	update tb_batch set isdrug=0 where isdrug=1;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_drug_transfer_stocks_inventory` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_drug_transfer_stocks_inventory`()
BEGIN  

	select a.drugnumber as yppzwh,a.ypbwm,a.tradename as yptymc,'湖南药品销售有限公司' as kcqymc,'91430103765611' as tyshxydmkcqy,b.batch as ypscph,b.prodate as ypscrq,b.indate as ypyxqjzrq,a.piece as bzgg,a.dosage as jx,a.unit as jldw,CURRENT_TIMESTAMP as kcsbsj,'02' as kcsblx,c.scalar as kcsl,a.category as ypfl from tb_wares a,tb_batch_info b,tb_batch c

	where a.id=b.id and a.id=c.id and b.id=c.id and b.batchid=c.batchid and c.isdrug=2;

	update tb_batch set isdrug=0 where isdrug=2;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_enterprise_expire` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_enterprise_expire`( IN cycle INT )
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_enterprise_expire (

			busiid BIGINT,

			ecode VARCHAR ( 10 ),

			ename VARCHAR ( 50 ),

			legalbyname VARCHAR ( 20 ),

			salephone VARCHAR ( 30 ),

			isfor TINYINT,

			issale TINYINT,

			ispro TINYINT,

			docname VARCHAR ( 50 ),

		indate VARCHAR ( 10 )) ENGINE INNODB;

	INSERT INTO temp_enterprise_expire ( busiid, indate ) SELECT

	busiid,

	min( enddate ) AS indate 

	FROM

		tb_enterprise_doc a 

	WHERE

		EXISTS ( SELECT busiid FROM tb_enterprise WHERE busiid = a.busiid AND isroval = 3  AND states = 0 ) 

		AND enddate > "1" 

	GROUP BY

		busiid;

	UPDATE temp_enterprise_expire a

	INNER JOIN tb_enterprise b ON a.busiid = b.busiid 

	SET a.ecode = b.ecode,

	a.ename = b.ename,

	a.legalbyname = b.legalbyname,

	a.salephone = b.salephone,

	a.isfor = b.isfor,

	a.issale = b.issale,

	a.ispro = b.ispro;

	UPDATE temp_enterprise_expire a,

	tb_enterprise_doc b 

	SET a.docname = b.docname 

	WHERE

		a.busiid = b.busiid 

		AND a.indate = b.enddate;

	SELECT

		busiid,

		ecode,

		ename,

		legalbyname,

		salephone,

		isfor,

		issale,

		ispro,

		docname,

		indate 

	FROM

		temp_enterprise_expire 

	WHERE

		indate <= DATE_ADD( CURRENT_DATE, INTERVAL cycle DAY ) 

	ORDER BY

		busiid,

		indate;

	DROP TABLE temp_enterprise_expire;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_expdata` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_expdata`(

	IN store_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		old_depart_scalar DECIMAL ( 18, 3 );-- 部门批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT FALSE;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batch,

		scalar,

		costprice,

		scalar * costprice AS amount,

		recno,

		batchid 		

	FROM

		tb_expdata WHERE scalar>0 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

		

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = TRUE;

		-- 批次信息

		UPDATE tb_expdata a INNER JOIN tb_batch_info b on a.id=b.id and a.batch=b.batch

		set a.batchid=b.batchid;

-- 批次表

	INSERT INTO tb_batch ( batchid, id, storeid ) SELECT

	batchid,

	id,

	store_id 

	FROM

		tb_batch_info a 

	WHERE

		NOT EXISTS ( SELECT batchid FROM tb_batch WHERE id = a.id AND batchid = a.batchid );-- 更新批次序号

-- 部门库存表

	INSERT INTO tb_stocks_depart ( batchid, id, departno ) SELECT DISTINCT

	batchid,

	id,

	depart_no 

	FROM

		tb_batch_info a 

	WHERE

		NOT EXISTS ( SELECT id FROM tb_stocks_depart WHERE batchid = a.batchid AND departno = depart_no );-- 总库存表

	INSERT INTO tb_stocks ( id, storeid ) SELECT DISTINCT

	id,

	store_id 

	FROM

		tb_expdata a 

	WHERE

		NOT EXISTS ( SELECT id FROM tb_stocks WHERE id = a.id AND storeid = store_id );-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, inscalar, openprice, remarks, storeid ) SELECT

	0,

	0,

	CURRENT_DATE,

	id,

	0,(

		SELECT

			batchid 

		FROM

			tb_batch_info 

		WHERE

			id = a.id 

			AND batch = a.batch 

		) AS batchid,

		batch,

		recno,

		scalar,

		costprice,

		'导入数据',

		store_id 

	FROM

		tb_expdata a WHERE scalar>0;-- 打开游标

		set done=FALSE;

	OPEN valid_batch;	



-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno,

		tmp_batchid;-- 如果发生异常

		

		REPEAT

		SELECT COALESCE

			( scalar, 0 ),

			COALESCE ( amount, 0 ) INTO old_scalar,

			old_amount 

		FROM

			tb_stocks 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			tb_batch 

		WHERE

			batchid =tmp_batchid

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_depart_scalar 

		FROM

			tb_stocks_depart 

		WHERE

			batchid =tmp_batchid

			AND departno = depart_no;

		UPDATE tb_water 

		SET total = old_scalar + tmp_scalar 

		WHERE

			orderid = 0 

			AND recno = tmp_recno 

			AND order_type = 0;

		UPDATE tb_water 

		SET total_batch = old_batch_scalar + tmp_scalar 

		WHERE

			orderid = 0 

			AND recno = tmp_recno 

			AND order_type = 0;

		UPDATE tb_batch a 

		SET lastprice = tmp_openprice,

		scalar = old_batch_scalar + tmp_scalar,

		createdate = CURRENT_DATE 

		WHERE

			batchid =tmp_batchid

			AND storeid = store_id;

		UPDATE tb_stocks a 

		SET lastprice = tmp_openprice,

		scalar = old_scalar + tmp_scalar,

		amount = old_amount + tmp_amount,

		busiid = 0,

		createdate = CURRENT_DATE 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		UPDATE tb_stocks_depart a 

		SET costprice = tmp_openprice,

		lastprice = tmp_openprice,

		scalar = old_depart_scalar + tmp_scalar,

		amount = COALESCE ( amount, 0 )+ tmp_amount 

		WHERE

			batchid =tmp_batchid 

			AND departno = depart_no;

			

		FETCH valid_batch INTO tmp_id,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno,

		tmp_batchid;

		

	UNTIL done END REPEAT;	



	CLOSE valid_batch;-- 批次数量

	UPDATE tb_stocks 

	SET costprice = amount / scalar WHERE scalar>0;

	UPDATE tb_stocks_depart 

	SET costprice = amount / scalar WHERE scalar>0;

	update tb_stocks a INNER JOIN tb_expdata b

	on a.id=b.id 

	set a.minprice=b.minprice,a.bidprice=b.bidprice,a.saleprice=b.saleprice,

	a.retailprice=b.retailprice;

	update tb_wares a INNER JOIN tb_expdata b

	on a.id=b.id 

	set a.minprice=b.minprice,a.bidprice=b.bidprice,a.saleprice=b.saleprice,

	a.retailprice=b.retailprice;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_finance_cash_chain_invoice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_finance_cash_chain_invoice`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		related_typeid,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

		case when order_type=5 then

		'配送开票单'

		 when order_type=8 then

		'配送冲票单'

		when order_type=9 then

		'配送退货单'

		when order_type=10 then

		'销售调价单'

		end tag   

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 1

	and platform=3 

	AND payway = '现金' 

	AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE ( profit <= 0 OR openprice < minprice ) AND related_id = a.orderid AND states = 0 ) 

	AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE related_id = a.orderid AND ishemp = 1 and states=0 );



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_finance_cash_check_invoice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_finance_cash_check_invoice`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		related_typeid,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

		case when order_type=5 then

		'销售开票单'

		 when order_type=8 then

		'销售冲票单'

		when order_type=9 then

		'销售退货单'

		when order_type=10 then

		'销售调价单'

		end tag   

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 1

	and platform<3 

	AND payway = '现金' 

	AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE ( profit <= 0 OR openprice < minprice ) AND related_id = a.orderid AND states = 0 );

	-- AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE related_id = a.orderid AND ishemp = 1 and states=0 );



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_finance_chain_invoice_book` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_finance_chain_invoice_book`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		related_typeid,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

		case when order_type=5 then

		'配送开票单'

		 when order_type=8 then

		'配送冲票单'

		when order_type=9 then

		'配送退货单'

		when order_type=10 then

		'销售调价单'

		end tag  

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 1 

	and platform=3

	AND payway = '记账' 

	AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE ( profit <= 0 OR openprice < minprice ) AND related_id = a.orderid AND states = 0 ) 

	AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE related_id = a.orderid AND ishemp = 1 and states=0);



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_finance_check_invoice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_finance_check_invoice`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		related_typeid,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

		case when order_type=5 then

		'销售开票单'

		 when order_type=8 then

		'销售冲票单'

		when order_type=9 then

		'销售退货单'

		when order_type=10 then

		'销售调价单'

		end tag  

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 1 

	and platform<3

	AND payway = '记账' 

	AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE ( profit <= 0 OR openprice < minprice ) AND related_id = a.orderid AND states = 0 ) 

	 AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE related_id = a.orderid AND ishemp = 1 and states=0);



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_inventory` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_inventory`(

	IN newid BIGINT,

	IN store_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		old_depart_scalar DECIMAL ( 18, 3 );-- 部门批次数量

	DECLARE

		tmp_batchid INT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_real_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		scalar,

		differ_scalar,

		costprice,

		differ_amount,

		recno 

	FROM

		tb_inventory_update 

	WHERE

		enterid = newid 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

-- 流水表

	INSERT INTO tb_water (

		orderid,

		order_type,

		createdate,

		id,

		busiid,

		batchid,

		batch,

		recno,

		inscalar,

		outscalar,

		openprice,

		remarks,

		storeid,

		enterid 

	) SELECT

	orderid,

	13,

	CURRENT_DATE,

	id,

	0,

	batchid,

	batch,

	recno,

	differ_scalar,

	differ_scalar,

	costprice,

	'盘点差额单',

	store_id,

	enterid 

	FROM

		tb_inventory_update a 

	WHERE

		enterid = newid;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batchid,

		tmp_real_scalar,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno;-- 如果发生异常

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ),

			COALESCE ( amount, 0 ) INTO old_scalar,

			old_amount 

		FROM

			tb_stocks 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			tb_batch 

		WHERE

			batchid = tmp_batchid 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_depart_scalar 

		FROM

			tb_stocks_depart 

		WHERE

			batchid = tmp_batchid 

			AND departno = depart_no;

		UPDATE tb_water 

		SET total = old_scalar + tmp_scalar 

		WHERE

			enterid = newid 

			AND recno = tmp_recno 

			AND order_type = 13;

		UPDATE tb_water 

		SET total_batch = old_batch_scalar + tmp_scalar 

		WHERE

			enterid = newid 

			AND recno = tmp_recno 

			AND order_type = 13;

		UPDATE tb_batch a 

		SET scalar = tmp_real_scalar,

		isdrug = 2 

		WHERE

			id = tmp_id 

			AND batchid = tmp_batchid 

			AND storeid = store_id;

		UPDATE tb_stocks_depart a 

		SET scalar = tmp_real_scalar,

		amount = COALESCE ( amount, 0 )+ tmp_amount 

		WHERE

			batchid = tmp_batchid 

			AND departno = depart_no;

		

	END LOOP;

	CLOSE valid_batch;-- 批次数量

	UPDATE tb_stocks a

	INNER JOIN ( SELECT id, storeid, sum( scalar ) AS scalar FROM tb_inventory_update WHERE enterid = newid GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.scalar = b.scalar,

	a.amount = a.costprice * b.scalar;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_lock_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lock_check`(var_lockid BIGINT)
BEGIN

	INSERT INTO tb_reserve(reserve_id,orderid,order_type,id,recno,batchid,batch,scalar,storeid,departno,user_id,createdate)

	select lock_id,orderid,order_type,id,recno,batchid,batch,scalar,storeid,departno,user_id,createdate from tb_lock where lock_id=var_lockid;

	update tb_wares a INNER JOIN tb_lock b on a.id=b.id and b.lock_id=var_lockid set a.states=0;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_lock_check_cancel` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lock_check_cancel`(var_lockid BIGINT)
BEGIN

	DELETE from tb_reserve where reserve_id=var_lockid;

	update tb_wares a INNER JOIN tb_lock b on a.id=b.id and b.lock_id=var_lockid set a.states=1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_loss_list` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_loss_list`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,		

		remarks,

		createdate,		

		receivdate,

		amount,		

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,		

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'质检已审核' 

			WHEN states=3 THEN

			'总经理已审核'

			WHEN states=4 THEN

			'财务已审核'

		END states

		

FROM

	tb_overflowloss_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_orderid_code` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_orderid_code`( IN var_orderid INT )
BEGIN
/*企业上传出入库信息，包括101, "生产入库"；102, "采购入库"；103, "退货入库"；104, "调拨入库"；106, "零头入库"；107, "供应入库"；108, "召回入库"；110,"赠品入库"；111,"盘盈入库"；112,"报废入库"；113,"其他入库" 201, "销售出库"；202, "退货出库"；203, "调拨出库"；204, "返工出库"；205, "销毁出库"；206, "抽检出库"；207, "直调出库"；208, "生产出库"；209, "供应出库"；211, "召回出库"；212,"赠品出库"；214,"盘亏出库"；215,"损坏出库"；216,"报废出库"；217,"其他出库"；237, "直调退货"。 不包括对个人的零售出库，疫苗接种，领药出库。 本接口与uploadcircubill接口的主要区别的，本接口入参中直接上传追溯码（多个码时用逗号分隔）。uploadcircubill接口入参中，需要上传码的单据文件（用扫码枪生成的xml文件），一般情况下使用uploadcircubill接口上传单据文件。*/
	SELECT
		orderid AS bill_code,
		createdate AS bill_time,
		201 AS bill_type,
		3 AS physic_type,
		'' AS agent_ref_user_id,
		'' AS dest_user_id,(
		SELECT
			user_name 
		FROM
			client_users 
		WHERE
			user_id = a.userid 
		) AS oper_ic_name,
		'' AS warehouse_id,
		'' AS drug_id,(
		SELECT
			GROUP_CONCAT( drugcode ) 
		FROM
			tb_msc_code_saleout 
		WHERE
			orderid = var_orderid 
		) trace_codes,
		'2' AS client_type,
		'' AS return_reason_code,
		'' AS return_reason_des,
		'' AS cancel_reason_code,
		'' AS cancel_reason_des,
		'' AS executer_name,
		'' AS executer_code,
		'' AS superviser_name,
		'' AS superviser_code,
		'' AS from_address,
		'' AS to_address,
		'' AS from_bill_code,
		'' AS order_code,
		'' AS from_person,
		'' AS to_person,
		'' AS dis_ref_ent_id,
		'' AS dis_ent_id,
		'' AS qu_receivable,
		'' AS xt_is_check,
		'' AS xt_check_code,
		'' AS xt_check_code_desc,
		'' AS drug_list_json,
		'' AS ass_ref_ent_id,
		'' AS ass_ent_id 
	FROM
		tb_msc_code_saleout a 
	WHERE
		orderid = var_orderid 
		LIMIT 1;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_return_code` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_return_code`( IN var_orderid INT )
BEGIN

/*企业上传出入库信息，包括101, "生产入库"；102, "采购入库"；103, "退货入库"；104, "调拨入库"；106, "零头入库"；107, "供应入库"；108, "召回入库"；110,"赠品入库"；111,"盘盈入库"；112,"报废入库"；113,"其他入库" 201, "销售出库"；202, "退货出库"；203, "调拨出库"；204, "返工出库"；205, "销毁出库"；206, "抽检出库"；207, "直调出库"；208, "生产出库"；209, "供应出库"；211, "召回出库"；212,"赠品出库"；214,"盘亏出库"；215,"损坏出库"；216,"报废出库"；217,"其他出库"；237, "直调退货"。 不包括对个人的零售出库，疫苗接种，领药出库。 本接口与uploadcircubill接口的主要区别的，本接口入参中直接上传追溯码（多个码时用逗号分隔）。uploadcircubill接口入参中，需要上传码的单据文件（用扫码枪生成的xml文件），一般情况下使用uploadcircubill接口上传单据文件。*/

	SELECT

		orderid AS bill_code,

		createdate AS bill_time,

		103 AS bill_type,

		3 AS physic_type,

		'' AS agent_ref_user_id,

		'' AS dest_user_id,(

		SELECT

			user_name 

		FROM

			client_users 

		WHERE

			user_id = a.userid 

		) AS oper_ic_name,

		'' AS warehouse_id,

		'' AS drug_id,(

		SELECT

			GROUP_CONCAT( drugcode ) 

		FROM

			tb_msc_code_return

		WHERE

			orderid = var_orderid 

		) trace_codes,

		'2' AS client_type,

		'' AS return_reason_code,

		'' AS return_reason_des,

		'' AS cancel_reason_code,

		'' AS cancel_reason_des,

		'' AS executer_name,

		'' AS executer_code,

		'' AS superviser_name,

		'' AS superviser_code,

		'' AS from_address,

		'' AS to_address,

		'' AS from_bill_code,

		'' AS order_code,

		'' AS from_person,

		'' AS to_person,

		'' AS dis_ref_ent_id,

		'' AS dis_ent_id,

		'' AS qu_receivable,

		'' AS xt_is_check,

		'' AS xt_check_code,

		'' AS xt_check_code_desc,

		'' AS drug_list_json,

		'' AS ass_ref_ent_id,

		'' AS ass_ent_id 

	FROM

		tb_msc_code_return a 

	WHERE

		orderid = var_orderid 

		LIMIT 1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_return_enterprise_ref` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_return_enterprise_ref`()
BEGIN

  /*取一张单据上传*/

	SELECT a.busiid,a.busipermit,b.orderid from tb_enterprise a INNER JOIN tb_msc_head_return b

	on a.busiid=b.busiid and b.states=1 LIMIT 1; 

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_saleout_enterprise_ref` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_saleout_enterprise_ref`()
BEGIN

  /*取一张单据上传*/

	SELECT a.busiid,a.busipermit,b.orderid from tb_enterprise a INNER JOIN tb_msc_head_saleout b

	on a.busiid=b.busiid and b.states=1 LIMIT 1; 

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_storage_code` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_storage_code`( IN var_orderid INT )
BEGIN

/*企业上传出入库信息，包括101, "生产入库"；102, "采购入库"；103, "退货入库"；104, "调拨入库"；106, "零头入库"；107, "供应入库"；108, "召回入库"；110,"赠品入库"；111,"盘盈入库"；112,"报废入库"；113,"其他入库" 201, "销售出库"；202, "退货出库"；203, "调拨出库"；204, "返工出库"；205, "销毁出库"；206, "抽检出库"；207, "直调出库"；208, "生产出库"；209, "供应出库"；211, "召回出库"；212,"赠品出库"；214,"盘亏出库"；215,"损坏出库"；216,"报废出库"；217,"其他出库"；237, "直调退货"。 不包括对个人的零售出库，疫苗接种，领药出库。 本接口与uploadcircubill接口的主要区别的，本接口入参中直接上传追溯码（多个码时用逗号分隔）。uploadcircubill接口入参中，需要上传码的单据文件（用扫码枪生成的xml文件），一般情况下使用uploadcircubill接口上传单据文件。*/

	SELECT

		orderid AS bill_code,

		createdate AS bill_time,

		102 AS bill_type,

		3 AS physic_type,

		'' AS agent_ref_user_id,

		'' AS dest_user_id,(

		SELECT

			user_name 

		FROM

			client_users 

		WHERE

			user_id = a.userid 

		) AS oper_ic_name,

		'' AS warehouse_id,

		'' AS drug_id,(

		SELECT

			GROUP_CONCAT( drugcode ) 

		FROM

			tb_msc_code_storage

		WHERE

			orderid = var_orderid 

		) trace_codes,

		'2' AS client_type,

		'' AS return_reason_code,

		'' AS return_reason_des,

		'' AS cancel_reason_code,

		'' AS cancel_reason_des,

		'' AS executer_name,

		'' AS executer_code,

		'' AS superviser_name,

		'' AS superviser_code,

		'' AS from_address,

		'' AS to_address,

		'' AS from_bill_code,

		'' AS order_code,

		'' AS from_person,

		'' AS to_person,

		'' AS dis_ref_ent_id,

		'' AS dis_ent_id,

		'' AS qu_receivable,

		'' AS xt_is_check,

		'' AS xt_check_code,

		'' AS xt_check_code_desc,

		'' AS drug_list_json,

		'' AS ass_ref_ent_id,

		'' AS ass_ent_id 

	FROM

		tb_msc_code_storage a 

	WHERE

		orderid = var_orderid 

		LIMIT 1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_storage_enterprise_ref` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_storage_enterprise_ref`()
BEGIN

  /*取一张单据上传*/

	SELECT a.busiid,a.busipermit,b.orderid from tb_enterprise a INNER JOIN tb_msc_head_storage b

	on a.busiid=b.busiid and b.states=1 LIMIT 1; 

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_toout_code` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_toout_code`( IN var_orderid INT )
BEGIN

/*企业上传出入库信息，包括101, "生产入库"；102, "采购入库"；103, "退货入库"；104, "调拨入库"；106, "零头入库"；107, "供应入库"；108, "召回入库"；110,"赠品入库"；111,"盘盈入库"；112,"报废入库"；113,"其他入库" 201, "销售出库"；202, "退货出库"；203, "调拨出库"；204, "返工出库"；205, "销毁出库"；206, "抽检出库"；207, "直调出库"；208, "生产出库"；209, "供应出库"；211, "召回出库"；212,"赠品出库"；214,"盘亏出库"；215,"损坏出库"；216,"报废出库"；217,"其他出库"；237, "直调退货"。 不包括对个人的零售出库，疫苗接种，领药出库。 本接口与uploadcircubill接口的主要区别的，本接口入参中直接上传追溯码（多个码时用逗号分隔）。uploadcircubill接口入参中，需要上传码的单据文件（用扫码枪生成的xml文件），一般情况下使用uploadcircubill接口上传单据文件。*/

	SELECT

		orderid AS bill_code,

		createdate AS bill_time,

		202 AS bill_type,

		3 AS physic_type,

		'' AS agent_ref_user_id,

		'' AS dest_user_id,(

		SELECT

			user_name 

		FROM

			client_users 

		WHERE

			user_id = a.userid 

		) AS oper_ic_name,

		'' AS warehouse_id,

		'' AS drug_id,(

		SELECT

			GROUP_CONCAT( drugcode ) 

		FROM

			tb_msc_code_toout

		WHERE

			orderid = var_orderid 

		) trace_codes,

		'2' AS client_type,

		'' AS return_reason_code,

		'' AS return_reason_des,

		'' AS cancel_reason_code,

		'' AS cancel_reason_des,

		'' AS executer_name,

		'' AS executer_code,

		'' AS superviser_name,

		'' AS superviser_code,

		'' AS from_address,

		'' AS to_address,

		'' AS from_bill_code,

		'' AS order_code,

		'' AS from_person,

		'' AS to_person,

		'' AS dis_ref_ent_id,

		'' AS dis_ent_id,

		'' AS qu_receivable,

		'' AS xt_is_check,

		'' AS xt_check_code,

		'' AS xt_check_code_desc,

		'' AS drug_list_json,

		'' AS ass_ref_ent_id,

		'' AS ass_ent_id 

	FROM

		tb_msc_code_toout a 

	WHERE

		orderid = var_orderid 

		LIMIT 1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_msc_toout_enterprise_ref` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_msc_toout_enterprise_ref`()
BEGIN

  /*取一张单据上传*/

	SELECT a.busiid,a.busipermit,b.orderid from tb_enterprise a INNER JOIN tb_msc_head_toout b

	on a.busiid=b.busiid and b.states=1 LIMIT 1; 

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_order_purcharse_list` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_order_purcharse_list`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		buyer,

		carrier,

		remarks,

		createdate,

		legalbyname,

		amount,

		roval_id,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			when states=4 then

			'已作废'

			WHEN states = 0 THEN

			'等待审核' 

			WHEN states = 1 THEN

			'等待收货' 

			WHEN states = 2 THEN

			'等待质检' 

			WHEN states = 3 THEN

			'已入库' 

		END states 

FROM

	tb_order_head a 

WHERE

	cast( createdate AS date ) >= startdate 

	AND cast( createdate AS date ) <= enddate;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_overflowloss_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_overflowloss_check`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		user_id,

		departno,

		remarks,

		createdate,

		receivdate,

		amount,

		order_type,

		( SELECT DISTINCT storeid FROM tb_overflowloss_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待质检审核' 

			WHEN states = 2 THEN

			'等待总经理审核' 

			WHEN states = 3 THEN

			'等待财务审核' 

			WHEN states = 4 THEN

			'已报损' 

		END states,

CASE

		

		WHEN order_type = 14 THEN

		'药品报损单' 

	END tag 

FROM

	tb_overflowloss_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_price_check_invoice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_price_check_invoice`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states 

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 1 

	AND EXISTS ( SELECT related_id FROM tb_invoice WHERE ( profit <= 0 OR openprice < minprice ) AND related_id = a.orderid AND states = 0 );



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_qa_first_enterprise` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_qa_first_enterprise`(

	IN abc VARCHAR ( 50 ))
BEGIN

	SELECT

		busiid,

		ecode,

		ename,

		linkman,

		address,

		bank,

		bankcode,

		docuno,

		( SELECT user_name FROM client_users WHERE user_id = tb_enterprise.createby ) AS createby,

		createdate,

		headbyname,

		head_phone,

		qualitybyname,

		quality_phone,

		category,

		region_name,

		isfor,

		issale,

		taxno,

		phone,

		drugspermit,

		drugsdate,

		gmppermit,

		gmpdate,

		legalby,

		legaldate,

		qualityby,

		qualitydate,

		legalbyname,

		salephone,

		salecard,

		busi_check,

		busi_year,

		zipcode,

		legal_person,

		busipermit,		

		isroval,

	CASE

			

			WHEN isroval = 0 THEN

			'采购销售未审' 

			WHEN isroval = 1 THEN

			'质量部未审' 

			WHEN isroval = 2 THEN

			'质量负责人未审' 

			WHEN isroval = 3 THEN

			'已通过审核' ELSE '未审核' 

		END AS remarks 

	FROM

		tb_enterprise 

	WHERE

		( ecode LIKE abc OR ename LIKE abc OR spell LIKE abc ) 

		AND states = 0;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_qa_first_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_qa_first_wares`(

	IN abc VARCHAR ( 50 ))
BEGIN

	SELECT

		id,

		CODE,

		tradename,

		unit,

		enterprise,

		specs,

		dosage,

		drugnumber,

		filingno,

		quality_standard,

		validity,

		isroval,

		holder,

		entrust,

		entrust_address,

		indate,

		piece,

		docuno,

		states,

		category,

		address,

	CASE

			

			WHEN isroval = 0 THEN

			'采购销售未审' 

			WHEN isroval = 1 THEN

			'质量管理部未审' 

			WHEN isroval = 2 THEN

			'质量负责人未审' 

			WHEN isroval = 3 THEN

			'已通过审核' ELSE '未审核' 

		END remarks 

FROM

	tb_wares 

WHERE

	( CODE LIKE abc OR tradename LIKE abc OR spell LIKE abc ) 

	AND states = 1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_quality_hemp_check_invoice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_quality_hemp_check_invoice`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states 

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 1 

	-- AND payway = '记账' 

	AND NOT EXISTS ( SELECT related_id FROM tb_invoice WHERE ( profit <= 0 OR openprice < minprice ) AND related_id = a.orderid AND states = 0 ) 

	AND  EXISTS ( SELECT related_id FROM tb_invoice WHERE related_id = a.orderid AND ishemp = 1 and states=0 );



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_buyer` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_buyer`( IN startdate date, IN enddate date )
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_buyer (

			buyer VARCHAR ( 20 ),

			amount DECIMAL ( 18, 2 ),

			cost DECIMAL ( 18, 2 ),

			profit DECIMAL ( 18, 2 ),

			rate DECIMAL ( 18, 2 ) 

		) ENGINE = INNODB;

	INSERT INTO temp_buyer ( buyer, amount, cost, profit ) SELECT

	saleman,

	sum( amount ) AS amount,

	sum( cost ) AS cost,

	sum( profit ) AS profit 

	FROM

		tb_invoice_refer_head 

	WHERE

		receivdate >= startdate 

		AND receivdate <= enddate 

		AND states = 2 

	GROUP BY

		saleman;

	UPDATE temp_buyer 

	SET rate = profit / amount;

	SELECT

		* 

	FROM

		temp_buyer;

	DROP TABLE temp_buyer;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_buyer_enterprise` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_buyer_enterprise`( IN startdate date, IN enddate date, IN buyer varchar(10) )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		cost,

		round(profit / amount,2) AS rate,

		related_id,

		order_type,

		payway,

		profit,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

CASE

		

		WHEN order_type = 5 THEN

		'销售开票单' 

		WHEN order_type = 8 THEN

		'销售冲票单' 

		WHEN order_type = 9 THEN

		'销售退货单' 

		WHEN order_type = 10 THEN

		'销售调价单' 

	END tag 

FROM

	tb_invoice_refer_head a 

WHERE

	saleman = buyer 

	AND receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 2;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_buyer_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_buyer_wares`( IN startdate date, IN enddate date, IN buyer varchar(10) )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,

		b.orderid,

		b.scalar,

		b.openprice,

		b.amount,

		b.new_price,

		b.packages,

		b.cost,

		b.profit,

		b.rate,

		b.rovaldate,

		b.busiid,

		b.ename 

	FROM

		tb_wares a,(

		SELECT

			a.orderid,

			a.id,

			a.scalar,

			a.openprice,

			a.amount,

			a.new_price,

			a.packages,

			a.profit,

			round( a.scalar * a.costprice, 2 ) AS cost,

			round( a.profit / a.amount, 2 ) AS rate,

			b.rovaldate,

			b.busiid,

			( SELECT ename FROM tb_enterprise WHERE busiid = b.busiid ) AS ename 

		FROM

			tb_invoice_refer_detailed a,

			tb_invoice_refer_head b 

		WHERE

			a.orderid = b.orderid 

			AND b.saleman = buyer 

			AND b.receivdate >= startdate 

			AND b.receivdate <= enddate 

			AND b.states = 2 

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_finance_purcharse_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_finance_purcharse_check`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		buyer,

		carrier,

		remarks,		

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		reson,

		storeid,

		( SELECT store_name FROM tb_storehouse WHERE storeid = a.storeid ) AS store_name,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 2 THEN

			'等待审核'

			WHEN states = 3 THEN

			'已审核'  

		END states,

		case when order_type=6 then

		'采购退货申请单'

		when order_type=7 then

		'采购调价单'

		end tag 

		

FROM

	tb_roval_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate and states=2 	

	AND (order_type=6 or order_type=7); 

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_first_enterprise_print` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_first_enterprise_print`( IN param_busiid BIGINT )
BEGIN
	SELECT
		busiid,
		ecode,
		ename,
		linkman,
		address,
		bank,
		bankcode,
		docuno,
		createdate,
		headbyname,
		head_phone,
		qualitybyname,
		quality_phone,
		region_name,
		isfor,
		issale,
		taxno,
		phone,
		drugspermit,
		drugsdate,
		gmppermit,
		gmpdate,
		legalby,
		legaldate,
		qualityby,
		qualitydate,
		legalbyname,
		salephone,
		salecard,
		busi_check,
		busi_year,
		zipcode,
		legal_person,
		busipermit,
		shipaddress,
		busicope,

		legal_person,
	CASE
			
			WHEN category = 0 THEN
			'药品生产企业' 
			WHEN category = 1 THEN
			'药品批发企业' 
			WHEN category = 2 THEN
			'药品零售企业' 
			WHEN category = 3 THEN
			'器械批发企业' 
			WHEN category = 4 THEN
			'医院' 
			WHEN category = 5 THEN
			'诊所' 
			WHEN category = 6 THEN
			'卫生服务站' ELSE '其他' 
		END AS category,
		(
		SELECT
			user_name 
		FROM
			client_users a 
		WHERE
		EXISTS ( SELECT checkid FROM tb_enterprise_first_check WHERE busiid = param_busiid AND user_id = a.user_id AND states = 1 )) AS userbypur,
		(
		SELECT
			user_name 
		FROM
			client_users a 
		WHERE
		EXISTS ( SELECT checkid FROM tb_enterprise_first_check WHERE busiid = param_busiid AND user_id = a.user_id AND states = 2 )) AS userbyqa,
		(
		SELECT
			user_name 
		FROM
			client_users a 
		WHERE
		EXISTS ( SELECT checkid FROM tb_enterprise_first_check WHERE busiid = param_busiid AND user_id = a.user_id AND states = 3 )) AS userbyhead,
		( SELECT createdate FROM tb_enterprise_first_check a WHERE busiid = param_busiid AND states = 1 ) AS purdate,
		( SELECT createdate FROM tb_enterprise_first_check a WHERE busiid = param_busiid AND states = 2 ) AS qadate,
		( SELECT createdate FROM tb_enterprise_first_check a WHERE busiid = param_busiid AND states = 3 ) AS headdate 
	FROM
		tb_enterprise 
	WHERE
		busiid = param_busiid 
		AND states = 0;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_first_wares_print` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_first_wares_print`( IN param_id BIGINT )
BEGIN

	SELECT

		id,

		CODE,

		tradename,

		unit,

		enterprise,

		specs,

		dosage,

		drugnumber,

		filingno,

		quality_standard,

		storage_conditions,

		validity,

		isroval,

		holder,

		entrust,

		entrust_address,

		indate,

		piece,

		docuno,

		states,

		category,

		address,

		(

		SELECT

			user_name 

		FROM

			client_users a 

		WHERE

		EXISTS ( SELECT checkid FROM tb_wares_first_check WHERE id = param_id AND user_id = a.user_id AND states = 1 )) AS userbypur,

		(

		SELECT

			user_name 

		FROM

			client_users a 

		WHERE

		EXISTS ( SELECT checkid FROM tb_wares_first_check WHERE id = param_id AND user_id = a.user_id AND states = 2 )) AS userbyqa,

		(

		SELECT

			user_name 

		FROM

			client_users a 

		WHERE

		EXISTS ( SELECT checkid FROM tb_wares_first_check WHERE id = param_id AND user_id = a.user_id AND states = 3 )) AS userbyhead,

		( SELECT createdate FROM tb_wares_first_check a WHERE id = param_id AND states = 1 ) AS purdate,

		( SELECT createdate FROM tb_wares_first_check a WHERE id = param_id AND states = 2 ) AS qadate,

		( SELECT createdate FROM tb_wares_first_check a WHERE id = param_id AND states = 3 ) AS headdate 

	FROM

		tb_wares 

	WHERE

		id=param_id

		AND states = 1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_invoicer` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_invoicer`( IN startdate date, IN enddate date )
BEGIN
	CREATE TEMPORARY TABLE
	IF
		NOT EXISTS temp_invoicer (
			user_code VARCHAR ( 10 ),
			user_id BIGINT,
			user_name VARCHAR ( 20 ),
			amount DECIMAL ( 18, 2 ),
			cost DECIMAL ( 18, 2 ),
			profit DECIMAL ( 18, 2 ),
			rate DECIMAL ( 18, 2 ),
			ordercount INT 
		) ENGINE = INNODB;
	INSERT INTO temp_invoicer ( user_id, amount, cost, profit, ordercount ) SELECT
	user_id,
	sum( amount ) AS amount,
	sum( cost ) AS cost,
	sum( profit ) AS profit,
	count( orderid ) AS ordercount 
	FROM
		tb_invoice_refer_head 
	WHERE
		receivdate >= startdate 
		AND receivdate <= enddate 
		AND states = 2 
	GROUP BY
		user_id;
	UPDATE temp_invoicer a
	INNER JOIN client_users b ON a.user_id = b.user_id 
	SET a.user_name = b.user_name,
	a.user_code = b.user_code,
	rate = profit / amount;
	SELECT
		* 
	FROM
		temp_invoicer;
	DROP TABLE temp_invoicer;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_invoicer_enterprise` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_invoicer_enterprise`( IN startdate date, IN enddate date, IN userid BIGINT )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		cost,

		round(profit / amount,2) AS rate,

		related_id,

		order_type,

		payway,

		profit,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

CASE

		

		WHEN order_type = 5 THEN

		'销售开票单' 

		WHEN order_type = 8 THEN

		'销售冲票单' 

		WHEN order_type = 9 THEN

		'销售退货单' 

		WHEN order_type = 10 THEN

		'销售调价单' 

	END tag 

FROM

	tb_invoice_refer_head a 

WHERE

	user_id = userid 

	AND receivdate >= startdate 

	AND receivdate <= enddate 

	AND states = 2;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_invoicer_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_invoicer_wares`( IN startdate date, IN enddate date, IN userid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,

		b.orderid,

		b.scalar,

		b.openprice,

		b.amount,

		b.new_price,

		b.packages,

		b.cost,

		b.profit,

		b.rate,

		b.rovaldate,

		b.busiid,

		b.ename 

	FROM

		tb_wares a,(

		SELECT

			a.orderid,

			a.id,

			a.scalar,

			a.openprice,

			a.amount,

			a.new_price,

			a.packages,

			a.profit,

			round( a.scalar * a.costprice, 2 ) AS cost,

			round( a.profit / a.amount, 2 ) AS rate,

			b.rovaldate,

			b.busiid,

			( SELECT ename FROM tb_enterprise WHERE busiid = b.busiid ) AS ename 

		FROM

			tb_invoice_refer_detailed a,

			tb_invoice_refer_head b 

		WHERE

			a.orderid = b.orderid 

			AND b.user_id = userid 

			AND b.receivdate >= startdate 

			AND b.receivdate <= enddate 

			AND b.states = 2 

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_limitprice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_limitprice`( IN startdate date, IN enddate date )
BEGIN
	SELECT
		orderid,
		orgid,
		busiid,
		user_id,
		departno,
		saleman,
		remarks,
		createdate,
		legalbyname,
		receivdate,
		amount,
		related_id,
		order_type,
		payway,
		rovaldate,
		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,
		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,
		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,
		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,
		( SELECT user_name FROM client_users WHERE user_id = a.rovalby ) AS rovalbyname,
		'已审核' AS states 
	FROM
		tb_invoice_head a 
	WHERE
		receivdate >= startdate 
		AND receivdate <= enddate AND order_type = 4 AND rovalby > 1;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_lock_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_lock_wares`( IN startdate date, IN enddate date)
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,

		b.lock_id,

		b.orderid,

		b.scalar,

		b.batchid,

		b.batch,

		b.order_type,

		b.remark,		

		b.createdate,

		b.user_id,

		b.user_name,

		b.reviewer,

		b.reviewdate,

		b.isroval

	FROM

		tb_wares a,(

		SELECT

		  a.lock_id,

			a.orderid,

			a.id,

			a.scalar,	

			a.batchid,

			a.batch,		

			a.createdate,

			a.order_type,

			a.user_id,			

			( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,	

			( SELECT user_name FROM client_users WHERE user_id = a.reviewer ) AS reviewer,		

			remark,			

			reviewdate,

			isroval

		FROM

			tb_lock a			

		WHERE			

		 DATE_FORMAT(a.createdate,'%Y-%m-%d') >= startdate 

			AND DATE_FORMAT(a.createdate,'%Y-%m-%d') <= enddate			

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_plan` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_plan`(in startdate date)
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_plan_wares (

			id BIGINT,

			scalar DECIMAL ( 18, 3 ),-- 库存数量			

			total_scalar DECIMAL ( 18, 3 ),-- 季度销量

			total_month DECIMAL ( 18, 3 ),-- 上月销量

			lastprice DECIMAL ( 18, 4 ),

			busiid BIGINT			

		) ENGINE =innodb;

		insert into temp_plan_wares(id)select distinct id from tb_water where createdate>=startdate and (order_type=5 or order_type=8 or order_type=9);

		update temp_plan_wares a INNER JOIN tb_stocks b

		on a.id=b.id set a.scalar=b.scalar;

		

		update temp_plan_wares a INNER JOIN (select id,sum(outscalar) as scalar from tb_water where createdate>=startdate and (order_type=5 or order_type=8 or order_type=9) GROUP BY id) b on a.id=b.id set a.total_month=b.scalar;

		

		update temp_plan_wares a INNER JOIN (select id,sum(outscalar) as scalar from tb_water where createdate>=DATE_SUB(startdate,INTERVAL 2 MONTH) and (order_type=5 or order_type=8 or order_type=9) GROUP BY id) b on a.id=b.id set a.total_scalar=b.scalar;

		

		update temp_plan_wares a INNER JOIN (select distinct id,busiid,openprice from tb_water where createdate>=startdate and (order_type=3)) b on a.id=b.id set a.busiid=b.busiid,a.lastprice=b.openprice;

		

		select a.id,a.code,a.tradename,a.specs,a.enterprise,a.holder,a.unit,a.piece,a.drugnumber,b.scalar,b.total_scalar,b.total_month,b.lastprice,

		(select ename from tb_enterprise where busiid=b.busiid) as ename from tb_wares a,temp_plan_wares b

		where a.id=b.id and scalar<300;

		drop table temp_plan_wares;

		

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_purcharse_cata` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_purcharse_cata`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		buyer,

		carrier,

		remarks,		

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		reson,

		storeid,

		( SELECT store_name FROM tb_storehouse WHERE storeid = a.storeid ) AS store_name,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'已入库'

			WHEN states = 2 THEN

			'已审核'  

			WHEN states = 4 THEN

			'已退货'  

		END states,

		case when order_type=3 then

		'验收入库单'

		 when order_type=6 then

		'采购退货申请单'

		when order_type=7 then

		'采购调价单'

		end tag 

		

FROM

	tb_roval_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate; 

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_quality_purcharse_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_quality_purcharse_check`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		buyer,

		carrier,

		remarks,		

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		reson,

		storeid,

		( SELECT store_name FROM tb_storehouse WHERE storeid = a.storeid ) AS store_name,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核'

			WHEN states = 2 THEN

			'已审核'  

		END states,

		case when order_type=6 then

		'采购退货申请单'

		when order_type=7 then

		'采购调价单'

		end tag 

		

FROM

	tb_roval_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 	

	AND order_type=6 and states=1; 

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_reserve_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_reserve_wares`( IN startdate date, IN enddate date)
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,

		b.orderid,

		b.scalar,

		b.batchid,

		b.batch,

		b.order_type,

		b.logo,		

		b.createdate,

		b.user_id,

		b.user_name 

	FROM

		tb_wares a,(

		SELECT

			a.orderid,

			a.id,

			a.scalar,	

			a.batchid,

			a.batch,		

			a.createdate,

			a.order_type,

			a.user_id,			

			( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

			case when a.order_type=4 THEN '销售预留' when a.order_type=6 then '采购退货预留' when a.order_type=14 then '报损预留' 

			end logo

		FROM

			tb_reserve a			

		WHERE			

		 DATE_FORMAT(a.createdate,'%Y-%m-%d') >= startdate 

			AND DATE_FORMAT(a.createdate,'%Y-%m-%d') <= enddate 			

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_saleout_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_saleout_check`( IN startdate date, IN enddate date )
BEGIN

  DECLARE

		flag INT DEFAULT 0;

	DECLARE

		tmp_orderid BIGINT;	

	DECLARE

		auditer CURSOR FOR SELECT

		orderid		

	FROM

		temp_pick a;	

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET flag = 1;

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_pick (			

			busiid BIGINT,

			ename varchar(100),			

			orderid int,

			pick int,

			carton int,

			bags int

			

		) ENGINE = INNODB;

	INSERT INTO temp_pick (orderid,busiid) SELECT distinct

		orderid,busiid

	FROM

		tb_sale_pick 

	WHERE

		receivdate >= startdate 

		AND receivdate <= enddate 

		AND isroval = 1;

		

		OPEN auditer;

	FETCH auditer INTO tmp_orderid;	

	WHILE

			flag <> 1 DO

			update temp_pick a INNER JOIN (select count(distinct pick) as pick from tb_sale_pick where orderid=tmp_orderid and pick>0) b on a.orderid=tmp_orderid set a.pick=b.pick;

			update temp_pick a INNER JOIN (select count(distinct carton) as carton from tb_sale_pick where orderid=tmp_orderid and carton>0) b on a.orderid=tmp_orderid set a.carton=b.carton;

			update temp_pick a INNER JOIN (select count(distinct bags) as bags from tb_sale_pick where orderid=tmp_orderid and bags>0) b on a.orderid=tmp_orderid set a.bags=b.bags;

		FETCH auditer INTO tmp_orderid;	

	end while;

	CLOSE auditer;

	update temp_pick a INNER JOIN tb_enterprise b on a.busiid=b.busiid

  set a.ename=b.ename;

	select * from temp_pick;

	drop table temp_pick;	

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_saleout_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_saleout_wares`(IN var_orderid BIGINT )
BEGIN

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,

		b.orderid,

		b.scalar,

		b.batch,

		b.batchid,

		b.recno,

		b.packages,		

		b.ename,

		b.user_name,

		b.createdate 

	FROM

		tb_wares a,(

		SELECT

		  a.createdate,

			a.orderid,

			a.id,

			a.scalar,

			a.batch,

			a.batchid,			

			a.packages,

			a.recno,

			( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

			( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name 

		FROM

			tb_sale_pick a

			

		WHERE

			a.orderid = var_orderid 		

			

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_sale_details` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_sale_details`(param_abc varchar(20),startdate date,enddate date)
BEGIN

	#Routine body goes here...

	SELECT a.orderid,a.receivdate,(select ename from tb_enterprise  where busiid=a.busiid) as ename,b.scalar,b.openprice,b.amount,b.profit,b.scalar*b.costprice as cost,b.batch,b.indate,

	c.id,c.code,c.tradename,c.unit,c.specs,c.enterprise,c.holder,c.piece from tb_invoice_refer_head a,tb_invoice_refer_detailed b,

	tb_wares c where a.orderid=b.orderid and a.receivdate>=startdate and a.receivdate<=enddate and b.id=c.id; 



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_store_purcharse_check` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_store_purcharse_check`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		buyer,

		carrier,

		remarks,		

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		reson,

		storeid,

		( SELECT store_name FROM tb_storehouse WHERE storeid = a.storeid ) AS store_name,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 3 THEN

			'等待审核'

			WHEN states = 4 THEN

			'已审核'  

		END states,

		case when order_type=6 then

		'采购退货申请单'

		when order_type=7 then

		'采购调价单'

		end tag 

		

FROM

	tb_roval_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate 	

	AND order_type=6 and states=3; 

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_temp_invoice` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_temp_invoice`( IN startdate date, IN enddate date, IN userid BIGINT )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		rate,

		related_id,

		order_type,

		payway,

		fetch_way,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid) AS ename,-- 非连锁业务islock=0

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 0 THEN

			'草拟' 

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states 

FROM

	tb_invoice_head a 

WHERE

	user_id = userid

	and states=0

	and platform<3 -- 连锁为3，批发为0，小药药为1,药士帮为2

	AND receivdate >= startdate 

	AND receivdate <= enddate and order_type=4;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_query_temp_invoice_chain` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_query_temp_invoice_chain`( IN startdate date, IN enddate date, IN userid BIGINT )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		rate,

		related_id,

		order_type,

		payway,

		fetch_way,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid) AS ename,-- 非连锁业务islock=0

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 0 THEN

			'草拟' 

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states 

FROM

	tb_invoice_head a 

WHERE

	user_id = userid

	and states=0

	and platform=3 -- 连锁为3，批发为0，小药药为1,药士帮为2

	AND receivdate >= startdate 

	AND receivdate <= enddate and order_type=4;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_received_purcharse_list` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_received_purcharse_list`( IN startdate date, IN enddate date )
BEGIN
	SELECT
		orderid,
		orgid,
		busiid,
		user_id,
		departno,
		buyer,
		carrier,
		remarks,
		createdate,
		legalbyname,
		receivdate,
		amount,
		related_id,
		order_type,
		( SELECT store_name FROM tb_storehouse WHERE storeid = a.storeid ) AS store_name,
		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,
		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,
		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,
		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,
	CASE
			
			WHEN states = 1 THEN
			'等待质检' 
			WHEN states = 2 THEN
			'已入库' 
		END states 
FROM
	tb_received_head a 
WHERE
	receivdate >= startdate 
	AND receivdate <= enddate AND states > 0;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_chain_cash_type_5` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_chain_cash_type_5`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		chain_scalar DECIMAL ( 18, 3 );-- 连锁总库存数量

	DECLARE

		chain_amount DECIMAL ( 18, 2 );-- 连锁总库存金额

	DECLARE

		chain_batch_scalar DECIMAL ( 18, 3 );-- 连锁批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_order_type TINYINT;

	DECLARE

		var_order_type TINYINT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		openprice,

	  amount,

		recno,

		( SELECT order_type FROM tb_invoice_refer_head WHERE orderid = roval_id ) 

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	SELECT

		order_type INTO var_order_type 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;

		-- 连锁门店库存表

		INSERT into chain_store_stocks(busiid,id)select DISTINCT busi_id,id from tb_invoice_refer_detailed a where orderid=roval_id and not EXISTS(select busiid,id from chain_store_stocks where id=a.id and busiid=busi_id);

		-- 连锁批次表

		INSERT INTO chain_store_batch(busiid,id,batchid,batch,indate,prodate)select DISTINCT busi_id,id,batchid,batch,indate,prodate from tb_invoice_refer_detailed a where orderid=roval_id and not EXISTS(select busiid,id batchid from chain_store_batch where busiid=busi_id and id=a.id and batchid=a.batchid);

		-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, outscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	var_order_type,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	scalar,

	openprice,

	CASE

			

			WHEN var_order_type = 5 THEN

			'配送出库' 

			WHEN var_order_type = 8 THEN

			'配送冲票单' 

			WHEN var_order_type = 9 THEN

			'配送退货单' 

		END remarks,

	store_id,

	depart_no,

	(select user_id from tb_invoice_refer_head where orderid=roval_id),

  amount		

FROM

	tb_invoice_refer_detailed a 

WHERE

	orderid = roval_id;-- 打开游标

OPEN valid_batch;

www :

LOOP-- 使用游标

	FETCH valid_batch INTO tmp_id,

	tmp_batchid,

	tmp_batch,

	tmp_scalar,

	tmp_openprice,

	tmp_amount,

	tmp_recno,

	tmp_order_type;-- 如果发生异常

	IF

		done = 1 THEN

			LEAVE www;

		

	END IF;

	SELECT COALESCE

		( scalar, 0 ),

		COALESCE ( amount, 0 ) INTO old_scalar,

		old_amount 

	FROM

		tb_stocks 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	SELECT COALESCE

		( scalar, 0 ) INTO old_batch_scalar 

	FROM

		tb_batch 

	WHERE

	  id=tmp_id AND

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_water 

	SET total = old_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_water 

	SET total_batch = old_batch_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_batch a 

	SET scalar = old_batch_scalar - tmp_scalar 

	WHERE

	  id=tmp_id and

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_stocks a 

	SET scalar = old_scalar - tmp_scalar,

	amount = old_amount - tmp_amount 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	UPDATE tb_stocks_depart a 

	SET scalar = scalar - tmp_scalar,

	amount = amount - tmp_amount 

	WHERE

		batchid = tmp_batchid 

		AND departno = depart_no;

	-- 连锁部分库存处理

	SELECT COALESCE

		( scalar, 0 ),

		COALESCE ( amount, 0 ) INTO chain_scalar,

		chain_amount 

	FROM

		chain_store_stocks 

	WHERE

		id = tmp_id 

		AND busiid = busi_id;

	SELECT COALESCE

		( scalar, 0 ) INTO chain_batch_scalar 

	FROM

		chain_store_batch 

	WHERE

		batchid = tmp_batchid 

		and id=tmp_id

		AND busiid = busi_id;

	UPDATE chain_store_batch a 

	SET scalar = chain_batch_scalar + tmp_scalar,

	    openprice=tmp_openprice	 

	WHERE

		batchid = tmp_batchid 

		and id=tmp_id

		AND busiid = busi_id;

	UPDATE chain_store_stocks a 

	SET scalar = chain_scalar + tmp_scalar,

	amount = chain_amount + tmp_amount 

	WHERE

		id = tmp_id 

		AND busiid = busi_id;

	

END LOOP;

CLOSE valid_batch;-- 批次数量

-- 处理成本价和金额

UPDATE chain_store_stocks a

	INNER JOIN ( SELECT DISTINCT id, busi_id as busiid FROM tb_invoice_refer_detailed WHERE orderid = roval_id ) b ON a.id = b.id 

	AND a.busiid = b.busiid 

	SET costprice = amount / scalar;

	UPDATE chain_store_batch a

	INNER JOIN ( SELECT DISTINCT id, busi_id as busiid,batchid FROM tb_invoice_refer_detailed WHERE orderid = roval_id ) b ON a.id = b.id and a.batchid=b.batchid

	AND a.busiid = b.busiid 

	SET amount = scalar*openprice;

-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );

-- 往来企业余额(发票余额)

UPDATE tb_receipt_head a

INNER JOIN tb_invoice_refer_head b ON a.busiid = busi_id 

AND b.orderid = roval_id 

AND a.busiid = b.busiid 

SET total_party = COALESCE ( total_party, 0 )+ b.amount;

INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount, departno, direction, unreceipt_party ) SELECT

newid,

busiid,

orderid,

order_type,

CURRENT_TIMESTAMP,

saleman,

amount,

departno,

1,

amount 

FROM

	tb_invoice_refer_head 

WHERE

	orderid = roval_id;-- 财务表汇总及明细

INSERT INTO tb_finance_head ( orderid, order_type, busiid, amount, payway, receivdate, saleman ) SELECT

roval_id,

order_type,

busi_id,

amount,

payway,

CURRENT_TIMESTAMP,

saleman 

FROM

	tb_invoice_refer_head 

WHERE

	orderid = roval_id;

INSERT INTO tb_finance_detailed ( orderid, recno, id, scalar, openprice, amount, batchid, batch, indate, prodate ) SELECT

orderid,

recno,

id,

scalar,

openprice,

amount,

batchid,

batch,

indate,

prodate 

FROM

	tb_invoice_refer_detailed 

WHERE

	orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_chain_type_5` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_chain_type_5`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		chain_scalar DECIMAL ( 18, 3 );-- 连锁总库存数量

	DECLARE

		chain_amount DECIMAL ( 18, 2 );-- 连锁总库存金额

	DECLARE

		chain_batch_scalar DECIMAL ( 18, 3 );-- 连锁批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_order_type TINYINT;

	DECLARE

		var_order_type TINYINT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		openprice,

	  amount,

		recno,

		( SELECT order_type FROM tb_invoice_refer_head WHERE orderid = roval_id ) 

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	SELECT

		order_type INTO var_order_type 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;

		-- 连锁门店库存表

		INSERT into chain_store_stocks(busiid,id)select DISTINCT busi_id,id from tb_invoice_refer_detailed a where orderid=roval_id and not EXISTS(select busiid,id from chain_store_stocks where id=a.id and busiid=busi_id);

		-- 连锁批次表

		INSERT INTO chain_store_batch(busiid,id,batchid,batch,indate,prodate)select DISTINCT busi_id,id,batchid,batch,indate,prodate from tb_invoice_refer_detailed a where orderid=roval_id and not EXISTS(select busiid,id batchid from chain_store_batch where busiid=busi_id and id=a.id and batchid=a.batchid);

		-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, outscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	var_order_type,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	scalar,

	openprice,

	CASE

			

			WHEN var_order_type = 5 THEN

			'配送出库' 

			WHEN var_order_type = 8 THEN

			'配送冲票单' 

			WHEN var_order_type = 9 THEN

			'配送退货单' 

		END remarks,

	store_id,

	depart_no,

	(select user_id from tb_invoice_refer_head where orderid=roval_id),

  amount		

FROM

	tb_invoice_refer_detailed a 

WHERE

	orderid = roval_id;-- 打开游标

OPEN valid_batch;

www :

LOOP-- 使用游标

	FETCH valid_batch INTO tmp_id,

	tmp_batchid,

	tmp_batch,

	tmp_scalar,

	tmp_openprice,

	tmp_amount,

	tmp_recno,

	tmp_order_type;-- 如果发生异常

	IF

		done = 1 THEN

			LEAVE www;

		

	END IF;

	SELECT COALESCE

		( scalar, 0 ),

		COALESCE ( amount, 0 ) INTO old_scalar,

		old_amount 

	FROM

		tb_stocks 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	SELECT COALESCE

		( scalar, 0 ) INTO old_batch_scalar 

	FROM

		tb_batch 

	WHERE

	  id=tmp_id AND

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_water 

	SET total = old_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_water 

	SET total_batch = old_batch_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_batch a 

	SET scalar = old_batch_scalar - tmp_scalar 

	WHERE

	  id=tmp_id and

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_stocks a 

	SET scalar = old_scalar - tmp_scalar,

	amount = old_amount - tmp_amount 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	UPDATE tb_stocks_depart a 

	SET scalar = scalar - tmp_scalar,

	amount = amount - tmp_amount 

	WHERE

		batchid = tmp_batchid 

		AND departno = depart_no;

	-- 连锁部分库存处理

	SELECT COALESCE

		( scalar, 0 ),

		COALESCE ( amount, 0 ) INTO chain_scalar,

		chain_amount 

	FROM

		chain_store_stocks 

	WHERE

		id = tmp_id 

		AND busiid = busi_id;

	SELECT COALESCE

		( scalar, 0 ) INTO chain_batch_scalar 

	FROM

		chain_store_batch 

	WHERE

		batchid = tmp_batchid 

		and id=tmp_id

		AND busiid = busi_id;

	UPDATE chain_store_batch a 

	SET scalar = chain_batch_scalar + tmp_scalar,

	    openprice=tmp_openprice	 

	WHERE

		batchid = tmp_batchid 

		and id=tmp_id

		AND busiid = busi_id;

	UPDATE chain_store_stocks a 

	SET scalar = chain_scalar + tmp_scalar,

	amount = chain_amount + tmp_amount 

	WHERE

		id = tmp_id 

		AND busiid = busi_id;

	

END LOOP;

CLOSE valid_batch;-- 批次数量

-- 处理成本价和金额

UPDATE chain_store_stocks a

	INNER JOIN ( SELECT DISTINCT id, busi_id as busiid FROM tb_invoice_refer_detailed WHERE orderid = roval_id ) b ON a.id = b.id 

	AND a.busiid = b.busiid 

	SET costprice = amount / scalar;

	UPDATE chain_store_batch a

	INNER JOIN ( SELECT DISTINCT id, busi_id as busiid,batchid FROM tb_invoice_refer_detailed WHERE orderid = roval_id ) b ON a.id = b.id and a.batchid=b.batchid

	AND a.busiid = b.busiid 

	SET amount = scalar*openprice;

-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );



-- 往来企业余额(发票余额)

UPDATE tb_receipt_head a

INNER JOIN tb_invoice_refer_head b ON a.busiid = busi_id 

AND b.orderid = roval_id 

AND a.busiid = b.busiid 

SET total_party = COALESCE ( total_party, 0 )+ b.amount;

INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount, departno, direction, unreceipt_party ) SELECT

newid,

busiid,

orderid,

order_type,

CURRENT_TIMESTAMP,

saleman,

amount,

departno,

1,

amount 

FROM

	tb_invoice_refer_head 

WHERE

	orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_differ_type_7` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_differ_type_7`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		0 AS roval_scalar,

		new_price,

		differ_amount,

		recno 

	FROM

		tb_roval_detailed 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, inscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	7,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	0,

	new_price,

	'采购调价',

	store_id,

	depart_no,

	(select user_id from tb_roval_head where orderid=roval_id),

  amount		

	FROM

		tb_roval_detailed a 

	WHERE

		orderid = roval_id;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batchid,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno;-- 如果发生异常

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ),

			COALESCE ( amount, 0 ) INTO old_scalar,

			old_amount 

		FROM

			tb_stocks 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			tb_batch 

		WHERE

		  id=tmp_id and

			batchid = tmp_batchid 

			AND storeid = store_id;

		UPDATE tb_water 

		SET total = old_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = 7;

		UPDATE tb_water 

		SET total_batch = old_batch_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = 7;

		UPDATE tb_stocks a 

		SET amount = old_amount + tmp_amount 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		UPDATE tb_stocks_depart a 

		SET amount = amount + tmp_amount 

		WHERE

			batchid = tmp_batchid 

			AND departno = depart_no;

		

	END LOOP;

	CLOSE valid_batch;-- 批次数量

	

	-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

		

	UPDATE tb_stocks a

	INNER JOIN ( SELECT DISTINCT id, storeid FROM tb_roval_detailed WHERE orderid = roval_id ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET costprice = amount / scalar;

	UPDATE tb_stocks_depart a

	INNER JOIN ( SELECT DISTINCT id, storeid FROM tb_roval_detailed WHERE orderid = roval_id ) b ON a.id = b.id 

	AND a.departno = depart_no 

	SET costprice = amount / scalar;-- 往来企业余额(发票余额)

	UPDATE tb_receipt_head a

	INNER JOIN tb_roval_head b ON a.busiid = busi_id 

	AND b.orderid = roval_id 

	AND a.busiid = b.busiid 

	SET total_payer = COALESCE ( total_payer, 0 )+ b.amount;

	INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount, departno, direction, unreceipt_payer ) SELECT

	newid,

	busiid,

	orderid,

	order_type,

	CURRENT_TIMESTAMP,

	buyer,

	amount,

	departno,

	0,

	amount 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_overflowloss_type_14` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_overflowloss_type_14`(

	IN newid BIGINT,

	IN roval_id INT,	

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

  

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_order_type TINYINT;

	DECLARE

		var_order_type TINYINT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE tmp_storeid BIGINT;

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		openprice,

		amount,

		recno,(

		SELECT

			order_type 

		FROM

			tb_overflowloss_head 

		WHERE

			orderid = roval_id 

		),storeid 

	FROM

		tb_overflowloss_detailed a 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	SELECT

		order_type INTO var_order_type 

	FROM

		tb_overflowloss_head 

	WHERE

		orderid = roval_id;-- 流水表

	INSERT INTO tb_water (

		orderid,

		order_type,

		createdate,

		id,

		busiid,

		batchid,

		batch,

		recno,

		outscalar,

		openprice,

		remarks,

		storeid,

		departno,

		user_id,

		amount 

	) SELECT

	roval_id,

	var_order_type,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	scalar,

	openprice,

	CASE

			

			WHEN var_order_type = 14 THEN

			'药品报损' 

			WHEN var_order_type = 8 THEN

			'销售冲票单' 

			WHEN var_order_type = 9 THEN

			'销售退货单' 

		END remarks,

	storeid,

	depart_no,(

	SELECT

		user_id 

	FROM

		tb_overflowloss_head 

	WHERE

		orderid = roval_id 

	),

	amount 

FROM

	tb_overflowloss_detailed a 

WHERE

	orderid = roval_id;-- 打开游标

OPEN valid_batch;

www :

LOOP-- 使用游标

	FETCH valid_batch INTO tmp_id,

	tmp_batchid,

	tmp_batch,

	tmp_scalar,

	tmp_openprice,

	tmp_amount,

	tmp_recno,

	tmp_order_type,

	tmp_storeid;-- 如果发生异常

	IF

		done = 1 THEN

			LEAVE www;

		

	END IF;

	SELECT COALESCE

		( scalar, 0 ),

		COALESCE ( amount, 0 ) INTO old_scalar,

		old_amount 

	FROM

		tb_stocks 

	WHERE

		id = tmp_id 

		AND storeid = tmp_storeid;

	SELECT COALESCE

		( scalar, 0 ) INTO old_batch_scalar 

	FROM

		tb_batch 

	WHERE

	  id=tmp_id AND

		batchid = tmp_batchid 

		AND storeid = tmp_storeid;

	UPDATE tb_water 

	SET total = old_scalar + tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_water 

	SET total_batch = old_batch_scalar + tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_batch a 

	SET scalar = old_batch_scalar + tmp_scalar,isdrug=1 

	WHERE

	  id=tmp_id and

		batchid = tmp_batchid 

		AND storeid = tmp_storeid;

	UPDATE tb_stocks a 

	SET scalar = old_scalar + tmp_scalar,

	amount = old_amount + tmp_amount 

	WHERE

		id = tmp_id 

		AND storeid = tmp_storeid;

	UPDATE tb_stocks_depart a 

	SET scalar = scalar + tmp_scalar,

	amount = amount + tmp_amount 

	WHERE

		batchid = tmp_batchid 

		AND departno = depart_no;

	

END LOOP;

CLOSE valid_batch;-- 批次数量



-- 写入不合格库记录

insert into tb_below(id,batchid,batch,costprice,indate,prodate,createdate,departno) select distinct id,batchid,batch,costprice,indate,prodate,CURRENT_DATE,depart_no from tb_overflowloss_detailed a where orderid=roval_id and not EXISTS(select id,batchid from tb_below b where b.id=a.id and b.batchid=a.batchid);

update tb_below a INNER JOIN (select batchid,id,sum(scalar) as scalar from tb_overflowloss_detailed where orderid=roval_id group by batchid,id) b

on a.id=b.id and a.batchid=b.batchid set a.scalar=COALESCE(a.scalar,0)+b.scalar;



update tb_below set amount=scalar*costprice;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_purcharse_list` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_purcharse_list`(in startdate date,in enddate date)
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		buyer,

		carrier,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		( SELECT store_name FROM tb_storehouse WHERE storeid = a.storeid ) AS store_name,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN			

			'已入库' 

		END states 

FROM

	tb_roval_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate AND states=1;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_return_type_6` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_return_type_6`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		roval_scalar,

		openprice,

		amount,

		recno 

	FROM

		tb_roval_detailed 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, inscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	6,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	roval_scalar,

	openprice,

	'采购退货出库',

	store_id,

	depart_no,

	(select user_id from tb_roval_head where orderid=roval_id),

   amount		

	FROM

		tb_roval_detailed a 

	WHERE

		orderid = roval_id;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batchid,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno;-- 如果发生异常

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ),

			COALESCE ( amount, 0 ) INTO old_scalar,

			old_amount 

		FROM

			tb_stocks 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			tb_batch 

		WHERE

		  id=tmp_id AND

			batchid = tmp_batchid 

			AND storeid = store_id;

		UPDATE tb_water 

		SET total = old_scalar + tmp_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = 6;

		UPDATE tb_water 

		SET total_batch = old_batch_scalar + tmp_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = 6;

		UPDATE tb_batch a 

		SET scalar = old_batch_scalar + tmp_scalar,isdrug=1 

		WHERE

		  id=tmp_id and 

			batchid = tmp_batchid 

			AND storeid = store_id;

		UPDATE tb_stocks a 

		SET scalar = old_scalar + tmp_scalar,

		amount = old_amount + tmp_amount 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		UPDATE tb_stocks_depart a 

		SET scalar = COALESCE ( scalar, 0 ) + tmp_scalar,

		amount = COALESCE ( amount, 0 )+ tmp_amount 

		WHERE

			batchid = tmp_batchid 

			AND departno = depart_no;

		

	END LOOP;

	CLOSE valid_batch;-- 批次数量

	-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );

	UPDATE tb_receipt_head a

	INNER JOIN tb_roval_head b ON a.busiid = busi_id 

	AND b.orderid = roval_id 

	AND a.busiid = b.busiid 

	SET total_payer = COALESCE ( total_payer, 0 )+ b.amount;

	INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount, departno, direction, unreceipt_payer ) SELECT

	newid,

	busiid,

	orderid,

	order_type,

	CURRENT_TIMESTAMP,

	buyer,

	amount,

	departno,

	0,

	amount 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_sale_cash_type_10` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_sale_cash_type_10`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_order_type TINYINT;

	DECLARE

		var_order_type TINYINT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		new_price,

		amount,

		recno,

		( SELECT order_type FROM tb_invoice_refer_head WHERE orderid = roval_id ) 

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	SELECT

		order_type INTO var_order_type 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, outscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	var_order_type,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	0 as scalar,

	new_price,

	'销售调价单',

	store_id,

	depart_no,

	(select user_id from tb_invoice_refer_head where orderid=roval_id),

  amount		

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batchid,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno,

		tmp_order_type;-- 如果发生异常

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ),

			COALESCE ( amount, 0 ) INTO old_scalar,

			old_amount 

		FROM

			tb_stocks 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			tb_batch 

		WHERE

		  id=tmp_id and 

			batchid = tmp_batchid 

			AND storeid = store_id;

		UPDATE tb_water 

		SET total = old_scalar - tmp_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = tmp_order_type;

		UPDATE tb_water 

		SET total_batch = old_batch_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = tmp_order_type;

		

	END LOOP;

	CLOSE valid_batch;-- 批次数量

	-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );

-- 往来企业余额(发票余额)

	UPDATE tb_receipt_head a

	INNER JOIN tb_invoice_refer_head b ON a.busiid = busi_id 

	AND b.orderid = roval_id 

	AND a.busiid = b.busiid 

	SET total_party = COALESCE ( total_party, 0 )+ b.amount;

	INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount,departno,direction,unreceipt_party ) SELECT

	newid,

	busiid,

	orderid,

	order_type,

	CURRENT_TIMESTAMP,

	saleman,

	amount,

	departno,

	1,

	unreceipt_party 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;-- 财务表汇总及明细

	INSERT INTO tb_finance_head ( orderid, order_type, busiid, amount, payway, receivdate, saleman ) SELECT

	roval_id,

	order_type,

	busi_id,

	amount,

	payway,

	CURRENT_TIMESTAMP,

	saleman 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;

	INSERT INTO tb_finance_detailed ( orderid, recno, id, scalar, openprice, amount, batchid, batch, indate, prodate ) SELECT

	orderid,

	recno,

	id,

	scalar,

	new_price,

	amount,

	batchid,

	batch,

	indate,

	prodate 

	FROM

		tb_invoice_refer_detailed 

	WHERE

		orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_sale_cash_type_5` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_sale_cash_type_5`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_order_type TINYINT;

	DECLARE

		var_order_type TINYINT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		openprice,

		scalar * costprice AS amount,

		recno,

		( SELECT order_type FROM tb_invoice_refer_head WHERE orderid = roval_id ) 

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	SELECT

		order_type INTO var_order_type 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, outscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	var_order_type,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	scalar,

	openprice,

	CASE

			

			WHEN var_order_type = 5 THEN

			'销售出库' 

			WHEN var_order_type = 8 THEN

			'销售冲票单' 

			WHEN var_order_type = 9 THEN

			'销售退货单' 

		END remarks,

	store_id,

	depart_no,

	(select user_id from tb_invoice_refer_head where orderid=roval_id),

  amount		

FROM

	tb_invoice_refer_detailed a 

WHERE

	orderid = roval_id;-- 打开游标

OPEN valid_batch;

www :

LOOP-- 使用游标

	FETCH valid_batch INTO tmp_id,

	tmp_batchid,

	tmp_batch,

	tmp_scalar,

	tmp_openprice,

	tmp_amount,

	tmp_recno,

	tmp_order_type;-- 如果发生异常

	IF

		done = 1 THEN

			LEAVE www;

		

	END IF;

	SELECT COALESCE

		( scalar, 0 ),

		COALESCE ( amount, 0 ) INTO old_scalar,

		old_amount 

	FROM

		tb_stocks 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	SELECT COALESCE

		( scalar, 0 ) INTO old_batch_scalar 

	FROM

		tb_batch 

	WHERE

	  id=tmp_id AND

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_water 

	SET total = old_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_water 

	SET total_batch = old_batch_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_batch a 

	SET scalar = old_batch_scalar - tmp_scalar,isdrug=1 

	WHERE

	  id=tmp_id AND

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_stocks a 

	SET scalar = old_scalar - tmp_scalar,

	amount = old_amount - tmp_amount 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	UPDATE tb_stocks_depart a 

	SET scalar = scalar - tmp_scalar,

	amount = amount - tmp_amount 

	WHERE

		batchid = tmp_batchid 

		AND departno = depart_no;

	

END LOOP;

CLOSE valid_batch;-- 批次数量

-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );

-- 往来企业余额(发票余额)

UPDATE tb_receipt_head a

INNER JOIN tb_invoice_refer_head b ON a.busiid = busi_id 

AND b.orderid = roval_id 

AND a.busiid = b.busiid 

SET total_party = COALESCE ( total_party, 0 )+ b.amount;

INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount, departno, direction, unreceipt_party ) SELECT

newid,

busiid,

orderid,

order_type,

CURRENT_TIMESTAMP,

saleman,

amount,

departno,

1,

amount 

FROM

	tb_invoice_refer_head 

WHERE

	orderid = roval_id;-- 财务表汇总及明细

INSERT INTO tb_finance_head ( orderid, order_type, busiid, amount, payway, receivdate, saleman ) SELECT

roval_id,

order_type,

busi_id,

amount,

payway,

CURRENT_TIMESTAMP,

saleman 

FROM

	tb_invoice_refer_head 

WHERE

	orderid = roval_id;

INSERT INTO tb_finance_detailed ( orderid, recno, id, scalar, openprice, amount, batchid, batch, indate, prodate ) SELECT

orderid,

recno,

id,

scalar,

openprice,

amount,

batchid,

batch,

indate,

prodate 

FROM

	tb_invoice_refer_detailed 

WHERE

	orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_sale_type_10` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_sale_type_10`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_order_type TINYINT;

	DECLARE

		var_order_type TINYINT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		new_price,

		amount,

		recno,

		( SELECT order_type FROM tb_invoice_refer_head WHERE orderid = roval_id ) 

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	SELECT

		order_type INTO var_order_type 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, outscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	var_order_type,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	0 as scalar,

	new_price,

	'销售调价单',

	store_id,

	depart_no,

	( SELECT user_id FROM tb_invoice_refer_head WHERE orderid = roval_id ),

	amount

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batchid,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno,

		tmp_order_type;-- 如果发生异常

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ),

			COALESCE ( amount, 0 ) INTO old_scalar,

			old_amount 

		FROM

			tb_stocks 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			tb_batch 

		WHERE

		  id=tmp_id AND

			batchid = tmp_batchid 

			AND storeid = store_id;

		UPDATE tb_water 

		SET total = old_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = tmp_order_type;

		UPDATE tb_water 

		SET total_batch = old_batch_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = tmp_order_type;

		

	END LOOP;

	CLOSE valid_batch;

	-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	UPDATE tb_receipt_head a

	INNER JOIN tb_invoice_refer_head b ON a.busiid = busi_id 

	AND b.orderid = roval_id 

	AND a.busiid = b.busiid 

	SET total_party = COALESCE ( total_party, 0 )+ b.amount;

	INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount,departno,direction,unreceipt_party ) SELECT

	newid,

	busiid,

	orderid,

	order_type,

	CURRENT_TIMESTAMP,

	saleman,

	amount,

	departno,

	1 ,

	amount

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_sale_type_5` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_sale_type_5`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_order_type TINYINT;

	DECLARE

		var_order_type TINYINT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batchid,

		batch,

		scalar,

		openprice,

		scalar * costprice AS amount,

		recno,

		( SELECT order_type FROM tb_invoice_refer_head WHERE orderid = roval_id ) 

	FROM

		tb_invoice_refer_detailed a 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	SELECT

		order_type INTO var_order_type 

	FROM

		tb_invoice_refer_head 

	WHERE

		orderid = roval_id;-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, outscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	var_order_type,

	CURRENT_DATE,

	id,

	busi_id,

	batchid,

	batch,

	recno,

	scalar,

	openprice,

	CASE

			

			WHEN var_order_type = 5 THEN

			'销售出库' 

			WHEN var_order_type = 8 THEN

			'销售冲票单' 

			WHEN var_order_type = 9 THEN

			'销售退货单' 

		END remarks,

	store_id,

	depart_no,

	(select user_id from tb_invoice_refer_head where orderid=roval_id),

  amount		

FROM

	tb_invoice_refer_detailed a 

WHERE

	orderid = roval_id;-- 打开游标

OPEN valid_batch;

www :

LOOP-- 使用游标

	FETCH valid_batch INTO tmp_id,

	tmp_batchid,

	tmp_batch,

	tmp_scalar,

	tmp_openprice,

	tmp_amount,

	tmp_recno,

	tmp_order_type;-- 如果发生异常

	IF

		done = 1 THEN

			LEAVE www;

		

	END IF;

	SELECT COALESCE

		( scalar, 0 ),

		COALESCE ( amount, 0 ) INTO old_scalar,

		old_amount 

	FROM

		tb_stocks 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	SELECT COALESCE

		( scalar, 0 ) INTO old_batch_scalar 

	FROM

		tb_batch 

	WHERE

	  id=tmp_id AND

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_water 

	SET total = old_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_water 

	SET total_batch = old_batch_scalar - tmp_scalar 

	WHERE

		orderid = roval_id 

		AND recno = tmp_recno 

		AND order_type = tmp_order_type;

	UPDATE tb_batch a 

	SET scalar = old_batch_scalar - tmp_scalar,isdrug=1 -- 库存变更标识 

	WHERE

	  id=tmp_id and 

		batchid = tmp_batchid 

		AND storeid = store_id;

	UPDATE tb_stocks a 

	SET scalar = old_scalar - tmp_scalar,

	amount = old_amount - tmp_amount 

	WHERE

		id = tmp_id 

		AND storeid = store_id;

	UPDATE tb_stocks_depart a 

	SET scalar = scalar - tmp_scalar,

	amount = amount - tmp_amount 

	WHERE

		batchid = tmp_batchid 

		AND departno = depart_no;

	

END LOOP;

CLOSE valid_batch;-- 批次数量

-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_invoice_refer_head

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );



-- 往来企业余额(发票余额)

UPDATE tb_receipt_head a

INNER JOIN tb_invoice_refer_head b ON a.busiid = busi_id 

AND b.orderid = roval_id 

AND a.busiid = b.busiid 

SET total_party = COALESCE ( total_party, 0 )+ b.amount;

INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount, departno, direction, unreceipt_party ) SELECT

newid,

busiid,

orderid,

order_type,

CURRENT_TIMESTAMP,

saleman,

amount,

departno,

1,

amount 

FROM

	tb_invoice_refer_head 

WHERE

	orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_roval_type_3` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_roval_type_3`(

	IN newid BIGINT,

	IN roval_id INT,

	IN store_id BIGINT,

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	DECLARE

		old_scalar DECIMAL ( 18, 3 );-- 总库存数量

	DECLARE

		old_amount DECIMAL ( 18, 2 );-- 总库存金额

	DECLARE

		old_batch_scalar DECIMAL ( 18, 3 );-- 批次数量

	DECLARE

		old_depart_scalar DECIMAL ( 18, 3 );-- 部门批次数量

	DECLARE

		tmp_batchid BIGINT;

	DECLARE

		tmp_id BIGINT;

	DECLARE

		tmp_recno INT;

	DECLARE

		tmp_batch VARCHAR ( 20 );

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_openprice DECIMAL ( 18, 4 );

	DECLARE

		tmp_amount DECIMAL ( 18, 2 );

	DECLARE

		done INT DEFAULT 0;-- 游标定义

	DECLARE

		valid_batch CURSOR FOR SELECT

		id,

		batch,

		roval_scalar,

		openprice,

		amount,

		recno 

	FROM

		tb_roval_detailed 

	WHERE

		orderid = roval_id 

	ORDER BY

		id;-- 捕获系统抛出的not found错误，如果捕获到，将done设置为1 相当于try异常

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET done = 1;-- 批次信息

	INSERT INTO tb_batch_info ( id, batch, indate, prodate, createdate, shelfno, whole ) SELECT DISTINCT

	id,

	batch,

	indate,

	prodate,

	CURRENT_DATE,

	( SELECT shelfno FROM tb_stocks WHERE id = a.id AND storeid = a.storeid ) AS shelfno,

	( SELECT whole FROM tb_stocks WHERE id = a.id AND storeid = a.storeid ) AS whole 

	FROM

		tb_roval_detailed a 

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT id, batch FROM tb_batch_info WHERE id = a.id AND batch = a.batch );-- 批次表

	INSERT INTO tb_batch ( batchid, id, storeid ) SELECT

	batchid,

	id,

	store_id 

	FROM

		tb_batch_info a 

	WHERE

		NOT EXISTS ( SELECT batchid FROM tb_batch WHERE id = a.id AND batchid = a.batchid );-- 更新批次序号

	UPDATE tb_roval_detailed a

	INNER JOIN tb_batch_info b ON a.orderid = roval_id 

	AND a.id = b.id 

	AND a.batch = b.batch 

	SET a.batchid = b.batchid;-- 部门库存表

	INSERT INTO tb_stocks_depart ( batchid, id, departno ) SELECT DISTINCT

	batchid,

	id,

	depart_no 

	FROM

		tb_batch_info a 

	WHERE

		NOT EXISTS ( SELECT id FROM tb_stocks_depart WHERE batchid = a.batchid AND departno = depart_no ) 

		AND EXISTS ( SELECT id FROM tb_roval_detailed WHERE orderid = roval_id AND id = a.id AND batchid = a.batchid );-- 总库存表

	INSERT INTO tb_stocks ( id, storeid ) SELECT DISTINCT

	id,

	store_id 

	FROM

		tb_roval_detailed a 

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT id FROM tb_stocks WHERE id = a.id AND storeid = store_id );-- 流水表

	INSERT INTO tb_water ( orderid, order_type, createdate, id, busiid, batchid, batch, recno, inscalar, openprice, remarks, storeid,departno,user_id,amount ) SELECT

	roval_id,

	3,

	CURRENT_DATE,

	id,

	busi_id,(

		SELECT

			batchid 

		FROM

			tb_batch_info 

		WHERE

			id = a.id 

			AND batch = a.batch 

		) AS batchid,

		batch,

		recno,

		roval_scalar,

		openprice,

		'采购验收入库',

		store_id,

		depart_no,

		(select user_id from tb_roval_head where orderid=roval_id),

		amount 

	FROM

		tb_roval_detailed a 

	WHERE

		orderid = roval_id;-- 打开游标

	OPEN valid_batch;

	www :

	LOOP-- 使用游标

		FETCH valid_batch INTO tmp_id,

		tmp_batch,

		tmp_scalar,

		tmp_openprice,

		tmp_amount,

		tmp_recno;-- 如果发生异常

		IF

			done = 1 THEN

				LEAVE www;

			

		END IF;

		SELECT COALESCE

			( scalar, 0 ),

			COALESCE ( amount, 0 ) INTO old_scalar,

			old_amount 

		FROM

			tb_stocks 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_batch_scalar 

		FROM

			tb_batch 

		WHERE

			batchid =(

			SELECT

				batchid 

			FROM

				tb_batch_info 

			WHERE

				id = tmp_id 

				AND batch = tmp_batch 

			) 

			AND storeid = store_id;

		SELECT COALESCE

			( scalar, 0 ) INTO old_depart_scalar 

		FROM

			tb_stocks_depart 

		WHERE

			batchid =(

			SELECT

				batchid 

			FROM

				tb_batch_info 

			WHERE

				id = tmp_id 

				AND batch = tmp_batch 

			) 

			AND departno = depart_no;

		UPDATE tb_water 

		SET total = old_scalar + tmp_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = 3;

		UPDATE tb_water 

		SET total_batch = old_batch_scalar + tmp_scalar 

		WHERE

			orderid = roval_id 

			AND recno = tmp_recno 

			AND order_type = 3;

		UPDATE tb_batch a 

		SET lastprice = tmp_openprice,

		scalar = old_batch_scalar + tmp_scalar,

		createdate = CURRENT_DATE,isdrug=1 

		WHERE

			batchid =(

			SELECT

				batchid 

			FROM

				tb_batch_info 

			WHERE

				id = tmp_id 

				AND batch = tmp_batch 

			) 

			and id=tmp_id 

			AND storeid = store_id;

		UPDATE tb_stocks a 

		SET lastprice = tmp_openprice,

		scalar = old_scalar + tmp_scalar,

		amount = old_amount + tmp_amount,

		busiid = busi_id,

		createdate = CURRENT_DATE 

		WHERE

			id = tmp_id 

			AND storeid = store_id;

		UPDATE tb_stocks_depart a 

		SET costprice = tmp_openprice,

		lastprice = tmp_openprice,

		scalar = old_depart_scalar + tmp_scalar,

		amount = COALESCE ( amount, 0 )+ tmp_amount 

		WHERE

			batchid =(

			SELECT

				batchid 

			FROM

				tb_batch_info 

			WHERE

				id = tmp_id 

				AND batch = tmp_batch 

			) 

			AND departno = depart_no;

		

	END LOOP;

	CLOSE valid_batch;-- 批次数量

	UPDATE tb_stocks a

	INNER JOIN ( SELECT DISTINCT id, storeid FROM tb_roval_detailed WHERE orderid = roval_id ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET costprice = amount / scalar;

	UPDATE tb_stocks_depart a

	INNER JOIN ( SELECT DISTINCT id, storeid FROM tb_roval_detailed WHERE orderid = roval_id ) b ON a.id = b.id 

	AND a.departno = depart_no 

	SET costprice = amount / scalar;-- 插入总账数据

	INSERT INTO tb_account ( busiid ) SELECT

	busi_id 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_account WHERE busiid = busi_id );

	-- 往来企业余额(发票余额)

	INSERT INTO tb_receipt_head ( busiid ) SELECT

	busi_id 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id 

		AND NOT EXISTS ( SELECT busiid FROM tb_receipt_head WHERE busiid = busi_id );

	UPDATE tb_receipt_head a

	INNER JOIN tb_roval_head b ON a.busiid = busi_id 

	AND b.orderid = roval_id 

	AND a.busiid = b.busiid 

	SET total_payer = COALESCE ( total_payer, 0 )+ b.amount;

	INSERT INTO tb_receipt_detailed ( receipt_id, busiid, orderid, order_type, receivdate, sale_buyer_man, amount, departno, direction, unreceipt_payer ) SELECT

	newid,

	busiid,

	orderid,

	order_type,

	CURRENT_TIMESTAMP,

	buyer,

	amount,

	departno,

	0,

	amount 

	FROM

		tb_roval_head 

	WHERE

		orderid = roval_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_sale_list` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_sale_list`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		rate,

		related_id,

		order_type,

		payway,

		profit,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

		CASE

			

			WHEN order_type = 5 THEN

			'销售开票单' 

			WHEN order_type = 8 THEN

			'销售冲票单' 

			WHEN order_type = 9 THEN

			'销售退货单' 

			WHEN order_type = 10 THEN

			'销售调价单' 

		END tag,

		CASE

			

			WHEN platform = 0 THEN

			'批发业务' 

			WHEN platform = 1 THEN

			'小药药' 

			when platform=2 THEN

			'药士帮'

			WHEN platform=3 THEN

			'连锁配送'

		END platform

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_sale_list_bybusiid` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_sale_list_bybusiid`( IN startdate date, IN enddate date,var_busiid BIGINT )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		profit,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待审核' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

		CASE

			

			WHEN order_type = 5 THEN

			'销售开票单' 

			WHEN order_type = 8 THEN

			'销售冲票单' 

			WHEN order_type = 9 THEN

			'销售退货单' 

			WHEN order_type = 10 THEN

			'销售调价单' 

		END tag

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate and busiid like var_busiid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_sale_return_config` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_sale_return_config`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		rate,

		related_id,

		order_type,

		payway,

		profit,

		( SELECT DISTINCT storeid FROM tb_invoice_refer_detailed WHERE orderid = a.orderid ) AS storeid,

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'已验收' 

			WHEN states = 2 THEN

			'已审核' 

		END states,

		CASE

			

			WHEN order_type = 5 THEN

			'销售开票单' 

			WHEN order_type = 8 THEN

			'销售冲票单' 

			WHEN order_type = 9 THEN

			'销售退货单' 

			WHEN order_type = 10 THEN

			'销售调价单' 

		END tag

FROM

	tb_invoice_refer_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate

  and ORDER_TYPE=9 and states=2 and isconfig=0;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_sale_return_list` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_sale_return_list`( IN startdate date, IN enddate date )
BEGIN

	SELECT

		orderid,

		orgid,

		busiid,

		user_id,

		departno,

		saleman,		

		remarks,

		createdate,

		legalbyname,

		receivdate,

		amount,

		related_id,

		order_type,

		payway,

		fetch_way,		

		( SELECT user_name FROM client_users WHERE user_id = a.user_id ) AS user_name,

		( SELECT ename FROM tb_enterprise WHERE busiid = a.busiid ) AS ename,

		( SELECT depart_name FROM tb_department WHERE departno = a.departno ) AS depart_name,

		( SELECT orgname FROM tb_organ WHERE orgid = a.orgid ) AS orgname,

	CASE

			

			WHEN states = 1 THEN

			'等待质检' 

			WHEN states = 2 THEN

			'已入库' 

		END states 

FROM

	tb_invoice_head a 

WHERE

	receivdate >= startdate 

	AND receivdate <= enddate AND states = 1 and order_type=9 and platform<3;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_single_purcharse` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_single_purcharse`( IN waresid BIGINT, IN startdate DATE, IN enddate DATE )
BEGIN
	SELECT
		a.CODE,
		a.tradename,
		a.specs,
		a.enterprise,
		a.unit,
		a.holder,
		b.scalar,
		b.batch,
		b.prodate,
		b.indate,
		b.openprice,
		b.amount,
		c.orderid,
		c.createdate,(
		SELECT
			ename 
		FROM
			tb_enterprise 
		WHERE
			busiid = c.busiid 
		) AS ename,
	CASE
			
			WHEN c.order_type = 3 THEN
			'采购入库单' 
			WHEN c.order_type = 6 THEN
			'采购退货单' 
			WHEN c.order_type = 7 THEN
			'采购调价单' 
		END order_type 
FROM
	tb_wares a,
	tb_roval_detailed b,
	tb_roval_head c 
WHERE
	a.id = waresid 
	AND a.id = b.id 
	AND c.orderid = b.orderid 
	AND EXISTS ( SELECT orderid FROM tb_roval_head WHERE createdate >= startdate AND createdate <= enddate );

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_single_sale` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_single_sale`( IN waresid BIGINT, IN startdate DATE, IN enddate DATE )
BEGIN

	SELECT

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		b.scalar,

		b.batch,

		b.prodate,

		b.indate,

		b.openprice,

		b.amount,

		c.orderid,

		c.createdate,(

		SELECT

			ename 

		FROM

			tb_enterprise 

		WHERE

			busiid = c.busiid 

		) AS ename,

	CASE

			

			WHEN c.order_type = 5 THEN

			'销售出库单' 

			WHEN c.order_type = 9 THEN

			'销售退货单' 

			WHEN c.order_type = 8 THEN

			'销售冲票单' 

			WHEN c.order_type=10 THEN

			'销售调价单'

		END order_type 

FROM

	tb_wares a,

	tb_invoice_refer_detailed b,

	tb_invoice_refer_head c 

WHERE

	a.id = waresid 

	AND a.id = b.id 

	AND c.orderid = b.orderid 

	AND c.states=2

  AND EXISTS ( SELECT orderid FROM tb_invoice_refer_head WHERE receivdate >= startdate AND receivdate <= enddate);



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_single_stocks` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_single_stocks`(in waresid BIGINT)
BEGIN

	SELECT a.code,a.tradename,a.specs,a.enterprise,a.unit,a.holder,b.scalar,b.lastprice,c.batch,c.prodate,c.indate

	from tb_wares a,tb_batch b,tb_batch_info c where a.id=waresid and a.id=b.id and a.id=c.id and b.id=c.id and b.batchid=c.batchid;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_sum_sale_settled` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_sum_sale_settled`(startdate date,enddate date)
BEGIN

	#Routine body goes here...

	select a.receivdate,a.user_id,b.user_name,a.amount,a.payway from  (select receivdate,user_id,sum(amount) as amount,payway from tb_settled where receivdate>=startdate and receivdate<=enddate and direction=1

	group by receivdate,user_id,payway) a INNER JOIN client_users b ON a.user_id=b.user_id order by a.receivdate,a.user_id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_suplies_purcharse` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_suplies_purcharse`( IN startdate date, IN enddate date,var_busiid BIGINT )
BEGIN

  

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,

		b.orderid,

		b.scalar,

		b.openprice,

		b.amount,

		b.lastprice,

		b.batch,

		b.batchid,

		b.recno,

		b.packages,		

		b.ename,		

		b.createdate,

		b.order_type 

	FROM

		tb_wares a,(

		SELECT

		  b.createdate,

			a.orderid,

			a.id,

			a.scalar,

			a.openprice,

			a.amount,

			a.batch,

			a.batchid,			

			a.packages,

			a.recno,

			( SELECT ename FROM tb_enterprise WHERE busiid = b.busiid ) AS ename,

			(select lastprice from tb_stocks where id=a.id) as lastprice,

			CASE

			

			WHEN b.order_type = 3 THEN

			'采购入库单' 

			WHEN b.order_type = 6 THEN

			'采购退货单' 

			WHEN b.order_type = 7 THEN

			'采购调价单' 

			

		END order_type			

		FROM

			tb_roval_detailed a,tb_roval_head b

			

		WHERE

			a.orderid = b.orderid and b.createdate>=startdate and b.createdate<=enddate	and b.busiid=var_busiid 

			

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_suplies_sale` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_suplies_sale`( IN startdate date, IN enddate date,var_busiid BIGINT )
BEGIN

  

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,

		b.orderid,

		b.scalar,

		b.openprice,

		b.amount,

		b.limitprice,

		b.cost,

		b.profit,

		b.batch,

		b.batchid,

		b.recno,

		b.packages,		

		b.ename,		

		b.createdate,

		b.order_type 

	FROM

		tb_wares a,(

		SELECT

		  b.createdate,

			a.orderid,

			a.id,

			case when b.order_type=10 then 0 else  a.scalar end scalar,

			

			a.openprice,

			a.amount,

			a.batch,

			a.batchid,			

			a.packages,

			a.recno,

			abs(a.scalar*a.costprice) as cost,

			a.profit,

			( SELECT ename FROM tb_enterprise WHERE busiid = b.busiid ) AS ename,

			(select minprice from tb_stocks where id=a.id) as limitprice,

			CASE

			

			WHEN b.order_type = 5 THEN

			'销售开票单' 

			WHEN b.order_type = 8 THEN

			'销售冲票单' 

			WHEN b.order_type = 9 THEN

			'销售退货单' 

			WHEN b.order_type = 10 THEN

			'销售调价单' 

			

		END order_type			

		FROM

			tb_invoice_refer_detailed a,tb_invoice_refer_head b

			

		WHERE

			a.orderid = b.orderid and b.receivdate>=startdate and b.receivdate<=enddate and b.states=2

			and a.id in (select id from tb_roval_detailed  a where EXISTS(select orderid from tb_roval_head where createdate>=startdate and createdate<=enddate and orderid=a.orderid and  busiid=var_busiid))

			

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_suplies_stocks` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_suplies_stocks`( IN startdate date, IN enddate date,var_busiid BIGINT )
BEGIN

  

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.unit,

		a.specs,

		a.enterprise,

		a.drugnumber,

		a.holder,

		a.piece,		

		b.scalar,

		b.lastprice,		

		b.batch,

		b.batchid

		

	FROM

		tb_wares a,(

		SELECT

		  

			a.id,

			a.scalar,			

			a.lastprice,			

			(select batch from tb_batch_info where batchid=a.batchid) as batch,

			a.batchid			

			

		FROM

			tb_batch a

			

		WHERE

			

			a.id in (select id from tb_roval_detailed  a where EXISTS(select orderid from tb_roval_head where createdate>=startdate and createdate<=enddate and orderid=a.orderid and  busiid=var_busiid))

			

		) b 

	WHERE

		a.id = b.id;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_sys_enter_checked` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_sys_enter_checked`(

	IN usercode VARCHAR ( 20 ))
BEGIN

	DECLARE

		flag INT DEFAULT 0;

	DECLARE

		tmp_postid BIGINT;

	DECLARE

		tmp_rovaled TINYINT;

	DECLARE

		auditer CURSOR FOR SELECT

		postid,

		isroval 

	FROM

		tb_post_role a 

	WHERE

		EXISTS ( SELECT user_id FROM client_users WHERE user_id = a.user_id AND user_code = usercode ) 

		AND a.isroval = 1;-- 经过质量管理权限审核

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET flag = 1;

	CREATE TEMPORARY TABLE if not exists t_menu_post ( menuid BIGINT, menu_name VARCHAR ( 50 ), winname VARCHAR ( 50 ), assemblyname VARCHAR ( 50 ), parentid BIGINT ,recno int) ENGINE = INNODB;

	OPEN auditer;

	FETCH auditer INTO tmp_postid,

	tmp_rovaled;

	WHILE

			flag <> 1 DO

			INSERT INTO t_menu_post ( menuid, menu_name, winname, assemblyname, parentid,recno ) SELECT

			menuid,

			menu_name,

			winname,

			assemblyname,

			parentid,

			recno 

		FROM

			client_menu a 

		WHERE

			EXISTS ( SELECT DISTINCT menuid FROM tb_post_role_menu WHERE postid = tmp_postid AND menuid = a.menuid AND isview = 1 ) and isactive=1;-- 授予功能权限的菜单

		FETCH auditer INTO tmp_postid,

		tmp_rovaled;

		

	END WHILE;

	CLOSE auditer;

	SELECT DISTINCT

		menuid,

		menu_name,

		winname,

		assemblyname,

		parentid,

		recno 

	FROM

		t_menu_post order by parentid,recno;

	DROP TABLE t_menu_post;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_trace` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_trace`(

	IN startdate date,

	IN enddate date,

	IN wareid BIGINT,

	IN varbatch VARCHAR ( 20 ))
BEGIN

	DECLARE

		total_scalar DECIMAL ( 18, 3 );

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_trace (

			tid INT NOT NULL AUTO_INCREMENT,

			id BIGINT,

			busiid BIGINT,

			ename VARCHAR ( 50 ),

			user_name VARCHAR ( 10 ),

			user_id BIGINT,

			departno VARCHAR ( 10 ),

			remarks VARCHAR ( 100 ),

			orderid INT,

			recno INT,

			order_type TINYINT,

			saleman VARCHAR ( 10 ),

			prodate VARCHAR ( 10 ),

			indate VARCHAR ( 10 ),

			batchid INT,

			batch VARCHAR ( 20 ),

			createdate date,

			scalar DECIMAL ( 18, 3 ),

			openprice DECIMAL ( 18, 4 ),

			amount DECIMAL ( 18, 2 ),

		PRIMARY KEY ( tid )) ENGINE = INNODB;

	INSERT INTO temp_trace ( id, busiid, remarks, orderid, recno, order_type, batchid, createdate, openprice, departno, user_id,amount ) SELECT

	id,

	busiid,

	remarks,

	orderid,

	recno,

	order_type,

	batchid,

	createdate,

	openprice,

	departno,

	user_id,

	amount 

	FROM

		tb_water 

	WHERE

		createdate >= startdate 

		AND createdate <= enddate 

		AND id = wareid 

		AND batch LIKE varbatch 

		AND remarks LIKE '%销售%' 

	ORDER BY

		remarks;

	UPDATE temp_trace a

	INNER JOIN tb_water b ON a.orderid = b.orderid 

	AND a.recno = b.recno 

	AND ( a.order_type = 5 OR a.order_type = 8 OR a.order_type = 9 OR a.order_type = 10 ) 

	SET a.scalar = b.outscalar;

	SELECT

		sum( scalar ) AS scalar INTO total_scalar 

	FROM

		temp_trace 

	WHERE

		remarks LIKE '%销售%';

	IF

		total_scalar > 0 THEN

			INSERT INTO temp_trace ( remarks, scalar )

		VALUES

			( '销售合计', total_scalar );

		

	END IF;

	INSERT INTO temp_trace ( id, busiid, remarks, orderid, recno, order_type, batchid, createdate, openprice, departno, user_id,amount ) SELECT

	id,

	busiid,

	remarks,

	orderid,

	recno,

	order_type,

	batchid,

	createdate,

	openprice,

	departno,

	user_id,

	amount 

	FROM

		tb_water 

	WHERE

		createdate >= startdate 

		AND createdate <= enddate 

		AND id = wareid 

		AND batch LIKE varbatch 

		AND remarks LIKE '%采购%' 

	ORDER BY

		remarks;

	UPDATE temp_trace a

	INNER JOIN tb_water b ON a.orderid = b.orderid 

	AND a.recno = b.recno 

	AND ( a.order_type = 3 OR a.order_type = 6 OR a.order_type = 7 ) 

	SET a.scalar = b.inscalar;

	SELECT

		sum( scalar ) AS scalar INTO total_scalar 

	FROM

		temp_trace 

	WHERE

		remarks LIKE '%采购%';

	IF

		total_scalar > 0 THEN

			INSERT INTO temp_trace ( remarks, scalar )

		VALUES

			( '采购合计', total_scalar );

		

	END IF;

	UPDATE temp_trace a

	INNER JOIN tb_enterprise b ON a.busiid = b.busiid 

	SET a.ename = b.ename;

	

	UPDATE temp_trace a

	INNER JOIN tb_batch_info b ON a.batchid = b.batchid 

	SET a.batch = b.batch,

	a.prodate = b.prodate,

	a.indate = b.indate;

	UPDATE temp_trace a

	INNER JOIN tb_invoice_refer_head b ON a.orderid = b.orderid 

	AND a.remarks LIKE "%销售%" 

	SET a.saleman = b.saleman,	

	user_name =(

		SELECT

			user_name 

		FROM

			client_users 

		WHERE

			user_id = b.user_id 

		);

	UPDATE temp_trace a

	INNER JOIN tb_roval_head b ON a.orderid = b.orderid 

	AND a.remarks LIKE "%采购%" 

	SET a.saleman = b.buyer,	

	user_name =(

		SELECT

			user_name 

		FROM

			client_users 

		WHERE

			user_id = b.user_id 

		);

	SELECT

		id,

		ename,

		user_name,

		departno,

		remarks,

		orderid,		

		saleman,

		indate,

		prodate,

		batch,

		createdate,

		openprice,

		amount,

		scalar,

		order_type 

	FROM

		temp_trace 

	ORDER BY

		tid;

	DROP TABLE temp_trace;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_type_invoice_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_type_invoice_wares`(

	IN abc VARCHAR ( 50 ),

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_invoice_wares (

			id BIGINT,

			scalar DECIMAL ( 18, 3 ),-- 批次数量

			batchid INT,-- 批次序号

			batch VARCHAR ( 20 ),

			indate VARCHAR ( 10 ),

			prodate VARCHAR ( 10 ),

			storeid BIGINT,

			total_scalar DECIMAL ( 18, 3 ),-- 总库存

			costprice DECIMAL ( 18, 4 ),

			lastprice DECIMAL ( 18, 4 ),

			saleprice DECIMAL ( 18, 4 ),

			minprice DECIMAL ( 18, 4 ),

			retailprice DECIMAL ( 18, 4 ),

			history_price DECIMAL ( 18, 4 ),

			bidprice DECIMAL ( 18, 4 ),

			hemp_max DECIMAL ( 18, 3 ),

			hemp_scalar DECIMAL ( 18, 3 ),

			ishemp TINYINT DEFAULT 0 

		) ENGINE = INNODB;

	INSERT INTO temp_invoice_wares ( id, batchid, batch, indate, prodate, scalar, storeid, lastprice ) SELECT

	a.id,

	a.batchid,

	a.batch,

	a.indate,

	a.prodate,

	b.scalar,

	c.storeid,

	c.lastprice 

	FROM

		tb_batch_info a,

		tb_stocks_depart b,

		tb_batch c 

	WHERE

		a.batchid = b.batchid 

		AND b.batchid = c.batchid 

		AND b.departno = depart_no 

		AND b.scalar > 0 

		AND EXISTS (

		SELECT

			id 

		FROM

			tb_wares 

		WHERE

			id = a.id 

			AND ( CODE LIKE abc OR tradename LIKE abc OR spell LIKE abc ) 

			AND isroval = 3 

			AND states = 1 

		);

	START TRANSACTION;-- 最近历史售价

	UPDATE temp_invoice_wares a

	INNER JOIN ( SELECT id, batchid, openprice FROM tb_invoice_lastprice WHERE busiid = busi_id ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	SET a.history_price = b.openprice;

	UPDATE temp_invoice_wares a

	INNER JOIN tb_stocks b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = b.scalar,

	a.costprice = b.costprice;

	-- 需要减去总库存

	UPDATE temp_invoice_wares a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 减总库存 采购退货、报损申请预留(未审核)

	UPDATE temp_invoice_wares a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_reserve WHERE (order_type = 6 or order_type=14) AND departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 已经开票的批次数量

	UPDATE temp_invoice_wares a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, batchid, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, batchid, storeid ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	AND a.storeid = b.storeid 

	SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 减批次库存 采购退货、报损申请预留(未审核)

	UPDATE temp_invoice_wares a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id,

			batchid,

			storeid 

		FROM

			tb_reserve 

		WHERE

			(order_type = 6 or order_type=14) 

			AND departno = depart_no 

		GROUP BY

			id,

			batchid,

			storeid 

		) b ON a.id = b.id 

		AND a.batchid = b.batchid 

		AND a.storeid = b.storeid 

		SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 含麻处理

	UPDATE temp_invoice_wares a

	INNER JOIN ( SELECT id FROM tb_wares WHERE category LIKE '含特殊药品%' ) b ON a.id = b.id 

	SET a.ishemp = 1;

	UPDATE temp_invoice_wares 

	SET hemp_max =(

		SELECT

			limit_scalar 

		FROM

			tb_enterprise_type 

		WHERE

			typeid =(

			SELECT

				typeid 

			FROM

				tb_enterprise 

			WHERE

				busiid = busi_id 

			)) 

	WHERE

		ishemp = 1;

	UPDATE temp_invoice_wares a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id 

		FROM

			tb_invoice_detailed a 

		WHERE

			EXISTS (

			SELECT

				orderid 

			FROM

				tb_invoice_head 

			WHERE

				orderid = a.orderid 

				AND busiid = busi_id 

				AND MONTH ( receivdate )= MONTH (

				CURDATE())) 

		GROUP BY

			id 

		) b ON a.id = b.id 

		SET a.hemp_scalar = b.scalar;

	UPDATE temp_invoice_wares a

	INNER JOIN ( SELECT id, sum( scalar ) AS scalar FROM tb_invoice WHERE busiid = busi_id GROUP BY id ) b ON a.id = b.id 

	SET a.hemp_scalar = COALESCE ( a.hemp_scalar, 0 )+ COALESCE ( b.scalar, 0 );

	COMMIT;

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,

		a.piece,

		a.validity,

		b.scalar,

		b.batchid,

		b.batch,

		b.indate,

		b.prodate,

		b.storeid,

		b.total_scalar,

		b.costprice,

		b.lastprice,

		a.bidprice,

		b.history_price,

		a.saleprice,

		a.minprice,

		a.retailprice,

		b.hemp_max,

		b.hemp_scalar,

		b.ishemp,

		( SELECT store_name FROM tb_storehouse WHERE storeid = b.storeid ) AS store_name 

	FROM

		tb_wares a,

		temp_invoice_wares b 

	WHERE

		a.id = b.id 

		AND b.scalar > 0 

	ORDER BY

		a.id,

		b.indate;

	DROP TABLE temp_invoice_wares;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_type_invoice_wares_chain` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_type_invoice_wares_chain`(

	IN abc VARCHAR ( 50 ),

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_invoice_wares_chain (

			id BIGINT,

			scalar DECIMAL ( 18, 3 ),-- 批次数量

			batchid INT,-- 批次序号

			batch VARCHAR ( 20 ),

			indate VARCHAR ( 10 ),

			prodate VARCHAR ( 10 ),

			storeid BIGINT,

			total_scalar DECIMAL ( 18, 3 ),-- 总库存

			costprice DECIMAL ( 18, 4 ),

			lastprice DECIMAL ( 18, 4 ),

			saleprice DECIMAL ( 18, 4 ),

			minprice DECIMAL ( 18, 4 ),

			retailprice DECIMAL ( 18, 4 ),

			history_price DECIMAL ( 18, 4 ),

			bidprice DECIMAL ( 18, 4 ),

			hemp_max DECIMAL ( 18, 3 ),

			hemp_scalar DECIMAL ( 18, 3 ),

			ishemp TINYINT DEFAULT 0,

			lockprice DECIMAL(18,4) -- 连锁开票统一价格 

		) ENGINE = INNODB;

	INSERT INTO temp_invoice_wares_chain ( id, batchid, batch, indate, prodate, scalar, storeid, lastprice ) SELECT

	a.id,

	a.batchid,

	a.batch,

	a.indate,

	a.prodate,

	b.scalar,

	c.storeid,

	c.lastprice 

	FROM

		tb_batch_info a,

		tb_stocks_depart b,

		tb_batch c 

	WHERE

		a.batchid = b.batchid 

		AND b.batchid = c.batchid 

		AND b.departno = depart_no 

		AND b.scalar > 0 

		AND EXISTS (

		SELECT

			id 

		FROM

			tb_wares 

		WHERE

			id = a.id 

			AND ( CODE LIKE abc OR tradename LIKE abc OR spell LIKE abc ) 

			AND isroval = 3 

			AND states = 1 

		);

	START TRANSACTION;-- 最近历史售价

	UPDATE temp_invoice_wares_chain a

	INNER JOIN ( SELECT id, batchid, openprice FROM tb_invoice_lastprice WHERE busiid = busi_id ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	SET a.history_price = b.openprice;

	UPDATE temp_invoice_wares_chain a

	INNER JOIN tb_stocks b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = b.scalar,

	a.costprice = b.costprice;-- 需要减去总库存

	UPDATE temp_invoice_wares_chain a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 减总库存 采购退货、报损申请预留(未审核)

	UPDATE temp_invoice_wares_chain a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_reserve WHERE (order_type = 6 or order_type=14) AND departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 已经开票的批次数量

	UPDATE temp_invoice_wares_chain a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, batchid, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, batchid, storeid ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	AND a.storeid = b.storeid 

	SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 减批次库存 采购退货、报损申请预留(未审核)

	UPDATE temp_invoice_wares_chain a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id,

			batchid,

			storeid 

		FROM

			tb_reserve 

		WHERE

			(order_type = 6 or order_type=14) 

			AND departno = depart_no 

		GROUP BY

			id,

			batchid,

			storeid 

		) b ON a.id = b.id 

		AND a.batchid = b.batchid 

		AND a.storeid = b.storeid 

		SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 含麻处理

	UPDATE temp_invoice_wares_chain a

	INNER JOIN ( SELECT id FROM tb_wares WHERE category LIKE '含特殊药品%' ) b ON a.id = b.id 

	SET a.ishemp = 1;

	UPDATE temp_invoice_wares_chain 

	SET hemp_max =(

		SELECT

			limit_scalar 

		FROM

			tb_enterprise_type 

		WHERE

			typeid =(

			SELECT

				typeid 

			FROM

				tb_enterprise 

			WHERE

				busiid = busi_id 

			)) 

	WHERE

		ishemp = 1;

	UPDATE temp_invoice_wares_chain a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id 

		FROM

			tb_invoice_detailed a 

		WHERE

			EXISTS (

			SELECT

				orderid 

			FROM

				tb_invoice_head 

			WHERE

				orderid = a.orderid 

				AND busiid = busi_id 

				AND MONTH ( receivdate )= MONTH (

				CURDATE())) 

		GROUP BY

			id 

		) b ON a.id = b.id 

		SET a.hemp_scalar = b.scalar;

	UPDATE temp_invoice_wares_chain a

	INNER JOIN ( SELECT id, sum( scalar ) AS scalar FROM tb_invoice WHERE busiid = busi_id GROUP BY id ) b ON a.id = b.id 

	SET a.hemp_scalar = COALESCE ( a.hemp_scalar, 0 )+ COALESCE ( b.scalar, 0 );

	COMMIT;

	SELECT

		a.id,

		a.CODE,

		a.tradename,

		a.specs,

		a.enterprise,

		a.unit,

		a.holder,

		a.drugnumber,

		a.piece,

		a.validity,

		b.scalar,

		b.batchid,

		b.batch,

		b.indate,

		b.prodate,

		b.storeid,

		b.total_scalar,

		b.costprice,

		b.lastprice,

		a.bidprice,

		b.history_price,

		a.saleprice,

		a.lockprice as minprice,

		a.lockprice,

		a.retailprice,

		b.hemp_max,

		b.hemp_scalar,

		b.ishemp,

		( SELECT store_name FROM tb_storehouse WHERE storeid = b.storeid ) AS store_name 

	FROM

		tb_wares a,

		temp_invoice_wares_chain b 

	WHERE

		a.id = b.id 

		AND b.scalar > 0 

	ORDER BY

		a.id,

		b.indate;

	DROP TABLE temp_invoice_wares_chain;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_type_validate_enterprise` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_type_validate_enterprise`(

	IN abc VARCHAR ( 50 ))
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_enterprise (

			busiid BIGINT,

			ecode VARCHAR ( 10 ),

			ename VARCHAR ( 50 ),

			legalbyname VARCHAR ( 20 ),

			salephone VARCHAR ( 30 ),

			isfor TINYINT,

			issale TINYINT,

			ispro TINYINT,

			docname VARCHAR ( 50 ),

		indate VARCHAR ( 10 )) ENGINE INNODB;

	INSERT INTO temp_enterprise ( busiid, indate ) SELECT

	busiid,

	min( enddate ) AS indate 

	FROM

		tb_enterprise_doc a 

	WHERE

		EXISTS (

		SELECT

			busiid 

		FROM

			tb_enterprise 

		WHERE

			busiid = a.busiid 

			AND ( ecode LIKE abc OR ename LIKE abc OR spell LIKE abc ) 

			AND isroval = 3 and isfor=1 and states=0

		) 

		AND enddate > "1" 

	GROUP BY

		busiid;

	UPDATE temp_enterprise a

	INNER JOIN tb_enterprise b ON a.busiid = b.busiid 

	SET a.ecode = b.ecode,

	a.ename = b.ename,

	a.legalbyname = b.legalbyname,

	a.salephone = b.salephone,

	a.isfor = b.isfor,

	a.issale = b.issale,

	a.ispro = b.ispro;

	UPDATE temp_enterprise a,

	tb_enterprise_doc b 

	SET a.docname = b.docname 

	WHERE

		a.busiid = b.busiid 

		AND a.indate = b.enddate;

	SELECT

		busiid,

		ecode,

		ename,

		legalbyname,

		salephone,

		isfor,

		issale,

		ispro,

		docname,

		indate 

	FROM

		temp_enterprise 

	ORDER BY

		busiid,

		indate;

	DROP TABLE temp_enterprise;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_type_validate_enterprise_chain` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_type_validate_enterprise_chain`(in abc varchar(50))
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_enterprise (

			busiid BIGINT,

			ecode VARCHAR ( 10 ),

			ename VARCHAR ( 50 ),

			legalbyname VARCHAR ( 20 ),

			salephone VARCHAR ( 30 ),

			isfor TINYINT,

			issale TINYINT,

			ispro TINYINT,

			docname VARCHAR ( 50 ),

			shipaddress varchar(100),

		indate VARCHAR ( 10 )) ENGINE INNODB;

	INSERT INTO temp_enterprise ( busiid, indate ) SELECT

	busiid,

	min( enddate ) AS indate 

	FROM

		tb_enterprise_doc a 

	WHERE

		EXISTS (

		SELECT

			busiid 

		FROM

			tb_enterprise 

		WHERE

			busiid = a.busiid 

			AND ( ecode LIKE abc OR ename LIKE abc OR spell LIKE abc ) 

			AND isroval=3 and islock=1 and states=0

		) 

		AND enddate > "1" 

	GROUP BY

		busiid;

	UPDATE temp_enterprise a

	INNER JOIN tb_enterprise b ON a.busiid = b.busiid 

	SET a.ecode = b.ecode,

	a.ename = b.ename,

	a.legalbyname = b.legalbyname,

	a.salephone = b.salephone,

	a.isfor = b.isfor,

	a.issale = b.issale,

	a.ispro = b.ispro,

	a.shipaddress=b.shipaddress;

	UPDATE temp_enterprise a,

	tb_enterprise_doc b 

	SET a.docname = b.docname 

	WHERE

		a.busiid = b.busiid 

		AND a.indate = b.enddate;

	SELECT

		busiid,

		ecode,

		ename,

		legalbyname,

		salephone,

		isfor,

		issale,

		ispro,

		docname,

		indate,

		shipaddress

	FROM

		temp_enterprise 

	ORDER BY

		busiid,

		indate;

	DROP TABLE temp_enterprise;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_type_validate_enterprise_sale` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_type_validate_enterprise_sale`(in abc varchar(50))
BEGIN

	CREATE TEMPORARY TABLE

	IF

		NOT EXISTS temp_enterprise (

			busiid BIGINT,

			ecode VARCHAR ( 10 ),

			ename VARCHAR ( 50 ),

			legalbyname VARCHAR ( 20 ),

			salephone VARCHAR ( 30 ),

			isfor TINYINT,

			issale TINYINT,

			ispro TINYINT,

			docname VARCHAR ( 50 ),

			shipaddress varchar(100),

		indate VARCHAR ( 10 )) ENGINE INNODB;

	INSERT INTO temp_enterprise ( busiid, indate ) SELECT

	busiid,

	min( enddate ) AS indate 

	FROM

		tb_enterprise_doc a 

	WHERE

		EXISTS (

		SELECT

			busiid 

		FROM

			tb_enterprise 

		WHERE

			busiid = a.busiid 

			AND ( ecode LIKE abc OR ename LIKE abc OR spell LIKE abc ) 

			AND isroval = 3 and issale=1 and states=0

		) 

		AND enddate > "1" 

	GROUP BY

		busiid;

	UPDATE temp_enterprise a

	INNER JOIN tb_enterprise b ON a.busiid = b.busiid 

	SET a.ecode = b.ecode,

	a.ename = b.ename,

	a.legalbyname = b.legalbyname,

	a.salephone = b.salephone,

	a.isfor = b.isfor,

	a.issale = b.issale,

	a.ispro = b.ispro,

	a.shipaddress=b.shipaddress;

	UPDATE temp_enterprise a,

	tb_enterprise_doc b 

	SET a.docname = b.docname 

	WHERE

		a.busiid = b.busiid 

		AND a.indate = b.enddate;

	SELECT

		busiid,

		ecode,

		ename,

		legalbyname,

		salephone,

		isfor,

		issale,

		ispro,

		docname,

		indate,

		shipaddress

	FROM

		temp_enterprise 

	ORDER BY

		busiid,

		indate;

	DROP TABLE temp_enterprise;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_ysb_ddhz_enterprise` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_ysb_ddhz_enterprise`()
BEGIN

	SELECT DISTINCT

		drugstorename,

		recvphone,

		address,

		beizhu,

		recvname,

		provincename,

		cityname,

		districtname,

		DRUGSTOREBRANCHID 

	FROM

		ysb_ddhz a 

	WHERE

		rq <= CURRENT_DATE

		AND NOT EXISTS ( SELECT ename FROM tb_enterprise WHERE ename = a.drugstorename );



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_ysb_enterprise` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_ysb_enterprise`()
BEGIN

	SELECT DISTINCT

		pick_name,

		pick_phone,

		pick_address,

		remark,

		merchant_name,

		province_name,

		city_name,

		area_name 

	FROM

		xyy_seller_order_info a 

	WHERE

		order_state = 1 

		AND NOT EXISTS ( SELECT ename FROM tb_enterprise WHERE ename = a.MERCHANT_NAME );



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_ysb_erp_order` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_ysb_erp_order`( IN ysb_orderid VARCHAR ( 32 ), IN userid BIGINT, OUT erp_order INT, OUT erp_busiid BIGINT )
BEGIN

	DECLARE

		flag INT DEFAULT 0;

	DECLARE

		order_id INT;

	DECLARE

		busi_id BIGINT;

	DECLARE

		relateid INT;

	DECLARE

		tmp_recno INT DEFAULT 1;

	DECLARE

		tmp_batchid INT;

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_id BIGINT;

	DECLARE

		var_id BIGINT;

	DECLARE

		var_scalar DECIMAL ( 18, 3 );

	DECLARE

		var_price DECIMAL ( 18, 4 );

	DECLARE

		mx CURSOR FOR SELECT

		ERP_CODE AS var_id,

		PURCHASE_NUM AS var_scalar,

		pay_amount / PURCHASE_NUM AS var_price 

	FROM

		xyy_seller_order_detail a 

	WHERE

		order_no = ysb_orderid 

	ORDER BY

		ERP_CODE;

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET flag = 1;

	SELECT

		order_number + 1 INTO ORDER_ID 

	FROM

		tb_order_number 

	WHERE

		order_type = 4;

	UPDATE tb_order_number 

	SET order_number = order_number + 1 

	WHERE

		order_type = 4;

	

	SET erp_order = order_id;

	SELECT

		busiid INTO busi_id 

	FROM

		tb_enterprise 

	WHERE

		ename =(

		SELECT

			MERCHANT_NAME 

		FROM

			xyy_seller_order_info 

		WHERE

			ORDER_NO = ysb_orderid 

		) limit 1;

	

	-- SET erp_busiid = busi_id;

	OPEN mx;

	FETCH mx INTO var_id,

	var_scalar,

	var_price;

	WHILE

			flag <> 1 DO

			CALL sp_ysb_invoice_wares ( var_id, busi_id, '999' );

		INSERT INTO tb_invoice (

			orderid,

			storeid,

			departno,

			user_id,

			busiid,

			id,

			recno,

			scalar,

			openprice,

			batchid,

			batch,

			prodate,

			indate,

			costprice,

			saleprice,

			minprice,

			states,

			ishemp,

			related_id,

			ysb_order_no 

		) SELECT

		order_id,

		storeid,

		'999',

		userid,

		busi_id,

		id,

		tmp_recno,

		var_scalar,

		var_price,

		batchid,

		batch,

		prodate,

		indate,

		costprice,

		saleprice,

		minprice,

		0,

		ishemp,

		0,

		ysb_orderid 

		FROM

			tb_invoice_ysb a 

		WHERE

			id = (select id from tb_wares where code=var_id) 

			AND scalar >= var_scalar 

			AND total_scalar > 0

			order by indate 

			LIMIT 1;

		

		SET tmp_recno = tmp_recno + 1;

		FETCH mx INTO var_id,

		var_scalar,

		var_price;

		

	END WHILE;

	CLOSE mx;

	UPDATE tb_invoice a

	INNER JOIN tb_stocks b ON a.orderid = order_id 

	AND a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.amount = a.scalar * a.openprice,

	a.profit = a.scalar *(

		a.openprice - b.costprice 

	);

	UPDATE tb_invoice a

	INNER JOIN tb_wares b ON a.orderid = order_id 

	AND a.id = b.id 

	SET a.piece = b.piece,

	a.packages = a.scalar / COALESCE ( b.piece, 999 );

	INSERT INTO tb_invoice_head (

		orderid,

		busiid,

		user_id,

		departno,

		cost,

		amount,

		profit,

		order_type,

		states,

		payway,

		fetch_way,

		related_id,

		createdate,

		receivdate,

		ysb_order_no 

	) SELECT DISTINCT

	orderid,

	busiid,

	user_id,

	'999',(

		SELECT

			sum( scalar * costprice ) AS cost 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

			),(

		SELECT

			sum( amount ) AS amount 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

			),(

		SELECT

			sum( profit ) AS profit 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

		),

		4,

		0,

		'现金',

		'托运',

		related_id,

		CURRENT_TIMESTAMP,

		CURRENT_TIMESTAMP,

		ysb_order_no 

	FROM

		tb_invoice 

	WHERE

		orderid = order_id;

	INSERT INTO tb_invoice_detailed (

		orderid,

		recno,

		id,

		scalar,

		openprice,

		amount,

		costprice,

		profit,

		packages,

		piece,

		departno,

		batchid,

		batch,

		indate,

		prodate,

		storeid,

		related_id,

		ysb_order_no 

	) SELECT

	orderid,

	recno,

	id,

	scalar,

	openprice,

	amount,

	costprice,

	profit,

	packages,

	piece,

	departno,

	batchid,

	batch,

	indate,

	prodate,

	storeid,

	related_id,

	ysb_order_no 

	FROM

		tb_invoice 

	WHERE

		orderid = order_id;

SET erp_busiid = busi_id;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_ysb_erp_order_ddhz` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_ysb_erp_order_ddhz`( IN ysb_orderid VARCHAR ( 32 ), IN userid BIGINT, OUT erp_order INT, OUT erp_busiid BIGINT )
BEGIN

	DECLARE

		flag INT DEFAULT 0;

	DECLARE

		order_id INT;

	DECLARE

		busi_id BIGINT;

	DECLARE

		relateid INT;

	DECLARE

		tmp_recno INT DEFAULT 1;

	DECLARE

		tmp_batchid INT;

	DECLARE

		tmp_scalar DECIMAL ( 18, 3 );

	DECLARE

		tmp_id BIGINT;

	DECLARE

		var_id BIGINT;

	DECLARE

		var_scalar DECIMAL ( 18, 3 );

	DECLARE

		var_price DECIMAL ( 18, 4 );

	DECLARE

		mx CURSOR FOR SELECT

		drugCODE AS var_id,

		shl AS var_scalar,

		dj AS var_price 

	FROM

		ysb_ddmx a 

	WHERE

		djbh = ysb_orderid 

	ORDER BY

		drugCODE;

	DECLARE

		CONTINUE HANDLER FOR NOT found 

		SET flag = 1;

	SELECT

		order_number + 1 INTO ORDER_ID 

	FROM

		tb_order_number 

	WHERE

		order_type = 4;

	UPDATE tb_order_number 

	SET order_number = order_number + 1 

	WHERE

		order_type = 4;

	

	SET erp_order = order_id;

	SELECT

		busiid INTO busi_id 

	FROM

		tb_enterprise 

	WHERE

		ename =(

		SELECT

			drugstorename 

		FROM

			ysb_ddhz 

		WHERE

			djbh = ysb_orderid 

		) limit 1;

	

	-- SET erp_busiid = busi_id;

	OPEN mx;

	FETCH mx INTO var_id,

	var_scalar,

	var_price;

	WHILE

			flag <> 1 DO

			CALL sp_ysb_invoice_wares ( var_id, busi_id, '999' );

		INSERT INTO tb_invoice (

			orderid,

			storeid,

			departno,

			user_id,

			busiid,

			id,

			recno,

			scalar,

			openprice,

			batchid,

			batch,

			prodate,

			indate,

			costprice,

			saleprice,

			minprice,

			states,

			ishemp,

			related_id,

			ysb_order_no 

		) SELECT

		order_id,

		storeid,

		'999',

		userid,

		busi_id,

		id,

		tmp_recno,

		var_scalar,

		var_price,

		batchid,

		batch,

		prodate,

		indate,

		costprice,

		saleprice,

		minprice,

		0,

		ishemp,

		0,

		ysb_orderid 

		FROM

			tb_invoice_ysb a 

		WHERE

			id = (select id from tb_wares where code=var_id) 

			AND scalar >= var_scalar 

			AND total_scalar > 0 

			order by indate

			LIMIT 1;

		

		SET tmp_recno = tmp_recno + 1;

		FETCH mx INTO var_id,

		var_scalar,

		var_price;

		

	END WHILE;

	CLOSE mx;

	UPDATE tb_invoice a

	INNER JOIN tb_stocks b ON a.orderid = order_id 

	AND a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.amount = a.scalar * a.openprice,

	a.profit = a.scalar *(

		a.openprice - b.costprice 

	);

	UPDATE tb_invoice a

	INNER JOIN tb_wares b ON a.orderid = order_id 

	AND a.id = b.id 

	SET a.piece = b.piece,

	a.packages = a.scalar / COALESCE ( b.piece, 999 );

	INSERT INTO tb_invoice_head (

		orderid,

		busiid,

		user_id,

		departno,

		cost,

		amount,

		profit,

		order_type,

		states,

		payway,

		fetch_way,

		related_id,

		createdate,

		receivdate,

		ysb_order_no 

	) SELECT DISTINCT

	orderid,

	busiid,

	user_id,

	'999',(

		SELECT

			sum( scalar * costprice ) AS cost 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

			),(

		SELECT

			sum( amount ) AS amount 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

			),(

		SELECT

			sum( profit ) AS profit 

		FROM

			tb_invoice 

		WHERE

			orderid = order_id 

		),

		4,

		0,

		'现金',

		'托运',

		related_id,

		CURRENT_DATE,

		CURRENT_DATE,

		ysb_order_no 

	FROM

		tb_invoice 

	WHERE

		orderid = order_id;

	INSERT INTO tb_invoice_detailed (

		orderid,

		recno,

		id,

		scalar,

		openprice,

		amount,

		costprice,

		profit,

		packages,

		piece,

		departno,

		batchid,

		batch,

		indate,

		prodate,

		storeid,

		related_id,

		ysb_order_no 

	) SELECT

	orderid,

	recno,

	id,

	scalar,

	openprice,

	amount,

	costprice,

	profit,

	packages,

	piece,

	departno,

	batchid,

	batch,

	indate,

	prodate,

	storeid,

	related_id,

	ysb_order_no 

	FROM

		tb_invoice 

	WHERE

		orderid = order_id;

SET erp_busiid = busi_id;

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_ysb_invoice_wares` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_ysb_invoice_wares`(

	IN wareid varchar(32),

	IN busi_id BIGINT,

	IN depart_no VARCHAR ( 10 ))
BEGIN

	

	DELETE from tb_invoice_ysb;

	INSERT INTO tb_invoice_ysb ( id, batchid, batch, indate, prodate, scalar, storeid, lastprice ) SELECT

	a.id,

	a.batchid,

	a.batch,

	a.indate,

	a.prodate,

	b.scalar,

	c.storeid,

	c.lastprice 

	FROM

		tb_batch_info a,

		tb_stocks_depart b,

		tb_batch c 

	WHERE

		a.batchid = b.batchid 

		AND b.batchid = c.batchid 

		AND b.departno = depart_no 

		AND b.scalar > 0 

		AND EXISTS (

		SELECT

			id 

		FROM

			tb_wares 

		WHERE

			id = a.id 

			AND code=wareid

			AND isroval = 3 

			AND states = 1 

		);

	START TRANSACTION;-- 最近历史售价

	UPDATE tb_invoice_ysb a

	INNER JOIN ( SELECT id, batchid, openprice FROM tb_invoice_lastprice WHERE busiid = busi_id ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	SET a.history_price = b.openprice;

	UPDATE tb_invoice_ysb a

	INNER JOIN tb_stocks b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = b.scalar,

	a.costprice = b.costprice,

	a.bidprice = b.bidprice,

	a.minprice = b.minprice,

	a.retailprice = b.retailprice,

	a.saleprice = b.saleprice;-- 需要减去总库存

	UPDATE tb_invoice_ysb a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 减总库存 采购退货、报损申请预留(未审核)

	UPDATE tb_invoice_ysb a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, storeid FROM tb_reserve WHERE (order_type = 6 or order_type=14) AND departno = depart_no GROUP BY id, storeid ) b ON a.id = b.id 

	AND a.storeid = b.storeid 

	SET a.total_scalar = a.total_scalar - b.scalar;-- 已经开票的批次数量

	UPDATE tb_invoice_ysb a

	INNER JOIN ( SELECT sum( scalar ) AS scalar, id, batchid, storeid FROM tb_invoice WHERE departno = depart_no GROUP BY id, batchid, storeid ) b ON a.id = b.id 

	AND a.batchid = b.batchid 

	AND a.storeid = b.storeid 

	SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 减批次库存 采购退货、报损申请预留(未审核)

	UPDATE tb_invoice_ysb a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id,

			batchid,

			storeid 

		FROM

			tb_reserve 

		WHERE

			(order_type = 6 or order_type=14) 

			AND departno = depart_no 

		GROUP BY

			id,

			batchid,

			storeid 

		) b ON a.id = b.id 

		AND a.batchid = b.batchid 

		AND a.storeid = b.storeid 

		SET a.scalar = a.scalar - COALESCE ( b.scalar, 0 );-- 含麻处理

	UPDATE tb_invoice_ysb a

	INNER JOIN ( SELECT id FROM tb_wares WHERE category LIKE '含特殊药品%' ) b ON a.id = b.id 

	SET a.ishemp = 1;

	UPDATE tb_invoice_ysb 

	SET hemp_max =(

		SELECT

			limit_scalar 

		FROM

			tb_enterprise_type 

		WHERE

			typeid =(

			SELECT

				typeid 

			FROM

				tb_enterprise 

			WHERE

				busiid = busi_id 

			)) 

	WHERE

		ishemp = 1;

	UPDATE tb_invoice_ysb a

	INNER JOIN (

		SELECT

			sum( scalar ) AS scalar,

			id 

		FROM

			tb_invoice_detailed a 

		WHERE

			EXISTS (

			SELECT

				orderid 

			FROM

				tb_invoice_head 

			WHERE

				orderid = a.orderid 

				AND busiid = busi_id 

				AND MONTH ( receivdate )= MONTH (

				CURDATE())) 

		GROUP BY

			id 

		) b ON a.id = b.id 

		SET a.hemp_scalar = b.scalar;

	UPDATE tb_invoice_ysb a

	INNER JOIN ( SELECT id, sum( scalar ) AS scalar FROM tb_invoice WHERE busiid = busi_id GROUP BY id ) b ON a.id = b.id 

	SET a.hemp_scalar = COALESCE ( a.hemp_scalar, 0 )+ COALESCE ( b.scalar, 0 );

	COMMIT;

	

	



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_ysb_order` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_ysb_order`()
BEGIN

	SELECT

		order_id,

		ORDER_NO,

		order_create_time,

		pay_type,

		pay_channel,

		total_amount,

		DISCOUNT_AMOUNT,

		PLATFORM_AMOUNT,

		SHOP_AMOUNT,

		FREIGHT,

		PAY_AMOUNT,

		pick_name,

		pick_phone,

		pick_address,

		remark,

		merchant_name,

		province_name,

		city_name,

		area_name 

	FROM

		xyy_seller_order_info a 

	WHERE

		order_state = 1;



END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_ysb_order_ddhz` */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection  = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_ysb_order_ddhz`(in startdate date,in enddate date)
BEGIN

	SELECT

		djbh,

		rq,

		ontime,

		drugstorename,

		je,

		xgdjbh,

		beizhu,		

		recvname,

		recvphone,

		address,			

		provincename,

		cityname,

		districtname 

	FROM

		ysb_ddhz  

	WHERE

		RQ>=startdate and RQ<=enddate and `STATUS`='已提交';

END ;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2025-11-11 14:35:38
