提交 7dd8e8bb authored 作者: 刘擎阳's avatar 刘擎阳

1.优化bug

上级 6c2b4902
...@@ -29,9 +29,9 @@ class CcPackageGood(models.Model): ...@@ -29,9 +29,9 @@ class CcPackageGood(models.Model):
bl_id = fields.Many2one('cc.bl') bl_id = fields.Many2one('cc.bl')
# 按item_id,唯一 # 按item_id,唯一
_sql_constraints = [ # _sql_constraints = [
('item_id_uniq', 'unique(item_id)', 'The Item ID must be unique.') # ('item_id_uniq', 'unique(item_id)', 'The Item ID must be unique.')
] # ]
item_id = fields.Char(string='Item ID', index=True) item_id = fields.Char(string='Item ID', index=True)
# SKU标识ID # SKU标识ID
......
...@@ -35,9 +35,9 @@ class CcHistoryShipPackage(models.Model): ...@@ -35,9 +35,9 @@ class CcHistoryShipPackage(models.Model):
logistic_order_no = fields.Char(string='Logistic Order No', index=True) logistic_order_no = fields.Char(string='Logistic Order No', index=True)
# 按logistic_order_no,唯一 # 按logistic_order_no,唯一
_sql_constraints = [ # _sql_constraints = [
('logistic_order_no_uniq', 'unique(logistic_order_no)', 'The Logistic Order No must be unique.') # ('logistic_order_no_uniq', 'unique(logistic_order_no)', 'The Logistic Order No must be unique.')
] # ]
# 运单号(面单号) # 运单号(面单号)
tracking_no = fields.Char(string='Tracking No', index=True) # 对应面单号 tracking_no = fields.Char(string='Tracking No', index=True) # 对应面单号
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Package Good"> <search string="Package Good">
<field name="item_name_en" string="Search" <field name="item_name_en" string="Search"
filter_domain="['|', ('item_id', 'ilike', self)'|', ('sku_id', 'ilike', self)'|', ('item_name_en', 'ilike', self), ('item_name_cn', 'ilike', self)]"/> filter_domain="['|', ('item_id', 'ilike', self), '|', ('sku_id', 'ilike', self), '|', ('item_name_en', 'ilike', self), ('item_name_cn', 'ilike', self)]"/>
<separator/> <separator/>
<field name="item_id"/> <field name="item_id"/>
<field name="sku_id" string="SKU ID"/> <field name="sku_id" string="SKU ID"/>
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Package Good"> <search string="Package Good">
<field name="item_name_en" string="Search" <field name="item_name_en" string="Search"
filter_domain="['|', ('item_id', 'ilike', self)'|', ('sku_id', 'ilike', self)'|', ('item_name_en', 'ilike', self), ('item_name_cn', 'ilike', self)]"/> filter_domain="['|', ('item_id', 'ilike', self), '|', ('sku_id', 'ilike', self), '|', ('item_name_en', 'ilike', self), ('item_name_cn', 'ilike', self)]"/>
<separator/> <separator/>
<field name="item_id" string="Item ID"/> <field name="item_id" string="Item ID"/>
<field name="sku_id" string="SKU ID"/> <field name="sku_id" string="SKU ID"/>
......
...@@ -437,22 +437,22 @@ class Order_dispose(object): ...@@ -437,22 +437,22 @@ class Order_dispose(object):
pd.read_sql(update_sql, con=db_handle, chunksize=100) pd.read_sql(update_sql, con=db_handle, chunksize=100)
if origin_delete: if origin_delete:
# print('delete data') # print('delete data')
if origin_big_ids: # 删除原大包
ids = '(%s)' % str(origin_big_ids)[1:-1]
delete_big_sql = 'delete from cc_big_package where id in %s' % ids
pd.read_sql(delete_big_sql, con=db_handle, chunksize=100)
if origin_ship_ids: # 删除原小包
ids = '(%s)' % str(origin_ship_ids)[1:-1]
delete_package_sql = 'delete from cc_ship_package where id in %s' % ids
pd.read_sql(delete_package_sql, con=db_handle, chunksize=100)
if origin_goods_ids: # 删除原小包商品
ids = '(%s)' % str(origin_goods_ids)[1:-1]
delete_goods_sql = 'delete from cc_package_good where id in %s' % ids
pd.read_sql(delete_goods_sql, con=db_handle, chunksize=100)
if origin_log_ids: # 删除原小包同步日志 if origin_log_ids: # 删除原小包同步日志
ids = '(%s)' % str(origin_log_ids)[1:-1] ids = '(%s)' % str(origin_log_ids)[1:-1]
delete_log_sql = 'delete from cc_ship_package_sync_log where id in %s' % ids delete_log_sql = 'delete from cc_ship_package_sync_log where id in %s' % ids
pd.read_sql(delete_log_sql, con=db_handle, chunksize=100) pd.read_sql(delete_log_sql, con=db_handle, chunksize=100)
if origin_goods_ids: # 删除原小包商品
ids = '(%s)' % str(origin_goods_ids)[1:-1]
delete_goods_sql = 'delete from cc_package_good where id in %s' % ids
pd.read_sql(delete_goods_sql, con=db_handle, chunksize=100)
if origin_ship_ids: # 删除原小包
ids = '(%s)' % str(origin_ship_ids)[1:-1]
delete_package_sql = 'delete from cc_ship_package where id in %s' % ids
pd.read_sql(delete_package_sql, con=db_handle, chunksize=100)
if origin_big_ids: # 删除原大包
ids = '(%s)' % str(origin_big_ids)[1:-1]
delete_big_sql = 'delete from cc_big_package where id in %s' % ids
pd.read_sql(delete_big_sql, con=db_handle, chunksize=100)
logging.info(f'同步提单:{select_bl_no},删除大包{len(origin_big_ids)}个,删除小包{len(origin_ship_ids)}个,删除小包商品{len(origin_goods_ids)}个,删除小包同步日志{len(origin_log_ids)}条') logging.info(f'同步提单:{select_bl_no},删除大包{len(origin_big_ids)}个,删除小包{len(origin_ship_ids)}个,删除小包商品{len(origin_goods_ids)}个,删除小包同步日志{len(origin_log_ids)}条')
# tk日志 # tk日志
origin_tk_log_ids = self.history_ao_tt_log(db_handle, past_date, limit_log_num) origin_tk_log_ids = self.history_ao_tt_log(db_handle, past_date, limit_log_num)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论