Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
Laisi_AutoMES2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiawei.su
Laisi_AutoMES2
Commits
17f44366
Commit
17f44366
authored
Jan 27, 2021
by
yucheng.jiang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.siger-data.com:9000/jiawei.su/Laisi_AutoMES2
parents
0912a2a0
7864f19f
Hide whitespace changes
Inline
Side-by-side
Showing
77 changed files
with
3699 additions
and
463 deletions
+3699
-463
en-US.js
Html/src/locale/lang/en-US.js
+7
-2
zh-CN.js
Html/src/locale/lang/zh-CN.js
+8
-2
lineMonitor.vue
Html/src/view/flm/statistical_analysis/lineMonitor.vue
+0
-16
feedingBlanking.vue
Html/src/view/fml/operation_manage/feedingBlanking.vue
+34
-15
lineMonitor.vue
Html/src/view/fml/statistical_analysis/lineMonitor.vue
+118
-44
taskList.vue
Html/src/view/fml/statistical_analysis/taskList.vue
+232
-49
assemblyInfo.vue
Html/src/view/fms/associate/assemblyInfo.vue
+238
-50
associateProduct.vue
Html/src/view/fms/associate/associateProduct.vue
+13
-13
accountInfo.vue
Html/src/view/fms/config/accountInfo.vue
+13
-13
typeMaintenance.vue
Html/src/view/fms/config/typeMaintenance.vue
+13
-13
datasearch.vue
Html/src/view/qms/analysis/datasearch.vue
+8
-4
collection.vue
Html/src/view/qms/manual/collection.vue
+3
-4
storageInfoQuery.vue
Html/src/view/wms/whStatusQuery/storageInfoQuery.vue
+14
-14
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+244
-60
AutomationLocationController.cs
.../Siger.ApiACC/Controllers/AutomationLocationController.cs
+101
-7
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+77
-22
AutomationStateController.cs
...pis/Siger.ApiACC/Controllers/AutomationStateController.cs
+102
-0
FixtureToolsAssemblyController.cs
...iger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
+171
-13
FixtureToolsController.cs
...r/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
+57
-20
FixtureToolsProductController.cs
...Siger.ApiACC/Controllers/FixtureToolsProductController.cs
+60
-2
QmsCheckController.cs
Server/Apis/Siger.ApiACC/Controllers/QmsCheckController.cs
+364
-0
UploadController.cs
Server/Apis/Siger.ApiACC/Controllers/UploadController.cs
+159
-1
DownloadController.cs
Server/Apis/Siger.ApiConfig/Controller/DownloadController.cs
+4
-1
LocationController.cs
Server/Apis/Siger.ApiWMS/Controllers/LocationController.cs
+4
-5
DictKeyValConst.cs
...ommon/Siger.Middlelayer.Share/Constant/DictKeyValConst.cs
+5
-0
CommonEnum.cs
Server/Common/Siger.Middlelayer.Share/Enum/CommonEnum.cs
+1
-0
AccEnum.cs
...Common/Siger.Middlelayer.Share/Enum/ModuleEnum/AccEnum.cs
+5
-1
Automation.cs
...mon/Siger.Middlelayer.Share/Enum/ModuleEnum/Automation.cs
+7
-5
RequestEnum.cs
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
+4
-1
FixtureTools.cs
.../Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
+189
-13
ManualCollectionList.cs
...iddlelayer.Utility/ImportEntities/ManualCollectionList.cs
+2
-3
siger_automation_fixture_tools_monitor.cs
...sitory/Entities/siger_automation_fixture_tools_monitor.cs
+4
-0
siger_automation_location.cs
...layer.AccRepository/Entities/siger_automation_location.cs
+31
-0
siger_automation_task_list.cs
...ayer.AccRepository/Entities/siger_automation_task_list.cs
+5
-0
siger_check_sn_list.cs
...Middlelayer.AccRepository/Entities/siger_check_sn_list.cs
+31
-0
siger_check_sn_trace_detail.cs
...yer.AccRepository/Entities/siger_check_sn_trace_detail.cs
+46
-0
siger_check_sn_trace_file.cs
...layer.AccRepository/Entities/siger_check_sn_trace_file.cs
+24
-0
siger_check_sn_trace_inspection.cs
...AccRepository/Entities/siger_check_sn_trace_inspection.cs
+108
-0
siger_qms_inspection_standard.cs
...r.AccRepository/Entities/siger_qms_inspection_standard.cs
+2
-0
AutomationFixtureToolsAssemblyRepository.cs
.../Repositories/AutomationFixtureToolsAssemblyRepository.cs
+178
-20
AutomationFixtureToolsCategoryRepository.cs
.../Repositories/AutomationFixtureToolsCategoryRepository.cs
+65
-3
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+116
-5
AutomationFixtureToolsRepository.cs
...pository/Repositories/AutomationFixtureToolsRepository.cs
+81
-6
AutomationLocationRepository.cs
...ccRepository/Repositories/AutomationLocationRepository.cs
+95
-15
AutomationMachineStatusRepository.cs
...ository/Repositories/AutomationMachineStatusRepository.cs
+31
-0
AutomationTaskListRepository.cs
...ccRepository/Repositories/AutomationTaskListRepository.cs
+92
-4
CheckSnListRepository.cs
...layer.AccRepository/Repositories/CheckSnListRepository.cs
+27
-0
CheckSnTraceDetailRepository.cs
...ccRepository/Repositories/CheckSnTraceDetailRepository.cs
+14
-0
CheckSnTraceFileRepository.cs
....AccRepository/Repositories/CheckSnTraceFileRepository.cs
+14
-0
CheckSnTraceInspectionRepository.cs
...pository/Repositories/CheckSnTraceInspectionRepository.cs
+14
-0
InspectStandardRepository.cs
...r.AccRepository/Repositories/InspectStandardRepository.cs
+25
-2
IAutomationFixtureToolsAssemblyRepository.cs
...es/Interface/IAutomationFixtureToolsAssemblyRepository.cs
+5
-2
IAutomationFixtureToolsCategoryRepository.cs
...es/Interface/IAutomationFixtureToolsCategoryRepository.cs
+5
-1
IAutomationFixtureToolsProductRepository.cs
...ies/Interface/IAutomationFixtureToolsProductRepository.cs
+13
-1
IAutomationFixtureToolsRepository.cs
...positories/Interface/IAutomationFixtureToolsRepository.cs
+5
-2
IAutomationLocationRepository.cs
...y/Repositories/Interface/IAutomationLocationRepository.cs
+4
-1
IAutomationMachineStatus.cs
...sitory/Repositories/Interface/IAutomationMachineStatus.cs
+2
-0
IAutomationTaskListRepository.cs
...y/Repositories/Interface/IAutomationTaskListRepository.cs
+6
-1
ICheckSnListRepository.cs
...pository/Repositories/Interface/ICheckSnListRepository.cs
+11
-0
ICheckSnTraceDetailRepository.cs
...y/Repositories/Interface/ICheckSnTraceDetailRepository.cs
+9
-0
ICheckSnTraceFileRepository.cs
...ory/Repositories/Interface/ICheckSnTraceFileRepository.cs
+8
-0
ICheckSnTraceInspectionRepository.cs
...positories/Interface/ICheckSnTraceInspectionRepository.cs
+9
-0
IInspectStandardRepository.cs
...tory/Repositories/Interface/IInspectStandardRepository.cs
+2
-0
RequestAddQmsCheck.cs
...r.Middlelayer.AccRepository/Request/RequestAddQmsCheck.cs
+51
-0
FixtureToolsCategory.cs
...iddlelayer.AccRepository/Response/FixtureToolsCategory.cs
+13
-0
ResponseAutomationInfo.cs
...dlelayer.AccRepository/Response/ResponseAutomationInfo.cs
+15
-0
ResponseAutomationLocation.cs
...ayer.AccRepository/Response/ResponseAutomationLocation.cs
+4
-1
ResponseAutomationMachineStatus.cs
...AccRepository/Response/ResponseAutomationMachineStatus.cs
+35
-0
ResponseAutomationTasklist.cs
...ayer.AccRepository/Response/ResponseAutomationTasklist.cs
+46
-0
ResponseProductFixtureInfo.cs
...ayer.AccRepository/Response/ResponseProductFixtureInfo.cs
+11
-0
ResponseQmsCheck.cs
...er.Middlelayer.AccRepository/Response/ResponseQmsCheck.cs
+61
-0
ApiQmsDbContext.cs
...tories/Siger.Middlelayer.QmsRepository/ApiQmsDbContext.cs
+2
-0
siger_project_beat_set.cs
...dlelayer.QmsRepository/Entities/siger_project_beat_set.cs
+96
-0
CheckSnTraceDetailRepository.cs
...msRepository/Repositories/CheckSnTraceDetailRepository.cs
+2
-2
CheckSnTraceInspectionRepository.cs
...pository/Repositories/CheckSnTraceInspectionRepository.cs
+2
-2
ResponseLoadStation.cs
...er.Middlelayer.Repository/Response/ResponseLoadStation.cs
+5
-0
DB.script
Server/Infrastructure/Script/DB.script
+17
-2
No files found.
Html/src/locale/lang/en-US.js
View file @
17f44366
...
...
@@ -716,10 +716,11 @@ export default {
'9000491'
:
'人员未找到'
,
'9000492'
:
'默认展示已存在'
,
'9000493'
:
'未找到储位类别'
,
'9000494'
:
'未找到工装类
别
'
,
'9000494'
:
'未找到工装类
型
'
,
'9000495'
:
'未找到工装信息'
,
'9000496'
:
'ID重复'
,
'9000497'
:
'父级和子级不能相同'
,
'9000498'
:
'该类型绑定了工装,不能删除'
,
'9100000'
:
'Departments cannot be empty'
,
'9100001'
:
'Position cannot be empty'
,
...
...
@@ -6650,6 +6651,10 @@ export default {
'300159'
:
'设备正在使用中'
,
'300160'
:
'任务进行中'
,
'300161'
:
'产品工装未找到'
,
'300162'
:
'未找到工装信息'
'300162'
:
'未找到工装信息'
,
'300163'
:
'设备正在空闲中'
,
'300164'
:
'设备已经生产完成'
,
'300165'
:
'该设备当前无工装状态'
,
'300166'
:
'未配置字典信息'
,
}
Html/src/locale/lang/zh-CN.js
View file @
17f44366
...
...
@@ -743,10 +743,11 @@ export default {
'9000491'
:
'人员未找到'
,
'9000492'
:
'默认展示已存在'
,
'9000493'
:
'未找到储位类别'
,
'9000494'
:
'未找到工装类
别
'
,
'9000494'
:
'未找到工装类
型
'
,
'9000495'
:
'未找到工装信息'
,
'9000496'
:
'ID重复'
,
'9000497'
:
'父级和子级不能相同'
,
'9000498'
:
'该类型绑定了工装,不能删除'
,
'9100000'
:
'部门不能为空'
,
...
...
@@ -6922,7 +6923,12 @@ export default {
'300159'
:
'设备正在使用中'
,
'300160'
:
'任务进行中'
,
'300161'
:
'产品工装未找到'
,
'300162'
:
'未找到工装信息'
'300162'
:
'未找到工装信息'
,
'300163'
:
'设备正在空闲中'
,
'300164'
:
'设备已经生产完成'
,
'300165'
:
'该设备当前无工装状态'
,
'300166'
:
'未配置字典信息'
,
...
...
Html/src/view/flm/statistical_analysis/lineMonitor.vue
deleted
100644 → 0
View file @
0912a2a0
<
template
>
<div>
产线监控管理
</div>
</
template
>
<
script
>
export
default
{
}
</
script
>
<
style
>
</
style
>
\ No newline at end of file
Html/src/view/fml/operation_manage/feedingBlanking.vue
View file @
17f44366
...
...
@@ -29,7 +29,15 @@
:class=
"
{ active: b == index }"
>
<p>
{{
item
.
title
}}
</p>
<p>
{{
item
.
status
==
1
?
"待上料"
:
"运行中"
}}
</p>
<p>
{{
item
.
status
==
1
?
"待上料"
:
orderDetail
.
status
==
2
?
"运行中"
:
"待下料"
}}
</p>
</div>
</div>
</div>
...
...
@@ -79,7 +87,13 @@
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
状态:
</span>
<span
class=
"info"
>
{{
orderDetail
.
status
orderDetail
.
status
==
1
?
"待上料"
:
orderDetail
.
status
==
2
?
"运行中"
:
orderDetail
.
status
==
3
?
"待下料"
:
""
}}
</span>
</p>
<p
class=
"flex"
>
...
...
@@ -103,7 +117,9 @@
<Button
type=
"primary"
@
click=
"feedReady()"
>
准备上料
</Button
>
<Button
type=
"primary"
>
安装完成
</Button>
<Button
type=
"primary"
@
click=
"installOver()"
>
安装完成
</Button
>
</div>
</TabPane>
<TabPane
label=
"下料"
:disabled=
"attr2"
name=
"2"
...
...
@@ -162,7 +178,9 @@
?
"待上料"
:
orderDetail
.
status
==
2
?
"运行中"
:
"待下料"
:
orderDetail
.
status
==
3
?
"待下料"
:
""
}}
</span>
</p>
<p
class=
"flex"
>
...
...
@@ -352,16 +370,17 @@ export default {
this
.
b
=
index
;
let
status
=
this
.
stationList
[
index
].
status
;
this
.
sectionid
=
this
.
stationList
[
index
].
section
;
if
(
status
==
3
)
{
this
.
attr1
=
true
;
this
.
tabindex
=
"2"
;
//
if (status == 3) {
//
this.attr1 = true;
//
this.tabindex = "2";
this
.
getRunningDetail
(
index
);
}
else
{
this
.
attr2
=
true
;
}
if
(
status
==
2
)
{
this
.
getRunningDetail
(
index
);
}
// }
// else {
// this.attr2 = true;
// }
// if (status == 2) {
// this.getRunningDetail(index);
// }
},
//获取储位
getStorages
()
{
...
...
@@ -455,13 +474,13 @@ export default {
return
false
;
}
let
data
=
{
section
:
13
,
section
:
this
.
sectionid
,
};
this
.
request
(
"/acc/AutomationOperate/CompalateAssemble"
,
data
,
"post"
).
th
ne
((
res
)
=>
{
).
th
en
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
res
.
data
.
msg
));
}
else
{
...
...
Html/src/view/fml/statistical_analysis/lineMonitor.vue
View file @
17f44366
...
...
@@ -10,6 +10,8 @@
class=
"searchSelect"
:data=
"datalevel"
:value=
"leveldata"
change-on-select
@
on-change=
"getSectionId"
></Cascader>
</div>
<div
class=
"searchBtn"
>
...
...
@@ -20,7 +22,11 @@
@
click=
"search()"
>
{{
$t
(
"1001"
)
}}
</Button
>
<Button
type=
"primary"
class=
"twoWord"
icon=
"ios-search"
@
click=
"exportExcel()"
<Button
type=
"primary"
class=
"twoWord"
icon=
"ios-search"
@
click=
"exportExcel()"
>
导出
</Button
>
</div>
...
...
@@ -28,49 +34,60 @@
</div>
<div
class=
"divborder"
>
<div
class=
"stateTitle flex"
>
<p><span>
4
</span>
生产中
</p>
<p><span>
4
</span>
待下料
</p>
<p><span>
4
</span>
待上料
</p>
<p><span>
4
</span>
不可用
</p>
<p>
<span>
{{
summary
.
waittingTotal
}}
</span
>
待上料
</p>
<p>
<span>
{{
summary
.
produceTotal
}}
</span
>
生产中
</p>
<p>
<span>
{{
summary
.
complateTotal
}}
</span
>
待下料
</p>
<p>
<span>
{{
summary
.
disableTotal
}}
</span
>
不可用
</p>
</div>
<div
class=
"stateWrap"
>
<template
v-for=
"(item,index) in stateList"
>
<div
class=
"stateItem"
:key=
"index"
>
<template
v-for=
"(item, index) in stateList"
>
<div
class=
"stateItem"
:key=
"index"
:style=
"
{ background: item.bgc,color:item.status!=0?fontColor:'' }"
>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工位:
</span>
<span
class=
"info"
>
{{
item
}}
</span>
<span
class=
"info"
>
{{
item
.
section
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
产品:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
item
.
product
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工装:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
item
.
fixtureName
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
储位:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
item
.
location
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工件:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
item
.
sn
}}
</span>
</p>
</div>
</
template
>
</div>
<Table
class=
"tableClass"
:data=
"data1"
:columns=
"columns1"
:max-height=
"200"
></Table>
<Table
class=
"tableClass"
:data=
"data1"
:columns=
"columns1"
></Table>
<div
v-show=
"show1"
>
<Table
class=
"tableClass"
:data=
"data2"
:columns=
"columns2"
:max-height=
"200"
></Table>
</div>
<div
v-show=
"show2"
>
...
...
@@ -78,7 +95,6 @@
class=
"tableClass"
:data=
"data3"
:columns=
"columns3"
:max-height=
"200"
></Table>
</div>
</div>
...
...
@@ -94,37 +110,34 @@ export default {
productionLine
:
[],
leveldata
:
[],
// 产线层级插件所需数据
datalevel
:
[],
// 产线层级选中数据
stateList
:[
0
],
stateList
:
[
0
],
columns1
:
[
{
title
:
this
.
$t
(
"1008"
),
key
:
"xuhao"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
params
.
index
+
(
this
.
page
-
1
)
*
this
.
pagesize
+
1
);
return
h
(
"span"
,
params
.
index
+
1
);
},
width
:
70
,
},
{
title
:
"产线层级"
,
key
:
"warehouse"
,
},
{
title
:
"设备"
,
key
:
"storage_sn"
,
key
:
"section"
,
},
// {
// title: "设备",
// key: "storage_sn",
// },
{
title
:
"工装编号"
,
key
:
"
install_sn
"
,
key
:
"
fixtureName
"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"a"
,
{
on
:
{
click
:
()
=>
{
this
.
show1
=
true
;
//
this.show1 = true;
},
},
},
...
...
@@ -134,18 +147,18 @@ export default {
},
{
title
:
"产品编号"
,
key
:
"
workpiece_sn
"
,
key
:
"
product
"
,
},
{
title
:
"工件编号"
,
key
:
"s
torage_s
n"
,
key
:
"sn"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"a"
,
{
on
:
{
click
:
()
=>
{
this
.
show2
=
true
;
//
this.show2 = true;
},
},
},
...
...
@@ -155,7 +168,7 @@ export default {
},
{
title
:
"状态"
,
key
:
"
install_sn
"
,
key
:
"
status
"
,
},
{
title
:
"最后更新时间"
,
...
...
@@ -297,13 +310,63 @@ export default {
data3
:
[],
show2
:
false
,
show1
:
false
,
sectionid
:
0
,
summary
:
{
complateTotal
:
0
,
disableTotal
:
0
,
produceTotal
:
0
,
waittingTotal
:
0
,
},
fontColor
:
'#fff'
};
},
created
()
{
this
.
initlevel
();
this
.
search
();
},
methods
:
{
search
()
{},
search
()
{
// 初始化产线层级
this
.
axios
.
request
({
url
:
"/acc/AutomationState/GetStationMonitor?section="
+
this
.
sectionid
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
const
arr
=
[];
if
(
res
.
data
.
ret
==
1
)
{
console
.
log
(
res
.
data
.
data
);
// this.stateList = res.data.data.dts;
let
arr
=
[];
arr
=
res
.
data
.
data
.
dts
.
length
>
0
?
res
.
data
.
data
.
dts
:
[];
arr
.
forEach
((
ele
)
=>
{
let
bgc
=
""
;
if
(
ele
.
enable
==
0
)
{
bgc
=
"red"
;
}
if
(
ele
.
status
==
1
)
{
bgc
=
"#ff9900"
;
}
if
(
ele
.
status
==
2
)
{
bgc
=
"#19be6b"
;
}
if
(
ele
.
status
==
3
)
{
bgc
=
"#2db7f5"
;
}
ele
.
bgc
=
bgc
;
});
this
.
stateList
=
arr
;
this
.
data1
=
arr
;
this
.
summary
=
res
.
data
.
data
.
sum
;
console
.
log
(
this
.
summary
);
}
});
},
initlevel
()
{
// 初始化产线层级
this
.
axios
...
...
@@ -320,7 +383,14 @@ export default {
}
});
},
exportExcel
(){
getSectionId
(
val
)
{
this
.
leveldata
=
val
;
this
.
sectionid
=
this
.
leveldata
.
length
>
0
?
this
.
leveldata
[
this
.
leveldata
.
length
-
1
]
:
0
;
},
exportExcel
()
{
let
data
=
{};
this
.
axios
.
request
({
...
...
@@ -336,7 +406,7 @@ export default {
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
}
}
,
},
};
</
script
>
...
...
@@ -347,16 +417,20 @@ export default {
}
.stateWrap
{
margin
:
20px
10px
;
display
:
flex
;
flex-wrap
:
wrap
;
}
.stateItem
{
border
:
1px
solid
#
000
;
width
:
2
00px
;
height
:
150px
;
border
:
1px
solid
#
d3d3d3
;
width
:
3
00px
;
//
height
:
150px
;
padding-left
:
10px
;
margin
:
10px
;
p
{
height
:
30px
;
line-height
:
30px
;
font-size
:
16px
;
}
}
.stateTitle
{
...
...
@@ -375,13 +449,13 @@ export default {
//
border
:
1px
solid
#333
;
}
}
p
:nth-child
(
1
)
span
{
p
:nth-child
(
3
)
span
{
background-color
:
#2db7f5
;
}
p
:nth-child
(
2
)
span
{
background-color
:
#19be6b
;
}
p
:nth-child
(
3
)
span
{
p
:nth-child
(
1
)
span
{
background-color
:
#ff9900
;
}
p
:nth-child
(
4
)
span
{
...
...
Html/src/view/fml/statistical_analysis/taskList.vue
View file @
17f44366
...
...
@@ -19,17 +19,10 @@
clearable
filterable
class=
"searchSelect"
v-model=
"taskType"
>
</Select>
</div>
<div
class=
"filter"
>
<label>
发起地:
</label>
<Select
label-in-value
clearable
filterable
class=
"searchSelect"
>
<Option
:value=
"1"
>
Load
</Option>
<Option
:value=
"2"
>
Unload
</Option>
</Select>
</div>
<div
class=
"filter"
>
...
...
@@ -39,16 +32,40 @@
clearable
filterable
class=
"searchSelect"
v-model=
"productCode"
>
<Option
v-for=
"(item, index) in productList"
:value=
"item.id"
:key=
"index"
:label=
"
item.name +
'#' +
item.code +
'#' +
item.drawingcode
"
>
{{
item
.
name
+
"#"
+
item
.
code
+
"#"
+
item
.
drawingcode
}}
</Option
>
</Select>
</div>
<div
class=
"filter"
>
<label>
任务编号:
</label>
<Input
type=
"text"
class=
"searchInput"
/>
<Input
type=
"text"
class=
"searchInput"
v-model=
"taskNumber"
/>
</div>
<div
class=
"filter"
>
<label>
工件编号:
</label>
<Input
type=
"text"
class=
"searchInput"
/>
<Input
type=
"text"
class=
"searchInput"
v-model=
"sn"
/>
</div>
<div
class=
"filter"
>
<label>
状态:
</label>
...
...
@@ -57,7 +74,12 @@
clearable
filterable
class=
"searchSelect"
v-model=
"state"
>
<Option
:value=
"1"
>
待执行
</Option>
<Option
:value=
"2"
>
执行中
</Option>
<Option
:value=
"3"
>
执行完成
</Option>
<Option
:value=
"4"
>
取消
</Option>
</Select>
</div>
<div
class=
"filter"
>
...
...
@@ -67,23 +89,30 @@
clearable
filterable
class=
"searchSelect"
v-model=
"performType"
>
<Option
:value=
"1"
>
手动执行
</Option>
<Option
:value=
"2"
>
自动执行
</Option>
</Select>
</div>
<div
class=
"filter"
>
<label>
触发时间:
</label>
<DatePicker
type=
"datetime
range
"
type=
"datetime"
placeholder=
"Select date"
style=
"width: 200px"
v-model=
"startTime"
@
on-change=
"getTime"
></DatePicker>
</div>
<div
class=
"filter"
>
<label>
完成时间:
</label>
<DatePicker
type=
"datetime
range
"
type=
"datetime"
placeholder=
"Select date"
style=
"width: 200px"
v-model=
"endTime"
@
on-change=
"getTime2"
></DatePicker>
</div>
<div
class=
"searchBtn"
>
...
...
@@ -91,24 +120,26 @@
type=
"primary"
class=
"twoWord"
icon=
"ios-search"
@
click=
"search()"
@
click=
"search(
page, pagesize
)"
>
{{
$t
(
"1001"
)
}}
</Button
>
<!-- -->
<Button
<
!--
<
Button
type=
"warning"
class=
"twoWord"
icon=
"ios-search"
@
click=
"cancel()"
>
取消
</Button
>
<!--只有状态是待执行的可以改成取消-->
>
-->
<!--只有状态是待执行的可以改成取消-->
<Button
type=
"primary"
class=
"twoWord"
icon=
"ios-
search
"
icon=
"ios-
build
"
@
click=
"manual()"
>
手动
</Button
>
<!--当生产线的模式是手动是才可以进行手动任务执行-->
>
<!--当生产线的模式是手动是才可以进行手动任务执行-->
<Button
type=
"primary"
class=
"twoWord"
...
...
@@ -120,7 +151,13 @@
</div>
</div>
<div
class=
"divborder newTableDiv"
>
<Table
class=
"tableClass"
:columns=
"columns1"
:data=
"data1"
></Table>
<Table
class=
"tableClass"
:columns=
"columns1"
:data=
"data1"
@
on-current-change=
"handleRowChange"
highlight-row
></Table>
<div
class=
"pageDiv"
>
<div
class=
"pageDirection"
>
<Page
...
...
@@ -129,6 +166,8 @@
show-elevator
show-sizer
show-total
@
on-change=
"changePage"
@
on-page-size-change=
"handlePageSize"
:page-size-opts=
"[10, 20, 30, 40, 100]"
></Page>
</div>
...
...
@@ -158,93 +197,202 @@ export default {
width
:
70
,
},
{
title
:
"任务清单"
,
key
:
"productcode"
,
title
:
"任务编号"
,
key
:
"taskno"
,
width
:
300
,
},
{
title
:
"产线层级"
,
key
:
"
productcode
"
,
key
:
"
section
"
,
},
{
title
:
"触发方"
,
key
:
"
productcode
"
,
key
:
"
trigger
"
,
},
{
title
:
"任务类型"
,
key
:
"productcode"
,
},
{
title
:
"发起地"
,
key
:
"productcode"
,
key
:
"tasktype"
,
},
{
title
:
"工件编号"
,
key
:
"
productcode
"
,
key
:
"
sn
"
,
},
{
title
:
"工单编号"
,
key
:
"
productcode
"
,
key
:
"
ordernumber
"
,
},
{
title
:
"产品编号"
,
key
:
"product
c
ode"
,
key
:
"product
C
ode"
,
},
{
title
:
"工序编号"
,
key
:
"
productcode
"
,
key
:
"
routeNo
"
,
},
{
title
:
"工序"
,
key
:
"
productcod
e"
,
key
:
"
rout
e"
,
},
{
title
:
"程序号"
,
key
:
"pro
ductcode
"
,
key
:
"pro
gram
"
,
},
{
title
:
"储位位置"
,
key
:
"
productcode
"
,
key
:
"
location
"
,
},
{
title
:
"工装编号"
,
key
:
"
productc
ode"
,
key
:
"
fixtureC
ode"
,
},
{
title
:
"动作"
,
key
:
"
productcode
"
,
key
:
"
action
"
,
},
{
title
:
"执行类型"
,
key
:
"
productcod
e"
,
key
:
"
actionTyp
e"
,
},
{
title
:
"状态"
,
key
:
"productcode"
,
key
:
"status"
,
render
:
(
h
,
params
)
=>
{
let
str
=
""
;
switch
(
params
.
row
.
status
)
{
case
1
:
str
=
"待执行"
;
break
;
case
2
:
str
=
"执行中"
;
break
;
case
3
:
str
=
"执行完成"
;
break
;
case
4
:
str
=
"取消"
;
break
;
}
return
h
(
"div"
,
str
);
},
},
{
title
:
"触发时间"
,
key
:
"
productcod
e"
,
key
:
"
triggerTim
e"
,
},
{
title
:
"完成时间"
,
key
:
"
productcod
e"
,
key
:
"
complatetim
e"
,
},
],
data1
:
[],
total
:
0
,
page
:
1
,
pagesize
:
10
,
taskType
:
0
,
from
:
0
,
productCode
:
""
,
productList
:
[],
taskNumber
:
""
,
sn
:
""
,
state
:
0
,
performType
:
0
,
startTime
:
""
,
endTime
:
""
,
detailobj
:
{},
};
},
created
()
{
this
.
columns1
=
this
.
$time
.
initTableTitle
(
this
.
columns1
);
this
.
initlevel
()
this
.
initlevel
();
this
.
iniproducts
();
this
.
search
(
1
,
10
);
},
methods
:
{
search
()
{},
cancel
()
{},
manual
()
{},
exportExcel
()
{},
search
(
page
,
pagesize
)
{
let
params
=
{
section
:
this
.
sectionId
,
tasktype
:
this
.
taskType
,
productCode
:
this
.
productCode
,
sn
:
this
.
sn
,
status
:
this
.
status
,
actionType
:
this
.
performType
,
triggertime
:
this
.
startTime
,
complatetime
:
this
.
endTime
,
page
:
page
,
pageSize
:
pagesize
,
};
this
.
axios
.
request
({
url
:
"/acc/AutomationState/GetTasklist"
,
params
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
const
arr
=
[];
if
(
res
.
data
.
ret
==
1
)
{
console
.
log
(
res
.
data
.
data
);
this
.
data1
=
res
.
data
.
data
.
data
;
}
this
.
total
=
res
.
data
.
data
.
total
;
});
},
cancel
()
{
if
(
this
.
detailobj
.
status
!=
1
)
{
this
.
$Message
.
error
(
"该任务清单状态不能取消"
);
return
false
;
}
return
;
let
data
=
{
section
:
this
.
sectionid
,
};
this
.
request
(
// "/acc/AutomationOperate/CompalateAssemble",
data
,
"post"
).
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
res
.
data
.
msg
));
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
manual
()
{
// if (this.detailobj.actiontype != 1) {
// this.$Message.error("该任务清单不能手动执行");
// return false;
// }
if
(
!
this
.
detailobj
.
id
)
{
this
.
$Message
.
error
(
this
.
$t
(
1043
));
return
false
;
}
let
data
=
{
id
:
this
.
detailobj
.
id
,
};
this
.
request
(
"/acc/AutomationOperate/Send"
,
data
,
"get"
).
then
(
(
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
res
.
data
.
msg
));
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
}
);
},
exportExcel
()
{
// this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation",
// method: "get",
// })
// .then((res) => {
// if (res.data.ret === 1) {
// window.location.href =
// this.axios.publicPath + "" + res.data.data;
// } else {
// this.$Message.error(this.$t(res.data.msg));
// }
// });
},
initlevel
()
{
// 初始化产线层级
this
.
axios
...
...
@@ -261,7 +409,31 @@ export default {
}
});
},
exportExcel
(){
iniproducts
()
{
var
params
=
{
name
:
""
,
count
:
1000000
,
};
this
.
axios
.
request
({
url
:
"/config/ProjectProduct/GetProductsByCode"
,
params
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
let
data
=
res
.
data
.
data
;
if
(
res
.
data
.
ret
===
1
)
{
this
.
productList
=
res
.
data
.
data
;
}
});
},
getTime
(
val
)
{
this
.
startTime
=
val
;
},
getTime2
(
val
)
{
this
.
endTime
=
val
;
},
exportExcel
()
{
let
data
=
{};
this
.
axios
.
request
({
...
...
@@ -277,7 +449,18 @@ export default {
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
}
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
},
handlePageSize
(
value
)
{
this
.
pagesize
=
value
;
this
.
data1
=
this
.
search
(
this
.
page
,
this
.
pagesize
);
},
changePage
(
value
)
{
this
.
page
=
value
;
this
.
data1
=
this
.
search
(
this
.
page
,
this
.
pagesize
);
},
},
};
</
script
>
...
...
Html/src/view/fms/associate/assemblyInfo.vue
View file @
17f44366
<
template
>
<div
class=
"testdiv"
>
<div
class=
"divborder"
>
<h2>
基本信息
</h2>
<div
class=
"newSearchDiv"
>
<div
class=
"filter"
>
<label>
工装类别:
</label>
...
...
@@ -41,7 +40,7 @@
type=
"primary"
class=
"twoWord"
icon=
"ios-search"
@
click=
"
search(1, 10
)"
@
click=
"
tosearch(
)"
>
{{
$t
(
"1001"
)
}}
</Button
>
<Button
...
...
@@ -72,8 +71,8 @@
@
click=
"loadExcel()"
>
{{
$t
(
"1005"
)
}}
</Button
>
<
!--
<
Upload
style=
"display:
inline-block"
<Upload
style=
"display:inline-block"
ref=
"upload"
:action=
"action"
name=
"excel-file"
...
...
@@ -82,20 +81,19 @@
:on-format-error=
"handleFormatError"
:on-success=
"handleSuccess"
:on-error=
"handleError"
:format=
"['xlsx']"
>
-->
<Button
type=
"primary"
class=
"fourWord"
icon=
"md-cloud-upload"
>
{{
$t
(
"1006"
)
}}
</Button
:format=
"['xlsx','xls']"
>
<!--
</Upload>
-->
<Button
type=
"primary"
class=
"fourWord"
icon=
"md-cloud-upload"
>
{{
$t
(
'1006'
)
}}
</Button>
</Upload>
<Button
type=
"primary"
class=
"fourWord"
icon=
"ios-cloud-download"
@
click=
"
exportEecel(
)"
@
click=
"
search(1
)"
>
{{
$t
(
"1007"
)
}}
</Button
>
</div>
...
...
@@ -107,9 +105,10 @@
:columns=
"columns1"
:data=
"data1"
highlight-row
@
on-current-change=
"handleRowChange"
@
on-row-click=
"onExpand"
></Table>
<!-- @on-row-click="onExpand" -->
<div
class=
"pageDiv"
>
<div
class=
"pageDirection"
>
<Page
...
...
@@ -139,13 +138,14 @@
<div>
正在上传...
</div>
</Spin>
<div
class=
"filter"
>
<label>
父工装类
别
:
</label>
<label>
父工装类
型
:
</label>
<Cascader
class=
"searchSelect"
:data=
"typeTree"
v-model=
"parentType"
change-on-select
@
on-change=
"getCategory1"
:disabled=
"disabled"
></Cascader>
</div>
<div
class=
"filter"
>
...
...
@@ -157,6 +157,7 @@
filterable
filter-by-label
class=
"searchSelect"
:disabled=
"disabled"
>
<Option
v-for=
"(item, index) in toolingList1"
...
...
@@ -170,7 +171,7 @@
<div
style=
"padding-left: 50px"
>
<div
class=
"filter"
>
<label>
子工装类
别
:
</label>
<label>
子工装类
型
:
</label>
<Cascader
class=
"searchSelect"
:data=
"typeTree"
...
...
@@ -203,6 +204,13 @@
<label>
备注:
</label>
<Input
type=
"text"
class=
"searchInput"
v-model=
"remark"
/>
</div>
<div
class=
"filter"
>
<label><i>
*
</i>
状态:
</label>
<RadioGroup
v-model=
"addstatus"
>
<Radio
label=
"1"
><span>
可用
</span></Radio>
<Radio
label=
"0"
><span>
停用
</span></Radio>
</RadioGroup>
</div>
<div>
<label>
上传文件:
</label>
<div
class=
"accountInfoUploadFile"
>
...
...
@@ -251,13 +259,14 @@ export default {
//导入方法
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
"
acc/Upload/UploadExcel?templateName=FixtureToolsAssmeblyTemplate
"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
nonce
:
localStorage
.
getItem
(
"nonce"
),
sign
:
localStorage
.
getItem
(
"sign"
),
},
disabled
:
false
,
columns1
:
[
{
type
:
"expand"
,
...
...
@@ -276,7 +285,13 @@ export default {
highlightRow
:
true
,
},
on
:
{
onCurrentChange
:
()
=>
{},
"on-current-change"
:
(
currentRow
,
oldCurrentRow
)
=>
{
this
.
childObj
=
{};
this
.
childObj
=
currentRow
;
},
},
});
},
...
...
@@ -402,6 +417,27 @@ export default {
title
:
"子工装编号"
,
key
:
"code"
,
},
{
title
:
"状态"
,
key
:
"status"
,
render
:
(
h
,
params
)
=>
{
let
str
=
""
;
if
(
params
.
row
.
status
===
1
)
{
str
=
"可用"
;
}
else
{
str
=
"停用"
;
}
return
h
(
"span"
,
str
);
},
},
{
title
:
"维护人"
,
key
:
"updator"
,
},
{
title
:
"维护时间"
,
key
:
"updatetime"
,
},
],
modal
:
false
,
type
:
0
,
...
...
@@ -424,74 +460,197 @@ export default {
fileurl
:
""
,
filename
:
""
,
UploadAction
:
this
.
axios
.
publicPath
+
"config/upload/UploadImage"
,
childObj
:{}
detailobj
:
{},
childObj
:
{},
addstatus
:
'1'
,
//状态 1可用 0停用
};
},
created
()
{
this
.
columns1
=
this
.
$time
.
initTableTitle
(
this
.
columns1
);
this
.
columns2
=
this
.
$time
.
initTableTitle
(
this
.
columns2
);
this
.
initFrockType
();
this
.
search
(
1
,
10
);
this
.
tosearch
(
);
},
methods
:
{
search
(
page
,
pagesize
)
{
tosearch
(){
this
.
page
=
1
;
this
.
pagesize
=
10
;
this
.
search
(
0
);
},
search
(
toexcel
)
{
let
data
=
{
category
:
this
.
categoryId
,
//工装类型id
code
:
this
.
number
,
name
:
this
.
name
,
//
state: this.state, //0停用 1可用
state
:
this
.
state
,
//0停用 1可用
page
:
this
.
page
,
pagesize
:
this
.
pagesize
,
// toexcel: 0,
//0查询 1导出
toexcel
:
toexcel
//0查询 1导出
};
this
.
request
(
"/acc/FixtureToolsAssembly/GetPageList"
,
data
,
"get"
).
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
this
.
total
=
res
.
data
.
total
;
// let arr = [];
// arr = res.data.data;
// arr.forEach(ele=>{
// ele.parentcate_guid = '';
// })
// this.data1 = arr;
console
.
log
(
this
.
data1
);
this
.
data1
=
res
.
data
.
data
;
if
(
toexcel
===
1
){
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
}
else
{
this
.
total
=
0
;
this
.
data1
=
[];
let
data
=
res
.
data
.
data
;
if
(
res
.
data
.
ret
==
1
&&
Array
.
isArray
(
data
)
&&
data
.
length
)
{
this
.
total
=
res
.
data
.
total
;
this
.
data1
=
res
.
data
.
data
;
}
}
});
},
add
()
{
this
.
parentType
=
[];
this
.
parentId
=
0
;
this
.
sonType
=
[];
this
.
sonId
=
0
;
this
.
remark
=
""
;
this
.
fileurl
=
""
;
this
.
filename
=
""
;
this
.
modal
=
true
;
this
.
toolingId2
=
0
;
this
.
disabled
=
false
;
if
(
!
this
.
detailobj
.
id
)
{
this
.
parentType
=
[];
this
.
parentId
=
0
;
}
else
{
this
.
parentType
=
this
.
detailobj
.
categoryids
;
this
.
parentId
=
this
.
detailobj
.
categoryid
;
this
.
getToolingList
(
1
);
this
.
$nextTick
(()
=>
{
this
.
toolingId1
=
this
.
detailobj
.
fixturetoolid
;
});
}
this
.
type
=
1
;
this
.
addstatus
=
'1'
;
//状态 1可用 0停用
},
addPost
()
{
if
(
!
this
.
toolingId1
){
this
.
$Message
.
error
(
"请选择父工装"
);
return
false
;
}
if
(
!
this
.
toolingId2
){
this
.
$Message
.
error
(
"请选择子工装"
);
return
false
;
}
let
url
=
""
;
let
data
=
{
parentid
:
this
.
toolingId1
,
//父级工装ID
fixturetoolid
:
this
.
toolingId2
,
//工装ID
fileurl
:
this
.
fileurl
,
//url
filename
:
this
.
filename
,
//附件名称
status
:
1
,
remark
:
this
.
remark
,
status
:
this
.
addstatus
,
};
this
.
request
(
"/acc/FixtureToolsAssembly/Add"
,
data
,
"post"
).
then
(
(
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
if
(
this
.
type
==
1
)
{
url
=
"/acc/FixtureToolsAssembly/Add"
;
}
if
(
this
.
type
==
2
)
{
data
.
id
=
this
.
childObj
.
id
;
url
=
"/acc/FixtureToolsAssembly/Update"
;
}
this
.
request
(
url
,
data
,
"post"
).
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
res
.
data
.
msg
));
this
.
modal
=
false
;
this
.
detailobj
=
{};
this
.
childObj
=
{};
this
.
search
(
0
);
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
);
});
},
edit
()
{
if
(
!
this
.
childObj
.
id
)
{
this
.
$Message
.
error
(
"请先选择子工装信息"
);
return
false
;
}
this
.
parentType
=
this
.
childObj
.
parentcategoryids
;
this
.
sonType
=
this
.
childObj
.
categoryids
;
this
.
parentId
=
this
.
childObj
.
parentcategoryid
;
this
.
getToolingList
(
1
);
this
.
$nextTick
(()
=>
{
this
.
toolingId1
=
this
.
childObj
.
parentid
;
});
this
.
sonId
=
this
.
childObj
.
categoryid
;
this
.
getToolingList
(
2
);
this
.
$nextTick
(()
=>
{
this
.
toolingId2
=
this
.
childObj
.
fixturetoolid
;
});
this
.
filename
=
this
.
childObj
.
filename
;
this
.
fileurl
=
this
.
childObj
.
fileurl
;
this
.
remark
=
this
.
childObj
.
remark
;
this
.
disabled
=
true
;
this
.
type
=
2
;
this
.
addstatus
=
this
.
childObj
.
status
+
''
;
//状态 1可用 0停用
this
.
modal
=
true
;
},
dele
()
{
if
(
this
.
detailobj
.
id
===
undefined
||
this
.
detailobj
.
id
===
null
)
{
this
.
$Message
.
error
(
this
.
$t
(
"1017"
));
return
false
;
}
else
{
// if (!this.childObj.id) {
// this.$Message.error("请选择子工装信息");
// return false;
// }
var
params
=
{
id
:
this
.
childObj
.
id
?
this
.
childObj
.
id
:
this
.
detailobj
.
id
,
};
this
.
$Modal
.
confirm
({
title
:
this
.
$t
(
"1018"
),
content
:
""
,
width
:
"290px"
,
closable
:
true
,
okText
:
this
.
$t
(
"1004"
),
onOk
:
()
=>
{
this
.
axios
.
request
({
url
:
"/acc/FixtureToolsAssembly/Delete"
,
params
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
"1058"
));
this
.
search
(
0
);
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
});
}
},
loadExcel
()
{
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsAssmeblyTemplate"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
edit
()
{},
dele
()
{},
loadExcel
()
{},
exportEecel
()
{},
//工装类型
initFrockType
()
{
...
...
@@ -521,9 +680,6 @@ export default {
this
.
parentType
.
length
>
0
?
this
.
parentType
[
this
.
parentType
.
length
-
1
]
:
0
;
console
.
log
(
val
);
console
.
log
(
this
.
parentId
);
if
(
this
.
parentId
!=
0
)
{
this
.
getToolingList
(
1
);
...
...
@@ -542,7 +698,6 @@ export default {
getToolingList
(
index
)
{
let
id
=
0
;
id
=
index
==
1
?
this
.
parentId
:
this
.
sonId
;
console
.
log
(
index
);
this
.
request
(
"/acc/FixtureTools/GetFixtureToolList?categoryid="
+
id
,
""
,
...
...
@@ -578,15 +733,28 @@ export default {
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
console
.
log
(
currentRow
);
// this.data1.forEach((item, i) => {
// //这个循环是为了每次只能展开一个,其他自动收起,不需要可以去掉
// i !== currentRow.index ? (this.data1[currentRow.index]._expanded = false) : "";
// });
// this.data1[currentRow.index]._expanded = !this.data1[currentRow.index]._expanded;
// this.data1.sort();
// this.childObj = {};
},
onExpand
(
row
,
index
)
{
this
.
detailobj
=
row
;
console
.
log
(
this
.
detailobj
);
this
.
data1
.
forEach
((
item
,
i
)
=>
{
//这个循环是为了每次只能展开一个,其他自动收起,不需要可以去掉
i
!==
index
?
(
this
.
data1
[
i
].
_expanded
=
false
)
:
""
;
});
this
.
data1
[
index
].
_expanded
=
!
this
.
data1
[
index
].
_expanded
;
if
(
this
.
data1
[
index
].
_expanded
==
false
)
{
this
.
detailobj
=
{};
this
.
toolingId1
=
0
;
this
.
childObj
=
{};
}
this
.
data1
.
sort
();
},
handlePageSize
(
value
)
{
...
...
@@ -650,6 +818,26 @@ export default {
.
catch
((
error
)
=>
error
);
}
},
handleFormatError
(
file
)
{
this
.
$Message
.
error
(
this
.
$t
(
"950396"
)
+
file
.
name
+
this
.
$t
(
"950397"
)
);
},
handleSuccess
(
res
,
file
)
{
if
(
res
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
"950398"
));
this
.
tosearch
();
}
else
{
if
((
res
.
msg
+
""
).
indexOf
(
","
)
!=
-
1
)
{
inittip
(
res
.
msg
);
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
));
}
}
},
handleError
()
{
this
.
$Message
.
error
(
this
.
$t
(
"2010006"
)
+
"!"
);
},
},
};
</
script
>
...
...
Html/src/view/fms/associate/associateProduct.vue
View file @
17f44366
...
...
@@ -150,7 +150,7 @@ export default {
data
(){
return
{
//导入方法
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/UploadExcel?templateName=FixtureToolsProductTemplate
"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
...
...
@@ -595,18 +595,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsProductTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
...
...
Html/src/view/fms/config/accountInfo.vue
View file @
17f44366
...
...
@@ -154,7 +154,7 @@ export default {
data
(){
return
{
//导入方法
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/UploadExcel?templateName=FixtureToolsTemplate
"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
...
...
@@ -546,18 +546,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
...
...
Html/src/view/fms/config/typeMaintenance.vue
View file @
17f44366
...
...
@@ -86,7 +86,7 @@ export default {
data
(){
return
{
//导入方法
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/UploadExcel?templateName=FixtureToolsCategoryTemplate
"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
...
...
@@ -313,18 +313,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=FixtureToolsCategoryTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
...
...
Html/src/view/qms/analysis/datasearch.vue
View file @
17f44366
...
...
@@ -123,6 +123,10 @@
<Input
class=
"searchInput"
type=
"text"
id=
"input1"
v-model=
"editobj.checktype_value"
disabled=
"disabled"
/>
</div>
<div
class=
"filter"
>
<label
>
{{$t('950232')}}:
</label>
<Input
class=
"searchInput"
type=
"text"
id=
"input1"
v-model=
"editobj.routename"
disabled=
"disabled"
/>
</div>
<div
class=
"filter"
>
<label
>
{{$t('800008')}}:
</label>
<Input
class=
"searchInput"
type=
"text"
id=
"input1"
v-model=
"editobj.sn"
disabled=
"disabled"
/>
</div>
...
...
@@ -330,10 +334,6 @@ export default{
title
:
this
.
$t
(
'100089'
),
key
:
'productcode'
},
// {
// title: this.$t('500006'),
// key: 'routename'
// },
{
title
:
this
.
$t
(
'100088'
),
key
:
'productname'
...
...
@@ -347,6 +347,10 @@ export default{
key
:
'workorder'
},
{
title
:
this
.
$t
(
'950232'
),
key
:
'routename'
},
{
title
:
this
.
$t
(
'800008'
),
key
:
'sn'
},
...
...
Html/src/view/qms/manual/collection.vue
View file @
17f44366
...
...
@@ -100,7 +100,6 @@
:class=
"table_scrollx ? 'collection_table' : ''"
style=
"
width: 100%;
float: left;
height: 100%;
padding-left: 5px;
"
...
...
@@ -353,7 +352,6 @@
<div
style=
"
width: 870px;
float: left;
height: 100%;
padding-left: 5px;
overflow-y: scroll;
...
...
@@ -680,6 +678,7 @@ export default {
this
.
stationList
=
res
.
data
.
data
;
this
.
station
=
this
.
stationList
[
0
];
this
.
initproduct
(
this
.
station
.
id
);
this
.
initSn
(
this
.
station
.
id
);
});
}
},
...
...
@@ -721,7 +720,7 @@ export default {
axios
.
request
({
url
:
"/acc/SectionProperty/GetSn?
productId="
+
productid
+
"&
sectionId="
+
sectionid
,
"/acc/SectionProperty/GetSn?sectionId="
+
sectionid
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
...
...
@@ -1252,7 +1251,7 @@ export default {
this
.
loading3
=
true
;
axios
.
request
({
url
:
"/
qms/ManualCollection/Add
"
,
url
:
"/
acc/QmsCheck/AddManual
"
,
data
,
method
:
"post"
,
})
...
...
Html/src/view/wms/whStatusQuery/storageInfoQuery.vue
View file @
17f44366
...
...
@@ -176,7 +176,7 @@ export default {
},
{
title
:
'储位ID'
,
key
:
'loca
tion
id'
key
:
'locaid'
},
{
title
:
'工装类别'
,
...
...
@@ -275,7 +275,7 @@ export default {
addremark
:
''
,
//备注
filename
:
''
,
fileurl
:
''
,
action
:
this
.
axios
.
publicPath
+
"
wms/Upload/Submit?templateName=StorageLocation
"
,
action
:
this
.
axios
.
publicPath
+
"
acc/Upload/UploadExcel?templateName=AutomationLocationTemplate
"
,
UploadAction
:
this
.
axios
.
publicPath
+
"config/upload/UploadImage"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
...
...
@@ -665,18 +665,18 @@ export default {
},
//导出模板
loadexcel
()
{
//
this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation
",
//
method: "get",
//
})
//
.then((res) => {
//
if (res.data.ret === 1) {
//
window.location.href =
//
this.axios.publicPath + "" + res.data.data;
//
} else {
//
this.$Message.error(this.$t(res.data.msg));
//
}
//
});
this
.
axios
.
request
({
url
:
"/config/Download/GetTemplate?name=AutomationLocationTemplate
"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
window
.
location
.
href
=
this
.
axios
.
publicPath
+
""
+
res
.
data
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
/*********文件上传 start******** */
//下载文件
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
17f44366
...
...
@@ -17,6 +17,10 @@ using Siger.Middlelayer.Repository.Repositories.Interface;
using
Siger.Middlelayer.Share.Constant
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
using
Siger.Middlelayer.Repository.Entities
;
using
NPOI.SS.Formula.Functions
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common.Helpers
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -31,9 +35,14 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
ISigerProjectMachineAttributionRepository
_sigerProjectMachineAttribution
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
private
readonly
IAutomationLocationRepository
_automationLocation
;
private
readonly
IProductionBeatSetRepository
_productionBeatSet
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
private
readonly
IAutomationFixtureToolsRepository
_automationFixtureTools
;
public
AutomationController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationLineMode
automationLineMode
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerDict
sigerDict
,
IAutomationTaskListRepository
automationTaskList
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationLocationRepository
automationLocation
,
IProductionBeatSetRepository
productionBeatSet
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
IAutomationFixtureToolsRepository
automationFixtureTools
)
{
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
...
...
@@ -43,8 +52,12 @@ namespace Siger.ApiACC.Controllers
_automationTaskList
=
automationTaskList
;
_sigerProjectMachineAttribution
=
sigerProjectMachineAttribution
;
_automationFixtureMonitor
=
automationFixtureMonitor
;
_automationLocation
=
automationLocation
;
_productionBeatSet
=
productionBeatSet
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
_automationFixtureTools
=
automationFixtureTools
;
}
/// <summary>
/// 设备状态接口 用于 保存 设备当前可用状态
/// </summary>
...
...
@@ -74,8 +87,10 @@ namespace Siger.ApiACC.Controllers
exitsObj
.
enable
=
request
.
enable
;
exitsObj
.
status
=
request
.
status
;
exitsObj
.
updatetime
=
DateTime
.
Now
;
_automationMachineStatus
.
Update
(
exitsObj
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
{
// 设备空闲,或者完成时触发 自动任务
...
...
@@ -83,14 +98,29 @@ namespace Siger.ApiACC.Controllers
{
if
(
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
||
request
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
var
tasklist
=
_automationTaskList
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(!
tasklist
.
Any
())
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
machineAttr
.
station
);
if
(
section
!=
null
)
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
uploadStation
.
Select
(
f
=>
f
.
dval
.
ToInt
()).
ToList
();
if
(!
uploadStations
.
Contains
(
machineAttr
.
station
))
{
var
tasklist
=
_automationTaskList
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(!
tasklist
.
Any
())
{
Logger
.
WriteLineInfo
(
$"MachineStatus 设备状态 触发自动任务检查"
);
AutoProcess
(
section
.
parentid
);
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
machineAttr
.
station
);
if
(
section
!=
null
)
{
Logger
.
WriteLineInfo
(
$"MachineStatus 设备
{
section
.
title
}
状态 触发自动任务检查"
);
AutoProcess
(
section
.
parentid
,
stationDicts
);
}
}
}
}
...
...
@@ -138,11 +168,19 @@ namespace Siger.ApiACC.Controllers
//TODO
//手动-》自动 时
//task 无任务时候 ,根据设备状态创建任务
var
tasklist
=
_automationTaskList
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
var
tasklist
=
_automationTaskList
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(!
tasklist
.
Any
())
{
Logger
.
WriteLineInfo
(
$"LineMode Mode=1 触发自动任务检查"
);
AutoProcess
(
line
);
AutoProcess
(
line
,
stationDicts
);
}
}
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
...
...
@@ -193,25 +231,27 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
AccEnum
.
AutoTaskDone
);
}
//2.更新状态
taskObj
.
status
=
request
.
status
;
_automationTaskList
.
Update
(
taskObj
);
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
//更新Tasklist
PlCfeeback
(
taskObj
,
request
.
status
,
stationDicts
);
if
(
_unitOfWork
.
Commit
()
<=
0
)
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
//是否还有未完成任务
var
taskDone
=
_automationTaskList
.
Get
(
f
=>
f
.
projectId
==
PID
&&
f
.
status
>
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(
taskDone
!=
null
)
//还有未完成任务 退出 等待任务下发
if
(!
_automationTaskList
.
CanTask
(
PID
,
taskObj
.
sectionid
))
{
//还有未完成任务 退出 等待任务下发
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
//3.Tasklist 任务全部完成 ,创建自动任务
switch
(
request
.
status
)
{
case
(
int
)
TaskResultStatus
.
Cancel
:
...
...
@@ -220,7 +260,15 @@ namespace Siger.ApiACC.Controllers
var
section
=
_sigerProjectLevelSection
.
Get
(
f
=>
f
.
id
==
taskObj
.
sectionid
);
if
(
section
!=
null
)
{
AutoProcess
(
section
.
parentid
);
var
updownDic
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
.
ToInt
()).
ToList
();
var
uploadPostion
=
uploadStations
.
Contains
(
taskObj
.
sectionid
);
if
(
uploadPostion
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 上料料工站 无需自动创建任务 "
);
break
;
}
AutoProcess
(
section
.
parentid
,
stationDicts
);
}
break
;
}
...
...
@@ -234,11 +282,54 @@ namespace Siger.ApiACC.Controllers
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
void
PlCfeeback
(
siger_automation_task_list
taskObj
,
int
status
,
IEnumerable
<
SigerTrDict
>
stationDicts
)
{
//2.更新状态
taskObj
.
status
=
status
;
_automationTaskList
.
Update
(
taskObj
);
//PLC 反馈结束.
if
(
status
==
(
int
)
TaskResultStatus
.
Complated
)
{
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
uploadStation
.
Select
(
f
=>
f
.
dval
).
ToList
();
if
(
taskObj
.
action
==
TaskAction
.
Step_SXLW_LK
)
{
// 业务入口: 上料位-》 入库 如果是上料工装 安装完成 ,绑定 储位与装配
if
(
uploadStations
.
Exists
(
f
=>
f
.
Contains
(
taskObj
.
sectionid
.
ToString
())))
{
var
location
=
_automationLocation
.
Get
(
f
=>
f
.
fixturetools
==
taskObj
.
fixtureguid
);
if
(
location
==
null
)
{
Logger
.
WriteLineInfo
(
$"PlCfeeback 未找到该工装储位信息"
);
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
location
.
fixturetools
=
taskObj
.
fixtureguid
;
location
.
fixturename
=
taskObj
.
fixturename
;
location
.
ordernumber
=
taskObj
.
ordercode
;
location
.
productcode
=
taskObj
.
productcode
;
location
.
productid
=
taskObj
.
productid
;
location
.
sn
=
taskObj
.
sn
;
_automationLocation
.
Update
(
location
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
taskObj
.
sectionid
);
monitor
.
section
=
0
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
}
}
}
/// <summary>
/// 创建自动 Task任务
/// </summary>
/// <param name="line"></param>
void
AutoProcess
(
int
line
)
/// <param name="fixture"></param>
/// <param name="stationDicts"></param>
void
AutoProcess
(
int
line
,
IEnumerable
<
SigerTrDict
>
stationDicts
)
{
var
lineMode
=
_automationLineMode
.
Get
(
f
=>
f
.
projectId
==
PID
&&
f
.
section
==
line
);
if
(
lineMode
==
null
)
...
...
@@ -259,36 +350,35 @@ namespace Siger.ApiACC.Controllers
//2.其他设备上料
//3.其他设备下料
*/
var
stationDicts
=
_sigerDict
.
GetDataByCat
(
AccDictCost
.
Automation
,
PID
);
if
(!
stationDicts
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
return
;
}
var
updownDic
=
stationDicts
.
Where
(
s
=>
s
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStations
=
updownDic
.
Select
(
f
=>
f
.
dval
.
ToInt
()).
ToList
();
/* 自动任务创建只有CNC 设备;排除上料设备(手动任务) */
var
dictClean
=
stationDicts
.
FirstOrDefault
(
s
=>
s
.
dkey
==
DictKeyValConst
.
CleanStation
);
if
(
dictClean
==
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置清洗机字典"
);
return
;
}
// 获取可用 设备状态列表
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
f
.
enable
==
1
);
// 获取可用 设备状态列表 排除上料工位
var
machineStatusList
=
_automationMachineStatus
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
!
uploadStations
.
Contains
(
f
.
section
)
&&
f
.
enable
==
1
);
if
(!
machineStatusList
.
Any
())
{
Logger
.
WriteLineInfo
(
$"AutoProcess 无可用状态的设备"
);
return
;
}
//优先级1 :清洗机完成 。待下料
var
cleanMachine
=
machineStatusList
.
FirstOrDefault
(
f
=>
f
.
machineid
==
dictClean
.
dval
.
ToInt
());
var
cleanMachine
=
machineStatusList
.
FirstOrDefault
(
f
=>
f
.
section
==
dictClean
.
dval
.
ToInt
());
if
(
cleanMachine
!=
null
)
{
if
(
cleanMachine
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 有清洗机完成,创建清洗剂Task"
);
CreateTask
(
cleanMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
);
return
;
//完成当前任务 退出
Logger
.
WriteLineInfo
(
$"AutoProcess 有清洗机完成,创建清洗机Task"
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
if
(
monitor
!=
null
)
{
CreateTask
(
cleanMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
);
return
;
//完成当前任务 退出
}
}
}
...
...
@@ -298,8 +388,44 @@ namespace Siger.ApiACC.Controllers
if
(
freeMachine
!=
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 普通空闲,创建普通设备上料Task"
);
CreateTask
(
freeMachine
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
);
return
;
//完成当前任务 退出
var
location
=
SelectLocation
(
freeMachine
.
machineid
);
if
(
location
!=
null
)
{
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
freeMachine
.
section
);
if
(
monitor
==
null
)
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
projectId
=
PID
,
productId
=
location
.
productId
,
productCode
=
location
.
productCode
,
productName
=
location
.
productName
,
fixtureguid
=
location
.
fixture
,
fixturename
=
location
.
fixturename
,
ordernumber
=
location
.
ordernumber
,
locationId
=
location
.
location
,
section
=
freeMachine
.
section
,
sn
=
location
.
sn
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
});
}
else
{
monitor
.
productId
=
location
.
productId
;
monitor
.
productCode
=
location
.
productCode
;
monitor
.
productName
=
location
.
productName
;
monitor
.
fixtureguid
=
location
.
fixture
;
monitor
.
fixturename
=
location
.
fixturename
;
monitor
.
ordernumber
=
location
.
ordernumber
;
monitor
.
locationId
=
location
.
location
;
monitor
.
sn
=
location
.
sn
;
monitor
.
updatetime
=
DateTime
.
Now
;
_automationFixtureMonitor
.
Update
(
monitor
);
}
CreateTask
(
freeMachine
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
,
location
.
fixture
,
location
.
ordernumber
,
location
.
sn
,
location
.
pn
,
location
.
productId
,
location
.
productCode
,
location
.
location
);
return
;
//完成当前任务 退出
}
}
//优先级3:其他设备下料 (加工中心 ->立库)
if
(
cleanMachine
!=
null
)
...
...
@@ -308,7 +434,14 @@ namespace Siger.ApiACC.Controllers
if
(
fullMachine
!=
null
&&
cleanMachine
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 普通空闲,创建普通设备下料Task "
);
CreateTask
(
fullMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
fullMachine
.
section
);
if
(
monitor
==
null
)
{
Logger
.
WriteLineInfo
(
$"AutoProcess 找不到CNC监控信息"
);
return
;
}
CreateTask
(
fullMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
);
return
;
//完成当前任务 退出
}
...
...
@@ -322,24 +455,17 @@ namespace Siger.ApiACC.Controllers
/// <param name="machineStatus"></param>
/// <param name="actionType"></param>
/// <param name="taskAction"></param>
void
CreateTask
(
siger_automation_machine_status
machineStatus
,
TaskActionType
actionType
,
TaskAction
taskAction
)
/// <param name="guid">工装GUID</param>
/// <param name="orderno">订单</param>
/// <param name="sn">工件</param>
/// <param name="productCode">产品CODE</param>
/// <param name="locationid">储位ID</param>
void
CreateTask
(
siger_automation_machine_status
machineStatus
,
TaskActionType
actionType
,
TaskAction
taskAction
,
string
guid
,
string
orderno
,
string
sn
,
string
program
,
int
productId
,
string
productCode
,
int
locationid
)
{
//j检查工装监控状态
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
machineStatus
.
section
);
if
(
monitor
==
null
)
{
Logger
.
WriteLineInfo
(
$"CreateTask 工装监控状态无数据,请确认业务链正确 "
);
return
;
}
if
(
monitor
.
section
==
0
)
{
Logger
.
WriteLineInfo
(
$"CreateTask 工装监控状态无当前工站信息,请确认业务链正确 "
);
return
;
}
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Auto
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
no
=
taskNo
,
projectId
=
PID
,
sectionid
=
machineStatus
.
section
,
trigger
=
TaskTrigerType
.
Auto
,
...
...
@@ -352,13 +478,15 @@ namespace Siger.ApiACC.Controllers
send
=
0
,
operater
=
0
,
status
=
1
,
fixtureguid
=
monitor
.
fixtureguid
,
productcode
=
monitor
.
productCode
,
locationid
=
monitor
.
locationId
,
ordercode
=
monitor
.
ordernumber
,
sn
=
monitor
.
sn
,
remark
=
"自动任务"
fixtureguid
=
guid
,
productid
=
productId
,
productcode
=
productCode
,
programnumber
=
program
,
locationid
=
locationid
,
ordercode
=
orderno
,
sn
=
sn
,
remark
=
EnumHelper
.
GetEnumDesc
(
taskAction
)
});
...
...
@@ -367,6 +495,62 @@ namespace Siger.ApiACC.Controllers
else
Logger
.
WriteLineInfo
(
$"CreateTask 工站 失败"
);
}
/// <summary>
/// 自动匹配储位 储位 ->CNC
/// </summary>
ResponseAutomationLocationRouteInfo
SelectLocation
(
int
machine
)
{
// 当前空闲设备能加工的产品
var
beats
=
_productionBeatSet
.
GetList
(
f
=>
f
.
projectID
==
PID
&&
f
.
machineID
==
machine
);
var
productIds
=
beats
.
Select
(
f
=>
f
.
product_name
.
ToInt
()).
Distinct
().
ToList
();
// 取产品交期最近的订单
var
planOrder
=
_automationFixtureToolsProduct
.
GetDeliveryOrder
(
productIds
,
PID
);
if
(!
planOrder
.
Any
())
{
Logger
.
WriteLineInfo
(
$"SelectLocation 未找到最近订单号信息"
);
return
null
;
}
var
order
=
planOrder
.
FirstOrDefault
();
//TODO 20210126
var
beatset
=
beats
.
Where
(
f
=>
f
.
product_name
==
order
.
productId
.
ToString
());
//var location = _automationLocation.GetList(f => f.projectId == PID && f.ordernumber == order.ordernumber && productIds.Contains(f.productid));
//if (!location.Any())
//{
// Logger.WriteLineInfo($"SelectLocation 未找到最近交期订单号{order.ordernumber} 对应产品 {order.productName}的储位信息");
// return null;
//}
//储位有SN 工件
var
location
=
_automationLocation
.
GetList
(
f
=>
f
.
projectId
==
PID
&&
productIds
.
Contains
(
f
.
productid
));
var
hasSnloaction
=
location
.
Where
(
f
=>!
string
.
IsNullOrEmpty
(
f
.
sn
));
if
(!
hasSnloaction
.
Any
())
return
null
;
var
result
=
location
.
FirstOrDefault
();
var
valiateBeat
=
beatset
.
FirstOrDefault
(
f
=>
f
.
route_number
.
ToInt
()>
result
.
routenum
);
if
(
valiateBeat
==
null
)
{
Logger
.
WriteLineInfo
(
$"SelectLocation 未找到产品的工艺顺序"
);
return
null
;
}
return
new
ResponseAutomationLocationRouteInfo
{
fixture
=
result
.
fixturetools
,
fixturename
=
result
.
fixturename
,
ordernumber
=
result
.
ordernumber
,
location
=
result
.
locationid
,
productId
=
result
.
productid
,
productCode
=
result
.
productcode
,
productName
=
result
.
productname
,
sn
=
result
.
sn
,
pn
=
valiateBeat
.
process_number
,
route
=
valiateBeat
.
route_name
};
}
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationLocationController.cs
View file @
17f44366
...
...
@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.Helpers
;
using
System.IO
;
using
Siger.Middlelayer.Log
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -25,10 +30,11 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationLocationRepository
_autoLocationRepository
;
private
readonly
IAutomationFixtureMonitor
_fixtureMonitor
;
private
readonly
IProductRouteRepository
_routeRepository
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
public
AutomationLocationController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsCategoryRepository
toolsCategoryRepository
,
IAutomationFixtureToolsRepository
toolsRepository
,
IAutomationLocationRepository
autoLocationRepository
,
IAutomationFixtureMonitor
fixtureMonitor
,
IProductRouteRepository
routeRepository
)
IAutomationFixtureMonitor
fixtureMonitor
,
IProductRouteRepository
routeRepository
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
)
{
_unitOfWork
=
unitOfWork
;
_toolsCategoryRepository
=
toolsCategoryRepository
;
...
...
@@ -36,12 +42,13 @@ namespace Siger.ApiACC.Controllers
_autoLocationRepository
=
autoLocationRepository
;
_fixtureMonitor
=
fixtureMonitor
;
_routeRepository
=
routeRepository
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
}
[
HttpGet
]
public
IActionResult
GetPageList
(
string
wavehouseid
,
string
locationid
,
int
page
,
int
pagesize
)
public
IActionResult
GetPageList
(
string
wavehouseid
,
string
locationid
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
data
=
_autoLocationRepository
.
GetPagedList
(
wavehouseid
.
ToInt
(),
locationid
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
var
data
=
_autoLocationRepository
.
GetPagedList
(
wavehouseid
.
ToInt
(),
locationid
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
var
list
=
new
List
<
ResponseAutomationLocation
>();
var
locations
=
_autoLocationRepository
.
GetLocationList
(
ProjectId
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
...
...
@@ -64,7 +71,7 @@ namespace Siger.ApiACC.Controllers
item
.
materialstate
=
4
;
//无工装有工件
}
var
loca
=
locations
.
FirstOrDefault
(
q
=>
q
.
locationid
==
item
.
loca
id
);
var
loca
=
locations
.
FirstOrDefault
(
q
=>
q
.
id
==
item
.
location
id
);
if
(
loca
!=
null
)
{
var
locas
=
GetParentLocations
(
loca
.
id
,
locations
);
...
...
@@ -81,7 +88,84 @@ namespace Siger.ApiACC.Controllers
list
.
Add
(
item
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
list
);
}
else
{
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
}
private
IActionResult
ExportExcel
(
IEnumerable
<
ResponseAutomationLocation
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
AutomationLocationList
>();
foreach
(
var
item
in
data
)
{
var
state
=
""
;
switch
(
item
.
materialstate
)
{
case
1
:
state
=
"有工装无工件"
;
break
;
case
2
:
state
=
"有工装有工件"
;
break
;
case
3
:
state
=
"无工装无工件"
;
break
;
case
4
:
state
=
"无工装有工件"
;
break
;
}
dataList
.
Add
(
new
AutomationLocationList
{
Warehouse
=
item
.
wavehouse
,
Location
=
item
.
location
,
LocationId
=
item
.
locaid
.
ToString
(),
Catgeory
=
item
.
category
,
Code
=
item
.
code
,
Name
=
item
.
fixturetool
,
Specfication
=
item
.
specfication
,
SN
=
item
.
sn
,
RouteNumber
=
item
.
routenumber
,
RouteName
=
item
.
route
,
State
=
state
,
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
AutomationLocationList
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
AutomationLocationList
>();
var
temporaryFileName
=
$"储位信息查询_FixtureToolsLocationData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"Export Fixture Tools Location Data failed, error:"
+
e
);
throw
new
BadRequestException
(
RequestEnum
.
ExportFailed
);
}
finally
{
helper
?.
Dispose
();
}
}
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
private
IEnumerable
<
siger_automation_fixture_tools_category
>
GetParentCategoryList
(
string
parentId
,
List
<
siger_automation_fixture_tools_category
>
sections
)
...
...
@@ -110,13 +194,15 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
fixturetoolProduct
=
_automationFixtureToolsProduct
.
Get
(
f
=>
f
.
fixturetools
==
fixturetool
.
guid
);
var
location
=
_autoLocationRepository
.
GetLocation
(
req
.
locationid
.
ToInt
(),
ProjectId
);
if
(
location
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
LocationNull
);
}
var
exsit
=
_autoLocationRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
req
.
fixturetoolid
||
q
.
location
id
==
req
.
locationid
.
ToInt
()));
(
q
.
fixturetools
==
fixturetool
.
guid
||
q
.
location_c
id
==
req
.
locationid
.
ToInt
()));
if
(
exsit
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
...
...
@@ -126,7 +212,10 @@ namespace Siger.ApiACC.Controllers
{
guid
=
Guid
.
NewGuid
().
ToString
(),
locationid
=
location
.
locationid
,
location_cid
=
location
.
id
,
fixturetools
=
fixturetool
.
guid
,
productid
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productid
:
0
,
productcode
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productcode
:
""
,
attachment
=
req
.
fileurl
,
filename
=
req
.
filename
,
remark
=
req
.
remark
,
...
...
@@ -162,25 +251,30 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
fixturetoolProduct
=
_automationFixtureToolsProduct
.
Get
(
f
=>
f
.
fixturetools
==
fixturetool
.
guid
);
var
location
=
_autoLocationRepository
.
GetLocation
(
req
.
locationid
.
ToInt
(),
ProjectId
);
if
(
location
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
LocationNull
);
}
var
exsit
=
_autoLocationRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
req
.
fixturetoolid
||
q
.
location
id
==
req
.
locationid
.
ToInt
())
&&
q
.
id
!=
req
.
id
);
(
q
.
fixturetools
==
fixturetool
.
guid
||
q
.
location_c
id
==
req
.
locationid
.
ToInt
())
&&
q
.
id
!=
req
.
id
);
if
(
exsit
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
entity
.
locationid
=
location
.
locationid
;
entity
.
location_cid
=
location
.
id
;
entity
.
fixturetools
=
fixturetool
.
guid
;
entity
.
attachment
=
req
.
fileurl
;
entity
.
filename
=
req
.
filename
;
entity
.
remark
=
req
.
remark
;
entity
.
updatetime
=
DateTime
.
Now
;
entity
.
updator
=
UserId
;
entity
.
productid
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productid
:
0
;
entity
.
productcode
=
fixturetoolProduct
!=
null
?
fixturetoolProduct
.
productcode
:
""
;
_autoLocationRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
17f44366
...
...
@@ -35,9 +35,10 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
private
readonly
IAutomationFixtureToolsRepository
_automationFixtureTools
;
private
readonly
IAutomationLocationRepository
_automationLocation
;
public
AutomationOperateController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
ISigerDict
sigerDict
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationTaskListRepository
automationTaskList
,
IProductPlanDetails
planDetails
,
IProductPlanRepository
productPlan
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
IAutomationFixtureToolsRepository
automationFixtureTools
)
IProductPlanDetails
planDetails
,
IProductPlanRepository
productPlan
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
IAutomationFixtureToolsRepository
automationFixtureTools
,
IAutomationLocationRepository
automationLocation
)
{
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
...
...
@@ -50,6 +51,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor
=
automationFixtureMonitor
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
_automationFixtureTools
=
automationFixtureTools
;
_automationLocation
=
automationLocation
;
}
/// <summary>
...
...
@@ -101,7 +103,7 @@ namespace Siger.ApiACC.Controllers
var
machintAttr
=
_sigerProjectMachineAttribution
.
Get
(
f
=>
f
.
station
==
section
.
id
);
if
(
machintAttr
==
null
)
{
Logger
.
WriteLineInfo
(
$"GetloadStation 未配置
清洗
工站字典"
);
Logger
.
WriteLineInfo
(
$"GetloadStation 未配置工站字典"
);
continue
;
}
var
loadStatus
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
...
...
@@ -116,8 +118,10 @@ namespace Siger.ApiACC.Controllers
section
=
section
.
id
,
updatetime
=
DateTime
.
Now
});
}
else
{
loadStatus
=
machineStatus
.
status
;
}
data
.
Add
(
new
ResponseLoadStation
{
...
...
@@ -126,6 +130,8 @@ namespace Siger.ApiACC.Controllers
status
=
loadStatus
});
}
_unitOfWork
.
Commit
();
return
new
ObjectResult
(
data
);
}
...
...
@@ -143,14 +149,14 @@ namespace Siger.ApiACC.Controllers
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
section
);
var
result
=
new
ResponsePlanlFixtureInfo
{
OrderNumber
=
monitor
.
ordernumber
,
FixtureGuid
=
monitor
.
fixtureguid
,
FixtureName
=
monitor
.
fixturename
,
ProductCode
=
monitor
.
productCode
,
ProductName
=
monitor
.
productName
,
Sn
=
monitor
.
sn
,
status
=
monitor
.
status
,
Location
=
monitor
.
locationId
,
OrderNumber
=
monitor
!=
null
?
monitor
.
ordernumber
:
""
,
FixtureGuid
=
monitor
!=
null
?
monitor
.
fixtureguid
:
""
,
FixtureName
=
monitor
!=
null
?
monitor
.
fixturename
:
""
,
ProductCode
=
monitor
!=
null
?
monitor
.
productCode
:
""
,
ProductName
=
monitor
!=
null
?
monitor
.
productName
:
""
,
Sn
=
monitor
!=
null
?
monitor
.
sn
:
""
,
status
=
monitor
!=
null
?
monitor
.
status
:(
int
)
Automation
.
MachineStatus
.
Waiting
,
Location
=
monitor
!=
null
?
monitor
.
locationId
:
0
,
};
return
new
ObjectResult
(
result
);
}
...
...
@@ -173,7 +179,7 @@ namespace Siger.ApiACC.Controllers
return
new
ObjectResult
(
result
);
}
/// <summary>
/// 准备上料 -生成指令 load
/// 准备上料 -生成指令 load
(立库->上料位)
/// </summary>
/// <param name="loading"></param>
/// <returns></returns>
...
...
@@ -198,7 +204,7 @@ namespace Siger.ApiACC.Controllers
section
=
loading
.
section
,
machineid
=
machineAttr
.
machine
,
projectId
=
ProjectId
,
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
,
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
,
updatetime
=
DateTime
.
Now
});
}
...
...
@@ -261,7 +267,7 @@ namespace Siger.ApiACC.Controllers
productcode
=
plan
.
product_code
,
processid
=
0
,
programnumber
=
""
,
remark
=
"手动任务"
,
remark
=
"手动任务
-准备上料
"
,
});
...
...
@@ -279,6 +285,7 @@ namespace Siger.ApiACC.Controllers
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
status
=(
int
)
Automation
.
MachineStatus
.
Produce
,
productId
=
plan
.
product_id
,
productCode
=
plan
.
product_code
,
productName
=
plan
.
product_name
,
ordernumber
=
plandts
.
OrderNumber
,
...
...
@@ -291,6 +298,7 @@ namespace Siger.ApiACC.Controllers
monitor
.
section
=
loading
.
section
;
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
;
monitor
.
productId
=
plan
.
product_id
;
monitor
.
productName
=
plan
.
product_name
;
monitor
.
productCode
=
plan
.
product_code
;
monitor
.
ordernumber
=
plandts
.
OrderNumber
;
...
...
@@ -301,9 +309,14 @@ namespace Siger.ApiACC.Controllers
if
(
_unitOfWork
.
Commit
()
>
0
)
{
Logger
.
WriteLineError
(
$"手动任务创建成功-
{
Siger
.
Middlelayer
.
Common
.
Helpers
.
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_LK_SXLW
)}
"
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
/// <summary>
...
...
@@ -323,24 +336,66 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
if
(
machineStatus
.
status
==
(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineOnFree
);
}
if
(
machineStatus
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineProCompalate
);
}
//
if (machineStatus.status == (int)Automation.MachineStatus.Waiting)
//
{
//
throw new BadRequestException(AccEnum.MachineOnFree);
//
}
//
if (machineStatus.status == (int)Automation.MachineStatus.Complated)
//
{
//
throw new BadRequestException(AccEnum.MachineProCompalate);
//
}
if
(!
_automationTaskList
.
CanTask
(
ProjectId
,
assemble
.
section
))
{
throw
new
BadRequestException
(
AccEnum
.
TaskProcessing
);
}
//创建 安装完成动作
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
projectId
==
ProjectId
&&
f
.
section
==
assemble
.
section
);
if
(
monitor
==
null
)
{
throw
new
BadRequestException
(
AccEnum
.
MonitorNotfound
);
}
//移出 上料位
monitor
.
status
=
(
int
)
Automation
.
MachineStatus
.
Waiting
;
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
no
=
taskNo
,
action
=
Automation
.
TaskAction
.
Step_SXLW_LK
,
actiontype
=
Automation
.
ExcueType
.
None
,
triggertime
=
DateTime
.
MinValue
,
tasktype
=
Automation
.
TaskActionType
.
Load
,
operater
=
UserId
,
operatetime
=
DateTime
.
Now
,
sectionid
=
assemble
.
section
,
send
=
0
,
status
=
1
,
completetime
=
DateTime
.
MinValue
,
trigger
=
Automation
.
TaskTrigerType
.
Manual
,
projectId
=
ProjectId
,
productid
=
monitor
.
productId
,
sn
=
monitor
.
sn
,
ordercode
=
monitor
.
ordernumber
,
fixtureguid
=
monitor
.
fixtureguid
,
locationid
=
monitor
.
locationId
,
productcode
=
monitor
.
productCode
,
processid
=
0
,
programnumber
=
""
,
remark
=
"手动任务-安装完成"
,
});
return
new
ObjectResult
(
1
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
Logger
.
WriteLineError
(
$"手动任务创建成功-
{
Siger
.
Middlelayer
.
Common
.
Helpers
.
EnumHelper
.
GetEnumDesc
(
Automation
.
TaskAction
.
Step_SXLW_LK
)}
"
);
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
/// <summary>
/// 准备下料
/// </summary>
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationStateController.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Mvc
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.Repository.Repositories.Interface
;
using
Siger.ApiCommon.Filters
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.ApiCommon.Result
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace
Siger.ApiACC.Controllers
{
public
class
AutomationStateController
:
BaseController
{
private
readonly
ISigerProjectLevelSectionRepository
_sigerProjectLevelSection
;
private
readonly
IAutomationMachineStatus
_automationMachineStatus
;
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
public
AutomationStateController
(
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationMachineStatus
automationMachineStatus
,
IAutomationTaskListRepository
automationTaskList
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
{
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
_automationMachineStatus
=
automationMachineStatus
;
_automationTaskList
=
automationTaskList
;
_automationFixtureMonitor
=
automationFixtureMonitor
;
}
/// <summary>
/// 产线监控管理
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
[
HttpGet
]
public
IActionResult
GetStationMonitor
(
int
section
)
{
var
ids
=
new
List
<
int
>();
if
(
section
!=
0
)
{
ids
=
_sigerProjectLevelSection
.
GetLevelSectionIds
(
section
,
ProjectId
).
ToList
();
}
var
data
=
_automationMachineStatus
.
GetSectionStatus
(
ProjectId
,
section
,
ids
);
var
result
=
new
List
<
ResponseAutomationMachineStatus
>();
foreach
(
var
d
in
data
)
{
var
item
=
new
ResponseAutomationMachineStatus
{
sectionid
=
d
.
sectionid
,
section
=
d
.
section
,
enable
=
d
.
enable
,
product
=
""
,
location
=
0
,
sn
=
""
,
fixtureCode
=
""
,
fixtureName
=
""
,
lastupdate
=
""
,
status
=(
int
)
Automation
.
MachineStatus
.
Waiting
,
};
var
fixture
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
d
.
sectionid
);
if
(
fixture
!=
null
)
{
item
.
product
=
fixture
.
productName
;
item
.
location
=
fixture
.
locationId
;
item
.
sn
=
fixture
.
sn
;
item
.
fixtureCode
=
fixture
.
fixtureguid
;
item
.
fixtureName
=
fixture
.
fixturename
;
item
.
status
=
fixture
.
status
;
}
result
.
Add
(
item
);
}
var
output
=
new
ResponseMachineMonitor
{
sum
=
new
ResponseAutomationMachineStatusTotal
{
waittingTotal
=
result
.
Where
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
).
Count
(),
produceTotal
=
result
.
Where
(
f
=>
f
.
status
==
(
int
)
Automation
.
MachineStatus
.
Produce
).
Count
(),
complateTotal
=
result
.
Where
(
f
=>
f
.
status
==
(
int
)
Automation
.
MachineStatus
.
Complated
).
Count
(),
disableTotal
=
result
.
Where
(
f
=>
f
.
enable
==
0
).
Count
(),
},
dts
=
result
};
return
new
ObjectResult
(
output
);
}
[
HttpGet
]
public
IActionResult
GetTasklist
(
int
section
,
int
tasktype
,
string
productCode
,
string
taskno
,
string
sn
,
int
status
,
int
actionType
,
string
triggertime
,
string
complatetime
,
int
page
,
int
pageSize
)
{
var
ids
=
new
List
<
int
>();
if
(
section
!=
0
)
{
ids
=
_sigerProjectLevelSection
.
GetLevelSectionIds
(
section
,
ProjectId
).
ToList
();
}
var
resulst
=
_automationTaskList
.
GetTasklistPagedList
(
ids
,
tasktype
,
productCode
,
taskno
,
sn
,
status
,
actionType
,
triggertime
,
complatetime
,
ProjectId
,
page
,
pageSize
);
return
new
PagedObjectResult
(
resulst
,
resulst
.
Total
,
page
,
pageSize
);
}
}
}
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
View file @
17f44366
...
...
@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Utility.Helpers
;
using
System.IO
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Log
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -33,12 +38,23 @@ namespace Siger.ApiACC.Controllers
_toolsAssemblyRepository
=
toolsAssemblyRepository
;
}
/// <summary>
///TODO 子类查询可优化掉
/// </summary>
/// <param name="category"></param>
/// <param name="code"></param>
/// <param name="name"></param>
/// <param name="state"></param>
/// <param name="page"></param>
/// <param name="pagesize"></param>
/// <param name="toexcel"></param>
/// <returns></returns>
[
HttpGet
]
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
int
page
,
int
pagesize
)
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
string
state
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
ProjectId
,
page
,
pagesize
);
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
state
,
ProjectId
,
page
,
pagesize
,
toexcel
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
list
=
new
List
<
ResponseAumationFixtureToolsAssembly
>();
var
list
=
new
List
<
ResponseAumationFixtureToolsAssembly
s
>();
foreach
(
var
item
in
data
.
Data
)
{
var
cates
=
GetParentCategoryList
(
item
.
cate_guid
,
categorys
);
...
...
@@ -52,7 +68,7 @@ namespace Siger.ApiACC.Controllers
item
.
parentcategoryids
=
parentcateIds
;
var
models
=
new
List
<
ResponseAumationFixtureToolsAssembly
>();
var
details
=
_toolsAssemblyRepository
.
GetDetailList
(
item
.
fixtureguid
,
ProjectId
);
var
details
=
_toolsAssemblyRepository
.
GetDetailList
(
item
.
fixtureguid
,
category
.
ToInt
(),
code
,
name
,
state
,
ProjectId
);
foreach
(
var
model
in
details
)
{
var
cates1
=
GetParentCategoryList
(
model
.
cate_guid
,
categorys
);
...
...
@@ -64,15 +80,99 @@ namespace Siger.ApiACC.Controllers
var
parentcateIds1
=
parentcates1
.
Select
(
q
=>
q
.
id
).
ToList
();
parentcateIds1
.
Reverse
();
model
.
parentcategoryids
=
parentcateIds1
;
model
.
fileurl
=
item
.
fileurl
;
model
.
filename
=
item
.
filename
;
model
.
remark
=
item
.
remark
;
models
.
Add
(
model
);
}
item
.
childrens
=
models
;
list
.
Add
(
item
);
}
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
list
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
private
IActionResult
ExportExcel
(
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureToolsAssmeblyList
>();
foreach
(
var
item
in
data
)
{
dataList
.
Add
(
new
FixtureToolsAssmeblyList
{
ParentCategory
=
item
.
category
,
ParentPartNumber
=
item
.
partnumber
,
ParentFixtureTool
=
item
.
name
,
ParentSpecfication
=
item
.
specfication
,
ParentCode
=
item
.
code
,
Category
=
""
,
FixtureTool
=
""
,
PartNumber
=
""
,
Specfication
=
""
,
Status
=
item
.
status
==
(
int
)
RowState
.
Valid
?
"可用"
:
"停用"
,
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
if
(
item
.
childrens
.
Any
())
{
foreach
(
var
son
in
item
.
childrens
)
{
dataList
.
Add
(
new
FixtureToolsAssmeblyList
{
ParentCategory
=
son
.
parentcategory
,
ParentPartNumber
=
son
.
parentpartnumber
,
ParentFixtureTool
=
son
.
parentname
,
ParentSpecfication
=
son
.
parentspecfication
,
ParentCode
=
son
.
parentcode
,
Category
=
son
.
category
,
FixtureTool
=
son
.
name
,
PartNumber
=
son
.
partnumber
,
Specfication
=
son
.
specfication
,
Code
=
son
.
code
,
Status
=
son
.
status
==
(
int
)
RowState
.
Valid
?
"可用"
:
"停用"
,
Remark
=
son
.
remark
,
Updator
=
son
.
updator
,
UpdateTime
=
son
.
updatetime
});
}
}
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureToolsAssmeblyList
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureToolsAssmeblyList
>();
var
temporaryFileName
=
$"工装装配_FixtureToolsAssemblyData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"Export Fixture Tools Assembly Data failed, error:"
+
e
);
throw
new
BadRequestException
(
RequestEnum
.
ExportFailed
);
}
finally
{
helper
?.
Dispose
();
}
}
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
private
IEnumerable
<
siger_automation_fixture_tools_category
>
GetParentCategoryList
(
string
parentId
,
List
<
siger_automation_fixture_tools_category
>
sections
)
{
var
query
=
from
c
in
sections
where
c
.
guid
==
parentId
select
c
;
...
...
@@ -83,7 +183,7 @@ namespace Siger.ApiACC.Controllers
[
HttpGet
]
public
IActionResult
GetDetail
(
string
guid
)
{
var
data
=
_toolsAssemblyRepository
.
GetDetailList
(
guid
,
ProjectId
);
var
data
=
_toolsAssemblyRepository
.
GetDetailList
(
guid
,
0
,
""
,
""
,
""
,
ProjectId
);
return
new
ObjectResult
(
data
);
}
...
...
@@ -116,12 +216,33 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
parentExsit
=
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
parentGuid
);
if
(
parentExsit
!=
null
)
if
(
parentExsit
!=
null
&&
!
string
.
IsNullOrEmpty
(
parentExsit
.
parent
)
)
{
throw
new
BadRequestException
(
RequestEnum
.
LevelCountError
);
}
if
(
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
parentGuid
)
==
null
)
if
(
parentExsit
!=
null
)
{
parentExsit
.
filename
=
req
.
filename
;
parentExsit
.
attachment
=
req
.
fileurl
;
parentExsit
.
remark
=
req
.
remark
;
parentExsit
.
updator
=
UserId
;
parentExsit
.
updatetime
=
DateTime
.
Now
;
//var sons = _toolsAssemblyRepository.GetList(q => q.parent == parentExsit.son && q.projectId == ProjectId).ToList();
//if (req.status.ToInt() == (int)RowState.Invalid && sons.Count(q => q.status == (int)RowState.Invalid) == sons.Count)
//{
// parentExsit.status = (int)RowState.Invalid;
//}
//else
//{
// parentExsit.status = (int)RowState.Valid;
//}
_toolsAssemblyRepository
.
Update
(
parentExsit
);
}
if
(
parentExsit
==
null
)
{
var
parentEntity
=
new
siger_automation_fixture_tools_assembly
{
...
...
@@ -138,13 +259,14 @@ namespace Siger.ApiACC.Controllers
status
=
req
.
status
.
ToInt
()
==
(
int
)
RowState
.
Valid
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
remark
=
req
.
remark
};
_toolsAssemblyRepository
.
Insert
(
parentEntity
);
}
var
entity
=
new
siger_automation_fixture_tools_assembly
{
guid
=
Guid
.
NewGuid
().
ToString
(),
parent
=
parent
?.
guid
??
""
,
parent
=
parent
Guid
,
son
=
son
.
guid
,
creator
=
UserId
,
createtime
=
DateTime
.
Now
,
...
...
@@ -201,12 +323,33 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
parentExsit
=
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
parentGuid
);
if
(
parentExsit
!=
null
)
if
(
parentExsit
!=
null
&&
!
string
.
IsNullOrEmpty
(
parentExsit
.
parent
)
)
{
throw
new
BadRequestException
(
RequestEnum
.
LevelCountError
);
}
if
(
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
parentGuid
)
==
null
)
if
(
parentExsit
!=
null
)
{
parentExsit
.
filename
=
req
.
filename
;
parentExsit
.
attachment
=
req
.
fileurl
;
parentExsit
.
remark
=
req
.
remark
;
parentExsit
.
updator
=
UserId
;
parentExsit
.
updatetime
=
DateTime
.
Now
;
//var sons = _toolsAssemblyRepository.GetList(q => q.parent == parentExsit.son && q.projectId == ProjectId).ToList();
//if (req.status.ToInt() == (int)RowState.Invalid && sons.Count(q => q.status == (int)RowState.Invalid) == sons.Count)
//{
// parentExsit.status = (int)RowState.Invalid;
//}
//else
//{
// parentExsit.status = (int)RowState.Valid;
//}
_toolsAssemblyRepository
.
Update
(
parentExsit
);
}
if
(
parentExsit
==
null
)
{
var
parentEntity
=
new
siger_automation_fixture_tools_assembly
{
...
...
@@ -226,7 +369,7 @@ namespace Siger.ApiACC.Controllers
_toolsAssemblyRepository
.
Insert
(
parentEntity
);
}
entity
.
parent
=
parent
?.
guid
??
""
;
entity
.
parent
=
parent
Guid
;
entity
.
son
=
son
.
guid
;
entity
.
attachment
=
req
.
fileurl
;
entity
.
filename
=
req
.
filename
;
...
...
@@ -248,11 +391,16 @@ namespace Siger.ApiACC.Controllers
[
HttpGet
]
public
IActionResult
Delete
(
int
id
)
{
var
entity
=
_toolsRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
id
==
id
);
var
entity
=
_tools
Assembly
Repository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
id
==
id
);
if
(
entity
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
sons
=
_toolsAssemblyRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
parent
==
entity
.
son
).
ToList
();
foreach
(
var
son
in
sons
)
{
_toolsAssemblyRepository
.
Delete
(
son
);
}
_toolsAssemblyRepository
.
Delete
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
...
...
@@ -276,14 +424,24 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
sons
=
_toolsAssemblyRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
entities
.
Select
(
t
=>
t
.
son
).
Contains
(
q
.
parent
)).
ToList
();
foreach
(
var
son
in
sons
)
{
_toolsAssemblyRepository
.
Delete
(
son
);
}
foreach
(
var
entity
in
entities
)
{
_toolsAssemblyRepository
.
Delete
(
entity
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
}
}
}
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
View file @
17f44366
...
...
@@ -40,9 +40,17 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
string
state
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
data
=
_toolsRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
string
.
IsNullOrEmpty
(
state
)
?
-
1
:
state
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
var
list
=
new
List
<
ResponseFixtureTools
>();
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
categoryIds
=
new
List
<
int
>();
if
(
category
.
ToInt
()
>
0
)
{
var
cate
=
categorys
.
FirstOrDefault
(
q
=>
q
.
id
==
category
.
ToInt
());
var
sonCates
=
GetSonCategoryList
(
cate
.
guid
,
categorys
);
categoryIds
=
sonCates
.
Select
(
q
=>
q
.
id
).
ToList
();
categoryIds
.
Add
(
category
.
ToInt
());
}
var
data
=
_toolsRepository
.
GetPagedList
(
categoryIds
,
code
,
name
,
string
.
IsNullOrEmpty
(
state
)
?
-
1
:
state
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
var
list
=
new
List
<
ResponseFixtureTools
>();
foreach
(
var
item
in
data
.
Data
)
{
var
cates
=
GetParentCategoryList
(
item
.
cate_guid
,
categorys
);
...
...
@@ -53,7 +61,7 @@ namespace Siger.ApiACC.Controllers
}
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
data
.
Data
);
return
ExportExcel
(
list
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
...
...
@@ -66,11 +74,11 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureTools
Template
>();
var
dataList
=
new
List
<
FixtureTools
List
>();
foreach
(
var
item
in
data
)
{
dataList
.
Add
(
new
FixtureTools
Template
dataList
.
Add
(
new
FixtureTools
List
{
Catgeory
=
item
.
category
,
Name
=
item
.
name
,
...
...
@@ -80,15 +88,17 @@ namespace Siger.ApiACC.Controllers
Specfication
=
item
.
specification
,
Number
=
item
.
number
.
ToString
(),
Status
=
item
.
status
==
1
?
"可用"
:
"停用"
,
Remark
=
item
.
remark
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureTools
Template
>
helper
=
null
;
EpPlusExcelHelper
<
FixtureTools
List
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureTools
Template
>();
helper
=
new
EpPlusExcelHelper
<
FixtureTools
List
>();
var
temporaryFileName
=
$"工装台账_FixtureToolsData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
...
...
@@ -118,7 +128,7 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
Add
([
FromBody
]
RequestAddFixtureTools
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
partnumber
)
||
string
.
IsNullOrEmpty
(
req
.
code
)
||
string
.
IsNullOrEmpty
(
req
.
name
)
||
string
.
IsNullOrEmpty
(
req
.
categoryid
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
)
string
.
IsNullOrEmpty
(
req
.
managetype
))
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
...
...
@@ -169,7 +179,7 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
Update
([
FromBody
]
RequestUpdateFixtureTools
req
)
{
if
(
string
.
IsNullOrEmpty
(
req
.
partnumber
)
||
string
.
IsNullOrEmpty
(
req
.
code
)
||
string
.
IsNullOrEmpty
(
req
.
name
)
||
string
.
IsNullOrEmpty
(
req
.
categoryid
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
req
.
id
<=
0
)
string
.
IsNullOrEmpty
(
req
.
managetype
)
||
req
.
id
<=
0
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
...
...
@@ -256,7 +266,16 @@ namespace Siger.ApiACC.Controllers
[
HttpGet
]
public
IActionResult
GetCategoryPageList
(
string
id
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
var
data
=
_toolsCategoryRepository
.
GetPagedList
(
id
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
categoryIds
=
new
List
<
int
>();
if
(
id
.
ToInt
()
>
0
)
{
var
cate
=
categorys
.
FirstOrDefault
(
q
=>
q
.
id
==
id
.
ToInt
());
var
sonCates
=
GetSonCategoryList
(
cate
.
guid
,
categorys
);
categoryIds
=
sonCates
.
Select
(
q
=>
q
.
id
).
ToList
();
categoryIds
.
Add
(
id
.
ToInt
());
}
var
data
=
_toolsCategoryRepository
.
GetPagedList
(
categoryIds
,
ProjectId
,
page
,
pagesize
,
toexcel
);
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportCategoryExcel
(
data
.
Data
);
...
...
@@ -320,7 +339,7 @@ namespace Siger.ApiACC.Controllers
var
exsit
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
parentid
.
ToInt
());
if
(
exsit
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
throw
new
BadRequestException
(
RequestEnum
.
ParentTypeError
);
}
else
{
...
...
@@ -352,6 +371,10 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
UpdateCategory
([
FromBody
]
RequestUpdateFixtureToolsCategory
req
)
{
var
entity
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
id
);
if
(
entity
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
data
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
req
.
name
&&
q
.
id
!=
req
.
id
);
if
(
data
!=
null
)
...
...
@@ -364,7 +387,7 @@ namespace Siger.ApiACC.Controllers
var
exsit
=
_toolsCategoryRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
req
.
parentid
.
ToInt
());
if
(
exsit
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
throw
new
BadRequestException
(
RequestEnum
.
ParentTypeError
);
}
else
{
...
...
@@ -395,18 +418,23 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
details
=
GetSonCategoryList
(
entity
.
guid
,
categorys
);
var
detailIds
=
details
.
Select
(
q
=>
q
.
id
).
Distinct
().
ToList
();
var
details
=
GetSonCategoryList
(
entity
.
guid
,
categorys
).
ToList
();
details
.
Add
(
entity
);
var
detailGuids
=
details
.
Select
(
q
=>
q
.
guid
).
Distinct
().
ToList
();
if
(
_toolsRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
detailGuids
.
Contains
(
q
.
category
)).
Any
())
{
throw
new
BadRequestException
(
RequestEnum
.
CategoryBindFixtureToolData
);
}
var
delDetails
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
detailIds
.
Contains
(
q
.
id
)).
ToList
();
detailGuids
.
Contains
(
q
.
guid
)).
ToList
();
foreach
(
var
detail
in
delDetails
)
{
detail
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsCategoryRepository
.
Update
(
detail
);
}
entity
.
status
=
(
int
)
RowState
.
Invalid
;
_toolsCategoryRepository
.
Update
(
entity
);
if
(
_unitOfWork
.
Commit
()
>
0
)
{
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
...
...
@@ -421,7 +449,7 @@ namespace Siger.ApiACC.Controllers
{
var
query
=
from
c
in
sections
where
c
.
parent
==
parentId
select
c
;
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetSonCategoryList
(
t
.
parent
,
sections
)));
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetSonCategoryList
(
t
.
guid
,
sections
)));
}
[
HttpGet
]
...
...
@@ -457,7 +485,16 @@ namespace Siger.ApiACC.Controllers
[
HttpGet
]
public
IActionResult
GetFixtureToolList
(
string
categoryid
)
{
var
list
=
_toolsRepository
.
GetDataList
(
categoryid
.
ToInt
(),
ProjectId
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
categoryIds
=
new
List
<
int
>();
if
(
categoryid
.
ToInt
()
>
0
)
{
var
cate
=
categorys
.
FirstOrDefault
(
q
=>
q
.
id
==
categoryid
.
ToInt
());
var
sonCates
=
GetSonCategoryList
(
cate
.
guid
,
categorys
);
categoryIds
=
sonCates
.
Select
(
q
=>
q
.
id
).
ToList
();
categoryIds
.
Add
(
categoryid
.
ToInt
());
}
var
list
=
_toolsRepository
.
GetDataList
(
categoryIds
,
ProjectId
);
return
new
ObjectResult
(
list
);
}
}
...
...
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsProductController.cs
View file @
17f44366
...
...
@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.Helpers
;
using
System.IO
;
using
Siger.Middlelayer.Log
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -37,9 +42,9 @@ namespace Siger.ApiACC.Controllers
}
[
HttpGet
]
public
IActionResult
GetPageList
(
string
category
,
string
tool
,
string
product
,
int
page
,
int
pagesize
)
public
IActionResult
GetPageList
(
string
category
,
string
tool
,
string
product
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
data
=
_toolsProductRepository
.
GetPagedList
(
category
.
ToInt
(),
tool
.
ToInt
(),
product
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
var
data
=
_toolsProductRepository
.
GetPagedList
(
category
.
ToInt
(),
tool
.
ToInt
(),
product
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
list
=
new
List
<
ResponseAumationFixtureToolsProduct
>();
foreach
(
var
item
in
data
.
Data
)
...
...
@@ -50,9 +55,62 @@ namespace Siger.ApiACC.Controllers
item
.
categoryids
=
cateIds
;
list
.
Add
(
item
);
}
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
list
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
private
IActionResult
ExportExcel
(
IEnumerable
<
ResponseAumationFixtureToolsProduct
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureToolsProductList
>();
foreach
(
var
item
in
data
)
{
dataList
.
Add
(
new
FixtureToolsProductList
{
Category
=
item
.
categoryname
,
PartNumber
=
item
.
partnumber
,
FixtureTool
=
item
.
fixturetool
,
Specfication
=
item
.
specfication
,
Product
=
item
.
productname
,
ProductCode
=
item
.
productcode
,
Remark
=
item
.
remark
,
Updator
=
item
.
updator
,
UpdateTime
=
item
.
updatetime
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureToolsProductList
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureToolsProductList
>();
var
temporaryFileName
=
$"工装对应产品_FixtureToolsProductData_
{
DateTime
.
Now
:
yyyyMMddHHmmss
}
.xlsx"
;
helper
.
GenerateExcel
(
dataList
,
Path
.
Combine
(
rootDir
,
temporaryFileName
));
return
new
ObjectResult
(
$"
{
FileSystemHelper
.
CommonFileSetting
.
RequestPath
}
/
{
FileSystemHelper
.
ExportFileName
}
/
{
temporaryFileName
}
"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"Export Fixture Tools Product Data failed, error:"
+
e
);
throw
new
BadRequestException
(
RequestEnum
.
ExportFailed
);
}
finally
{
helper
?.
Dispose
();
}
}
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
private
IEnumerable
<
siger_automation_fixture_tools_category
>
GetParentCategoryList
(
string
parentId
,
List
<
siger_automation_fixture_tools_category
>
sections
)
{
var
query
=
from
c
in
sections
where
c
.
guid
==
parentId
select
c
;
...
...
Server/Apis/Siger.ApiACC/Controllers/QmsCheckController.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
using
System.Linq.Expressions
;
using
Microsoft.AspNetCore.Mvc
;
using
Siger.ApiCommon.Result
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.AccRepository.Request
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Repository.Repositories.Interface
;
using
Siger.Middlelayer.Repository
;
using
Siger.Middlelayer.Repository.Extensions
;
using
System.Linq
;
using
Siger.Middlelayer.Repository.Entities
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
Siger.Middlelayer.Utility.Helpers
;
using
System.IO
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Common.ModuleEnum
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
namespace
Siger.ApiACC.Controllers
{
public
class
QmsCheckController
:
BaseController
{
private
readonly
IUnitOfWork
_unitOfWork
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
private
readonly
ISigerProjectProductRepository
_productRepository
;
private
readonly
ISigerProjectLevelRepository
_levelRepository
;
private
readonly
ISigerProjectLevelSectionRepository
_levelSectionRepository
;
private
readonly
IInspectStandardRepository
_inspectStandard
;
private
readonly
ICheckSnTraceInspectionRepository
_traceInspectionRepository
;
private
readonly
ICheckSnTraceDetailRepository
_traceDetailRepository
;
private
readonly
ICheckSnListRepository
_snListRepository
;
private
readonly
ISigerTrMaterialsRepository
_materialsRepository
;
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
IAutomationFixtureMonitor
_fixtureMonitor
;
public
QmsCheckController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
ISigerProjectProductRepository
productRepository
,
ISigerProjectLevelRepository
levelRepository
,
ISigerProjectLevelSectionRepository
levelSectionRepository
,
IInspectStandardRepository
inspectStandard
,
ICheckSnTraceInspectionRepository
traceInspectionRepository
,
ICheckSnTraceDetailRepository
traceDetailRepository
,
ICheckSnListRepository
checkSnListRepository
,
ISigerTrMaterialsRepository
materialsRepository
,
IAutomationTaskListRepository
automationTaskListRepository
,
IAutomationFixtureMonitor
fixtureMonitor
)
{
_unitOfWork
=
unitOfWork
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
_productRepository
=
productRepository
;
_levelRepository
=
levelRepository
;
_levelSectionRepository
=
levelSectionRepository
;
_inspectStandard
=
inspectStandard
;
_traceInspectionRepository
=
traceInspectionRepository
;
_traceDetailRepository
=
traceDetailRepository
;
_snListRepository
=
checkSnListRepository
;
_materialsRepository
=
materialsRepository
;
_automationTaskList
=
automationTaskListRepository
;
_fixtureMonitor
=
fixtureMonitor
;
}
[
HttpPost
]
public
IActionResult
AddManual
([
FromBody
]
RequestAddDataCollection
req
)
{
var
product
=
_productRepository
.
Get
(
t
=>
t
.
projectid
==
ProjectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
id
==
req
.
productid
);
if
(
product
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
ProductNotFound
);
}
var
maxLevel
=
_levelRepository
.
GetList
(
t
=>
t
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
projectid
==
ProjectId
).
Max
(
q
=>
q
.
id
);
var
section
=
_levelSectionRepository
.
Get
(
t
=>
t
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
projectid
==
ProjectId
&&
t
.
id
==
req
.
sectionid
);
if
(
section
==
null
||
section
.
levelid
!=
maxLevel
)
{
throw
new
ServerException
(
1052
);
}
var
machine
=
_inspectStandard
.
GetMachineBySectionId
(
section
.
id
,
ProjectId
);
if
(
string
.
IsNullOrEmpty
(
req
.
result
))
{
throw
new
BadRequestException
(
RequestEnum
.
SelectCheckResult
);
}
if
(
req
.
result
==
((
int
)
SendTestType
.
DeviationRelease
).
ToString
()
&&
(
string
.
IsNullOrEmpty
(
req
.
quantity
)
||
req
.
quantity
.
ToInt
()
<
1
))
{
throw
new
BadRequestException
(
RequestEnum
.
DeviationReleaseQuantityNotNull
);
}
var
items
=
_inspectStandard
.
GetList
(
t
=>
req
.
details
.
Select
(
q
=>
q
.
itemid
).
Contains
(
t
.
id
)).
ToList
();
var
indexs
=
req
.
details
.
Select
(
t
=>
t
.
index
).
Distinct
().
ToList
();
foreach
(
var
index
in
indexs
)
//验证传入参数
{
var
traceDetails
=
req
.
details
.
Where
(
t
=>
t
.
index
==
index
).
OrderBy
(
t
=>
t
.
index
).
ToList
();
if
(
traceDetails
.
Any
())
{
foreach
(
var
detail
in
traceDetails
)
{
var
item
=
items
.
FirstOrDefault
(
t
=>
t
.
id
==
detail
.
itemid
);
if
(
item
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
if
(
item
.
value_category
==
(
int
)
ValueCategory
.
Maxmin
&&
(
detail
.
lowerlimit
.
HasValue
&&
!
detail
.
upperlimit
.
HasValue
||
detail
.
upperlimit
.
HasValue
&&
!
detail
.
lowerlimit
.
HasValue
||
(
detail
.
upperlimit
.
HasValue
&&
detail
.
lowerlimit
.
HasValue
&&
detail
.
upperlimit
.
Value
<
detail
.
lowerlimit
.
Value
)))
{
throw
new
BadRequestException
(
RequestEnum
.
MaxMinError
);
}
}
}
}
var
traceResult
=
""
;
//检验结果可以传OK,2,NG,也可以传1,2,3
if
(
req
.
result
.
ToUpper
()
==
"OK"
||
req
.
result
.
ToUpper
()
==
"NG"
)
{
traceResult
=
req
.
result
.
ToUpper
();
}
else
{
if
(
req
.
result
.
ToInt
()
==
(
int
)
SendTestType
.
Qalified
||
req
.
result
.
ToInt
()
==
(
int
)
SendTestType
.
DeviationRelease
)
{
traceResult
=
"OK"
;
}
else
{
traceResult
=
"NG"
;
}
}
var
insertDetailList
=
new
List
<
SnTraceDetailList
>();
foreach
(
var
index
in
indexs
)
{
var
traceDetails
=
req
.
details
.
Where
(
t
=>
t
.
index
==
index
).
OrderBy
(
t
=>
t
.
index
).
ToList
();
foreach
(
var
detail
in
traceDetails
)
{
var
item
=
items
.
FirstOrDefault
(
t
=>
t
.
id
==
detail
.
itemid
);
if
(
item
==
null
)
{
continue
;
}
if
(
item
.
value_type
==
(
int
)
ValueTypeStatus
.
O
)
{
if
(
string
.
IsNullOrWhiteSpace
(
detail
.
result
))
{
continue
;
}
insertDetailList
.
Add
(
new
SnTraceDetailList
{
TraceID
=
""
,
ItemID
=
detail
.
itemid
,
Result
=
detail
.
result
,
Value
=
detail
.
value
,
ItemName
=
item
.
item_en
,
SN
=
req
.
sn
??
""
,
NumberIndex
=
detail
.
index
,
LowerLimit
=
detail
.
lowerlimit
,
UpperLimit
=
detail
.
upperlimit
,
});
}
else
if
(
item
.
value_type
==
(
int
)
ValueTypeStatus
.
V
)
{
if
(
detail
.
value
==
null
&&
item
.
value_category
!=
(
int
)
ValueCategory
.
Maxmin
)
{
continue
;
}
var
detailResult
=
""
;
if
(
item
.
value_category
==
(
int
)
ValueCategory
.
Maxmin
&&
!
detail
.
upperlimit
.
HasValue
&&
!
detail
.
lowerlimit
.
HasValue
)
{
continue
;
}
if
(
item
.
value_category
==
(
int
)
ValueCategory
.
Maxmin
)
{
var
range
=
detail
.
upperlimit
.
Value
-
detail
.
lowerlimit
.
Value
;
detail
.
value
=
(
detail
.
upperlimit
.
Value
+
detail
.
lowerlimit
.
Value
)
/
2
;
detailResult
=
"OK"
;
if
(
detail
.
upperlimit
.
Value
>
item
.
max_value
||
detail
.
lowerlimit
.
Value
<
item
.
min_value
||
range
>
item
.
range
||
detail
.
value
.
Value
>
item
.
max_value
||
detail
.
value
.
Value
<
item
.
min_value
||
detail
.
upperlimit
.
Value
<
item
.
min_value
||
detail
.
lowerlimit
.
Value
>
item
.
max_value
)
{
detailResult
=
"NG"
;
}
}
else
{
detailResult
=
(
detail
.
value
.
Value
<=
item
.
max_value
&&
detail
.
value
.
Value
>=
item
.
min_value
)
?
"OK"
:
"NG"
;
}
insertDetailList
.
Add
(
new
SnTraceDetailList
{
TraceID
=
""
,
ItemID
=
detail
.
itemid
,
Result
=
detailResult
,
Value
=
detail
.
value
,
ItemName
=
item
.
item_en
,
SN
=
req
.
sn
??
""
,
NumberIndex
=
detail
.
index
,
LowerLimit
=
detail
.
lowerlimit
,
UpperLimit
=
detail
.
upperlimit
});
}
}
}
var
trace_id
=
Guid
.
NewGuid
().
ToString
();
#
region
插入检验扩展表
if
(
req
.
result
.
ToUpper
()
==
"OK"
)
{
req
.
result
=
((
int
)
SendTestType
.
Qalified
).
ToString
();
}
else
if
(
req
.
result
.
ToUpper
()
==
"NG"
)
{
req
.
result
=
((
int
)
SendTestType
.
Unqualified
).
ToString
();
}
var
nowTime
=
DateTime
.
Now
;
//插入中间层库的trace表
var
inspection
=
new
siger_check_sn_trace_inspection
{
trace_id
=
trace_id
,
testroom
=
""
,
productid
=
req
.
productid
,
materialid
=
req
.
materialid
.
ToInt
(),
sectionid
=
req
.
sectionid
,
sn
=
req
.
sn
??
""
,
routeid
=
req
.
routeid
.
ToInt
(),
check_type
=
req
.
checktype
,
check_status
=
(
int
)
SendCheckStatus
.
Completed
,
result
=
req
.
result
,
send_mid
=
UserId
,
send_time
=
nowTime
,
check_mid
=
UserId
,
check_time
=
nowTime
,
inspection_type
=
(
int
)
InspectionType
.
ManualCollection
,
projectId
=
ProjectId
,
reason
=
req
.
reason
??
""
,
workorder
=
""
,
number
=
req
.
number
.
ToInt
(),
quantity
=
req
.
quantity
.
ToInt
()
};
_traceInspectionRepository
.
Insert
(
inspection
);
//插入中间层库的 检验详情表
foreach
(
var
detail
in
insertDetailList
)
{
var
model
=
new
siger_check_sn_trace_detail
{
TraceID
=
inspection
.
trace_id
,
ItemID
=
detail
.
ItemID
,
Result
=
detail
.
Result
,
Value
=
detail
.
Value
,
ItemName
=
detail
.
ItemName
,
SN
=
req
.
sn
??
""
,
NumberIndex
=
detail
.
NumberIndex
,
LowerLimit
=
detail
.
LowerLimit
,
UpperLimit
=
detail
.
UpperLimit
,
projectId
=
ProjectId
,
CreateTime
=
nowTime
};
_traceDetailRepository
.
Insert
(
model
);
}
if
(
_unitOfWork
.
Commit
()
>
0
)
{
try
{
CreateTaskList
(
req
.
sectionid
,
req
.
productid
,
product
.
code
,
req
.
sn
,
req
.
routeid
.
ToInt
());
AddSnList
(
req
.
materialid
.
ToInt
(),
inspection
,
product
.
code
,
section
.
parentid
);
//把二维码插入到 sn_list表
}
catch
(
Exception
ex
)
{
Logger
.
WriteLineError
(
ex
.
ToString
());
}
return
new
ObjectResult
(
CommonEnum
.
Succefull
);
}
else
{
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
#
endregion
}
private
void
AddSnList
(
int
materialid
,
siger_check_sn_trace_inspection
trace
,
string
code
,
int
lineId
)
{
var
snEntity
=
_snListRepository
.
Get
(
t
=>
t
.
projectId
==
ProjectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
SN
==
trace
.
sn
&&
!
string
.
IsNullOrWhiteSpace
(
trace
.
sn
));
if
(
snEntity
==
null
)
{
var
stateCode
=
"000"
;
var
eventNoObj
=
_snListRepository
.
GetEventNoByResult
(
trace
.
sn
,
ProjectId
);
if
(
eventNoObj
!=
null
)
{
//出站信息获取
var
outObj
=
_snListRepository
.
GetOutStationByEventNo
(
eventNoObj
.
EventNo
,
trace
.
sectionid
,
ProjectId
);
if
(
outObj
!=
null
)
{
stateCode
=
outObj
.
ResultStatus
;
}
}
var
material
=
_materialsRepository
.
Get
(
t
=>
t
.
projectId
==
ProjectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
id
==
materialid
);
var
snListObj
=
new
siger_check_sn_list
{
SN
=
trace
.
sn
,
BatchNumber
=
""
,
ProductID
=
trace
.
productid
,
ProductCode
=
code
,
LineID
=
lineId
,
WorkOrder
=
trace
.
workorder
,
MaterialID
=
material
?.
id
??
0
,
PartNumber
=
material
?.
pn
??
""
,
StateCode
=
stateCode
,
CreateTime
=
DateTime
.
Now
,
projectId
=
ProjectId
};
_snListRepository
.
Insert
(
snListObj
);
_unitOfWork
.
Commit
();
}
}
private
void
CreateTaskList
(
int
section
,
int
productid
,
string
productcode
,
string
sn
,
int
routeid
)
{
if
(
section
<=
0
||
string
.
IsNullOrEmpty
(
sn
)
||
string
.
IsNullOrEmpty
(
productcode
)
||
productid
<=
0
)
{
return
;
}
var
monitor
=
_fixtureMonitor
.
GetList
(
q
=>
q
.
section
==
section
&&
q
.
sn
==
sn
).
OrderByDescending
(
q
=>
q
.
updatetime
).
FirstOrDefault
();
if
(
monitor
==
null
)
{
return
;
}
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Manual
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
no
=
taskNo
,
action
=
Automation
.
TaskAction
.
Step_CJT_SXLW
,
actiontype
=
Automation
.
ExcueType
.
None
,
triggertime
=
DateTime
.
MinValue
,
tasktype
=
Automation
.
TaskActionType
.
Unload
,
operater
=
UserId
,
operatetime
=
DateTime
.
Now
,
sectionid
=
section
,
send
=
0
,
status
=
1
,
completetime
=
DateTime
.
MinValue
,
trigger
=
Automation
.
TaskTrigerType
.
Manual
,
projectId
=
ProjectId
,
productid
=
productid
,
sn
=
sn
,
ordercode
=
""
,
fixtureguid
=
monitor
.
fixtureguid
,
locationid
=
monitor
.
locationId
,
productcode
=
productcode
,
processid
=
routeid
,
programnumber
=
""
,
remark
=
"质量检验"
,
});
_unitOfWork
.
Commit
();
}
}
}
Server/Apis/Siger.ApiACC/Controllers/UploadController.cs
View file @
17f44366
...
...
@@ -41,12 +41,19 @@ namespace Siger.ApiACC.Controllers
private
readonly
IBasketSettingRepository
_basketSetting
;
private
readonly
ITrParameterConfigRepository
_parameterConfigRepository
;
private
readonly
ISeriNumCfg
_serinumCfgRepository
;
private
readonly
IAutomationFixtureToolsCategoryRepository
_fixtureToolsCategoryRepository
;
private
readonly
IAutomationFixtureToolsRepository
_fixtureToolsRepository
;
private
readonly
IAutomationFixtureToolsProductRepository
_fixtureToolsProductRepository
;
private
readonly
IAutomationFixtureToolsAssemblyRepository
_fixtureToolsAssemblyRepository
;
private
readonly
IAutomationLocationRepository
_autoLocationRepository
;
public
UploadController
(
IUnitOfWork
unitOfWork
,
ISigerTrMaterialsRepository
materialsRepository
,
ISigerTrMaterialTypeRepository
materialTypeRepository
,
ISigerTrAssemblyMaintenanceRepository
assemblyMaintenanceRepository
,
ISigerTrProductStructureRepository
productStructureRepository
,
ISigerDict
sigerDict
,
ISigerEquipment
sigerEquipment
,
ISigerEquipmentPosition
sigerEquipmentPosition
,
ISigerRoutingEventNo
routingEvenNo
,
ISigerRoutingOutStation
sigerRoutingOutStation
,
ISigerRoutingInStation
sigerRoutingIn
,
ISigerPackingFullQty
sigerPackingFull
,
ISigerCheckItem
checkItem
,
ISigerWOBookingItem
sigerWOBooking
,
IBasketSettingRepository
basketSetting
,
ITrParameterConfigRepository
parameterConfigRepository
,
ISeriNumCfg
serinumCfgRepository
)
ISeriNumCfg
serinumCfgRepository
,
IAutomationFixtureToolsCategoryRepository
fixtureToolsCategoryRepository
,
IAutomationFixtureToolsRepository
fixtureToolsRepository
,
IAutomationFixtureToolsProductRepository
fixtureToolsProductRepository
,
IAutomationFixtureToolsAssemblyRepository
fixtureToolsAssemblyRepository
,
IAutomationLocationRepository
autoLocationRepository
)
{
_unitOfWork
=
unitOfWork
;
_materialsRepository
=
materialsRepository
;
...
...
@@ -65,6 +72,11 @@ namespace Siger.ApiACC.Controllers
_basketSetting
=
basketSetting
;
_parameterConfigRepository
=
parameterConfigRepository
;
_serinumCfgRepository
=
serinumCfgRepository
;
_fixtureToolsCategoryRepository
=
fixtureToolsCategoryRepository
;
_fixtureToolsRepository
=
fixtureToolsRepository
;
_fixtureToolsProductRepository
=
fixtureToolsProductRepository
;
_fixtureToolsAssemblyRepository
=
fixtureToolsAssemblyRepository
;
_autoLocationRepository
=
autoLocationRepository
;
}
[
HttpPost
]
...
...
@@ -208,6 +220,21 @@ namespace Siger.ApiACC.Controllers
case
TemplateNameEnums
.
SnRule
:
result
=
ImportSnRule
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsCategoryTemplate
:
result
=
ImportFixtureToolsCategory
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsTemplate
:
result
=
ImportFixtureTools
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsProductTemplate
:
result
=
ImportFixtureToolsProduct
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
FixtureToolsAssmeblyTemplate
:
result
=
ImportFixtureToolsAssembly
(
temporaryFilePath
);
break
;
case
TemplateNameEnums
.
AutomationLocationTemplate
:
result
=
ImportAutomationLocation
(
temporaryFilePath
);
break
;
default
:
throw
new
ArgumentOutOfRangeException
();
}
...
...
@@ -803,5 +830,136 @@ namespace Siger.ApiACC.Controllers
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureToolsCategory
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsCategoryTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsCategoryTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsCategoryRepository
.
ImportData
(
data
,
ProjectId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureToolsCategory failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureTools
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureTools failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureToolsProduct
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsProductTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsProductTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsProductRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureToolsProduct failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportFixtureToolsAssembly
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
FixtureToolsAssmeblyTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
FixtureToolsAssmeblyTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_fixtureToolsAssemblyRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportFixtureToolsAssembly failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
private
CommonImportResult
ImportAutomationLocation
(
string
temporaryFilePath
)
{
EpPlusExcelHelper
<
AutomationLocationTemplate
>
excelHelper
=
null
;
try
{
excelHelper
=
new
EpPlusExcelHelper
<
AutomationLocationTemplate
>(
temporaryFilePath
);
var
checkResult
=
excelHelper
.
CheckExcel
();
if
(
checkResult
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
';'
,
checkResult
));
}
var
data
=
excelHelper
.
ConvertSheetToList
();
var
result
=
_autoLocationRepository
.
ImportData
(
data
,
ProjectId
,
UserId
);
return
result
;
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
"ImportAutomationLocation failed,error: "
+
e
.
Message
);
throw
;
}
finally
{
excelHelper
?.
Dispose
();
}
}
}
}
Server/Apis/Siger.ApiConfig/Controller/DownloadController.cs
View file @
17f44366
...
...
@@ -72,7 +72,7 @@ namespace Siger.ApiConfig.Controller
}
private
Type
GetType
(
TemplateNameEnums
template
)
{
{
Type
type
=
null
;
switch
(
template
)
{
...
...
@@ -300,6 +300,9 @@ namespace Siger.ApiConfig.Controller
case
TemplateNameEnums
.
FixtureToolsAssmeblyTemplate
:
type
=
typeof
(
FixtureToolsAssmeblyTemplate
);
break
;
case
TemplateNameEnums
.
AutomationLocationTemplate
:
type
=
typeof
(
AutomationLocationTemplate
);
break
;
}
return
type
;
...
...
Server/Apis/Siger.ApiWMS/Controllers/LocationController.cs
View file @
17f44366
...
...
@@ -680,13 +680,12 @@ namespace Siger.ApiWMS.Controllers
//title
excelData
.
Add
(
GetExcelTitle
());
//data
int
id
=
1
;
foreach
(
var
item
in
data
)
{
var
tmp
=
new
List
<
string
>();
tmp
.
Add
(
i
d
++
.
ToString
());
tmp
.
Add
(
i
tem
.
storeID
.
ToString
());
tmp
.
Add
(
item
.
storageName
);
tmp
.
AddRange
(
item
.
field
.
Select
(
q
=>
q
.
name
));
tmp
.
AddRange
(
item
.
field
.
Select
(
q
=>
q
.
val
));
tmp
.
Add
(
item
.
state
==
(
int
)
RowState
.
Valid
?
"否"
:
"是"
);
tmp
.
Add
(
item
.
serialNumber
);
excelData
.
Add
(
tmp
);
...
...
@@ -940,7 +939,7 @@ namespace Siger.ApiWMS.Controllers
if
(
Location
.
id
==
locationTypeId
)
{
var
locationIdExist
=
location
.
Get
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
typeid
==
locationTypeId
&&
q
.
locationid
==
req
.
storeID
.
ToInt
());
q
.
locationid
==
req
.
storeID
.
ToInt
()
&&
q
.
storageid
==
req
.
warehouseid
);
if
(
locationIdExist
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
IDExist
);
...
...
@@ -1074,7 +1073,7 @@ namespace Siger.ApiWMS.Controllers
if
(
Location
.
id
==
locationTypeId
)
{
var
locationIdExist
=
location
.
Get
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
typeid
==
locationTypeId
&&
q
.
locationid
==
req
.
storeID
.
ToInt
()
&&
q
.
id
!=
Location
.
locationid
.
ToInt
());
q
.
locationid
==
req
.
storeID
.
ToInt
()
&&
q
.
id
!=
Location
.
locationid
.
ToInt
()
&&
q
.
storageid
==
req
.
warehouseid
);
if
(
locationIdExist
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
IDExist
);
...
...
Server/Common/Siger.Middlelayer.Share/Constant/DictKeyValConst.cs
View file @
17f44366
...
...
@@ -38,5 +38,10 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary>
public
const
string
UploadloadStation
=
"LoadStation"
;
/// <summary>
/// 立库
/// </summary>
public
const
string
WarehouseStation
=
"WarehouseStation"
;
}
}
Server/Common/Siger.Middlelayer.Share/Enum/CommonEnum.cs
View file @
17f44366
...
...
@@ -236,6 +236,7 @@ namespace Siger.Middlelayer.Common
FixtureToolsTemplate
,
FixtureToolsProductTemplate
,
FixtureToolsAssmeblyTemplate
,
AutomationLocationTemplate
,
}
public
enum
LogLevel
...
...
Server/Common/Siger.Middlelayer.Share/Enum/ModuleEnum/AccEnum.cs
View file @
17f44366
...
...
@@ -332,7 +332,11 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[
Description
(
"设备正在空闲中"
)]
MachineOnFree
,
[
Description
(
"设备已经生产完成"
)]
MachineProCompalate
MachineProCompalate
,
[
Description
(
"该设备当前无工装状态"
)]
MonitorNotfound
,
[
Description
(
"未配置字典信息"
)]
AutomationDictNotfound
}
public
enum
SeriNumCfg
...
...
Server/Common/Siger.Middlelayer.Share/Enum/ModuleEnum/Automation.cs
View file @
17f44366
...
...
@@ -45,21 +45,23 @@ namespace Siger.Middlelayer.Share.Enum.ModuleEnum
public
enum
TaskResultStatus
{
/// <summary>
/// 取消
/// </summary>
Cancel
=
0
,
/// <summary>
/// 待生产
/// </summary>
[
Description
(
"待执行"
)]
Waiting
=
1
,
/// <summary>
/// 生产中
/// </summary>
[
Description
(
"执行中"
)]
Produce
=
2
,
/// <summary>
/// 生产完成
/// </summary>
Complated
=
3
[
Description
(
"任务完成"
)]
Complated
=
3
,
[
Description
(
"取消"
)]
Cancel
=
4
,
}
/// <summary>
/// 设备状态 (自动任务)
...
...
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
View file @
17f44366
...
...
@@ -1465,7 +1465,7 @@ namespace Siger.Middlelayer.Common
[
Description
(
"未找到储位类别"
)]
LocationTypeNotFound
,
[
Description
(
"未找到工装类
别
"
)]
[
Description
(
"未找到工装类
型
"
)]
FixtureToolCatgeoryNotFound
,
[
Description
(
"未找到工装信息"
)]
...
...
@@ -1476,5 +1476,8 @@ namespace Siger.Middlelayer.Common
[
Description
(
"父级和子级不能相同"
)]
ParentSonSame
,
[
Description
(
"该类型绑定了工装,不能删除"
)]
CategoryBindFixtureToolData
,
}
}
Server/Common/Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
View file @
17f44366
...
...
@@ -4,7 +4,7 @@ namespace Siger.Middlelayer.Utility.ImportEntities
{
public
class
FixtureToolsCategoryTemplate
:
ImportBase
{
[
ExcelColumn
(
"
工装类型*
"
)]
[
ExcelColumn
(
"
*工装类型
"
)]
public
string
Fixture
{
get
;
set
;
}
[
ExcelColumn
(
"上级类型"
)]
...
...
@@ -13,28 +13,58 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public
class
FixtureToolsTemplate
:
ImportBase
{
[
ExcelColumn
(
"
工装类型*
"
)]
[
ExcelColumn
(
"
*工装类型
"
)]
public
string
Catgeory
{
get
;
set
;
}
[
ExcelColumn
(
"
管理类型*
"
)]
[
ExcelColumn
(
"
*管理类型
"
)]
public
string
Manage
{
get
;
set
;
}
[
ExcelColumn
(
"
工装名称*
"
)]
[
ExcelColumn
(
"
*工装名称
"
)]
public
string
Name
{
get
;
set
;
}
[
ExcelColumn
(
"
工装料号*
"
)]
[
ExcelColumn
(
"
*工装料号
"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"
工装编号*
"
)]
[
ExcelColumn
(
"
*工装编号
"
)]
public
string
Code
{
get
;
set
;
}
[
ExcelColumn
(
"
规格型号*
"
)]
[
ExcelColumn
(
"
*规格型号
"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"
数量*
"
)]
[
ExcelColumn
(
"
*数量
"
)]
public
string
Number
{
get
;
set
;
}
[
ExcelColumn
(
"状态*"
)]
[
ExcelColumn
(
"*状态"
)]
public
string
Status
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
FixtureToolsList
:
ImportBase
{
[
ExcelColumn
(
"工装类型"
)]
public
string
Catgeory
{
get
;
set
;
}
[
ExcelColumn
(
"管理类型"
)]
public
string
Manage
{
get
;
set
;
}
[
ExcelColumn
(
"工装名称"
)]
public
string
Name
{
get
;
set
;
}
[
ExcelColumn
(
"工装料号"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"工装编号"
)]
public
string
Code
{
get
;
set
;
}
[
ExcelColumn
(
"规格型号"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"数量"
)]
public
string
Number
{
get
;
set
;
}
[
ExcelColumn
(
"状态"
)]
public
string
Status
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
...
...
@@ -49,25 +79,171 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public
class
FixtureToolsProductTemplate
:
ImportBase
{
[
ExcelColumn
(
"工装编号*"
)]
[
ExcelColumn
(
"工装类型"
)]
public
string
Categroy
{
get
;
set
;
}
[
ExcelColumn
(
"*工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"
产品名称*
"
)]
[
ExcelColumn
(
"
*产品编号
"
)]
public
string
Product
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
FixtureToolsProductList
:
ImportBase
{
[
ExcelColumn
(
"工装类型"
)]
public
string
Category
{
get
;
set
;
}
[
ExcelColumn
(
"工装料号"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"规格型号"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"产品编号"
)]
public
string
ProductCode
{
get
;
set
;
}
[
ExcelColumn
(
"产品名称"
)]
public
string
Product
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"维护人"
)]
public
string
Updator
{
get
;
set
;
}
[
ExcelColumn
(
"维护时间"
)]
public
string
UpdateTime
{
get
;
set
;
}
}
public
class
FixtureToolsAssmeblyTemplate
:
ImportBase
{
[
ExcelColumn
(
"父工装编号*"
)]
[
ExcelColumn
(
"父工装类型"
)]
public
string
ParentCategory
{
get
;
set
;
}
[
ExcelColumn
(
"*父工装名称"
)]
public
string
ParentFixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"子工装编号*"
)]
[
ExcelColumn
(
"子工装类型"
)]
public
string
Category
{
get
;
set
;
}
[
ExcelColumn
(
"*子工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"*状态"
)]
public
string
Status
{
get
;
set
;
}
}
public
class
FixtureToolsAssmeblyList
:
ImportBase
{
[
ExcelColumn
(
"父工装类型"
)]
public
string
ParentCategory
{
get
;
set
;
}
[
ExcelColumn
(
"父工装料号"
)]
public
string
ParentPartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"父工装名称"
)]
public
string
ParentFixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"父工装规格"
)]
public
string
ParentSpecfication
{
get
;
set
;
}
[
ExcelColumn
(
"父工装编号"
)]
public
string
ParentCode
{
get
;
set
;
}
[
ExcelColumn
(
"子工装类型"
)]
public
string
Category
{
get
;
set
;
}
[
ExcelColumn
(
"子工装料号"
)]
public
string
PartNumber
{
get
;
set
;
}
[
ExcelColumn
(
"子工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"子工装规格"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"子工装编号"
)]
public
string
Code
{
get
;
set
;
}
[
ExcelColumn
(
"状态"
)]
public
string
Status
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"维护人"
)]
public
string
Updator
{
get
;
set
;
}
[
ExcelColumn
(
"维护时间"
)]
public
string
UpdateTime
{
get
;
set
;
}
}
public
class
AutomationLocationTemplate
:
ImportBase
{
[
ExcelColumn
(
"*仓库名称"
)]
public
string
Warehouse
{
get
;
set
;
}
[
ExcelColumn
(
"*储位ID"
)]
public
string
LocationId
{
get
;
set
;
}
[
ExcelColumn
(
"*工装名称"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
AutomationLocationList
:
ImportBase
{
[
ExcelColumn
(
"仓库名称"
)]
public
string
Warehouse
{
get
;
set
;
}
[
ExcelColumn
(
"储位信息"
)]
public
string
Location
{
get
;
set
;
}
[
ExcelColumn
(
"储位ID"
)]
public
string
LocationId
{
get
;
set
;
}
[
ExcelColumn
(
"工装类别"
)]
public
string
Catgeory
{
get
;
set
;
}
[
ExcelColumn
(
"工装编号"
)]
public
string
Code
{
get
;
set
;
}
[
ExcelColumn
(
"工装名称"
)]
public
string
Name
{
get
;
set
;
}
[
ExcelColumn
(
"工装规格"
)]
public
string
Specfication
{
get
;
set
;
}
[
ExcelColumn
(
"工件编号"
)]
public
string
SN
{
get
;
set
;
}
[
ExcelColumn
(
"工序顺序"
)]
public
string
RouteNumber
{
get
;
set
;
}
[
ExcelColumn
(
"工序名称"
)]
public
string
RouteName
{
get
;
set
;
}
[
ExcelColumn
(
"物料状态"
)]
public
string
State
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
[
ExcelColumn
(
"维护人"
)]
public
string
Updator
{
get
;
set
;
}
[
ExcelColumn
(
"维护时间"
)]
public
string
UpdateTime
{
get
;
set
;
}
}
}
Server/Common/Siger.Middlelayer.Utility/ImportEntities/ManualCollectionList.cs
View file @
17f44366
...
...
@@ -14,14 +14,13 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[
ExcelColumn
(
"产品名称"
)]
public
string
ProductName
{
get
;
set
;
}
[
ExcelColumn
(
"工序"
)]
public
string
RouteName
{
get
;
set
;
}
[
ExcelColumn
(
"位置"
)]
public
string
Section
{
get
;
set
;
}
[
ExcelColumn
(
"工单"
)]
public
string
WorkOrder
{
get
;
set
;
}
[
ExcelColumn
(
"工艺"
)]
public
string
RouteName
{
get
;
set
;
}
[
ExcelColumn
(
"二维码"
)]
public
string
SN
{
get
;
set
;
}
[
ExcelColumn
(
"偏差放行数量"
)]
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_fixture_tools_monitor.cs
View file @
17f44366
...
...
@@ -40,6 +40,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
public
DateTime
updatetime
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
/// <summary>
/// 产品ID
/// </summary>
public
int
productId
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
string
productCode
{
get
;
set
;
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_location.cs
View file @
17f44366
...
...
@@ -11,6 +11,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
{
public
string
guid
{
get
;
set
;
}
/// <summary>
/// 储位自增ID
/// </summary>
public
int
location_cid
{
get
;
set
;
}
/// <summary>
/// 储位位置
/// </summary>
public
int
locationid
{
get
;
set
;
}
...
...
@@ -18,6 +22,33 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 工装GUID
/// </summary>
public
string
fixturetools
{
get
;
set
;
}
public
string
fixturename
{
get
;
set
;
}
public
int
productid
{
get
;
set
;
}
public
string
productcode
{
get
;
set
;
}
public
string
productname
{
get
;
set
;
}
/// <summary>
/// 工件对应的工单号
/// </summary>
public
string
ordernumber
{
get
;
set
;
}
/// <summary>
/// 工装工件
/// </summary>
public
string
sn
{
get
;
set
;
}
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public
int
routeid
{
get
;
set
;
}
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public
string
route
{
get
;
set
;
}
/// <summary>
/// 工序顺序
/// </summary>
public
int
routenum
{
get
;
set
;
}
/// <summary>
/// 附件
/// </summary>
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_task_list.cs
View file @
17f44366
...
...
@@ -20,6 +20,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
public
string
fixtureguid
{
get
;
set
;
}
/// <summary>
/// 工装Name
/// </summary>
public
string
fixturename
{
get
;
set
;
}
/// <summary>
/// 工位ID
/// </summary>
public
int
sectionid
{
get
;
set
;
}
...
...
@@ -47,6 +51,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 产品code
/// </summary>
public
string
productcode
{
get
;
set
;
}
public
string
productname
{
get
;
set
;
}
/// <summary>
/// 工序ID
/// </summary>
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_check_sn_list.cs
0 → 100644
View file @
17f44366
using
System
;
namespace
Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// snList
/// </summary>
public
class
siger_check_sn_list
:
AccEntityBase
{
public
string
SN
{
get
;
set
;
}
public
string
BatchNumber
{
get
;
set
;
}
public
int
ProductID
{
get
;
set
;
}
public
string
ProductCode
{
get
;
set
;
}
public
int
MaterialID
{
get
;
set
;
}
public
string
PartNumber
{
get
;
set
;
}
public
int
LineID
{
get
;
set
;
}
public
string
StateCode
{
get
;
set
;
}
public
string
WorkOrder
{
get
;
set
;
}
public
DateTime
CreateTime
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_check_sn_trace_detail.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// siger_check_sn_trace_detail
/// </summary>
public
class
siger_check_sn_trace_detail
:
AccEntityBase
{
[
NotMapped
]
public
int
id
{
get
;
set
;
}
[
Key
]
public
long
ID
{
get
;
set
;
}
public
int
MachineID
{
get
;
set
;
}
public
string
TraceID
{
get
;
set
;
}
public
string
SN
{
get
;
set
;
}
public
int
ItemID
{
get
;
set
;
}
public
string
ItemName
{
get
;
set
;
}
public
double
?
Value
{
get
;
set
;
}
public
string
Result
{
get
;
set
;
}
public
DateTime
CreateTime
{
get
;
set
;
}
public
double
?
LowerLimit
{
get
;
set
;
}
public
double
?
UpperLimit
{
get
;
set
;
}
public
int
NumberIndex
{
get
;
set
;
}
/// <summary>
/// 쳣״̬ abnomal_rulekey
/// </summary>
public
string
abnomal_status
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_check_sn_trace_file.cs
0 → 100644
View file @
17f44366
namespace
Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 检验数据附件
/// </summary>
public
class
siger_check_sn_trace_file
:
AccEntityBase
{
public
int
trace_id
{
get
;
set
;
}
public
string
url
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
int
size
{
get
;
set
;
}
public
int
file_type
{
get
;
set
;
}
/// <summary>
/// 检验方式1->进料检验2->送检检验3->人工检验
/// </summary>
public
int
trace_type
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_check_sn_trace_inspection.cs
0 → 100644
View file @
17f44366
using
System
;
namespace
Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// trace扩展表
/// </summary>
public
class
siger_check_sn_trace_inspection
:
AccEntityBase
{
public
string
trace_id
{
get
;
set
;
}
/// <summary>
/// 检测室字典key
/// </summary>
public
string
testroom
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
productid
{
get
;
set
;
}
public
int
materialid
{
get
;
set
;
}
/// <summary>
/// 工位ID
/// </summary>
public
int
sectionid
{
get
;
set
;
}
/// <summary>
/// 二维码
/// </summary>
public
string
sn
{
get
;
set
;
}
/// <summary>
/// 工序ID
/// </summary>
public
int
routeid
{
get
;
set
;
}
/// <summary>
/// 检验类型
/// </summary>
public
int
check_type
{
get
;
set
;
}
/// <summary>
/// 1->待接收2->检测完成3->待检验4->检验中
/// </summary>
public
int
check_status
{
get
;
set
;
}
/// <summary>
/// 结果
/// </summary>
public
string
result
{
get
;
set
;
}
/// <summary>
/// 送检人
/// </summary>
public
int
send_mid
{
get
;
set
;
}
/// <summary>
/// 送检时间
/// </summary>
public
DateTime
send_time
{
get
;
set
;
}
/// <summary>
/// 检验人
/// </summary>
public
int
check_mid
{
get
;
set
;
}
/// <summary>
/// 检验时间
/// </summary>
public
DateTime
?
check_time
{
get
;
set
;
}
/// <summary>
/// 扩展表类别 1->送检检验2->人工检验
/// </summary>
public
int
inspection_type
{
get
;
set
;
}
public
int
number
{
get
;
set
;
}
/// <summary>
/// 送检原因
/// </summary>
public
string
reason
{
get
;
set
;
}
public
string
workorder
{
get
;
set
;
}
/// <summary>
/// 偏差放行数量
/// </summary>
public
int
quantity
{
get
;
set
;
}
/// <summary>
/// 接收人
/// </summary>
public
int
recieve_mid
{
get
;
set
;
}
/// <summary>
/// 接收时间
/// </summary>
public
DateTime
?
recieve_time
{
get
;
set
;
}
/// <summary>
/// 开始检验人
/// </summary>
public
int
checking_mid
{
get
;
set
;
}
/// <summary>
/// 开始检验时间
/// </summary>
public
DateTime
?
checking_time
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_qms_inspection_standard.cs
View file @
17f44366
...
...
@@ -131,5 +131,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 是否触发安灯0不触发 1触发
/// </summary>
public
int
trigger_andon
{
get
;
set
;
}
public
string
image
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsAssemblyRepository.cs
View file @
17f44366
...
...
@@ -7,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -21,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
s
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_assembly
join
t1
in
_context
.
siger_automation_fixture_tools
on
q
.
parent
equals
t1
.
guid
into
tt1
...
...
@@ -32,8 +35,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join
c2
in
_context
.
siger_automation_fixture_tools_category
on
t2
.
category
equals
c2
.
guid
join
u
in
_context
.
siger_project_user
on
q
.
updator
equals
u
.
mid
into
uu
from
u
in
uu
.
DefaultIfEmpty
()
join
s
in
_context
.
siger_automation_fixture_tools_assembly
on
q
.
son
equals
s
.
parent
into
ss
from
s
in
ss
.
DefaultIfEmpty
()
join
st2
in
_context
.
siger_automation_fixture_tools
on
s
.
son
equals
st2
.
guid
into
stt2
from
st2
in
stt2
.
DefaultIfEmpty
()
join
sc2
in
_context
.
siger_automation_fixture_tools_category
on
st2
.
category
equals
sc2
.
guid
into
scc2
from
sc2
in
scc2
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
string
.
IsNullOrEmpty
(
q
.
parent
)
select
new
ResponseAumationFixtureToolsAssembly
select
new
ResponseAumationFixtureToolsAssembly
s
{
id
=
q
.
id
,
parentid
=
t1
==
null
?
0
:
t1
.
id
,
...
...
@@ -50,35 +59,56 @@ namespace Siger.Middlelayer.AccRepository.Repositories
categoryid
=
c2
.
id
,
category
=
c2
.
name
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
,
cate_guid
=
t2
.
guid
,
parentcate_guid
=
t1
.
guid
,
cate_guid
=
c2
.
guid
??
""
,
parentcate_guid
=
c1
.
guid
??
""
,
parentguid
=
q
.
parent
,
fixtureguid
=
q
.
son
,
remark
=
q
.
remark
,
parentcategoryid
=
c1
==
null
?
0
:
c1
.
id
parentcategoryid
=
c1
==
null
?
0
:
c1
.
id
,
parentcategory
=
c1
.
name
??
""
,
parentpartnumber
=
t1
.
partnumber
??
""
,
parentspecfication
=
t1
.
specification
??
""
,
parentcode
=
t1
.
code
??
""
,
son_code
=
st2
.
code
??
""
,
son_name
=
st2
.
code
??
""
,
son_categoryid
=
sc2
==
null
?
0
:
sc2
.
id
,
son_status
=
s
==
null
?
-
1
:
s
.
status
,
};
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
categoryExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
s
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
{
categoryExpression
=
q
=>
q
.
categoryid
==
category
;
categoryExpression
=
q
=>
(
q
.
categoryid
==
category
||
q
.
son_categoryid
==
category
)
;
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
codeExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
s
,
bool
>>
codeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
code
))
{
c
ategoryExpression
=
q
=>
q
.
code
.
Contains
(
code
);
c
odeExpression
=
q
=>
(
q
.
code
.
Contains
(
code
)
||
q
.
son_code
.
Contains
(
code
)
);
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
nameExpression
=
f
=>
true
;
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
s
,
bool
>>
nameExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
name
))
{
nameExpression
=
q
=>
q
.
name
.
Contains
(
name
);
nameExpression
=
q
=>
(
q
.
name
.
Contains
(
name
)
||
q
.
son_name
.
Contains
(
name
));
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssemblys
,
bool
>>
stateExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
state
))
{
stateExpression
=
q
=>
(
q
.
status
==
state
.
ToInt
()
||
q
.
son_status
==
state
.
ToInt
());
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
).
And
(
stateExpression
);
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
expression
).
GroupBy
(
q
=>
q
.
fixtureguid
).
Select
(
q
=>
q
.
FirstOrDefault
()).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssemblys
>(
entities
,
entities
.
Count
);
}
else
{
var
entities
=
query
.
Where
(
expression
).
GroupBy
(
q
=>
q
.
fixtureguid
).
Select
(
q
=>
q
.
FirstOrDefault
()).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
GroupBy
(
q
=>
q
.
fixtureguid
).
Select
(
q
=>
q
.
FirstOrDefault
()).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssemblys
>(
entities
,
totalCount
);
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
);
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>(
entities
,
totalCount
);
}
public
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
projectid
)
public
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_assembly
join
t1
in
_context
.
siger_automation_fixture_tools
on
q
.
parent
equals
t1
.
guid
into
tt1
...
...
@@ -106,14 +136,142 @@ namespace Siger.Middlelayer.AccRepository.Repositories
categoryid
=
c2
.
id
,
category
=
c2
.
name
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
,
cate_guid
=
t2
.
guid
,
parentcate_guid
=
t1
.
guid
,
cate_guid
=
c2
.
guid
??
""
,
parentcate_guid
=
c1
.
guid
??
""
,
parentguid
=
q
.
parent
,
fixtureguid
=
q
.
son
,
remark
=
q
.
remark
remark
=
q
.
remark
,
parentcategoryid
=
c1
==
null
?
0
:
c1
.
id
,
parentcategory
=
c1
.
name
??
""
,
parentpartnumber
=
t1
.
partnumber
??
""
,
parentspecfication
=
t1
.
specification
??
""
,
parentcode
=
t1
.
code
??
""
};
var
entities
=
query
.
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
{
categoryExpression
=
q
=>
q
.
categoryid
==
category
;
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
codeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
code
))
{
codeExpression
=
q
=>
q
.
code
.
Contains
(
code
);
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
nameExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
name
))
{
nameExpression
=
q
=>
q
.
name
.
Contains
(
name
);
}
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
stateExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
state
))
{
stateExpression
=
q
=>
q
.
status
==
state
.
ToInt
();
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
).
And
(
stateExpression
);
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
entities
;
}
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsAssmeblyTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
var
entities
=
new
List
<
siger_automation_fixture_tools_assembly
>();
if
(
string
.
IsNullOrEmpty
(
item
.
FixtureTool
)
||
string
.
IsNullOrEmpty
(
item
.
ParentFixtureTool
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
if
(
item
.
ParentFixtureTool
==
item
.
FixtureTool
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParentSonSame
}
"
);
}
var
parent
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
ParentFixtureTool
&&
q
.
projectId
==
projectid
);
if
(
parent
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
son
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
FixtureTool
&&
q
.
projectId
==
projectid
);
if
(
son
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
parentGuid
=
parent
.
guid
;
var
exsit
=
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
son
.
guid
&&
q
.
parent
==
parentGuid
);
if
(
exsit
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
&&
q
.
ParentFixtureTool
==
item
.
ParentFixtureTool
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
var
parentExsit
=
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
parentGuid
);
if
(
parentExsit
!=
null
&&
!
string
.
IsNullOrEmpty
(
parentExsit
.
parent
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
LevelCountError
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
if
(
_context
.
siger_automation_fixture_tools_assembly
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
son
==
parentGuid
)
==
null
)
{
var
parentEntity
=
new
siger_automation_fixture_tools_assembly
{
guid
=
Guid
.
NewGuid
().
ToString
(),
parent
=
""
,
son
=
parent
.
guid
,
creator
=
userid
,
createtime
=
DateTime
.
Now
,
attachment
=
""
,
filename
=
""
,
projectId
=
projectid
,
updatetime
=
DateTime
.
Now
,
updator
=
userid
,
status
=
item
.
Status
==
"可用"
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
remark
=
item
.
Remark
};
_context
.
siger_automation_fixture_tools_assembly
.
Add
(
parentEntity
);
}
var
entity
=
new
siger_automation_fixture_tools_assembly
{
guid
=
Guid
.
NewGuid
().
ToString
(),
parent
=
parentGuid
,
son
=
son
.
guid
,
creator
=
userid
,
createtime
=
DateTime
.
Now
,
attachment
=
""
,
filename
=
""
,
projectId
=
projectid
,
updatetime
=
DateTime
.
Now
,
updator
=
userid
,
status
=
item
.
Status
==
"可用"
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
remark
=
item
.
Remark
};
entities
.
Add
(
entity
);
try
{
_context
.
siger_automation_fixture_tools_assembly
.
AddRange
(
entities
);
_context
.
SaveChanges
();
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
return
new
CommonImportResult
(
1
,
"1"
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsCategoryRepository.cs
View file @
17f44366
...
...
@@ -8,8 +8,10 @@ using Siger.Middlelayer.AccRepository.Repositories.Interface;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -21,7 +23,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
int
id
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
public
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
List
<
int
>
id
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
Expression
<
Func
<
ResponseFixtureToolsCategory
,
bool
>>
FunNum
=
f
=>
true
;
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_category
...
...
@@ -39,9 +41,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
createtime
=
q
.
createtime
.
ToString
(
ParameterConstant
.
DateTimeFormat
),
time
=
q
.
createtime
};
if
(
id
>
0
)
if
(
id
.
Any
()
)
{
FunNum
=
q
=>
q
.
id
==
id
;
FunNum
=
q
=>
id
.
Contains
(
q
.
id
)
;
}
if
(
toexcel
.
ToInt
()
==
1
)
{
...
...
@@ -55,5 +57,65 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return
new
PagedCollectionResult
<
ResponseFixtureToolsCategory
>(
entities
,
totalCount
);
}
}
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsCategoryTemplate
>
list
,
int
projectid
)
{
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
if
(
string
.
IsNullOrEmpty
(
item
.
Fixture
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
data
=
_context
.
siger_automation_fixture_tools_category
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
item
.
Fixture
);
if
(
data
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
var
parent
=
""
;
if
(!
string
.
IsNullOrEmpty
(
item
.
Parent
))
{
var
exsit
=
_context
.
siger_automation_fixture_tools_category
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
name
==
item
.
Parent
);
if
(
exsit
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParentTypeError
}
"
);
}
else
{
parent
=
exsit
.
guid
;
}
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
try
{
var
entity
=
new
siger_automation_fixture_tools_category
{
guid
=
Guid
.
NewGuid
().
ToString
(),
name
=
item
.
Fixture
,
parent
=
parent
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
projectId
=
projectid
};
_context
.
siger_automation_fixture_tools_category
.
Add
(
entity
);
_context
.
SaveChanges
();
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
return
new
CommonImportResult
(
1
,
"1"
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
Microsoft.EntityFrameworkCore
;
...
...
@@ -6,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -36,7 +40,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return
query
.
FirstOrDefault
();
}
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools_product
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
...
...
@@ -80,9 +84,39 @@ namespace Siger.Middlelayer.AccRepository.Repositories
productExpression
=
q
=>
q
.
productid
==
product
;
}
var
expression
=
categoryExpression
.
And
(
toolExpression
).
And
(
productExpression
);
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>(
entities
,
totalCount
);
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>(
entities
,
entities
.
Count
);
}
else
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>(
entities
,
totalCount
);
}
}
/// <summary>
/// 获取 交期最早的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
int
>
productIds
,
int
projectId
)
{
var
query
=
from
d
in
_context
.
siger_project_product_plan_detail
join
p
in
_context
.
siger_project_product_plan
on
d
.
PlanId
equals
p
.
id
where
d
.
projectId
==
projectId
&&
productIds
.
Contains
(
p
.
product_id
)
&&
d
.
status
!=
(
int
)
RowState
.
Invalid
&&
p
.
status
!=
(
int
)
RowState
.
Invalid
select
new
ResponseAutomationPlanOrder
{
productId
=
p
.
product_id
,
ordernumber
=
d
.
OrderNumber
,
productCode
=
p
.
product_code
,
productName
=
p
.
product_name
,
delvery
=
p
.
delivery_time
,
};
return
query
.
OrderBy
(
f
=>
f
.
delvery
);
}
public
ResponsePlanlFixtureInfo
GetPlanFixtureInfo
(
int
projectId
,
string
ordernumber
)
...
...
@@ -93,7 +127,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join
q
in
_context
.
siger_automation_fixture_tools_product
on
p
.
product_code
equals
q
.
productcode
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
join
l
in
_context
.
siger_automation_location
on
t
.
guid
equals
l
.
fixturetools
where
q
.
projectId
==
projectId
&&
d
.
OrderNumber
==
ordernumber
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
status
==
(
int
)
RowState
.
Valid
where
q
.
projectId
==
projectId
&&
d
.
OrderNumber
==
ordernumber
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
l
.
status
==(
int
)
RowState
.
Valid
select
new
ResponsePlanlFixtureInfo
{
OrderNumber
=
ordernumber
,
...
...
@@ -105,5 +140,81 @@ namespace Siger.Middlelayer.AccRepository.Repositories
};
return
query
.
FirstOrDefault
();
}
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsProductTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
entities
=
new
List
<
siger_automation_fixture_tools_product
>();
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
if
(
string
.
IsNullOrEmpty
(
item
.
FixtureTool
)
||
string
.
IsNullOrEmpty
(
item
.
Product
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
fixtureTool
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
name
==
item
.
FixtureTool
);
if
(
fixtureTool
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
product
=
_context
.
siger_project_product
.
FirstOrDefault
(
q
=>
q
.
projectid
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
code
==
item
.
Product
);
if
(
product
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ProductNotFound
}
"
);
}
if
(
fixtureTool
!=
null
&&
product
!=
null
)
{
var
data
=
_context
.
siger_automation_fixture_tools_product
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
fixtureTool
.
guid
||
q
.
productid
==
product
.
id
));
if
(
data
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
||
q
.
Product
==
item
.
Product
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
var
entity
=
new
siger_automation_fixture_tools_product
{
guid
=
Guid
.
NewGuid
().
ToString
(),
fixturetools
=
fixtureTool
.
guid
,
remark
=
item
.
Remark
,
productid
=
product
.
id
,
productcode
=
product
.
code
,
projectId
=
projectid
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
creator
=
userid
,
updator
=
userid
,
attachment
=
""
,
filename
=
""
};
entities
.
Add
(
entity
);
}
try
{
_context
.
siger_automation_fixture_tools_product
.
AddRange
(
entities
);
_context
.
SaveChanges
();
return
new
CommonImportResult
(
1
,
"1"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsRepository.cs
View file @
17f44366
...
...
@@ -8,9 +8,11 @@ using Siger.Middlelayer.AccRepository.Repositories.Interface;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -22,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseFixtureTools
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
state
,
public
IPagedCollectionResult
<
ResponseFixtureTools
>
GetPagedList
(
List
<
int
>
category
,
string
code
,
string
name
,
int
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools
...
...
@@ -51,9 +53,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
};
Expression
<
Func
<
ResponseFixtureTools
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
if
(
category
.
Any
()
)
{
categoryExpression
=
q
=>
q
.
categoryid
==
category
;
categoryExpression
=
q
=>
category
.
Contains
(
q
.
categoryid
)
;
}
Expression
<
Func
<
ResponseFixtureTools
,
bool
>>
codeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
code
))
...
...
@@ -85,7 +87,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
public
IEnumerable
<
ResponseFixtureTools
>
GetDataList
(
int
categoryid
,
int
projectid
)
public
IEnumerable
<
ResponseFixtureTools
>
GetDataList
(
List
<
int
>
categoryid
,
int
projectid
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools
join
p
in
_context
.
siger_automation_fixture_tools_category
on
q
.
category
equals
p
.
guid
...
...
@@ -107,9 +109,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
status
=
q
.
status
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
};
if
(
categoryid
>
0
)
if
(
categoryid
.
Any
()
)
{
query
=
query
.
Where
(
q
=>
q
.
categoryid
==
categoryid
);
query
=
query
.
Where
(
q
=>
categoryid
.
Contains
(
q
.
categoryid
)
);
}
var
entities
=
query
.
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
entities
;
...
...
@@ -128,5 +130,78 @@ namespace Siger.Middlelayer.AccRepository.Repositories
};
return
query
.
FirstOrDefault
();
}
public
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
entities
=
new
List
<
siger_automation_fixture_tools
>();
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
foreach
(
var
item
in
list
)
{
rowIndex
++;
if
(
string
.
IsNullOrEmpty
(
item
.
PartNumber
)
||
string
.
IsNullOrEmpty
(
item
.
Code
)
||
string
.
IsNullOrEmpty
(
item
.
Name
)
||
string
.
IsNullOrEmpty
(
item
.
Catgeory
)
||
string
.
IsNullOrEmpty
(
item
.
Manage
)
||
string
.
IsNullOrEmpty
(
item
.
Number
)
||
string
.
IsNullOrEmpty
(
item
.
Status
)
||
string
.
IsNullOrEmpty
(
item
.
Specfication
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
data
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
(
q
.
name
==
item
.
Name
||
q
.
code
==
item
.
Code
||
q
.
partnumber
==
item
.
PartNumber
));
if
(
data
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
list
.
Count
(
q
=>
q
.
Name
==
item
.
Name
||
q
.
Code
==
item
.
Code
||
q
.
PartNumber
==
item
.
PartNumber
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
var
category
=
_context
.
siger_automation_fixture_tools_category
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
Catgeory
&&
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
if
(
category
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolCatgeoryNotFound
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
var
entity
=
new
siger_automation_fixture_tools
{
guid
=
Guid
.
NewGuid
().
ToString
(),
category
=
category
.
guid
,
managetype
=
item
.
Manage
==
"单件"
?
1
:
2
,
partnumber
=
item
.
PartNumber
,
name
=
item
.
Name
,
specification
=
item
.
Specfication
,
number
=
item
.
Number
.
ToInt
(),
remark
=
item
.
Remark
,
attachment
=
""
,
filename
=
""
,
code
=
item
.
Code
,
projectId
=
projectid
,
status
=
item
.
Status
==
"可用"
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
creator
=
userid
,
updator
=
userid
,
};
entities
.
Add
(
entity
);
}
try
{
_context
.
siger_automation_fixture_tools
.
AddRange
(
entities
);
_context
.
SaveChanges
();
return
new
CommonImportResult
(
1
,
"1"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationLocationRepository.cs
View file @
17f44366
...
...
@@ -7,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Log
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
...
...
@@ -21,18 +24,16 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
)
{
var
query
=
from
q
in
_context
.
siger_automation_location
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
join
c
in
_context
.
siger_automation_fixture_tools_category
on
t
.
category
equals
c
.
guid
join
l
in
_context
.
siger_wms_storage_location
on
q
.
location
id
equals
l
.
location
id
join
l
in
_context
.
siger_wms_storage_location
on
q
.
location
_cid
equals
l
.
id
join
w
in
_context
.
siger_wms_storage
on
l
.
storageid
equals
w
.
id
join
u
in
_context
.
siger_project_user
on
q
.
updator
equals
u
.
mid
into
uu
from
u
in
uu
.
DefaultIfEmpty
()
join
m
in
_context
.
siger_automation_fixture_tools_moniter
on
q
.
fixturetools
equals
m
.
fixtureguid
into
mm
from
m
in
mm
.
DefaultIfEmpty
()
join
r
in
_context
.
siger_project_product_route
on
m
.
route
equals
r
.
id
into
rr
join
r
in
_context
.
siger_project_beat_set
on
q
.
routeid
equals
r
.
id
into
rr
from
r
in
rr
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseAutomationLocation
...
...
@@ -54,9 +55,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updator
=
u
.
name
??
""
,
status
=
q
.
status
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
,
sn
=
m
.
sn
??
""
,
route
=
r
.
name
??
""
,
routenumber
=
r
==
null
?
""
:
r
.
serialN
umber
.
ToString
(),
sn
=
q
.
sn
??
""
,
route
=
r
.
route_
name
??
""
,
routenumber
=
r
==
null
?
""
:
r
.
route_n
umber
.
ToString
(),
cate_guid
=
c
.
guid
??
""
,
categoryId
=
c
==
null
?
0
:
c
.
id
};
...
...
@@ -71,9 +72,17 @@ namespace Siger.Middlelayer.AccRepository.Repositories
locationidExpression
=
q
=>
q
.
locationid
==
locationid
;
}
var
expression
=
wavehouseidExpression
.
And
(
locationidExpression
);
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAutomationLocation
>(
entities
,
totalCount
);
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseAutomationLocation
>(
entities
,
entities
.
Count
);
}
else
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAutomationLocation
>(
entities
,
totalCount
);
}
}
public
siger_wms_storage_location
GetLocation
(
int
id
,
int
projectid
)
...
...
@@ -91,10 +100,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var
query
=
from
q
in
_context
.
siger_automation_location
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
join
c
in
_context
.
siger_automation_fixture_tools_category
on
t
.
category
equals
c
.
guid
join
l
in
_context
.
siger_wms_storage_location
on
q
.
location
id
equals
l
.
location
id
join
l
in
_context
.
siger_wms_storage_location
on
q
.
location
_cid
equals
l
.
id
join
w
in
_context
.
siger_wms_storage
on
l
.
storageid
equals
w
.
id
join
m
in
_context
.
siger_automation_fixture_tools_moniter
on
q
.
fixturetools
equals
m
.
fixtureguid
into
mm
from
m
in
mm
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseAutomationLocationList
{
...
...
@@ -109,11 +116,84 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid
=
t
.
id
,
code
=
t
.
code
,
name
=
t
.
name
,
materialsn
=
m
.
sn
??
""
,
materialsn
=
q
.
sn
??
""
,
categoryid
=
c
==
null
?
0
:
c
.
id
};
var
entities
=
query
.
AsNoTracking
().
ToList
();
return
entities
;
}
public
CommonImportResult
ImportData
(
IEnumerable
<
AutomationLocationTemplate
>
list
,
int
projectid
,
int
userid
)
{
var
errors
=
new
List
<
string
>();
var
rowIndex
=
1
;
var
entities
=
new
List
<
siger_automation_location
>();
foreach
(
var
item
in
list
)
{
rowIndex
++;
if
(
string
.
IsNullOrEmpty
(
item
.
LocationId
)
||
string
.
IsNullOrEmpty
(
item
.
FixtureTool
))
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
ParameterMiss
}
"
);
}
var
fixturetool
=
_context
.
siger_automation_fixture_tools
.
FirstOrDefault
(
q
=>
q
.
name
==
item
.
FixtureTool
&&
q
.
projectId
==
projectid
);
if
(
fixturetool
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
FixtureToolNotFound
}
"
);
}
var
warehouse
=
_context
.
siger_wms_storage
.
FirstOrDefault
(
q
=>
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
projectId
==
projectid
&&
q
.
name
==
item
.
Warehouse
);
if
(
warehouse
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
WaveHouseIDNotExist
}
"
);
}
var
location
=
_context
.
siger_wms_storage_location
.
FirstOrDefault
(
q
=>
q
.
locationid
==
item
.
LocationId
.
ToInt
()
&&
q
.
storageid
==
warehouse
.
id
&&
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
if
(
location
==
null
||
item
.
LocationId
.
ToInt
()
<=
0
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
LocationNull
}
"
);
}
var
exsit
=
_context
.
siger_automation_location
.
FirstOrDefault
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
(
q
.
fixturetools
==
fixturetool
.
guid
||
q
.
locationid
==
item
.
LocationId
.
ToInt
()));
if
(
exsit
!=
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
list
.
Count
(
q
=>
q
.
FixtureTool
==
item
.
FixtureTool
||
q
.
LocationId
==
item
.
LocationId
)
>
1
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
DataExist
}
"
);
}
if
(
errors
.
Any
())
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
var
entity
=
new
siger_automation_location
{
guid
=
Guid
.
NewGuid
().
ToString
(),
locationid
=
location
.
id
,
fixturetools
=
fixturetool
.
guid
,
attachment
=
""
,
filename
=
""
,
remark
=
item
.
Remark
,
projectId
=
projectid
,
updatetime
=
DateTime
.
Now
,
updator
=
userid
,
};
entities
.
Add
(
entity
);
}
try
{
_context
.
siger_automation_location
.
AddRange
(
entities
);
_context
.
SaveChanges
();
return
new
CommonImportResult
(
1
,
"1"
);
}
catch
(
Exception
e
)
{
Logger
.
WriteLineError
(
e
.
Message
);
throw
;
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationMachineStatusRepository.cs
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
System
;
using
System.Linq
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Linq.Expressions
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
internal
class
AutomationMachineStatusRepository
:
AccRepositoryBase
<
siger_automation_machine_status
>,
IAutomationMachineStatus
{
private
ApiAccDbContext
_context
;
public
AutomationMachineStatusRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
_context
=
context
;
}
public
IEnumerable
<
ResponseAutomationMachineStatus
>
GetSectionStatus
(
int
projectId
,
int
section
,
List
<
int
>
sections
)
{
var
data
=
from
atr
in
_context
.
siger_project_machine_attribution
join
lv
in
_context
.
siger_project_level_section
on
atr
.
station
equals
lv
.
id
join
ms
in
_context
.
siger_automation_machine_status
on
lv
.
id
equals
ms
.
section
into
mstemp
join
plv
in
_context
.
siger_project_level_section
on
lv
.
parentid
equals
plv
.
id
from
ms
in
mstemp
.
DefaultIfEmpty
()
select
new
ResponseAutomationMachineStatus
{
sectionid
=
lv
.
id
,
section
=
$"
{
plv
.
title
}
-
{
lv
.
title
}
"
,
lastupdate
=
ms
!=
null
?
ms
.
updatetime
.
ToString
():
""
,
enable
=
ms
!=
null
?
ms
.
enable
:
1
,
status
=
ms
!=
null
?
ms
.
status
:
1
,
};
Expression
<
Func
<
ResponseAutomationMachineStatus
,
bool
>>
sectionsExpression
=
f
=>
true
;
if
(
sections
.
Any
())
{
sectionsExpression
=
q
=>
sections
.
Contains
(
q
.
sectionid
);
}
return
data
.
Where
(
sectionsExpression
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationTaskListRepository.cs
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
Microsoft.EntityFrameworkCore
;
using
OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common.Extensions
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Share.Enum.ModuleEnum
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
...
...
@@ -23,7 +27,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public
bool
CanTask
(
int
projectId
,
int
section
)
{
var
taskObj
=
_context
.
siger_automation_task_list
.
FirstOrDefault
(
f
=>
f
.
projectId
==
projectId
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
//已经下发,并且任务完成
var
taskObj
=
_context
.
siger_automation_task_list
.
FirstOrDefault
(
f
=>
f
.
projectId
==
projectId
&&
f
.
send
==
1
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(
taskObj
==
null
)
return
true
;
...
...
@@ -36,14 +41,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
var
date
=
DateTime
.
Now
;
var
lable
=
date
.
ToString
(
UnixTimeHelper
.
DateTimeFormatYmd
)+
date
.
Hour
+
date
.
Minute
+
date
.
Second
+
date
.
Millisecond
;
var
lableUnix
=
UnixTimeHelper
.
GetNow
();
var
radon
=
new
Random
().
Next
(
1000
,
9999
);
if
(
trigerType
==
TaskTrigerType
.
Auto
)
{
return
$"A
{
radon
}
T
{
lable
}
"
;
return
$"A
{
lableUnix
}
R
{
radon
}
T
{
lable
}
"
;
}
else
{
return
$"M
{
radon
}
T
{
lable
}
"
;
return
$"M
{
lableUnix
}
R
{
radon
}
T
{
lable
}
"
;
}
}
...
...
@@ -55,5 +60,88 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var
randon
=
new
Random
().
Next
(
1000
,
9999
);
return
$"
{
productCode
}{
date
.
ToString
(
UnixTimeHelper
.
DateTimeFormatYmd
)}{
serinum
}{
randon
}
"
;
}
public
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
tiggertime
,
string
comptime
,
int
projectid
,
int
page
,
int
pagesize
)
{
var
query
=
from
q
in
_context
.
siger_automation_task_list
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixtureguid
equals
t
.
guid
join
s
in
_context
.
siger_project_level_section
on
q
.
sectionid
equals
s
.
id
join
lv
in
_context
.
siger_project_level_section
on
s
.
parentid
equals
lv
.
id
where
q
.
projectId
==
projectid
select
new
ResponseAutomationTasklist
{
taskno
=
q
.
no
,
sectionid
=
q
.
sectionid
,
section
=
$"
{
lv
.
title
}
-
{
s
.
title
}
"
,
trigger
=
EnumHelper
.
GetEnumDesc
(
q
.
trigger
),
triggervalue
=
q
.
triggertime
,
triggerTime
=
q
.
triggertime
==
DateTime
.
MinValue
?
""
:
q
.
triggertime
.
ToString
(),
complatevalue
=
q
.
completetime
,
complatetime
=
q
.
completetime
==
DateTime
.
MinValue
?
""
:
q
.
completetime
.
ToString
(),
action
=
EnumHelper
.
GetEnumDesc
(
q
.
action
),
actionType
=
EnumHelper
.
GetEnumDesc
(
q
.
actiontype
),
fixtureCode
=
t
.
code
,
fixtureName
=
t
.
name
,
location
=
q
.
locationid
.
ToString
(),
sn
=
q
.
sn
,
ordernumber
=
q
.
ordercode
,
productCode
=
q
.
productcode
,
program
=
q
.
programnumber
,
route
=
q
.
remark
,
tasktype
=
EnumHelper
.
GetEnumDesc
(
q
.
tasktype
),
status
=
q
.
status
,
};
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
sectonsExpression
=
f
=>
true
;
if
(
sections
.
Any
())
{
sectonsExpression
=
q
=>
sections
.
Contains
(
q
.
sectionid
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
taskTypeExpression
=
f
=>
true
;
if
(
taskType
!=
0
)
{
taskTypeExpression
=
q
=>
q
.
tasktypeid
==
taskType
;
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
productCodeExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
productCode
))
{
productCodeExpression
=
q
=>
q
.
productCode
.
Contains
(
productCode
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
tasknoExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
TaskNo
))
{
tasknoExpression
=
q
=>
q
.
taskno
.
Contains
(
TaskNo
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
snExpression
=
f
=>
true
;
if
(!
string
.
IsNullOrEmpty
(
sn
))
{
snExpression
=
q
=>
q
.
sn
.
Contains
(
sn
);
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
actionTypeExpression
=
f
=>
true
;
if
(
actionType
!=
0
)
{
actionTypeExpression
=
q
=>
q
.
actionTypeid
==
actionType
;
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
triggerTimeTypeExpression
=
f
=>
true
;
if
(
string
.
IsNullOrEmpty
(
tiggertime
))
{
triggerTimeTypeExpression
=
q
=>
q
.
triggervalue
==
tiggertime
.
ToDateTime
();
}
Expression
<
Func
<
ResponseAutomationTasklist
,
bool
>>
comptimeExpression
=
f
=>
true
;
if
(
actionType
!=
0
)
{
comptimeExpression
=
q
=>
q
.
complatevalue
==
comptime
.
ToDateTime
();
}
var
expression
=
sectonsExpression
.
And
(
taskTypeExpression
).
And
(
productCodeExpression
).
And
(
tasknoExpression
).
And
(
snExpression
)
.
And
(
actionTypeExpression
).
And
(
triggerTimeTypeExpression
).
And
(
comptimeExpression
);
var
entities
=
query
.
Where
(
expression
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
expression
).
Count
();
return
new
PagedCollectionResult
<
ResponseAutomationTasklist
>(
entities
,
totalCount
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/CheckSnListRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.Common
;
using
System.Linq
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
internal
class
CheckSnListRepository
:
AccRepositoryBase
<
siger_check_sn_list
>,
ICheckSnListRepository
{
private
readonly
ApiAccDbContext
_context
;
public
CheckSnListRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
_context
=
context
;
}
public
SigerTrRoutingEventNo
GetEventNoByResult
(
string
result
,
int
projectId
)
{
return
_context
.
siger_tr_routing_eventno
.
FirstOrDefault
(
t
=>
t
.
projectId
==
projectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
Descr
==
result
);
}
public
SigerTrRoutingOutStation
GetOutStationByEventNo
(
int
eventno
,
int
sectionId
,
int
projectId
)
{
return
_context
.
siger_tr_routing_outstation
.
FirstOrDefault
(
t
=>
t
.
projectId
==
projectId
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
EventNo
==
eventno
&&
t
.
Station
==
sectionId
);
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/CheckSnTraceDetailRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
internal
class
CheckSnTraceDetailRepository
:
AccRepositoryBase
<
siger_check_sn_trace_detail
>,
ICheckSnTraceDetailRepository
{
private
readonly
ApiAccDbContext
_context
;
public
CheckSnTraceDetailRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
_context
=
context
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/CheckSnTraceFileRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
internal
class
CheckSnTraceFileRepository
:
AccRepositoryBase
<
siger_check_sn_trace_file
>,
ICheckSnTraceFileRepository
{
private
readonly
ApiAccDbContext
_context
;
public
CheckSnTraceFileRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
_context
=
context
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/CheckSnTraceInspectionRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
internal
class
CheckSnTraceInspectionRepository
:
AccRepositoryBase
<
siger_check_sn_trace_inspection
>,
ICheckSnTraceInspectionRepository
{
private
readonly
ApiAccDbContext
_context
;
public
CheckSnTraceInspectionRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
_context
=
context
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/InspectStandardRepository.cs
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Repositories.Interface
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Repository.Response
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Repositories
{
internal
class
InspectStandardRepository
:
AccRepositoryBase
<
siger_qms_inspection_standard
>,
IInspectStandardRepository
{
private
ApiAccDbContext
accDbC
ontext
;
private
ApiAccDbContext
_c
ontext
;
public
InspectStandardRepository
(
ApiAccDbContext
context
)
:
base
(
context
)
{
accDbContext
=
context
;
_context
=
context
;
}
public
ResponseIdName
GetMachineBySectionId
(
int
sectionId
,
int
projectId
)
{
var
query
=
_context
.
siger_project_machine_attribution
.
FirstOrDefault
(
q
=>
q
.
station
==
sectionId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
attribution
==
(
int
)
MachineAttributionEnum
.
equipment
);
if
(
query
==
null
)
{
return
null
;
}
var
machine
=
_context
.
siger_project_machine
.
FirstOrDefault
(
q
=>
q
.
projectid
==
projectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
id
==
query
.
machine
);
if
(
machine
==
null
)
{
return
null
;
}
return
new
ResponseIdName
{
id
=
machine
.
id
,
name
=
machine
.
title
};
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsAssemblyRepository.cs
View file @
17f44366
...
...
@@ -2,14 +2,17 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsAssemblyRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_assembly
>
{
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
projectid
,
int
page
,
int
pagesize
);
IPagedCollectionResult
<
ResponseAumationFixtureToolsAssembly
s
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
projectid
);
IEnumerable
<
ResponseAumationFixtureToolsAssembly
>
GetDetailList
(
string
parent
,
int
category
,
string
code
,
string
name
,
string
state
,
int
projectid
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsAssmeblyTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsCategoryRepository.cs
View file @
17f44366
...
...
@@ -2,11 +2,15 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsCategoryRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_category
>
{
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
int
id
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
List
<
int
>
id
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsCategoryTemplate
>
list
,
int
projectid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsProductRepository.cs
View file @
17f44366
...
...
@@ -2,12 +2,14 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsProductRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools_product
>
{
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
);
IPagedCollectionResult
<
ResponseAumationFixtureToolsProduct
>
GetPagedList
(
int
category
,
int
tool
,
int
product
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
);
ResponseProductFixtureInfo
GetFixtureInfoByProductCode
(
int
projectId
,
string
productCode
);
...
...
@@ -19,5 +21,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <returns></returns>
ResponsePlanlFixtureInfo
GetPlanFixtureInfo
(
int
projectId
,
string
ordernumber
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsProductTemplate
>
list
,
int
projectid
,
int
userid
);
/// <summary>
/// 获取交期最近的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
int
>
productIds
,
int
projectId
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsRepository.cs
View file @
17f44366
...
...
@@ -2,17 +2,20 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationFixtureToolsRepository
:
IAccRepositoryBase
<
siger_automation_fixture_tools
>
{
IPagedCollectionResult
<
ResponseFixtureTools
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
state
,
IPagedCollectionResult
<
ResponseFixtureTools
>
GetPagedList
(
List
<
int
>
category
,
string
code
,
string
name
,
int
state
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
IEnumerable
<
ResponseFixtureTools
>
GetDataList
(
int
categoryid
,
int
projectid
);
IEnumerable
<
ResponseFixtureTools
>
GetDataList
(
List
<
int
>
categoryid
,
int
projectid
);
ResponseProductFixtureInfo
GetProductFixtureLocation
(
int
projectId
,
string
guid
);
CommonImportResult
ImportData
(
IEnumerable
<
FixtureToolsTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationLocationRepository.cs
View file @
17f44366
...
...
@@ -2,13 +2,14 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
Siger.Middlelayer.Utility.ImportEntities
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationLocationRepository
:
IAccRepositoryBase
<
siger_automation_location
>
{
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
);
IPagedCollectionResult
<
ResponseAutomationLocation
>
GetPagedList
(
int
wavehouseid
,
int
locationid
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
);
siger_wms_storage_location
GetLocation
(
int
id
,
int
projectid
);
...
...
@@ -16,5 +17,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
IEnumerable
<
ResponseAutomationLocationList
>
GetDataList
(
int
projectid
);
IEnumerable
<
siger_wms_storage_location
>
GetLocationList
(
int
projectid
);
CommonImportResult
ImportData
(
IEnumerable
<
AutomationLocationTemplate
>
list
,
int
projectid
,
int
userid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationMachineStatus.cs
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -7,5 +8,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IAutomationMachineStatus
:
IAccRepositoryBase
<
siger_automation_machine_status
>
{
IEnumerable
<
ResponseAutomationMachineStatus
>
GetSectionStatus
(
int
projectId
,
int
section
,
List
<
int
>
sections
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationTaskListRepository.cs
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
using
System.Collections.Generic
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
...
...
@@ -10,7 +12,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <summary>
/// 是否能创建任务
///
上下料时候
是否能创建任务
/// </summary>
/// <param name="projectId"></param>
/// <param name="section"></param>
...
...
@@ -22,5 +24,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// </summary>
/// <returns></returns>
string
CreateRandonSn
(
string
productCode
);
IPagedCollectionResult
<
ResponseAutomationTasklist
>
GetTasklistPagedList
(
List
<
int
>
sections
,
int
taskType
,
string
productCode
,
string
TaskNo
,
string
sn
,
int
status
,
int
actionType
,
string
tiggertime
,
string
comptime
,
int
projectid
,
int
page
,
int
pagesize
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/ICheckSnListRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
ICheckSnListRepository
:
IAccRepositoryBase
<
siger_check_sn_list
>
{
SigerTrRoutingEventNo
GetEventNoByResult
(
string
result
,
int
projectId
);
SigerTrRoutingOutStation
GetOutStationByEventNo
(
int
eventno
,
int
sectionId
,
int
projectId
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/ICheckSnTraceDetailRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
ICheckSnTraceDetailRepository
:
IAccRepositoryBase
<
siger_check_sn_trace_detail
>
{
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/ICheckSnTraceFileRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
ICheckSnTraceFileRepository
:
IAccRepositoryBase
<
siger_check_sn_trace_file
>
{
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/ICheckSnTraceInspectionRepository.cs
0 → 100644
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
namespace
Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
ICheckSnTraceInspectionRepository
:
IAccRepositoryBase
<
siger_check_sn_trace_inspection
>
{
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IInspectStandardRepository.cs
View file @
17f44366
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.Repository.Response
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -7,5 +8,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public
interface
IInspectStandardRepository
:
IAccRepositoryBase
<
siger_qms_inspection_standard
>
{
ResponseIdName
GetMachineBySectionId
(
int
sectionId
,
int
projectId
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/RequestAddQmsCheck.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
namespace
Siger.Middlelayer.AccRepository.Request
{
public
class
RequestAddDataCollection
{
public
List
<
DataCollectionDetail
>
details
{
get
;
set
;
}
=
new
List
<
DataCollectionDetail
>();
public
int
productid
{
get
;
set
;
}
public
string
materialid
{
get
;
set
;
}
public
int
sectionid
{
get
;
set
;
}
public
string
routeid
{
get
;
set
;
}
public
string
workorder
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
string
result
{
get
;
set
;
}
public
int
checktype
{
get
;
set
;
}
public
string
reason
{
get
;
set
;
}
public
string
number
{
get
;
set
;
}
public
string
quantity
{
get
;
set
;
}
}
public
class
DataCollectionDetail
{
public
int
index
{
get
;
set
;
}
public
int
id
{
get
;
set
;
}
public
int
itemid
{
get
;
set
;
}
public
int
checktype
{
get
;
set
;
}
public
string
result
{
get
;
set
;
}
public
double
?
value
{
get
;
set
;
}
public
double
?
lowerlimit
{
get
;
set
;
}
public
double
?
upperlimit
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/FixtureToolsCategory.cs
View file @
17f44366
...
...
@@ -148,5 +148,18 @@ namespace Siger.Middlelayer.AccRepository.Response
public
List
<
ResponseAumationFixtureToolsAssembly
>
childrens
{
get
;
set
;
}
public
string
remark
{
get
;
set
;
}
public
string
parentcategory
{
get
;
set
;
}
public
string
parentpartnumber
{
get
;
set
;
}
public
string
parentspecfication
{
get
;
set
;
}
public
string
parentcode
{
get
;
set
;
}
}
public
class
ResponseAumationFixtureToolsAssemblys
:
ResponseAumationFixtureToolsAssembly
{
public
string
son_code
{
get
;
set
;
}
public
string
son_name
{
get
;
set
;
}
public
int
son_categoryid
{
get
;
set
;
}
public
int
son_status
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationInfo.cs
View file @
17f44366
...
...
@@ -28,4 +28,19 @@ namespace Siger.Middlelayer.AccRepository.Response
/// </summary>
public
string
fixture
{
get
;
set
;
}
}
public
class
ResponseAutomationLocationRouteInfo
{
public
string
fixture
{
get
;
set
;
}
public
string
fixturename
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
int
location
{
get
;
set
;
}
public
int
productId
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
string
route
{
get
;
set
;
}
public
string
pn
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationLocation.cs
View file @
17f44366
...
...
@@ -8,9 +8,12 @@ namespace Siger.Middlelayer.AccRepository.Response
{
public
int
id
{
get
;
set
;
}
/// <summary>
/// 储位
位置
/// 储位
自增ID
/// </summary>
public
int
locationid
{
get
;
set
;
}
/// <summary>
/// 储位填写ID
/// </summary>
public
int
locaid
{
get
;
set
;
}
public
string
location
{
get
;
set
;
}
public
int
wavehouseid
{
get
;
set
;
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationMachineStatus.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
ResponseAutomationMachineStatus
{
public
int
sectionid
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
// public string machine { get; set; }
public
string
product
{
get
;
set
;
}
public
string
fixtureCode
{
get
;
set
;
}
public
string
fixtureName
{
get
;
set
;
}
public
int
location
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
int
enable
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
string
lastupdate
{
get
;
set
;
}
}
public
class
ResponseAutomationMachineStatusTotal
{
public
int
waittingTotal
{
get
;
set
;
}
public
int
produceTotal
{
get
;
set
;
}
public
int
complateTotal
{
get
;
set
;
}
public
int
disableTotal
{
get
;
set
;
}
}
public
class
ResponseMachineMonitor
{
public
ResponseAutomationMachineStatusTotal
sum
{
get
;
set
;
}
public
List
<
ResponseAutomationMachineStatus
>
dts
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationTasklist.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
ResponseAutomationTasklist
{
public
string
taskno
{
get
;
set
;
}
public
int
sectionid
{
get
;
set
;
}
public
string
section
{
get
;
set
;
}
/// <summary>
/// 触发方式
/// </summary>
public
string
trigger
{
get
;
set
;
}
public
int
tasktypeid
{
get
;
set
;
}
/// <summary>
/// 任务类型
/// </summary>
public
string
tasktype
{
get
;
set
;
}
public
string
sn
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
string
routeNo
{
get
;
set
;
}
public
string
route
{
get
;
set
;
}
public
string
program
{
get
;
set
;
}
/// <summary>
/// 储位ID
/// </summary>
public
string
location
{
get
;
set
;
}
public
string
fixtureCode
{
get
;
set
;
}
public
string
fixtureName
{
get
;
set
;
}
public
string
action
{
get
;
set
;
}
public
int
actionTypeid
{
get
;
set
;
}
/// <summary>
/// 执行类型
/// </summary>
public
string
actionType
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
DateTime
triggervalue
{
get
;
set
;
}
public
string
triggerTime
{
get
;
set
;
}
public
DateTime
?
complatevalue
{
get
;
set
;
}
public
string
complatetime
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseProductFixtureInfo.cs
View file @
17f44366
...
...
@@ -40,4 +40,15 @@ namespace Siger.Middlelayer.AccRepository.Response
public
int
Location
{
get
;
set
;
}
public
string
Sn
{
get
;
set
;
}
}
public
class
ResponseAutomationPlanOrder
{
public
string
ordernumber
{
get
;
set
;
}
public
int
productId
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
int
delvery
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseQmsCheck.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Response
{
public
class
SnTrace
{
public
string
ID
{
get
;
set
;
}
public
int
ProductID
{
get
;
set
;
}
public
int
MaterialID
{
get
;
set
;
}
public
int
SectionID
{
get
;
set
;
}
public
int
MachineID
{
get
;
set
;
}
public
string
WorkOrder
{
get
;
set
;
}
public
string
SN
{
get
;
set
;
}
public
string
Result
{
get
;
set
;
}
public
int
UserID
{
get
;
set
;
}
public
int
RouteID
{
get
;
set
;
}
public
DateTime
CreateTime
{
get
;
set
;
}
public
int
CheckType
{
get
;
set
;
}
public
string
ItemName
{
get
;
set
;
}
=
string
.
Empty
;
}
public
class
SnTraceDetail
{
public
long
ID
{
get
;
set
;
}
public
string
TraceID
{
get
;
set
;
}
public
int
ItemID
{
get
;
set
;
}
public
string
ItemName
{
get
;
set
;
}
=
string
.
Empty
;
public
string
Result
{
get
;
set
;
}
public
double
?
Value
{
get
;
set
;
}
public
string
SN
{
get
;
set
;
}
}
public
class
SnTraceDetailList
:
SnTraceDetail
{
public
int
NumberIndex
{
get
;
set
;
}
public
double
?
LowerLimit
{
get
;
set
;
}
public
double
?
UpperLimit
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.QmsRepository/ApiQmsDbContext.cs
View file @
17f44366
...
...
@@ -157,5 +157,7 @@ namespace Siger.Middlelayer.QmsRepository
public
DbSet
<
siger_tr_sn_trace_detail
>
siger_tr_sn_trace_detail
{
get
;
set
;
}
public
DbSet
<
siger_project_beat_set
>
siger_project_beat_set
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.QmsRepository/Entities/siger_project_beat_set.cs
0 → 100644
View file @
17f44366
using
System
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Siger.Middlelayer.QmsRepository.Entities
{
/// <summary>
/// siger_project_beat_set Entity Model
/// </summary>
public
class
siger_project_beat_set
:
QmsEntityBase
{
/// <summary>
/// 产线id
/// </summary>
public
int
section_id
{
get
;
set
;
}
/// <summary>
/// 设备id
/// </summary>
public
int
machineID
{
get
;
set
;
}
/// <summary>
/// 加工程序号
/// </summary>
public
string
process_number
{
get
;
set
;
}
/// <summary>
/// 产品名称 编号
/// </summary>
public
string
product_name
{
get
;
set
;
}
/// <summary>
/// 产品图纸号
/// </summary>
public
string
drawing_number
{
get
;
set
;
}
/// <summary>
/// 标准节拍(单位/ 秒 S )
/// </summary>
public
int
standard_besat
{
get
;
set
;
}
/// <summary>
/// 日标准产量(单位/pcs个)
/// </summary>
public
int
daily_standard_output
{
get
;
set
;
}
/// <summary>
/// 添加时间
/// </summary>
public
DateTime
add_time
{
get
;
set
;
}
/// <summary>
/// 修改时间
/// </summary>
public
DateTime
?
edit_time
{
get
;
set
;
}
/// <summary>
/// 产品名称
/// </summary>
public
string
product_name_text
{
get
;
set
;
}
/// <summary>
/// 换型时间
/// </summary>
public
int
changemodeltime
{
get
;
set
;
}
/// <summary>
/// 工序顺序
/// </summary>
public
string
route_number
{
get
;
set
;
}
=
""
;
/// <summary>
/// 工序名称
/// </summary>
public
string
route_name
{
get
;
set
;
}
/// <summary>
/// 上下料时间
/// </summary>
public
double
updown_besat
{
get
;
set
;
}
/// <summary>
/// 产量比率
/// </summary>
public
int
yieldrate
{
get
;
set
;
}
/// <summary>
/// 有效开始时间
/// </summary>
public
DateTime
start_time
{
get
;
set
;
}
/// <summary>
/// 有效结束时间
/// </summary>
public
DateTime
end_time
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.QmsRepository/Repositories/CheckSnTraceDetailRepository.cs
View file @
17f44366
...
...
@@ -38,7 +38,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
from
m
in
mm
.
DefaultIfEmpty
()
join
s
in
_context
.
siger_project_level_section
on
q
.
sectionid
equals
s
.
id
into
ss
from
s
in
ss
.
DefaultIfEmpty
()
join
r
in
_context
.
siger_project_
product_route
on
q
.
routeid
equals
r
.
id
into
rr
join
r
in
_context
.
siger_project_
beat_set
on
q
.
routeid
equals
r
.
id
into
rr
from
r
in
rr
.
DefaultIfEmpty
()
join
u1
in
_context
.
siger_project_user
on
q
.
send_mid
equals
u1
.
mid
into
uu1
from
u1
in
uu1
.
DefaultIfEmpty
()
...
...
@@ -60,7 +60,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
check_time
=
(
q
.
check_time
.
HasValue
&&
q
.
check_time
!=
DateTime
.
Now
)
?
q
.
check_time
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
,
routeid
=
q
.
routeid
,
routename
=
r
.
name
??
""
,
routename
=
r
.
route_
name
??
""
,
materialid
=
q
.
materialid
,
materialname
=
m
.
name
??
""
,
materialpn
=
m
.
pn
??
""
,
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.QmsRepository/Repositories/CheckSnTraceInspectionRepository.cs
View file @
17f44366
...
...
@@ -34,7 +34,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
join
s
in
_context
.
siger_project_level_section
on
q
.
sectionid
equals
s
.
id
join
m
in
_context
.
siger_tr_materials
on
q
.
materialid
equals
m
.
id
into
mm
from
m
in
mm
.
DefaultIfEmpty
()
join
r
in
_context
.
siger_project_
product_route
on
q
.
routeid
equals
r
.
id
into
rr
join
r
in
_context
.
siger_project_
beat_set
on
q
.
routeid
equals
r
.
id
into
rr
from
r
in
rr
.
DefaultIfEmpty
()
join
u1
in
_context
.
siger_user
on
q
.
send_mid
equals
u1
.
id
into
uu1
from
u1
in
uu1
.
DefaultIfEmpty
()
...
...
@@ -58,7 +58,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
sectionid
=
q
.
sectionid
,
sectionname
=
s
.
title
??
""
,
routeid
=
q
.
routeid
,
routename
=
r
.
name
??
""
,
routename
=
r
.
route_
name
??
""
,
testroom
=
q
.
testroom
,
sn
=
q
.
sn
,
checktype
=
q
.
check_type
,
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.Repository/Response/ResponseLoadStation.cs
View file @
17f44366
...
...
@@ -18,5 +18,10 @@ namespace Siger.Middlelayer.Repository.Response
/// 上料位状态
/// </summary>
public
int
status
{
get
;
set
;
}
/// <summary>
/// 1 :可以上料 2:可以下料
/// </summary>
public
int
upload
{
get
;
set
;
}
}
}
Server/Infrastructure/Script/DB.script
View file @
17f44366
...
...
@@ -267,8 +267,20 @@ CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_product` (
-- ----------------------------
CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`location_cid` int(11) NOT NULL DEFAULT 0 COMMENT '储位自增ID',
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`fixturename` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品name',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件对应工单号',
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件',
`routeid` int(11) NULL DEFAULT 0,
`route` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工序',
`routenum` int(11) NULL DEFAULT 0 COMMENT '工序顺序',
`attachment` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
`filename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
...
...
@@ -325,6 +337,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`no` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`fixturename` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装name',
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方',
`tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型',
...
...
@@ -332,6 +345,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`ordercode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工单号',
`productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '产品CODE',
`productname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '产品NAME',
`processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID',
`programnumber` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '程序号',
`locationid` int(11) NOT NULL COMMENT '储位位置',
...
...
@@ -395,7 +409,7 @@ CREATE TABLE `siger_automation_produce_history` (
`statusid` int(11) NOT NULL DEFAULT 0 COMMENT '设备状态ID',
`section` int(11) NOT NULL DEFAULT 0 COMMENT '产线ID',
`projectid` int(11) NOT NULL DEFAULT 0,
`productid` int(1
) NOT NULL DEFAULT 1
COMMENT '产品ID',
`productid` int(1
1) NULL DEFAULT 0
COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品编号',
`productname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位ID',
...
...
@@ -426,6 +440,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
`createtime` datetime(0) NULL DEFAULT NULL COMMENT '添加时间',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工令单',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productCode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationId` int(11) NOT NULL DEFAULT 0,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment