Beispiel #1
0
def delete_product_gl_packetqty_rules(request):
    '删除配货规则'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=4)
        rs2, rs1 = verifyData(rs1, length=4, required=[0, 2, 3], psrules=1)

        html = u"<table width='800'><tr><th>代码</th><th>名称</th><th>代码说明</th><th>配货单位</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td style='background-color:yellow;'>" + rs[
                    4] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(html)
    else:
        t = get_template('mana1/delete_product_gl_packetqty_rules.html')
        html = t.render(Context())
        return HttpResponse(html)
def delete_product_gl_packetqty_rules(request):
    '删除配货规则'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=4)
        rs2,rs1=verifyData(rs1,length=4,required=[0,2,3],psrules=1)

        html=u"<table width='800'><tr><th>代码</th><th>名称</th><th>代码说明</th><th>配货单位</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td style='background-color:yellow;'>" + rs[4] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(html)
    else:
        t=get_template('mana1/delete_product_gl_packetqty_rules.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #3
0
def delete_quantou(request):
    '删除订货规则'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=2)
        rs2,rs1=verifyData(rs1,length=2,required=[0])

        html=u"<table width='400'><tr><th>商品代码</th><th>商品名称</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td style='background-color:yellow'>" + rs[2] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(Context(html))
    else:
        t=get_template('mana1/delete_quantou.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #4
0
def delete_tianshu(request):
    '删除订货规则'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=4)
        rs2, rs1 = verifyData(rs1, length=4, required=[0, 2, 3])

        html = u"<table width='800'><tr><th>门店代码</th><th>门店名称</th><th>安全库存天数</th><th>配送周期天数</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td style='background-color:yellow'>" + rs[4] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(Context(html))
    else:
        t = get_template('mana1/delete_tianshu.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #5
0
def delete_delivery(request):
    '删除配送规则'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=3)
        rs2,rs1=verifyData(rs1,length=3,required=[0,2],delivery=1)

        html=u"<table width='800'><tr><th>门店代码</th><th>门店名称</th><th>配送日</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td style='background-color:yellow;'>" + rs[3] + "</td>"
                html+="</tr>"
        #log(rs1)
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(html)
    else:
        t=get_template('mana1/delete_delivery.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #6
0
def import_product_gl_packetqty_rules(request):
    '商品配送规则导入'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=4)
        rs2, rs1 = verifyData(rs1, length=4, required=[0, 2, 3], psrules=1)

        temp = []
        for rs in rs1:
            excode = rs[2]
            if rs[2] == u'商品代码':
                excode = 'sp'
            if rs[2] == u'小类代码':
                excode = 'xl'
            if rs[2] == u'中类代码':
                excode = 'zl'
            if rs[2] == u'大类代码':
                excode = 'dl'
            '重复项覆盖'
            sqlstr = "select * from product_gl_packetqty_rules where xcode='" + rs[
                0] + "' and excode='" + excode + "'"
            if confsql.checkExist(
                    sqlstr) == 1:  #检查xcode,excode,packetqty 数据库是否已存在
                rs.append(u'数据库已存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        html = u"<table width='800'><tr><th>代码</th><th>名称</th><th>代码说明</th><th>配货单位</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td style='background-color:yellow;'>" + rs[
                    4] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(html)
    else:
        t = get_template('mana1/import_product_gl_packetqty_rules.html')
        html = t.render(Context())
        return HttpResponse(html)
def import_product_gl_packetqty_rules(request):
    '商品配送规则导入'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=4)
        rs2,rs1=verifyData(rs1,length=4,required=[0,2,3],psrules=1)

        temp=[]
        for rs in rs1:
            excode=rs[2]
            if rs[2]==u'商品代码':
                excode='sp'
            if rs[2]==u'小类代码':
                excode='xl'
            if rs[2]==u'中类代码':
                excode='zl'
            if rs[2]==u'大类代码':
                excode='dl'
            '重复项覆盖'
            sqlstr="select * from product_gl_packetqty_rules where xcode='"+rs[0]+"' and excode='"+excode+"'"
            if confsql.checkExist(sqlstr)==1: #检查xcode,excode,packetqty 数据库是否已存在
                rs.append(u'数据库已存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        html=u"<table width='800'><tr><th>代码</th><th>名称</th><th>代码说明</th><th>配货单位</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td style='background-color:yellow;'>" + rs[4] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(html)
    else:
        t=get_template('mana1/import_product_gl_packetqty_rules.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #8
0
def import_basedisplay(request):
    '订货量修改规则导入'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=5)
        rs2, rs1 = verifyData(rs1, length=5, required=[0, 2, 4])

        '重复项覆盖'
        temp = []
        for rs in rs1:
            sqlstr = u"select * from basedisplay where braid='" + rs[
                0] + "' and proid='" + rs[2] + "'"
            if confsql.checkExist(sqlstr) == 1:  #检查braid,proid数据库是否已存在
                rs.append(u'数据库已存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        html = u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>商品代码</th><th>商品名称</th><th>基本陈列量</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td style='background-color:yellow'>" + rs[5] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(Context(html))
    else:
        t = get_template('mana1/import_basedisplay.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #9
0
def import_basedisplay(request):
    '订货量修改规则导入'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=5)
        rs2,rs1=verifyData(rs1,length=5,required=[0,2,4])

        '重复项覆盖'
        temp=[]
        for rs in rs1:
            sqlstr=u"select * from basedisplay where braid='"+rs[0]+"' and proid='"+rs[2]+"'"
            if confsql.checkExist(sqlstr)==1: #检查braid,proid数据库是否已存在
                rs.append(u'数据库已存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        html=u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>商品代码</th><th>商品名称</th><th>基本陈列量</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td style='background-color:yellow'>" + rs[5] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(Context(html))
    else:
        t=get_template('mana1/import_basedisplay.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #10
0
def import_tianshu(request):
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=4)
        rs2, rs1 = verifyData(rs1, length=4, required=[0, 2, 3])

        '重复项覆盖'
        temp = []
        if len(rs1) > 0:
            for rs in rs1:
                if confsql.checkExist("select * from tianshu where braid='" +
                                      rs[0] + "'") == 1:  #检查数据库是否已存在
                    temp.append(rs)
                    rs.append(u'数据库已存在!')
                    rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        html = u"<table width='800'><tr><th>门店代码</th><th>门店名称</th><th>安全库存天数</th><th>送货周期天数</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td style='background-color:yellow'>" + rs[4] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(Context(html))
    else:
        t = get_template('mana1/import_tianshu.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #11
0
def import_tianshu(request):
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=4)
        rs2,rs1=verifyData(rs1,length=4,required=[0,2,3])

        '重复项覆盖'
        temp=[]
        if len(rs1)>0:
            for rs in rs1:
                if confsql.checkExist("select * from tianshu where braid='"+rs[0]+"'")==1: #检查数据库是否已存在
                    temp.append(rs)
                    rs.append(u'数据库已存在!')
                    rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        html=u"<table width='800'><tr><th>门店代码</th><th>门店名称</th><th>安全库存天数</th><th>送货周期天数</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td style='background-color:yellow'>" + rs[4] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(Context(html))
    else:
        t=get_template('mana1/import_tianshu.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #12
0
def import_delivery(request):
    ''' 配送日期导入 '''
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value, itemlenth=3) #去除行尾多余换行符 rs1存放初始值
        rs2,rs1=verifyData(rs1,length=3,required=[0,2],delivery=1)
        
        #数据库已存在给予提示
        temp=[]
        for rs in rs1:
            if confsql.checkExist("select * from delivery where braid='"+rs[0]+"' and weekdelivery='"+rs[2]+"'")==1:
                temp.append(rs)
                rs.append(u'数据库已存在!')
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        html=u"<table width='800'><tr><th>门店代码</th><th>门店名称</th><th>配送日</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td style='background-color:yellow;'>" + rs[3] + "</td>"
                html+="</tr>"
        #log(rs1)
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(html)
    else:
        t=get_template('mana1/import_delivery.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #13
0
def import_maxmin(request):
    ''' 上下限导入界面 '''
    if request.method == 'POST':
        '''暂存数据 初步检查'''
        try:
            value = request.POST['value']
            rs1 = trim_csv(value, itemlenth=6)  #去除行尾多余换行符 rs1存放初始值
            rs2, rs1 = verifyData(rs1, length=6, required=[4], maxmin=1)

            html = u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>商品代码</th><th>商品名称</th><th>上限</th><th>下限</th><th></th></tr>"
            if len(rs2) > 0:
                for rs in rs2:
                    html += "<tr>"
                    html += "<td>" + rs[0] + "</td>"
                    html += "<td>" + rs[1] + "</td>"
                    html += "<td>" + rs[2] + "</td>"
                    html += "<td>" + rs[3] + "</td>"
                    html += "<td>" + rs[4] + "</td>"
                    html += "<td>" + rs[5] + "</td>"
                    html += "<td style='background-color:yellow'>" + rs[
                        6] + "</td>"
                    html += "</tr>"
            if len(rs1) > 0:
                for rs in rs1:
                    html += "<tr>"
                    html += "<td>" + rs[0] + "</td>"
                    html += "<td>" + rs[1] + "</td>"
                    html += "<td>" + rs[2] + "</td>"
                    html += "<td>" + rs[3] + "</td>"
                    html += "<td>" + rs[4] + "</td>"
                    html += "<td>" + rs[5] + "</td>"
                    html += "<td></td>"
                    html += "</tr>"
            html += "</table>"
            return HttpResponse(html)
        except:
            return HttpResponse(0)
    else:
        t = get_template('mana1/import_maxmin.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #14
0
def delete_dhrules(request):
    '删除订货规则'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=8)
        rs2,rs1=verifyData(rs1,length=8,required=[5,6,7],dhrules=1)

        html=u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>名称</th><th>代码说明</th><th>规则对象</th><th>规则说明</th><th>规则值</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td style='background-color:yellow'>" + rs[8] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(Context(html))
    else:
        t=get_template('mana1/delete_dhrules.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #15
0
def delete_dhrules(request):
    '删除订货规则'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=8)
        rs2, rs1 = verifyData(rs1, length=8, required=[5, 6, 7], dhrules=1)

        html = u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>名称</th><th>代码说明</th><th>规则对象</th><th>规则说明</th><th>规则值</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td style='background-color:yellow'>" + rs[8] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(Context(html))
    else:
        t = get_template('mana1/delete_dhrules.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #16
0
def import_maxmin(request):
    ''' 上下限导入界面 '''
    if request.method=='POST':
        '''暂存数据 初步检查'''
        try:
            value=request.POST['value']
            rs1=trim_csv(value,itemlenth=6) #去除行尾多余换行符 rs1存放初始值
            rs2,rs1=verifyData(rs1,length=6,required=[4],maxmin=1)

            html=u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>商品代码</th><th>商品名称</th><th>上限</th><th>下限</th><th></th></tr>"
            if len(rs2)>0:
                for rs in rs2:
                    html+="<tr>"
                    html+="<td>" + rs[0] + "</td>"
                    html+="<td>" + rs[1] + "</td>"
                    html+="<td>" + rs[2] + "</td>"
                    html+="<td>" + rs[3] + "</td>"
                    html+="<td>" + rs[4] + "</td>"
                    html+="<td>" + rs[5] + "</td>"
                    html+="<td style='background-color:yellow'>" + rs[6] + "</td>"
                    html+="</tr>"
            if len(rs1)>0:
                for rs in rs1:
                    html+="<tr>"
                    html+="<td>" + rs[0] + "</td>"
                    html+="<td>" + rs[1] + "</td>"
                    html+="<td>" + rs[2] + "</td>"
                    html+="<td>" + rs[3] + "</td>"
                    html+="<td>" + rs[4] + "</td>"
                    html+="<td>" + rs[5] + "</td>"
                    html+="<td></td>"
                    html+="</tr>"
            html+="</table>"
            return HttpResponse(html)
        except:
            return HttpResponse(0)
    else:
        t=get_template('mana1/import_maxmin.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #17
0
def import_dhrules(request):
    '订货量修改规则导入'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=8)
        rs2,rs1=verifyData(rs1,length=8,required=[5,6,7],dhrules=1)

        '重复项覆盖'
        temp=[]
        for rs in rs1:
            excode=rs[4]
            if rs[4]==u'商品代码':
                excode='sp'
            if rs[4]==u'小类代码':
                excode='xl'
            if rs[4]==u'中类代码':
                excode='zl'
            if rs[4]==u'大类代码':
                excode='dl'
                
            yqkey = rs[5]
            if rs[5]==u'上阈值':
                yqkey='maxlimit'
            if rs[5]==u'下阈值':
                yqkey='minlimit'
            
            
            
            sqlstr=u"select * from dhrules where mdcode='"+rs[0]+"' and xcode = '"+ rs[2] +"' and excode='"+excode+"' and yqkey='"+yqkey+"'"
            if confsql.checkExist(sqlstr)==1: #检查mdcode,excode,yqkey数据库是否已存在
                rs.append(u'数据库已存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        html=u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>名称</th><th>代码说明</th><th>规则对象</th><th>规则说明</th><th>规则值</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td style='background-color:yellow'>" + rs[8] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(Context(html))
    else:
        t=get_template('mana1/import_dhrules.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #18
0
def delete_maxminCuxiaori(request):
    '删除促销日上下限规则'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=10)
        rs2, rs1 = verifyData(rs1, length=10, required=[0, 2, 4, 5, 6, 7, 8])

        '重复项覆盖'
        temp = []
        for rs in rs1:
            excode = rs[4]
            if rs[4] == u'商品代码':
                excode = 'sp'
            if rs[4] == u'品牌小类代码':
                excode = 'braxl'
            if rs[4] == u'大类代码':
                excode = 'prodl'
            if rs[4] == u'中类代码':
                excode = 'prozl'
            if rs[4] == u'小类代码':
                excode = 'proxl'
            sqlstr = u"select * from maxminCuxiaori where mdcode='" + rs[
                0] + "' and xcode = '" + rs[
                    2] + "' and excode='" + excode + "' and startdate='" + rs[
                        7] + "' and enddate = '" + rs[8] + "'"
            if confsql.checkExist(sqlstr) <> 1:  #检查mdcode,excode,yqkey数据库是否已存在
                rs.append(u'数据库中不存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '门店代码商品代码 长度检查'
        temp = []
        for rs in rs1:
            if len(rs[0]) <> 5:  #门店代码 5位
                rs.append(u'门店代码长度必须为5位')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '代码说明 检查'
        temp = []
        for rs in rs1:
            if rs[4] <> u"商品代码" and rs[4] <> u"品牌小类代码" and rs[
                    4] <> u"大类代码" and rs[4] <> u"中类代码" and rs[4] <> u"小类代码":
                rs.append(u'代码说明不符要求')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '代码 检查 未考虑大,中类,小类'
        """temp=[]
        for rs in rs1:
            if len(rs[2])<>8: #商品代码或品牌小类代码 8位
                rs.append(u'商品代码或品牌小类代码长度必须为8位')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)"""

        '上下限倍数必须是数值'
        temp = []
        for rs in rs1:
            if type(eval(rs[5])) <> type(1.00) and type(eval(
                    rs[5])) <> type(1):
                rs.append(u'上限倍数必须是数值')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        temp = []
        for rs in rs1:
            if type(eval(rs[6])) <> type(1.00) and type(eval(
                    rs[6])) <> type(1):
                rs.append(u'下限倍数必须是数值')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '开始日期格式检查'
        temp = []
        for rs in rs1:
            m = re.match(r'^\w\w\w\w-\w\w-\w\w$', rs[7])
            if m == None:  #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '结束日期格式检查'
        temp = []
        for rs in rs1:
            m = re.match(r'^\w\w\w\w-\w\w-\w\w$', rs[8])
            if m == None:  #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        html = u"<table width='1200'><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>代码名称</th><th>代码说明</th><th>上限倍数</th><th>下限倍数</th><th>规则开始时间</th><th>规则结束时间</th><th>备注</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td>" + rs[8] + "</td>"
                html += "<td>" + rs[9] + "</td>"
                html += "<td style='background-color:yellow'>" + rs[
                    10] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td>" + rs[8] + "</td>"
                html += "<td>" + rs[9] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(Context(html))
    else:
        t = get_template('mana1/delete_maxminCuxiaori.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #19
0
def import_dhrules(request):
    '订货量修改规则导入'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=8)
        rs2, rs1 = verifyData(rs1, length=8, required=[5, 6, 7], dhrules=1)

        '重复项覆盖'
        temp = []
        for rs in rs1:
            excode = rs[4]
            if rs[4] == u'商品代码':
                excode = 'sp'
            if rs[4] == u'小类代码':
                excode = 'xl'
            if rs[4] == u'中类代码':
                excode = 'zl'
            if rs[4] == u'大类代码':
                excode = 'dl'

            yqkey = rs[5]
            if rs[5] == u'上阈值':
                yqkey = 'maxlimit'
            if rs[5] == u'下阈值':
                yqkey = 'minlimit'

            sqlstr = u"select * from dhrules where mdcode='" + rs[
                0] + "' and xcode = '" + rs[
                    2] + "' and excode='" + excode + "' and yqkey='" + yqkey + "'"
            if confsql.checkExist(sqlstr) == 1:  #检查mdcode,excode,yqkey数据库是否已存在
                rs.append(u'数据库已存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        html = u"<table width='1000'><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>名称</th><th>代码说明</th><th>规则对象</th><th>规则说明</th><th>规则值</th></tr>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td style='background-color:yellow'>" + rs[8] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</table>"
        return HttpResponse(Context(html))
    else:
        t = get_template('mana1/import_dhrules.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #20
0
def delete_dhrulesYuzhi(request):
    '删除暂停订货范围规则'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=12)
        rs2,rs1=verifyData(rs1,length=12,required=[5,6,7,8,9])

        '是否重复'
        temp=[]
        for rs in rs1:
            excode=rs[4]
            if rs[4]==u'商品代码':
                excode='sp'
            if rs[4]==u'品牌小类代码':
                excode='braxl'
            if rs[4]==u'大类代码':
                excode='prodl'
            if rs[4]==u'中类代码':
                excode='prozl'
            if rs[4]==u'小类代码':
                excode='proxl'
            sqlstr=u"select * from dhrulesYuzhi where mdcode='"+rs[0]+"' and xcode = '"+ rs[2] +"' and excode='"+excode+"' and startdate='"+rs[8]+"' and enddate = '" + rs[9] + "'"
            if confsql.checkExist(sqlstr)<>1: #检查mdcode,excode,yqkey数据库是否已存在
                rs.append(u'数据库不存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '门店代码商品代码 长度检查'
        temp=[]
        for rs in rs1:
            if len(rs[0])<>5: #门店代码 5位
                rs.append(u'门店代码长度必须为5位!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '代码说明 检查'
        temp=[]
        for rs in rs1:
            if rs[4] <>u"商品代码" and rs[4]<>u"品牌小类代码" and rs[4]<>u"大类代码" and rs[4]<>u"中类代码" and rs[4]<>u"小类代码":
                rs.append(u'代码说明不符要求!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '代码 检查'
        temp=[]
        for rs in rs1:
            if rs[4]==u"商品代码" or rs[4]==u"品牌小类代码" or rs[4]==u"小类代码":
                if len(rs[2])<>8: #商品代码或品牌小类代码 8位
                    rs.append(u'代码长度不符!')
                    temp.append(rs)
                    rs2.append(rs)
            if rs[4]==u"中类代码":
                if len(rs[2])<>5:
                    rs.append(u'代码长度不符!')
                    temp.append(rs)
                    rs2.append(rs)
            if rs[4]==u"大类代码":
                if len(rs[2])<>2:
                    rs.append(u'代码长度不符!')
                    temp.append(rs)
                    rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '规则说明只能填相对值'
        temp=[]
        for rs in rs1:
            if rs[6]<>u'相对值':
                rs.append(u'规则说明只能填“相对值”!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '规则值为百分比格式且大于0'
        temp=[]
        for rs in rs1:
            if type(eval(rs[7]))<>type(1.00) or eval(rs[7])<0:
                rs.append(u'规则值必须为正百分比格式!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '开始日期格式检查'
        temp=[]
        for rs in rs1:
            m=re.match(r'^\w\w\w\w-\w\w-\w\w$',rs[8])
            if m==None: #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '结束日期格式检查'
        temp=[]
        for rs in rs1:
            m=re.match(r'^\w\w\w\w-\w\w-\w\w$',rs[9])
            if m==None: #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)


        html=u"<table width='1200'><thead><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>代码名称</th><th>代码说明</th><th>规则对象</th><th>规则说明</th><th>规则值</th><th>开始日期</th><th>结束日期</th><th>备注</th><th>添加日期</th></tr></thead><tbody>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td>" + rs[8] + "</td>"
                html+="<td>" + rs[9] + "</td>"
                html+="<td>" + rs[10] + "</td>"
                html+="<td>" + rs[11] + "</td>"
                html+="<td style='background-color:yellow'>" + rs[12] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td>" + rs[8] + "</td>"
                html+="<td>" + rs[9] + "</td>"
                html+="<td>" + rs[10] + "</td>"
                html+="<td>" + rs[11] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</tbody></table>"
        return HttpResponse(Context(html))
    else:
        t=get_template('mana1/delete_dhrulesYuzhi.html')
        html=t.render(Context())
        return HttpResponse(html)
Beispiel #21
0
def delete_dhrulesYuzhi(request):
    '删除暂停订货范围规则'
    if request.method == 'POST':
        value = request.POST['value']
        rs1 = trim_csv(value, itemlenth=12)
        rs2, rs1 = verifyData(rs1, length=12, required=[5, 6, 7, 8, 9])

        '是否重复'
        temp = []
        for rs in rs1:
            excode = rs[4]
            if rs[4] == u'商品代码':
                excode = 'sp'
            if rs[4] == u'品牌小类代码':
                excode = 'braxl'
            if rs[4] == u'大类代码':
                excode = 'prodl'
            if rs[4] == u'中类代码':
                excode = 'prozl'
            if rs[4] == u'小类代码':
                excode = 'proxl'
            sqlstr = u"select * from dhrulesYuzhi where mdcode='" + rs[
                0] + "' and xcode = '" + rs[
                    2] + "' and excode='" + excode + "' and startdate='" + rs[
                        8] + "' and enddate = '" + rs[9] + "'"
            if confsql.checkExist(sqlstr) <> 1:  #检查mdcode,excode,yqkey数据库是否已存在
                rs.append(u'数据库不存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '门店代码商品代码 长度检查'
        temp = []
        for rs in rs1:
            if len(rs[0]) <> 5:  #门店代码 5位
                rs.append(u'门店代码长度必须为5位!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '代码说明 检查'
        temp = []
        for rs in rs1:
            if rs[4] <> u"商品代码" and rs[4] <> u"品牌小类代码" and rs[
                    4] <> u"大类代码" and rs[4] <> u"中类代码" and rs[4] <> u"小类代码":
                rs.append(u'代码说明不符要求!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '代码 检查'
        temp = []
        for rs in rs1:
            if rs[4] == u"商品代码" or rs[4] == u"品牌小类代码" or rs[4] == u"小类代码":
                if len(rs[2]) <> 8:  #商品代码或品牌小类代码 8位
                    rs.append(u'代码长度不符!')
                    temp.append(rs)
                    rs2.append(rs)
            if rs[4] == u"中类代码":
                if len(rs[2]) <> 5:
                    rs.append(u'代码长度不符!')
                    temp.append(rs)
                    rs2.append(rs)
            if rs[4] == u"大类代码":
                if len(rs[2]) <> 2:
                    rs.append(u'代码长度不符!')
                    temp.append(rs)
                    rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '规则说明只能填相对值'
        temp = []
        for rs in rs1:
            if rs[6] <> u'相对值':
                rs.append(u'规则说明只能填“相对值”!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '规则值为百分比格式且大于0'
        temp = []
        for rs in rs1:
            if type(eval(rs[7])) <> type(1.00) or eval(rs[7]) < 0:
                rs.append(u'规则值必须为正百分比格式!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '开始日期格式检查'
        temp = []
        for rs in rs1:
            m = re.match(r'^\w\w\w\w-\w\w-\w\w$', rs[8])
            if m == None:  #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        '结束日期格式检查'
        temp = []
        for rs in rs1:
            m = re.match(r'^\w\w\w\w-\w\w-\w\w$', rs[9])
            if m == None:  #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp) > 0:
            for rs in temp:
                rs1.remove(rs)

        html = u"<table width='1200'><thead><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>代码名称</th><th>代码说明</th><th>规则对象</th><th>规则说明</th><th>规则值</th><th>开始日期</th><th>结束日期</th><th>备注</th><th>添加日期</th></tr></thead><tbody>"
        if len(rs2) > 0:
            for rs in rs2:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td>" + rs[8] + "</td>"
                html += "<td>" + rs[9] + "</td>"
                html += "<td>" + rs[10] + "</td>"
                html += "<td>" + rs[11] + "</td>"
                html += "<td style='background-color:yellow'>" + rs[
                    12] + "</td>"
                html += "</tr>"
        if len(rs1) > 0:
            for rs in rs1:
                html += "<tr>"
                html += "<td>" + rs[0] + "</td>"
                html += "<td>" + rs[1] + "</td>"
                html += "<td>" + rs[2] + "</td>"
                html += "<td>" + rs[3] + "</td>"
                html += "<td>" + rs[4] + "</td>"
                html += "<td>" + rs[5] + "</td>"
                html += "<td>" + rs[6] + "</td>"
                html += "<td>" + rs[7] + "</td>"
                html += "<td>" + rs[8] + "</td>"
                html += "<td>" + rs[9] + "</td>"
                html += "<td>" + rs[10] + "</td>"
                html += "<td>" + rs[11] + "</td>"
                html += "<td></td>"
                html += "</tr>"
        html += "</tbody></table>"
        return HttpResponse(Context(html))
    else:
        t = get_template('mana1/delete_dhrulesYuzhi.html')
        html = t.render(Context())
        return HttpResponse(html)
Beispiel #22
0
def delete_maxminCuxiaori(request):
    '删除促销日上下限规则'
    if request.method=='POST':
        value=request.POST['value']
        rs1=trim_csv(value,itemlenth=10)
        rs2,rs1=verifyData(rs1,length=10,required=[0,2,4,5,6,7,8])

        '重复项覆盖'
        temp=[]
        for rs in rs1:
            excode=rs[4]
            if rs[4]==u'商品代码':
                excode='sp'
            if rs[4]==u'品牌小类代码':
                excode='braxl'
            if rs[4]==u'大类代码':
                excode='prodl'
            if rs[4]==u'中类代码':
                excode='prozl'
            if rs[4]==u'小类代码':
                excode='proxl'
            sqlstr=u"select * from maxminCuxiaori where mdcode='"+rs[0]+"' and xcode = '"+ rs[2] +"' and excode='"+excode+"' and startdate='"+rs[7]+"' and enddate = '" + rs[8] + "'"
            if confsql.checkExist(sqlstr)<>1: #检查mdcode,excode,yqkey数据库是否已存在
                rs.append(u'数据库中不存在!')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '门店代码商品代码 长度检查'
        temp=[]
        for rs in rs1:
            if len(rs[0])<>5: #门店代码 5位
                rs.append(u'门店代码长度必须为5位')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '代码说明 检查'
        temp=[]
        for rs in rs1:
            if rs[4] <>u"商品代码" and rs[4]<>u"品牌小类代码" and rs[4]<>u"大类代码" and rs[4]<>u"中类代码" and rs[4]<>u"小类代码":
                rs.append(u'代码说明不符要求')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '代码 检查 未考虑大,中类,小类'
        """temp=[]
        for rs in rs1:
            if len(rs[2])<>8: #商品代码或品牌小类代码 8位
                rs.append(u'商品代码或品牌小类代码长度必须为8位')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)"""

        '上下限倍数必须是数值'
        temp=[]
        for rs in rs1:
            if type(eval(rs[5]))<>type(1.00) and type(eval(rs[5]))<>type(1):
                rs.append(u'上限倍数必须是数值')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        temp=[]
        for rs in rs1:
            if type(eval(rs[6]))<>type(1.00) and type(eval(rs[6]))<>type(1):
                rs.append(u'下限倍数必须是数值')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '开始日期格式检查'
        temp=[]
        for rs in rs1:
            m=re.match(r'^\w\w\w\w-\w\w-\w\w$',rs[7])
            if m==None: #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        '结束日期格式检查'
        temp=[]
        for rs in rs1:
            m=re.match(r'^\w\w\w\w-\w\w-\w\w$',rs[8])
            if m==None: #日期格式 yyyy-mm-dd
                rs.append(u'日期格式必须为yyyy-mm-dd')
                temp.append(rs)
                rs2.append(rs)
        if len(temp)>0:
            for rs in temp:
                rs1.remove(rs)

        html=u"<table width='1200'><tr><th>门店代码</th><th>门店名称</th><th>代码</th><th>代码名称</th><th>代码说明</th><th>上限倍数</th><th>下限倍数</th><th>规则开始时间</th><th>规则结束时间</th><th>备注</th></tr>"
        if len(rs2)>0:
            for rs in rs2:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td>" + rs[8] + "</td>"
                html+="<td>" + rs[9] + "</td>"
                html+="<td style='background-color:yellow'>" + rs[10] + "</td>"
                html+="</tr>"
        if len(rs1)>0:
            for rs in rs1:
                html+="<tr>"
                html+="<td>" + rs[0] + "</td>"
                html+="<td>" + rs[1] + "</td>"
                html+="<td>" + rs[2] + "</td>"
                html+="<td>" + rs[3] + "</td>"
                html+="<td>" + rs[4] + "</td>"
                html+="<td>" + rs[5] + "</td>"
                html+="<td>" + rs[6] + "</td>"
                html+="<td>" + rs[7] + "</td>"
                html+="<td>" + rs[8] + "</td>"
                html+="<td>" + rs[9] + "</td>"
                html+="<td></td>"
                html+="</tr>"
        html+="</table>"
        return HttpResponse(Context(html))
    else:
        t=get_template('mana1/delete_maxminCuxiaori.html')
        html=t.render(Context())
        return HttpResponse(html)