Exemplo n.º 1
0
The diction of packing_lis is as below:
{'detail':[{'form':,'to:','carton_qty':,'colour_detail':,'per_carton_pcs':,'per_carton_gw':,'per_carton_nw':,
            'subtotal':,'length':,'width':,'height':,'size_qty':{-xs:, ...}}],
 'summary':{-COBALT BLUE:{'Order Qty':{'total':, 'size_qty':{-xs:,....}},
                          'Actual Qty':{'total':, 'size_qty':{-xs:,....}},
                          'Balance':{'total':, 'size_qty':{-xs:,....}},
                          'Ratio':{'total':, 'size_qty':{-xs:,....}}
                          }
                          ...
            }
 'total_quantity':,'total_carton':,'total_gw':,'total_nw':,'total_volume':,'style_no':,'style_description':,
 'invoice_no':,'date':,'order_no':
}
"""

logger = get_xls_logger()


#if the cell given row&col is in the area of size title
def is_size_title(current_row, current_col, row_size_head, left_col,
                  right_col):
    if current_row == upper_row + 1 and current_col > left_col and current_col < right_col:
        #print("&&&&now it is the size row , current row="+str(current_row))
        return 1
    else:
        return False


def str_contain(string, words, all_any='all'):
    result = [
        str(word).strip().upper() in str(string).strip().upper()
Exemplo n.º 2
0
import os
import glob
from read_excel import read_excel_file
import xls_log
logger = xls_log.init_xls_logger()
import th_packing
import gz_packing
import st_packing
import jf_packing
import lt_packing

logger = xls_log.get_xls_logger()

base_dir = os.path.abspath(os.path.dirname(__file__))


#def validate_packing_list_gz(path='gz'):
def abc(path='th', save_db=False):
    data_path = os.path.join(base_dir, path)
    logger.info('Data_path=%s, len=%s' % (data_path, len(data_path)))
    file_position = len(data_path) + 1  #including the char \
    data_path = os.path.join(data_path, "*.xls*")
    logger.debug('data files path=%s' % data_path)
    files = glob.glob(data_path)
    logger.info('Total %s files' % len(files))

    for file in files:
        logger.info('Start reading file%s' % (file))
        if file.startswith('~', file_position):
            continue
        if path == 'jf':