Commit 0a6ba9b6 by yucheng.jiang
parents ec2949f8 b0295f37
<template>
<div>
员工上下料管理
</div>
<div>
员工上下料管理
<div class="divborder">
<div class="choose">
<p class="selectTitle">
1.请选择生产线
<span class="red">*</span>
</p>
<div class="row">
<p
:key="index"
class="options"
v-for="(item, index) in productionLine"
@click="change(index)"
:class="{ active: a == index }"
>
{{ item.title }}
</p>
</div>
<div class="choose">
<p class="selectTitle">
2.上下料工位
<span class="red">*</span>
</p>
<div class="row">
<p
:key="index"
class="options"
v-for="(item, index) in productionLine"
@click="change(index)"
:class="{ active: a == index }"
>
{{ item.title }}
</p>
</div>
</div>
<div class="choose">
<p class="selectTitle">
3.操作
<span class="red">*</span>
</p>
<Tabs type="card">
<TabPane label="上料">
<div class="filter">
<label>上料信息:</label>
<Input
type="text"
class="searchInput"
style="width: 300px"
></Input>
</div>
<div class="row">
<p class="flex">
<span class="infoLabel">工单信息:</span>
<span class="info"></span>
</p>
<p class="flex">
<span class="infoLabel">产品编号:</span>
<span class="info"></span>
</p>
<p class="flex">
<span class="infoLabel">产品名称:</span>
<span class="info"></span>
</p>
<p class="flex">
<span class="infoLabel">工件编号:</span>
<span class="info"></span>
</p>
</div>
<div class="row">
<p class="flex">
<span class="infoLabel">状态:</span>
<span class="info"></span>
</p>
<p class="flex">
<span class="infoLabel">储位编号:</span>
<span class="info"></span>
</p>
<p class="flex">
<span class="infoLabel">工装编号:</span>
<span class="info"></span>
</p>
<Button type="primary">储位选择</Button>
</div>
<div>
<Button type="primary">准备上料</Button>
<Button type="primary">安装完成</Button>
</div>
</TabPane>
<TabPane label="下料">下料</TabPane>
</Tabs>
<Modal
class="newModalClass"
:title="$t(900249)"
v-model="modal"
:styles="{ width: '940px' }"
>
<div class="modal_body" style="padding-right: 40px">
<Table
class="tableClass"
:data="data1"
:columns="columns1"
:max-height="200"
></Table>
</div>
<div slot="footer">
<Button
type="text"
size="large"
@click="modal = false"
v-text="$t('1033')"
>取消</Button
>
<Button
type="primary"
size="large"
v-text="$t('1011')"
>提交</Button
>
</div>
</Modal>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
}
data() {
return {
productionLine: [],
a: 0,
modal:false,
columns1:[],
data1:[]
};
},
created() {},
methods: {
change(i) {
this.a = i;
// 1. 选中产线后自动带出来工位属性中为上下料属性的工位
},
},
};
</script>
<style>
<style scoped>
.selectTitle {
font-size: 18px;
}
.row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
flex-shrink: 1;
}
.options {
font-size: 12px;
padding: 0 12px;
/* width: 100px; */
height: 50px;
line-height: 50px;
text-align: center;
border-radius: 5px;
background-color: #f2f2f2;
margin: 10px 0;
margin-right: 50px;
cursor: pointer;
}
.active {
background-color: #2d8cf0;
color: #fff;
}
.actionTitle {
height: 50px;
width: 100px;
line-height: 50px;
font-size: 25px;
text-align: center;
/* border: 1px solid #b2b2b2; */
/* color: #c0c0c0; */
}
.flex {
display: flex;
}
.infoLabel {
display: inline-block;
margin-right: 10px;
width: 100px;
text-align: right;
font-size: 16px;
}
.info {
display: inline-block;
width: 200px;
font-size: 20px;
}
</style>
\ No newline at end of file
<template>
<div>
任务清单管理
<div class="testdiv">
\任务清单管理
<div class="divborder">
<h2>基本信息</h2>
<div class="newSearchDiv">
<div class="filter">
<label>{{ $t("1950574") }}</label>
<Cascader trigger="click" class="searchSelect"></Cascader>
</div>
<div class="filter">
<label>任务类型:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="filter">
<label>发起地:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="filter">
<label>产品编号:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="filter">
<label>任务编号:</label>
<Input type="text" class="searchInput"></Input>
</div>
<div class="filter">
<label>工件编号:</label>
<Input type="text" class="searchInput"></Input>
</div>
<div class="filter">
<label>状态:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="filter">
<label>执行类型:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="filter">
<label>触发时间:</label>
<DatePicker
type="datetimerange"
placeholder="Select date"
style="width: 200px"
></DatePicker>
</div>
<div class="filter">
<label>完成时间:</label>
<DatePicker
type="datetimerange"
placeholder="Select date"
style="width: 200px"
></DatePicker>
</div>
<div class="searchBtn">
<Button type="primary" class="twoWord" icon="ios-search">{{
$t("1001")
}}</Button>
<!-- -->
<Button type="primary" class="twoWord" icon="ios-search"
>取消</Button
><!--只有状态是待执行的可以改成取消-->
<Button type="primary" class="twoWord" icon="ios-search"
>手动</Button
><!--当生产线的模式是手动是才可以进行手动任务执行-->
<Button type="primary" class="twoWord" icon="ios-search"
>导出</Button
>
</div>
</div>
</div>
<div class="divborder newTableDiv">
<Table class="tableClass" :columns="columns1" :data="data1"></Table>
<div class="pageDiv">
<div class="pageDirection">
<Page
:total="total"
:current="page"
show-elevator
show-sizer
show-total
:page-size-opts="[10, 20, 30, 40, 100]"
></Page>
</div>
</div>
</div>
</div>
</template>
<script>
export default {};
export default {
data() {
return {
columns1: [
{
title: this.$t('1008'),
key: 'xuhao',
render: (h, params) => {
return h(
'span',
params.index + (this.page - 1) * this.pagesize + 1
);
},
width: 70
},
{
title: this.$t('100089'),
key: 'productcode',
minWidth: 150
},
],
data1: [],
total: 0,
page: 1,
pagesize: 10,
};
},
created() {
this.columns1 = this.$time.initTableTitle(this.columns1);
},
methods: {},
};
</script>
<style>
......
<template>
<div class="testdiv">
工装装配信息
<div class="divborder">
<h2>基本信息</h2>
<div class="newSearchDiv">
<div class="filter">
<label>工装类别:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="filter">
<label>夹具类型:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="searchBtn">
<Button
type="primary"
class="twoWord"
icon="ios-search"
@click="search(1, 10)"
>{{ $t("1001") }}</Button
>
<Button
type="success"
class="twoWord"
icon="md-add-circle"
@click="add()"
>{{ $t("1002") }}</Button
>
<Button
type="warning"
class="twoWord"
icon="ios-create-outline"
@click="edit()"
>{{ $t("1003") }}</Button
>
<Button
type="error"
class="twoWord intervalRight"
icon="md-close-circle"
@click="dele()"
>{{ $t("1004") }}</Button
>
<Button
type="primary"
class="fourWord"
icon="md-download"
@click="loadExcel()"
>{{ $t("1005") }}</Button
>
<!-- <Upload
style="display: inline-block"
ref="upload"
:action="action"
name="excel-file"
:headers="headers"
:show-upload-list="false"
:on-format-error="handleFormatError"
:on-success="handleSuccess"
:on-error="handleError"
:format="['xlsx']"
> -->
<Button
type="primary"
class="fourWord"
icon="md-cloud-upload"
>{{ $t("1006") }}</Button
>
<!-- </Upload> -->
<Button
type="primary"
class="fourWord"
icon="ios-cloud-download"
@click="exportEecel()"
>{{ $t("1007") }}</Button
>
</div>
</div>
</div>
<div class="divborder newTableDiv">
<Table class="tableClass" :columns="columns1" :data="data1"></Table>
<div class="pageDiv">
<div class="pageDirection">
<Page
:total="total"
:current="page"
show-elevator
show-sizer
show-total
:page-size-opts="[10, 20, 30, 40, 100]"
></Page>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
columns1: [
{
title: this.$t("1008"),
key: "xuhao",
render: (h, params) => {
return h(
"span",
params.index + (this.page - 1) * this.pagesize + 1
);
},
width: 70,
},
{
title: this.$t("100089"),
key: "productcode",
minWidth: 150,
},
],
data1: [],
total: 0,
page: 1,
pagesize: 10,
};
},
created() {
this.columns1 = this.$time.initTableTitle(this.columns1);
},
methods: {
search(page,pagesize){},
add(){},
edit(){},
dele(){},
loadExcel(){},
exportEecel(){},
},
};
</script>
<style>
</style>
\ No newline at end of file
......@@ -3,14 +3,40 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Request;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Log;
using Siger.Middlelayer.Common.ModuleEnum;
using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Share.Constant;
using Siger.Middlelayer.Share.Enum.ModuleEnum;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
namespace Siger.ApiACC.Controllers
{
public class AutomationController : BaseController
public class AutomationController : LaisiBaseController
{
private readonly IUnitOfWork _unitOfWork;
private readonly ISigerProjectLevelSectionRepository _sigerProjectLevelSection;
private readonly IAutomationLineMode _automationLineMode;
private readonly IAutomationMachineStatus _automationMachineStatus;
private readonly ISigerDict _sigerDict;
private readonly IAutomationTaskListRepository _automationTaskList;
public AutomationController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection,IAutomationLineMode automationLineMode,IAutomationMachineStatus automationMachineStatus,ISigerDict sigerDict,IAutomationTaskListRepository automationTaskList)
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
_automationLineMode = automationLineMode;
_automationMachineStatus = automationMachineStatus;
_sigerDict = sigerDict;
_automationTaskList = automationTaskList;
}
/// <summary>
/// 设备状态接口 用于 保存 设备当前可用状态
/// </summary>
......@@ -19,27 +45,161 @@ namespace Siger.ApiACC.Controllers
[HttpPost]
public IActionResult MachineStatus([FromBody]RequestAutomationMachine request)
{
return new ObjectResult("1");
var exitsObj = _automationMachineStatus.Get(f => f.machineid == request.machineid);
if (exitsObj==null)
{
_automationMachineStatus.Insert(new siger_automation_machine_status{
machineid=request.machineid,
projectId=PID,
updatetime=DateTime.Now,
enable=request.enable,
status=request.status
});
}else
{
exitsObj.enable = request.enable;
exitsObj.status = request.status;
exitsObj.updatetime = DateTime.Now;
}
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
else
throw new BadRequestException(CommonEnum.Fail);
}
/// <summary>
/// 任务状态接口 用于保存PLC 实时任务状态
/// 任务状态接口 用于保存PLC 实时任务状态 ()
/// </summary>
/// <returns></returns>
public IActionResult TaskResult([FromBody]RequestAutomationTaskResult request)
{
//1.检查Tasklist
var taskObj = _automationTaskList.Get(f => f.guid == request.guid);
if (taskObj == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
if (taskObj.status==(int)TaskResultStatus.Complated)
{
throw new BadRequestException(AccEnum.AutoTaskDone);
}
//2.更新状态
taskObj.status = request.status;
if (_unitOfWork.Commit() <= 0)
{
throw new BadRequestException(CommonEnum.Fail);
}
//是否还有未完成任务
var taskDone = _automationTaskList.Get(f => f.projectId == PID && f.status > (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
if(taskDone!=null)
{
//还有未完成任务 退出 等待任务下发
return new ObjectResult(CommonEnum.Succefull);
}
//3.Tasklist 任务全部完成 ,创建自动任务
switch (request.status)
{
case (int)TaskResultStatus.Cancel:
case (int)TaskResultStatus.Complated:
{
CreateAutoTask(taskObj);
break;
}
case (int)TaskResultStatus.Waiting:
case (int)TaskResultStatus.Produce:
default:
{
break;
}
}
return new ObjectResult(CommonEnum.Succefull);
}
/// <summary>
/// 创建自动 Task任务
/// </summary>
/// <param name="tasklist"></param>
void CreateAutoTask(siger_automation_task_list tasklist)
{
var section = _sigerProjectLevelSection.Get(f => f.id == tasklist.startsection);
if (section == null)
{
Logger.WriteLineInfo($"CreateAutoTask 工站未找到");
throw new BadRequestException(RequestEnum.LevelSectionNotFound);
}
var lineMode = _automationLineMode.Get(f => f.projectId == PID && f.section == section.parentid);
if (lineMode==null)
{
Logger.WriteLineInfo($"CreateAutoTask 产线未找到");
throw new BadRequestException(RequestEnum.LevelSectionNotFound);
}
if (lineMode.mode==0)
{
Logger.WriteLineInfo($"CreateAutoTask 手动模式");
//手动模式时 退出
return;
}
var machineList= _automationMachineStatus.GetList(f => f.projectId == PID && f.enable == 1);
//自动Task任务 顺序
//1.清洗机下料
//2.其他设备上料
//3.其他设备下料
var stationDicts = _sigerDict.GetDataByCat(AccDictCost.Automation, PID);
if (!stationDicts.Any())
{
Logger.WriteLineInfo($"CreateAutoTask 未配置设备类型字典");
return;
}
var dictClean = stationDicts.FirstOrDefault(s=>s.dkey==DictKeyValConst.CleanStation);
if (dictClean==null)
{
Logger.WriteLineInfo($"CreateAutoTask 未配置清洗机字典");
return;
}
return new ObjectResult("1");
}
/// <summary>
/// 产线模式 0:手动模式 /1:自动模式(产生自动任务)
/// </summary>
/// <param name="line"></param>
/// <param name="mode"></param>
/// <returns></returns>
public IActionResult LineMode(int mode)
public IActionResult LineMode(int line,int mode)
{
return new ObjectResult("1");
var exitObj = _automationLineMode.Get(f => f.section == line);
if (exitObj==null)
{
_automationLineMode.Insert(new siger_automation_line_mode
{
section = line,
projectId = PID,
status=1,
updatetime=DateTime.Now,
mode=mode
}) ;
}else
{
exitObj.updatetime = DateTime.Now;
exitObj.mode = mode;
}
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
else
throw new BadRequestException(CommonEnum.Fail);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc;
using Siger.ApiCommon.Result;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Extensions;
using System.Linq;
using Siger.Middlelayer.Repository.Entities;
namespace Siger.ApiACC.Controllers
{
public class AutomationLocationController : BaseController
{
private readonly IUnitOfWork _unitOfWork;
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly ISigerTrMaterialsRepository _materialsRepository;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository,
ISigerTrMaterialsRepository materialsRepository)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository;
_autoLocationRepository = autoLocationRepository;
_materialsRepository = materialsRepository;
}
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize)
{
var data = _toolsRepository.GetPagedList(category.ToInt(), code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
}
[HttpPost]
public IActionResult Add([FromBody]RequestAddAutomationLocation req)
{
if (string.IsNullOrEmpty(req.locationid) || string.IsNullOrEmpty(req.fixturetoolid) || string.IsNullOrEmpty(req.materialid))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var fixturetool = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId && q.status == (int)RowState.Valid);
if (fixturetool == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
throw new BadRequestException(RequestEnum.LocationNull);
}
var material = _materialsRepository.Get(q => q.id == req.materialid.ToInt() && q.projectId == ProjectId && q.status == (int)RowState.Valid);
var data = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.fixturetools == fixturetool.guid &&
q.locationid == req.locationid.ToInt());
if (data != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var state = 1;
if (fixturetool != null && material == null)
{
state = 1;//有工装 无工件
}
else if(fixturetool != null && material != null)
{
state = 2;//有工装 有工件
}
var entity = new siger_automation_location
{
guid = Guid.NewGuid().ToString(),
locationid = req.locationid.ToInt(),
fixturetools = fixturetool.guid,
materialid = req.materialid.ToInt(),
processid = req.processid.ToInt(),
materialstate = state,
attachment = req.attachment,
remark = req.remark,
projectId = ProjectId,
updatetime = DateTime.Now,
updator = UserId,
};
_autoLocationRepository.Insert(entity);
if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
[HttpPost]
public IActionResult Update([FromBody]RequestUpdateAutomationLocation req)
{
if (string.IsNullOrEmpty(req.locationid) || string.IsNullOrEmpty(req.fixturetoolid) || string.IsNullOrEmpty(req.materialid))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var entity = _autoLocationRepository.Get(q => q.id == req.id && q.projectId == ProjectId && q.status == (int)RowState.Valid);
var fixturetool = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId && q.status == (int)RowState.Valid);
if (fixturetool == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
throw new BadRequestException(RequestEnum.LocationNull);
}
var material = _materialsRepository.Get(q => q.id == req.materialid.ToInt() && q.projectId == ProjectId && q.status == (int)RowState.Valid);
var data = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.fixturetools == fixturetool.guid &&
q.locationid == req.locationid.ToInt() && q.id != req.id);
if (data != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var state = 1;
if (fixturetool != null && material == null)
{
state = 1;//有工装 无工件
}
else if (fixturetool != null && material != null)
{
state = 2;//有工装 有工件
}
entity.locationid = req.locationid.ToInt();
entity.fixturetools = fixturetool.guid;
entity.materialid = req.materialid.ToInt();
entity.processid = req.processid.ToInt();
entity.materialstate = state;
entity.attachment = req.attachment;
entity.remark = req.remark;
entity.updatetime = DateTime.Now;
entity.updator = UserId;
_autoLocationRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
[HttpGet]
public IActionResult Delete(int id)
{
var entity = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == id);
if (entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
entity.status = (int)RowState.Invalid;
_autoLocationRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
[HttpPost]
public IActionResult Deletes([FromBody]RequestDeleteRange req)
{
if (req.ids == null || !req.ids.Any())
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var entities = _autoLocationRepository.GetList(t =>
req.ids.Contains(t.id) && t.projectId == ProjectId && t.status == (int)RowState.Valid).ToList();
if (!entities.Any())
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
foreach (var entity in entities)
{
entity.status = (int)RowState.Invalid;
_autoLocationRepository.Update(entity);
}
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
throw new BadRequestException(CommonEnum.Fail);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc;
using Siger.ApiCommon.Result;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Extensions;
using System.Linq;
using Siger.Middlelayer.Repository.Entities;
namespace Siger.ApiACC.Controllers
{
public class FixtureToolsAssemblyController : BaseController
{
private readonly IUnitOfWork _unitOfWork;
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationFixtureToolsAssemblyRepository _toolsAssemblyRepository;
public FixtureToolsAssemblyController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationFixtureToolsAssemblyRepository toolsAssemblyRepository)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository;
_toolsAssemblyRepository = toolsAssemblyRepository;
}
public IActionResult GetPageList(string category, int page, int pagesize)
{
var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc;
using Siger.ApiCommon.Result;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Extensions;
using System.Linq;
using Siger.Middlelayer.Repository.Entities;
namespace Siger.ApiACC.Controllers
{
public class FixtureToolsProductController : BaseController
{
private readonly IUnitOfWork _unitOfWork;
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationFixtureToolsProductRepository _toolsProductRepository;
private readonly ISigerProjectProductRepository _productRepository;
public FixtureToolsProductController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationFixtureToolsProductRepository toolsProductRepository,
ISigerProjectProductRepository productRepository)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository;
_toolsProductRepository = toolsProductRepository;
_productRepository = productRepository;
}
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);
}
[HttpPost]
public IActionResult Add([FromBody]RequestAddFixtureToolsProduct req)
{
if(string.IsNullOrEmpty(req.fixturetoolid) || string.IsNullOrEmpty(req.productid))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var fixtureTool = _toolsRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.fixturetoolid.ToInt());
if(fixtureTool == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var product = _productRepository.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.productid.ToInt());
if(product == null)
{
throw new BadRequestException(RequestEnum.ProductNotFound);
}
var data = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && (q.fixturetools == fixtureTool.guid ||
q.productid == req.productid.ToInt()));
if (data != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
var entity = new siger_automation_fixture_tools_product
{
guid = Guid.NewGuid().ToString(),
fixturetools = fixtureTool.guid,
remark=req.remark,
productid=req.productid.ToInt(),
projectId = ProjectId,
createtime = DateTime.Now,
updatetime = DateTime.Now,
creator = UserId,
updator = UserId,
};
_toolsProductRepository.Insert(entity);
if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
[HttpPost]
public IActionResult Update([FromBody]RequestUpdateFixtureToolsProduct req)
{
if (string.IsNullOrEmpty(req.fixturetoolid) || string.IsNullOrEmpty(req.productid))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var entity = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.id);
if(entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var fixtureTool = _toolsRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.fixturetoolid.ToInt());
if (fixtureTool == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var product = _productRepository.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.id == req.productid.ToInt());
if (product == null)
{
throw new BadRequestException(RequestEnum.ProductNotFound);
}
var data = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && (q.fixturetools == fixtureTool.guid ||
q.productid == req.productid.ToInt()) && q.id != req.id);
if (data != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
entity.fixturetools = fixtureTool.guid;
entity.remark = req.remark;
entity.productid = req.productid.ToInt();
entity.updatetime = DateTime.Now;
entity.updator = UserId;
_toolsProductRepository.Insert(entity);
if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
[HttpGet]
public IActionResult Delete(int id)
{
var entity = _toolsProductRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == id);
if (entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
entity.status = (int)RowState.Invalid;
_toolsProductRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
[HttpPost]
public IActionResult Deletes([FromBody]RequestDeleteRange req)
{
if (req.ids == null || !req.ids.Any())
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
var entities = _toolsProductRepository.GetList(t =>
req.ids.Contains(t.id) && t.projectId == ProjectId && t.status == (int)RowState.Valid).ToList();
if (!entities.Any())
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
foreach (var entity in entities)
{
entity.status = (int)RowState.Invalid;
_toolsProductRepository.Update(entity);
}
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
throw new BadRequestException(CommonEnum.Fail);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Siger.ApiCommon;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Configuration;
using Siger.Middlelayer.Common.Extensions;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Siger.ApiACC.Controllers
{
[Route("acc/[controller]/[action]")]
public class LaisiBaseController
{
/// <summary>
/// 自动线 ProjectID 通过配置
/// </summary>
public int PID = 0;
public LaisiBaseController()
{
var _pid = ConfigManager.GetValue("ProjectSetting", "ProjectId", string.Empty);
if (string.IsNullOrEmpty(_pid))
throw new Exception("DbSetting about [ProjectSetting] ProjectId not found.");
PID = _pid.ToInt();
}
}
}
......@@ -63,6 +63,12 @@ namespace Siger.Middlelayer.Common
/// 罗美特分类
/// </summary>
public const string FlowMetek = "FlowMetek";
/// <summary>
/// MES 自动线类型
/// </summary>
public const string Automation = "automation";
}
public class AccDictCostNoProjectId
......@@ -102,4 +108,6 @@ namespace Siger.Middlelayer.Common
/// </summary>
public const string outgoing_type = "outgoing_type";
}
}
......@@ -28,5 +28,18 @@ namespace Siger.Middlelayer.Share.Constant
/// 表头 工站
/// </summary>
public const string EleHeader = "EleHeader";
/// <summary>
/// automation key:清洗工站
/// </summary>
public const string CleanStation = "CleanStation";
/// <summary>
/// key:上料工站
/// </summary>
public const string UploadloadStation = "UploadloadStation";
/// <summary>
/// key:下料工站
/// </summary>
public const string DownloadStation = "DownloadStation";
}
}
......@@ -314,7 +314,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("序号规则未配置")]
SerinumCfgEmpty,
[Description("序号已全部生成")]
SerinumFull
SerinumFull,
[Description("该任务状态已经完成")]
AutoTaskDone
......
......@@ -8,7 +8,7 @@ namespace Siger.Middlelayer.Share.Enum.ModuleEnum
public class Automation
{
/// <summary>
/// 任务触发类型
/// 任务触发方式 1 手动 2 自动
/// </summary>
public enum TaskTrigerType
{
......@@ -61,6 +61,17 @@ namespace Siger.Middlelayer.Share.Enum.ModuleEnum
/// </summary>
Complated = 3
}
/// <summary>
/// 动作类型 1:load 2:Unload
/// </summary>
public enum TaskActionType
{
[Description("Load")]
Load =1,
[Description("Unload")]
Unload =2
}
/// <summary>
/// 动作
/// </summary>
......
......@@ -1464,5 +1464,11 @@ namespace Siger.Middlelayer.Common
[Description("未找到储位类别")]
LocationTypeNotFound,
[Description("未找到工装类别")]
FixtureToolCatgeoryNotFound,
[Description("未找到工装信息")]
FixtureToolNotFound,
}
}
......@@ -150,6 +150,15 @@ namespace Siger.Middlelayer.AccRepository
public DbSet<siger_automation_fixture_tools_category> siger_automation_fixture_tools_category { get; set; }
public DbSet<siger_automation_fixture_tools_assembly> siger_automation_fixture_tools_assembly { get; set; }
public DbSet<siger_automation_fixture_tools> siger_automation_fixture_tools { get; set; }
public DbSet<siger_automation_fixture_tools_product> siger_automation_fixture_tools_product { get; set; }
public DbSet<siger_automation_location> siger_automation_location { get; set; }
public DbSet<siger_automation_section_property> siger_automation_section_property { get; set; }
public DbSet<siger_automation_section_route> siger_automation_section_route { get; set; }
public DbSet<siger_automation_task_list> siger_automation_task_list { get; set; }
public DbSet<siger_wms_storage> siger_wms_storage { get; set; }
public DbSet<siger_wms_storage_location> siger_wms_storage_location { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 工装台账信息
/// </summary>
public class siger_automation_fixture_tools : AccEntityBase
{
public string guid { get; set; }
/// <summary>
/// 工装类别
/// </summary>
public string category { get; set; }
/// <summary>
/// 管理类型
/// </summary>
public int managetype { get; set; }
/// <summary>
/// 工装料号
/// </summary>
public string partnumber { get; set; }
/// <summary>
/// 工装名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string specification { get; set; }
/// <summary>
/// 数量
/// </summary>
public int number { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 附件
/// </summary>
public string attachment { get; set; }
/// <summary>
/// 工装编号
/// </summary>
public string code { get; set; }
public DateTime createtime { get; set; }
public int creator { get; set; }
public int updator { get; set; }
public DateTime? updatetime { get; set; }
public string extend1 { get; set; }
}
}
......@@ -4,20 +4,25 @@ using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 工装装配信息
/// </summary>
public class siger_automation_fixture_tools_assembly : AccEntityBase
{
public string name { get; set; }
public string guid { get; set; }
/// <summary>
/// 父工装GUID
/// </summary>
public string parent { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string son { get; set; }
public int creator { get; set; }
public DateTime createTime { get; set; }
public DateTime createtime { get; set; }
public int updator { get; set; }
public DateTime? updateTime { get; set; }
public DateTime? updatetime { get; set; }
public string extend1 { get; set; }
}
......
......@@ -12,9 +12,9 @@ namespace Siger.Middlelayer.AccRepository.Entities
public string parent { get; set; }
public DateTime createTime { get; set; }
public DateTime createtime { get; set; }
public DateTime? updateTime { get; set; }
public DateTime? updatetime { get; set; }
public string extend1 { get; set; }
}
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 工装对应产品
/// </summary>
public class siger_automation_fixture_tools_product : AccEntityBase
{
public string guid { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string fixturetools { get; set; }
/// <summary>
/// 产品ID
/// </summary>
public int productid { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
public DateTime createtime { get; set; }
public int creator { get; set; }
public int updator { get; set; }
public DateTime? updatetime { get; set; }
public string extend1 { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 储位信息
/// </summary>
public class siger_automation_location : AccEntityBase
{
public string guid { get; set; }
/// <summary>
/// 储位位置
/// </summary>
public int locationid { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string fixturetools { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public int materialid { get; set; }
/// <summary>
/// 工序ID
/// </summary>
public int processid { get; set; }
/// <summary>
/// 物料状态
/// </summary>
public int materialstate { get; set; }
/// <summary>
/// 附件
/// </summary>
public string attachment { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
public int updator { get; set; }
public DateTime? updatetime { get; set; }
public string extend1 { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 工位属性
/// </summary>
public class siger_automation_section_property : AccEntityBase
{
public string guid { get; set; }
/// <summary>
/// 工位ID
/// </summary>
public int sectionid { get; set; }
/// <summary>
/// 1:上下料工位2:加工工位3:检验工位4:装配工位5:存储工位
/// </summary>
public int propertytype { get; set; }
/// <summary>
/// 0:不是上料1:是上料
/// </summary>
public string upload { get; set; }
/// <summary>
/// 0:不是下料1:是下料
/// </summary>
public string down { get; set; }
public DateTime createtime { get; set; }
public DateTime? updatetime { get; set; }
public string extend1 { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 自动线路径
/// </summary>
public class siger_automation_section_route : AccEntityBase
{
public string guid { get; set; }
/// <summary>
/// 产线
/// </summary>
public int sectionid { get; set; }
/// <summary>
/// 开始工位
/// </summary>
public int startsection { get; set; }
/// <summary>
/// 目标工位
/// </summary>
public int endsection { get; set; }
public DateTime createtime { get; set; }
public DateTime? updatetime { get; set; }
public string extend1 { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 工装台账信息
/// </summary>
public class siger_automation_task_list : AccEntityBase
{
public string guid { get; set; }
/// <summary>
/// 工位ID
/// </summary>
public string sectionid { get; set; }
/// <summary>
/// 触发方式
/// </summary>
public TaskTrigerType trigger { get; set; }
/// <summary>
/// 任务类型
/// </summary>
public TaskActionType tasktype { get; set; }
/// <summary>
/// 发起工位
/// </summary>
public int startsection { get; set; }
/// <summary>
/// 工件ID
/// </summary>
public int materialid { get; set; }
/// <summary>
/// 工单号
/// </summary>
public string ordercode { get; set; }
/// <summary>
/// 产品ID
/// </summary>
public int productid { get; set; }
/// <summary>
/// 工序ID
/// </summary>
public int processid { get; set; }
/// <summary>
/// 程序号
/// </summary>
public string programnumber { get; set; }
/// <summary>
/// 储位位置
/// </summary>
public int locationid { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public int fixturetools { get; set; }
/// <summary>
/// 动作类型 1 手动 2 自动
/// </summary>
public TaskTrigerType actiontype { get; set; }
/// <summary>
/// 动作
/// </summary>
public TaskAction action { get; set; }
/// <summary>
/// 是否已下发PLC 0:未下发 1:已下发
/// </summary>
public int send { get; set; }
/// <summary>
/// 触发时间
/// </summary>
public DateTime triggertime { get; set; }
/// <summary>
/// 完成时间
/// </summary>
public DateTime? completetime { get; set; }
/// <summary>
/// 操作人
/// </summary>
public int operater { get; set; }
/// <summary>
/// 操作时间
/// </summary>
public DateTime? operatetime { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
public string extend1 { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" siger_wms_storage.cs" company="xxxx Enterprises">
// * Copyright (C) 2019 xxxx Enterprises All Rights Reserved
// * version : 4.0.30319.42000
// * author : auto generated by T4
// * FileName: siger_wms_storage.cs
// * history : Created by T4 04/01/2019 09:14:26
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// siger_wms_storage Entity Model
/// </summary>
public class siger_wms_storage : AccEntityBase
{
/// <summary>
/// 分类
/// </summary>
public int typeid { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 编号
/// </summary>
public string serial_number { get; set; }
/// <summary>
/// 仓库详细地址
/// </summary>
public string address { get; set; }
/// <summary>
/// 联系人
/// </summary>
public string manager { get; set; }
/// <summary>
///
/// </summary>
public int creator { get; set; }
/// <summary>
///
/// </summary>
public DateTime create_time { get; set; }
/// <summary>
///
/// </summary>
public int updator { get; set; }
/// <summary>
///
/// </summary>
public DateTime update_time { get; set; }
public string description { get; set; }
public string phone { get; set; }
public string mobile { get; set; }
public string option { get; set; }
}
}
//-----------------------------------------------------------------------
// <copyright file=" siger_wms_storage_location.cs" company="xxxx Enterprises">
// * Copyright (C) 2019 xxxx Enterprises All Rights Reserved
// * version : 4.0.30319.42000
// * author : auto generated by T4
// * FileName: siger_wms_storage_location.cs
// * history : Created by T4 04/01/2019 09:14:26
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.ComponentModel.DataAnnotations;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// siger_wms_storage_location Entity Model
/// </summary>
public class siger_wms_storage_location : AccEntityBase
{
/// <summary>
/// 仓库id
/// </summary>
public int storageid { get; set; }
/// <summary>
/// 父类
/// </summary>
public int parentid { get; set; }
/// <summary>
///
/// </summary>
public string name { get; set; }
/// <summary>
/// 区分层级 区域1,货架2,层号3,位置4
/// </summary>
public int level { get; set; }
/// <summary>
/// 分类
/// </summary>
public int typeid { get; set; }
/// <summary>
/// 储位编号-只有level=4才有
/// </summary>
public string serial_number { get; set; }
/// <summary>
///
/// </summary>
public int creator { get; set; }
/// <summary>
///
/// </summary>
public DateTime create_time { get; set; }
/// <summary>
///
/// </summary>
public int updator { get; set; }
/// <summary>
///
/// </summary>
public DateTime update_time { get; set; }
public string option { get; set; }
public string realname { get; set; }
public int locationid { get; set; }
}
}
......@@ -4,7 +4,10 @@ using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories
......@@ -16,5 +19,32 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
_context = context;
}
public IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int categor, int projectid, int page, int pagesize)
{
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 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
from u in uu.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid && string.IsNullOrEmpty(q.parent)
select new ResponseAumationFixtureToolsAssembly
{
id = q.id,
parentid = t1 == null ? 0 : t1.id,
parentname = t1.name ?? "",
sonid = t2.id,
sonname = t2.name ??"",
updator = u.name ?? "",
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
var entities = query.OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Count();
return new PagedCollectionResult<ResponseAumationFixtureToolsAssembly>(entities, totalCount);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
......@@ -16,5 +19,32 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
_context = context;
}
public IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize)
{
Expression<Func<ResponseFixtureToolsCategory, bool>> FunNum = f => true;
var query = from q in _context.siger_automation_fixture_tools_category
join p in _context.siger_automation_fixture_tools_category on q.parent equals p.guid into pp
from p in pp.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseFixtureToolsCategory
{
id = q.id,
name = q.name,
parentid = p == null ? 0 : p.id,
parentname = p.name ?? "",
parent = q.parent,
guid = q.guid,
createtime = q.createtime.ToString(ParameterConstant.DateTimeFormat),
time = q.createtime
};
if (id > 0)
{
FunNum = q => q.id == id;
}
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);
}
}
}
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationFixtureToolsProductRepository : AccRepositoryBase<siger_automation_fixture_tools_product>, IAutomationFixtureToolsProductRepository
{
private ApiAccDbContext _context;
public AutomationFixtureToolsProductRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize)
{
var query = from q in _context.siger_automation_fixture_tools_product
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid
join p in _context.siger_project_product on q.productid equals p.id
join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAumationFixtureToolsProduct
{
id = q.id,
categoryid=c.id,
categoryname=c.name,
fixturetoolid = t.id,
fixturetool = t.name,
productid = q.productid,
productname = p.name,
remark = q.remark,
updator = q.updator,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
Expression<Func<ResponseAumationFixtureToolsProduct, bool>> categoryExpression = f => true;
if (category > 0)
{
categoryExpression = q => q.categoryid == category;
}
Expression<Func<ResponseAumationFixtureToolsProduct, bool>> toolExpression = f => true;
if (tool > 0)
{
toolExpression = q => q.fixturetoolid == tool;
}
Expression<Func<ResponseAumationFixtureToolsProduct, bool>> productExpression = f => true;
if (product > 0)
{
productExpression = q => q.productid == product;
}
var expression = categoryExpression.And(toolExpression).And(productExpression);
var entities = query.Where(expression).OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAumationFixtureToolsProduct>(entities, totalCount);
}
}
}
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationFixtureToolsRepository : AccRepositoryBase<siger_automation_fixture_tools>, IAutomationFixtureToolsRepository
{
private ApiAccDbContext _context;
public AutomationFixtureToolsRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
public IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
int projectid, int page, int pagesize)
{
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
join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseFixtureTools
{
id = q.id,
name = q.name,
guid = q.guid,
categoryid = p.id,
category = p.name,
managetype = q.managetype,
partnumber = q.partnumber,
specification = q.specification,
number = q.number,
remark = q.remark,
attachment = q.attachment,
code = q.code,
updator = u.name ?? "",
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
Expression<Func<ResponseFixtureTools, bool>> categoryExpression = f => true;
if (category > 0)
{
categoryExpression = q => q.categoryid == category;
}
Expression<Func<ResponseFixtureTools, bool>> codeExpression = f => true;
if (!string.IsNullOrEmpty(code))
{
categoryExpression = q => q.code.Contains(code);
}
Expression<Func<ResponseFixtureTools, bool>> nameExpression = f => true;
if (!string.IsNullOrEmpty(name))
{
nameExpression = q => q.name.Contains(name);
}
Expression<Func<ResponseFixtureTools, bool>> stateExpression = f => true;
if (state >= 0)
{
stateExpression = q => q.status == state;
}
var expression = categoryExpression.And(codeExpression).And(nameExpression).And(stateExpression);
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);
}
}
}
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationLocationRepository : AccRepositoryBase<siger_automation_location>, IAutomationLocationRepository
{
private ApiAccDbContext _context;
public AutomationLocationRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
public IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize)
{
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid
join l in _context.siger_wms_storage_location on q.locationid equals l.locationid
join w in _context.siger_wms_storage on l.storageid equals w.id
join m in _context.siger_tr_assist_materials on q.materialid equals m.id
join p in _context.siger_project_process on q.processid equals p.id into pp
from p in pp.DefaultIfEmpty()
join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocation
{
id = q.id,
locationid=l.id,
location=l.name,
wavehouseid=w.id,
wavehouse=w.name,
fixturetoolid=t.id,
fixturetool=t.name,
category=c.name,
code=t.code,
specfication=t.specification,
materialid=q.materialid,
materialcode=m.pn,
processid = q.processid,
processnumber = p == null ? 0 : p.Process_Seq,
processname = p.Process_name??"",
materialstate = q.materialstate,
attachment=q.attachment,
remark=q.remark,
updator = u.name ?? "",
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true;
if (wavehouseid > 0)
{
wavehouseidExpression = q => q.wavehouseid == wavehouseid;
}
Expression<Func<ResponseAutomationLocation, bool>> locationidExpression = f => true;
if (locationid > 0)
{
locationidExpression = q => q.locationid == locationid;
}
var expression = wavehouseidExpression.And(locationidExpression);
var entities = query.Where(expression).OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAutomationLocation>(entities, totalCount);
}
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);
}
}
}
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationSectionPropertyRepository : AccRepositoryBase<siger_automation_section_property>, IAutomationSectionPropertyRepository
{
private ApiAccDbContext _context;
public AutomationSectionPropertyRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
}
}
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationSectionRouteRepository : AccRepositoryBase<siger_automation_section_route>, IAutomationSectionRouteRepository
{
private ApiAccDbContext _context;
public AutomationSectionRouteRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
}
}
using System;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationTaskListRepository : AccRepositoryBase<siger_automation_task_list>, IAutomationTaskListRepository
{
private ApiAccDbContext _context;
public AutomationTaskListRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
......@@ -6,6 +7,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsAssemblyRepository : IAccRepositoryBase<siger_automation_fixture_tools_assembly>
{
IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int categor, int projectid, int page, int pagesize);
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
......@@ -6,5 +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);
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsProductRepository : IAccRepositoryBase<siger_automation_fixture_tools_product>
{
IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize);
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
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);
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationLocationRepository : IAccRepositoryBase<siger_automation_location>
{
IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize);
siger_wms_storage_location GetLocation(int id, int projectid);
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationSectionPropertyRepository : IAccRepositoryBase<siger_automation_section_property>
{
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationSectionRouteRepository : IAccRepositoryBase<siger_automation_section_route>
{
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationTaskListRepository : IAccRepositoryBase<siger_automation_task_list>
{
}
}
......@@ -10,7 +10,7 @@ namespace Siger.Middlelayer.AccRepository.Request
/// 设备ID
/// </summary>
public int machine { get; set; }
public int machineid { get; set; }
/// <summary>
/// 是否可用
/// </summary>
......
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Siger.Middlelayer.Common.ModuleEnum;
using Siger.Middlelayer.Repository.Request;
namespace Siger.Middlelayer.AccRepository.Request
{
public class RequestAddFixtureToolsCategory
{
public string parentid { get; set; }
public string name { get; set; }
}
public class RequestUpdateFixtureToolsCategory : RequestAddFixtureToolsCategory
{
public int id { get; set; }
}
public class RequestDeleteRange
{
public List<int> ids { get; set; } = new List<int>();
}
public class RequestAddFixtureTools
{
/// <summary>
/// 工装类别
/// </summary>
public string categoryid { get; set; }
/// <summary>
/// 管理类型
/// </summary>
public string managetype { get; set; }
/// <summary>
/// 工装料号
/// </summary>
public string partnumber { get; set; }
/// <summary>
/// 工装名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string specifition { get; set; }
/// <summary>
/// 数量
/// </summary>
public string number { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 附件
/// </summary>
public string attachment { get; set; }
/// <summary>
/// 工装编号
/// </summary>
public string code { get; set; }
}
public class RequestUpdateFixtureTools : RequestAddFixtureTools
{
public int id { get; set; }
}
public class RequestAddFixtureToolsProduct
{
/// <summary>
/// 工装ID
/// </summary>
public string fixturetoolid { get; set; }
/// <summary>
/// 产品ID
/// </summary>
public string productid { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
}
public class RequestUpdateFixtureToolsProduct : RequestAddFixtureToolsProduct
{
public int id { get; set; }
}
public class RequestAddAutomationLocation
{
/// <summary>
/// 储位位置
/// </summary>
public string locationid { get; set; }
/// <summary>
/// 工装ID
/// </summary>
public string fixturetoolid { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public string materialid { get; set; }
/// <summary>
/// 工序ID
/// </summary>
public string processid { get; set; }
/// <summary>
/// 附件
/// </summary>
public string attachment { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
}
public class RequestUpdateAutomationLocation : RequestAddAutomationLocation
{
public int id { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseFixtureToolsCategory
{
public int id { get; set; }
public string name { get; set; }
public int parentid { get; set; }
public string parentname { get; set; }
public string guid { get; set; }
public string parent { get; set; }
public DateTime time { get; set; }
public string createtime { get; set; }
public string updatetime { get; set; }
public string extend1 { get; set; }
}
public class ResponseFixtureTools
{
public int id { get; set; }
public string guid { get; set; }
/// <summary>
/// 工装类别ID
/// </summary>
public int categoryid { get; set; }
/// <summary>
/// 工装类别名称
/// </summary>
public string category { get; set; }
/// <summary>
/// 管理类型
/// </summary>
public int managetype { get; set; }
/// <summary>
/// 工装料号
/// </summary>
public string partnumber { get; set; }
/// <summary>
/// 工装名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 规格型号
/// </summary>
public string specification { get; set; }
/// <summary>
/// 数量
/// </summary>
public int number { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 附件
/// </summary>
public string attachment { get; set; }
/// <summary>
/// 工装编号
/// </summary>
public string code { get; set; }
public string updator { get; set; }
public int status { get; set; }
public string updatetime { get; set; }
}
public class ResponseAumationFixtureToolsProduct
{
public int id { get; set; }
public int categoryid { get; set; }
public string categoryname { get; set; }
/// <summary>
/// 工装ID
/// </summary>
public int fixturetoolid { get; set; }
public string fixturetool { get; set; }
/// <summary>
/// 产品ID
/// </summary>
public int productid { get; set; }
public string productname { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
public int updator { get; set; }
public string updatetime { get; set; }
}
public class ResponseAumationFixtureToolsAssembly
{
public int id { get; set; }
public int parentid { get; set; }
public string parentname { get; set; }
public int sonid { get; set; }
public string sonname { get; set; }
public string partnumber { get; set; }
public string name { get; set; }
public string specfication { get; set; }
public string code { get; set; }
public string updator { get; set; }
public string updatetime { get; set; }
public int status { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseAutomationLocation
{
public int id { get; set; }
/// <summary>
/// 储位位置
/// </summary>
public int locationid { get; set; }
public string location { get; set; }
public int wavehouseid { get; set; }
public string wavehouse { get; set; }
/// <summary>
/// 工装ID
/// </summary>
public int fixturetoolid { get; set; }
public string fixturetool { get; set; }
public string category { get; set; }
public string code { get; set; }
public string specfication { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public int materialid { get; set; }
public string materialcode { get; set; }
/// <summary>
/// 工序ID
/// </summary>
public int processid { get; set; }
public int processnumber { get; set; }
public string processname { get; set; }
/// <summary>
/// 物料状态
/// </summary>
public int materialstate { get; set; }
/// <summary>
/// 附件
/// </summary>
public string attachment { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
public string updator { get; set; }
public string updatetime { get; set; }
public int status { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class FixtureToolsCategoryTree
{
public int value { get; set; }
public string label { get; set; }
public List<FixtureToolsCategoryTree> children = new List<FixtureToolsCategoryTree>();
}
}
......@@ -177,15 +177,15 @@ SET FOREIGN_KEY_CHECKS = 0;
-- 工装类型维护
-- Table structure for siger_automation_fixture_tools_category
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools_category` (
CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`parent` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'siger_automation_fixture_tools_category.guid',
`projectid` int(11) NOT NULL,
`status` int(11) NOT NULL,
`createTime` datetime(0) NOT NULL,
`updateTime` datetime(0) NULL DEFAULT NULL,
`createtime` datetime(0) NOT NULL,
`updatetime` datetime(0) NULL DEFAULT NULL,
`extend1` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
......@@ -194,14 +194,14 @@ CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools_category` (
-- 工装台账信息
-- Table structure for siger_automation_fixture_tools
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools` (
CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`category` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装类别siger_automation_fixture_tools_category.guid',
`managetype` int(11) NOT NULL DEFAULT 0 COMMENT '管理类型',
`partnumber` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装料号',
`name` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装名称',
`specifition` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格型号',
`specification` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格型号',
`number` int(11) NOT NULL DEFAULT 0 COMMENT '数量',
`remark` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`attachment` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
......@@ -219,17 +219,17 @@ CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools` (
-- 工装装配信息
-- Table structure for siger_automation_fixture_tools_assembly
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools_assembly` (
CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_assembly` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`parent` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '父类工装GUID',
`son` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '子类工装GUID',
`son` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`projectid` int(11) NOT NULL DEFAULT 0,
`status` int(11) NOT NULL DEFAULT 1,
`creator` int(11) NOT NULL DEFAULT 0,
`createtime` datetime(0) NOT NULL,
`updator` int(11) NOT NULL DEFAULT 0,
`updateTime` datetime(0) NULL DEFAULT NULL,
`updatetime` datetime(0) NULL DEFAULT NULL,
`extend1` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
......@@ -238,7 +238,7 @@ CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools_assembly` (
-- 工装类型应产品
-- Table structure for siger_automation_fixture_tools_product
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools_product` (
CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'siger_automation_fixture_tools.guid',
......@@ -255,10 +255,10 @@ CREATE TABLE IF NOT EXSIT `siger_automation_fixture_tools_product` (
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- 托盘台账列表
-- Table structure for siger_automation_tray
-- 储位工装信息
-- Table structure for siger_automation_location
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_tray` (
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',
......@@ -275,12 +275,12 @@ CREATE TABLE IF NOT EXSIT `siger_automation_tray` (
-- ----------------------------
-- 工位属性
-- Table structure for siger_automation_machine_property
-- Table structure for siger_automation_section_property
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_machine_property` (
CREATE TABLE IF NOT EXISTS `siger_automation_section_property` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`machineid` int(11) NOT NULL DEFAULT 0 COMMENT '设备ID',
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`propertytype` int(11) NOT NULL DEFAULT 0 COMMENT '1:上下料工位2:加工工位3:检验工位4:装配工位5:存储工位',
`upload` int(11) NOT NULL DEFAULT 0 COMMENT '0:不是上料1:是上料',
`down` int(11) NOT NULL DEFAULT 0 COMMENT '0:不是下料1:是下料',
......@@ -296,12 +296,12 @@ CREATE TABLE IF NOT EXSIT `siger_automation_machine_property` (
-- 自动线路径
-- Table structure for siger_automation_section_route
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_section_route` (
CREATE TABLE IF NOT EXISTS `siger_automation_section_route` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '产线',
`startmachine` int(11) NOT NULL DEFAULT 0 COMMENT '开始设备ID',
`endmachine` int(11) NOT NULL DEFAULT 0 COMMENT '目标设备ID',
`startsection` int(11) NOT NULL DEFAULT 0 COMMENT '开始工位',
`endsection` int(11) NOT NULL DEFAULT 0 COMMENT '目标工位',
`projectid` int(11) NOT NULL DEFAULT 0,
`status` int(11) NOT NULL DEFAULT 1,
`createtime` datetime(0) NOT NULL,
......@@ -314,13 +314,13 @@ CREATE TABLE IF NOT EXSIT `siger_automation_section_route` (
-- 任务清单管理
-- Table structure for siger_automation_task_list
-- ----------------------------
CREATE TABLE IF NOT EXSIT `siger_automation_task_list` (
CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`machineid` int(11) NOT NULL DEFAULT 0 COMMENT '设备ID',
`trigger` int(11) NOT NULL DEFAULT 0 COMMENT '触发方',
`tasktype` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '任务类型',
`startmachine` int(11) NOT NULL DEFAULT 0 COMMENT '发起地',
`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 '任务类型',
`startsection` int(11) NOT NULL DEFAULT 0 COMMENT '发起工位',
`materialid` 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',
......@@ -328,14 +328,15 @@ CREATE TABLE IF NOT EXSIT `siger_automation_task_list` (
`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` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '动作',
`action` int(1) int(11) NOT NULL DEFAULT 0 COMMENT '动作',
`actiontype` int(11) NOT NULL DEFAULT 0 COMMENT '动作类型',
`projectid` int(11) NOT NULL DEFAULT 0,
`status` int(11) NOT NULL DEFAULT 1 COMMENT '状态',
`send` int(1) NOT NULL DEFAULT 0 COMMENT '0:未下发 1:已下发',
`status` int(11) NOT NULL DEFAULT 1 COMMENT '任务进度状态:0 取消 1待生产 2生产中 3生产完成',
`triggertime` datetime(0) NOT NULL COMMENT '触发时间',
`completetime` datetime(0) NULL DEFAULT NULL COMMENT '完成时间',
`oprator` int(11) NOT NULL DEFAULT 0 COMMENT '操作人',
`opratetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`operater` int(11) NOT NULL DEFAULT 0 COMMENT '操作人',
`operatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`extend1` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment