Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
ypt_mgw_local
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
苏星豪
ypt_mgw_local
Commits
121ef23a
提交
121ef23a
authored
1月 26, 2024
作者:
Chris Harris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add: 易臻增加单行入库功能
上级
c58dc056
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
4 行删除
+75
-4
views.py
mes/views.py
+45
-3
product_bind.html
templates/mes/product_bind.html
+30
-1
没有找到文件。
mes/views.py
浏览文件 @
121ef23a
...
...
@@ -2053,7 +2053,8 @@ def product_bind(request,action,what=None):
cid
=
str
(
u
.
company_id
)
dt
=
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
dt_fr
=
request
.
GET
.
get
(
'dt_fr'
,
dt
)
dt_to
=
request
.
GET
.
get
(
'dt_to'
,
dt
)
dt_to
=
request
.
GET
.
get
(
'dt_to'
,
dt
)
single_inbound
=
str
(
request
.
GET
.
get
(
'singleInbound'
))
.
lower
()
==
"true"
cur
=
connection
.
cursor
()
sWhere
=
" where company_id="
+
cid
+
" and is_delete=false and (dt between '"
+
dt_fr
+
"' and '"
+
dt_to
+
"') "
#and inbound=false
...
...
@@ -2083,7 +2084,36 @@ def product_bind(request,action,what=None):
"group by prd_line,batch_no,store_id,product_id,carton_code,dt"
+
\
") h "
+
\
"group by prd_line,batch_no,store_id,product_id,dt"
+
\
") g"
") g"
if
cid
.
__eq__
(
19267
):
data
=
{
'data'
:
[],
'clmns'
:
[
'日期'
,
'生产时间'
,
'产品'
,
'包装规格'
,
'生产批次号'
,
'仓库'
,
'产量'
,
'待入库'
,
'备注'
,
'单行入库'
],
'dt_fr'
:
dt_fr
,
'dt_to'
:
dt_to
,
'qty_uninbound'
:
0
}
s
=
"select to_char(g.dt,'yyyy-mm-dd'),to_char(tm1,'HH24:MI:SS')||'--'||to_char(tm2,'HH24:MI:ss'),"
+
\
"coalesce(prd_line,''),coalesce((select name from product_product where id=product_id),''),"
+
\
"coalesce(batch_no,''),coalesce((select name from inventory_storehouse where id=store_id),''),qty,lv,"
+
\
"(select count(*) from mes_labelbindhx"
+
sWhere
+
" and inbound=false "
+
\
"and product_id=g.product_id and batch_no=g.batch_no and store_id=g.store_id and dt=g.dt)+"
+
\
"(select count(*) from mes_labelbindpx"
+
sWhere
+
" and inbound=false "
+
\
"and product_id=g.product_id and batch_no=g.batch_no and store_id=g.store_id and dt=g.dt) qty_inbound, "
+
\
"q0,coalesce((SELECT value FROM product_productprop where company_id="
+
cid
+
" and categoryprop_id="
+
\
"(SELECT id FROM company_categoryprop where name='package' "
+
\
"and category_id=(select category_id from company_company where id="
+
cid
+
")) "
+
\
"and id in (select prd_property_id from product_prdprops where product_id=g.product_id) limit 1),''),g.dt,product_id,store_id "
+
\
"from "
+
\
"(select min(tm1) tm1,max(tm2) tm2,prd_line,batch_no,store_id,product_id,count(*) qty,'三级绑定' lv,sum(q0) q0,dt from "
+
\
"(select min(tm) tm1,max(tm) tm2,prd_line,batch_no,store_id,product_id,carton_code,count(*) q0,dt FROM mes_labelbindhx"
+
sWhere
+
\
"group by prd_line,batch_no,store_id,product_id,carton_code,dt"
+
\
") h "
+
\
"group by prd_line,batch_no,store_id,product_id,dt "
+
\
"union all "
+
\
"select min(tm1) tm1,max(tm2) tm2,prd_line,batch_no,store_id,product_id,count(*) qty,'二级绑定' lv,sum(q0),dt from "
+
\
"(select min(tm) tm1,max(tm) tm2,prd_line,batch_no,store_id,product_id,carton_code,count(*) q0,dt FROM mes_labelbindpx"
+
sWhere
+
\
"group by prd_line,batch_no,store_id,product_id,carton_code,dt"
+
\
") h "
+
\
"group by prd_line,batch_no,store_id,product_id,dt"
+
\
") g"
# 2023-10-18
if
cid
in
[
'180087'
,]:
...
...
@@ -2149,7 +2179,11 @@ def product_bind(request,action,what=None):
if
cid
==
'180087'
:
q1
=
q1
.
replace
(
'箱'
,
'大袋'
)
.
replace
(
'盒'
,
'小袋'
)
q2
=
q2
.
replace
(
'箱'
,
'大袋'
)
.
replace
(
'盒'
,
'小袋'
)
data
[
'data'
]
.
append
([
r
[
0
],
r
[
1
],
r
[
3
],
r
[
10
],
r
[
4
],
r
[
12
],
r
[
5
],
q1
,
q2
,
r
[
7
]
])
data
[
'data'
]
.
append
([
r
[
0
],
r
[
1
],
r
[
3
],
r
[
10
],
r
[
4
],
r
[
12
],
r
[
5
],
q1
,
q2
,
r
[
7
]
])
elif
cid
.
__eq__
(
19267
):
btn_html
=
"<a type=
\"
button
\"
id='btn-single-inbound' class='btn btn-primary'>入库本行</a>"
\
if
int
(
qty_in
/
int
(
a
[
1
]))
else
"已入库"
data
[
'data'
]
.
append
([
r
[
0
],
r
[
1
],
r
[
3
],
r
[
10
],
r
[
4
],
r
[
5
],
q1
,
q2
,
r
[
7
],
btn_html
,
r
[
-
2
],
r
[
-
1
]])
else
:
data
[
'data'
]
.
append
([
r
[
0
],
r
[
1
],
r
[
3
],
r
[
10
],
r
[
4
],
r
[
5
],
q1
,
q2
,
r
[
7
]
])
...
...
@@ -2187,6 +2221,14 @@ def product_bind(request,action,what=None):
data
[
'data'
]
.
append
([
r
[
0
],
str
(
r
[
1
])
+
"--"
+
str
(
r
[
2
]),
r
[
3
],
r
[
4
],
r
[
5
],
''
])
return
render
(
request
,
'mes/product_bind.html'
,
data
)
elif
action
==
'inbound'
:
if
single_inbound
:
# prd_line, batch_no, store_id, product_id, dt
batch_no
=
request
.
GET
.
get
(
'batchNo'
,
''
)
store_id
=
request
.
GET
.
get
(
'storeId'
,
'0'
)
product_id
=
request
.
GET
.
get
(
'productId'
,
'0'
)
dt
=
request
.
GET
.
get
(
'dt'
,
dt
)
sWhere
=
(
f
" WHERE company_id = {cid} AND is_delete = FALSE AND dt = '{dt}' AND batch_no = '{batch_no}' AND "
f
"store_id = {store_id} AND product_id = {product_id}"
)
d
=
[]
# 将生产的产品按批次入库
tbs
=
[
'mes_labelbindhx'
,
'mes_labelbindpx'
]
...
...
templates/mes/product_bind.html
浏览文件 @
121ef23a
...
...
@@ -79,7 +79,36 @@
});
});
const
rowData
=
{{
data
|
safe
}}
table
.
on
(
"click"
,
"#btn-single-inbound"
,
function
(
e
)
{
e
.
preventDefault
();
const
thisRow
=
rowData
[
table
.
row
(
$
(
this
).
closest
(
'tr'
)).
index
()];
const
url
=
'/mes/product/bind/inbound'
;
const
data
=
{
singleInbound
:
true
,
dt
:
thisRow
[
0
],
batchNo
:
thisRow
[
4
],
productId
:
thisRow
[
10
],
storeId
:
thisRow
[
11
]
};
console
.
log
(
data
);
$
.
ajax
({
type
:
"get"
,
url
:
url
,
data
:
data
,
dataType
:
'json'
,
success
:
function
(
res
){
console
.
log
(
res
);
$
(
'.btn-qry'
).
trigger
(
'click'
);
},
error
:
function
(
XMLHttpRequest
,
textStatus
,
errorThrown
)
{
alert
(
'连接服务器失败'
);
}
});
});
});
</script>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论