提交 c9edd1d9 authored 作者: 张颂恩's avatar 张颂恩

Merge branch 'dev' of http://124.225.116.118:35236/tj_django/datacenter into dev

...@@ -225,6 +225,9 @@ urlpatterns = [ ...@@ -225,6 +225,9 @@ urlpatterns = [
#2019-12-04 #2019-12-04
url(r'^inventory/send/to/wuliu/(?P<batch_id>\d+)/$',inventory_views.send_to_wuliu), url(r'^inventory/send/to/wuliu/(?P<batch_id>\d+)/$',inventory_views.send_to_wuliu),
#lisin 2024-8-15
url(r'^inventory/stkclosingbatchdetails/$',inventory_views.stkclosingbatchdetails_list),
url(r'^inventory/stock/agents/$',inventory_views.children_stock), url(r'^inventory/stock/agents/$',inventory_views.children_stock),
url(r'^inventory/stock/agent/(?P<agt_id>\d+)/$',inventory_views.agent_stock), url(r'^inventory/stock/agent/(?P<agt_id>\d+)/$',inventory_views.agent_stock),
......
...@@ -3650,6 +3650,51 @@ def ajax_stkclosing_list(request): ...@@ -3650,6 +3650,51 @@ def ajax_stkclosing_list(request):
data['e'] = '数据丢失' data['e'] = '数据丢失'
return JsonResponse(data,safe=False) return JsonResponse(data,safe=False)
#lisin 2024-8-15 库存盘点批次明细
def stkclosingbatchdetails_list(request):
data = {'data': [], 'clmns': [], 'e': [],'subtt': ['进销存报表', '库存盘点批次明细'], 'murl': '', 'dt': True, 'add': True}
company_id=str(request.user.company.id)
ancestor_id = str(request.user.company.id)
data['murl'] = '/inventory/stkclosingbatchdetails'
dt = datetime.datetime.now().strftime('%Y-%m-%d')
dt_fr = request.GET.get('date_from', dt)
dt_to = request.GET.get('date_to', (datetime.datetime.now() + datetime.timedelta(days=1)).strftime("%Y-%m-%d"))
data["date_from"] = dt_fr
data["date_to"] = dt_to
package_units = get_package_name(ancestor_id)
cur = connection.cursor()
t = "ancestor_id = " + ancestor_id + " and tm>='" + dt_fr + "' and tm <='" + dt_to + "'"
s=f"""
SELECT
id,
( SELECT name FROM company_company WHERE id = a.company_id ),
( SELECT name FROM product_product WHERE id = a.product_id ),
label_code,
case when label_pkg = 3 then '{package_units[2]}' when label_pkg = 2 then '{package_units[1]}' else '{package_units[0]}' end,
(select name from inventory_storehouse where id=a.store_id),
to_char(tm,'yyyy-mm-dd HH24:MI:SS'),
stkclosing_id,
closingbatch_id
FROM
inventory_stkclosingbatchdetails a
WHERE
{t}
"""
cur.execute(s)
rs = cur.fetchall()
for r in rs:
data['data'].append([
r[1],
r[2],
r[3],
r[4],
r[5] if r[5] else '/',
r[6],
r[7] if r[7] else '/',
r[8]
])
return render(request,'inventory/stkclosingbatchdetails_list.html',data)
#2019-11-16 入库,销售,转库,退库,退标 #2019-11-16 入库,销售,转库,退库,退标
#@login_required #@login_required
@login_required @login_required
......
{% load i18n %}
<script type="text/javascript">
$(document).ready(function(){
var page_length=10;
var value=[]
var table=$('#tb').DataTable({
dom: 'Bfrtip',
autoWidth: true,
pageLength: page_length,
buttons: [{extend:'excelHtml5',text: '导出到Excel'}],
language:lng,
data:{{data|safe}}
});
table.columns().every( function () {
var that = this;
$('input', this.footer() ).on( 'keyup change clear', function () {
if ( that.search() !== this.value ) {
that.search( this.value ).draw();
}
});
});
$('#data-content .btn-obj-add').click(function(){
event.preventDefault();
$.RefreshContent($(this).attr('href'));
});
{% if dt %}
$('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
$('.datepicker').datepicker('setDate',new Date());
setDatePickerZh();
$('#dt_fr').val('{{date_from}}');
$('#dt_to').val('{{date_to}}');
$('.btn-qry').click(function(){
var date_from,date_to;
date_fr=$('#dt_fr').val();
date_to=$('#dt_to').val();
var params=[];
if(date_fr!=''){params.push('date_from='+date_fr)};
if(date_to!=''){params.push('date_to='+date_to)};
if(params.length==0){
bootbox.alert("{% trans '请先输入查询条件!'%}");
}else{
$.RefreshContent('{{request.path}}?'+params.join('&'));
}
});
{% endif %}
$(".checkall").on('click',function () {
var list_before = $('.checkchild')
for (var i = 0; i < list_before.length; i++) {
if (list_before[i].checked) {
$(".checkchild").prop("checked", false);
break;
}else {
$(".checkchild").prop("checked", true);
break;
}
}
var list = $('.checkchild')
for (var i = 0; i < list.length; i++) {
if (list[i].checked) {
if (value.indexOf(parseInt(list[i].value)) !=-1) {
{#value.push(parseInt(list[i].value))#}
}else{
value.push(parseInt(list[i].value))
}
}else {
if ($.inArray(parseInt(list[i].value), value) == -1) {
//$.inArray(元素, 数组) == -1 表示要删除的元素不在原数组中
} else {
value.splice($.inArray(parseInt(list[i].value), value), 1);
}
$(".checkchild").prop("checked", false);
}
}
});
$("#tb").on('click','.checkchild',function (e){
var check = $(this).prop("checked");
if (check){
if (value.indexOf(parseInt(this.value))){
value.push(parseInt(this.value))
}
}else{
if($.inArray(parseInt(this.value), value) == -1){
//$.inArray(元素, 数组) == -1 表示要删除的元素不在原数组中
}else{
value.splice($.inArray(parseInt(this.value), value), 1);
}
}
})
var url = 'sales/activity/person_lottery_plan_batch_delete/';
$('.btn-delete-all').click(function () {
if (value.length > 0) {
var r = confirm('您确定要删除吗?');
if (r) {
console.log(value)
$.ajax({
type: 'post',
url: url,
data: {
ids: value.join(','),
delflag: 1
},
success: function (html) {
table.draw();
$.RefreshContent('/sales/activity/person_lottery_plan_list/')
{#$('#bg-modal .modal-body').html(html);#}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert('连接服务器失败');
}
})
}
} else {
alert('请勾选需要删除的内容!')
}
})
});
function deleteItem(id){
var r = confirm('您确定要删除吗?');
if(r){
var durl = '/sales/activity/person_lottery_plan_delete/'+id+'/'
$.RefreshContent(durl);
}
}
</script>
<ol class="breadcrumb">
<li>{{subtt.0}}</li>
<li>{{subtt.1}}</li>
</ol>
{% if dt %}
<form role="form" class="form-inline" style="margin-top:0px;padding-left:10px;">
<div class="col-sm-2 input-group">
<span class="input-group-addon">{% trans "开始日期"%}</span>
<input class="datepicker form-control" id="dt_fr" />
</div>
<div class="col-sm-2 input-group">
<span class="input-group-addon">{% trans "结束日期"%}</span>
<input class="datepicker form-control" id="dt_to" />
</div>
<div class="col-sm-2 input-group">
<span class='input-group-btn'>
<a type="button" class='btn btn-primary btn-qry'>
<span class='glyphicon glyphicon-search' style='padding-right:5px;'></span>{% trans '查找' %}
</a>
</span>
</div>
</form>
<div class="clearfix"></div>
{% endif %}
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="table-responsive">
<h4>明细</h4>
<table id='tb' class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>公司名称</th>
<th>产品名称</th>
<th>标签号</th>
<th>标签类型</th>
<th>仓库</th>
<th>时间</th>
<th>所属会计期</th>
<th>批次id</th>
</tr>
</thead>
<tbody></tbody>
<tfoot>
<th><input type="text" placeholder="公司名称"></th>
<th><input type="text" placeholder="产品名称"></th>
<th><input type="text" placeholder="标签号"></th>
<th><input type="text" placeholder="标签类型"></th>
<th><input type="text" placeholder="仓库"></th>
<th><input type="text" placeholder="时间"></th>
<th><input type="text" placeholder="所属会计期"></th>
<th><input type="text" placeholder="批次id"></th>
</tfoot>
</table>
</div>
</div>
</div>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论