Commit 8c64b072 by yucheng.jiang
parents feb3ed4d 14b8e12a
......@@ -5,7 +5,7 @@
<div class="choose">
<p class="selectTitle">
1.请选择生产线
<span class="red">*</span>
<!-- <span class="red">*</span> -->
</p>
<div class="row">
<p
......@@ -19,17 +19,14 @@
</p>
</div>
<div class="choose">
<p class="selectTitle">
2.上下料工位
<span class="red">*</span>
</p>
<p class="selectTitle">2.上下料工位</p>
<div class="row">
<div
:key="index"
class="options2"
v-for="(item, index) in stationList"
@click="change(index)"
:class="{ active: a == index }"
@click="change2(index)"
:class="{ active: b == index }"
>
<p>{{ item.title }}</p>
<p>{{ item.status == 1 ? "待上料" : "运行中" }}</p>
......@@ -37,18 +34,19 @@
</div>
</div>
<div class="choose">
<p class="selectTitle">
3.操作
<span class="red">*</span>
</p>
<p class="selectTitle">3.操作</p>
<Tabs type="card">
<TabPane label="上料" :disabled="attr1">
<div class="filter">
<label style="font-size: 16px"
>上料信息:</label
>
<Input type="text" class="searchInput"
style="width: 300px"/>
<Input
type="text"
class="searchInput"
style="width: 300px"
@keyup.enter="getWorkOrderInfo()"
/>
</div>
<div class="row">
<p class="flex">
......@@ -149,8 +147,16 @@
</p>
</div>
<div>
<Button type="primary">准备上料</Button>
<Button type="primary">安装完成</Button>
<Button
type="primary"
@click="feedReady()"
>准备下料</Button
>
<Button
type="primary"
@click="installOver()"
>拆卸完成</Button
>
</div>
</div>
</div></TabPane
......@@ -199,6 +205,7 @@ export default {
productionLine: [],
stationList: [],
a: -1,
b: -1,
attr1: false, //上料、下料、上下料
attr2: false, //上料、下料、上下料
modal: false,
......@@ -209,26 +216,26 @@ export default {
render: (h, params) => {
return h(
"span",
params.index + (this.page - 1) * this.pagesize + 1
params.index + 1
);
},
width: 70,
},
{
title: "仓库",
key: "warehouse",
key: "wavehouse",
},
{
title: "储位编号",
key: "storage_sn",
key: "locationcode",
},
{
title: "工装编号",
key: "install_sn",
key: "code",
},
{
title: "工件编号",
key: "workpiece_sn",
key: "materialsn",
},
],
data1: [],
......@@ -239,22 +246,22 @@ export default {
render: (h, params) => {
return h(
"span",
params.index + (this.page - 1) * this.pagesize + 1
params.index+ 1
);
},
width: 70,
},
{
title: "储位编号",
key: "storage_sn",
key: "locationcode",
},
{
title: "工装编号",
key: "install_sn",
key: "code",
},
{
title: "工件编号",
key: "workpiece_sn",
key: "materialsn",
},
],
data2: [],
......@@ -262,6 +269,7 @@ export default {
},
created() {
this.getProLine();
this.getStorages();
},
mounted() {
// this.getStations()
......@@ -303,11 +311,22 @@ export default {
this.a = i;
this.getStations(this.productionLine[i].id);
},
change2(index) {
this.b = index;
let status = this.stationList[index].status;
if (status == 1) {
this.attr2 = true;
}
},
//获取储位
getStorages() {
this.request("", "", "")
this.request("/acc/AutomationLocation/GetLocationList", "", "get")
.then((res) => {
console.log(res.data.data);
if (res.data.ret == 1) {
this.data1 = res.data.data;
this.data2 = res.data.data;
}
})
.catch((err) => {
......@@ -325,6 +344,33 @@ export default {
console.log(err);
});
},
feedReady() {
// 准备上料
let data = {
section: 13,
code: "234324",
};
this.request("/acc/AutomationOperate/Loading", data, "post").thne((res) => {
if (res.data.ret == 1) {
}
});
},
installOver() {
// 安装完成
let data = {
section: 13
};
this.request("", data, "post").thne(
(res) => {
if (res.data.ret == 1) {
}
}
);
},
request(url, data, type) {
if (type == "get") {
return this.axios
......
......@@ -15,7 +15,17 @@
</Select>
</div>
<div class="filter">
<label>夹具类型:</label>
<label>工装编号:</label>
<Select
label-in-value
clearable
filterable
class="searchSelect"
>
</Select>
</div>
<div class="filter">
<label>状态:</label>
<Select
label-in-value
clearable
......@@ -112,8 +122,9 @@
export default {
data() {
return {
columns1: [
columns1:[
{
type: "index2",
title: this.$t("1008"),
key: "xuhao",
render: (h, params) => {
......@@ -122,13 +133,90 @@ export default {
params.index + (this.page - 1) * this.pagesize + 1
);
},
width: 70,
},
{
title: this.$t("100089"),
key: "productcode",
minWidth: 150,
title:'工装类型',
key:'category'
},
{
title:'管理类型',
key:'managetype',
render:(h,params)=>{
let str = '';
if(params.row.managetype===1){
str = '单件';
}else if(params.row.managetype===2){
str = '批次';
}
return h('span',str);
}
},
{
title:'工装料号',
key:'partnumber'
},
{
title:'工装名称',
key:'name'
},
{
title:'工装编号',
key:'code'
},
{
title:'规格型号',
key:'specification'
},
{
title:'数量',
key:'number'
},
{
title:'状态',
key:'status',
render:(h,params)=>{
let str = '';
if(params.row.status===1){
str = '可用';
}else{
str = '停用';
}
return h('span',str);
}
},
{
title:'备注',
key:'remark'
},
{
title:'附件',
key:'filename',
render:(h,params)=>{
return h('span',{
style:{
color:'#2b85e4',
cursor:'pointer'
},
on:{
click:()=>{
let name = params.row.filename;
let url = params.row.fileurl;
if(url){
this.downFile(url,name);
}
}
}
},params.row.filename);
}
},
{
title:'维护人',
key:'updator'
},
{
title:'维护时间',
key:'updatetime'
}
],
data1: [],
total: 0,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -23,7 +23,6 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly ISigerTrMaterialsRepository _materialsRepository;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository)
......@@ -90,7 +89,7 @@ namespace Siger.ApiACC.Controllers
[HttpPost]
public IActionResult Update([FromBody]RequestUpdateAutomationLocation req)
{
if (string.IsNullOrEmpty(req.locationid) || string.IsNullOrEmpty(req.fixturetoolid) || string.IsNullOrEmpty(req.materialid))
if (string.IsNullOrEmpty(req.locationid) || string.IsNullOrEmpty(req.fixturetoolid))
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Request;
......@@ -28,8 +29,13 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationMachineStatus _automationMachineStatus;
private readonly ISigerProjectMachineAttributionRepository _sigerProjectMachineAttribution;
private readonly IAutomationTaskListRepository _automationTaskList;
private readonly IProductPlanDetails _planDetails;
private readonly IProductPlanRepository _productPlan;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList)
public AutomationOperateController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection , ISigerDict sigerDict,IAutomationMachineStatus automationMachineStatus,ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution,IAutomationTaskListRepository automationTaskList,
IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct)
{
_unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection;
......@@ -37,6 +43,10 @@ namespace Siger.ApiACC.Controllers
_automationMachineStatus = automationMachineStatus;
_sigerProjectMachineAttribution = sigerProjectMachineAttribution;
_automationTaskList = automationTaskList;
_planDetails = planDetails;
_productPlan = productPlan;
_automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct;
}
/// <summary>
......@@ -163,11 +173,29 @@ namespace Siger.ApiACC.Controllers
{
throw new BadRequestException(AccEnum.TaskProcessing);
}
var plandts = _planDetails.Get(f => f.projectId == ProjectId && f.OrderNumber == loading.code);
if (plandts==null)
{
throw new BadRequestException(CncEnum.PlanHasExist);
}
var plan = _productPlan.Get(f => f.id == plandts.PlanId);
if (plan == null)
{
throw new BadRequestException(CncEnum.PlanHasExist);
}
//检查工装
var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code);
if (fixtureToolsObj == null)
{
throw new BadRequestException(AccEnum.FixtureToolsIsNone);
}
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
var sn = _automationTaskList.CreateRandonSn(plan.product_code);
_automationTaskList.Insert(new siger_automation_task_list
{
guid=taskNo,
no=taskNo,
action= Automation.TaskAction.Step_LK_SXLW,
actiontype= Automation.ExcueType.None,
triggertime=DateTime.MinValue,
......@@ -180,10 +208,42 @@ namespace Siger.ApiACC.Controllers
completetime=DateTime.MinValue,
trigger= Automation.TaskTrigerType.Manual,
projectId=ProjectId,
remark="手动任务",
productid=plan.product_id,
sn=sn,
ordercode=plandts.OrderNumber,
fixtureguid= fixtureToolsObj.FixtureGuid,
locationid=fixtureToolsObj.Location,
remark ="手动任务",
});
var monitor = _automationFixtureMonitor.Get(f => f.fixtureguid == fixtureToolsObj.FixtureGuid);
if (monitor==null)
{
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
{
fixtureguid=fixtureToolsObj.FixtureGuid,
projectId=ProjectId,
section=loading.section,
sn=sn,
createtime=DateTime.Now,
updatetime=DateTime.Now,
status=(int)Automation.MachineStatus.Produce,
});
}
else
{
monitor.sn = sn;
monitor.section = loading.section;
monitor.updatetime = DateTime.Now;
monitor.status = (int)Automation.MachineStatus.Produce;
_automationFixtureMonitor.Update(monitor);
}
if (_unitOfWork.Commit() > 0)
return new ObjectResult(CommonEnum.Succefull);
else
......
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc;
using Siger.ApiCommon.Result;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Repository.Repositories.Interface;
using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Extensions;
using System.Linq;
using Siger.Middlelayer.Repository.Entities;
namespace Siger.ApiACC.Controllers
{
public class SectionPropertyController : BaseController
{
private readonly IUnitOfWork _unitOfWork;
private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository;
private readonly ISigerProjectLevelSectionRepository _levelSectionRepository;
private readonly IProductionBeatSetRepository _beatSetRepository;
public SectionPropertyController(IUnitOfWork unitOfWork, IAutomationSectionPropertyRepository sectionPropertyRepository,
ISigerProjectLevelSectionRepository levelSectionRepository, IProductionBeatSetRepository beatSetRepository)
{
_unitOfWork = unitOfWork;
_sectionPropertyRepository = sectionPropertyRepository;
_levelSectionRepository = levelSectionRepository;
_beatSetRepository = beatSetRepository;
}
[HttpGet]
public IActionResult GetSections(string line)
{
var sectionIds = _levelSectionRepository.GetLevelSectionIds(line.ToInt(), ProjectId);
var sectionids = _sectionPropertyRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && sectionIds.Contains(q.sectionid)).
Select(q => q.sectionid).ToList();
var sections = _levelSectionRepository.GetList(q => q.projectid == ProjectId && q.status == (int)RowState.Valid && sectionids.Contains(q.id)).
Select(q => new { q.id, q.title }).ToList();
return new ObjectResult(sections);
}
public IActionResult GetRouteByProduct(string productId)
{
var list = _beatSetRepository.GetList(q => q.projectID == ProjectId && q.status == (int)RowState.Valid && q.product_name.ToInt() == productId.ToInt()).
Select(q => new
{
q.id,
name = q.route_name,
q.route_number
}).ToList();
return new ObjectResult(list);
}
}
}
......@@ -165,21 +165,7 @@ namespace Siger.ApiQMS.Controllers
traceResult = "NG";
}
}
//插入大数据库的trace表
var trace = new SnTrace
{
MaterialID = req.materialid.ToInt(),
ProductID = req.productid,
SectionID = req.sectionid,
MachineID = machine?.id ?? 0,
WorkOrder = req.workorder ?? "",
SN = req.sn ?? "",
Result = traceResult,
UserID = UserId,
RouteID = req.routeid.ToInt(),
CreateTime = DateTime.Now,
CheckType = req.checktype
};
var insertDetailList = new List<SnTraceDetailList>();
foreach (var index in indexs)
{
......@@ -265,6 +251,7 @@ namespace Siger.ApiQMS.Controllers
{
req.result = ((int)SendTestType.Unqualified).ToString();
}
var nowTime = DateTime.Now;
//插入中间层库的trace表
var inspection = new siger_check_sn_trace_inspection
{
......@@ -279,9 +266,9 @@ namespace Siger.ApiQMS.Controllers
check_status = (int)SendCheckStatus.Completed,
result = req.result,
send_mid = UserId,
send_time = trace.CreateTime,
send_time = nowTime,
check_mid = UserId,
check_time = trace.CreateTime,
check_time = nowTime,
inspection_type = (int)InspectionType.ManualCollection,
projectid = ProjectId,
reason = req.reason ?? "",
......@@ -305,7 +292,7 @@ namespace Siger.ApiQMS.Controllers
LowerLimit = detail.LowerLimit,
UpperLimit = detail.UpperLimit,
projectid = ProjectId,
CreateTime = trace.CreateTime
CreateTime = nowTime
};
_traceDetailRepository.Insert(model);
}
......@@ -314,7 +301,7 @@ namespace Siger.ApiQMS.Controllers
{
try
{
AddSnList(req.materialid.ToInt(), trace, product.code, section.parentid);//把二维码插入到 sn_list表
AddSnList(req.materialid.ToInt(), inspection, product.code, section.parentid);//把二维码插入到 sn_list表
var abnormalCheckHelper = new AbnormalCheckHelper(_unitOfWork, _abnormalRuleRepository, _projectUserRepository,
_traceDetailRepository, _inspectStandard, _traceInspectionRepository, _sigerDict, CompanyId, ProjectId, UserId);
......@@ -764,12 +751,9 @@ namespace Siger.ApiQMS.Controllers
req.result = ((int)SendTestType.Unqualified).ToString();
}
else
{
inspection.result = req.result;
inspection.quantity = req.quantity.ToInt();
_traceInspectionRepository.Update(inspection);
}
inspection.result = req.result;
inspection.quantity = req.quantity.ToInt();
_traceInspectionRepository.Update(inspection);
foreach (var delDetail in delTraceDetails)
{
......@@ -808,18 +792,18 @@ namespace Siger.ApiQMS.Controllers
#endregion
}
private void AddSnList(int materialid, SnTrace trace, string code, int lineId)
private void AddSnList(int materialid, siger_check_sn_trace_inspection trace, string code, int lineId)
{
var snEntity = _snListRepository.Get(t => t.projectid == ProjectId && t.status == (int)RowState.Valid &&
t.SN == trace.SN && !string.IsNullOrWhiteSpace(trace.SN));
t.SN == trace.sn && !string.IsNullOrWhiteSpace(trace.sn));
if (snEntity == null)
{
var stateCode = "000";
var eventNoObj = _snListRepository.GetEventNoByResult(trace.SN, ProjectId);
var eventNoObj = _snListRepository.GetEventNoByResult(trace.sn, ProjectId);
if (eventNoObj != null)
{
//出站信息获取
var outObj = _snListRepository.GetOutStationByEventNo(eventNoObj.EventNo, trace.SectionID, ProjectId);
var outObj = _snListRepository.GetOutStationByEventNo(eventNoObj.EventNo, trace.sectionid, ProjectId);
if (outObj != null)
{
stateCode = outObj.ResultStatus;
......@@ -829,12 +813,12 @@ namespace Siger.ApiQMS.Controllers
t.id == materialid);
var snListObj = new siger_check_sn_list
{
SN = trace.SN,
SN = trace.sn,
BatchNumber = "",
ProductID = trace.ProductID,
ProductID = trace.productid,
ProductCode = code,
LineID = lineId,
WorkOrder = trace.WorkOrder,
WorkOrder = trace.workorder,
MaterialID = material?.id ?? 0,
PartNumber = material?.pn ?? "",
StateCode = stateCode,
......
......@@ -342,20 +342,6 @@ namespace Siger.ApiQMS.Controllers
var machine = _inspectStandard.GetMachineBySectionId(sendTest.sectionid, ProjectId);
var trace = new SnTrace
{
MaterialID = sendTest.materialid,
ProductID = sendTest.productid,
SectionID = sendTest.sectionid,
MachineID = machine?.id ?? 0,
WorkOrder = "",
SN = sendTest.sn ?? "",
Result = (result == (int)SendTestType.Qalified || result == (int)SendTestType.DeviationRelease) ? "OK" : "NG",
UserID = UserId,
RouteID = sendTest.routeid,
CreateTime = DateTime.Now,
CheckType = sendTest.check_type
};
var insertDetailList = new List<SnTraceDetailList>();
foreach (var index in indexs)
{
......@@ -490,7 +476,7 @@ namespace Siger.ApiQMS.Controllers
{
try
{
AddSnList(sendTest, trace);
AddSnList(sendTest);
var abnormalCheckHelper = new AbnormalCheckHelper(_unitOfWork, _abnormalRuleRepository, _projectUserRepository,
_traceDetailRepository, _inspectStandard, _traceInspectionRepository, _sigerDict, CompanyId, ProjectId, UserId);
......@@ -1035,16 +1021,16 @@ namespace Siger.ApiQMS.Controllers
return new ObjectResult(CommonEnum.Succefull);
}
private void AddSnList(siger_check_sn_trace_inspection sendTest, SnTrace trace)
private void AddSnList(siger_check_sn_trace_inspection sendTest)
{
var snEntity = _snListRepository.Get(t => t.projectid == ProjectId && t.status == (int)RowState.Valid &&
t.SN == trace.SN && !string.IsNullOrWhiteSpace(trace.SN));
t.SN == sendTest.sn && !string.IsNullOrWhiteSpace(sendTest.sn));
var stateCode = "000";
var eventNoObj = _snListRepository.GetEventNoByResult(trace.SN, ProjectId);
var eventNoObj = _snListRepository.GetEventNoByResult(sendTest.sn, ProjectId);
if (eventNoObj != null)
{
//出站信息获取
var outObj = _snListRepository.GetOutStationByEventNo(eventNoObj.EventNo, trace.SectionID, ProjectId);
var outObj = _snListRepository.GetOutStationByEventNo(eventNoObj.EventNo, sendTest.sectionid, ProjectId);
if (outObj != null)
{
stateCode = outObj.ResultStatus;
......@@ -1062,12 +1048,12 @@ namespace Siger.ApiQMS.Controllers
{
var snListObj = new siger_check_sn_list
{
SN = trace.SN ?? "",
SN = sendTest.sn ?? "",
BatchNumber = "",
ProductID = trace.ProductID,
ProductID = sendTest.productid,
ProductCode = product.code,
LineID = section.parentid,
WorkOrder = trace.WorkOrder,
WorkOrder = sendTest.workorder,
MaterialID = material?.id ?? 0,
PartNumber = material?.pn ?? "",
StateCode = stateCode,
......
......@@ -324,7 +324,9 @@ namespace Siger.Middlelayer.Common.ModuleEnum
[Description("设备正在使用中")]
MachineBusy,
[Description("任务进行中")]
TaskProcessing
TaskProcessing,
[Description("产品工装未找到")]
FixtureToolsIsNone,
}
public enum SeriNumCfg
......
......@@ -15,6 +15,7 @@ namespace Siger.Middlelayer.Common.Helpers
public const string DateTimeFormatYmd = "yyyyMMdd";
public const string TimeFormat = "HH:mm:ss";
public const string DateTimeFormatYYmmdd = "yyMMdd";
/// <summary>
/// unix time to date-->yyyyMMdd
......
......@@ -165,5 +165,7 @@ namespace Siger.Middlelayer.AccRepository
public DbSet<siger_automation_machine_status> siger_automation_machine_status { get; set; }
public DbSet<siger_automation_produce_history> siger_automation_produce_history { get; set; }
public DbSet<siger_automation_fixture_tools_monitor> siger_automation_fixture_tools_moniter { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Entities
{
public class siger_automation_fixture_tools_monitor:AccEntityBase
{
/// <summary>
/// 工装ID
/// </summary>
public string fixtureguid { get; set; }
/// <summary>
/// 当前工站ID
/// </summary>
public int section { get; set; }
/// <summary>
/// 当前Sn
/// </summary>
public string sn { get; set; }
/// <summary>
/// 工序ID
/// </summary>
public int route { get; set; }
/// <summary>
/// 工序描述
/// </summary>
public string routedesc { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
}
}
......@@ -19,6 +19,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
public int productid { get; set; }
/// <summary>
/// 产品CODE
/// </summary>
public string productcode { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
......
......@@ -10,7 +10,11 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary>
public class siger_automation_task_list : AccEntityBase
{
public string guid { get; set; }
/// <summary>
/// 任务编号
/// </summary>
public string no { get; set; }
/// <summary>
/// 工位ID
/// </summary>
......@@ -26,7 +30,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// <summary>
/// 工件ID
/// </summary>
public int materialid { get; set; }
public string sn { get; set; }
/// <summary>
/// 工单号
/// </summary>
......@@ -50,7 +54,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// <summary>
/// 工装GUID
/// </summary>
public int fixturetools { get; set; }
public string fixtureguid { get; set; }
/// <summary>
/// Task 执行动作类型 1 手动 2 自动
......
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface;
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Repositories
{
internal class AutomationFixtureMonitor : AccRepositoryBase<siger_automation_fixture_tools_monitor>, IAutomationFixtureMonitor
{
public AutomationFixtureMonitor(ApiAccDbContext context) : base(context)
{
}
}
}
......@@ -20,6 +20,22 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context;
}
public ResponseProductFixtureInfo GetFixtureInfoByProductCode(int projectId, string productCode)
{
var query = from q in _context.siger_automation_fixture_tools_product
join t in _context.siger_automation_fixture_tools on q.fixturetools equals t.guid
join l in _context.siger_automation_location on t.guid equals l.fixturetools
where q.projectId == projectId && q.productcode==productCode && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
select new ResponseProductFixtureInfo
{
FixtureId=t.id,
FixtureGuid=t.guid,
ProductCode=q.productcode,
Location=l.locationid.ToString(),
};
return query.FirstOrDefault();
}
public IPagedCollectionResult<ResponseAumationFixtureToolsProduct> GetPagedList(int category, int tool, int product, int projectid, int page, int pagesize)
{
var query = from q in _context.siger_automation_fixture_tools_product
......
......@@ -2,6 +2,7 @@
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.Common.Helpers;
......@@ -45,5 +46,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return $"M{radon}T{lable}";
}
}
public string CreateRandonSn(string productCode)
{
var date = DateTime.Now;
var serinum = date.DayOfYear+date.Hour + date.Minute + date.Second + date.Millisecond;
var randon = new Random().Next(1000, 9999);
return $"{productCode}{date.ToString(UnixTimeHelper.DateTimeFormatYmd)}{serinum}{randon}";
}
}
}
using Siger.Middlelayer.AccRepository.Entities;
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
public interface IAutomationFixtureMonitor : IAccRepositoryBase<siger_automation_fixture_tools_monitor>
{
}
}
......@@ -8,5 +8,8 @@ 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);
ResponseProductFixtureInfo GetFixtureInfoByProductCode(int projectId, string productCode);
}
}
......@@ -16,5 +16,11 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <param name="section"></param>
/// <returns></returns>
bool CanTask(int projectId,int section);
/// <summary>
/// 创建随机工件号码 SN
/// </summary>
/// <returns></returns>
string CreateRandonSn(string productCode);
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Response
{
public class ResponseProductFixtureInfo
{
/// <summary>
/// 工装ID
/// </summary>
public int FixtureId { get; set; }
/// <summary>
/// GUID
/// </summary>
public string FixtureGuid { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// 储位
/// </summary>
public int Location { get; set; }
}
}
......@@ -247,6 +247,7 @@ CREATE TABLE IF NOT EXISTS `siger_automation_fixture_tools_product` (
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'siger_automation_fixture_tools.guid',
`productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品CODE',
`remark` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 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 '附件名称',
......@@ -325,7 +326,8 @@ CREATE TABLE IF NOT EXISTS `siger_automation_section_route` (
-- ----------------------------
CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`guid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`no` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`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 '任务类型',
......@@ -382,7 +384,7 @@ CREATE TABLE `siger_automation_line_mode` (
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- 生产线模式
-- 生产操作记录
-- Table structure for siger_automation_produce_history
-- ----------------------------
......@@ -404,4 +406,24 @@ CREATE TABLE `siger_automation_produce_history` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- 工装实时状态
-- Table structure for siger_automation_fixture_tools_moniter
-- ----------------------------
DROP TABLE IF EXISTS `siger_automation_fixture_tools_moniter`;
CREATE TABLE `siger_automation_fixture_tools_moniter` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`projectid` int(11) NOT NULL DEFAULT 0,
`fixtureguid` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工装ID',
`section` int(11) NOT NULL DEFAULT 0 COMMENT '当前工站ID',
`sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前绑定工件',
`route` int(1) NOT NULL DEFAULT 1 COMMENT '工序ID',
`routedesc` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前工序',
`createtime` datetime(0) NULL DEFAULT NULL COMMENT '添加时间',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
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