Esempio n. 1
0
def getallSpDhinfo(request):
    Dhinfo = {}
    viewUsername = request.session.get('viewUserCode')
    if request.user.is_authenticated() and request.user.has_perm(
            "auth.can_order_goods") and viewUsername is None:
        userid = request.POST['userid']
        usercode = request.user.username.encode("utf-8")
        allspaceData = getallspbyuserid(userid)
        i = 0
        for line in allspaceData:
            spcode = line[0]
            spname = line[1]
            #logger.debug(str(i))
            #logger.debug(usercode+spcode)
            maxminstock = getmemcache.getmemcache(usercode, spcode,
                                                  'maxminval')
            #logger.debug(maxminstock)
            maxstock = maxminstock.split("__")[0]
            minstock = maxminstock.split("__")[1]
            curstock = getmemcache.getmemcache(usercode, spcode, 'allstock')
            forecastquantity = str(
                int(
                    float(getmemcache.getmemcache(usercode, spcode,
                                                  'sugvalue'))))

            bak = """if float(curstock) < float(minstock):
                forecastquantity = str(int(float(maxstock)) - int(float(curstock)))
            else:
                forecastquantity = "0""" ""

            #info = {}
            info = {
                "spname": spname,
                "spcode": spcode,
                "maxstock": maxstock,
                "minstock": minstock,
                "curstock": curstock,
                "forecastquantity": forecastquantity
            }
            Dhinfo[spcode] = info

            i = i + 1

        info = getmemcache.getDelivery(usercode)
        Dhinfo["delivery"] = info

        return HttpResponse(json.dumps(Dhinfo))
    else:
        return
Esempio n. 2
0
def setmaxlimit(dhamount, maxminstock, usercode, spcode):
    maxstock = maxminstock.split("__")[0]
    minstock = maxminstock.split("__")[1]
    maxlimit = getmemcache.getmemcache(usercode, spcode,'maxlimit')
    yqrule = maxlimit.split("__")[0]
    yqvalue = maxlimit.split("__")[1]
    if yqrule == 'jd':
        x = int(round(float(dhamount)+float(yqvalue)))
    else:
        x = int(round(float(dhamount)*(1+float(yqvalue))+0.5))
    return str(x)
Esempio n. 3
0
def setmaxlimit(dhamount, maxminstock, usercode, spcode):
    maxstock = maxminstock.split("__")[0]
    minstock = maxminstock.split("__")[1]
    maxlimit = getmemcache.getmemcache(usercode, spcode, 'maxlimit')
    yqrule = maxlimit.split("__")[0]
    yqvalue = maxlimit.split("__")[1]
    if yqrule == 'jd':
        x = int(round(float(dhamount) + float(yqvalue)))
    else:
        x = int(round(float(dhamount) * (1 + float(yqvalue)) + 0.5))
    return str(x)
Esempio n. 4
0
def setminlimit(dhamount, maxminstock, usercode, spcode):
    maxstock = maxminstock.split("__")[0]
    minstock = maxminstock.split("__")[1]
    minlimit = getmemcache.getmemcache(usercode, spcode,'minlimit')
    yqrule = minlimit.split("__")[0]
    yqvalue = minlimit.split("__")[1]
    if yqrule == 'jd':
        x = int(round(float(dhamount)-float(yqvalue)))
    else:
        x = int(round(float(dhamount)*(1-float(yqvalue))))
    if x > 0 :
        return str(x)
    else:
        return "1"
Esempio n. 5
0
def setminlimit(dhamount, maxminstock, usercode, spcode):
    maxstock = maxminstock.split("__")[0]
    minstock = maxminstock.split("__")[1]
    minlimit = getmemcache.getmemcache(usercode, spcode, 'minlimit')
    yqrule = minlimit.split("__")[0]
    yqvalue = minlimit.split("__")[1]
    if yqrule == 'jd':
        x = int(round(float(dhamount) - float(yqvalue)))
    else:
        x = int(round(float(dhamount) * (1 - float(yqvalue))))
    if x > 0:
        return str(x)
    else:
        return "1"
Esempio n. 6
0
def getallSpDhinfo(request):
    Dhinfo = {}
    viewUsername = request.session.get('viewUserCode')
    if request.user.is_authenticated()and request.user.has_perm("auth.can_order_goods") and viewUsername is None:
        userid = request.POST['userid']
        usercode = request.user.username.encode("utf-8")
        allspaceData = getallspbyuserid(userid)
        i = 0
        for line in allspaceData:
            spcode = line[0]
            spname = line[1]
            #logger.debug(str(i))
            #logger.debug(usercode+spcode)
            maxminstock = getmemcache.getmemcache(usercode, spcode, 'maxminval')
            #logger.debug(maxminstock)
            maxstock = maxminstock.split("__")[0]
            minstock = maxminstock.split("__")[1]
            curstock = getmemcache.getmemcache(usercode, spcode,'allstock')
            forecastquantity = str(int(float(getmemcache.getmemcache(usercode, spcode,'sugvalue'))))
            
            bak = """if float(curstock) < float(minstock):
                forecastquantity = str(int(float(maxstock)) - int(float(curstock)))
            else:
                forecastquantity = "0"""""
            
            #info = {}
            info = {"spname":spname, "spcode":spcode, "maxstock":maxstock, "minstock":minstock, "curstock":curstock, "forecastquantity":forecastquantity}
            Dhinfo[spcode]=info
            
            i = i + 1
        
        info = getmemcache.getDelivery(usercode)
        Dhinfo["delivery"] = info
            
        return HttpResponse(json.dumps(Dhinfo))
    else:
        return
Esempio n. 7
0
def getsaledata(mdcode, spcode):
    fmdata = getmemcache.getmemcache(mdcode, spcode,'xiaoshou')
    fmdata1 = fmdata.split("__")
    fmdata2 = ",".join(["1", "2", "3", "4"])
    datapic = '<span class="sparklines">'+fmdata2+'</span>'
    return datapic
Esempio n. 8
0
def setcuxiao(usercode, spcode):
    x = getmemcache.getmemcache(usercode, spcode, "cuxiao")
    if x == '0':
        return " "
    else:
        return "y"
Esempio n. 9
0
def fmWebDh(mdcode):
    result = []   #有图
    result2 = []  #无图
    result3 = []  #物料赠品
    
    usercode = mdcode
    userid = theFmWebSql.getUserInfo(usercode)["UserId"]
    mdname = getmemcache.getMdinfo(usercode, "braname")
    spcodes = getallspcode2(userid)
    totalqty = 0
    for spcode in spcodes['youtu']:
        dhamount = getmdsp_dhamount(usercode+"_"+spcode)
        if dhamount:
            pass
        else:
            dhamount = getmemcache.getmemcache(usercode, spcode,'sugvalue')
            
        
        
        spname = getmemcache.getSpinfo(spcode, "proname")
        spdl = getmemcache.getSpinfo(spcode, "spdl")
        spzl = getmemcache.getSpinfo(spcode, "spzl")
        barcode = getmemcache.getSpinfo(spcode, "barcode")
        prostatus = getmemcache.getSpinfo(spcode, "status")
        propacketqty = getmemcache.getSpinfo(spcode, "packetqty1")
        maxminstock = getmemcache.getmemcache(usercode, spcode, 'maxminval')
        curstock = getmemcache.getmemcache(usercode, spcode,'allstock')
        curalloc = getmemcache.getmemcache(usercode, spcode,'alloc')
        datapic = getmemcache.getmemcache(usercode, spcode,'xiaoshou')
        cuxiao = setcuxiao(usercode, spcode)
        #logger.debug(datapic+"**************")
        datapiclist = datapic.split("__")
        
        saletotal = datapiclist[0]
        saleweek4 = datapiclist[1]
        #logger.debug(datapiclist[1])
        saleweek3 = datapiclist[2]
        saleweek2 = datapiclist[3]
        saleweek1 = datapiclist[4]
        
        
        
        
        if float(dhamount)>0 and prostatus in ("1", "2", "3", "4") :    #过滤停止叫货的商品
        #if float(dhamount)>0 :
            if propacketqty=="1":  #处理配货单位
                totalqty = totalqty + float(dhamount)
                #indhmount = '<input type="text" name="firstname" value="'+dhamount+'">'
                indhamount = dhamount
                indhamount_max = setmaxlimit(dhamount, maxminstock, usercode, spcode)
                indhamount_min = setminlimit(dhamount, maxminstock, usercode, spcode)
                result.append([spdl, spzl, barcode, spcode, spname, dhamount, indhamount, statusconvert(prostatus), propacketqty, maxminstock, curstock, saletotal, indhamount_max, indhamount_min, saleweek1, saleweek2,saleweek3, saleweek4, cuxiao, curalloc])
            else:
                try:
                    x = round(float(dhamount)/float(propacketqty)+0.2,0)*float(propacketqty)   #2舍3入
                    indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock, usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock, usercode, spcode)
                except:
                    x = float(dhamount)
                    #indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock, usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock, usercode, spcode)
                if x > 0: #配货量大于零
                    totalqty = totalqty + x
                    result.append([spdl, spzl, barcode, spcode, spname, str(x), indhamount, statusconvert(prostatus), propacketqty, maxminstock, curstock, saletotal, indhamount_max, indhamount_min, saleweek1, saleweek2,saleweek3, saleweek4, cuxiao, curalloc])
    
    
    for spcode in spcodes['wutu']:
        dhamount = getmdsp_dhamount(usercode+"_"+spcode)
        if dhamount:
            pass
        else:
            dhamount = getmemcache.getmemcache(usercode, spcode,'sugvalue')
            
        
        
        spname = getmemcache.getSpinfo(spcode, "proname")
        spdl = getmemcache.getSpinfo(spcode, "spdl")
        spzl = getmemcache.getSpinfo(spcode, "spzl")
        barcode = getmemcache.getSpinfo(spcode, "barcode")
        prostatus = getmemcache.getSpinfo(spcode, "status")
        propacketqty = getmemcache.getSpinfo(spcode, "packetqty1")
        maxminstock = getmemcache.getmemcache(usercode, spcode, 'maxminval')
        curstock = getmemcache.getmemcache(usercode, spcode,'allstock')
        curalloc = getmemcache.getmemcache(usercode, spcode,'alloc')
        datapic = getmemcache.getmemcache(usercode, spcode,'xiaoshou')
        cuxiao = setcuxiao(usercode, spcode)
        #logger.debug(datapic+"**************")
        datapiclist = datapic.split("__")
        
        saletotal = datapiclist[0]
        saleweek4 = datapiclist[1]
        #logger.debug(datapiclist[1])
        saleweek3 = datapiclist[2]
        saleweek2 = datapiclist[3]
        saleweek1 = datapiclist[4]
        
        
        
        
        if float(dhamount)>0 and prostatus in ("1", "2", "3", "4")  and saletotal != " " and spdl != '05_物料赠品':    #过滤停止叫货的商品
        #if float(dhamount)>0 :
            if propacketqty=="1":  #处理配货单位
                totalqty = totalqty + float(dhamount)
                #indhmount = '<input type="text" name="firstname" value="'+dhamount+'">'
                indhamount = dhamount
                indhamount_max = setmaxlimit(dhamount, maxminstock, usercode, spcode)
                indhamount_min = setminlimit(dhamount, maxminstock, usercode, spcode)
                result2.append([spdl, spzl, barcode, spcode, spname, dhamount, indhamount, statusconvert(prostatus), propacketqty, maxminstock, curstock, saletotal, indhamount_max, indhamount_min, saleweek1, saleweek2,saleweek3, saleweek4, cuxiao, curalloc])
            else:
                try:
                    x = round(float(dhamount)/float(propacketqty)+0.2,0)*float(propacketqty)   #2舍3入
                    indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock, usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock, usercode, spcode)
                except:
                    x = float(dhamount)
                    #indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock, usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock, usercode, spcode)
                if x > 0: #配货量大于零
                    totalqty = totalqty + x
                    result2.append([spdl, spzl, barcode, spcode, spname, str(x), indhamount, statusconvert(prostatus), propacketqty, maxminstock, curstock, saletotal, indhamount_max, indhamount_min, saleweek1, saleweek2,saleweek3, saleweek4, cuxiao, curalloc])
    

    
    totalsku = str(len(result)+len(result2))
    
    for spcode in spcodes['wutu']:            #无图商品中的物料赠品
        dhamount = getmdsp_dhamount(usercode+"_"+spcode)
        if dhamount:
            pass
        else:
            dhamount = getmemcache.getmemcache(usercode, spcode,'sugvalue')
            
        
        
        spname = getmemcache.getSpinfo(spcode, "proname")
        spdl = getmemcache.getSpinfo(spcode, "spdl")
        spzl = getmemcache.getSpinfo(spcode, "spzl")
        barcode = getmemcache.getSpinfo(spcode, "barcode")
        prostatus = getmemcache.getSpinfo(spcode, "status")
        propacketqty = getmemcache.getSpinfo(spcode, "packetqty1")
        maxminstock = getmemcache.getmemcache(usercode, spcode, 'maxminval')
        curstock = getmemcache.getmemcache(usercode, spcode,'allstock')
        curalloc = getmemcache.getmemcache(usercode, spcode,'alloc')
        datapic = getmemcache.getmemcache(usercode, spcode,'xiaoshou')
        cuxiao = setcuxiao(usercode, spcode)
        #logger.debug(datapic+"**************")
        datapiclist = datapic.split("__")
        
        saletotal = datapiclist[0]
        saleweek4 = datapiclist[1]
        #logger.debug(datapiclist[1])
        saleweek3 = datapiclist[2]
        saleweek2 = datapiclist[3]
        saleweek1 = datapiclist[4]
        
        
        
        
        if float(dhamount)>0 and prostatus in ("1", "2", "3", "4")  and spdl == '05_物料赠品':    #过滤停止叫货的商品
        #if float(dhamount)>0 :
            if propacketqty=="1":  #处理配货单位
                #totalqty = totalqty + float(dhamount)
                #indhmount = '<input type="text" name="firstname" value="'+dhamount+'">'
                indhamount = dhamount
                indhamount_max = setmaxlimit(dhamount, maxminstock, usercode, spcode)
                indhamount_min = setminlimit(dhamount, maxminstock, usercode, spcode)
                result3.append([spdl, spzl, barcode, spcode, spname, dhamount, indhamount, statusconvert(prostatus), propacketqty, maxminstock, curstock, saletotal, indhamount_max, indhamount_min, saleweek1, saleweek2,saleweek3, saleweek4, cuxiao, curalloc])
            else:
                try:
                    x = round(float(dhamount)/float(propacketqty)+0.2,0)*float(propacketqty)   #2舍3入
                    indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock, usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock, usercode, spcode)
                except:
                    x = float(dhamount)
                    #indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock, usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock, usercode, spcode)
                if x > 0: #配货量大于零
                    #totalqty = totalqty + x
                    result3.append([spdl, spzl, barcode, spcode, spname, str(x), indhamount, statusconvert(prostatus), propacketqty, maxminstock, curstock, saletotal, indhamount_max, indhamount_min, saleweek1, saleweek2,saleweek3, saleweek4, cuxiao, curalloc])
    
        
        
    fp = open('d:/vcms/lib/py/mana1/templates/mana1/dh.html')
    t = Template(fp.read())
    fp.close()
    
    
    html=t.render(Context({'userid': userid, 'result':result, 'result2':result2, 'result3':result3, 'totalsku':totalsku, 'totalqty':str(totalqty), 'mdname':mdname}))
    return html
Esempio n. 10
0
def setcuxiao(usercode, spcode):
    x = getmemcache.getmemcache(usercode, spcode, "cuxiao")
    if x == '0':
        return " "
    else:
        return "y"
Esempio n. 11
0
def getsaledata(mdcode, spcode):
    fmdata = getmemcache.getmemcache(mdcode, spcode, 'xiaoshou')
    fmdata1 = fmdata.split("__")
    fmdata2 = ",".join(["1", "2", "3", "4"])
    datapic = '<span class="sparklines">' + fmdata2 + '</span>'
    return datapic
Esempio n. 12
0
def fmWebDh(mdcode):
    result = []  #有图
    result2 = []  #无图
    result3 = []  #物料赠品

    usercode = mdcode
    userid = theFmWebSql.getUserInfo(usercode)["UserId"]
    mdname = getmemcache.getMdinfo(usercode, "braname")
    spcodes = getallspcode2(userid)
    totalqty = 0
    for spcode in spcodes['youtu']:
        dhamount = getmdsp_dhamount(usercode + "_" + spcode)
        if dhamount:
            pass
        else:
            dhamount = getmemcache.getmemcache(usercode, spcode, 'sugvalue')

        spname = getmemcache.getSpinfo(spcode, "proname")
        spdl = getmemcache.getSpinfo(spcode, "spdl")
        spzl = getmemcache.getSpinfo(spcode, "spzl")
        barcode = getmemcache.getSpinfo(spcode, "barcode")
        prostatus = getmemcache.getSpinfo(spcode, "status")
        propacketqty = getmemcache.getSpinfo(spcode, "packetqty1")
        maxminstock = getmemcache.getmemcache(usercode, spcode, 'maxminval')
        curstock = getmemcache.getmemcache(usercode, spcode, 'allstock')
        curalloc = getmemcache.getmemcache(usercode, spcode, 'alloc')
        datapic = getmemcache.getmemcache(usercode, spcode, 'xiaoshou')
        cuxiao = setcuxiao(usercode, spcode)
        #logger.debug(datapic+"**************")
        datapiclist = datapic.split("__")

        saletotal = datapiclist[0]
        saleweek4 = datapiclist[1]
        #logger.debug(datapiclist[1])
        saleweek3 = datapiclist[2]
        saleweek2 = datapiclist[3]
        saleweek1 = datapiclist[4]

        if float(dhamount) > 0 and prostatus in ("1", "2", "3",
                                                 "4"):  #过滤停止叫货的商品
            #if float(dhamount)>0 :
            if propacketqty == "1":  #处理配货单位
                totalqty = totalqty + float(dhamount)
                #indhmount = '<input type="text" name="firstname" value="'+dhamount+'">'
                indhamount = dhamount
                indhamount_max = setmaxlimit(dhamount, maxminstock, usercode,
                                             spcode)
                indhamount_min = setminlimit(dhamount, maxminstock, usercode,
                                             spcode)
                result.append([
                    spdl, spzl, barcode, spcode, spname, dhamount, indhamount,
                    statusconvert(prostatus), propacketqty, maxminstock,
                    curstock, saletotal, indhamount_max, indhamount_min,
                    saleweek1, saleweek2, saleweek3, saleweek4, cuxiao,
                    curalloc
                ])
            else:
                try:
                    x = round(float(dhamount) / float(propacketqty) + 0.2,
                              0) * float(propacketqty)  #2舍3入
                    indhamount = '<input type="text" name="firstname" value="' + str(
                        x) + '">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                except:
                    x = float(dhamount)
                    #indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                if x > 0:  #配货量大于零
                    totalqty = totalqty + x
                    result.append([
                        spdl, spzl, barcode, spcode, spname,
                        str(x), indhamount,
                        statusconvert(prostatus), propacketqty, maxminstock,
                        curstock, saletotal, indhamount_max, indhamount_min,
                        saleweek1, saleweek2, saleweek3, saleweek4, cuxiao,
                        curalloc
                    ])

    for spcode in spcodes['wutu']:
        dhamount = getmdsp_dhamount(usercode + "_" + spcode)
        if dhamount:
            pass
        else:
            dhamount = getmemcache.getmemcache(usercode, spcode, 'sugvalue')

        spname = getmemcache.getSpinfo(spcode, "proname")
        spdl = getmemcache.getSpinfo(spcode, "spdl")
        spzl = getmemcache.getSpinfo(spcode, "spzl")
        barcode = getmemcache.getSpinfo(spcode, "barcode")
        prostatus = getmemcache.getSpinfo(spcode, "status")
        propacketqty = getmemcache.getSpinfo(spcode, "packetqty1")
        maxminstock = getmemcache.getmemcache(usercode, spcode, 'maxminval')
        curstock = getmemcache.getmemcache(usercode, spcode, 'allstock')
        curalloc = getmemcache.getmemcache(usercode, spcode, 'alloc')
        datapic = getmemcache.getmemcache(usercode, spcode, 'xiaoshou')
        cuxiao = setcuxiao(usercode, spcode)
        #logger.debug(datapic+"**************")
        datapiclist = datapic.split("__")

        saletotal = datapiclist[0]
        saleweek4 = datapiclist[1]
        #logger.debug(datapiclist[1])
        saleweek3 = datapiclist[2]
        saleweek2 = datapiclist[3]
        saleweek1 = datapiclist[4]

        if float(dhamount) > 0 and prostatus in (
                "1", "2", "3",
                "4") and saletotal != " " and spdl != '05_物料赠品':  #过滤停止叫货的商品
            #if float(dhamount)>0 :
            if propacketqty == "1":  #处理配货单位
                totalqty = totalqty + float(dhamount)
                #indhmount = '<input type="text" name="firstname" value="'+dhamount+'">'
                indhamount = dhamount
                indhamount_max = setmaxlimit(dhamount, maxminstock, usercode,
                                             spcode)
                indhamount_min = setminlimit(dhamount, maxminstock, usercode,
                                             spcode)
                result2.append([
                    spdl, spzl, barcode, spcode, spname, dhamount, indhamount,
                    statusconvert(prostatus), propacketqty, maxminstock,
                    curstock, saletotal, indhamount_max, indhamount_min,
                    saleweek1, saleweek2, saleweek3, saleweek4, cuxiao,
                    curalloc
                ])
            else:
                try:
                    x = round(float(dhamount) / float(propacketqty) + 0.2,
                              0) * float(propacketqty)  #2舍3入
                    indhamount = '<input type="text" name="firstname" value="' + str(
                        x) + '">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                except:
                    x = float(dhamount)
                    #indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                if x > 0:  #配货量大于零
                    totalqty = totalqty + x
                    result2.append([
                        spdl, spzl, barcode, spcode, spname,
                        str(x), indhamount,
                        statusconvert(prostatus), propacketqty, maxminstock,
                        curstock, saletotal, indhamount_max, indhamount_min,
                        saleweek1, saleweek2, saleweek3, saleweek4, cuxiao,
                        curalloc
                    ])

    totalsku = str(len(result) + len(result2))

    for spcode in spcodes['wutu']:  #无图商品中的物料赠品
        dhamount = getmdsp_dhamount(usercode + "_" + spcode)
        if dhamount:
            pass
        else:
            dhamount = getmemcache.getmemcache(usercode, spcode, 'sugvalue')

        spname = getmemcache.getSpinfo(spcode, "proname")
        spdl = getmemcache.getSpinfo(spcode, "spdl")
        spzl = getmemcache.getSpinfo(spcode, "spzl")
        barcode = getmemcache.getSpinfo(spcode, "barcode")
        prostatus = getmemcache.getSpinfo(spcode, "status")
        propacketqty = getmemcache.getSpinfo(spcode, "packetqty1")
        maxminstock = getmemcache.getmemcache(usercode, spcode, 'maxminval')
        curstock = getmemcache.getmemcache(usercode, spcode, 'allstock')
        curalloc = getmemcache.getmemcache(usercode, spcode, 'alloc')
        datapic = getmemcache.getmemcache(usercode, spcode, 'xiaoshou')
        cuxiao = setcuxiao(usercode, spcode)
        #logger.debug(datapic+"**************")
        datapiclist = datapic.split("__")

        saletotal = datapiclist[0]
        saleweek4 = datapiclist[1]
        #logger.debug(datapiclist[1])
        saleweek3 = datapiclist[2]
        saleweek2 = datapiclist[3]
        saleweek1 = datapiclist[4]

        if float(dhamount) > 0 and prostatus in (
                "1", "2", "3", "4") and spdl == '05_物料赠品':  #过滤停止叫货的商品
            #if float(dhamount)>0 :
            if propacketqty == "1":  #处理配货单位
                #totalqty = totalqty + float(dhamount)
                #indhmount = '<input type="text" name="firstname" value="'+dhamount+'">'
                indhamount = dhamount
                indhamount_max = setmaxlimit(dhamount, maxminstock, usercode,
                                             spcode)
                indhamount_min = setminlimit(dhamount, maxminstock, usercode,
                                             spcode)
                result3.append([
                    spdl, spzl, barcode, spcode, spname, dhamount, indhamount,
                    statusconvert(prostatus), propacketqty, maxminstock,
                    curstock, saletotal, indhamount_max, indhamount_min,
                    saleweek1, saleweek2, saleweek3, saleweek4, cuxiao,
                    curalloc
                ])
            else:
                try:
                    x = round(float(dhamount) / float(propacketqty) + 0.2,
                              0) * float(propacketqty)  #2舍3入
                    indhamount = '<input type="text" name="firstname" value="' + str(
                        x) + '">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                except:
                    x = float(dhamount)
                    #indhamount = '<input type="text" name="firstname" value="'+str(x)+'">'
                    indhamount = str(x)
                    indhamount_max = setmaxlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                    indhamount_min = setminlimit(indhamount, maxminstock,
                                                 usercode, spcode)
                if x > 0:  #配货量大于零
                    #totalqty = totalqty + x
                    result3.append([
                        spdl, spzl, barcode, spcode, spname,
                        str(x), indhamount,
                        statusconvert(prostatus), propacketqty, maxminstock,
                        curstock, saletotal, indhamount_max, indhamount_min,
                        saleweek1, saleweek2, saleweek3, saleweek4, cuxiao,
                        curalloc
                    ])

    fp = open('d:/vcms/lib/py/mana1/templates/mana1/dh.html')
    t = Template(fp.read())
    fp.close()

    html = t.render(
        Context({
            'userid': userid,
            'result': result,
            'result2': result2,
            'result3': result3,
            'totalsku': totalsku,
            'totalqty': str(totalqty),
            'mdname': mdname
        }))
    return html