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
be0071e4
Commit
be0071e4
authored
Feb 01, 2021
by
jiawei.su
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
someupdate
parent
0b6df559
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
180 additions
and
93 deletions
+180
-93
AutomationController.cs
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
+56
-50
AutomationLocationController.cs
.../Siger.ApiACC/Controllers/AutomationLocationController.cs
+3
-0
BeatAllocationController.cs
...Apis/Siger.ApiCNC/Controllers/BeatAllocationController.cs
+16
-4
AutomationFixtureToolsProductRepository.cs
...y/Repositories/AutomationFixtureToolsProductRepository.cs
+4
-3
AutomationLocationRepository.cs
...ccRepository/Repositories/AutomationLocationRepository.cs
+54
-32
IAutomationFixtureToolsProductRepository.cs
...ies/Interface/IAutomationFixtureToolsProductRepository.cs
+1
-1
ResponseAutomationInfo.cs
...dlelayer.AccRepository/Response/ResponseAutomationInfo.cs
+19
-1
ProductionBeatSetRepository.cs
...CncRepository/Repositories/ProductionBeatSetRepository.cs
+18
-2
RequestAddBeatAllocation.cs
...lelayer.CncRepository/Request/RequestAddBeatAllocation.cs
+9
-0
No files found.
Server/Apis/Siger.ApiACC/Controllers/AutomationController.cs
View file @
be0071e4
...
@@ -21,6 +21,7 @@ using Siger.Middlelayer.Repository.Entities;
...
@@ -21,6 +21,7 @@ using Siger.Middlelayer.Repository.Entities;
using
NPOI.SS.Formula.Functions
;
using
NPOI.SS.Formula.Functions
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.AccRepository.Response
;
using
Siger.Middlelayer.Common.Helpers
;
using
Siger.Middlelayer.Common.Helpers
;
using
NPOI.SS.Formula
;
namespace
Siger.ApiACC.Controllers
namespace
Siger.ApiACC.Controllers
{
{
...
@@ -105,6 +106,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -105,6 +106,7 @@ namespace Siger.ApiACC.Controllers
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
Logger
.
WriteLineInfo
(
$"AutoProcess 未配置设备类型字典"
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
throw
new
BadRequestException
(
AccEnum
.
AutomationDictNotfound
);
}
}
Logger
.
WriteLineInfo
(
$"设备状态更变
{
request
.
status
}
触发"
);
if
(
_automationTaskList
.
CanTask
(
PID
,
machineAttr
.
station
))
if
(
_automationTaskList
.
CanTask
(
PID
,
machineAttr
.
station
))
{
{
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
var
uploadStation
=
stationDicts
.
Where
(
f
=>
f
.
dkey
==
DictKeyValConst
.
UploadloadStation
);
...
@@ -382,7 +384,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -382,7 +384,7 @@ namespace Siger.ApiACC.Controllers
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
cleanMachine
.
section
);
if
(
monitor
!=
null
)
if
(
monitor
!=
null
)
{
{
CreateTask
(
cleanMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
);
CreateTask
(
cleanMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_QXJ_LK
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
);
return
;
//完成当前任务 退出
return
;
//完成当前任务 退出
}
}
}
}
...
@@ -390,14 +392,14 @@ namespace Siger.ApiACC.Controllers
...
@@ -390,14 +392,14 @@ namespace Siger.ApiACC.Controllers
//优先级2 :其他设备待上料 (立库->加工中心)
//优先级2 :其他设备待上料 (立库->加工中心)
var
freeMachine
=
machineStatusList
.
FirstOrDefault
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
);
var
freeMachine
=
machineStatusList
.
Where
(
f
=>
f
.
status
==(
int
)
Automation
.
MachineStatus
.
Waiting
);
if
(
freeMachine
!=
null
)
if
(
freeMachine
!=
null
)
{
{
Logger
.
WriteLine
Info
(
$"AutoProcess 普通空闲,创建普通设备上料Task"
);
Logger
.
WriteLine
Error
(
$"AutoProcess 普通空闲,创建普通设备上料Task"
);
var
location
=
SelectLocation
(
freeMachine
.
machineid
);
var
location
=
SelectLocation
(
freeMachine
.
Select
(
s
=>
s
.
machineid
).
ToList
()
);
if
(
location
!=
null
)
if
(
location
!=
null
)
{
{
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
freeMachine
.
section
);
var
monitor
=
_automationFixtureMonitor
.
Get
(
f
=>
f
.
section
==
location
.
section
);
if
(
monitor
==
null
)
if
(
monitor
==
null
)
{
{
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
_automationFixtureMonitor
.
Insert
(
new
siger_automation_fixture_tools_monitor
...
@@ -410,7 +412,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -410,7 +412,7 @@ namespace Siger.ApiACC.Controllers
fixturename
=
location
.
fixturename
,
fixturename
=
location
.
fixturename
,
ordernumber
=
location
.
ordernumber
,
ordernumber
=
location
.
ordernumber
,
locationId
=
location
.
location
,
locationId
=
location
.
location
,
section
=
freeMachine
.
section
,
section
=
location
.
section
,
sn
=
location
.
sn
,
sn
=
location
.
sn
,
createtime
=
DateTime
.
Now
,
createtime
=
DateTime
.
Now
,
updatetime
=
DateTime
.
Now
updatetime
=
DateTime
.
Now
...
@@ -429,7 +431,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -429,7 +431,7 @@ namespace Siger.ApiACC.Controllers
monitor
.
updatetime
=
DateTime
.
Now
;
monitor
.
updatetime
=
DateTime
.
Now
;
_automationFixtureMonitor
.
Update
(
monitor
);
_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
);
CreateTask
(
location
.
section
,
TaskActionType
.
Load
,
TaskAction
.
Step_LK_JGZX
,
location
.
fixture
,
location
.
ordernumber
,
location
.
sn
,
location
.
pn
,
location
.
productId
,
location
.
productCode
,
location
.
location
);
return
;
//完成当前任务 退出
return
;
//完成当前任务 退出
}
}
}
}
...
@@ -447,7 +449,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -447,7 +449,7 @@ namespace Siger.ApiACC.Controllers
Logger
.
WriteLineInfo
(
$"AutoProcess 找不到CNC监控信息"
);
Logger
.
WriteLineInfo
(
$"AutoProcess 找不到CNC监控信息"
);
return
;
return
;
}
}
CreateTask
(
fullMachine
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
);
CreateTask
(
fullMachine
.
section
,
TaskActionType
.
Unload
,
TaskAction
.
Step_JGZX_QXJ
,
monitor
.
fixtureguid
,
monitor
.
ordernumber
,
monitor
.
sn
,
"无程序"
,
monitor
.
productId
,
monitor
.
productCode
,
monitor
.
locationId
);
return
;
//完成当前任务 退出
return
;
//完成当前任务 退出
}
}
...
@@ -458,7 +460,7 @@ namespace Siger.ApiACC.Controllers
...
@@ -458,7 +460,7 @@ namespace Siger.ApiACC.Controllers
/// <summary>
/// <summary>
/// 创建自动任务
/// 创建自动任务
/// </summary>
/// </summary>
/// <param name="
machineStatus
"></param>
/// <param name="
section
"></param>
/// <param name="actionType"></param>
/// <param name="actionType"></param>
/// <param name="taskAction"></param>
/// <param name="taskAction"></param>
/// <param name="guid">工装GUID</param>
/// <param name="guid">工装GUID</param>
...
@@ -466,14 +468,14 @@ namespace Siger.ApiACC.Controllers
...
@@ -466,14 +468,14 @@ namespace Siger.ApiACC.Controllers
/// <param name="sn">工件</param>
/// <param name="sn">工件</param>
/// <param name="productCode">产品CODE</param>
/// <param name="productCode">产品CODE</param>
/// <param name="locationid">储位ID</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
)
void
CreateTask
(
int
section
,
TaskActionType
actionType
,
TaskAction
taskAction
,
string
guid
,
string
orderno
,
string
sn
,
string
program
,
int
productId
,
string
productCode
,
int
locationid
)
{
{
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Auto
);
var
taskNo
=
_automationTaskList
.
CrateTaskNumber
(
Automation
.
TaskTrigerType
.
Auto
);
_automationTaskList
.
Insert
(
new
siger_automation_task_list
_automationTaskList
.
Insert
(
new
siger_automation_task_list
{
{
no
=
taskNo
,
no
=
taskNo
,
projectId
=
PID
,
projectId
=
PID
,
sectionid
=
machineStatus
.
section
,
sectionid
=
section
,
trigger
=
TaskTrigerType
.
Auto
,
trigger
=
TaskTrigerType
.
Auto
,
action
=
taskAction
,
action
=
taskAction
,
actiontype
=
ExcueType
.
None
,
actiontype
=
ExcueType
.
None
,
...
@@ -504,57 +506,61 @@ namespace Siger.ApiACC.Controllers
...
@@ -504,57 +506,61 @@ namespace Siger.ApiACC.Controllers
/// <summary>
/// <summary>
/// 自动匹配储位 储位 ->CNC
/// 自动匹配储位 储位 ->CNC
/// </summary>
/// </summary>
ResponseAutomationLocationRouteInfo
SelectLocation
(
int
machine
)
ResponseAutomationLocationRouteInfo
SelectLocation
(
List
<
int
>
machines
)
{
{
// 当前空闲设备能加工的产品
// 当前空闲设备能加工的产品
var
beats
=
_productionBeatSet
.
GetList
(
f
=>
f
.
projectID
==
PID
&&
f
.
machineID
==
machine
);
var
beats
=
_productionBeatSet
.
GetList
(
f
=>
f
.
projectID
==
PID
&&
machines
.
Contains
(
f
.
machineID
)
&&
f
.
status
==(
int
)
RowState
.
Valid
).
ToList
();
var
productIds
=
beats
.
Select
(
f
=>
f
.
product_name
.
ToInt
()).
Distinct
().
ToList
();
var
TempList
=
new
List
<
ResponseAutoRouteInfo
>();
foreach
(
var
b
in
beats
)
// 取产品交期最近的订单
var
planOrder
=
_automationFixtureToolsProduct
.
GetDeliveryOrder
(
productIds
,
PID
);
if
(!
planOrder
.
Any
())
{
{
Logger
.
WriteLineInfo
(
$"SelectLocation 未找到最近订单号信息"
);
var
autoLocation
=
_automationLocation
.
Get
(
f
=>
f
.
projectId
==
b
.
projectID
&&
!
string
.
IsNullOrEmpty
(
f
.
sn
)
&&
f
.
routeid
==
b
.
route_number
.
ToInt
()
&&
f
.
productid
==
b
.
product_name
.
ToInt
());
return
null
;
if
(
autoLocation
==
null
)
continue
;
TempList
.
Add
(
new
ResponseAutoRouteInfo
{
FixtureGuid
=
autoLocation
.
fixturetools
,
FixtureName
=
autoLocation
.
fixturename
,
Section
=
b
.
section_id
,
Machine
=
b
.
machineID
,
Pn
=
b
.
process_number
,
ProductId
=
b
.
product_name
.
ToInt
(),
ProductName
=
b
.
product_name
,
Location
=
autoLocation
.
id
,
Route
=
b
.
route_number
.
ToInt
(),
RouteName
=
b
.
route_name
,
OrderNo
=
autoLocation
.
ordernumber
,
Sn
=
autoLocation
.
sn
});
}
}
var
order
=
planOrder
.
FirstOrDefault
();
//TODO 20210126
var
ordernos
=
TempList
.
Select
(
f
=>
f
.
OrderNo
).
ToList
();
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
)
var
planOrder
=
_automationFixtureToolsProduct
.
GetDeliveryOrder
(
ordernos
,
PID
);
if
(!
planOrder
.
Any
())
{
{
Logger
.
WriteLine
Info
(
$"SelectLocation 未找到产品的工艺顺序
"
);
Logger
.
WriteLine
Error
(
$"SelectLocation 未找到最近订单号信息
"
);
return
null
;
return
null
;
}
}
var
order
=
planOrder
.
FirstOrDefault
();
var
autoRouteInfo
=
TempList
.
Where
(
f
=>
f
.
OrderNo
==
order
.
ordernumber
).
OrderBy
(
d
=>
d
.
Sn
);
var
result
=
autoRouteInfo
.
FirstOrDefault
();
return
new
ResponseAutomationLocationRouteInfo
return
new
ResponseAutomationLocationRouteInfo
{
{
fixture
=
result
.
fixturetools
,
section
=
result
.
Section
,
fixturename
=
result
.
fixturename
,
machine
=
result
.
Machine
,
ordernumber
=
result
.
ordernumber
,
fixture
=
result
.
FixtureGuid
,
location
=
result
.
locationid
,
fixturename
=
result
.
FixtureName
,
productId
=
result
.
productid
,
ordernumber
=
result
.
OrderNo
,
productCode
=
result
.
productcode
,
location
=
result
.
Location
,
productName
=
result
.
productname
,
productId
=
result
.
ProductId
,
sn
=
result
.
sn
,
//productCode=result.productcode,
pn
=
valiateBeat
.
process_number
,
productName
=
result
.
ProductName
,
route
=
valiateBeat
.
route_name
sn
=
result
.
Sn
,
pn
=
result
.
Pn
,
route
=
result
.
Route
};
};
}
}
...
...
Server/Apis/Siger.ApiACC/Controllers/AutomationLocationController.cs
View file @
be0071e4
...
@@ -361,6 +361,9 @@ namespace Siger.ApiACC.Controllers
...
@@ -361,6 +361,9 @@ namespace Siger.ApiACC.Controllers
[
HttpGet
]
[
HttpGet
]
public
IActionResult
GetLocationList
(
string
productcode
,
int
fillsn
=
0
)
public
IActionResult
GetLocationList
(
string
productcode
,
int
fillsn
=
0
)
{
{
var
productFix
=
_automationFixtureToolsProduct
.
Get
(
f
=>
f
.
productcode
==
productcode
);
var
locations
=
_autoLocationRepository
.
GetFulllocation
(
ProjectId
,
fillsn
);
var
locations
=
_autoLocationRepository
.
GetFulllocation
(
ProjectId
,
fillsn
);
return
new
ObjectResult
(
locations
);
return
new
ObjectResult
(
locations
);
//if (fillsn == 1)
//if (fillsn == 1)
...
...
Server/Apis/Siger.ApiCNC/Controllers/BeatAllocationController.cs
View file @
be0071e4
...
@@ -23,14 +23,16 @@ namespace Siger.ApiCNC.Controllers
...
@@ -23,14 +23,16 @@ namespace Siger.ApiCNC.Controllers
private
readonly
IProductionBeatSetRepository
_beatSetRepository
;
private
readonly
IProductionBeatSetRepository
_beatSetRepository
;
private
readonly
ISigerProjectMachineRepository
_machineRepository
;
private
readonly
ISigerProjectMachineRepository
_machineRepository
;
private
readonly
ISigerProjectProductRepository
_productRepository
;
private
readonly
ISigerProjectProductRepository
_productRepository
;
private
readonly
IProductRouteRepository
_productRoute
;
public
BeatAllocationController
(
IUnitOfWork
unitOfWork
,
IProductionBeatSetRepository
beatSetRepository
,
ISigerProjectMachineRepository
machineRepository
,
public
BeatAllocationController
(
IUnitOfWork
unitOfWork
,
IProductionBeatSetRepository
beatSetRepository
,
ISigerProjectMachineRepository
machineRepository
,
ISigerProjectProductRepository
productRepository
)
ISigerProjectProductRepository
productRepository
,
IProductRouteRepository
productRoute
)
{
{
_unitOfWork
=
unitOfWork
;
_unitOfWork
=
unitOfWork
;
_beatSetRepository
=
beatSetRepository
;
_beatSetRepository
=
beatSetRepository
;
_machineRepository
=
machineRepository
;
_machineRepository
=
machineRepository
;
_productRepository
=
productRepository
;
_productRepository
=
productRepository
;
_productRoute
=
productRoute
;
}
}
[
HttpGet
]
[
HttpGet
]
...
@@ -43,6 +45,7 @@ namespace Siger.ApiCNC.Controllers
...
@@ -43,6 +45,7 @@ namespace Siger.ApiCNC.Controllers
var
validMachines
=
_machineRepository
.
GetLevelSectionNames
(
sectionID
,
ProjectId
);
var
validMachines
=
_machineRepository
.
GetLevelSectionNames
(
sectionID
,
ProjectId
);
foreach
(
var
time
in
data
.
Data
)
foreach
(
var
time
in
data
.
Data
)
{
{
var
route
=
_productRoute
.
Get
(
f
=>
f
.
id
==
time
.
route_number
.
ToInt
());
var
entity
=
Mapper
<
ResponseBeatSet
,
ResponseBeatSet
>.
Map
(
time
);
var
entity
=
Mapper
<
ResponseBeatSet
,
ResponseBeatSet
>.
Map
(
time
);
var
section
=
validMachines
.
FirstOrDefault
(
q
=>
q
.
machine_id
==
time
.
machineID
);
var
section
=
validMachines
.
FirstOrDefault
(
q
=>
q
.
machine_id
==
time
.
machineID
);
if
(
section
!=
null
)
if
(
section
!=
null
)
...
@@ -50,6 +53,10 @@ namespace Siger.ApiCNC.Controllers
...
@@ -50,6 +53,10 @@ namespace Siger.ApiCNC.Controllers
entity
.
sectionName
=
section
.
machine_name
;
entity
.
sectionName
=
section
.
machine_name
;
entity
.
stationName
=
section
.
lastSecondSectionTitle
+
"-"
+
section
.
lastSectionTitle
;
entity
.
stationName
=
section
.
lastSecondSectionTitle
+
"-"
+
section
.
lastSectionTitle
;
}
}
if
(
route
!=
null
)
{
entity
.
routeName
=
route
.
name
;
}
list
.
Add
(
entity
);
list
.
Add
(
entity
);
}
}
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
return
new
PagedObjectResult
(
list
,
data
.
Total
,
page
,
pagesize
);
...
@@ -104,6 +111,11 @@ namespace Siger.ApiCNC.Controllers
...
@@ -104,6 +111,11 @@ namespace Siger.ApiCNC.Controllers
{
{
throw
new
BadRequestException
(
RequestEnum
.
ProductNotFound
);
throw
new
BadRequestException
(
RequestEnum
.
ProductNotFound
);
}
}
var
route
=
_productRoute
.
Get
(
f
=>
f
.
id
==
request
.
route_id
);
if
(
route
==
null
)
{
throw
new
BadRequestException
(
RequestEnum
.
RouteNotFound
);
}
var
beatSet
=
new
siger_project_beat_set
var
beatSet
=
new
siger_project_beat_set
{
{
daily_standard_output
=
request
.
daily_standard_output
,
daily_standard_output
=
request
.
daily_standard_output
,
...
@@ -117,8 +129,8 @@ namespace Siger.ApiCNC.Controllers
...
@@ -117,8 +129,8 @@ namespace Siger.ApiCNC.Controllers
standard_besat
=
request
.
standard_besat
,
standard_besat
=
request
.
standard_besat
,
projectID
=
ProjectId
,
projectID
=
ProjectId
,
changemodeltime
=
request
.
time_num
.
ToInt
(),
changemodeltime
=
request
.
time_num
.
ToInt
(),
route_number
=
request
.
route_
number
.
ToStr
(),
route_number
=
request
.
route_
id
.
ToStr
(),
route_name
=
r
equest
.
route_
name
,
route_name
=
r
oute
.
name
,
updown_besat
=
request
.
updown_besat
.
ToDouble
(),
updown_besat
=
request
.
updown_besat
.
ToDouble
(),
yieldrate
=
request
.
yieldratio
,
yieldrate
=
request
.
yieldratio
,
start_time
=
timSet
?
start
:
DateTime
.
MinValue
,
start_time
=
timSet
?
start
:
DateTime
.
MinValue
,
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationFixtureToolsProductRepository.cs
View file @
be0071e4
...
@@ -103,11 +103,11 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -103,11 +103,11 @@ namespace Siger.Middlelayer.AccRepository.Repositories
/// <param name="productIds"></param>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <param name="projectId"></param>
/// <returns></returns>
/// <returns></returns>
public
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
int
>
productId
s
,
int
projectId
)
public
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
string
>
Ordernum
s
,
int
projectId
)
{
{
var
query
=
from
d
in
_context
.
siger_project_product_plan_detail
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
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
where
d
.
projectId
==
projectId
&&
Ordernums
.
Contains
(
d
.
OrderNumber
)
&&
d
.
status
!=
(
int
)
RowState
.
Invalid
&&
p
.
status
!=
(
int
)
RowState
.
Invalid
select
new
ResponseAutomationPlanOrder
select
new
ResponseAutomationPlanOrder
{
{
productId
=
p
.
product_id
,
productId
=
p
.
product_id
,
...
@@ -136,7 +136,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -136,7 +136,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
ProductName
=
p
.
product_name
,
ProductName
=
p
.
product_name
,
Url
=
pd
.
image
,
Url
=
pd
.
image
,
FixtureName
=
t
.
name
,
FixtureName
=
t
.
name
,
FixtureGuid
=
t
.
code
,
FixtureGuid
=
t
.
guid
,
FixtureCode
=
t
.
code
,
ProductCode
=
q
!=
null
?
q
.
productcode
:
""
,
ProductCode
=
q
!=
null
?
q
.
productcode
:
""
,
Location
=
l
!=
null
?
l
.
locationid
:
0
,
Location
=
l
!=
null
?
l
.
locationid
:
0
,
};
};
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/AutomationLocationRepository.cs
View file @
be0071e4
...
@@ -238,42 +238,64 @@ namespace Siger.Middlelayer.AccRepository.Repositories
...
@@ -238,42 +238,64 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public
IEnumerable
<
ResponseAutomationLocationList
>
GetFulllocation
(
int
projectId
,
int
full
)
public
IEnumerable
<
ResponseAutomationLocationList
>
GetFulllocation
(
int
projectId
,
int
full
)
{
{
var
query
=
from
q
in
_context
.
siger_automation_location
//获取有SN 的储位
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
if
(
full
==
1
)
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
where
q
.
projectId
==
projectId
&&
q
.
status
==(
int
)
RowState
.
Valid
&&
t
.
status
==(
int
)
RowState
.
Valid
&&
l
.
status
==(
int
)
RowState
.
Valid
&&
w
.
status
==(
int
)
RowState
.
Valid
select
new
ResponseAutomationLocationList
{
id
=
q
.
id
,
typeid
=
t
.
id
,
fixtureguid
=
t
.
guid
,
locationid
=
l
.
locationid
,
location
=
l
.
realname
,
locationcode
=
l
.
serial_number
,
wavehouseid
=
w
.
id
,
wavehouse
=
w
.
name
,
wavehousecode
=
w
.
serial_number
,
fixturetoolid
=
t
.
id
,
code
=
t
.
code
,
name
=
t
.
name
,
materialsn
=
q
.
sn
??
""
};
Expression
<
Func
<
ResponseAutomationLocationList
,
bool
>>
locationidExpression
=
f
=>
true
;
if
(
full
!=
0
)
{
{
locationidExpression
=
q
=>
!
string
.
IsNullOrEmpty
(
q
.
materialsn
);
var
query
=
from
q
in
_context
.
siger_automation_location
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
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
where
q
.
projectId
==
projectId
&&
!
string
.
IsNullOrEmpty
(
q
.
sn
)
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
l
.
status
==
(
int
)
RowState
.
Valid
&&
w
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseAutomationLocationList
{
id
=
q
.
id
,
typeid
=
t
.
id
,
fixtureguid
=
t
.
guid
,
locationid
=
l
.
locationid
,
location
=
l
.
realname
,
locationcode
=
l
.
serial_number
,
wavehouseid
=
w
.
id
,
wavehouse
=
w
.
name
,
wavehousecode
=
w
.
serial_number
,
fixturetoolid
=
t
.
id
,
code
=
t
.
code
,
name
=
t
.
name
,
materialsn
=
q
.
sn
};
Expression
<
Func
<
ResponseAutomationLocationList
,
bool
>>
locationidExpression
=
f
=>
true
;
return
query
.
Where
(
locationidExpression
);
}
else
}
else
{
{
locationidExpression
=
q
=>
string
.
IsNullOrEmpty
(
q
.
materialsn
);
//选择SN为空的储位
var
query
=
from
q
in
_context
.
siger_automation_location
join
t
in
_context
.
siger_automation_fixture_tools
on
q
.
fixturetools
equals
t
.
guid
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
where
q
.
projectId
==
projectId
&&
string
.
IsNullOrEmpty
(
q
.
sn
)
&&
q
.
status
==
(
int
)
RowState
.
Valid
&&
t
.
status
==
(
int
)
RowState
.
Valid
&&
l
.
status
==
(
int
)
RowState
.
Valid
&&
w
.
status
==
(
int
)
RowState
.
Valid
select
new
ResponseAutomationLocationList
{
id
=
q
.
id
,
typeid
=
t
.
id
,
fixtureguid
=
t
.
guid
,
locationid
=
l
.
locationid
,
location
=
l
.
realname
,
locationcode
=
l
.
serial_number
,
wavehouseid
=
w
.
id
,
wavehouse
=
w
.
name
,
wavehousecode
=
w
.
serial_number
,
fixturetoolid
=
t
.
id
,
code
=
t
.
code
,
name
=
t
.
name
,
materialsn
=
q
.
sn
};
Expression
<
Func
<
ResponseAutomationLocationList
,
bool
>>
locationidExpression
=
f
=>
true
;
return
query
.
Where
(
locationidExpression
);
}
}
return
query
.
Where
(
locationidExpression
);
}
}
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Repositories/Interface/IAutomationFixtureToolsProductRepository.cs
View file @
be0071e4
...
@@ -37,7 +37,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
...
@@ -37,7 +37,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <param name="productIds"></param>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <param name="projectId"></param>
/// <returns></returns>
/// <returns></returns>
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
int
>
productId
s
,
int
projectId
);
IEnumerable
<
ResponseAutomationPlanOrder
>
GetDeliveryOrder
(
List
<
string
>
Ordernum
s
,
int
projectId
);
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.AccRepository/Response/ResponseAutomationInfo.cs
View file @
be0071e4
...
@@ -31,6 +31,8 @@ namespace Siger.Middlelayer.AccRepository.Response
...
@@ -31,6 +31,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public
class
ResponseAutomationLocationRouteInfo
public
class
ResponseAutomationLocationRouteInfo
{
{
public
int
section
{
get
;
set
;
}
public
int
machine
{
get
;
set
;
}
public
string
fixture
{
get
;
set
;
}
public
string
fixture
{
get
;
set
;
}
public
string
fixturename
{
get
;
set
;
}
public
string
fixturename
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
public
string
ordernumber
{
get
;
set
;
}
...
@@ -39,8 +41,24 @@ namespace Siger.Middlelayer.AccRepository.Response
...
@@ -39,8 +41,24 @@ namespace Siger.Middlelayer.AccRepository.Response
public
int
productId
{
get
;
set
;
}
public
int
productId
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productCode
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
string
productName
{
get
;
set
;
}
public
string
route
{
get
;
set
;
}
public
int
route
{
get
;
set
;
}
public
string
pn
{
get
;
set
;
}
public
string
pn
{
get
;
set
;
}
}
}
public
class
ResponseAutoRouteInfo
{
public
int
Section
{
get
;
set
;
}
public
int
Machine
{
get
;
set
;
}
public
string
Pn
{
get
;
set
;
}
public
int
ProductId
{
get
;
set
;
}
public
string
ProductName
{
get
;
set
;
}
public
int
Route
{
get
;
set
;
}
public
string
RouteName
{
get
;
set
;
}
public
string
OrderNo
{
get
;
set
;
}
public
string
FixtureGuid
{
get
;
set
;
}
public
string
FixtureName
{
get
;
set
;
}
public
string
Sn
{
get
;
set
;
}
public
int
Location
{
get
;
set
;
}
}
}
}
Server/Infrastructure/Repositories/Siger.Middlelayer.CncRepository/Repositories/ProductionBeatSetRepository.cs
View file @
be0071e4
...
@@ -101,6 +101,8 @@ namespace Siger.Middlelayer.CncRepository.Repositories
...
@@ -101,6 +101,8 @@ namespace Siger.Middlelayer.CncRepository.Repositories
var
sectionIds
=
new
List
<
int
>();
var
sectionIds
=
new
List
<
int
>();
var
productIds
=
new
List
<
string
>();
var
productIds
=
new
List
<
string
>();
var
machineIds
=
new
List
<
int
>();
var
machineIds
=
new
List
<
int
>();
var
validates
=
new
List
<
BeatSetEntity
>();
foreach
(
var
beatSetEntity
in
beatSetEntities
)
foreach
(
var
beatSetEntity
in
beatSetEntities
)
{
{
var
sectionId
=
0
;
var
sectionId
=
0
;
...
@@ -180,14 +182,26 @@ namespace Siger.Middlelayer.CncRepository.Repositories
...
@@ -180,14 +182,26 @@ namespace Siger.Middlelayer.CncRepository.Repositories
{
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
UpDownBesatNotInteger
}
"
);
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
UpDownBesatNotInteger
}
"
);
}
}
var
route
=
_context
.
siger_project_product_route
.
FirstOrDefault
(
f
=>
f
.
projectId
==
projectid
&&
f
.
productId
==
product
.
id
&&
f
.
name
==
beatSetEntity
.
RouteName
);
if
(
route
==
null
)
{
errors
.
Add
(
$"
{
rowIndex
}
,
{(
int
)
RequestEnum
.
RouteNotFound
}
"
);
}
if
(
errors
.
Any
())
if
(
errors
.
Any
())
{
{
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
return
new
CommonImportResult
(
0
,
string
.
Join
(
";"
,
errors
));
}
}
beatSetEntity
.
RouteNumber
=
route
.
id
.
ToString
();
validates
.
Add
(
beatSetEntity
);
}
}
var
index
=
0
;
var
index
=
0
;
var
maxTime
=
"2199-01-01 00:00:00"
.
ToDateTime
();
var
maxTime
=
"2199-01-01 00:00:00"
.
ToDateTime
();
foreach
(
var
entity
in
beatSetEntiti
es
)
foreach
(
var
entity
in
validat
es
)
{
{
var
beat
=
new
siger_project_beat_set
var
beat
=
new
siger_project_beat_set
{
{
...
@@ -201,12 +215,14 @@ namespace Siger.Middlelayer.CncRepository.Repositories
...
@@ -201,12 +215,14 @@ namespace Siger.Middlelayer.CncRepository.Repositories
product_name
=
productIds
[
index
],
product_name
=
productIds
[
index
],
section_id
=
sectionIds
[
index
],
section_id
=
sectionIds
[
index
],
standard_besat
=
entity
.
CycleTime
.
ToInt
(),
standard_besat
=
entity
.
CycleTime
.
ToInt
(),
route_name
=
entity
.
RouteName
,
route_name
=
entity
.
RouteName
,
machineID
=
machineIds
.
Count
>
index
?
machineIds
[
index
]:
0
,
machineID
=
machineIds
.
Count
>
index
?
machineIds
[
index
]:
0
,
changemodeltime
=
entity
.
ChangeModelTime
.
ToInt
(),
changemodeltime
=
entity
.
ChangeModelTime
.
ToInt
(),
updown_besat
=
entity
.
UpDownBesat
.
ToDouble
(),
updown_besat
=
entity
.
UpDownBesat
.
ToDouble
(),
yieldrate
=
entity
.
YieldRate
.
ToInt
(),
yieldrate
=
entity
.
YieldRate
.
ToInt
(),
route_number
=
entity
.
RouteNumber
,
//route_number = entity.RouteNumber,
route_number
=
entity
.
RouteNumber
,
start_time
=
string
.
IsNullOrEmpty
(
entity
.
StartTime
)
?
DateTime
.
MinValue
:
entity
.
StartTime
.
ToDateTime
(),
start_time
=
string
.
IsNullOrEmpty
(
entity
.
StartTime
)
?
DateTime
.
MinValue
:
entity
.
StartTime
.
ToDateTime
(),
end_time
=
string
.
IsNullOrEmpty
(
entity
.
EndTime
)
?
maxTime
:
entity
.
EndTime
.
ToDateTime
().
AddDays
(
1
).
AddSeconds
(-
1
)
end_time
=
string
.
IsNullOrEmpty
(
entity
.
EndTime
)
?
maxTime
:
entity
.
EndTime
.
ToDateTime
().
AddDays
(
1
).
AddSeconds
(-
1
)
};
};
...
...
Server/Infrastructure/Repositories/Siger.Middlelayer.CncRepository/Request/RequestAddBeatAllocation.cs
View file @
be0071e4
...
@@ -13,6 +13,10 @@ namespace Siger.Middlelayer.CncRepository.Request
...
@@ -13,6 +13,10 @@ namespace Siger.Middlelayer.CncRepository.Request
public
string
product_name_text
{
get
;
set
;
}
public
string
product_name_text
{
get
;
set
;
}
/// <summary>
/// productId
/// </summary>
[
Required
(
ErrorMessage
=
"ProductNameIsEmpty"
)]
[
Required
(
ErrorMessage
=
"ProductNameIsEmpty"
)]
public
string
product_name
{
get
;
set
;
}
public
string
product_name
{
get
;
set
;
}
...
@@ -24,6 +28,11 @@ namespace Siger.Middlelayer.CncRepository.Request
...
@@ -24,6 +28,11 @@ namespace Siger.Middlelayer.CncRepository.Request
public
string
time_num
{
get
;
set
;
}
public
string
time_num
{
get
;
set
;
}
/// <summary>
/// 产品工序表ID
/// </summary>
public
int
route_id
{
get
;
set
;
}
public
string
route_number
{
get
;
set
;
}
public
string
route_number
{
get
;
set
;
}
public
string
route_name
{
get
;
set
;
}
public
string
route_name
{
get
;
set
;
}
...
...
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