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
9f261137
Commit
9f261137
authored
Jan 23, 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
281394cc
64e411d3
Show whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
1362 additions
and
220 deletions
+1362
-220
en-US.js
Html/src/locale/lang/en-US.js
+11
-0
zh-CN.js
Html/src/locale/lang/zh-CN.js
+5
-0
feedingBlanking.vue
Html/src/view/fml/operation_manage/feedingBlanking.vue
+87
-41
assemblyInfo.vue
Html/src/view/fms/associate/assemblyInfo.vue
+390
-76
collection.vue
Html/src/view/qms/manual/collection.vue
+18
-3
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+31
-2
AutomationLocationController.cs
.../Siger.ApiACC/Controllers/AutomationLocationController.cs
+63
-4
AutomationOperateController.cs
...s/Siger.ApiACC/Controllers/AutomationOperateController.cs
+28
-8
FixtureToolsAssemblyController.cs
...iger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
+91
-7
FixtureToolsController.cs
...r/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
+113
-18
FixtureToolsProductController.cs
...Siger.ApiACC/Controllers/FixtureToolsProductController.cs
+21
-1
SectionPropertyController.cs
...pis/Siger.ApiACC/Controllers/SectionPropertyController.cs
+16
-4
AccRegistry.cs
Server/Apis/Siger.ApiACC/Tasks/AccRegistry.cs
+3
-1
AutoMES.cs
Server/Apis/Siger.ApiACC/Tasks/AutoMES.cs
+95
-5
DBhelper.cs
Server/Apis/Siger.ApiACC/Tasks/DBhelper.cs
+38
-12
CncRegistry.cs
Server/Apis/Siger.ApiCNC/Tasks/CncRegistry.cs
+1
-1
LocationController.cs
Server/Apis/Siger.ApiWMS/Controllers/LocationController.cs
+63
-0
CommonConst.cs
...er/Common/Siger.Middlelayer.Share/Constant/CommonConst.cs
+2
-0
AccEnum.cs
...Common/Siger.Middlelayer.Share/Enum/ModuleEnum/AccEnum.cs
+2
-0
RequestEnum.cs
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
+3
-0
FixtureTools.cs
.../Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
+67
-0
siger_automation_fixture_tools_assembly.cs
...itory/Entities/siger_automation_fixture_tools_assembly.cs
+0
-1
siger_automation_fixture_tools_monitor.cs
...sitory/Entities/siger_automation_fixture_tools_monitor.cs
+4
-0
siger_automation_machine_status.cs
...AccRepository/Entities/siger_automation_machine_status.cs
+4
-0
siger_automation_task_list.cs
...ayer.AccRepository/Entities/siger_automation_task_list.cs
+9
-4
AutomationFixtureToolsAssemblyRepository.cs
.../Repositories/AutomationFixtureToolsAssemblyRepository.cs
+5
-2
AutomationFixtureToolsCategoryRepository.cs
.../Repositories/AutomationFixtureToolsCategoryRepository.cs
+10
-1
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+7
-5
AutomationFixtureToolsRepository.cs
...pository/Repositories/AutomationFixtureToolsRepository.cs
+56
-1
AutomationLocationRepository.cs
...ccRepository/Repositories/AutomationLocationRepository.cs
+21
-4
IAutomationFixtureToolsCategoryRepository.cs
...es/Interface/IAutomationFixtureToolsCategoryRepository.cs
+1
-1
IAutomationFixtureToolsRepository.cs
...positories/Interface/IAutomationFixtureToolsRepository.cs
+6
-1
IAutomationLocationRepository.cs
...y/Repositories/Interface/IAutomationLocationRepository.cs
+2
-0
RequestAutomationMachine.cs
...lelayer.AccRepository/Request/RequestAutomationMachine.cs
+1
-0
RequestPLC.cs
...ies/Siger.Middlelayer.AccRepository/Request/RequestPLC.cs
+44
-0
requestAutoLoad.cs
...iger.Middlelayer.AccRepository/Request/requestAutoLoad.cs
+5
-0
FixtureToolsCategory.cs
...iddlelayer.AccRepository/Response/FixtureToolsCategory.cs
+9
-0
ResponseAutomationLocation.cs
...ayer.AccRepository/Response/ResponseAutomationLocation.cs
+6
-0
ResponseProductFixtureInfo.cs
...ayer.AccRepository/Response/ResponseProductFixtureInfo.cs
+5
-2
DB.script
Server/Infrastructure/Script/DB.script
+19
-15
No files found.
Html/src/locale/lang/en-US.js
View file @
9f261137
...
...
@@ -709,6 +709,17 @@ export default {
'9000484'
:
'数据库创建失败'
,
'9000485'
:
'数据表创建失败'
,
'9000486'
:
'标签来源未维护'
,
'9000487'
:
'只能读取txt文件'
,
'9000488'
:
'程序版本号不能为空'
,
'9000489'
:
'存在相同程序号的程序已审核,是否覆盖原来程序记录?'
,
'9000490'
:
'记录已存在,请删除后添加'
,
'9000491'
:
'人员未找到'
,
'9000492'
:
'默认展示已存在'
,
'9000493'
:
'未找到储位类别'
,
'9000494'
:
'未找到工装类别'
,
'9000495'
:
'未找到工装信息'
,
'9000496'
:
'ID重复'
,
'9000497'
:
'父级和子级不能相同'
,
'9100000'
:
'Departments cannot be empty'
,
'9100001'
:
'Position cannot be empty'
,
...
...
Html/src/locale/lang/zh-CN.js
View file @
9f261137
...
...
@@ -742,6 +742,11 @@ export default {
'9000490'
:
'记录已存在,请删除后添加'
,
'9000491'
:
'人员未找到'
,
'9000492'
:
'默认展示已存在'
,
'9000493'
:
'未找到储位类别'
,
'9000494'
:
'未找到工装类别'
,
'9000495'
:
'未找到工装信息'
,
'9000496'
:
'ID重复'
,
'9000497'
:
'父级和子级不能相同'
,
'9100000'
:
'部门不能为空'
,
...
...
Html/src/view/fml/operation_manage/feedingBlanking.vue
View file @
9f261137
...
...
@@ -45,46 +45,60 @@
type=
"text"
class=
"searchInput"
style=
"width: 300px"
@
keyup
.
enter=
"getWorkOrderInfo()"
v-model=
"code"
@
on-keyup
.
enter=
"getWorkOrderInfo()"
/>
</div>
<div
class=
"row"
>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工单信息:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
orderNumber
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
产品编号:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
productCode
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
产品名称:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
productName
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工件编号:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
sn
}}
</span>
</p>
</div>
<div
class=
"row"
>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
状态:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
status
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
储位编号:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
location
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工装编号:
</span>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
fixtureGuid
}}
</span>
</p>
<Button
type=
"primary"
@
click=
"modal = true"
>
储位选择
</Button
>
</div>
<div>
<Button
type=
"primary"
>
准备上料
</Button>
<Button
type=
"primary"
@
click=
"feedReady()"
>
准备上料
</Button
>
<Button
type=
"primary"
>
安装完成
</Button>
</div>
</TabPane>
...
...
@@ -105,25 +119,33 @@
<span
class=
"infoLabel"
>
工单信息:
</span
>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
orderNumber
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
产品编号:
</span
>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
productCode
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
产品名称:
</span
>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
productName
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工件编号:
</span
>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
sn
}}
</span>
</p>
</div>
<div
class=
"row"
>
...
...
@@ -131,19 +153,25 @@
<span
class=
"infoLabel"
>
状态:
</span
>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
code
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
储位编号:
</span
>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
location
}}
</span>
</p>
<p
class=
"flex"
>
<span
class=
"infoLabel"
>
工装编号:
</span
>
<span
class=
"info"
></span>
<span
class=
"info"
>
{{
orderDetail
.
fixtureGuid
}}
</span>
</p>
</div>
<div>
...
...
@@ -173,7 +201,8 @@
class=
"tableClass"
:data=
"data1"
:columns=
"columns1"
:max-height=
"200"
@
on-current-change=
"handleRowChange"
highlight-row
></Table>
</div>
<div
slot=
"footer"
>
...
...
@@ -209,15 +238,13 @@ export default {
attr1
:
false
,
//上料、下料、上下料
attr2
:
false
,
//上料、下料、上下料
modal
:
false
,
code
:
""
,
//工令单
columns1
:
[
{
title
:
this
.
$t
(
"1008"
),
key
:
"xuhao"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
params
.
index
+
1
);
return
h
(
"span"
,
params
.
index
+
1
);
},
width
:
70
,
},
...
...
@@ -244,10 +271,7 @@ export default {
title
:
this
.
$t
(
"1008"
),
key
:
"xuhao"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
params
.
index
+
1
);
return
h
(
"span"
,
params
.
index
+
1
);
},
width
:
70
,
},
...
...
@@ -265,6 +289,9 @@ export default {
},
],
data2
:
[],
orderDetail
:
{},
detailobj
:
{},
sectionid
:
0
,
};
},
created
()
{
...
...
@@ -314,6 +341,7 @@ export default {
change2
(
index
)
{
this
.
b
=
index
;
let
status
=
this
.
stationList
[
index
].
status
;
this
.
sectionid
=
this
.
stationList
[
index
].
section
;
if
(
status
==
1
)
{
this
.
attr2
=
true
;
}
...
...
@@ -326,7 +354,6 @@ export default {
if
(
res
.
data
.
ret
==
1
)
{
this
.
data1
=
res
.
data
.
data
;
this
.
data2
=
res
.
data
.
data
;
}
})
.
catch
((
err
)
=>
{
...
...
@@ -335,9 +362,21 @@ export default {
},
// 获取工单信息
getWorkOrderInfo
()
{
this
.
request
(
""
,
""
,
""
)
let
data
=
{
code
:
this
.
code
,
};
this
.
request
(
"/acc/AutomationOperate/ScanCode"
,
data
,
"get"
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
let
obj
=
res
.
data
.
data
;
this
.
orderDetail
=
Object
.
assign
(
{},
this
.
orderDetail
,
obj
);
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
,
msg
));
}
})
.
catch
((
err
)
=>
{
...
...
@@ -347,30 +386,37 @@ export default {
feedReady
()
{
// 准备上料
if
(
this
.
sectionid
==
0
)
{
this
.
$Message
.
error
(
"请选择工位"
);
}
let
data
=
{
section
:
13
,
code
:
"234324"
,
section
:
this
.
sectionid
,
code
:
this
.
orderDetail
.
fixtureGuid
,
};
this
.
request
(
"/acc/AutomationOperate/Loading"
,
data
,
"post"
).
thne
((
res
)
=>
{
this
.
request
(
"/acc/AutomationOperate/Loading"
,
data
,
"post"
).
thne
(
(
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
console
.
log
(
res
.
data
.
data
);
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
}
);
},
installOver
()
{
// 安装完成
let
data
=
{
section
:
13
section
:
13
,
};
this
.
request
(
""
,
data
,
"post"
).
thne
(
(
res
)
=>
{
this
.
request
(
""
,
data
,
"post"
).
thne
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
}
}
);
});
},
handleRowChange
(
currentRow
,
oldCurrentRow
)
{
this
.
detailobj
=
currentRow
;
},
request
(
url
,
data
,
type
)
{
if
(
type
==
"get"
)
{
return
this
.
axios
...
...
Html/src/view/fms/associate/assemblyInfo.vue
View file @
9f261137
<
template
>
<div
class=
"testdiv"
>
工装装配信息
<div
class=
"divborder"
>
<h2>
基本信息
</h2>
<div
class=
"newSearchDiv"
>
<div
class=
"filter"
>
<label>
工装类别:
</label>
<Select
label-in-value
clearable
filterable
<Cascader
class=
"searchSelect"
>
</Select>
:data=
"typeTree"
clearable
change-on-select
v-model=
"category"
@
on-change=
"getCategory"
></Cascader>
</div>
<div
class=
"filter"
>
<label>
工装编号:
</label>
<Select
label-in-value
clearable
filterable
class=
"searchSelect"
>
</Select>
<Input
type=
"text"
class=
"searchInput"
v-model=
"number"
/>
</div>
<div
class=
"filter"
>
<label>
工装名称:
</label>
<Input
type=
"text"
class=
"searchInput"
v-model=
"name"
/>
</div>
<div
class=
"filter"
>
<label>
状态:
</label>
...
...
@@ -30,8 +28,11 @@
label-in-value
clearable
filterable
v-model=
"state"
class=
"searchSelect"
>
<Option
:value=
"1"
>
可用
</Option>
<Option
:value=
"0"
>
停用
</Option>
</Select>
</div>
...
...
@@ -115,6 +116,122 @@
</div>
</div>
</div>
<Modal
class=
"newModalClass"
v-model=
"modal"
:styles=
"
{ width: '700px' }"
>
<p
slot=
"header"
>
<span
v-show=
"type == 1"
>
{{
$t
(
"1002"
)
}}
</span>
<span
v-show=
"type == 2"
>
{{
$t
(
"1003"
)
}}
</span>
</p>
<div
class=
"demo-spin-col"
>
<Spin
fix
v-if=
"spinShow"
>
<div>
正在上传...
</div>
</Spin>
<div
class=
"filter"
>
<label>
父工装类别:
</label>
<Cascader
class=
"searchSelect"
:data=
"typeTree"
v-model=
"parentType"
change-on-select
@
on-change=
"getCategory1"
></Cascader>
</div>
<div
class=
"filter"
>
<label><i>
*
</i>
父工装名称:
</label>
<Select
v-model=
"toolingId1"
label-in-value
clearable
filterable
filter-by-label
class=
"searchSelect"
>
<Option
v-for=
"(item, index) in toolingList1"
:value=
"item.id"
:key=
"index"
:label=
"item.name + '#' + item.code"
>
{{
item
.
name
+
"#"
+
item
.
code
}}
</Option
>
</Select>
</div>
<div
style=
"padding-left: 50px"
>
<div
class=
"filter"
>
<label>
子工装类别:
</label>
<Cascader
class=
"searchSelect"
:data=
"typeTree"
v-model=
"sonType"
change-on-select
@
on-change=
"getCategory2"
></Cascader>
</div>
<div
class=
"filter"
>
<label><i>
*
</i>
子工装名称:
</label>
<Select
v-model=
"toolingId2"
label-in-value
clearable
filterable
filter-by-label
class=
"searchSelect"
>
<Option
v-for=
"(item, index) in toolingList2"
:value=
"item.id"
:key=
"index"
:label=
"item.name + '#' + item.code"
>
{{
item
.
name
+
"#"
+
item
.
code
}}
</Option
>
</Select>
</div>
</div>
<div
class=
"filter"
>
<label>
备注:
</label>
<Input
type=
"text"
class=
"searchInput"
v-model=
"remark"
/>
</div>
<div>
<label>
上传文件:
</label>
<div
class=
"accountInfoUploadFile"
>
<Upload
ref=
"upload"
:show-upload-list=
"false"
:on-success=
"handleSuccess1"
:before-upload=
"handleBeforeUpload"
:on-error=
"handleError1"
type=
"drag"
:headers=
"headers"
:action=
"UploadAction"
>
<div
class=
"descicon"
style=
""
>
<Icon
type=
"md-cloud-upload"
size=
"15"
></Icon>
<span>
上传文件
</span>
</div>
</Upload>
<div
v-show=
"filename"
class=
"hasfile"
>
{{
filename
}}
<Icon
@
click
.
native=
"delfile"
type=
"ios-close-circle"
size=
"15"
/>
</div>
</div>
</div>
</div>
<div
slot=
"footer"
>
<Button
type=
"text"
size=
"large"
@
click=
"modal = false"
>
{{
$t
(
"1033"
)
}}
</Button>
<Button
type=
"primary"
size=
"large"
@
click=
"addPost()"
>
{{
$t
(
"1011"
)
}}
</Button>
</div>
</Modal>
</div>
</
template
>
...
...
@@ -122,7 +239,17 @@
export
default
{
data
()
{
return
{
columns1
:[
//导入方法
action
:
this
.
axios
.
publicPath
+
"wms/Upload/Submit?templateName=StorageLocation"
,
headers
:
{
token
:
localStorage
.
getItem
(
"token"
),
timestamp
:
localStorage
.
getItem
(
"timestamp"
),
nonce
:
localStorage
.
getItem
(
"nonce"
),
sign
:
localStorage
.
getItem
(
"sign"
),
},
columns1
:
[
{
type
:
"index2"
,
title
:
this
.
$t
(
"1008"
),
...
...
@@ -135,106 +262,293 @@ export default {
},
},
{
title
:
'工装类型'
,
key
:
'category'
title
:
"工装类型"
,
key
:
"category"
,
},
{
title
:
'管理类型'
,
key
:
'managetype'
,
render
:(
h
,
params
)
=>
{
let
str
=
''
;
if
(
params
.
row
.
managetype
===
1
){
str
=
'单件'
;
}
else
if
(
params
.
row
.
managetype
===
2
){
str
=
'批次'
;
}
return
h
(
'span'
,
str
);
title
:
"管理类型"
,
key
:
"managetype"
,
render
:
(
h
,
params
)
=>
{
let
str
=
""
;
if
(
params
.
row
.
managetype
===
1
)
{
str
=
"单件"
;
}
else
if
(
params
.
row
.
managetype
===
2
)
{
str
=
"批次"
;
}
return
h
(
"span"
,
str
);
},
},
{
title
:
'工装料号'
,
key
:
'partnumber'
title
:
"工装料号"
,
key
:
"partnumber"
,
},
{
title
:
'工装名称'
,
key
:
'name'
title
:
"工装名称"
,
key
:
"name"
,
},
{
title
:
'工装编号'
,
key
:
'code'
title
:
"工装编号"
,
key
:
"code"
,
},
{
title
:
'规格型号'
,
key
:
'specification'
title
:
"规格型号"
,
key
:
"specification"
,
},
{
title
:
'数量'
,
key
:
'number'
title
:
"数量"
,
key
:
"number"
,
},
{
title
:
'状态'
,
key
:
'status'
,
render
:(
h
,
params
)
=>
{
let
str
=
''
;
if
(
params
.
row
.
status
===
1
){
str
=
'可用'
;
}
else
{
str
=
'停用'
;
}
return
h
(
'span'
,
str
);
title
:
"状态"
,
key
:
"status"
,
render
:
(
h
,
params
)
=>
{
let
str
=
""
;
if
(
params
.
row
.
status
===
1
)
{
str
=
"可用"
;
}
else
{
str
=
"停用"
;
}
return
h
(
"span"
,
str
);
},
},
{
title
:
'备注'
,
key
:
'remark'
title
:
"备注"
,
key
:
"remark"
,
},
{
title
:
'附件'
,
key
:
'filename'
,
render
:(
h
,
params
)
=>
{
return
h
(
'span'
,{
style
:{
color
:
'#2b85e4'
,
cursor
:
'pointer'
},
on
:{
click
:()
=>
{
title
:
"附件"
,
key
:
"filename"
,
render
:
(
h
,
params
)
=>
{
return
h
(
"span"
,
{
style
:
{
color
:
"#2b85e4"
,
cursor
:
"pointer"
,
},
on
:
{
click
:
()
=>
{
let
name
=
params
.
row
.
filename
;
let
url
=
params
.
row
.
fileurl
;
if
(
url
){
this
.
downFile
(
url
,
name
);
}
}
}
},
params
.
row
.
filename
);
if
(
url
)
{
this
.
downFile
(
url
,
name
);
}
},
},
},
params
.
row
.
filename
);
},
},
{
title
:
'维护人'
,
key
:
'updator'
title
:
"维护人"
,
key
:
"updator"
,
},
{
title
:
'维护时间'
,
key
:
'updatetime'
}
title
:
"维护时间"
,
key
:
"updatetime"
,
}
,
],
data1
:
[],
total
:
0
,
page
:
1
,
pagesize
:
10
,
modal
:
false
,
type
:
0
,
typeTree
:
[],
category
:
[],
categoryId
:
0
,
number
:
""
,
name
:
""
,
state
:
""
,
parentType
:
[],
sonType
:
[],
parentId
:
0
,
sonId
:
0
,
remark
:
""
,
toolingList1
:
[],
toolingList2
:
[],
toolingId1
:
0
,
toolingId2
:
0
,
spinShow
:
false
,
fileurl
:
""
,
filename
:
""
,
UploadAction
:
this
.
axios
.
publicPath
+
"config/upload/UploadImage"
,
};
},
created
()
{
this
.
columns1
=
this
.
$time
.
initTableTitle
(
this
.
columns1
);
this
.
initFrockType
();
},
methods
:
{
search
(
page
,
pagesize
){},
add
(){},
edit
(){},
dele
(){},
loadExcel
(){},
exportEecel
(){},
search
(
page
,
pagesize
)
{
let
data
=
{
category
:
this
.
categoryId
,
//工装类型id
code
:
this
.
number
,
name
:
this
.
name
,
// state: this.state, //0停用 1可用
page
:
this
.
page
,
pagesize
:
this
.
pagesize
,
// toexcel: 0, //0查询 1导出
};
this
.
request
(
"/acc/FixtureToolsAssembly/GetPageList"
,
data
,
"get"
).
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
this
.
data1
=
res
.
data
.
data
;
}
});
},
add
()
{
this
.
modal
=
true
;
this
.
type
=
1
;
},
addPost
()
{
let
data
=
{
parentid
:
this
.
toolingId1
,
//父级工装ID
fixturetoolid
:
this
.
toolingId2
,
//工装ID
fileurl
:
this
.
fileurl
,
//url
filename
:
this
.
filename
,
//附件名称
status
:
1
,
};
this
.
request
(
"/acc/AutomationLocation/Add"
,
data
,
"post"
).
then
(
(
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
}
);
},
edit
()
{},
dele
()
{},
loadExcel
()
{},
exportEecel
()
{},
//工装类型
initFrockType
()
{
this
.
axios
.
request
({
url
:
"/acc/FixtureTools/GetCategoryList"
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
let
arr
=
res
.
data
.
data
;
this
.
contentTree
(
arr
);
this
.
typeTree
=
arr
;
}
});
},
getCategory
(
val
)
{
this
.
category
=
val
;
this
.
categoryId
=
this
.
category
.
length
>
0
?
this
.
category
[
this
.
category
.
length
-
1
]
:
0
;
},
getCategory1
(
val
)
{
this
.
parentType
=
val
;
this
.
parentId
=
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
);
}
},
getCategory2
(
val
)
{
this
.
sonType
=
val
;
this
.
sonId
=
this
.
sonType
.
length
>
0
?
this
.
sonType
[
this
.
sonType
.
length
-
1
]
:
0
;
if
(
this
.
sonId
!=
0
)
{
this
.
getToolingList
(
2
);
}
},
getToolingList
(
index
)
{
let
id
=
0
;
id
=
index
==
1
?
this
.
parentId
:
this
.
sonId
;
console
.
log
(
index
);
this
.
request
(
"/acc/FixtureTools/GetFixtureToolList?categoryid="
+
id
,
""
,
"get"
).
then
((
res
)
=>
{
if
(
res
.
data
.
ret
==
1
)
{
if
(
index
==
1
)
{
this
.
toolingList1
=
res
.
data
.
data
;
}
if
(
index
==
2
)
{
this
.
toolingList2
=
res
.
data
.
data
;
}
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
data
.
msg
));
}
});
},
contentTree
(
arr
)
{
arr
.
forEach
((
ele
)
=>
{
ele
.
disabled
=
false
;
if
(
ele
.
children
!=
undefined
&&
ele
.
children
!=
null
&&
ele
.
children
.
length
!=
0
)
{
this
.
contentTree
(
ele
.
children
);
}
else
{
ele
.
children
=
[];
}
});
},
/*********文件上传 start******** */
handleBeforeUpload
(
file
)
{
this
.
spinShow
=
true
;
if
(
!
file
)
{
this
.
spinShow
=
false
;
return
false
;
}
},
handleSuccess1
(
res
,
file
)
{
this
.
spinShow
=
false
;
if
(
res
.
ret
==
1
)
{
this
.
$Message
.
success
(
this
.
$t
(
"100378"
));
this
.
filename
=
file
.
name
;
this
.
fileurl
=
res
.
data
;
}
else
{
this
.
$Message
.
error
(
this
.
$t
(
res
.
msg
+
""
));
}
},
handleError1
()
{
this
.
spinShow
=
false
;
this
.
$Message
.
error
(
this
.
$t
(
"600512"
)
+
"!"
);
},
delfile
()
{
this
.
filename
=
""
;
this
.
fileurl
=
""
;
},
/*********文件上传 end******** */
request
(
url
,
data
,
type
)
{
if
(
type
==
"get"
)
{
return
this
.
axios
.
request
({
url
:
url
,
params
:
data
,
method
:
type
,
});
}
else
{
return
this
.
axios
.
request
({
url
:
url
,
data
,
method
:
type
,
});
}
},
},
};
</
script
>
...
...
Html/src/view/qms/manual/collection.vue
View file @
9f261137
...
...
@@ -654,7 +654,6 @@ export default {
});
},
linechange
(
i
)
{
console
.
log
(
1111111111
);
this
.
a
=
i
;
this
.
line
=
this
.
lineList
[
i
];
this
.
initstations
(
this
.
line
.
id
);
...
...
@@ -672,7 +671,7 @@ export default {
axios
.
request
({
url
:
"
http://localhost:8105
/acc/SectionProperty/GetSections"
"/acc/SectionProperty/GetSections"
,
params
,
method
:
"get"
,
...
...
@@ -715,6 +714,22 @@ export default {
this
.
b
=
i
;
this
.
station
=
this
.
stationList
[
i
];
this
.
initproduct
(
this
.
station
.
id
);
this
.
initSn
(
this
.
station
.
id
)
},
initSn
(
sectionid
){
if
(
sectionid
>
0
)
{
axios
.
request
({
url
:
"/acc/SectionProperty/GetSn?productId="
+
productid
+
"§ionId="
+
sectionid
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
ret
===
1
)
{
this
.
qrcode
=
res
.
data
.
data
;
}
});
}
},
productchange
(
i
)
{
this
.
c
=
i
;
...
...
@@ -730,7 +745,7 @@ export default {
axios
.
request
({
url
:
"/acc/SectionProperty/GetRouteByProduct?productId="
+
productid
,
"/acc/SectionProperty/GetRouteByProduct?productId="
+
productid
+
"§ionId="
+
sectionid
,
method
:
"get"
,
})
.
then
((
res
)
=>
{
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
9f261137
...
...
@@ -28,9 +28,10 @@ namespace Siger.ApiACC.Controllers
private
readonly
ISigerDict
_sigerDict
;
private
readonly
IAutomationTaskListRepository
_automationTaskList
;
private
readonly
ISigerProjectMachineAttributionRepository
_sigerProjectMachineAttribution
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
public
AutomationController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
IAutomationLineMode
automationLineMode
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerDict
sigerDict
,
IAutomationTaskListRepository
automationTaskList
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
)
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationFixtureMonitor
automationFixtureMonitor
)
{
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
...
...
@@ -39,6 +40,7 @@ namespace Siger.ApiACC.Controllers
_sigerDict
=
sigerDict
;
_automationTaskList
=
automationTaskList
;
_sigerProjectMachineAttribution
=
sigerProjectMachineAttribution
;
_automationFixtureMonitor
=
automationFixtureMonitor
;
}
/// <summary>
...
...
@@ -181,7 +183,7 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
TaskResult
([
FromBody
]
RequestAutomationTaskResult
request
)
{
//1.检查Tasklist
var
taskObj
=
_automationTaskList
.
Get
(
f
=>
f
.
guid
==
request
.
guid
);
var
taskObj
=
_automationTaskList
.
Get
(
f
=>
f
.
no
==
request
.
guid
);
if
(
taskObj
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
...
...
@@ -311,8 +313,28 @@ namespace Siger.ApiACC.Controllers
}
}
/// <summary>
/// 创建自动任务
/// </summary>
/// <param name="machineStatus"></param>
/// <param name="actionType"></param>
/// <param name="taskAction"></param>
void
CreateTask
(
siger_automation_machine_status
machineStatus
,
TaskActionType
actionType
,
TaskAction
taskAction
)
{
//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
;
}
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
...
...
@@ -328,9 +350,16 @@ 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
=
"自动任务"
});
if
(
_unitOfWork
.
Commit
()
>
0
)
Logger
.
WriteLineInfo
(
$"CreateTask 工站 完成"
);
else
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationLocationController.cs
View file @
9f261137
...
...
@@ -23,20 +23,79 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationFixtureToolsCategoryRepository
_toolsCategoryRepository
;
private
readonly
IAutomationFixtureToolsRepository
_toolsRepository
;
private
readonly
IAutomationLocationRepository
_autoLocationRepository
;
private
readonly
IAutomationFixtureMonitor
_fixtureMonitor
;
private
readonly
IProductRouteRepository
_routeRepository
;
public
AutomationLocationController
(
IUnitOfWork
unitOfWork
,
IAutomationFixtureToolsCategoryRepository
toolsCategoryRepository
,
IAutomationFixtureToolsRepository
toolsRepository
,
IAutomationLocationRepository
autoLocationRepository
)
IAutomationFixtureToolsRepository
toolsRepository
,
IAutomationLocationRepository
autoLocationRepository
,
IAutomationFixtureMonitor
fixtureMonitor
,
IProductRouteRepository
routeRepository
)
{
_unitOfWork
=
unitOfWork
;
_toolsCategoryRepository
=
toolsCategoryRepository
;
_toolsRepository
=
toolsRepository
;
_autoLocationRepository
=
autoLocationRepository
;
_fixtureMonitor
=
fixtureMonitor
;
_routeRepository
=
routeRepository
;
}
[
HttpGet
]
public
IActionResult
GetPageList
(
string
wavehouseid
,
string
locationid
,
int
page
,
int
pagesize
)
{
var
data
=
_autoLocationRepository
.
GetPagedList
(
wavehouseid
.
ToInt
(),
locationid
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
var
list
=
new
List
<
ResponseAutomationLocation
>();
var
locations
=
_autoLocationRepository
.
GetLocationList
(
ProjectId
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
foreach
(
var
item
in
data
.
Data
)
{
if
(
item
.
fixturetoolid
>
0
&&
string
.
IsNullOrEmpty
(
item
.
sn
))
{
item
.
materialstate
=
1
;
//有工装无工件
}
else
if
(
item
.
fixturetoolid
>
0
&&
!
string
.
IsNullOrEmpty
(
item
.
sn
))
{
item
.
materialstate
=
2
;
//有工装有工件
}
else
if
(
item
.
fixturetoolid
<=
0
&&
string
.
IsNullOrEmpty
(
item
.
sn
))
{
item
.
materialstate
=
3
;
//无工装无工件
}
else
if
(
item
.
fixturetoolid
<=
0
&&
string
.
IsNullOrEmpty
(
item
.
sn
))
{
item
.
materialstate
=
4
;
//无工装有工件
}
var
loca
=
locations
.
FirstOrDefault
(
q
=>
q
.
locationid
==
item
.
locaid
);
if
(
loca
!=
null
)
{
var
locas
=
GetParentLocations
(
loca
.
id
,
locations
);
var
locationIds
=
locas
.
Select
(
q
=>
q
.
id
).
ToList
();
locationIds
=
locationIds
.
Distinct
().
ToList
();
locationIds
.
Reverse
();
item
.
locationIds
=
locationIds
;
}
var
cates
=
GetParentCategoryList
(
item
.
cate_guid
,
categorys
);
var
cateIds
=
cates
.
Select
(
q
=>
q
.
id
).
ToList
();
cateIds
.
Reverse
();
item
.
categoryIds
=
cateIds
;
list
.
Add
(
item
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
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
;
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetParentCategoryList
(
t
.
parent
,
sections
)));
}
private
IEnumerable
<
siger_wms_storage_location
>
GetParentLocations
(
int
pid
,
IEnumerable
<
siger_wms_storage_location
>
types
)
{
var
query
=
from
c
in
types
where
c
.
id
==
pid
select
c
;
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetParentLocations
(
t
.
parentid
,
types
)));
}
[
HttpPost
]
...
...
@@ -66,7 +125,7 @@ namespace Siger.ApiACC.Controllers
var
entity
=
new
siger_automation_location
{
guid
=
Guid
.
NewGuid
().
ToString
(),
locationid
=
req
.
locationid
.
ToInt
()
,
locationid
=
location
.
locationid
,
fixturetools
=
fixturetool
.
guid
,
attachment
=
req
.
fileurl
,
filename
=
req
.
filename
,
...
...
@@ -115,7 +174,7 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
entity
.
locationid
=
req
.
locationid
.
ToInt
()
;
entity
.
locationid
=
location
.
locationid
;
entity
.
fixturetools
=
fixturetool
.
guid
;
entity
.
attachment
=
req
.
fileurl
;
entity
.
filename
=
req
.
filename
;
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationOperateController.cs
View file @
9f261137
...
...
@@ -33,9 +33,10 @@ namespace Siger.ApiACC.Controllers
private
readonly
IProductPlanRepository
_productPlan
;
private
readonly
IAutomationFixtureMonitor
_automationFixtureMonitor
;
private
readonly
IAutomationFixtureToolsProductRepository
_automationFixtureToolsProduct
;
private
readonly
IAutomationFixtureToolsRepository
_automationFixtureTools
;
public
AutomationOperateController
(
IUnitOfWork
unitOfWork
,
ISigerProjectLevelSectionRepository
sigerProjectLevelSection
,
ISigerDict
sigerDict
,
IAutomationMachineStatus
automationMachineStatus
,
ISigerProjectMachineAttributionRepository
sigerProjectMachineAttribution
,
IAutomationTaskListRepository
automationTaskList
,
IProductPlanDetails
planDetails
,
IProductPlanRepository
productPlan
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
)
IProductPlanDetails
planDetails
,
IProductPlanRepository
productPlan
,
IAutomationFixtureMonitor
automationFixtureMonitor
,
IAutomationFixtureToolsProductRepository
automationFixtureToolsProduct
,
IAutomationFixtureToolsRepository
automationFixtureTools
)
{
_unitOfWork
=
unitOfWork
;
_sigerProjectLevelSection
=
sigerProjectLevelSection
;
...
...
@@ -47,6 +48,7 @@ namespace Siger.ApiACC.Controllers
_productPlan
=
productPlan
;
_automationFixtureMonitor
=
automationFixtureMonitor
;
_automationFixtureToolsProduct
=
automationFixtureToolsProduct
;
_automationFixtureTools
=
automationFixtureTools
;
}
/// <summary>
...
...
@@ -139,6 +141,8 @@ namespace Siger.ApiACC.Controllers
var
result
=
new
ResponsePlanlFixtureInfo
{
OrderNumber
=
monitor
.
ordernumber
,
FixtureGuid
=
monitor
.
fixtureguid
,
FixtureName
=
monitor
.
fixturename
,
ProductCode
=
monitor
.
productCode
,
ProductName
=
monitor
.
productName
,
Sn
=
monitor
.
sn
,
...
...
@@ -159,7 +163,7 @@ namespace Siger.ApiACC.Controllers
var
result
=
_automationFixtureToolsProduct
.
GetPlanFixtureInfo
(
ProjectId
,
code
);
if
(
result
==
null
)
{
throw
new
BadRequestException
(
CncEnum
.
PlanHasExist
);
throw
new
BadRequestException
(
AccEnum
.
FixtureOrderNulll
);
}
var
sn
=
_automationTaskList
.
CreateRandonSn
(
result
.
ProductCode
);
result
.
Sn
=
sn
;
...
...
@@ -179,19 +183,33 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
machineid
==
machineAttr
.
machine
);
if
(
machineStatus
==
null
)
var
machineStatus
=
_automationMachineStatus
.
Get
(
f
=>
f
.
machineid
==
machineAttr
.
machine
);
if
(
machineStatus
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
// throw new BadRequestException(CommonEnum.RecordNotFound);
//上料设备状态与PLC 无关,
//需要手动插入
_automationMachineStatus
.
Insert
(
new
siger_automation_machine_status
{
enable
=
1
,
section
=
loading
.
section
,
machineid
=
machineAttr
.
machine
,
projectId
=
ProjectId
,
status
=
(
int
)
Automation
.
MachineStatus
.
Produce
,
updatetime
=
DateTime
.
Now
});
}
if
(
machineStatus
.
enable
==
0
)
else
{
if
(
machineStatus
.
enable
==
0
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineDisable
);
}
if
(
machineStatus
.
status
!=
(
int
)
Automation
.
MachineStatus
.
Waiting
)
if
(
machineStatus
.
status
!=
(
int
)
Automation
.
MachineStatus
.
Waiting
)
{
throw
new
BadRequestException
(
AccEnum
.
MachineBusy
);
}
}
if
(!
_automationTaskList
.
CanTask
(
ProjectId
,
loading
.
section
))
{
throw
new
BadRequestException
(
AccEnum
.
TaskProcessing
);
...
...
@@ -208,7 +226,8 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
CncEnum
.
PlanHasExist
);
}
//检查工装
var
fixtureToolsObj
=
_automationFixtureToolsProduct
.
GetFixtureInfoByProductCode
(
ProjectId
,
plan
.
product_code
);
var
fixtureToolsObj
=
_automationFixtureTools
.
GetProductFixtureLocation
(
ProjectId
,
loading
.
guid
);
//var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code);
if
(
fixtureToolsObj
==
null
)
{
throw
new
BadRequestException
(
AccEnum
.
FixtureToolsIsNone
);
...
...
@@ -248,6 +267,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
{
fixtureguid
=
fixtureToolsObj
.
FixtureGuid
,
fixturename
=
fixtureToolsObj
.
FixtureName
,
projectId
=
ProjectId
,
section
=
loading
.
section
,
sn
=
sn
,
...
...
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsAssemblyController.cs
View file @
9f261137
...
...
@@ -37,7 +37,30 @@ namespace Siger.ApiACC.Controllers
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
int
page
,
int
pagesize
)
{
var
data
=
_toolsAssemblyRepository
.
GetPagedList
(
category
.
ToInt
(),
code
,
name
,
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
var
categorys
=
_toolsCategoryRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
list
=
new
List
<
ResponseAumationFixtureToolsAssembly
>();
foreach
(
var
item
in
data
.
Data
)
{
var
cates
=
GetParentCategoryList
(
item
.
cate_guid
,
categorys
);
var
cateIds
=
cates
.
Select
(
q
=>
q
.
id
).
ToList
();
cateIds
.
Reverse
();
item
.
categoryids
=
cateIds
;
var
parentcates
=
GetParentCategoryList
(
item
.
parentcate_guid
,
categorys
);
var
parentcateIds
=
parentcates
.
Select
(
q
=>
q
.
id
).
ToList
();
parentcateIds
.
Reverse
();
item
.
parentcategoryids
=
parentcateIds
;
list
.
Add
(
item
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
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
;
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetParentCategoryList
(
t
.
parent
,
sections
)));
}
[
HttpGet
]
...
...
@@ -55,22 +78,50 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
if
(
req
.
parentid
==
req
.
fixturetoolid
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParentSonSame
);
}
var
parent
=
_toolsRepository
.
Get
(
q
=>
q
.
id
==
req
.
parentid
.
ToInt
()
&&
q
.
projectId
==
ProjectId
);
var
son
=
_toolsRepository
.
Get
(
q
=>
q
.
id
==
req
.
fixturetoolid
.
ToInt
()
&&
q
.
projectId
==
ProjectId
);
if
(
son
==
null
)
if
(
parent
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
if
(
parent
==
null
)
var
son
=
_toolsRepository
.
Get
(
q
=>
q
.
id
==
req
.
fixturetoolid
.
ToInt
()
&&
q
.
projectId
==
ProjectId
);
if
(
son
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
parentGuid
=
parent
?.
guid
??
""
;
var
parentGuid
=
parent
.
guid
;
var
exsit
=
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
son
.
guid
&&
q
.
parent
==
parentGuid
);
if
(
exsit
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
parentExsit
=
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
parentGuid
);
if
(
parentExsit
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
LevelCountError
);
}
if
(
_toolsAssemblyRepository
.
Get
(
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
=
req
.
fileurl
,
filename
=
req
.
filename
,
projectId
=
ProjectId
,
updatetime
=
DateTime
.
Now
,
updator
=
UserId
,
status
=
req
.
status
.
ToInt
()
==
(
int
)
RowState
.
Valid
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
};
_toolsAssemblyRepository
.
Insert
(
parentEntity
);
}
var
entity
=
new
siger_automation_fixture_tools_assembly
{
...
...
@@ -104,24 +155,57 @@ namespace Siger.ApiACC.Controllers
{
throw
new
BadRequestException
(
RequestEnum
.
ParameterMiss
);
}
if
(!
string
.
IsNullOrEmpty
(
req
.
parentid
)
&&
!
string
.
IsNullOrEmpty
(
req
.
fixturetoolid
)
&&
req
.
parentid
==
req
.
fixturetoolid
)
{
throw
new
BadRequestException
(
RequestEnum
.
ParentSonSame
);
}
var
entity
=
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
id
==
req
.
id
);
if
(
entity
==
null
)
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
parent
=
_toolsRepository
.
Get
(
q
=>
q
.
id
==
req
.
parentid
.
ToInt
()
&&
q
.
projectId
==
ProjectId
);
if
(
parent
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
son
=
_toolsRepository
.
Get
(
q
=>
q
.
id
==
req
.
fixturetoolid
.
ToInt
()
&&
q
.
projectId
==
ProjectId
);
if
(
son
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
FixtureToolNotFound
);
}
var
parentGuid
=
parent
?.
guid
??
""
;
var
parentGuid
=
parent
.
guid
;
var
exsit
=
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
son
.
guid
&&
q
.
parent
==
parentGuid
&&
q
.
id
!=
req
.
id
);
if
(
exsit
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
DataExist
);
}
var
parentExsit
=
_toolsAssemblyRepository
.
Get
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
son
==
parentGuid
);
if
(
parentExsit
!=
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
LevelCountError
);
}
if
(
_toolsAssemblyRepository
.
Get
(
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
=
req
.
fileurl
,
filename
=
req
.
filename
,
projectId
=
ProjectId
,
updatetime
=
DateTime
.
Now
,
updator
=
UserId
,
status
=
req
.
status
.
ToInt
()
==
(
int
)
RowState
.
Valid
?
(
int
)
RowState
.
Valid
:
(
int
)
RowState
.
Invalid
,
};
_toolsAssemblyRepository
.
Insert
(
parentEntity
);
}
entity
.
parent
=
parent
?.
guid
??
""
;
entity
.
son
=
son
.
guid
;
...
...
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsController.cs
View file @
9f261137
...
...
@@ -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
Siger.Middlelayer.Utility.ImportEntities
;
using
System.IO
;
using
Siger.Middlelayer.Log
;
namespace
Siger.ApiACC.Controllers
{
...
...
@@ -31,9 +36,9 @@ namespace Siger.ApiACC.Controllers
_toolsRepository
=
toolsRepository
;
}
public
IActionResult
GetPageList
(
string
category
,
string
code
,
string
name
,
string
state
,
int
page
,
int
pagesize
)
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
);
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
();
foreach
(
var
item
in
data
.
Data
)
...
...
@@ -44,9 +49,62 @@ namespace Siger.ApiACC.Controllers
item
.
categoryids
=
cateIds
;
list
.
Add
(
item
);
}
if
(
toexcel
.
ToInt
()
==
1
)
{
return
ExportExcel
(
data
.
Data
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
private
IActionResult
ExportExcel
(
IEnumerable
<
ResponseFixtureTools
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureToolsTemplate
>();
foreach
(
var
item
in
data
)
{
dataList
.
Add
(
new
FixtureToolsTemplate
{
Catgeory
=
item
.
category
,
Name
=
item
.
name
,
Manage
=
item
.
managetype
==
1
?
"单件"
:
"批次"
,
PartNumber
=
item
.
partnumber
,
Code
=
item
.
code
,
Specfication
=
item
.
specification
,
Number
=
item
.
number
.
ToString
(),
Status
=
item
.
status
==
1
?
"可用"
:
"停用"
,
Remark
=
item
.
remark
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureToolsTemplate
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureToolsTemplate
>();
var
temporaryFileName
=
$"工装台账_FixtureToolsData_
{
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 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
;
...
...
@@ -191,30 +249,59 @@ namespace Siger.ApiACC.Controllers
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
[
HttpGet
]
public
IActionResult
Get
FxitureTooolList
(
)
public
IActionResult
Get
CategoryPageList
(
string
id
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
var
list
=
_toolsRepository
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
Select
(
q
=>
new
var
data
=
_toolsCategoryRepository
.
GetPagedList
(
id
.
ToInt
(),
ProjectId
,
page
,
pagesize
,
toexcel
);
if
(
toexcel
.
ToInt
()
==
1
)
{
q
.
id
,
q
.
code
,
q
.
partnumber
,
q
.
name
,
q
.
specification
,
q
.
number
}).
ToList
();
return
new
ObjectResult
(
list
);
return
ExportCategoryExcel
(
data
.
Data
);
}
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
}
private
IActionResult
ExportCategoryExcel
(
IEnumerable
<
ResponseFixtureToolsCategory
>
data
)
{
var
rootDir
=
FileSystemHelper
.
GetPhysicalFolders
(
FileSystemHelper
.
CommonFileSetting
.
PhysicalFolder
,
FileSystemHelper
.
ExportFileName
);
if
(!
data
.
Any
())
{
throw
new
BadRequestException
(
CommonEnum
.
RecordNotFound
);
}
var
dataList
=
new
List
<
FixtureToolsCategoryTemplate
>();
[
HttpGet
]
public
IActionResult
GetCategoryPageList
(
string
id
,
int
page
,
int
pagesize
)
foreach
(
var
item
in
data
)
{
var
data
=
_toolsCategoryRepository
.
GetPagedList
(
id
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
dataList
.
Add
(
new
FixtureToolsCategoryTemplate
{
Fixture
=
item
.
name
,
Parent
=
item
.
parentname
});
}
if
(
dataList
.
Any
())
{
EpPlusExcelHelper
<
FixtureToolsCategoryTemplate
>
helper
=
null
;
try
{
helper
=
new
EpPlusExcelHelper
<
FixtureToolsCategoryTemplate
>();
var
temporaryFileName
=
$"工装类型_FixtureToolsCategoryData_
{
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 Category Data failed, error:"
+
e
);
throw
new
BadRequestException
(
RequestEnum
.
ExportFailed
);
}
finally
{
helper
?.
Dispose
();
}
}
throw
new
BadRequestException
(
CommonEnum
.
Fail
);
}
[
HttpPost
]
...
...
@@ -370,5 +457,13 @@ namespace Siger.ApiACC.Controllers
}
return
resp
;
}
[
HttpGet
]
public
IActionResult
GetFixtureToolList
(
string
categoryid
)
{
var
list
=
_toolsRepository
.
GetDataList
(
categoryid
.
ToInt
(),
ProjectId
);
return
new
ObjectResult
(
list
);
}
}
}
Server/Apis/Siger.ApiACC/Controllers/FixtureToolsProductController.cs
View file @
9f261137
...
...
@@ -36,10 +36,28 @@ namespace Siger.ApiACC.Controllers
_productRepository
=
productRepository
;
}
[
HttpGet
]
public
IActionResult
GetPageList
(
string
category
,
string
tool
,
string
product
,
int
page
,
int
pagesize
)
{
var
data
=
_toolsProductRepository
.
GetPagedList
(
category
.
ToInt
(),
tool
.
ToInt
(),
product
.
ToInt
(),
ProjectId
,
page
,
pagesize
);
return
new
PagedObjectResult
(
data
.
Data
,
data
.
Total
,
page
,
pagesize
);
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
)
{
var
cates
=
GetParentCategoryList
(
item
.
cate_guid
,
categorys
);
var
cateIds
=
cates
.
Select
(
q
=>
q
.
id
).
ToList
();
cateIds
.
Reverse
();
item
.
categoryids
=
cateIds
;
list
.
Add
(
item
);
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
}
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
;
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetParentCategoryList
(
t
.
parent
,
sections
)));
}
[
HttpPost
]
...
...
@@ -72,6 +90,7 @@ namespace Siger.ApiACC.Controllers
fixturetools
=
fixtureTool
.
guid
,
remark
=
req
.
remark
,
productid
=
req
.
productid
.
ToInt
(),
productcode
=
product
.
code
,
projectId
=
ProjectId
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
,
...
...
@@ -123,6 +142,7 @@ namespace Siger.ApiACC.Controllers
entity
.
fixturetools
=
fixtureTool
.
guid
;
entity
.
remark
=
req
.
remark
;
entity
.
productid
=
req
.
productid
.
ToInt
();
entity
.
productcode
=
product
.
code
;
entity
.
updatetime
=
DateTime
.
Now
;
entity
.
updator
=
UserId
;
entity
.
filename
=
req
.
filename
;
...
...
Server/Apis/Siger.ApiACC/Controllers/SectionPropertyController.cs
View file @
9f261137
...
...
@@ -23,14 +23,17 @@ namespace Siger.ApiACC.Controllers
private
readonly
IAutomationSectionPropertyRepository
_sectionPropertyRepository
;
private
readonly
ISigerProjectLevelSectionRepository
_levelSectionRepository
;
private
readonly
IProductionBeatSetRepository
_beatSetRepository
;
private
readonly
IAutomationFixtureMonitor
_fixtureMonitor
;
public
SectionPropertyController
(
IUnitOfWork
unitOfWork
,
IAutomationSectionPropertyRepository
sectionPropertyRepository
,
ISigerProjectLevelSectionRepository
levelSectionRepository
,
IProductionBeatSetRepository
beatSetRepository
)
ISigerProjectLevelSectionRepository
levelSectionRepository
,
IProductionBeatSetRepository
beatSetRepository
,
IAutomationFixtureMonitor
fixtureMonitor
)
{
_unitOfWork
=
unitOfWork
;
_sectionPropertyRepository
=
sectionPropertyRepository
;
_levelSectionRepository
=
levelSectionRepository
;
_beatSetRepository
=
beatSetRepository
;
_fixtureMonitor
=
fixtureMonitor
;
}
[
HttpGet
]
...
...
@@ -44,10 +47,11 @@ namespace Siger.ApiACC.Controllers
return
new
ObjectResult
(
sections
);
}
public
IActionResult
GetRouteByProduct
(
string
productId
)
[
HttpGet
]
public
IActionResult
GetRouteByProduct
(
string
productId
,
int
sectionId
)
{
var
list
=
_beatSetRepository
.
GetList
(
q
=>
q
.
projectID
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
product_name
.
ToInt
()
==
productId
.
ToInt
()
).
Select
(
q
=>
new
var
list
=
_beatSetRepository
.
GetList
(
q
=>
q
.
projectID
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
product_name
.
ToInt
()
==
productId
.
ToInt
()
&&
q
.
section_id
==
sectionId
).
Select
(
q
=>
new
{
q
.
id
,
name
=
q
.
route_name
,
...
...
@@ -56,5 +60,13 @@ namespace Siger.ApiACC.Controllers
return
new
ObjectResult
(
list
);
}
[
HttpGet
]
public
IActionResult
GetSn
(
int
sectionid
)
{
var
monitor
=
_fixtureMonitor
.
GetList
(
q
=>
q
.
projectId
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
q
.
section
==
sectionid
).
OrderByDescending
(
q
=>
q
.
updatetime
).
FirstOrDefault
();
return
new
ObjectResult
(
monitor
?.
sn
??
""
);
}
}
}
Server/Apis/Siger.ApiACC/Tasks/AccRegistry.cs
View file @
9f261137
using
FluentScheduler
;
using
NPOI.SS.Formula.Functions
;
using
Siger.Middlelayer.Log
;
using
Module
=
Siger
.
Middlelayer
.
Common
.
Module
;
...
...
@@ -11,7 +12,8 @@ namespace Siger.ApiACC.Tasks
//Logger.RegisterLogEngine(Module.Acc);
//Schedule<AccCalculateTraceJob>().ToRunNow().AndEvery(30).Minutes();
Logger
.
RegisterTxtLogEngine
(
Module
.
Acc
);
Schedule
<
AutoMES
>().
ToRunNow
().
AndEvery
(
10
).
Seconds
();
}
}
}
Server/Apis/Siger.ApiACC/Tasks/AutoMES.cs
View file @
9f261137
using
FluentScheduler
;
using
Newtonsoft.Json
;
using
Siger.Middlelayer.AccRepository.Request
;
using
Siger.Middlelayer.Common
;
using
Siger.Middlelayer.Common.Configuration
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Common.Log
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -12,19 +18,103 @@ namespace Siger.ApiACC.Tasks
public
void
Execute
()
{
throw
new
NotImplementedException
();
Logger
.
WriteLineInfo
(
$"execute mes job"
);
var
projectId
=
GetProjectId
();
var
hostDic
=
GetHost
();
if
(
projectId
==
0
||
!
hostDic
.
Any
())
{
Logger
.
WriteLineInfo
(
$"配置未完整"
);
return
;
}
using
(
DBhelper
dbhelper
=
new
DBhelper
())
{
var
tasklist
=
dbhelper
.
GetTaskList
(
projectId
);
if
(!
tasklist
.
Any
())
{
Logger
.
WriteLineInfo
(
$"无任务下发"
);
return
;
}
var
tasks
=
tasklist
.
OrderBy
(
s
=>
s
.
actiontype
);
var
task
=
tasks
.
FirstOrDefault
();
var
sendToPLC
=
new
RequestPLC
{
RStation
=
task
.
sectionid
,
Fixture
=
task
.
fixtureguid
,
RequestForm
=
task
.
no
,
RobotStep
=
(
int
)
task
.
action
,
StorageNo
=
task
.
locationid
,
SN
=
task
.
sn
,
Program
=
task
.
programnumber
};
var
result
=
PushTask
(
hostDic
,
sendToPLC
,
out
string
message
);
if
(!
result
)
{
Logger
.
WriteLineError
(
$"TASK 下发失败 :
{
message
}
"
);
return
;
}
task
.
send
=
1
;
if
(!
dbhelper
.
UpdateTask
(
task
))
{
Logger
.
WriteLineError
(
$"更新TASK 下发状态失败"
);
}
}
}
public
void
Dispose
()
{
throw
new
NotImplementedException
();
}
/// <summary>
/// 下发任务
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
/// <param name="request"></param>
/// <param name="msg"></param>
private
bool
PushTask
(
string
ip
,
RequestPLC
request
,
out
string
msg
)
{
msg
=
string
.
Empty
;
try
{
var
param
=
JsonHelper
.
SerializerToJsonString
(
request
);
var
retstring
=
HttpHelper
.
HttpPost
(
$"
{
ip
}{
CommonConst
.
SenTaskToMES
}
"
,
"application/json"
,
param
);
var
result
=
JsonConvert
.
DeserializeObject
<
ResponsePlC
>(
retstring
);
if
(
result
.
return_code
!=
0
)
{
msg
=
$"PushTask failed,URL
{
ip
}
input:
{
param
}
result :
{
result
.
return_desc
}
"
;
return
false
;
}
return
true
;
}
catch
(
Exception
ex
)
{
msg
=
ex
.
ToString
();
}
return
false
;
}
private
int
GetProjectId
()
{
var
_pid
=
ConfigManager
.
GetValue
(
"ProjectSetting"
,
"ProjectId"
,
string
.
Empty
);
if
(
string
.
IsNullOrEmpty
(
_pid
))
Logger
.
WriteLineError
(
"DbSetting about [ProjectSetting] ProjectId not found."
);
return
int
.
Parse
(
_pid
);
}
private
string
GetHost
()
{
//获取TaskList
private
List
<
int
>
GetTaskList
(
)
var
host
=
ConfigManager
.
GetValue
(
"ProjectSetting"
,
"Host"
,
string
.
Empty
);
if
(
string
.
IsNullOrEmpty
(
host
)
)
{
Logger
.
WriteLineError
(
"DbSetting about [ProjectSetting] Host not found."
);
return
null
;
}
return
host
;
return
new
List
<
int
>();
}
}
}
Server/Apis/Siger.ApiACC/Tasks/DBhelper.cs
View file @
9f261137
using
Siger.Middlelayer.AccRepository
;
using
Siger.Middlelayer.AccRepository.Entities
;
using
Siger.Middlelayer.CncRepository
;
using
Siger.Middlelayer.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
static
Siger
.
Middlelayer
.
Share
.
Enum
.
ModuleEnum
.
Automation
;
namespace
Siger.ApiACC.Tasks
{
public
class
DBhelper
public
class
DBhelper
:
IDisposable
{
private
static
DBhelper
_helper
;
public
static
DBhelper
Instance
=
_helper
??
(
_helper
=
new
DBhelper
());
public
ApiCncDbContext
CncDbContext
;
public
ApiAccDbContext
AccDbContext
;
public
ApiConfigDbContext
ConfigDbContext
;
static
DBhelper
()
{
}
public
void
LoadDbContext
()
private
readonly
ApiCncDbContext
CncDbContext
;
private
readonly
ApiAccDbContext
AccDbContext
;
private
readonly
ApiConfigDbContext
ConfigDbContext
;
public
DBhelper
()
{
CncDbContext
=
new
ApiCncDbContext
();
AccDbContext
=
new
ApiAccDbContext
();
ConfigDbContext
=
new
ApiConfigDbContext
();
}
public
List
<
int
>
GetTaskList
()
internal
bool
CanTask
(
int
projectId
,
int
section
)
{
var
taskObj
=
AccDbContext
.
siger_automation_task_list
.
FirstOrDefault
(
f
=>
f
.
projectId
==
projectId
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
if
(
taskObj
==
null
)
return
true
;
else
return
false
;
}
/// <summary>
/// 获取未推送tasklist
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public
IEnumerable
<
siger_automation_task_list
>
GetTaskList
(
int
projectId
)
{
var
taskObjs
=
AccDbContext
.
siger_automation_task_list
.
Where
(
f
=>
f
.
projectId
==
projectId
&&
f
.
send
==
0
&&
f
.
status
>=
(
int
)
TaskResultStatus
.
Cancel
&&
f
.
status
<
(
int
)
TaskResultStatus
.
Complated
);
return
taskObjs
;
}
public
siger_automation_fixture_tools_monitor
GetMonitor
(
int
section
)
{
return
new
List
<
int
>();
return
AccDbContext
.
siger_automation_fixture_tools_moniter
.
FirstOrDefault
(
f
=>
f
.
section
==
section
);
}
public
bool
UpdateTask
(
siger_automation_task_list
taskNo
)
{
AccDbContext
.
siger_automation_task_list
.
Update
(
taskNo
);
return
AccDbContext
.
SaveChanges
()
>
0
;
}
public
void
Dispose
()
{
...
...
@@ -37,5 +62,6 @@ namespace Siger.ApiACC.Tasks
AccDbContext
?.
Dispose
();
ConfigDbContext
?.
Dispose
();
}
}
}
Server/Apis/Siger.ApiCNC/Tasks/CncRegistry.cs
View file @
9f261137
...
...
@@ -9,7 +9,7 @@ namespace Siger.ApiCNC.Tasks
{
public
CncRegistry
()
{
Schedule
<
ProduceEfficiencyJob
>().
ToRunNow
().
AndEvery
(
1
).
Days
().
At
(
3
,
0
);
//
Schedule<ProduceEfficiencyJob>().ToRunNow().AndEvery(1).Days().At(3,0);
}
}
}
Server/Apis/Siger.ApiWMS/Controllers/LocationController.cs
View file @
9f261137
...
...
@@ -1127,5 +1127,67 @@ namespace Siger.ApiWMS.Controllers
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetSonTypes
(
t
.
id
,
types
)));
}
[
HttpGet
]
public
IActionResult
GetLocationTree
(
int
warehouseid
)
{
var
locationTypes
=
locationtype
.
GetList
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
sonLocationTypes
=
GetSonTypes
(
0
,
locationTypes
).
ToList
();
var
lastLocationId
=
sonLocationTypes
.
LastOrDefault
()?.
id
??
0
;
var
allLocas
=
location
.
GetList
(
q
=>
q
.
projectid
==
ProjectId
&&
q
.
status
==
(
int
)
RowState
.
Valid
).
ToList
();
var
locations
=
allLocas
.
Where
(
q
=>
q
.
typeid
==
lastLocationId
);
if
(
warehouseid
>
0
)
{
locations
=
locations
.
Where
(
q
=>
q
.
storageid
==
warehouseid
);
}
var
locationTreeList
=
new
List
<
LevelSectionTree
>();
foreach
(
var
loca
in
locations
)
{
var
locas
=
GetParentLocations
(
loca
.
id
,
allLocas
.
Select
(
q
=>
new
LevelSectionTree
{
id
=
q
.
id
,
pid
=
q
.
parentid
,
title
=
q
.
realname
,
name
=
q
.
realname
}));
locationTreeList
.
AddRange
(
locas
);
}
var
locationTree
=
locationTreeList
.
GroupBy
(
q
=>
q
.
id
).
Select
(
q
=>
q
.
FirstOrDefault
()).
ToList
();
return
new
ObjectResult
(
ConvertToTree
(
locationTree
));
}
private
IEnumerable
<
LevelSectionTree
>
GetParentLocations
(
int
pid
,
IEnumerable
<
LevelSectionTree
>
types
)
{
var
query
=
from
c
in
types
where
c
.
id
==
pid
select
c
;
return
query
.
ToList
().
Concat
(
query
.
ToList
().
SelectMany
(
t
=>
GetParentLocations
(
t
.
pid
,
types
)));
}
private
IList
<
LevelSectionTree
>
ConvertToTree
(
IEnumerable
<
LevelSectionTree
>
models
)
{
var
section
=
new
Dictionary
<
int
,
LevelSectionTree
>();
foreach
(
var
item
in
models
)
{
section
.
Add
(
item
.
id
,
item
);
}
var
result
=
new
List
<
LevelSectionTree
>();
foreach
(
var
item
in
section
.
Values
)
{
if
(
item
.
pid
==
0
)
{
result
.
Add
(
item
);
}
else
{
if
(
section
.
ContainsKey
(
item
.
pid
))
{
section
[
item
.
pid
].
AddChilrden
(
item
);
}
}
}
return
result
;
}
}
}
\ No newline at end of file
Server/Common/Siger.Middlelayer.Share/Constant/CommonConst.cs
View file @
9f261137
...
...
@@ -105,5 +105,7 @@
/// 罗美特追溯附件 存放路径
/// </summary>
public
const
string
MetekAttachmentFilePath
=
"attachment"
;
public
const
string
SenTaskToMES
=
"/distributiontask"
;
}
}
Server/Common/Siger.Middlelayer.Share/Enum/ModuleEnum/AccEnum.cs
View file @
9f261137
...
...
@@ -327,6 +327,8 @@ namespace Siger.Middlelayer.Common.ModuleEnum
TaskProcessing
,
[
Description
(
"产品工装未找到"
)]
FixtureToolsIsNone
,
[
Description
(
"未找到工装信息"
)]
FixtureOrderNulll
}
public
enum
SeriNumCfg
...
...
Server/Common/Siger.Middlelayer.Share/Enum/RequestEnum.cs
View file @
9f261137
...
...
@@ -1473,5 +1473,8 @@ namespace Siger.Middlelayer.Common
[
Description
(
"ID重复"
)]
IDExist
,
[
Description
(
"父级和子级不能相同"
)]
ParentSonSame
,
}
}
Server/Common/Siger.Middlelayer.Utility/ImportEntities/FixtureTools.cs
0 → 100644
View file @
9f261137
using
Siger.Middlelayer.Utility.ExcelImport
;
namespace
Siger.Middlelayer.Utility.ImportEntities
{
public
class
FixtureToolsCategoryTemplate
:
ImportBase
{
[
ExcelColumn
(
"工装类型*"
)]
public
string
Fixture
{
get
;
set
;
}
[
ExcelColumn
(
"上级类型"
)]
public
string
Parent
{
get
;
set
;
}
}
public
class
FixtureToolsTemplate
:
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
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
FixtureToolsProductTemplate
:
ImportBase
{
[
ExcelColumn
(
"工装编号*"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"产品名称*"
)]
public
string
Product
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
public
class
FixtureToolsAssmeblyTemplate
:
ImportBase
{
[
ExcelColumn
(
"父工装编号*"
)]
public
string
ParentFixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"子工装编号*"
)]
public
string
FixtureTool
{
get
;
set
;
}
[
ExcelColumn
(
"备注"
)]
public
string
Remark
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_fixture_tools_assembly.cs
View file @
9f261137
...
...
@@ -22,7 +22,6 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 附件
/// </summary>
public
string
attachment
{
get
;
set
;
}
public
string
fileurl
{
get
;
set
;
}
/// <summary>
/// 附件名称
/// </summary>
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_fixture_tools_monitor.cs
View file @
9f261137
...
...
@@ -11,6 +11,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
public
string
fixtureguid
{
get
;
set
;
}
/// <summary>
/// 工装名称
/// </summary>
public
string
fixturename
{
get
;
set
;
}
/// <summary>
/// 当前工站ID
/// </summary>
public
int
section
{
get
;
set
;
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_machine_status.cs
View file @
9f261137
...
...
@@ -25,6 +25,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 更新时间
/// </summary>
public
DateTime
updatetime
{
get
;
set
;
}
/// <summary>
/// 程序号
/// </summary>
public
string
program
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Entities/siger_automation_task_list.cs
View file @
9f261137
...
...
@@ -16,6 +16,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
public
string
no
{
get
;
set
;
}
/// <summary>
/// 工装GUID
/// </summary>
public
string
fixtureguid
{
get
;
set
;
}
/// <summary>
/// 工位ID
/// </summary>
public
int
sectionid
{
get
;
set
;
}
...
...
@@ -40,6 +44,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
public
int
productid
{
get
;
set
;
}
/// <summary>
/// 产品code
/// </summary>
public
string
productcode
{
get
;
set
;
}
/// <summary>
/// 工序ID
/// </summary>
public
int
processid
{
get
;
set
;
}
...
...
@@ -51,10 +59,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 储位位置
/// </summary>
public
int
locationid
{
get
;
set
;
}
/// <summary>
/// 工装GUID
/// </summary>
public
string
fixtureguid
{
get
;
set
;
}
/// <summary>
/// Task 执行动作类型 1 手动 2 自动
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsAssemblyRepository.cs
View file @
9f261137
...
...
@@ -26,7 +26,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
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
from
t1
in
tt1
.
DefaultIfEmpty
()
join
c1
in
_context
.
siger_automation_fixture_tools_category
on
t1
.
category
equals
c1
.
guid
join
c1
in
_context
.
siger_automation_fixture_tools_category
on
t1
.
category
equals
c1
.
guid
into
cc1
from
c1
in
cc1
.
DefaultIfEmpty
()
join
t2
in
_context
.
siger_automation_fixture_tools
on
q
.
son
equals
t2
.
guid
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
...
...
@@ -48,7 +49,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename
=
q
.
filename
,
categoryid
=
c2
.
id
,
category
=
c2
.
name
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
,
cate_guid
=
t2
.
guid
,
parentcate_guid
=
t1
.
guid
};
Expression
<
Func
<
ResponseAumationFixtureToolsAssembly
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsCategoryRepository.cs
View file @
9f261137
...
...
@@ -7,6 +7,7 @@ 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.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
...
...
@@ -20,7 +21,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context
=
context
;
}
public
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
int
id
,
int
projectid
,
int
page
,
int
pagesize
)
public
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
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
...
...
@@ -42,9 +43,17 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
FunNum
=
q
=>
q
.
id
==
id
;
}
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
FunNum
).
OrderBy
(
q
=>
q
.
parentid
).
OrderBy
(
q
=>
q
.
createtime
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseFixtureToolsCategory
>(
entities
,
entities
.
Count
);
}
else
{
var
entities
=
query
.
Where
(
FunNum
).
OrderBy
(
q
=>
q
.
parentid
).
OrderBy
(
q
=>
q
.
createtime
).
Skip
((
page
-
1
)
*
pagesize
).
Take
(
pagesize
).
AsNoTracking
().
ToList
();
var
totalCount
=
query
.
Where
(
FunNum
).
Count
();
return
new
PagedCollectionResult
<
ResponseFixtureToolsCategory
>(
entities
,
totalCount
);
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
9f261137
...
...
@@ -28,7 +28,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
where
q
.
projectId
==
projectId
&&
q
.
productcode
==
productCode
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseProductFixtureInfo
{
Fixture
Id
=
t
.
id
,
Fixture
Name
=
t
.
name
,
FixtureGuid
=
t
.
guid
,
ProductCode
=
q
.
productcode
,
Location
=
l
.
locationid
,
...
...
@@ -61,7 +61,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename
=
q
.
filename
,
partnumber
=
t
.
partnumber
,
specfication
=
t
.
specification
,
productcode
=
p
.
code
productcode
=
p
.
code
,
cate_guid
=
c
.
guid
??
""
};
Expression
<
Func
<
ResponseAumationFixtureToolsProduct
,
bool
>>
categoryExpression
=
f
=>
true
;
if
(
category
>
0
)
...
...
@@ -97,9 +98,10 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
OrderNumber
=
ordernumber
,
ProductName
=
p
.
product_name
,
ProductCode
=
q
.
productcode
,
Location
=
l
.
locationid
,
FixtureName
=
t
.
name
,
FixtureGuid
=
t
.
guid
,
ProductCode
=
q
!=
null
?
q
.
productcode
:
""
,
Location
=
l
!=
null
?
l
.
locationid
:
0
,
};
return
query
.
FirstOrDefault
();
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsRepository.cs
View file @
9f261137
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
Microsoft.EntityFrameworkCore
;
...
...
@@ -6,6 +7,7 @@ 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.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Extensions
;
using
Siger.Middlelayer.Repository.Paged
;
...
...
@@ -21,7 +23,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
public
IPagedCollectionResult
<
ResponseFixtureTools
>
GetPagedList
(
int
category
,
string
code
,
string
name
,
int
state
,
int
projectid
,
int
page
,
int
pagesize
)
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
)
{
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
...
...
@@ -69,9 +71,62 @@ namespace Siger.Middlelayer.AccRepository.Repositories
stateExpression
=
q
=>
q
.
status
==
state
;
}
var
expression
=
categoryExpression
.
And
(
codeExpression
).
And
(
nameExpression
).
And
(
stateExpression
);
if
(
toexcel
.
ToInt
()
==
1
)
{
var
entities
=
query
.
Where
(
expression
).
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
new
PagedCollectionResult
<
ResponseFixtureTools
>(
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
<
ResponseFixtureTools
>(
entities
,
totalCount
);
}
}
public
IEnumerable
<
ResponseFixtureTools
>
GetDataList
(
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
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseFixtureTools
{
id
=
q
.
id
,
name
=
q
.
name
,
guid
=
q
.
guid
,
cate_guid
=
p
.
guid
,
categoryid
=
p
.
id
,
category
=
p
.
name
,
managetype
=
q
.
managetype
,
partnumber
=
q
.
partnumber
,
specification
=
q
.
specification
,
number
=
q
.
number
,
remark
=
q
.
remark
,
code
=
q
.
code
,
status
=
q
.
status
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
};
if
(
categoryid
>
0
)
{
query
=
query
.
Where
(
q
=>
q
.
categoryid
==
categoryid
);
}
var
entities
=
query
.
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
return
entities
;
}
public
ResponseProductFixtureInfo
GetProductFixtureLocation
(
int
projectId
,
string
guid
)
{
var
query
=
from
q
in
_context
.
siger_automation_fixture_tools
join
l
in
_context
.
siger_automation_location
on
q
.
guid
equals
l
.
guid
select
new
ResponseProductFixtureInfo
{
FixtureGuid
=
q
.
guid
,
FixtureName
=
q
.
name
,
Location
=
l
.
locationid
};
return
query
.
FirstOrDefault
();
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationLocationRepository.cs
View file @
9f261137
...
...
@@ -30,11 +30,16 @@ namespace Siger.Middlelayer.AccRepository.Repositories
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
from
r
in
rr
.
DefaultIfEmpty
()
where
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseAutomationLocation
{
id
=
q
.
id
,
locationid
=
l
.
id
,
locaid
=
q
.
locationid
,
location
=
l
.
name
,
wavehouseid
=
w
.
id
,
wavehouse
=
w
.
name
,
...
...
@@ -48,7 +53,11 @@ namespace Siger.Middlelayer.AccRepository.Repositories
remark
=
q
.
remark
,
updator
=
u
.
name
??
""
,
status
=
q
.
status
,
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
updatetime
=
q
.
updatetime
.
HasValue
&&
q
.
updatetime
>
DateTime
.
MinValue
?
q
.
updatetime
.
Value
.
ToString
(
ParameterConstant
.
DateTimeFormat
)
:
""
,
sn
=
m
.
sn
??
""
,
route
=
r
.
name
??
""
,
routenumber
=
r
==
null
?
""
:
r
.
serialNumber
.
ToString
(),
cate_guid
=
c
.
guid
??
""
};
Expression
<
Func
<
ResponseAutomationLocation
,
bool
>>
wavehouseidExpression
=
f
=>
true
;
if
(
wavehouseid
>
0
)
...
...
@@ -68,7 +77,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public
siger_wms_storage_location
GetLocation
(
int
id
,
int
projectid
)
{
return
_context
.
siger_wms_storage_location
.
FirstOrDefault
(
q
=>
q
.
locationid
==
id
&&
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
return
_context
.
siger_wms_storage_location
.
FirstOrDefault
(
q
=>
q
.
id
==
id
&&
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
}
public
IEnumerable
<
siger_wms_storage_location
>
GetLocationList
(
int
projectid
)
{
return
_context
.
siger_wms_storage_location
.
Where
(
q
=>
q
.
projectId
==
projectid
&&
q
.
status
==
(
int
)
RowState
.
Valid
);
}
public
IEnumerable
<
ResponseAutomationLocationList
>
GetDataList
(
int
projectid
)
...
...
@@ -78,10 +92,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories
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
.
locationid
equals
l
.
locationid
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
{
id
=
q
.
id
,
fixtureguid
=
t
.
guid
,
locationid
=
l
.
locationid
,
location
=
l
.
realname
,
locationcode
=
l
.
serial_number
,
...
...
@@ -91,9 +108,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid
=
t
.
id
,
code
=
t
.
code
,
name
=
t
.
name
,
materialsn
=
"TestData
"
materialsn
=
m
.
sn
??
"
"
};
var
entities
=
query
.
OrderByDescending
(
q
=>
q
.
id
).
AsNoTracking
().
ToList
();
var
entities
=
query
.
AsNoTracking
().
ToList
();
return
entities
;
}
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsCategoryRepository.cs
View file @
9f261137
...
...
@@ -7,6 +7,6 @@ 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
);
IPagedCollectionResult
<
ResponseFixtureToolsCategory
>
GetPagedList
(
int
id
,
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsRepository.cs
View file @
9f261137
...
...
@@ -2,12 +2,17 @@
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Repository.Data.Acc
;
using
Siger.Middlelayer.Repository.Paged
;
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
,
int
projectid
,
int
page
,
int
pagesize
);
int
projectid
,
int
page
,
int
pagesize
,
string
toexcel
=
""
);
IEnumerable
<
ResponseFixtureTools
>
GetDataList
(
int
categoryid
,
int
projectid
);
ResponseProductFixtureInfo
GetProductFixtureLocation
(
int
projectId
,
string
guid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationLocationRepository.cs
View file @
9f261137
...
...
@@ -14,5 +14,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
siger_wms_storage_location
GetLocation
(
int
id
,
int
projectid
);
IEnumerable
<
ResponseAutomationLocationList
>
GetDataList
(
int
projectid
);
IEnumerable
<
siger_wms_storage_location
>
GetLocationList
(
int
projectid
);
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/RequestAutomationMachine.cs
View file @
9f261137
...
...
@@ -19,5 +19,6 @@ namespace Siger.Middlelayer.AccRepository.Request
/// 完成状态
/// </summary>
public
int
status
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/RequestPLC.cs
0 → 100644
View file @
9f261137
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Siger.Middlelayer.AccRepository.Request
{
public
class
RequestPLC
{
/// <summary>
/// 工件唯一识别SN
/// </summary>
public
String
SN
{
get
;
set
;
}
/// <summary>
/// 工装唯一编号GUID
/// </summary>
public
string
Fixture
{
get
;
set
;
}
/// <summary>
/// 任务唯一编号
/// </summary>
public
string
RequestForm
{
get
;
set
;
}
/// <summary>
/// 机器人动作指令
/// </summary>
public
int
RobotStep
{
get
;
set
;
}
/// <summary>
/// 发起地
/// </summary>
public
int
RStation
{
get
;
set
;
}
/// <summary>
/// 储位位置编号
/// </summary>
public
int
StorageNo
{
get
;
set
;
}
/// <summary>
/// 加工程序号 ,上料完成后自动加工需要
/// </summary>
public
string
Program
{
get
;
set
;
}
}
public
class
ResponsePlC
{
public
int
return_code
{
get
;
set
;
}
public
string
return_desc
{
get
;
set
;
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Request/requestAutoLoad.cs
View file @
9f261137
...
...
@@ -11,6 +11,11 @@ namespace Siger.Middlelayer.AccRepository.Request
{
public
int
section
{
get
;
set
;
}
public
string
code
{
get
;
set
;
}
/// <summary>
/// 工装GUID
/// </summary>
public
string
guid
{
get
;
set
;
}
}
/// <summary>
/// 安装完成
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/FixtureToolsCategory.cs
View file @
9f261137
...
...
@@ -111,6 +111,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public
string
updatetime
{
get
;
set
;
}
public
string
fileurl
{
get
;
set
;
}
public
string
filename
{
get
;
set
;
}
public
string
cate_guid
{
get
;
set
;
}
public
List
<
int
>
categoryids
{
get
;
set
;
}
=
new
List
<
int
>();
}
public
class
ResponseAumationFixtureToolsAssembly
...
...
@@ -130,5 +134,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public
int
status
{
get
;
set
;
}
public
string
fileurl
{
get
;
set
;
}
public
string
filename
{
get
;
set
;
}
public
string
parentcate_guid
{
get
;
set
;
}
public
List
<
int
>
parentcategoryids
{
get
;
set
;
}
=
new
List
<
int
>();
public
string
cate_guid
{
get
;
set
;
}
public
List
<
int
>
categoryids
{
get
;
set
;
}
=
new
List
<
int
>();
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationLocation.cs
View file @
9f261137
...
...
@@ -11,6 +11,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// 储位位置
/// </summary>
public
int
locationid
{
get
;
set
;
}
public
int
locaid
{
get
;
set
;
}
public
string
location
{
get
;
set
;
}
public
int
wavehouseid
{
get
;
set
;
}
public
string
wavehouse
{
get
;
set
;
}
...
...
@@ -47,6 +48,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public
string
updatetime
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
List
<
int
>
locationIds
{
get
;
set
;
}
=
new
List
<
int
>();
public
List
<
int
>
categoryIds
{
get
;
set
;
}
=
new
List
<
int
>();
public
string
cate_guid
{
get
;
set
;
}
}
public
class
ResponseAutomationLocationList
...
...
@@ -71,6 +76,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// 工装ID
/// </summary>
public
int
fixturetoolid
{
get
;
set
;
}
public
string
fixtureguid
{
get
;
set
;
}
public
string
code
{
get
;
set
;
}
public
string
name
{
get
;
set
;
}
public
string
materialsn
{
get
;
set
;
}
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseProductFixtureInfo.cs
View file @
9f261137
...
...
@@ -7,9 +7,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public
class
ResponseProductFixtureInfo
{
/// <summary>
/// 工装
ID
/// 工装
名称
/// </summary>
public
int
FixtureId
{
get
;
set
;
}
public
string
FixtureName
{
get
;
set
;
}
/// <summary>
/// GUID
/// </summary>
...
...
@@ -34,6 +35,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public
string
ProductCode
{
get
;
set
;
}
public
string
ProductName
{
get
;
set
;
}
public
int
status
{
get
;
set
;
}
public
string
FixtureName
{
get
;
set
;
}
public
string
FixtureGuid
{
get
;
set
;
}
public
int
Location
{
get
;
set
;
}
public
string
Sn
{
get
;
set
;
}
}
...
...
Server/Infrastructure/Script/DB.script
View file @
9f261137
...
...
@@ -269,9 +269,6 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`materialid` int(11) NOT NULL DEFAULT 0 COMMENT '物料ID',
`processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID',
`materialstate` int(11) NOT 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 '备注',
...
...
@@ -327,17 +324,17 @@ CREATE TABLE IF NOT EXISTS `siger_automation_section_route` (
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,
`fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
COMMENT '工装GUID'
,
`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 '任务类型',
`
materialid
` int(11) NOT NULL DEFAULT 0 COMMENT '工件ID',
`
sn
` int(11) NOT NULL DEFAULT 0 COMMENT '工件ID',
`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',
`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 '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`action` int(1) NOT NULL DEFAULT 0 COMMENT '动作',
`actiontype` int(11) NOT NULL DEFAULT 0 COMMENT '动作类型',
`projectid` int(11) NOT NULL DEFAULT 0,
...
...
@@ -354,19 +351,22 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
-- ----------------------------
-- 设备可用状态
-- Table structure for siger_automation_
task_list
-- Table structure for siger_automation_
machine_status
-- ----------------------------
DROP TABLE IF EXISTS `siger_automation_machine_status`;
CREATE TABLE `siger_automation_machine_status` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`section` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`machineid` int(11) NOT NULL DEFAULT 0 COMMENT '工位对应设备ID',
`projectid` int(11) NOT NULL DEFAULT 0,
`enable` int(1) NOT NULL DEFAULT 1 COMMENT '设备可用状态 0:不可用 1:可用',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '完工状态 0:取消 1:待生产 2:生产中 3:生产完成 ',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`id` int NOT NULL AUTO_INCREMENT,
`section` int NOT NULL DEFAULT '0' COMMENT '工位ID',
`machineid` int NOT NULL DEFAULT '0' COMMENT '工位对应设备ID',
`projectid` int NOT NULL DEFAULT '0',
`enable` int NOT NULL DEFAULT '1' COMMENT '设备可用状态 0:不可用 1:可用',
`status` int NOT NULL DEFAULT '1' COMMENT '完工状态 0:取消 1:待生产 2:生产中 3:生产完成 ',
`updatetime` datetime DEFAULT NULL COMMENT '操作时间',
`program` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '程序号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS=1;
-- ----------------------------
...
...
@@ -417,6 +417,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`projectid` int(11) NOT NULL DEFAULT 0,
`fixtureguid` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工装ID',
`fixturename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工装名称',
`section` int(11) NOT NULL DEFAULT 0 COMMENT '当前工站ID',
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前绑定工件',
`route` int(1) NOT NULL DEFAULT 1 COMMENT '工序ID',
...
...
@@ -430,4 +431,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
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