Commit 17f44366 by yucheng.jiang
parents 0912a2a0 7864f19f
......@@ -716,10 +716,11 @@ export default {
'9000491': '人员未找到',
'9000492': '默认展示已存在',
'9000493': '未找到储位类别',
'9000494': '未找到工装类',
'9000494': '未找到工装类',
'9000495': '未找到工装信息',
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9000498': '该类型绑定了工装,不能删除',
'9100000': 'Departments cannot be empty',
'9100001': 'Position cannot be empty',
......@@ -6650,6 +6651,10 @@ export default {
'300159': '设备正在使用中',
'300160': '任务进行中',
'300161': '产品工装未找到',
'300162': '未找到工装信息'
'300162': '未找到工装信息',
'300163': '设备正在空闲中',
'300164': '设备已经生产完成',
'300165': '该设备当前无工装状态',
'300166': '未配置字典信息',
}
......@@ -743,10 +743,11 @@ export default {
'9000491': '人员未找到',
'9000492': '默认展示已存在',
'9000493': '未找到储位类别',
'9000494': '未找到工装类',
'9000494': '未找到工装类',
'9000495': '未找到工装信息',
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9000498': '该类型绑定了工装,不能删除',
'9100000': '部门不能为空',
......@@ -6922,7 +6923,12 @@ export default {
'300159': '设备正在使用中',
'300160': '任务进行中',
'300161': '产品工装未找到',
'300162': '未找到工装信息'
'300162': '未找到工装信息',
'300163': '设备正在空闲中',
'300164': '设备已经生产完成',
'300165': '该设备当前无工装状态',
'300166': '未配置字典信息',
......
<template>
<div>
产线监控管理
</div>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -29,7 +29,15 @@
:class="{ active: b == index }"
>
<p>{{ item.title }}</p>
<p>{{ item.status == 1 ? "待上料" : "运行中" }}</p>
<p>
{{
item.status == 1
? "待上料"
: orderDetail.status == 2
? "运行中"
: "待下料"
}}
</p>
</div>
</div>
</div>
......@@ -79,7 +87,13 @@
<p class="flex">
<span class="infoLabel">状态:</span>
<span class="info">{{
orderDetail.status
orderDetail.status == 1
? "待上料"
: orderDetail.status == 2
? "运行中"
: orderDetail.status == 3
? "待下料"
: ""
}}</span>
</p>
<p class="flex">
......@@ -103,7 +117,9 @@
<Button type="primary" @click="feedReady()"
>准备上料</Button
>
<Button type="primary">安装完成</Button>
<Button type="primary" @click="installOver()"
>安装完成</Button
>
</div>
</TabPane>
<TabPane label="下料" :disabled="attr2" name="2"
......@@ -162,7 +178,9 @@
? "待上料"
: orderDetail.status == 2
? "运行中"
: "待下料"
: orderDetail.status == 3
? "待下料"
: ""
}}</span>
</p>
<p class="flex">
......@@ -352,16 +370,17 @@ export default {
this.b = index;
let status = this.stationList[index].status;
this.sectionid = this.stationList[index].section;
if (status == 3) {
this.attr1 = true;
this.tabindex = "2";
// if (status == 3) {
// this.attr1 = true;
// this.tabindex = "2";
this.getRunningDetail(index);
} else {
this.attr2 = true;
}
if (status == 2) {
this.getRunningDetail(index);
}
// }
// else {
// this.attr2 = true;
// }
// if (status == 2) {
// this.getRunningDetail(index);
// }
},
//获取储位
getStorages() {
......@@ -455,13 +474,13 @@ export default {
return false;
}
let data = {
section: 13,
section: this.sectionid,
};
this.request(
"/acc/AutomationOperate/CompalateAssemble",
data,
"post"
).thne((res) => {
).then((res) => {
if (res.data.ret == 1) {
this.$Message.success(this.$t(res.data.msg));
} else {
......
......@@ -150,7 +150,7 @@ export default {
data(){
return {
//导入方法
action: this.axios.publicPath + "wms/Upload/Submit?templateName=StorageLocation",
action: this.axios.publicPath + "acc/Upload/UploadExcel?templateName=FixtureToolsProductTemplate",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
......@@ -595,18 +595,18 @@ export default {
},
//导出模板
loadexcel() {
// this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation",
// method: "get",
// })
// .then((res) => {
// if (res.data.ret === 1) {
// window.location.href =
// this.axios.publicPath + "" + res.data.data;
// } else {
// this.$Message.error(this.$t(res.data.msg));
// }
// });
this.axios.request({
url: "/config/Download/GetTemplate?name=FixtureToolsProductTemplate",
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href =
this.axios.publicPath + "" + res.data.data;
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
handleRowChange(currentRow, oldCurrentRow) {
this.detailobj = currentRow;
......
......@@ -154,7 +154,7 @@ export default {
data(){
return {
//导入方法
action: this.axios.publicPath + "wms/Upload/Submit?templateName=StorageLocation",
action: this.axios.publicPath + "acc/Upload/UploadExcel?templateName=FixtureToolsTemplate",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
......@@ -546,18 +546,18 @@ export default {
},
//导出模板
loadexcel() {
// this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation",
// method: "get",
// })
// .then((res) => {
// if (res.data.ret === 1) {
// window.location.href =
// this.axios.publicPath + "" + res.data.data;
// } else {
// this.$Message.error(this.$t(res.data.msg));
// }
// });
this.axios.request({
url: "/config/Download/GetTemplate?name=FixtureToolsTemplate",
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href =
this.axios.publicPath + "" + res.data.data;
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
handleRowChange(currentRow, oldCurrentRow) {
this.detailobj = currentRow;
......
......@@ -86,7 +86,7 @@ export default {
data(){
return{
//导入方法
action: this.axios.publicPath + "wms/Upload/Submit?templateName=StorageLocation",
action: this.axios.publicPath + "acc/Upload/UploadExcel?templateName=FixtureToolsCategoryTemplate",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
......@@ -313,18 +313,18 @@ export default {
},
//导出模板
loadexcel() {
// this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation",
// method: "get",
// })
// .then((res) => {
// if (res.data.ret === 1) {
// window.location.href =
// this.axios.publicPath + "" + res.data.data;
// } else {
// this.$Message.error(this.$t(res.data.msg));
// }
// });
this.axios.request({
url: "/config/Download/GetTemplate?name=FixtureToolsCategoryTemplate",
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href =
this.axios.publicPath + "" + res.data.data;
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
handleRowChange(currentRow, oldCurrentRow) {
this.detailobj = currentRow;
......
......@@ -123,6 +123,10 @@
<Input class="searchInput" type="text" id="input1" v-model="editobj.checktype_value" disabled="disabled" />
</div>
<div class="filter">
<label >{{$t('950232')}}:</label>
<Input class="searchInput" type="text" id="input1" v-model="editobj.routename" disabled="disabled" />
</div>
<div class="filter">
<label >{{$t('800008')}}:</label>
<Input class="searchInput" type="text" id="input1" v-model="editobj.sn" disabled="disabled" />
</div>
......@@ -330,10 +334,6 @@ export default{
title: this.$t('100089'),
key: 'productcode'
},
// {
// title: this.$t('500006'),
// key: 'routename'
// },
{
title: this.$t('100088'),
key: 'productname'
......@@ -347,6 +347,10 @@ export default{
key: 'workorder'
},
{
title: this.$t('950232'),
key: 'routename'
},
{
title: this.$t('800008'),
key: 'sn'
},
......
......@@ -100,7 +100,6 @@
:class="table_scrollx ? 'collection_table' : ''"
style="
width: 100%;
float: left;
height: 100%;
padding-left: 5px;
"
......@@ -353,7 +352,6 @@
<div
style="
width: 870px;
float: left;
height: 100%;
padding-left: 5px;
overflow-y: scroll;
......@@ -680,6 +678,7 @@ export default {
this.stationList = res.data.data;
this.station = this.stationList[0];
this.initproduct(this.station.id);
this.initSn(this.station.id);
});
}
},
......@@ -721,7 +720,7 @@ export default {
axios
.request({
url:
"/acc/SectionProperty/GetSn?productId=" + productid + "&sectionId=" + sectionid,
"/acc/SectionProperty/GetSn?sectionId=" + sectionid,
method: "get",
})
.then((res) => {
......@@ -1252,7 +1251,7 @@ export default {
this.loading3 = true;
axios
.request({
url: "/qms/ManualCollection/Add",
url: "/acc/QmsCheck/AddManual",
data,
method: "post",
})
......
......@@ -176,7 +176,7 @@ export default {
},
{
title:'储位ID',
key:'locationid'
key:'locaid'
},
{
title:'工装类别',
......@@ -275,7 +275,7 @@ export default {
addremark:'',//备注
filename:'',
fileurl:'',
action: this.axios.publicPath + "wms/Upload/Submit?templateName=StorageLocation",
action: this.axios.publicPath + "acc/Upload/UploadExcel?templateName=AutomationLocationTemplate",
UploadAction: this.axios.publicPath + "config/upload/UploadImage",
headers: {
token: localStorage.getItem("token"),
......@@ -665,18 +665,18 @@ export default {
},
//导出模板
loadexcel() {
// this.axios.request({
// url: "/config/Download/GetTemplate?name=StorageLocation",
// method: "get",
// })
// .then((res) => {
// if (res.data.ret === 1) {
// window.location.href =
// this.axios.publicPath + "" + res.data.data;
// } else {
// this.$Message.error(this.$t(res.data.msg));
// }
// });
this.axios.request({
url: "/config/Download/GetTemplate?name=AutomationLocationTemplate",
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href =
this.axios.publicPath + "" + res.data.data;
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
/*********文件上传 start******** */
//下载文件
......
......@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Extensions;
using System.Linq;
using Siger.Middlelayer.Repository.Entities;
using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Utility.ImportEntities;
using Siger.Middlelayer.Utility.Helpers;
using System.IO;
using Siger.Middlelayer.Log;
namespace Siger.ApiACC.Controllers
{
......@@ -25,10 +30,11 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor;
private readonly IProductRouteRepository _routeRepository;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository,
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository)
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct)
{
_unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository;
......@@ -36,12 +42,13 @@ namespace Siger.ApiACC.Controllers
_autoLocationRepository = autoLocationRepository;
_fixtureMonitor = fixtureMonitor;
_routeRepository = routeRepository;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
}
[HttpGet]
public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize)
public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize, string toexcel)
{
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize);
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize, toexcel);
var list = new List<ResponseAutomationLocation>();
var locations = _autoLocationRepository.GetLocationList(ProjectId);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
......@@ -64,7 +71,7 @@ namespace Siger.ApiACC.Controllers
item.materialstate = 4;//无工装有工件
}
var loca = locations.FirstOrDefault(q => q.locationid == item.locaid);
var loca = locations.FirstOrDefault(q => q.id == item.locationid);
if(loca != null)
{
var locas = GetParentLocations(loca.id, locations);
......@@ -81,7 +88,84 @@ namespace Siger.ApiACC.Controllers
list.Add(item);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
if (toexcel.ToInt() == 1)
{
return ExportExcel(list);
}
else
{
return new PagedObjectResult(list, data.Total, page, pagesize);
}
}
private IActionResult ExportExcel(IEnumerable<ResponseAutomationLocation> data)
{
var rootDir = FileSystemHelper.GetPhysicalFolders(FileSystemHelper.CommonFileSetting.PhysicalFolder, FileSystemHelper.ExportFileName);
if (!data.Any())
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var dataList = new List<AutomationLocationList>();
foreach (var item in data)
{
var state = "";
switch (item.materialstate)
{
case 1:
state = "有工装无工件";
break;
case 2:
state = "有工装有工件";
break;
case 3:
state = "无工装无工件";
break;
case 4:
state = "无工装有工件";
break;
}
dataList.Add(new AutomationLocationList
{
Warehouse = item.wavehouse,
Location = item.location,
LocationId = item.locaid.ToString(),
Catgeory = item.category,
Code = item.code,
Name = item.fixturetool,
Specfication = item.specfication,
SN = item.sn,
RouteNumber = item.routenumber,
RouteName = item.route,
State = state,
Remark = item.remark,
Updator = item.updator,
UpdateTime = item.updatetime
});
}
if (dataList.Any())
{
EpPlusExcelHelper<AutomationLocationList> helper = null;
try
{
helper = new EpPlusExcelHelper<AutomationLocationList>();
var temporaryFileName = $"储位信息查询_FixtureToolsLocationData_{DateTime.Now:yyyyMMddHHmmss}.xlsx";
helper.GenerateExcel(dataList, Path.Combine(rootDir, temporaryFileName));
return new ObjectResult($"{FileSystemHelper.CommonFileSetting.RequestPath}/{FileSystemHelper.ExportFileName}/{temporaryFileName}");
}
catch (Exception e)
{
Logger.WriteLineError("Export Fixture Tools Location Data failed, error:" + e);
throw new BadRequestException(RequestEnum.ExportFailed);
}
finally
{
helper?.Dispose();
}
}
throw new BadRequestException(CommonEnum.Fail);
}
private IEnumerable<siger_automation_fixture_tools_category> GetParentCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
......@@ -110,13 +194,15 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
throw new BadRequestException(RequestEnum.LocationNull);
}
var exsit = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
(q.fixturetools == req.fixturetoolid || q.locationid == req.locationid.ToInt()));
(q.fixturetools == fixturetool.guid || q.location_cid == req.locationid.ToInt()));
if(exsit != null)
{
throw new BadRequestException(RequestEnum.DataExist);
......@@ -126,7 +212,10 @@ namespace Siger.ApiACC.Controllers
{
guid = Guid.NewGuid().ToString(),
locationid = location.locationid,
location_cid = location.id,
fixturetools = fixturetool.guid,
productid= fixturetoolProduct != null ? fixturetoolProduct.productid : 0,
productcode = fixturetoolProduct!=null? fixturetoolProduct.productcode:"",
attachment = req.fileurl,
filename = req.filename,
remark = req.remark,
......@@ -162,25 +251,30 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var fixturetoolProduct = _automationFixtureToolsProduct.Get(f => f.fixturetools == fixturetool.guid);
var location = _autoLocationRepository.GetLocation(req.locationid.ToInt(), ProjectId);
if (location == null)
{
throw new BadRequestException(RequestEnum.LocationNull);
}
var exsit = _autoLocationRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
(q.fixturetools == req.fixturetoolid || q.locationid == req.locationid.ToInt()) && q.id != req.id);
(q.fixturetools == fixturetool.guid || q.location_cid == req.locationid.ToInt()) && q.id != req.id);
if (exsit != null)
{
throw new BadRequestException(RequestEnum.DataExist);
}
entity.locationid = location.locationid;
entity.location_cid = location.id;
entity.fixturetools = fixturetool.guid;
entity.attachment = req.fileurl;
entity.filename = req.filename;
entity.remark = req.remark;
entity.updatetime = DateTime.Now;
entity.updator = UserId;
entity.productid = fixturetoolProduct != null ? fixturetoolProduct.productid : 0;
entity.productcode = fixturetoolProduct != null ? fixturetoolProduct.productcode : "";
_autoLocationRepository.Update(entity);
if (_unitOfWork.Commit() > 0)
{
......
......@@ -35,9 +35,10 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
private readonly IAutomationFixtureToolsRepository _automationFixtureTools;
private readonly IAutomationLocationRepository _automationLocation;
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList,
IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools)
IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools, IAutomationLocationRepository automationLocation)
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
......@@ -50,6 +51,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
_automationFixtureTools = automationFixtureTools;
_automationLocation = automationLocation;
}
/// <summary>
......@@ -101,7 +103,7 @@ namespace Siger.ApiACC.Controllers
var machintAttr = _sigerProjectMachineAttribution.Get(f => f.station == section.id);
if(machintAttr==null)
{
Logger.WriteLineInfo($"GetloadStation 未配置清洗工站字典");
Logger.WriteLineInfo($"GetloadStation 未配置工站字典");
continue;
}
var loadStatus = (int)Automation.MachineStatus.Waiting;
......@@ -116,8 +118,10 @@ namespace Siger.ApiACC.Controllers
section=section.id,
updatetime=DateTime.Now
});
}else
{
loadStatus = machineStatus.status;
}
data.Add(new ResponseLoadStation {
......@@ -126,6 +130,8 @@ namespace Siger.ApiACC.Controllers
status=loadStatus
});
}
_unitOfWork.Commit();
return new ObjectResult(data);
}
......@@ -143,14 +149,14 @@ namespace Siger.ApiACC.Controllers
var monitor = _automationFixtureMonitor.Get(f => f.section == section);
var result = new ResponsePlanlFixtureInfo
{
OrderNumber = monitor.ordernumber,
FixtureGuid=monitor.fixtureguid,
FixtureName=monitor.fixturename,
ProductCode=monitor.productCode,
ProductName=monitor.productName,
Sn=monitor.sn,
status=monitor.status,
Location=monitor.locationId,
OrderNumber = monitor!=null? monitor.ordernumber:"",
FixtureGuid = monitor != null ? monitor.fixtureguid:"",
FixtureName = monitor != null ? monitor.fixturename:"",
ProductCode = monitor != null ? monitor.productCode:"",
ProductName = monitor != null ? monitor.productName:"",
Sn = monitor != null ? monitor.sn:"",
status = monitor != null ? monitor.status:(int)Automation.MachineStatus.Waiting,
Location = monitor != null ? monitor.locationId:0,
};
return new ObjectResult(result);
}
......@@ -173,7 +179,7 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(result);
}
/// <summary>
/// 准备上料 -生成指令 load
/// 准备上料 -生成指令 load (立库->上料位)
/// </summary>
/// <param name="loading"></param>
/// <returns></returns>
......@@ -198,7 +204,7 @@ namespace Siger.ApiACC.Controllers
section = loading.section,
machineid = machineAttr.machine,
projectId = ProjectId,
status = (int)Automation.MachineStatus.Produce,
status = (int)Automation.MachineStatus.Waiting,
updatetime = DateTime.Now
});
}
......@@ -261,7 +267,7 @@ namespace Siger.ApiACC.Controllers
productcode=plan.product_code,
processid=0,
programnumber="",
remark ="手动任务",
remark ="手动任务-准备上料",
});
......@@ -279,6 +285,7 @@ namespace Siger.ApiACC.Controllers
createtime=DateTime.Now,
updatetime=DateTime.Now,
status=(int)Automation.MachineStatus.Produce,
productId=plan.product_id,
productCode=plan.product_code,
productName=plan.product_name,
ordernumber=plandts.OrderNumber,
......@@ -291,6 +298,7 @@ namespace Siger.ApiACC.Controllers
monitor.section = loading.section;
monitor.updatetime = DateTime.Now;
monitor.status = (int)Automation.MachineStatus.Produce;
monitor.productId = plan.product_id;
monitor.productName = plan.product_name;
monitor.productCode = plan.product_code;
monitor.ordernumber = plandts.OrderNumber;
......@@ -301,9 +309,14 @@ namespace Siger.ApiACC.Controllers
if (_unitOfWork.Commit() > 0)
{
Logger.WriteLineError($"手动任务创建成功-{Siger.Middlelayer.Common.Helpers.EnumHelper.GetEnumDesc(Automation.TaskAction.Step_LK_SXLW)}");
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
/// <summary>
......@@ -323,24 +336,66 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.MachineDisable);
}
if (machineStatus.status == (int)Automation.MachineStatus.Waiting)
{
throw new BadRequestException(AccEnum.MachineOnFree);
}
if (machineStatus.status == (int)Automation.MachineStatus.Complated)
{
throw new BadRequestException(AccEnum.MachineProCompalate);
}
//if (machineStatus.status == (int)Automation.MachineStatus.Waiting)
//{
// throw new BadRequestException(AccEnum.MachineOnFree);
//}
//if (machineStatus.status == (int)Automation.MachineStatus.Complated)
//{
// throw new BadRequestException(AccEnum.MachineProCompalate);
//}
if (!_automationTaskList.CanTask(ProjectId, assemble.section))
{
throw new BadRequestException(AccEnum.TaskProcessing);
}
//创建 安装完成动作
var monitor = _automationFixtureMonitor.Get(f => f.projectId == ProjectId && f.section == assemble.section);
if (monitor==null)
{
throw new BadRequestException(AccEnum.MonitorNotfound);
}
//移出 上料位
monitor.status = (int)Automation.MachineStatus.Waiting;
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list
{
no = taskNo,
action = Automation.TaskAction.Step_SXLW_LK,
actiontype = Automation.ExcueType.None,
triggertime = DateTime.MinValue,
tasktype = Automation.TaskActionType.Load,
operater = UserId,
operatetime = DateTime.Now,
sectionid = assemble.section,
send = 0,
status = 1,
completetime = DateTime.MinValue,
trigger = Automation.TaskTrigerType.Manual,
projectId = ProjectId,
productid = monitor.productId,
sn = monitor.sn,
ordercode = monitor.ordernumber,
fixtureguid = monitor.fixtureguid,
locationid = monitor.locationId,
productcode = monitor.productCode,
processid = 0,
programnumber = "",
remark = "手动任务-安装完成",
});
return new ObjectResult(1);
if (_unitOfWork.Commit() > 0)
{
Logger.WriteLineError($"手动任务创建成功-{Siger.Middlelayer.Common.Helpers.EnumHelper.GetEnumDesc(Automation.TaskAction.Step_SXLW_LK)}");
return new ObjectResult(CommonEnum.Succefull);
}
else
{
throw new BadRequestException(CommonEnum.Fail);
}
}
/// <summary>
/// 准备下料
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.ApiCommon.Filters;
using Siger.Middlelayer.AccRepository.Response;
using Siger.ApiCommon.Result;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Share.Enum.ModuleEnum;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace Siger.ApiACC.Controllers
{
public class AutomationStateController : BaseController
{
private readonly ISigerProjectLevelSectionRepository _sigerProjectLevelSection;
private readonly IAutomationMachineStatus _automationMachineStatus;
private readonly IAutomationTaskListRepository _automationTaskList;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
public AutomationStateController(ISigerProjectLevelSectionRepository sigerProjectLevelSection, IAutomationMachineStatus automationMachineStatus, IAutomationTaskListRepository automationTaskList, IAutomationFixtureMonitor automationFixtureMonitor)
{
_sigerProjectLevelSection = sigerProjectLevelSection;
_automationMachineStatus = automationMachineStatus;
_automationTaskList = automationTaskList;
_automationFixtureMonitor = automationFixtureMonitor;
}
/// <summary>
/// 产线监控管理
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
[HttpGet]
public IActionResult GetStationMonitor(int section)
{
var ids = new List<int>();
if (section != 0)
{
ids = _sigerProjectLevelSection.GetLevelSectionIds(section,ProjectId).ToList();
}
var data = _automationMachineStatus.GetSectionStatus(ProjectId, section,ids);
var result = new List<ResponseAutomationMachineStatus>();
foreach(var d in data)
{
var item = new ResponseAutomationMachineStatus
{
sectionid=d.sectionid,
section=d.section,
enable=d.enable,
product="",
location=0,
sn="",
fixtureCode="",
fixtureName="",
lastupdate="",
status=(int)Automation.MachineStatus.Waiting,
};
var fixture = _automationFixtureMonitor.Get(f => f.section == d.sectionid);
if (fixture!=null)
{
item.product = fixture.productName;
item.location = fixture.locationId;
item.sn = fixture.sn;
item.fixtureCode = fixture.fixtureguid;
item.fixtureName = fixture.fixturename;
item.status = fixture.status;
}
result.Add(item);
}
var output = new ResponseMachineMonitor
{
sum=new ResponseAutomationMachineStatusTotal {
waittingTotal =result.Where(f=>f.status==(int)Automation.MachineStatus.Waiting).Count(),
produceTotal= result.Where(f => f.status == (int)Automation.MachineStatus.Produce).Count(),
complateTotal= result.Where(f => f.status == (int)Automation.MachineStatus.Complated).Count(),
disableTotal= result.Where(f => f.enable ==0).Count(),
},
dts=result
};
return new ObjectResult(output);
}
[HttpGet]
public IActionResult GetTasklist(int section, int tasktype, string productCode, string taskno, string sn, int status, int actionType, string triggertime, string complatetime,int page,int pageSize)
{
var ids = new List<int>();
if (section != 0)
{
ids = _sigerProjectLevelSection.GetLevelSectionIds(section, ProjectId).ToList();
}
var resulst = _automationTaskList.GetTasklistPagedList(ids, tasktype, productCode, taskno, sn, status, actionType, triggertime, complatetime,ProjectId,page,pageSize);
return new PagedObjectResult(resulst, resulst.Total, page, pageSize);
}
}
}
......@@ -40,9 +40,17 @@ namespace Siger.ApiACC.Controllers
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize, string toexcel)
{
var data = _toolsRepository.GetPagedList(category.ToInt(), code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize, toexcel);
var list = new List<ResponseFixtureTools>();
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var categoryIds = new List<int>();
if(category.ToInt() > 0)
{
var cate = categorys.FirstOrDefault(q => q.id == category.ToInt());
var sonCates = GetSonCategoryList(cate.guid, categorys);
categoryIds = sonCates.Select(q => q.id).ToList();
categoryIds.Add(category.ToInt());
}
var data = _toolsRepository.GetPagedList(categoryIds, code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize, toexcel);
var list = new List<ResponseFixtureTools>();
foreach(var item in data.Data)
{
var cates = GetParentCategoryList(item.cate_guid, categorys);
......@@ -53,7 +61,7 @@ namespace Siger.ApiACC.Controllers
}
if (toexcel.ToInt() == 1)
{
return ExportExcel(data.Data);
return ExportExcel(list);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
}
......@@ -66,11 +74,11 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var dataList = new List<FixtureToolsTemplate>();
var dataList = new List<FixtureToolsList>();
foreach (var item in data)
{
dataList.Add(new FixtureToolsTemplate
dataList.Add(new FixtureToolsList
{
Catgeory = item.category,
Name = item.name,
......@@ -80,15 +88,17 @@ namespace Siger.ApiACC.Controllers
Specfication = item.specification,
Number = item.number.ToString(),
Status = item.status == 1 ? "可用" : "停用",
Remark = item.remark
Remark = item.remark,
Updator = item.updator,
UpdateTime = item.updatetime
});
}
if (dataList.Any())
{
EpPlusExcelHelper<FixtureToolsTemplate> helper = null;
EpPlusExcelHelper<FixtureToolsList> helper = null;
try
{
helper = new EpPlusExcelHelper<FixtureToolsTemplate>();
helper = new EpPlusExcelHelper<FixtureToolsList>();
var temporaryFileName = $"工装台账_FixtureToolsData_{DateTime.Now:yyyyMMddHHmmss}.xlsx";
helper.GenerateExcel(dataList, Path.Combine(rootDir, temporaryFileName));
return new ObjectResult($"{FileSystemHelper.CommonFileSetting.RequestPath}/{FileSystemHelper.ExportFileName}/{temporaryFileName}");
......@@ -118,7 +128,7 @@ namespace Siger.ApiACC.Controllers
public IActionResult Add([FromBody]RequestAddFixtureTools req)
{
if(string.IsNullOrEmpty(req.partnumber) || string.IsNullOrEmpty(req.code) || string.IsNullOrEmpty(req.name) || string.IsNullOrEmpty(req.categoryid) ||
string.IsNullOrEmpty(req.managetype) || string.IsNullOrEmpty(req.managetype))
string.IsNullOrEmpty(req.managetype))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
......@@ -169,7 +179,7 @@ namespace Siger.ApiACC.Controllers
public IActionResult Update([FromBody]RequestUpdateFixtureTools req)
{
if (string.IsNullOrEmpty(req.partnumber) || string.IsNullOrEmpty(req.code) || string.IsNullOrEmpty(req.name) || string.IsNullOrEmpty(req.categoryid) ||
string.IsNullOrEmpty(req.managetype) || string.IsNullOrEmpty(req.managetype) || req.id <= 0)
string.IsNullOrEmpty(req.managetype) || req.id <= 0)
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
......@@ -256,7 +266,16 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetCategoryPageList(string id, int page, int pagesize, string toexcel = "")
{
var data = _toolsCategoryRepository.GetPagedList(id.ToInt(), ProjectId, page, pagesize, toexcel);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var categoryIds = new List<int>();
if (id.ToInt() > 0)
{
var cate = categorys.FirstOrDefault(q => q.id == id.ToInt());
var sonCates = GetSonCategoryList(cate.guid, categorys);
categoryIds = sonCates.Select(q => q.id).ToList();
categoryIds.Add(id.ToInt());
}
var data = _toolsCategoryRepository.GetPagedList(categoryIds, ProjectId, page, pagesize, toexcel);
if(toexcel.ToInt() == 1)
{
return ExportCategoryExcel(data.Data);
......@@ -320,7 +339,7 @@ namespace Siger.ApiACC.Controllers
var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt());
if(exsit == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
throw new BadRequestException(RequestEnum.ParentTypeError);
}
else
{
......@@ -352,6 +371,10 @@ namespace Siger.ApiACC.Controllers
public IActionResult UpdateCategory([FromBody]RequestUpdateFixtureToolsCategory req)
{
var entity = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.id);
if(entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var data = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.name == req.name &&
q.id != req.id);
if (data != null)
......@@ -364,7 +387,7 @@ namespace Siger.ApiACC.Controllers
var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt());
if (exsit == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
throw new BadRequestException(RequestEnum.ParentTypeError);
}
else
{
......@@ -395,18 +418,23 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var details = GetSonCategoryList(entity.guid, categorys);
var detailIds = details.Select(q => q.id).Distinct().ToList();
var details = GetSonCategoryList(entity.guid, categorys).ToList();
details.Add(entity);
var detailGuids = details.Select(q => q.guid).Distinct().ToList();
if (_toolsRepository.GetList(q => q.projectId == ProjectId && detailGuids.Contains(q.category)).Any())
{
throw new BadRequestException(RequestEnum.CategoryBindFixtureToolData);
}
var delDetails = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid &&
detailIds.Contains(q.id)).ToList();
detailGuids.Contains(q.guid)).ToList();
foreach (var detail in delDetails)
{
detail.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(detail);
}
entity.status = (int)RowState.Invalid;
_toolsCategoryRepository.Update(entity);
if(_unitOfWork.Commit() > 0)
{
return new ObjectResult(CommonEnum.Succefull);
......@@ -421,7 +449,7 @@ namespace Siger.ApiACC.Controllers
{
var query = from c in sections where c.parent == parentId select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonCategoryList(t.parent, sections)));
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonCategoryList(t.guid, sections)));
}
[HttpGet]
......@@ -457,7 +485,16 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetFixtureToolList(string categoryid)
{
var list = _toolsRepository.GetDataList(categoryid.ToInt(), ProjectId);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var categoryIds = new List<int>();
if (categoryid.ToInt() > 0)
{
var cate = categorys.FirstOrDefault(q => q.id == categoryid.ToInt());
var sonCates = GetSonCategoryList(cate.guid, categorys);
categoryIds = sonCates.Select(q => q.id).ToList();
categoryIds.Add(categoryid.ToInt());
}
var list = _toolsRepository.GetDataList(categoryIds, ProjectId);
return new ObjectResult(list);
}
}
......
......@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Extensions;
using System.Linq;
using Siger.Middlelayer.Repository.Entities;
using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Utility.ImportEntities;
using Siger.Middlelayer.Utility.Helpers;
using System.IO;
using Siger.Middlelayer.Log;
namespace Siger.ApiACC.Controllers
{
......@@ -37,9 +42,9 @@ namespace Siger.ApiACC.Controllers
}
[HttpGet]
public IActionResult GetPageList(string category, string tool, string product, int page, int pagesize)
public IActionResult GetPageList(string category, string tool, string product, int page, int pagesize, string toexcel)
{
var data = _toolsProductRepository.GetPagedList(category.ToInt(), tool.ToInt(), product.ToInt(), ProjectId, page, pagesize);
var data = _toolsProductRepository.GetPagedList(category.ToInt(), tool.ToInt(), product.ToInt(), ProjectId, page, pagesize, toexcel);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var list = new List<ResponseAumationFixtureToolsProduct>();
foreach(var item in data.Data)
......@@ -50,9 +55,62 @@ namespace Siger.ApiACC.Controllers
item.categoryids = cateIds;
list.Add(item);
}
if(toexcel.ToInt() == 1)
{
return ExportExcel(list);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
}
private IActionResult ExportExcel(IEnumerable<ResponseAumationFixtureToolsProduct> data)
{
var rootDir = FileSystemHelper.GetPhysicalFolders(FileSystemHelper.CommonFileSetting.PhysicalFolder, FileSystemHelper.ExportFileName);
if (!data.Any())
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var dataList = new List<FixtureToolsProductList>();
foreach (var item in data)
{
dataList.Add(new FixtureToolsProductList
{
Category = item.categoryname,
PartNumber = item.partnumber,
FixtureTool = item.fixturetool,
Specfication = item.specfication,
Product = item.productname,
ProductCode = item.productcode,
Remark = item.remark,
Updator = item.updator,
UpdateTime = item.updatetime
});
}
if (dataList.Any())
{
EpPlusExcelHelper<FixtureToolsProductList> helper = null;
try
{
helper = new EpPlusExcelHelper<FixtureToolsProductList>();
var temporaryFileName = $"工装对应产品_FixtureToolsProductData_{DateTime.Now:yyyyMMddHHmmss}.xlsx";
helper.GenerateExcel(dataList, Path.Combine(rootDir, temporaryFileName));
return new ObjectResult($"{FileSystemHelper.CommonFileSetting.RequestPath}/{FileSystemHelper.ExportFileName}/{temporaryFileName}");
}
catch (Exception e)
{
Logger.WriteLineError("Export Fixture Tools Product Data failed, error:" + e);
throw new BadRequestException(RequestEnum.ExportFailed);
}
finally
{
helper?.Dispose();
}
}
throw new BadRequestException(CommonEnum.Fail);
}
private IEnumerable<siger_automation_fixture_tools_category> GetParentCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
{
var query = from c in sections where c.guid == parentId select c;
......
......@@ -41,12 +41,19 @@ namespace Siger.ApiACC.Controllers
private readonly IBasketSettingRepository _basketSetting;
private readonly ITrParameterConfigRepository _parameterConfigRepository;
private readonly ISeriNumCfg _serinumCfgRepository;
private readonly IAutomationFixtureToolsCategoryRepository _fixtureToolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _fixtureToolsRepository;
private readonly IAutomationFixtureToolsProductRepository _fixtureToolsProductRepository;
private readonly IAutomationFixtureToolsAssemblyRepository _fixtureToolsAssemblyRepository;
private readonly IAutomationLocationRepository _autoLocationRepository;
public UploadController(IUnitOfWork unitOfWork,ISigerTrMaterialsRepository materialsRepository, ISigerTrMaterialTypeRepository materialTypeRepository,
ISigerTrAssemblyMaintenanceRepository assemblyMaintenanceRepository, ISigerTrProductStructureRepository productStructureRepository
, ISigerDict sigerDict, ISigerEquipment sigerEquipment, ISigerEquipmentPosition sigerEquipmentPosition, ISigerRoutingEventNo routingEvenNo
, ISigerRoutingOutStation sigerRoutingOutStation, ISigerRoutingInStation sigerRoutingIn, ISigerPackingFullQty sigerPackingFull
, ISigerCheckItem checkItem, ISigerWOBookingItem sigerWOBooking, IBasketSettingRepository basketSetting, ITrParameterConfigRepository parameterConfigRepository,
ISeriNumCfg serinumCfgRepository)
ISeriNumCfg serinumCfgRepository, IAutomationFixtureToolsCategoryRepository fixtureToolsCategoryRepository, IAutomationFixtureToolsRepository fixtureToolsRepository,
IAutomationFixtureToolsProductRepository fixtureToolsProductRepository, IAutomationFixtureToolsAssemblyRepository fixtureToolsAssemblyRepository,
IAutomationLocationRepository autoLocationRepository)
{
_unitOfWork = unitOfWork;
_materialsRepository = materialsRepository;
......@@ -65,6 +72,11 @@ namespace Siger.ApiACC.Controllers
_basketSetting = basketSetting;
_parameterConfigRepository = parameterConfigRepository;
_serinumCfgRepository = serinumCfgRepository;
_fixtureToolsCategoryRepository = fixtureToolsCategoryRepository;
_fixtureToolsRepository = fixtureToolsRepository;
_fixtureToolsProductRepository = fixtureToolsProductRepository;
_fixtureToolsAssemblyRepository = fixtureToolsAssemblyRepository;
_autoLocationRepository = autoLocationRepository;
}
[HttpPost]
......@@ -208,6 +220,21 @@ namespace Siger.ApiACC.Controllers
case TemplateNameEnums.SnRule:
result = ImportSnRule(temporaryFilePath);
break;
case TemplateNameEnums.FixtureToolsCategoryTemplate:
result = ImportFixtureToolsCategory(temporaryFilePath);
break;
case TemplateNameEnums.FixtureToolsTemplate:
result = ImportFixtureTools(temporaryFilePath);
break;
case TemplateNameEnums.FixtureToolsProductTemplate:
result = ImportFixtureToolsProduct(temporaryFilePath);
break;
case TemplateNameEnums.FixtureToolsAssmeblyTemplate:
result = ImportFixtureToolsAssembly(temporaryFilePath);
break;
case TemplateNameEnums.AutomationLocationTemplate:
result = ImportAutomationLocation(temporaryFilePath);
break;
default:
throw new ArgumentOutOfRangeException();
}
......@@ -803,5 +830,136 @@ namespace Siger.ApiACC.Controllers
excelHelper?.Dispose();
}
}
private CommonImportResult ImportFixtureToolsCategory(string temporaryFilePath)
{
EpPlusExcelHelper<FixtureToolsCategoryTemplate> excelHelper = null;
try
{
excelHelper = new EpPlusExcelHelper<FixtureToolsCategoryTemplate>(temporaryFilePath);
var checkResult = excelHelper.CheckExcel();
if (checkResult.Any())
{
return new CommonImportResult(0, string.Join(';', checkResult));
}
var data = excelHelper.ConvertSheetToList();
var result = _fixtureToolsCategoryRepository.ImportData(data, ProjectId);
return result;
}
catch (Exception e)
{
Logger.WriteLineError("ImportFixtureToolsCategory failed,error: " + e.Message);
throw;
}
finally
{
excelHelper?.Dispose();
}
}
private CommonImportResult ImportFixtureTools(string temporaryFilePath)
{
EpPlusExcelHelper<FixtureToolsTemplate> excelHelper = null;
try
{
excelHelper = new EpPlusExcelHelper<FixtureToolsTemplate>(temporaryFilePath);
var checkResult = excelHelper.CheckExcel();
if (checkResult.Any())
{
return new CommonImportResult(0, string.Join(';', checkResult));
}
var data = excelHelper.ConvertSheetToList();
var result = _fixtureToolsRepository.ImportData(data, ProjectId, UserId);
return result;
}
catch (Exception e)
{
Logger.WriteLineError("ImportFixtureTools failed,error: " + e.Message);
throw;
}
finally
{
excelHelper?.Dispose();
}
}
private CommonImportResult ImportFixtureToolsProduct(string temporaryFilePath)
{
EpPlusExcelHelper<FixtureToolsProductTemplate> excelHelper = null;
try
{
excelHelper = new EpPlusExcelHelper<FixtureToolsProductTemplate>(temporaryFilePath);
var checkResult = excelHelper.CheckExcel();
if (checkResult.Any())
{
return new CommonImportResult(0, string.Join(';', checkResult));
}
var data = excelHelper.ConvertSheetToList();
var result = _fixtureToolsProductRepository.ImportData(data, ProjectId, UserId);
return result;
}
catch (Exception e)
{
Logger.WriteLineError("ImportFixtureToolsProduct failed,error: " + e.Message);
throw;
}
finally
{
excelHelper?.Dispose();
}
}
private CommonImportResult ImportFixtureToolsAssembly(string temporaryFilePath)
{
EpPlusExcelHelper<FixtureToolsAssmeblyTemplate> excelHelper = null;
try
{
excelHelper = new EpPlusExcelHelper<FixtureToolsAssmeblyTemplate>(temporaryFilePath);
var checkResult = excelHelper.CheckExcel();
if (checkResult.Any())
{
return new CommonImportResult(0, string.Join(';', checkResult));
}
var data = excelHelper.ConvertSheetToList();
var result = _fixtureToolsAssemblyRepository.ImportData(data, ProjectId, UserId);
return result;
}
catch (Exception e)
{
Logger.WriteLineError("ImportFixtureToolsAssembly failed,error: " + e.Message);
throw;
}
finally
{
excelHelper?.Dispose();
}
}
private CommonImportResult ImportAutomationLocation(string temporaryFilePath)
{
EpPlusExcelHelper<AutomationLocationTemplate> excelHelper = null;
try
{
excelHelper = new EpPlusExcelHelper<AutomationLocationTemplate>(temporaryFilePath);
var checkResult = excelHelper.CheckExcel();
if (checkResult.Any())
{
return new CommonImportResult(0, string.Join(';', checkResult));
}
var data = excelHelper.ConvertSheetToList();
var result = _autoLocationRepository.ImportData(data, ProjectId, UserId);
return result;
}
catch (Exception e)
{
Logger.WriteLineError("ImportAutomationLocation failed,error: " + e.Message);
throw;
}
finally
{
excelHelper?.Dispose();
}
}
}
}
......@@ -72,7 +72,7 @@ namespace Siger.ApiConfig.Controller
}
private Type GetType(TemplateNameEnums template)
{
{
Type type = null;
switch (template)
{
......@@ -300,6 +300,9 @@ namespace Siger.ApiConfig.Controller
case TemplateNameEnums.FixtureToolsAssmeblyTemplate:
type = typeof(FixtureToolsAssmeblyTemplate);
break;
case TemplateNameEnums.AutomationLocationTemplate:
type = typeof(AutomationLocationTemplate);
break;
}
return type;
......
......@@ -680,13 +680,12 @@ namespace Siger.ApiWMS.Controllers
//title
excelData.Add(GetExcelTitle());
//data
int id = 1;
foreach (var item in data)
{
var tmp = new List<string>();
tmp.Add(id++.ToString());
tmp.Add(item.storeID.ToString());
tmp.Add(item.storageName);
tmp.AddRange(item.field.Select(q => q.name));
tmp.AddRange(item.field.Select(q => q.val));
tmp.Add(item.state == (int)RowState.Valid ? "否" : "是");
tmp.Add(item.serialNumber);
excelData.Add(tmp);
......@@ -940,7 +939,7 @@ namespace Siger.ApiWMS.Controllers
if (Location.id == locationTypeId)
{
var locationIdExist = location.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.typeid == locationTypeId &&
q.locationid == req.storeID.ToInt());
q.locationid == req.storeID.ToInt() && q.storageid == req.warehouseid);
if (locationIdExist != null)
{
throw new BadRequestException(RequestEnum.IDExist);
......@@ -1074,7 +1073,7 @@ namespace Siger.ApiWMS.Controllers
if(Location.id == locationTypeId)
{
var locationIdExist = location.Get(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && q.typeid == locationTypeId &&
q.locationid == req.storeID.ToInt() && q.id != Location.locationid.ToInt());
q.locationid == req.storeID.ToInt() && q.id != Location.locationid.ToInt() && q.storageid == req.warehouseid);
if (locationIdExist != null)
{
throw new BadRequestException(RequestEnum.IDExist);
......
......@@ -38,5 +38,10 @@ namespace Siger.Middlelayer.Share.Constant
/// </summary>
public const string UploadloadStation = "LoadStation";
/// <summary>
/// 立库
/// </summary>
public const string WarehouseStation = "WarehouseStation";
}
}
......@@ -236,6 +236,7 @@ namespace Siger.Middlelayer.Common
FixtureToolsTemplate,
FixtureToolsProductTemplate,
FixtureToolsAssmeblyTemplate,
AutomationLocationTemplate,
}
public enum LogLevel
......
......@@ -332,7 +332,11 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("设备正在空闲中")]
MachineOnFree,
[Description("设备已经生产完成")]
MachineProCompalate
MachineProCompalate,
[Description("该设备当前无工装状态")]
MonitorNotfound,
[Description("未配置字典信息")]
AutomationDictNotfound
}
public enum SeriNumCfg
......
......@@ -45,21 +45,23 @@ namespace Siger.Middlelayer.Share.Enum.ModuleEnum
public enum TaskResultStatus
{
/// <summary>
/// 取消
/// </summary>
Cancel=0,
/// <summary>
/// 待生产
/// </summary>
[Description("待执行")]
Waiting=1,
/// <summary>
/// 生产中
/// </summary>
[Description("执行中")]
Produce=2,
/// <summary>
/// 生产完成
/// </summary>
Complated=3
[Description("任务完成")]
Complated=3,
[Description("取消")]
Cancel=4,
}
/// <summary>
/// 设备状态 (自动任务)
......
......@@ -1465,7 +1465,7 @@ namespace Siger.Middlelayer.Common
[Description("未找到储位类别")]
LocationTypeNotFound,
[Description("未找到工装类")]
[Description("未找到工装类")]
FixtureToolCatgeoryNotFound,
[Description("未找到工装信息")]
......@@ -1476,5 +1476,8 @@ namespace Siger.Middlelayer.Common
[Description("父级和子级不能相同")]
ParentSonSame,
[Description("该类型绑定了工装,不能删除")]
CategoryBindFixtureToolData,
}
}
......@@ -4,7 +4,7 @@ namespace Siger.Middlelayer.Utility.ImportEntities
{
public class FixtureToolsCategoryTemplate : ImportBase
{
[ExcelColumn("工装类型*")]
[ExcelColumn("*工装类型")]
public string Fixture { get; set; }
[ExcelColumn("上级类型")]
......@@ -13,28 +13,58 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public class FixtureToolsTemplate : ImportBase
{
[ExcelColumn("工装类型*")]
[ExcelColumn("*工装类型")]
public string Catgeory { get; set; }
[ExcelColumn("管理类型*")]
[ExcelColumn("*管理类型")]
public string Manage { get; set; }
[ExcelColumn("工装名称*")]
[ExcelColumn("*工装名称")]
public string Name { get; set; }
[ExcelColumn("工装料号*")]
[ExcelColumn("*工装料号")]
public string PartNumber { get; set; }
[ExcelColumn("工装编号*")]
[ExcelColumn("*工装编号")]
public string Code { get; set; }
[ExcelColumn("规格型号*")]
[ExcelColumn("*规格型号")]
public string Specfication { get; set; }
[ExcelColumn("数量*")]
[ExcelColumn("*数量")]
public string Number { get; set; }
[ExcelColumn("状态*")]
[ExcelColumn("*状态")]
public string Status { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
}
public class FixtureToolsList : ImportBase
{
[ExcelColumn("工装类型")]
public string Catgeory { get; set; }
[ExcelColumn("管理类型")]
public string Manage { get; set; }
[ExcelColumn("工装名称")]
public string Name { get; set; }
[ExcelColumn("工装料号")]
public string PartNumber { get; set; }
[ExcelColumn("工装编号")]
public string Code { get; set; }
[ExcelColumn("规格型号")]
public string Specfication { get; set; }
[ExcelColumn("数量")]
public string Number { get; set; }
[ExcelColumn("状态")]
public string Status { get; set; }
[ExcelColumn("备注")]
......@@ -49,25 +79,171 @@ namespace Siger.Middlelayer.Utility.ImportEntities
public class FixtureToolsProductTemplate : ImportBase
{
[ExcelColumn("工装编号*")]
[ExcelColumn("工装类型")]
public string Categroy { get; set; }
[ExcelColumn("*工装名称")]
public string FixtureTool { get; set; }
[ExcelColumn("产品名称*")]
[ExcelColumn("*产品编号")]
public string Product { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
}
public class FixtureToolsProductList : ImportBase
{
[ExcelColumn("工装类型")]
public string Category { get; set; }
[ExcelColumn("工装料号")]
public string PartNumber { get; set; }
[ExcelColumn("工装名称")]
public string FixtureTool { get; set; }
[ExcelColumn("规格型号")]
public string Specfication { get; set; }
[ExcelColumn("产品编号")]
public string ProductCode { get; set; }
[ExcelColumn("产品名称")]
public string Product { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
[ExcelColumn("维护人")]
public string Updator { get; set; }
[ExcelColumn("维护时间")]
public string UpdateTime { get; set; }
}
public class FixtureToolsAssmeblyTemplate : ImportBase
{
[ExcelColumn("父工装编号*")]
[ExcelColumn("父工装类型")]
public string ParentCategory { get; set; }
[ExcelColumn("*父工装名称")]
public string ParentFixtureTool { get; set; }
[ExcelColumn("子工装编号*")]
[ExcelColumn("子工装类型")]
public string Category { get; set; }
[ExcelColumn("*子工装名称")]
public string FixtureTool { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
[ExcelColumn("*状态")]
public string Status { get; set; }
}
public class FixtureToolsAssmeblyList : ImportBase
{
[ExcelColumn("父工装类型")]
public string ParentCategory { get; set; }
[ExcelColumn("父工装料号")]
public string ParentPartNumber { get; set; }
[ExcelColumn("父工装名称")]
public string ParentFixtureTool { get; set; }
[ExcelColumn("父工装规格")]
public string ParentSpecfication { get; set; }
[ExcelColumn("父工装编号")]
public string ParentCode { get; set; }
[ExcelColumn("子工装类型")]
public string Category { get; set; }
[ExcelColumn("子工装料号")]
public string PartNumber { get; set; }
[ExcelColumn("子工装名称")]
public string FixtureTool { get; set; }
[ExcelColumn("子工装规格")]
public string Specfication { get; set; }
[ExcelColumn("子工装编号")]
public string Code { get; set; }
[ExcelColumn("状态")]
public string Status { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
[ExcelColumn("维护人")]
public string Updator { get; set; }
[ExcelColumn("维护时间")]
public string UpdateTime { get; set; }
}
public class AutomationLocationTemplate : ImportBase
{
[ExcelColumn("*仓库名称")]
public string Warehouse { get; set; }
[ExcelColumn("*储位ID")]
public string LocationId { get; set; }
[ExcelColumn("*工装名称")]
public string FixtureTool { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
}
public class AutomationLocationList : ImportBase
{
[ExcelColumn("仓库名称")]
public string Warehouse { get; set; }
[ExcelColumn("储位信息")]
public string Location { get; set; }
[ExcelColumn("储位ID")]
public string LocationId { get; set; }
[ExcelColumn("工装类别")]
public string Catgeory { get; set; }
[ExcelColumn("工装编号")]
public string Code { get; set; }
[ExcelColumn("工装名称")]
public string Name { get; set; }
[ExcelColumn("工装规格")]
public string Specfication { get; set; }
[ExcelColumn("工件编号")]
public string SN { get; set; }
[ExcelColumn("工序顺序")]
public string RouteNumber { get; set; }
[ExcelColumn("工序名称")]
public string RouteName { get; set; }
[ExcelColumn("物料状态")]
public string State { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
[ExcelColumn("维护人")]
public string Updator { get; set; }
[ExcelColumn("维护时间")]
public string UpdateTime { get; set; }
}
}
......@@ -14,14 +14,13 @@ namespace Siger.Middlelayer.Utility.ImportEntities
[ExcelColumn("产品名称")]
public string ProductName { get; set; }
[ExcelColumn("工序")]
public string RouteName { get; set; }
[ExcelColumn("位置")]
public string Section { get; set; }
[ExcelColumn("工单")]
public string WorkOrder { get; set; }
[ExcelColumn("工艺")]
public string RouteName { get; set; }
[ExcelColumn("二维码")]
public string SN { get; set; }
[ExcelColumn("偏差放行数量")]
......
......@@ -40,6 +40,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
public DateTime updatetime { get; set; }
public string ordernumber { get; set; }
/// <summary>
/// 产品ID
/// </summary>
public int productId { get; set; }
/// <summary>
///
/// </summary>
public string productCode { get; set; }
......
......@@ -11,6 +11,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
{
public string guid { get; set; }
/// <summary>
/// 储位自增ID
/// </summary>
public int location_cid { get; set; }
/// <summary>
/// 储位位置
/// </summary>
public int locationid { get; set; }
......@@ -18,6 +22,33 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 工装GUID
/// </summary>
public string fixturetools { get; set; }
public string fixturename { get; set; }
public int productid { get; set; }
public string productcode { get; set; }
public string productname { get; set; }
/// <summary>
/// 工件对应的工单号
/// </summary>
public string ordernumber { get; set; }
/// <summary>
/// 工装工件
/// </summary>
public string sn { get; set; }
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public int routeid { get; set; }
/// <summary>
/// 每加工CNC 设备 经过的工序: 标准节拍表
/// </summary>
public string route { get; set; }
/// <summary>
/// 工序顺序
/// </summary>
public int routenum { get; set; }
/// <summary>
/// 附件
/// </summary>
......
......@@ -20,6 +20,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
public string fixtureguid { get; set; }
/// <summary>
/// 工装Name
/// </summary>
public string fixturename { get; set; }
/// <summary>
/// 工位ID
/// </summary>
public int sectionid { get; set; }
......@@ -47,6 +51,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 产品code
/// </summary>
public string productcode { get; set; }
public string productname { get; set; }
/// <summary>
/// 工序ID
/// </summary>
......
using System;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// snList
/// </summary>
public class siger_check_sn_list : AccEntityBase
{
public string SN { get; set; }
public string BatchNumber { get; set; }
public int ProductID { get; set; }
public string ProductCode { get; set; }
public int MaterialID { get; set; }
public string PartNumber { get; set; }
public int LineID { get; set; }
public string StateCode { get; set; }
public string WorkOrder { get; set; }
public DateTime CreateTime { get; set; }
}
}
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// siger_check_sn_trace_detail
/// </summary>
public class siger_check_sn_trace_detail : AccEntityBase
{
[NotMapped]
public int id { get; set; }
[Key]
public long ID { get; set; }
public int MachineID { get; set; }
public string TraceID { get; set; }
public string SN { get; set; }
public int ItemID { get; set; }
public string ItemName { get; set; }
public double? Value { get; set; }
public string Result { get; set; }
public DateTime CreateTime { get; set; }
public double? LowerLimit { get; set; }
public double? UpperLimit { get; set; }
public int NumberIndex { get; set; }
/// <summary>
/// 쳣״̬ abnomal_rulekey
/// </summary>
public string abnomal_status { get; set; }
}
}
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// 检验数据附件
/// </summary>
public class siger_check_sn_trace_file : AccEntityBase
{
public int trace_id { get; set; }
public string url { get; set; }
public string name { get; set; }
public int size { get; set; }
public int file_type { get; set; }
/// <summary>
/// 检验方式1->进料检验2->送检检验3->人工检验
/// </summary>
public int trace_type { get; set; }
}
}
using System;
namespace Siger.Middlelayer.AccRepository.Entities
{
/// <summary>
/// trace扩展表
/// </summary>
public class siger_check_sn_trace_inspection : AccEntityBase
{
public string trace_id { get; set; }
/// <summary>
/// 检测室字典key
/// </summary>
public string testroom { get; set; }
/// <summary>
///
/// </summary>
public int productid { get; set; }
public int materialid { get; set; }
/// <summary>
/// 工位ID
/// </summary>
public int sectionid { get; set; }
/// <summary>
/// 二维码
/// </summary>
public string sn { get; set; }
/// <summary>
/// 工序ID
/// </summary>
public int routeid { get; set; }
/// <summary>
/// 检验类型
/// </summary>
public int check_type { get; set; }
/// <summary>
/// 1->待接收2->检测完成3->待检验4->检验中
/// </summary>
public int check_status { get; set; }
/// <summary>
/// 结果
/// </summary>
public string result { get; set; }
/// <summary>
/// 送检人
/// </summary>
public int send_mid { get; set; }
/// <summary>
/// 送检时间
/// </summary>
public DateTime send_time { get; set; }
/// <summary>
/// 检验人
/// </summary>
public int check_mid { get; set; }
/// <summary>
/// 检验时间
/// </summary>
public DateTime? check_time { get; set; }
/// <summary>
/// 扩展表类别 1->送检检验2->人工检验
/// </summary>
public int inspection_type { get; set; }
public int number { get; set; }
/// <summary>
/// 送检原因
/// </summary>
public string reason { get; set; }
public string workorder { get; set; }
/// <summary>
/// 偏差放行数量
/// </summary>
public int quantity { get; set; }
/// <summary>
/// 接收人
/// </summary>
public int recieve_mid { get; set; }
/// <summary>
/// 接收时间
/// </summary>
public DateTime? recieve_time { get; set; }
/// <summary>
/// 开始检验人
/// </summary>
public int checking_mid { get; set; }
/// <summary>
/// 开始检验时间
/// </summary>
public DateTime? checking_time { get; set; }
}
}
......@@ -131,5 +131,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 是否触发安灯0不触发 1触发
/// </summary>
public int trigger_andon { get; set; }
public string image { get; set; }
}
}
......@@ -8,8 +8,10 @@ using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Log;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
namespace Siger.Middlelayer.AccRepository.Repositories
{
......@@ -21,7 +23,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize, string toexcel = "")
public IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(List<int> id, int projectid, int page, int pagesize, string toexcel = "")
{
Expression<Func<ResponseFixtureToolsCategory, bool>> FunNum = f => true;
var query = from q in _context.siger_automation_fixture_tools_category
......@@ -39,9 +41,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
createtime = q.createtime.ToString(ParameterConstant.DateTimeFormat),
time = q.createtime
};
if (id > 0)
if (id.Any())
{
FunNum = q => q.id == id;
FunNum = q => id.Contains(q.id);
}
if(toexcel.ToInt() == 1)
{
......@@ -55,5 +57,65 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return new PagedCollectionResult<ResponseFixtureToolsCategory>(entities, totalCount);
}
}
public CommonImportResult ImportData(IEnumerable<FixtureToolsCategoryTemplate> list, int projectid)
{
var errors = new List<string>();
var rowIndex = 1;
foreach (var item in list)
{
rowIndex++;
if (string.IsNullOrEmpty(item.Fixture))
{
errors.Add($"{rowIndex}, {(int)RequestEnum.ParameterMiss}");
}
var data = _context.siger_automation_fixture_tools_category.FirstOrDefault(q => q.projectId == projectid && q.status == (int)RowState.Valid && q.name == item.Fixture);
if (data != null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
var parent = "";
if (!string.IsNullOrEmpty(item.Parent))
{
var exsit = _context.siger_automation_fixture_tools_category.FirstOrDefault(q => q.projectId == projectid && q.status == (int)RowState.Valid && q.name == item.Parent);
if (exsit == null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.ParentTypeError}");
}
else
{
parent = exsit.guid;
}
}
if (errors.Any())
{
return new CommonImportResult(0, string.Join(";", errors));
}
try
{
var entity = new siger_automation_fixture_tools_category
{
guid = Guid.NewGuid().ToString(),
name = item.Fixture,
parent = parent,
createtime = DateTime.Now,
updatetime = DateTime.Now,
projectId = projectid
};
_context.siger_automation_fixture_tools_category.Add(entity);
_context.SaveChanges();
}
catch (Exception e)
{
Logger.WriteLineError(e.Message);
throw;
}
}
return new CommonImportResult(1, "1");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
......@@ -6,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Log;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
namespace Siger.Middlelayer.AccRepository.Repositories
{
......@@ -36,7 +40,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return query.FirstOrDefault();
}
public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize)
public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize, string toexcel)
{
var query = from q in _context.siger_automation_fixture_tools_product
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
......@@ -80,9 +84,39 @@ namespace Siger.Middlelayer.AccRepository.Repositories
productExpression = q => q.productid == product;
}
var expression = categoryExpression.And(toolExpression).And(productExpression);
var entities = query.Where(expression).OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAumationFixtureToolsProduct>(entities, totalCount);
if (toexcel.ToInt() == 1)
{
var entities = query.Where(expression).OrderByDescending(q => q.id).AsNoTracking().ToList();
return new PagedCollectionResult<ResponseAumationFixtureToolsProduct>(entities, entities.Count);
}
else
{
var entities = query.Where(expression).OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAumationFixtureToolsProduct>(entities, totalCount);
}
}
/// <summary>
/// 获取 交期最早的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public IEnumerable<ResponseAutomationPlanOrder> GetDeliveryOrder(List<int>productIds,int projectId)
{
var query = from d in _context.siger_project_product_plan_detail
join p in _context.siger_project_product_plan on d.PlanId equals p.id
where d.projectId == projectId && productIds.Contains(p.product_id) && d.status != (int)RowState.Invalid && p.status != (int)RowState.Invalid
select new ResponseAutomationPlanOrder
{
productId=p.product_id,
ordernumber=d.OrderNumber,
productCode=p.product_code,
productName=p.product_name,
delvery=p.delivery_time,
};
return query.OrderBy(f => f.delvery);
}
public ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber)
......@@ -93,7 +127,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join q in _context.siger_automation_fixture_tools_product on p.product_code equals q.productcode
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join l in _context.siger_automation_location on t.guid equals l.fixturetools
where q.projectId == projectId && d.OrderNumber == ordernumber && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
where q.projectId == projectId && d.OrderNumber == ordernumber
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid && l.status==(int)RowState.Valid
select new ResponsePlanlFixtureInfo
{
OrderNumber = ordernumber,
......@@ -105,5 +140,81 @@ namespace Siger.Middlelayer.AccRepository.Repositories
};
return query.FirstOrDefault();
}
public CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid)
{
var entities = new List<siger_automation_fixture_tools_product>();
var errors = new List<string>();
var rowIndex = 1;
foreach (var item in list)
{
rowIndex++;
if (string.IsNullOrEmpty(item.FixtureTool) || string.IsNullOrEmpty(item.Product))
{
errors.Add($"{rowIndex},{(int)RequestEnum.ParameterMiss}");
}
var fixtureTool = _context.siger_automation_fixture_tools.FirstOrDefault(q => q.projectId == projectid && q.name == item.FixtureTool);
if (fixtureTool == null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.FixtureToolNotFound}");
}
var product = _context.siger_project_product.FirstOrDefault(q => q.projectid == projectid && q.status == (int)RowState.Valid && q.code == item.Product);
if (product == null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.ProductNotFound}");
}
if(fixtureTool != null && product != null)
{
var data = _context.siger_automation_fixture_tools_product.FirstOrDefault(q => q.projectId == projectid && q.status == (int)RowState.Valid && (q.fixturetools == fixtureTool.guid ||
q.productid == product.id));
if (data != null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
}
if(list.Count(q => q.FixtureTool == item.FixtureTool || q.Product == item.Product) > 1)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
if (errors.Any())
{
return new CommonImportResult(0, string.Join(";", errors));
}
var entity = new siger_automation_fixture_tools_product
{
guid = Guid.NewGuid().ToString(),
fixturetools = fixtureTool.guid,
remark = item.Remark,
productid = product.id,
productcode = product.code,
projectId = projectid,
createtime = DateTime.Now,
updatetime = DateTime.Now,
creator = userid,
updator = userid,
attachment = "",
filename = ""
};
entities.Add(entity);
}
try
{
_context.siger_automation_fixture_tools_product.AddRange(entities);
_context.SaveChanges();
return new CommonImportResult(1, "1");
}
catch (Exception e)
{
Logger.WriteLineError(e.Message);
throw;
}
}
}
}
......@@ -8,9 +8,11 @@ using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Log;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
namespace Siger.Middlelayer.AccRepository.Repositories
{
......@@ -22,7 +24,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
public IPagedCollectionResult<ResponseFixtureTools> GetPagedList(List<int> category, string code, string name, int state,
int projectid, int page, int pagesize, string toexcel = "")
{
var query = from q in _context.siger_automation_fixture_tools
......@@ -51,9 +53,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
Expression<Func<ResponseFixtureTools, bool>> categoryExpression = f => true;
if (category > 0)
if (category.Any())
{
categoryExpression = q => q.categoryid == category;
categoryExpression = q => category.Contains(q.categoryid);
}
Expression<Func<ResponseFixtureTools, bool>> codeExpression = f => true;
if (!string.IsNullOrEmpty(code))
......@@ -85,7 +87,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
public IEnumerable<ResponseFixtureTools> GetDataList(int categoryid, int projectid)
public IEnumerable<ResponseFixtureTools> GetDataList(List<int> categoryid, int projectid)
{
var query = from q in _context.siger_automation_fixture_tools
join p in _context.siger_automation_fixture_tools_category on q.category equals p.guid
......@@ -107,9 +109,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
if (categoryid > 0)
if (categoryid.Any())
{
query = query.Where(q => q.categoryid == categoryid);
query = query.Where(q => categoryid.Contains(q.categoryid));
}
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList();
return entities;
......@@ -128,5 +130,78 @@ namespace Siger.Middlelayer.AccRepository.Repositories
};
return query.FirstOrDefault();
}
public CommonImportResult ImportData(IEnumerable<FixtureToolsTemplate> list, int projectid, int userid)
{
var entities = new List<siger_automation_fixture_tools>();
var errors = new List<string>();
var rowIndex = 1;
foreach (var item in list)
{
rowIndex++;
if (string.IsNullOrEmpty(item.PartNumber) || string.IsNullOrEmpty(item.Code) || string.IsNullOrEmpty(item.Name) || string.IsNullOrEmpty(item.Catgeory) ||
string.IsNullOrEmpty(item.Manage) || string.IsNullOrEmpty(item.Number) || string.IsNullOrEmpty(item.Status) || string.IsNullOrEmpty(item.Specfication))
{
errors.Add($"{rowIndex},{(int)RequestEnum.ParameterMiss}");
}
var data = _context.siger_automation_fixture_tools.FirstOrDefault(q => q.projectId == projectid && (q.name == item.Name || q.code == item.Code || q.partnumber == item.PartNumber));
if (data != null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
if (list.Count(q => q.Name == item.Name || q.Code == item.Code || q.PartNumber == item.PartNumber) > 1)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
var category = _context.siger_automation_fixture_tools_category.FirstOrDefault(q => q.name == item.Catgeory && q.projectId == projectid && q.status == (int)RowState.Valid);
if (category == null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.FixtureToolCatgeoryNotFound}");
}
if (errors.Any())
{
return new CommonImportResult(0, string.Join(";", errors));
}
var entity = new siger_automation_fixture_tools
{
guid = Guid.NewGuid().ToString(),
category = category.guid,
managetype = item.Manage == "单件" ? 1 : 2,
partnumber = item.PartNumber,
name = item.Name,
specification = item.Specfication,
number = item.Number.ToInt(),
remark = item.Remark,
attachment = "",
filename = "",
code = item.Code,
projectId = projectid,
status = item.Status == "可用" ? (int)RowState.Valid : (int)RowState.Invalid,
createtime = DateTime.Now,
updatetime = DateTime.Now,
creator = userid,
updator = userid,
};
entities.Add(entity);
}
try
{
_context.siger_automation_fixture_tools.AddRange(entities);
_context.SaveChanges();
return new CommonImportResult(1, "1");
}
catch (Exception e)
{
Logger.WriteLineError(e.Message);
throw;
}
}
}
}
......@@ -7,9 +7,12 @@ using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Log;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
namespace Siger.Middlelayer.AccRepository.Repositories
{
......@@ -21,18 +24,16 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize)
public IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize, string toexcel)
{
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid
join l in _context.siger_wms_storage_location on q.locationid equals l.locationid
join l in _context.siger_wms_storage_location on q.location_cid equals l.id
join w in _context.siger_wms_storage on l.storageid equals w.id
join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty()
join m in _context.siger_automation_fixture_tools_moniter on q.fixturetools equals m.fixtureguid into mm
from m in mm.DefaultIfEmpty()
join r in _context.siger_project_product_route on m.route equals r.id into rr
join r in _context.siger_project_beat_set on q.routeid equals r.id into rr
from r in rr.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocation
......@@ -54,9 +55,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
updator = u.name ?? "",
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
sn = m.sn ?? "",
route = r.name ?? "",
routenumber = r == null ? "" : r.serialNumber.ToString(),
sn = q.sn ?? "",
route = r.route_name ?? "",
routenumber = r == null ? "" : r.route_number.ToString(),
cate_guid = c.guid ?? "",
categoryId = c == null ? 0 : c.id
};
......@@ -71,9 +72,17 @@ namespace Siger.Middlelayer.AccRepository.Repositories
locationidExpression = q => q.locationid == locationid;
}
var expression = wavehouseidExpression.And(locationidExpression);
var entities = query.Where(expression).OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAutomationLocation>(entities, totalCount);
if(toexcel.ToInt() == 1)
{
var entities = query.Where(expression).OrderByDescending(q => q.id).AsNoTracking().ToList();
return new PagedCollectionResult<ResponseAutomationLocation>(entities, entities.Count);
}
else
{
var entities = query.Where(expression).OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAutomationLocation>(entities, totalCount);
}
}
public siger_wms_storage_location GetLocation(int id, int projectid)
......@@ -91,10 +100,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var query = from q in _context.siger_automation_location
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join c in _context.siger_automation_fixture_tools_category on t.category equals c.guid
join l in _context.siger_wms_storage_location on q.locationid equals l.locationid
join l in _context.siger_wms_storage_location on q.location_cid equals l.id
join w in _context.siger_wms_storage on l.storageid equals w.id
join m in _context.siger_automation_fixture_tools_moniter on q.fixturetools equals m.fixtureguid into mm
from m in mm.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocationList
{
......@@ -109,11 +116,84 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid = t.id,
code = t.code,
name = t.name,
materialsn = m.sn ?? "",
materialsn = q.sn ?? "",
categoryid = c == null ? 0 : c.id
};
var entities = query.AsNoTracking().ToList();
return entities;
}
public CommonImportResult ImportData(IEnumerable<AutomationLocationTemplate> list, int projectid, int userid)
{
var errors = new List<string>();
var rowIndex = 1;
var entities = new List<siger_automation_location>();
foreach (var item in list)
{
rowIndex++;
if (string.IsNullOrEmpty(item.LocationId) || string.IsNullOrEmpty(item.FixtureTool))
{
errors.Add($"{rowIndex},{(int)RequestEnum.ParameterMiss}");
}
var fixturetool = _context.siger_automation_fixture_tools.FirstOrDefault(q => q.name == item.FixtureTool && q.projectId == projectid);
if (fixturetool == null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.FixtureToolNotFound}");
}
var warehouse = _context.siger_wms_storage.FirstOrDefault(q => q.status == (int)RowState.Valid && q.projectId == projectid && q.name == item.Warehouse);
if(warehouse == null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.WaveHouseIDNotExist}");
}
var location = _context.siger_wms_storage_location.FirstOrDefault(q => q.locationid == item.LocationId.ToInt() && q.storageid == warehouse.id && q.projectId == projectid && q.status == (int)RowState.Valid);
if (location == null || item.LocationId.ToInt() <= 0)
{
errors.Add($"{rowIndex},{(int)RequestEnum.LocationNull}");
}
var exsit = _context.siger_automation_location.FirstOrDefault(q => q.projectId == projectid && q.status == (int)RowState.Valid &&
(q.fixturetools == fixturetool.guid || q.locationid == item.LocationId.ToInt()));
if (exsit != null)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
if (list.Count(q => q.FixtureTool == item.FixtureTool || q.LocationId == item.LocationId) > 1)
{
errors.Add($"{rowIndex},{(int)RequestEnum.DataExist}");
}
if (errors.Any())
{
return new CommonImportResult(0, string.Join(";", errors));
}
var entity = new siger_automation_location
{
guid = Guid.NewGuid().ToString(),
locationid = location.id,
fixturetools = fixturetool.guid,
attachment = "",
filename = "",
remark = item.Remark,
projectId = projectid,
updatetime = DateTime.Now,
updator = userid,
};
entities.Add(entity);
}
try
{
_context.siger_automation_location.AddRange(entities);
_context.SaveChanges();
return new CommonImportResult(1, "1");
}
catch (Exception e)
{
Logger.WriteLineError(e.Message);
throw;
}
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Linq.Expressions;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationMachineStatusRepository : AccRepositoryBase<siger_automation_machine_status>, IAutomationMachineStatus
{
private ApiAccDbContext _context;
public AutomationMachineStatusRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
public IEnumerable<ResponseAutomationMachineStatus> GetSectionStatus(int projectId, int section,List<int>sections)
{
var data = from atr in _context.siger_project_machine_attribution
join lv in _context.siger_project_level_section on atr.station equals lv.id
join ms in _context.siger_automation_machine_status on lv.id equals ms.section into mstemp
join plv in _context.siger_project_level_section on lv.parentid equals plv.id
from ms in mstemp.DefaultIfEmpty()
select new ResponseAutomationMachineStatus
{
sectionid = lv.id,
section =$"{ plv.title}-{lv.title}",
lastupdate = ms!=null? ms.updatetime.ToString():"",
enable =ms!=null? ms.enable:1,
status =ms!=null? ms.status:1,
};
Expression<Func<ResponseAutomationMachineStatus, bool>> sectionsExpression = f => true;
if (sections.Any())
{
sectionsExpression = q =>sections.Contains(q.sectionid);
}
return data.Where(sectionsExpression);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Share.Enum.ModuleEnum;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
......@@ -23,7 +27,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public bool CanTask(int projectId,int section)
{
var taskObj = _context.siger_automation_task_list.FirstOrDefault(f => f.projectId == projectId && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
//已经下发,并且任务完成
var taskObj = _context.siger_automation_task_list.FirstOrDefault(f => f.projectId == projectId && f.send==1 && f.status < (int)TaskResultStatus.Complated);
if (taskObj==null)
return true;
......@@ -36,14 +41,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{
var date = DateTime.Now;
var lable = date.ToString(UnixTimeHelper.DateTimeFormatYmd)+date.Hour + date.Minute + date.Second + date.Millisecond;
var lableUnix = UnixTimeHelper.GetNow();
var radon = new Random().Next(1000, 9999);
if (trigerType== TaskTrigerType.Auto)
{
return $"A{radon}T{lable}";
return $"A{lableUnix}R{radon}T{lable}";
}else
{
return $"M{radon}T{lable}";
return $"M{lableUnix}R{radon}T{lable}";
}
}
......@@ -55,5 +60,88 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var randon = new Random().Next(1000, 9999);
return $"{productCode}{date.ToString(UnixTimeHelper.DateTimeFormatYmd)}{serinum}{randon}";
}
public IPagedCollectionResult<ResponseAutomationTasklist> GetTasklistPagedList(List<int> sections, int taskType, string productCode, string TaskNo, string sn, int status, int actionType, string tiggertime, string comptime, int projectid, int page, int pagesize)
{
var query = from q in _context.siger_automation_task_list
join t in _context.siger_automation_fixture_tools on q.fixtureguid equals t.guid
join s in _context.siger_project_level_section on q.sectionid equals s.id
join lv in _context.siger_project_level_section on s.parentid equals lv.id
where q.projectId == projectid
select new ResponseAutomationTasklist
{
taskno=q.no,
sectionid= q.sectionid,
section=$"{lv.title}-{s.title}",
trigger =EnumHelper.GetEnumDesc(q.trigger),
triggervalue=q.triggertime,
triggerTime=q.triggertime==DateTime.MinValue?"":q.triggertime.ToString(),
complatevalue=q.completetime,
complatetime=q.completetime==DateTime.MinValue?"":q.completetime.ToString(),
action=EnumHelper.GetEnumDesc(q.action),
actionType=EnumHelper.GetEnumDesc(q.actiontype),
fixtureCode=t.code,
fixtureName=t.name,
location=q.locationid.ToString(),
sn=q.sn,
ordernumber=q.ordercode,
productCode=q.productcode,
program=q.programnumber,
route=q.remark,
tasktype=EnumHelper.GetEnumDesc(q.tasktype),
status=q.status,
};
Expression<Func<ResponseAutomationTasklist, bool>> sectonsExpression = f => true;
if (sections.Any())
{
sectonsExpression = q =>sections.Contains( q.sectionid );
}
Expression<Func<ResponseAutomationTasklist, bool>> taskTypeExpression = f => true;
if (taskType != 0 )
{
taskTypeExpression = q => q.tasktypeid == taskType;
}
Expression<Func<ResponseAutomationTasklist, bool>> productCodeExpression = f => true;
if (!string.IsNullOrEmpty(productCode))
{
productCodeExpression = q => q.productCode.Contains(productCode);
}
Expression<Func<ResponseAutomationTasklist, bool>> tasknoExpression = f => true;
if (!string.IsNullOrEmpty(TaskNo))
{
tasknoExpression = q => q.taskno.Contains(TaskNo);
}
Expression<Func<ResponseAutomationTasklist, bool>> snExpression = f => true;
if (!string.IsNullOrEmpty(sn))
{
snExpression = q => q.sn.Contains(sn);
}
Expression<Func<ResponseAutomationTasklist, bool>> actionTypeExpression = f => true;
if (actionType!=0)
{
actionTypeExpression = q => q.actionTypeid==actionType;
}
Expression<Func<ResponseAutomationTasklist, bool>> triggerTimeTypeExpression = f => true;
if (string.IsNullOrEmpty(tiggertime))
{
triggerTimeTypeExpression = q => q.triggervalue == tiggertime.ToDateTime();
}
Expression<Func<ResponseAutomationTasklist, bool>> comptimeExpression = f => true;
if (actionType != 0)
{
comptimeExpression = q => q.complatevalue == comptime.ToDateTime();
}
var expression = sectonsExpression.And(taskTypeExpression).And(productCodeExpression).And(tasknoExpression).And(snExpression)
.And(actionTypeExpression).And(triggerTimeTypeExpression).And(comptimeExpression);
var entities = query.Where(expression).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(expression).Count();
return new PagedCollectionResult<ResponseAutomationTasklist>(entities, totalCount);
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.Common;
using System.Linq;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
internal class CheckSnListRepository : AccRepositoryBase<siger_check_sn_list>, ICheckSnListRepository
{
private readonly ApiAccDbContext _context;
public CheckSnListRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
public SigerTrRoutingEventNo GetEventNoByResult(string result, int projectId)
{
return _context.siger_tr_routing_eventno.FirstOrDefault(t => t.projectId == projectId &&
t.status == (int)RowState.Valid && t.Descr == result);
}
public SigerTrRoutingOutStation GetOutStationByEventNo(int eventno, int sectionId, int projectId)
{
return _context.siger_tr_routing_outstation.FirstOrDefault(t => t.projectId == projectId &&
t.status == (int)RowState.Valid && t.EventNo == eventno && t.Station == sectionId);
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class CheckSnTraceDetailRepository : AccRepositoryBase<siger_check_sn_trace_detail>, ICheckSnTraceDetailRepository
{
private readonly ApiAccDbContext _context;
public CheckSnTraceDetailRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class CheckSnTraceFileRepository : AccRepositoryBase<siger_check_sn_trace_file>, ICheckSnTraceFileRepository
{
private readonly ApiAccDbContext _context;
public CheckSnTraceFileRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class CheckSnTraceInspectionRepository : AccRepositoryBase<siger_check_sn_trace_inspection>, ICheckSnTraceInspectionRepository
{
private readonly ApiAccDbContext _context;
public CheckSnTraceInspectionRepository(ApiAccDbContext context) : base(context)
{
_context = context;
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Repository.Response;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class InspectStandardRepository : AccRepositoryBase<siger_qms_inspection_standard>, IInspectStandardRepository
{
private ApiAccDbContext accDbContext;
private ApiAccDbContext _context;
public InspectStandardRepository(ApiAccDbContext context) : base(context)
{
accDbContext = context;
_context = context;
}
public ResponseIdName GetMachineBySectionId(int sectionId, int projectId)
{
var query = _context.siger_project_machine_attribution.FirstOrDefault(q =>
q.station == sectionId && q.status == (int)RowState.Valid && q.attribution == (int)MachineAttributionEnum.equipment);
if (query == null)
{
return null;
}
var machine = _context.siger_project_machine.FirstOrDefault(q =>
q.projectid == projectId && q.status == (int)RowState.Valid
&& q.id == query.machine);
if (machine == null)
{
return null;
}
return new ResponseIdName { id = machine.id, name = machine.title };
}
}
}
......@@ -2,14 +2,17 @@
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsAssemblyRepository : IAccRepositoryBase<siger_automation_fixture_tools_assembly>
{
IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int category, string code, string name, int projectid, int page, int pagesize);
IPagedCollectionResult<ResponseAumationFixtureToolsAssemblys> GetPagedList(int category, string code, string name, string state, int projectid, int page, int pagesize, string toexcel = "");
IEnumerable<ResponseAumationFixtureToolsAssembly> GetDetailList(string parent, int projectid);
IEnumerable<ResponseAumationFixtureToolsAssembly> GetDetailList(string parent, int category, string code, string name, string state, int projectid);
CommonImportResult ImportData(IEnumerable<FixtureToolsAssmeblyTemplate> list, int projectid, int userid);
}
}
......@@ -2,11 +2,15 @@
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsCategoryRepository : IAccRepositoryBase<siger_automation_fixture_tools_category>
{
IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize, string toexcel = "");
IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(List<int> id, int projectid, int page, int pagesize, string toexcel = "");
CommonImportResult ImportData(IEnumerable<FixtureToolsCategoryTemplate> list, int projectid);
}
}
......@@ -2,12 +2,14 @@
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsProductRepository : IAccRepositoryBase<siger_automation_fixture_tools_product>
{
IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize);
IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize, string toexcel);
ResponseProductFixtureInfo GetFixtureInfoByProductCode(int projectId, string productCode);
......@@ -19,5 +21,15 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <returns></returns>
ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber);
CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid);
/// <summary>
/// 获取交期最近的订单
/// </summary>
/// <param name="productIds"></param>
/// <param name="projectId"></param>
/// <returns></returns>
IEnumerable<ResponseAutomationPlanOrder> GetDeliveryOrder(List<int> productIds, int projectId);
}
}
......@@ -2,17 +2,20 @@
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureToolsRepository : IAccRepositoryBase<siger_automation_fixture_tools>
{
IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
IPagedCollectionResult<ResponseFixtureTools> GetPagedList(List<int> category, string code, string name, int state,
int projectid, int page, int pagesize, string toexcel = "");
IEnumerable<ResponseFixtureTools> GetDataList(int categoryid, int projectid);
IEnumerable<ResponseFixtureTools> GetDataList(List<int> categoryid, int projectid);
ResponseProductFixtureInfo GetProductFixtureLocation(int projectId, string guid);
CommonImportResult ImportData(IEnumerable<FixtureToolsTemplate> list, int projectid, int userid);
}
}
......@@ -2,13 +2,14 @@
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
using Siger.Middlelayer.Utility.ImportEntities;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationLocationRepository : IAccRepositoryBase<siger_automation_location>
{
IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize);
IPagedCollectionResult<ResponseAutomationLocation> GetPagedList(int wavehouseid, int locationid, int projectid, int page, int pagesize, string toexcel);
siger_wms_storage_location GetLocation(int id, int projectid);
......@@ -16,5 +17,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid);
IEnumerable<siger_wms_storage_location> GetLocationList(int projectid);
CommonImportResult ImportData(IEnumerable<AutomationLocationTemplate> list, int projectid, int userid);
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Response;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -7,5 +8,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationMachineStatus: IAccRepositoryBase<siger_automation_machine_status>
{
IEnumerable<ResponseAutomationMachineStatus> GetSectionStatus(int projectId, int section, List<int> sections);
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged;
using System.Collections.Generic;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
......@@ -10,7 +12,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <summary>
/// 是否能创建任务
/// 上下料时候是否能创建任务
/// </summary>
/// <param name="projectId"></param>
/// <param name="section"></param>
......@@ -22,5 +24,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// </summary>
/// <returns></returns>
string CreateRandonSn(string productCode);
IPagedCollectionResult<ResponseAutomationTasklist> GetTasklistPagedList(List<int> sections, int taskType, string productCode, string TaskNo, string sn, int status, int actionType, string tiggertime, string comptime, int projectid, int page, int pagesize);
}
}
using Siger.Middlelayer.AccRepository.Entities;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface ICheckSnListRepository : IAccRepositoryBase<siger_check_sn_list>
{
SigerTrRoutingEventNo GetEventNoByResult(string result, int projectId);
SigerTrRoutingOutStation GetOutStationByEventNo(int eventno, int sectionId, int projectId);
}
}
using Siger.Middlelayer.AccRepository.Entities;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface ICheckSnTraceDetailRepository : IAccRepositoryBase<siger_check_sn_trace_detail>
{
}
}
using Siger.Middlelayer.AccRepository.Entities;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface ICheckSnTraceFileRepository : IAccRepositoryBase<siger_check_sn_trace_file>
{
}
}
using Siger.Middlelayer.AccRepository.Entities;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface ICheckSnTraceInspectionRepository : IAccRepositoryBase<siger_check_sn_trace_inspection>
{
}
}
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.Repository.Response;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -7,5 +8,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IInspectStandardRepository : IAccRepositoryBase<siger_qms_inspection_standard>
{
ResponseIdName GetMachineBySectionId(int sectionId, int projectId);
}
}
using System;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Request
{
public class RequestAddDataCollection
{
public List<DataCollectionDetail> details { get; set; } = new List<DataCollectionDetail>();
public int productid { get; set; }
public string materialid { get; set; }
public int sectionid { get; set; }
public string routeid { get; set; }
public string workorder { get; set; }
public string sn { get; set; }
public string result { get; set; }
public int checktype { get; set; }
public string reason { get; set; }
public string number { get; set; }
public string quantity { get; set; }
}
public class DataCollectionDetail
{
public int index { get; set; }
public int id { get; set; }
public int itemid { get; set; }
public int checktype { get; set; }
public string result { get; set; }
public double? value { get; set; }
public double? lowerlimit { get; set; }
public double? upperlimit { get; set; }
}
}
......@@ -148,5 +148,18 @@ namespace Siger.Middlelayer.AccRepository.Response
public List<ResponseAumationFixtureToolsAssembly> childrens { get; set; }
public string remark { get; set; }
public string parentcategory { get; set; }
public string parentpartnumber { get; set; }
public string parentspecfication { get; set; }
public string parentcode { get; set; }
}
public class ResponseAumationFixtureToolsAssemblys : ResponseAumationFixtureToolsAssembly
{
public string son_code { get; set; }
public string son_name { get; set; }
public int son_categoryid { get; set; }
public int son_status { get; set; }
}
}
......@@ -28,4 +28,19 @@ namespace Siger.Middlelayer.AccRepository.Response
/// </summary>
public string fixture { get; set; }
}
public class ResponseAutomationLocationRouteInfo
{
public string fixture { get; set; }
public string fixturename { get; set; }
public string ordernumber { get; set; }
public string sn { get; set; }
public int location { get; set; }
public int productId { get; set; }
public string productCode { get; set; }
public string productName { get; set; }
public string route { get; set; }
public string pn { get; set; }
}
}
......@@ -8,9 +8,12 @@ namespace Siger.Middlelayer.AccRepository.Response
{
public int id { get; set; }
/// <summary>
/// 储位位置
/// 储位自增ID
/// </summary>
public int locationid { get; set; }
/// <summary>
/// 储位填写ID
/// </summary>
public int locaid { get; set; }
public string location { get; set; }
public int wavehouseid { get; set; }
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseAutomationMachineStatus
{
public int sectionid { get; set; }
public string section { get; set; }
// public string machine { get; set; }
public string product { get; set; }
public string fixtureCode { get; set; }
public string fixtureName { get; set; }
public int location { get; set; }
public string sn { get; set; }
public int enable { get; set; }
public int status { get; set; }
public string lastupdate { get; set; }
}
public class ResponseAutomationMachineStatusTotal
{
public int waittingTotal { get; set; }
public int produceTotal { get; set; }
public int complateTotal { get; set; }
public int disableTotal { get; set; }
}
public class ResponseMachineMonitor
{
public ResponseAutomationMachineStatusTotal sum { get; set; }
public List<ResponseAutomationMachineStatus> dts { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseAutomationTasklist
{
public string taskno { get; set; }
public int sectionid { get; set; }
public string section { get; set; }
/// <summary>
/// 触发方式
/// </summary>
public string trigger { get; set; }
public int tasktypeid { get; set; }
/// <summary>
/// 任务类型
/// </summary>
public string tasktype { get; set; }
public string sn { get; set; }
public string ordernumber { get; set; }
public string productCode { get; set; }
public string productName { get; set; }
public string routeNo { get; set; }
public string route { get; set; }
public string program { get; set; }
/// <summary>
/// 储位ID
/// </summary>
public string location { get; set; }
public string fixtureCode { get; set; }
public string fixtureName { get; set; }
public string action { get; set; }
public int actionTypeid { get; set; }
/// <summary>
/// 执行类型
/// </summary>
public string actionType { get; set; }
public int status { get; set; }
public DateTime triggervalue { get; set; }
public string triggerTime { get; set; }
public DateTime? complatevalue { get; set; }
public string complatetime { get; set; }
}
}
......@@ -40,4 +40,15 @@ namespace Siger.Middlelayer.AccRepository.Response
public int Location { get; set; }
public string Sn { get; set; }
}
public class ResponseAutomationPlanOrder
{
public string ordernumber { get; set; }
public int productId { get; set; }
public string productCode { get; set; }
public string productName { get; set; }
public int delvery { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class SnTrace
{
public string ID { get; set; }
public int ProductID { get; set; }
public int MaterialID { get; set; }
public int SectionID { get; set; }
public int MachineID { get; set; }
public string WorkOrder { get; set; }
public string SN { get; set; }
public string Result { get; set; }
public int UserID { get; set; }
public int RouteID { get; set; }
public DateTime CreateTime { get; set; }
public int CheckType { get; set; }
public string ItemName { get; set; } = string.Empty;
}
public class SnTraceDetail
{
public long ID { get; set; }
public string TraceID { get; set; }
public int ItemID { get; set; }
public string ItemName { get; set; } = string.Empty;
public string Result { get; set; }
public double? Value { get; set; }
public string SN { get; set; }
}
public class SnTraceDetailList : SnTraceDetail
{
public int NumberIndex { get; set; }
public double? LowerLimit { get; set; }
public double? UpperLimit { get; set; }
}
}
......@@ -157,5 +157,7 @@ namespace Siger.Middlelayer.QmsRepository
public DbSet<siger_tr_sn_trace_detail> siger_tr_sn_trace_detail { get; set; }
public DbSet<siger_project_beat_set> siger_project_beat_set { get; set; }
}
}
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Siger.Middlelayer.QmsRepository.Entities
{
/// <summary>
/// siger_project_beat_set Entity Model
/// </summary>
public class siger_project_beat_set: QmsEntityBase
{
/// <summary>
/// 产线id
/// </summary>
public int section_id { get; set; }
/// <summary>
/// 设备id
/// </summary>
public int machineID { get; set; }
/// <summary>
/// 加工程序号
/// </summary>
public string process_number { get; set; }
/// <summary>
/// 产品名称 编号
/// </summary>
public string product_name { get; set; }
/// <summary>
/// 产品图纸号
/// </summary>
public string drawing_number { get; set; }
/// <summary>
/// 标准节拍(单位/ 秒 S )
/// </summary>
public int standard_besat { get; set; }
/// <summary>
/// 日标准产量(单位/pcs个)
/// </summary>
public int daily_standard_output { get; set; }
/// <summary>
/// 添加时间
/// </summary>
public DateTime add_time { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime? edit_time { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string product_name_text { get; set; }
/// <summary>
/// 换型时间
/// </summary>
public int changemodeltime { get; set; }
/// <summary>
/// 工序顺序
/// </summary>
public string route_number { get; set; } = "";
/// <summary>
/// 工序名称
/// </summary>
public string route_name { get; set; }
/// <summary>
/// 上下料时间
/// </summary>
public double updown_besat { get; set; }
/// <summary>
/// 产量比率
/// </summary>
public int yieldrate { get; set; }
/// <summary>
/// 有效开始时间
/// </summary>
public DateTime start_time { get; set; }
/// <summary>
/// 有效结束时间
/// </summary>
public DateTime end_time { get; set; }
}
}
......@@ -38,7 +38,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
from m in mm.DefaultIfEmpty()
join s in _context.siger_project_level_section on q.sectionid equals s.id into ss
from s in ss.DefaultIfEmpty()
join r in _context.siger_project_product_route on q.routeid equals r.id into rr
join r in _context.siger_project_beat_set on q.routeid equals r.id into rr
from r in rr.DefaultIfEmpty()
join u1 in _context.siger_project_user on q.send_mid equals u1.mid into uu1
from u1 in uu1.DefaultIfEmpty()
......@@ -60,7 +60,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
check_time = (q.check_time.HasValue && q.check_time != DateTime.Now) ?
q.check_time.Value.ToString(ParameterConstant.DateTimeFormat) : "",
routeid = q.routeid,
routename = r.name ?? "",
routename = r.route_name ?? "",
materialid = q.materialid,
materialname = m.name ?? "",
materialpn = m.pn ?? "",
......
......@@ -34,7 +34,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
join s in _context.siger_project_level_section on q.sectionid equals s.id
join m in _context.siger_tr_materials on q.materialid equals m.id into mm
from m in mm.DefaultIfEmpty()
join r in _context.siger_project_product_route on q.routeid equals r.id into rr
join r in _context.siger_project_beat_set on q.routeid equals r.id into rr
from r in rr.DefaultIfEmpty()
join u1 in _context.siger_user on q.send_mid equals u1.id into uu1
from u1 in uu1.DefaultIfEmpty()
......@@ -58,7 +58,7 @@ namespace Siger.Middlelayer.QmsRepository.Repositories
sectionid = q.sectionid,
sectionname = s.title ?? "",
routeid = q.routeid,
routename = r.name ?? "",
routename = r.route_name ?? "",
testroom = q.testroom,
sn = q.sn,
checktype = q.check_type,
......
......@@ -18,5 +18,10 @@ namespace Siger.Middlelayer.Repository.Response
/// 上料位状态
/// </summary>
public int status { get; set; }
/// <summary>
/// 1 :可以上料 2:可以下料
/// </summary>
public int upload { get; set; }
}
}
......@@ -267,8 +267,20 @@ CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_product` (
-- ----------------------------
CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`location_cid` int(11) NOT NULL DEFAULT 0 COMMENT '储位自增ID',
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`fixturename` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品name',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件对应工单号',
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工件',
`routeid` int(11) NULL DEFAULT 0,
`route` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工序',
`routenum` int(11) NULL DEFAULT 0 COMMENT '工序顺序',
`attachment` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
`filename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件名称',
`remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
......@@ -325,6 +337,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`no` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`fixturename` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装name',
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方',
`tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型',
......@@ -332,6 +345,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`ordercode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工单号',
`productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '产品CODE',
`productname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '产品NAME',
`processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID',
`programnumber` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '程序号',
`locationid` int(11) NOT NULL COMMENT '储位位置',
......@@ -395,7 +409,7 @@ CREATE TABLE `siger_automation_produce_history` (
`statusid` int(11) NOT NULL DEFAULT 0 COMMENT '设备状态ID',
`section` int(11) NOT NULL DEFAULT 0 COMMENT '产线ID',
`projectid` int(11) NOT NULL DEFAULT 0,
`productid` int(1) NOT NULL DEFAULT 1 COMMENT '产品ID',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品编号',
`productname` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位ID',
......@@ -426,6 +440,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
`createtime` datetime(0) NULL DEFAULT NULL COMMENT '添加时间',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
`ordernumber` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工令单',
`productid` int(11) NULL DEFAULT 0 COMMENT '产品ID',
`productCode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`productName` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
`locationId` int(11) NOT NULL DEFAULT 0,
......
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