Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
ypt_mgw_local
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
苏星豪
ypt_mgw_local
Commits
9dc2e6f2
提交
9dc2e6f2
authored
8月 28, 2024
作者:
李思鑫
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add:包材管理可编辑
上级
85084238
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
109 行增加
和
94 行删除
+109
-94
urls.py
datacenter/urls.py
+3
-2
forms.py
mes/forms.py
+3
-1
models.py
mes/models.py
+1
-1
views.py
mes/views.py
+0
-0
packaging_instore_edit.html
templates/mes/packaging_instore_edit.html
+54
-40
packaging_purchase_edit.html
templates/mes/packaging_purchase_edit.html
+0
-12
packaging_receive.html
templates/mes/packaging_receive.html
+37
-36
views.py
utils/views.py
+11
-2
没有找到文件。
datacenter/urls.py
浏览文件 @
9dc2e6f2
...
...
@@ -1223,14 +1223,15 @@ urlpatterns = [
#lisin 2024-08-23 包材管理相关
url
(
r'^packaging/supplier/manage/(?P<id>\d+)/$'
,
list_views
.
packaging_supplier_manage
),
url
(
r'^mes/query/packaging/purchase/$'
,
mes_views
.
packaging_purchase_query
),
url
(
r'^mes/packaging/purchase/list/$'
,
mes_views
.
packaging_purchase_list
),
url
(
r'^mes/packaging/purchase/list/$'
,
mes_views
.
packaging_purchase_list
),
url
(
r'^mes/packaging/purchase/edit/$'
,
mes_views
.
packaging_purchase_edit
),
url
(
r'^mes/packaging/purchase/edit/(?P<id>\d+)/$'
,
mes_views
.
packaging_purchase_edit
),
url
(
r'^mes/packaging/instore/list/$'
,
mes_views
.
packaging_instore_list
),
url
(
r'^mes/packaging/instore/edit/$'
,
mes_views
.
packaging_instore_edit
),
url
(
r'^mes/packaging/instore/edit/(?P<id>\d+)/$'
,
mes_views
.
packaging_instore_edit
),
url
(
r'^mes/packaging/inventory/(?P<what>\w+)/$'
,
mes_views
.
packaging_inventory
),
url
(
r'^mes/packaging/receive/list/$'
,
mes_views
.
packaging_receive_list
),
#
url(r'^mes/packaging/receive/$', mes_views.packaging_receive),
url
(
r'^mes/packaging/receive/$'
,
mes_views
.
packaging_receive
),
url
(
r'^mes/packaging/receive/(?P<id>\d+)/$'
,
mes_views
.
packaging_receive
),
...
...
mes/forms.py
浏览文件 @
9dc2e6f2
...
...
@@ -231,6 +231,7 @@ class PackagingPurchaseRecordForm(ModelForm):
model
=
PackagingPurchasRecord
fields
=
'__all__'
widgets
=
{
'code'
:
forms
.
TextInput
(
attrs
=
{
'readonly'
:
'readonly'
}),
'company'
:
forms
.
HiddenInput
(),
}
...
...
@@ -247,7 +248,7 @@ class PackagingInstoreForm(ModelForm):
widgets
=
{
'code'
:
forms
.
TextInput
(
attrs
=
{
'readonly'
:
'readonly'
}),
'company'
:
forms
.
HiddenInput
(),
#
'Packaging':forms.HiddenInput()
'Packaging'
:
forms
.
HiddenInput
()
}
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -266,6 +267,7 @@ class PackagingReceiveForm(ModelForm):
model
=
PackagingReceive
fields
=
'__all__'
widgets
=
{
'code'
:
forms
.
TextInput
(
attrs
=
{
'readonly'
:
'readonly'
}),
'company'
:
forms
.
HiddenInput
(),
}
...
...
mes/models.py
浏览文件 @
9dc2e6f2
...
...
@@ -229,7 +229,7 @@ class PackagingPurchasRecord(models.Model):
class
Meta
:
verbose_name
=
_
(
'包材采购记录'
)
verbose_name_plural
=
_
(
'包材采购记录'
)
unique_together
=
(
"company"
,
"packaging"
,
"
vendor
"
)
unique_together
=
(
"company"
,
"packaging"
,
"
code
"
)
def
__str__
(
self
):
return
self
.
name
...
...
mes/views.py
浏览文件 @
9dc2e6f2
差异被折叠。
点击展开。
templates/mes/packaging_instore_edit.html
浏览文件 @
9dc2e6f2
...
...
@@ -11,9 +11,6 @@
{% block js %}
{{ block.super }}
$('.btn-save').click(function(){
$.SubmitForm('#obj_form form','{{request.path}}');
});
{% endblock %}
...
...
@@ -31,51 +28,55 @@
{% block form_content %}
{{ block.super }}
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
//生成设置 日期编码
var
now
=
new
Date
();
var
year
=
String
(
now
.
getFullYear
());
var
month
=
String
(
now
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 月份从0开始,需要加1并补零
var
day
=
String
(
now
.
getDate
()).
padStart
(
2
,
'0'
);
var
hours
=
String
(
now
.
getHours
()).
padStart
(
2
,
'0'
);
var
minutes
=
String
(
now
.
getMinutes
()).
padStart
(
2
,
'0'
);
var
seconds
=
String
(
now
.
getSeconds
()).
padStart
(
2
,
'0'
);
var
defaultCodeValue
=
'RK'
+
year
+
month
+
day
+
hours
+
minutes
+
seconds
;
$
(
'#id_code'
).
val
(
defaultCodeValue
);
//编辑 回显查询采购记录
var
purchase_id
=
$
(
'#id_packaging_purchas'
).
val
()
*
1
var
instore_id
=
$
(
'#id_instore'
).
val
()
var
before_instore_num
=
$
(
'#id_instore_num'
).
val
()?
$
(
'#id_instore_num'
).
val
()
*
1
:
0
//编辑前入库数量
console
.
log
(
'instore_id'
,
instore_id
)
if
(
purchase_id
){
queryPackagingPurchaseById
({
purchase_id
,
instore_id
})
}
//入库数量校验
$
(
'#id_instore_num'
).
on
(
'input'
,
function
(){
var
purchase_num
=
$
(
'#qty
'
).
val
()
*
1
;
var
in
store_num
=
$
(
this
).
val
()
*
1
;
function
validateForm
()
{
var
purchase_num
=
$
(
'#qty'
).
val
()
*
1
;
var
instore_num
=
$
(
'#id_instore_num
'
).
val
()
*
1
;
var
in
ventory_num
=
$
(
'#packaging_inventory'
).
val
()
*
1
;
var
yet_instore_num
=
$
(
'#yet_instore_num'
).
val
()
*
1
;
var
can_instore_num
=
purchase_num
-
yet_instore_num
;
//可入库数量
console
.
log
(
can_instore_num
,
yet_instore_num
)
var
max_num
=
purchase_num
-
yet_instore_num
;
//可入库数量 最大
var
max_min
=
(
before_instore_num
-
inventory_num
)
>
0
?
(
before_instore_num
-
inventory_num
)
:
0
;
//可入库数量 最小
if
(
purchase_num
&&
instore_num
){
if
(
instore_num
>
can_instore_num
){
toastr
.
error
(
'入库数量不能大于'
+
can_instore_num
);
$
(
'#id_instore_num'
).
val
(
''
);
}
if
(
instore_num
>
max_num
){
toastr
.
error
(
'入库数量不能大于'
+
max_num
);
$
(
'#id_instore_num'
).
val
(
""
)
return
false
;
}
}
if
(
purchase_id
&&
instore_num
<
max_min
){
//编辑修改
toastr
.
error
(
'入库数量不能小于'
+
max_min
);
$
(
'#id_instore_num'
).
val
(
""
)
return
false
;
}
}
)
return
true
;
}
// 监听code字段的变化
$
(
'#id_packaging_purchas'
).
on
(
'change'
,
function
()
{
var
id
=
$
(
this
).
val
();
console
.
log
(
'codeValue--'
,
id
)
// 发送AJAX请求获取相关数据
$
.
ajax
({
var
purchase_id
=
$
(
this
).
val
()
*
1
;
queryPackagingPurchaseById
({
purchase_id
,
instore_id
})
});
function
queryPackagingPurchaseById
(
data
=
{}){
$
.
ajax
({
url
:
'/mes/query/packaging/purchase/'
,
method
:
'GET'
,
data
:
{
id
:
id
}
,
data
:
data
,
success
:
function
(
response
)
{
// 在页面上显示相关数据
console
.
log
(
'packagingPurchasRecord'
,
response
)
const
{
dt
,
qty
,
yet_instore_num
,
qty
,
yet_instore_num
,
packaging_inventory
,
packaging_id
,
packaging_code
,
packaging_name
,
packaging_specification
,
vendor_name
}
=
response
...
...
@@ -87,16 +88,25 @@
$
(
'#vendor_name'
).
val
(
vendor_name
);
$
(
'#qty'
).
val
(
qty
);
$
(
'#yet_instore_num'
).
val
(
yet_instore_num
);
$
(
'#packaging_inventory'
).
val
(
packaging_inventory
);
},
error
:
function
(
xhr
,
status
,
error
)
{
console
.
error
(
'AJAX请求失败:'
,
error
);
}
});
}
);
});
}
// 表单提交时的数据校验
$
(
'.btn-save'
).
on
(
'click'
,
function
(
event
)
{
if
(
!
validateForm
())
{
event
.
preventDefault
();
// 阻止表单提交
}
else
{
$
.
SubmitForm
(
'#obj_form form'
,
'{{request.path}}'
);
}
});
});
</script>
<input
type=
'hidden'
type=
"number"
value=
"{{instore_id}}"
name=
"id_instore"
id=
"id_instore"
/>
<input
type=
'hidden'
type=
"number"
value=
""
name=
"packaging"
id=
"id_packaging"
/>
<div
class=
"form-group "
>
<label
class=
"col-sm-2 control-label "
>
{% trans '入库编码:' %}
</label>
...
...
@@ -147,10 +157,14 @@
</div>
</div>
<div
class=
"form-group "
>
<label
class=
"col-sm-
2 control-label "
>
{% trans '已入库
数量:' %}
</label>
<div
class=
"col-sm-
10
"
>
<label
class=
"col-sm-
1 control-label "
>
{% trans '采购单已入
数量:' %}
</label>
<div
class=
"col-sm-
5
"
>
<input
type=
"text"
disabled
name=
'yet_instore_num'
id=
'yet_instore_num'
/>
</div>
<label
class=
"col-sm-1 control-label "
>
{% trans '库数量:' %}
</label>
<div
class=
"col-sm-5"
>
<input
type=
"text"
disabled
name=
'packaging_inventory'
id=
'packaging_inventory'
/>
</div>
</div>
<div
class=
"form-group "
>
...
...
@@ -162,7 +176,7 @@
<div
class=
"col-sm-10"
>
{{ form.remark }}
</div>
</div>
<div>
<a
class=
"btn btn-primary btn-save"
type=
"
submit
"
style=
"float:right;"
>
{% trans '保存' %}
</a>
<a
class=
"btn btn-primary btn-save"
type=
"
button
"
style=
"float:right;"
>
{% trans '保存' %}
</a>
</div>
{% endblock %}
templates/mes/packaging_purchase_edit.html
浏览文件 @
9dc2e6f2
...
...
@@ -33,18 +33,6 @@
{{ block.super }}
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
//生成设置 日期编码
var
now
=
new
Date
();
var
year
=
String
(
now
.
getFullYear
());
var
month
=
String
(
now
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 月份从0开始,需要加1并补零
var
day
=
String
(
now
.
getDate
()).
padStart
(
2
,
'0'
);
var
hours
=
String
(
now
.
getHours
()).
padStart
(
2
,
'0'
);
var
minutes
=
String
(
now
.
getMinutes
()).
padStart
(
2
,
'0'
);
var
seconds
=
String
(
now
.
getSeconds
()).
padStart
(
2
,
'0'
);
var
defaultCodeValue
=
'CG'
+
year
+
month
+
day
+
hours
+
minutes
+
seconds
;
$
(
'#id_code'
).
val
(
defaultCodeValue
);
function
calculateTotalPrice
()
{
var
qty
=
parseFloat
(
$
(
'#id_qty'
).
val
())
||
0
;
var
unitPrice
=
parseFloat
(
$
(
'#id_unit_price'
).
val
())
||
0
;
...
...
templates/mes/packaging_receive.html
浏览文件 @
9dc2e6f2
...
...
@@ -33,18 +33,13 @@
{{ block.super }}
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
//生成设置 日期编码
var
now
=
new
Date
();
var
year
=
String
(
now
.
getFullYear
());
var
month
=
String
(
now
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
);
// 月份从0开始,需要加1并补零
var
day
=
String
(
now
.
getDate
()).
padStart
(
2
,
'0'
);
var
hours
=
String
(
now
.
getHours
()).
padStart
(
2
,
'0'
);
var
minutes
=
String
(
now
.
getMinutes
()).
padStart
(
2
,
'0'
);
var
seconds
=
String
(
now
.
getSeconds
()).
padStart
(
2
,
'0'
);
var
defaultCodeValue
=
'LY'
+
year
+
month
+
day
+
hours
+
minutes
+
seconds
;
$
(
'#id_code'
).
val
(
defaultCodeValue
);
//初始化
var
id
=
$
(
'#id_packaging'
).
val
();
var
edit_receive_num
=
$
(
'#id_receive_num'
).
val
()
*
1
;
if
(
id
)
{
packagingInventoreByid
(
id
)
}
//库存数量校验
$
(
'#id_receive_num'
).
on
(
'input'
,
function
(){
var
inventory_num
=
$
(
'#inventory_num'
).
val
()
*
1
;
...
...
@@ -59,32 +54,38 @@
//根据包材id 查询库存、包材信息
$
(
'#id_packaging'
).
on
(
'change'
,
function
()
{
var
id
=
$
(
this
).
val
();
console
.
log
(
'codeValue--'
,
id
)
// 发送AJAX请求获取相关数据
packagingInventoreByid
(
id
)
});
//查询库存、包材信息
function
packagingInventoreByid
(
id
){
$
.
ajax
({
url
:
'/mes/packaging/inventory/query/'
,
method
:
'GET'
,
data
:
{
id
:
id
},
success
:
function
(
response
)
{
// 在页面上显示相关数据
console
.
log
(
'packagingPurchasRecord'
,
response
)
const
{
dt
,
inventory_num
,
packaging_code
,
packaging_name
,
packaging_specification
,
vendor_name
}
=
response
$
(
'#dt'
).
val
(
dt
);
$
(
'#packaging_code'
).
val
(
packaging_code
);
$
(
'#packaging_name'
).
val
(
packaging_name
);
$
(
'#packaging_specification'
).
val
(
packaging_specification
);
$
(
'#inventory_num'
).
val
(
inventory_num
);
},
error
:
function
(
xhr
,
status
,
error
)
{
console
.
error
(
'AJAX请求失败:'
,
error
);
}
url
:
'/mes/packaging/inventory/query/'
,
method
:
'GET'
,
data
:
{
id
:
id
},
success
:
function
(
response
)
{
// 在页面上显示相关数据
console
.
log
(
'packagingPurchasRecord'
,
response
)
let
{
dt
,
inventory_num
,
packaging_code
,
packaging_name
,
packaging_specification
,
vendor_name
}
=
response
//之前领取的数量要加回库存 才是真实的可编辑领取数量
if
(
edit_receive_num
)
inventory_num
+=
edit_receive_num
$
(
'#dt'
).
val
(
dt
);
$
(
'#packaging_code'
).
val
(
packaging_code
);
$
(
'#packaging_name'
).
val
(
packaging_name
);
$
(
'#packaging_specification'
).
val
(
packaging_specification
);
$
(
'#inventory_num'
).
val
(
inventory_num
);
},
error
:
function
(
xhr
,
status
,
error
)
{
console
.
error
(
'AJAX请求失败:'
,
error
);
}
});
}
);
}
});
</script>
...
...
utils/views.py
浏览文件 @
9dc2e6f2
...
...
@@ -1709,4 +1709,14 @@ def block_consumer(consumer_id, ancestor_id, reason, jmcpid = ''):
r
=
cur
.
fetchone
()
if
not
r
:
cur
.
execute
(
f
"insert into z_consumer_blacklist (consumer_id, ancestor_id, reason) values ({str(consumer_id)},{str(ancestor_id)},'{reason}')"
)
cur
.
execute
(
f
"insert into z_consumer_blacklist_record (consumer_id, ancestor_id, reason, jmcpid) values ({str(consumer_id)},{str(ancestor_id)},'{reason}','{jmcpid}')"
)
\ No newline at end of file
cur
.
execute
(
f
"insert into z_consumer_blacklist_record (consumer_id, ancestor_id, reason, jmcpid) values ({str(consumer_id)},{str(ancestor_id)},'{reason}','{jmcpid}')"
)
# 创建编码
def
create_code
(
prefix
):
now
=
datetime
.
datetime
.
now
()
formatted_time
=
now
.
strftime
(
"
%
Y
%
m
%
d
%
H
%
M
%
S"
)
if
prefix
:
return
f
"{prefix}{formatted_time}"
return
formatted_time
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论