Commit 8f59f1ef by 岳巧源

add sql

parent 8f4e87ca
Showing with 49 additions and 8 deletions
......@@ -9,14 +9,14 @@ CREATE TABLE `lie_shipping_intermediate_data` (
`kingdee_purchase_order_no` varchar(64) NOT NULL DEFAULT '' COMMENT '金蝶采购单号',
`goods_id` mediumint(8) unsigned NOT NULL COMMENT '商品ID',
`goods_sn` varchar(32) NOT NULL DEFAULT '' COMMENT '商品编码',
`goods_name` varchar(128) NOT NULL DEFAULT '' COMMENT '商品型号',
`goods_name` varchar(128) NOT NULL DEFAULT '' COMMENT '商品型号', ------------------------------------------覆盖
`brand_id` mediumint(6) unsigned NOT NULL DEFAULT '0' COMMENT '品牌ID',
`brand_name` varchar(128) NOT NULL DEFAULT '' COMMENT '品牌',
`company_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '采购组织ID 采购组织ID 1猎芯-含税 2深茂电子-不含税',
`company_name` varchar(128) NOT NULL DEFAULT '' COMMENT '采购组织名称',
`supplier_id` mediumint(6) unsigned NOT NULL DEFAULT '0' COMMENT '供应商ID',
`supplier_name` varchar(128) NOT NULL DEFAULT '' COMMENT '供应商名称',
`warehouse_receipt_sn` varchar(32) NOT NULL DEFAULT '' COMMENT '入仓单号',
`warehouse_receipt_sn` varchar(32) NOT NULL DEFAULT '' COMMENT '入仓单号', -------------------------------覆盖
`in_qty` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '入库数量',
`out_qty` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '发货数量',
`stock_in_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0-待入库 1-部分入库 2-全部入库',
......
import pymysql
def migrate_from_lie_scm_order():
conf = {
'host': "master.db2.liexindev.me",
'port': 3306,
'user': "liexin_purchase",
'password': "liexin_purchase#zsyM",
'db': "liexin_purchase",
'charset': 'utf8'
}
sql1 = "select "
db = pymysql.connect(**conf)
cursor = db.cursor()
cursor.execute(sql1)
result1 = cursor.fetchall()
if __name__ == '__main__':
pass
\ No newline at end of file
......@@ -16,7 +16,7 @@ select purchase_sn, erp_purchase_sn, company_id, company_name from lie_purchase
insert into lie_shipping_intermediate_data
(
source_type, --lie_stock_in_items == 1 / lie_scm_order == 2
source_id, -- ???? 来源id是什么
source_id, -- ???? 来源id是什么 scm的主键id
kingdee_sales_order_no,
purchase_sn,
kingdee_purchase_order_no,
......@@ -31,7 +31,7 @@ insert into lie_shipping_intermediate_data
supplier_name,
warehouse_receipt_sn,
in_qty,
out_qty, --这个字段在 lie_scm_order没找到 ???
out_qty, --这个字段在 lie_scm_order没找到 ??? -- lie_scm_order 的 goods_number字段
stock_in_status,
create_name,
shipping_id,
......@@ -46,27 +46,45 @@ insert into lie_shipping_intermediate_data
values
();
------------------------------------------------------------下面的步骤是从lie_stock_in 还有 lie_stock_in_items 中取数据
select stock_in_id from lie_stock_in where stock_in_type in (1, 2); --从lie_stock_in中获取 stock_in_id; 假定为 stock_in_id_from_stock_in;
select stock_in_id, supplier_id, supplier_name from lie_stock_in where stock_in_type in (1, 2); --从lie_stock_in中获取 stock_in_id; 假定为 stock_in_id_from_stock_in;
select frq_id, purchase_id from lie_stock_in_items where stock_in_id = 'stock_in_id_from_stock_in'; ----获取到 frq_id_from_stock_in_items;
--获取到 purchase_id_from_stock_in_items;
-- kingdee_sales_order_no的获取
select erp_sn from lie_frq where frq_id = 'frq_id_from_stock_in_items';
-----------------------------------------purchase_sn的获取
select purchase_sn, erp_purchase_sn from lie_purchase_order where purchase_id = 'purchase_id_from_stock_in_items';
select purchase_sn, erp_purchase_sn, company_id, company_name from lie_purchase_order where purchase_id = 'purchase_id_from_stock_in_items';
----------------------------------------------------
insert into lie_shipping_intermediate_data
(
source_type, -- 1
source_id, --此字段暂不清楚
source_id, -- stock_in_items主键
kingdee_sales_order_no,
purchase_sn,
kingdee_purchase_order_no,
goods_id,
goods_sn,
goods_name,
brand_id,
brand_name,
company_id,
company_name,
supplier_id, -- 这两个特殊 不从items里面找 去stock_in里面找
supplier_name, -- 这两个特殊 不从items里面找 去stock_in里面找
warehouse_receipt_sn,
in_qty,
out_qty,
stock_in_status, --stock_in 的status字段
create_name, --这个特殊,不从items里面找,去stock_in里面找
shipping_id, --这个特殊,不从items里面找,去stock_in里面找
create_uid, --这个特殊,不从items里面找,去stock_in里面找
shipment_number, --这个特殊,不从items里面找,去stock_in里面找
shipping_name, --这个特殊,不从items里面找,去stock_in里面找
create_time,
update_time,
purchase_uid, --这个特殊,不从items里面找,去stock_in里面找
purchase_name ----这个特殊,不从items里面找,去stock_in里面找
)
values
();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment