Exemple #1
0
    'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6'
}
'''设置登陆session'''
login = login_api.login_requests()
login2 = login_api.login_urllib()

excel = xlrd.open_workbook('./data_config.xls')
sh = excel.sheet_by_name("qcOrder生成质检")
rows = sh.nrows

db_purchasesystem = "purchasesystem"
db_warehousesystem = "warehousesystem"
'''查询可以生成到货单的采购单ID,数据配置需要生成几个,查询语句就写Top几'''
# n=str(rows-1)
sql_caigouid = "Select Top 4 [Id],[OrderNumber] From [dbo].[PurchaseOrder] Where [Type]=0 And [IsSync]=0 And [Status]=0 And [Freight] IS NOT NULL Order By [Created]"
caigouid = database_api.sql_multconn(db_purchasesystem, sql_caigouid)
# print caigouid

caigoulist = []
for j in caigouid:
    cgd = str(j[1])
    caigoulist.append(cgd)
print "采购单号:%s" % (caigoulist)
print '\n'

pg = 1
area = 1
baoguo = []
cgids = []
'''添加包裹并生成到货单'''
for i in caigouid:
Exemple #2
0
    url_ScanSerialNumber = "" + login_api.pda_url + "ajax/Distribute/ScanSerialNumber"
    postdata_ScanSerialNumber = urllib.urlencode(
        {"SerialNumber": text_content[1]})
    req_ScanSerialNumber = urllib2.Request(url_ScanSerialNumber,
                                           postdata_ScanSerialNumber, header)
    print "扫描批次卡返回信息:" + pda.open(req_ScanSerialNumber).read()

    db_warehouse = "warehousesystem"
    '''获取拣货单id'''
    sql_pickingid = "select [Id] from [dbo].[PickingList] where [Code]='" + text_content[
        0] + "'"
    pickingListId = database_api.sql_conn(db_warehouse, sql_pickingid)
    '''获取拣货单对应的SKUID'''
    sql_skuids = "select [SkuId] from [dbo].[DistributeSkuList] where [PickingListId]='" + pickingListId + "'"
    skuids = database_api.sql_multconn(db_warehouse, sql_skuids)
    # skulist=[]
    for j in skuids:
        skuid = str(j[0])
        '''获取SKUID对应的SKUCODE'''
        sql_skucode = "select [Code] from [dbo].[Sku] where [Id]='" + skuid + "'"
        skucode = database_api.sql_conn(db_warehouse, sql_skucode)
        print skuid
        url_scansku = "" + login_api.pda_url + "ajax/Distribute/ScanSkuCode"
        postdata_scansku = urllib.urlencode({
            "SkuCode": skucode,
            "PickingListId": pickingListId,
            "ShippingOrderID": ""
        })
        req_scansku = urllib2.Request(url_scansku, postdata_scansku, header)
        scan_info = pda.open(req_scansku).read()
Exemple #3
0
    'Accept-Language': 'zh-CN,zh;q=0.8,en;q=0.6'
}
'''设置登陆'''
edit = login_api.login_urllib()
'''读取excel表格'''
excel = xlrd.open_workbook('./data_config.xls')
sh = excel.sheet_by_name("editproduct产品编辑")
rows = sh.nrows

for i in range(1, rows):
    text_content = sh.row_values(i)
    '''根据产品编码查询任务id'''
    db_edit = "editingsystem"
    sql_Id = "select [Id] from [dbo].[EditingTask] where [EntityCode]='" + text_content[
        0] + "'"
    editTaskid = database_api.sql_multconn(db_edit, sql_Id)

    for taskid in editTaskid:
        taskid_str = str(taskid[0])

        sql_textid = "select [Id] from [dbo].[EditingTask_Text] where [Id]='" + taskid_str + "'"
        edittext_id = database.sql_multconn(db_edit, sql_textid)

        db_package = "systemmanagementsystem"
        sql_packageId = "select [Id] from [dbo].[Package] where [Name]='" + text_content[
            5] + "'"
        packageId = database_api.sql_conn(db_package, sql_packageId)
        sql_pgWeight = "select [Weight] from [dbo].[Package] where [Id]='" + packageId + "'"
        pgWeight = database_api.sql_conn(db_package, sql_pgWeight)
        '''判断是否为文字编辑ID'''
        if edittext_id:
Exemple #4
0
reload(sys)
sys.setdefaultencoding("utf-8")
'''设置登陆'''
edit_req = login_api.login_requests()
'''读取excel表格'''
excel = xlrd.open_workbook('./data_config.xls')
sh = excel.sheet_by_name("editproduct产品编辑")
rows = sh.nrows

for i in range(1, rows):
    text_content = sh.row_values(i)
    '''根据产品编码查询任务id'''
    db_edit = "editingsystem"
    sql_Id = "select [Id] from [dbo].[EditingTask] where [EntityCode]='" + text_content[
        0] + "'"
    editTaskid = database_api.sql_multconn(db_edit, sql_Id)

    for taskid in editTaskid:
        taskid_str = str(taskid[0])

        sql_imageid = "select [Id] from [dbo].[EditingTask_Image] where [Id]='" + taskid_str + "'"
        editimage_id = database_api.sql_multconn(db_edit, sql_imageid)

        db_package = "systemmanagementsystem"
        sql_packageId = "select [Id] from [dbo].[Package] where [Name]='" + text_content[
            5] + "'"
        packageId = database_api.sql_conn(db_package, sql_packageId)
        sql_pgWeight = "select [Weight] from [dbo].[Package] where [Id]='" + packageId + "'"
        pgWeight = database_api.sql_conn(db_package, sql_pgWeight)

        if editimage_id:
Exemple #5
0
sh = excel.sheet_by_name("printPickinglist生成批次")
rows = sh.nrows

for i in range(1, rows):
    text_content = sh.row_values(i)

    db_shippingsystem = "shippingsystem"
    db_warehouse = "warehousesystem"
    db_user = "******"
    '''判断订单类型'''
    if text_content[0] == "单发":
        printType = "0"
        '''运输类型ID'''
        if text_content[1] == "全部":
            sql_shippingIDs = "select [Id] from [dbo].[ShippingMethod] where [WarehouseId]='01602662-74ce-4ab8-aabb-3f6c5e5c9f34' and [Enabled]=1 and ([ShippingType]=1 or [ShippingType]=0)"
            shippingIDs = database_api.sql_multconn(db_shippingsystem,
                                                    sql_shippingIDs)

        else:
            shippingIDs = []
            shippingType_list = text_content[1].split(',')
            for shippingType in shippingType_list:
                sql_shippingID = "select [Id] from  [dbo].[ShippingMethod] where [WarehouseId]='01602662-74ce-4ab8-aabb-3f6c5e5c9f34' and [Enabled]=1 and ([ShippingType]=1 or [ShippingType]=0) and [Name]='" + shippingType + "'"
                shippingID = database_api.sql_conn(db_shippingsystem,
                                                   sql_shippingID)
                shippingIDs.append(shippingID)
            #print shippingIDs
        '''拣单数量'''
        orderAmount = int(text_content[2])
        '''拣货区ID'''
        locations_list = text_content[3].split(',')
        locationIDs = []
Exemple #6
0
}
'''设置登陆'''
edit = login_api.login_urllib()
edit_req = login_api.login_requests()
'''读取excel表格'''
excel = xlrd.open_workbook('./data_config.xls')
sh = excel.sheet_by_name("editproduct产品编辑")
rows = sh.nrows

for i in range(1, rows):
    text_content = sh.row_values(i)
    '''根据产品编码查询任务id'''
    db_edit = "editingsystem"
    sql_Id = "select [Id] from [dbo].[EditingTask] where [EntityCode]='" + text_content[
        0] + "'"
    editTaskid = database_api.sql_multconn(db_edit, sql_Id)

    for taskid in editTaskid:
        taskid_str = str(taskid[0])
        sql_textid = "select [Id] from [dbo].[EditingTask_Text] where [Id]='" + taskid_str + "'"
        edittext_id = database_api.sql_multconn(db_edit, sql_textid)

        sql_physicalid = "select [Id] from [dbo].[EditingTask_Physical] where [Id]='" + taskid_str + "'"
        editphysical_id = database_api.sql_multconn(db_edit, sql_physicalid)

        sql_imageid = "select [Id] from [dbo].[EditingTask_Image] where [Id]='" + taskid_str + "'"
        editimage_id = database_api.sql_multconn(db_edit, sql_imageid)

        db_package = "systemmanagementsystem"
        sql_packageId = "select [Id] from [dbo].[Package] where [Name]='" + text_content[
            5] + "'"
'''设置登陆'''
edit=login_api.login_urllib()
edit_req=login_api.login_requests()

'''读取excel表格'''
excel=xlrd.open_workbook('./data_config.xls')
sh=excel.sheet_by_name("editproduct产品编辑")
rows=sh.nrows

for i in range(1,rows):
	text_content=sh.row_values(i)
	'''根据产品编码查询任务id'''
	db_edit="editingsystem"
	sql_Id="select [Id] from [dbo].[EditingTask] where [EntityCode]='"+text_content[0]+"'"
	editTaskid=database_api.sql_multconn(db_edit,sql_Id)
	for taskid in editTaskid:
		taskid_str=str(taskid[0])
		
		sql_physicalid="select [Id] from [dbo].[EditingTask_Physical] where [Id]='"+taskid_str+"'"
		editphysical_id=database_api.sql_multconn(db_edit,sql_physicalid)

		db_package="systemmanagementsystem"
		sql_packageId="select [Id] from [dbo].[Package] where [Name]='"+text_content[5]+"'"
		packageId=database_api.sql_conn(db_package,sql_packageId)
		sql_pgWeight="select [Weight] from [dbo].[Package] where [Id]='"+packageId+"'"
		pgWeight=database_api.sql_conn(db_package,sql_pgWeight)

		if editphysical_id:
			editphysical_url=""+login_api.erp_url+"Products/UpdatePhysicalTask"
			postdata_editphysical={"taskId":""+taskid_str+"","taskStatus":2,"netWeight":""+text_content[7]+"","length":""+text_content[8]+"","width":""+text_content[9]+"","height":""+text_content[10]+"","grossWeight":""+text_content[6]+"","package":{"id":""+packageId+"","packageWeight":""+pgWeight+"","storageId":"01602662-74ce-4ab8-aabb-3f6c5e5c9f34"}}
        0] + "'"
    requestid = database_api.sql_conn(db_warehouse, sql_requestid)

    sql_areaid = "select [Id] from [dbo].[Area] where [Code]='" + text_content[
        2] + "'"
    areaid = database_api.sql_conn(db_warehouse, sql_areaid)

    url_locatrd = "" + login_api.erp_url + "InRequest/LocationRecommend"
    postdata_locatrd = {"requestId": requestid, "areaId": areaid}
    req_locatrd = urllib2.Request(url_locatrd,
                                  data=json.dumps(postdata_locatrd),
                                  headers=header)
    print "推荐入库信息返回:" + edit.open(req_locatrd).read()
    '''检查SKU数量'''
    sql_amountid = "select [Id] from [dbo].[InRequestDetail] where [RequestId]='" + requestid + "'"
    amountid = database_api.sql_multconn(db_warehouse, sql_amountid)
    #print amountid
    #print type(amountid[0][0])
    amountid_list = []
    for j in range(0, len(amountid)):
        amountid_list.append(str(amountid[j][0]))
        url_checkamount = "" + login_api.erp_url + "InRequest/RecordCheckAmount"
        postdata_checkamount = {
            "id": str(amountid[j][0]),
            "requestId": requestid
        }
        req_checkamount = urllib2.Request(
            url_checkamount,
            data=json.dumps(postdata_checkamount),
            headers=header)
        print "检查数量信息返回:" + edit.open(req_checkamount).read()
Exemple #9
0
            req_print = login.post(url_print, data=postdata_print)
            print "打印发货返回信息:" + req_print.text
            '''发货'''
            url_delivery = "" + login_api.erp_url + "ShippingOrder/ShippingOrderDelivery"
            postdata_delivery = {"orderIds": [orderId], "weight": weight}
            req_delivery = login.post(url_delivery, data=postdata_delivery)
            print "发货返回信息:" + req_delivery.text
            print "\n"

    else:
        sql_picklist = "select [Id] from [dbo].[PickingList] where [Code]='" + text_content[
            0] + "'"
        picklist = database_api.sql_conn(db_warehouse, sql_picklist)

        sql_orderIds = "select [OrderId] from [dbo].[PickingListDetail] where [ListId]='" + picklist + "'"
        orderIds = database_api.sql_multconn(db_warehouse, sql_orderIds)
        '''遍历全部未发货的发货单id'''
        for j in orderIds:
            allorderIds = str(j[0])
            sql_orderId = "select [Id] from [dbo].[ShippingOrder] where [Id]='" + allorderIds + "' and [Status]=3"
            orderId = database_api.sql_multconn(db_warehouse, sql_orderId)
            #orderId=list(orderId)
            if orderId:
                orderId = str(orderId[0][0])
                sql_weight = "select [Weight] from [dbo].[ShippingOrder] where [Id]='" + orderId + "'"
                weight = database_api.sql_conn(db_warehouse, sql_weight)

                url_print = "" + login_api.erp_url + "ShippingOrder/GetOrderForPrint"
                postdata_print = {"orderIds": [orderId]}
                req_print = login.post(url_print, data=postdata_print)
                print "发货打印返回信息:" + req_print.text