Commit 3c45b71d by xin.yang
parents 1d4af520 4cbcd5fe
<template> <template>
<div> <div>
员工上下料管理
<div class="divborder"> <div class="divborder">
<div class="choose"> <div class="choose">
<p class="selectTitle"> <p class="selectTitle">
...@@ -44,7 +43,12 @@ ...@@ -44,7 +43,12 @@
<div class="choose"> <div class="choose">
<p class="selectTitle">3.操作</p> <p class="selectTitle">3.操作</p>
<Tabs type="card" :value="tabindex"> <Tabs type="card" :value="tabindex">
<TabPane label="上料" :disabled="attr1" name="1"> <TabPane
label="上料"
:disabled="attr1"
name="1"
@click="getStorages()"
>
<div class="filter"> <div class="filter">
<label style="font-size: 16px" <label style="font-size: 16px"
>上料信息:</label >上料信息:</label
...@@ -110,16 +114,14 @@ ...@@ -110,16 +114,14 @@
</p> </p>
<Button type="primary" @click="modal = true" <Button type="primary" @click="modal = true"
>储位选择</Button @on-click="getStorages()">储位选择</Button
> >
</div> </div>
<div class="flex"> <div class="flex">
<p class="infoLabel">产品图片:</p> <p class="infoLabel">产品图片:</p>
<div> <div>
<img <img
:src=" :src="orderDetail.url"
axios.publicPath + orderDetail.url
"
alt="" alt=""
style="width: 100%" style="width: 100%"
/> />
...@@ -134,7 +136,11 @@ ...@@ -134,7 +136,11 @@
> >
</div> </div>
</TabPane> </TabPane>
<TabPane label="下料" :disabled="attr2" name="2" <TabPane
label="下料"
:disabled="attr2"
name="2"
@click="getStorages()"
><div class="flex"> ><div class="flex">
<div> <div>
<Table <Table
...@@ -334,12 +340,11 @@ export default { ...@@ -334,12 +340,11 @@ export default {
detailobj: {}, detailobj: {},
sectionid: 0, sectionid: 0,
tabindex: "1", tabindex: "1",
locationobj:{} locationobj: {},
}; };
}, },
created() { created() {
this.getProLine(); this.getProLine();
this.getStorages();
}, },
mounted() { mounted() {
// this.getStations() // this.getStations()
...@@ -399,9 +404,16 @@ export default { ...@@ -399,9 +404,16 @@ export default {
}, },
//获取储位 //获取储位
getStorages() { getStorages() {
this.request("/acc/AutomationLocation/GetLocationList?fillsn=1", "", "get") let code = "";
code = this.orderDetail.productCode
? this.orderDetail.productCode
: "";
let data = {
fillsn: this.tabindex == "1" ? 0 : 1,
productcode: code,
};
this.request("/acc/AutomationLocation/GetLocationList", data, "get")
.then((res) => { .then((res) => {
console.log(res.data.data);
if (res.data.ret == 1) { if (res.data.ret == 1) {
this.data1 = res.data.data; this.data1 = res.data.data;
this.data2 = res.data.data; this.data2 = res.data.data;
...@@ -416,18 +428,28 @@ export default { ...@@ -416,18 +428,28 @@ export default {
let data = { let data = {
code: this.code, code: this.code,
}; };
this.request("/acc/AutomationOperate/ScanCode", data, "get") this.request("/acc/AutomationOperate/ScanCode", data, "get")
.then((res) => { .then((res) => {
if (res.data.ret == 1) { if (res.data.ret == 1) {
let obj = res.data.data; let obj = res.data.data;
if (
obj.url == null ||
obj.url == "" ||
obj.url == undefined
) {
obj.url = "";
} else {
obj.url = this.axios.publicPath + obj.url.slice(4);
}
this.orderDetail = Object.assign( this.orderDetail = Object.assign(
{}, {},
this.orderDetail, this.orderDetail,
obj obj
); );
this.getStorages();
} else { } else {
this.$Message.error(this.$t(res.data, msg)); this.$Message.error(this.$t(res.data.msg));
this.orderDetail = {};
} }
}) })
.catch((err) => { .catch((err) => {
...@@ -446,6 +468,15 @@ export default { ...@@ -446,6 +468,15 @@ export default {
.then((res) => { .then((res) => {
if (res.data.ret == 1) { if (res.data.ret == 1) {
let obj = res.data.data; let obj = res.data.data;
if (
obj.url == null ||
obj.url == "" ||
obj.url == undefined
) {
obj.url = "";
} else {
obj.url = this.axios.publicPath + obj.url.slice(4);
}
this.orderDetail = Object.assign( this.orderDetail = Object.assign(
{}, {},
this.orderDetail, this.orderDetail,
...@@ -510,14 +541,14 @@ export default { ...@@ -510,14 +541,14 @@ export default {
return false; return false;
} }
if (!this.locationobj.id) { if (!this.locationobj.id) {
this.$Message.error("请选择储位"); this.$Message.error("请选择储位");
return false; return false;
} }
let data = { let data = {
section: this.sectionid, section: this.sectionid,
id:this.locationobj.id, id: this.locationobj.id,
}; };
this.request("/acc/AutomationOperate/Unloading", data, "post").thne( this.request("/acc/AutomationOperate/Unloading", data, "post").then(
(res) => { (res) => {
if (res.data.ret == 1) { if (res.data.ret == 1) {
this.$Message.success(this.$t(res.data.msg)); this.$Message.success(this.$t(res.data.msg));
...@@ -540,7 +571,7 @@ export default { ...@@ -540,7 +571,7 @@ export default {
"/acc/AutomationOperate/Disassemble", "/acc/AutomationOperate/Disassemble",
data, data,
"post" "post"
).thne((res) => { ).then((res) => {
if (res.data.ret == 1) { if (res.data.ret == 1) {
this.$Message.success(this.$t(res.data.msg)); this.$Message.success(this.$t(res.data.msg));
} else { } else {
...@@ -558,6 +589,28 @@ export default { ...@@ -558,6 +589,28 @@ export default {
this.locationobj = currentRow; this.locationobj = currentRow;
this.orderDetail.fixtureGuid = this.detailobj.fixtureguid; this.orderDetail.fixtureGuid = this.detailobj.fixtureguid;
this.orderDetail.location = this.detailobj.locationid; this.orderDetail.location = this.detailobj.locationid;
if (this.locationobj.id) {
this.request(
"/acc/AutomationOperate/ScanCode?id=" + this.locationobj.id,
"",
"get"
)
.then((res) => {
if (res.data.ret == 1) {
let obj = res.data.data;
this.orderDetail = Object.assign(
{},
this.orderDetail,
obj
);
} else {
this.$Message.error(this.$t(res.data.msg));
}
})
.catch((err) => {
console.log(err);
});
}
}, },
request(url, data, type) { request(url, data, type) {
if (type == "get") { if (type == "get") {
...@@ -649,7 +702,7 @@ export default { ...@@ -649,7 +702,7 @@ export default {
.info { .info {
display: inline-block; display: inline-block;
width: 200px; width: 200px;
font-size: 20px; font-size: 16px;
} }
.ivu-btn { .ivu-btn {
margin: 10px; margin: 10px;
......
...@@ -57,7 +57,10 @@ ...@@ -57,7 +57,10 @@
<div <div
class="stateItem" class="stateItem"
:key="index" :key="index"
:style="{ background: item.bgc,color:item.status!=0?fontColor:'' }" :style="{
background: item.bgc,
color: item.status != 0 ? fontColor : '',
}"
> >
<p class="flex"> <p class="flex">
<span class="infoLabel">工位:</span> <span class="infoLabel">工位:</span>
...@@ -131,19 +134,19 @@ export default { ...@@ -131,19 +134,19 @@ export default {
{ {
title: "工装编号", title: "工装编号",
key: "fixtureName", key: "fixtureName",
render: (h, params) => { // render: (h, params) => {
return h( // return h(
"a", // "a",
{ // {
on: { // on: {
click: () => { // click: () => {
// this.show1 = true; // // this.show1 = true;
}, // },
}, // },
}, // },
"look" // "look"
); // );
}, // },
}, },
{ {
title: "产品编号", title: "产品编号",
...@@ -152,23 +155,35 @@ export default { ...@@ -152,23 +155,35 @@ export default {
{ {
title: "工件编号", title: "工件编号",
key: "sn", key: "sn",
render: (h, params) => { // render: (h, params) => {
return h( // return h(
"a", // "a",
{ // {
on: { // on: {
click: () => { // click: () => {
// this.show2 = true; // // this.show2 = true;
}, // },
}, // },
}, // },
"look" // "look"
); // );
}, // },
}, },
{ {
title: "状态", title: "状态",
key: "status", key: "status",
render: (h, params) => {
let str = "";
str =
params.row.status == 1
? "待上料"
: params.row.status == 2
? "生产中"
: params.row.status == 3
? "待下料"
: "";
return h("div", str);
},
}, },
{ {
title: "最后更新时间", title: "最后更新时间",
...@@ -317,7 +332,7 @@ export default { ...@@ -317,7 +332,7 @@ export default {
produceTotal: 0, produceTotal: 0,
waittingTotal: 0, waittingTotal: 0,
}, },
fontColor:'#fff' fontColor: "#fff",
}; };
}, },
created() { created() {
...@@ -346,9 +361,7 @@ export default { ...@@ -346,9 +361,7 @@ export default {
: []; : [];
arr.forEach((ele) => { arr.forEach((ele) => {
let bgc = ""; let bgc = "";
if (ele.enable == 0) {
bgc = "red";
}
if (ele.status == 1) { if (ele.status == 1) {
bgc = "#ff9900"; bgc = "#ff9900";
} }
...@@ -358,6 +371,9 @@ export default { ...@@ -358,6 +371,9 @@ export default {
if (ele.status == 3) { if (ele.status == 3) {
bgc = "#2db7f5"; bgc = "#2db7f5";
} }
if (ele.enable == 0) {
bgc = "red";
}
ele.bgc = bgc; ele.bgc = bgc;
}); });
this.stateList = arr; this.stateList = arr;
...@@ -430,7 +446,6 @@ export default { ...@@ -430,7 +446,6 @@ export default {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
font-size: 16px; font-size: 16px;
} }
} }
.stateTitle { .stateTitle {
......
...@@ -398,6 +398,17 @@ export default { ...@@ -398,6 +398,17 @@ export default {
page: 1, page: 1,
pagesize: 10, pagesize: 10,
columns2: [ columns2: [
{
type: "index2",
title: this.$t("1008"),
key: "xuhao",
render: (h, params) => {
return h(
"span",
params.index+ 1
);
},
},
{ {
title: "子工装类型", title: "子工装类型",
key: "category", key: "category",
...@@ -468,7 +479,7 @@ export default { ...@@ -468,7 +479,7 @@ export default {
}, },
created() { created() {
this.columns1 = this.$time.initTableTitle(this.columns1); this.columns1 = this.$time.initTableTitle(this.columns1);
// this.columns2 = this.$time.initTableTitle(this.columns2); this.columns2 = this.$time.initTableTitle(this.columns2);
this.initFrockType(); this.initFrockType();
this.tosearch(); this.tosearch();
......
...@@ -347,13 +347,12 @@ export default { ...@@ -347,13 +347,12 @@ export default {
handleSuccess(res, file) { handleSuccess(res, file) {
if (res.ret == 1) { if (res.ret == 1) {
this.$Message.success(this.$t("950398")); this.$Message.success(this.$t("950398"));
this.initFrockType();
this.tosearch(); this.tosearch();
} else { } else {
if ((res.msg + "").indexOf(",") != -1) { if ((res.msg + "").indexOf(",") != -1) {
inittip(res.msg); inittip(res.msg);
} else { } else {
this.$Message.error(this.$t(res.data)); this.$Message.error(this.$t(res.msg));
} }
} }
}, },
......
...@@ -149,7 +149,7 @@ namespace Siger.ApiACC.Controllers ...@@ -149,7 +149,7 @@ namespace Siger.ApiACC.Controllers
{ {
section = line, section = line,
projectId = PID, projectId = PID,
status = 0, status = 1,
updatetime = DateTime.Now, updatetime = DateTime.Now,
mode = mode mode = mode
}); });
...@@ -315,8 +315,11 @@ namespace Siger.ApiACC.Controllers ...@@ -315,8 +315,11 @@ namespace Siger.ApiACC.Controllers
_automationLocation.Update(location); _automationLocation.Update(location);
var monitor = _automationFixtureMonitor.Get(f => f.section == taskObj.sectionid); var monitor = _automationFixtureMonitor.Get(f => f.section == taskObj.sectionid);
monitor.section = 0; if (monitor != null)
_automationFixtureMonitor.Update(monitor); {
monitor.section = 0;
_automationFixtureMonitor.Update(monitor);
}
} }
} }
......
...@@ -227,15 +227,22 @@ namespace Siger.ApiACC.Controllers ...@@ -227,15 +227,22 @@ namespace Siger.ApiACC.Controllers
guid = Guid.NewGuid().ToString(), guid = Guid.NewGuid().ToString(),
locationid = location.locationid, locationid = location.locationid,
location_cid = location.id, location_cid = location.id,
fixturename=fixturetool.name,
fixturetools = fixturetool.guid, fixturetools = fixturetool.guid,
productid= fixturetoolProduct != null ? fixturetoolProduct.productid : 0, productid= fixturetoolProduct != null ? fixturetoolProduct.productid : 0,
productcode = fixturetoolProduct!=null? fixturetoolProduct.productcode:"", productcode = fixturetoolProduct!=null? fixturetoolProduct.productcode:"",
attachment = req.fileurl, attachment = req.fileurl,
filename = req.filename, filename = req.filename,
remark = req.remark, remark = req.remark,
projectId = ProjectId, projectId = ProjectId,
updatetime = DateTime.Now, updatetime = DateTime.Now,
updator = UserId, updator = UserId,
ordernumber="",
route="",
sn="",
extend1=""
}; };
_autoLocationRepository.Insert(entity); _autoLocationRepository.Insert(entity);
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
......
...@@ -193,7 +193,11 @@ namespace Siger.ApiACC.Controllers ...@@ -193,7 +193,11 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(AccEnum.LineIsAutoMode); throw new BadRequestException(AccEnum.LineIsAutoMode);
} }
var attr = _sigerProjectMachineAttribution.Get(f => f.station == taskobj.sectionid && f.status == 1);
if (attr==null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var host = GetHost(); var host = GetHost();
if (string.IsNullOrEmpty(host)) if (string.IsNullOrEmpty(host))
{ {
...@@ -201,7 +205,8 @@ namespace Siger.ApiACC.Controllers ...@@ -201,7 +205,8 @@ namespace Siger.ApiACC.Controllers
} }
var sendToPLC = new RequestPLC var sendToPLC = new RequestPLC
{ {
RStation = taskobj.sectionid, LineID=levelsection.parentid,
RStation = attr.machine,
Fixture = taskobj.fixtureguid, Fixture = taskobj.fixtureguid,
RequestForm = taskobj.no, RequestForm = taskobj.no,
RobotStep = (int)taskobj.action, RobotStep = (int)taskobj.action,
...@@ -259,21 +264,37 @@ namespace Siger.ApiACC.Controllers ...@@ -259,21 +264,37 @@ namespace Siger.ApiACC.Controllers
return host; return host;
} }
/// <summary> /// <summary>
/// 扫描 /// 扫描
/// </summary> /// </summary>
/// <param name="code"></param> /// <param name="code"></param>
/// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public IActionResult ScanCode(string code) public IActionResult ScanCode(string code,int id)
{ {
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code); if (!string.IsNullOrEmpty(code))
if (result==null) {
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code);
if (result == null)
{
throw new BadRequestException(AccEnum.FixtureOrderNulll);
}
var sn = _automationTaskList.CreateRandonSn(result.ProductCode);
result.Sn = sn;
return new ObjectResult(result);
}
if (id==0)
{
throw new BadRequestException(RequestEnum.ParameterMiss);
}
//下料
var unload = _automationFixtureToolsProduct.GetPlanFixtureInfoByLocation(ProjectId, id);
if (unload == null)
{ {
throw new BadRequestException(AccEnum.FixtureOrderNulll); throw new BadRequestException(AccEnum.FixtureOrderNulll);
} }
var sn = _automationTaskList.CreateRandonSn(result.ProductCode); return new ObjectResult(unload);
result.Sn = sn;
return new ObjectResult(result);
} }
/// <summary> /// <summary>
/// 准备上料 -生成指令 load (立库->上料位) /// 准备上料 -生成指令 load (立库->上料位)
...@@ -360,6 +381,7 @@ namespace Siger.ApiACC.Controllers ...@@ -360,6 +381,7 @@ namespace Siger.ApiACC.Controllers
sn=sn, sn=sn,
ordercode=plandts.OrderNumber, ordercode=plandts.OrderNumber,
fixtureguid= fixtureToolsObj.FixtureGuid, fixtureguid= fixtureToolsObj.FixtureGuid,
fixturename=fixtureToolsObj.FixtureCode,
locationid=fixtureToolsObj.Location, locationid=fixtureToolsObj.Location,
productcode=plan.product_code, productcode=plan.product_code,
processid=0, processid=0,
...@@ -453,7 +475,7 @@ namespace Siger.ApiACC.Controllers ...@@ -453,7 +475,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(AccEnum.MonitorNotfound); throw new BadRequestException(AccEnum.MonitorNotfound);
} }
//移出 上料位 //移出 上料位
monitor.section = 0;
var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual); var taskNo = _automationTaskList.CrateTaskNumber(Automation.TaskTrigerType.Manual);
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
...@@ -674,5 +696,7 @@ namespace Siger.ApiACC.Controllers ...@@ -674,5 +696,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.Fail); throw new BadRequestException(CommonEnum.Fail);
} }
} }
} }
} }
...@@ -50,7 +50,7 @@ namespace Siger.ApiACC.Controllers ...@@ -50,7 +50,7 @@ namespace Siger.ApiACC.Controllers
var item = new ResponseAutomationMachineStatus var item = new ResponseAutomationMachineStatus
{ {
sectionid=d.sectionid, sectionid=d.sectionid,
section=d.section, section=$"{ d.section} {d.linemode}",
enable=d.enable, enable=d.enable,
product="", product="",
location=0, location=0,
...@@ -59,6 +59,7 @@ namespace Siger.ApiACC.Controllers ...@@ -59,6 +59,7 @@ namespace Siger.ApiACC.Controllers
fixtureName="", fixtureName="",
lastupdate="", lastupdate="",
status=(int)Automation.MachineStatus.Waiting, status=(int)Automation.MachineStatus.Waiting,
linemode=d.linemode
}; };
var fixture = _automationFixtureMonitor.Get(f => f.section == d.sectionid); var fixture = _automationFixtureMonitor.Get(f => f.section == d.sectionid);
...@@ -68,6 +69,7 @@ namespace Siger.ApiACC.Controllers ...@@ -68,6 +69,7 @@ namespace Siger.ApiACC.Controllers
item.location = fixture.locationId; item.location = fixture.locationId;
item.sn = fixture.sn; item.sn = fixture.sn;
item.fixtureCode = fixture.fixtureguid; item.fixtureCode = fixture.fixtureguid;
item.fixtureName = fixture.fixturename; item.fixtureName = fixture.fixturename;
item.status = fixture.status; item.status = fixture.status;
} }
...@@ -76,6 +78,7 @@ namespace Siger.ApiACC.Controllers ...@@ -76,6 +78,7 @@ namespace Siger.ApiACC.Controllers
} }
var output = new ResponseMachineMonitor var output = new ResponseMachineMonitor
{ {
sum=new ResponseAutomationMachineStatusTotal { sum=new ResponseAutomationMachineStatusTotal {
waittingTotal =result.Where(f=>f.status==(int)Automation.MachineStatus.Waiting).Count(), waittingTotal =result.Where(f=>f.status==(int)Automation.MachineStatus.Waiting).Count(),
produceTotal= result.Where(f => f.status == (int)Automation.MachineStatus.Produce).Count(), produceTotal= result.Where(f => f.status == (int)Automation.MachineStatus.Produce).Count(),
......
...@@ -37,10 +37,17 @@ namespace Siger.ApiACC.Tasks ...@@ -37,10 +37,17 @@ namespace Siger.ApiACC.Tasks
var tasks = tasklist.OrderBy(s => s.actiontype); var tasks = tasklist.OrderBy(s => s.actiontype);
var task = tasks.FirstOrDefault(); var task = tasks.FirstOrDefault();
var levelsction = dbhelper.GetLevelsection(task.sectionid);
if (levelsction == null)
return;
var attr = dbhelper.GetAttribution(task.sectionid);
if (attr == null)
return;
var sendToPLC = new RequestPLC var sendToPLC = new RequestPLC
{ {
RStation = task.sectionid, LineID= levelsction.parentid,
RStation = attr.machine,
Fixture = task.fixtureguid, Fixture = task.fixtureguid,
RequestForm = task.no, RequestForm = task.no,
RobotStep = (int)task.action, RobotStep = (int)task.action,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using Siger.Middlelayer.AccRepository.Entities; using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.CncRepository; using Siger.Middlelayer.CncRepository;
using Siger.Middlelayer.Repository; using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Entities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -52,6 +53,15 @@ namespace Siger.ApiACC.Tasks ...@@ -52,6 +53,15 @@ namespace Siger.ApiACC.Tasks
AccDbContext.siger_automation_task_list.Update(taskNo); AccDbContext.siger_automation_task_list.Update(taskNo);
return AccDbContext.SaveChanges() > 0; return AccDbContext.SaveChanges() > 0;
} }
public siger_project_level_section GetLevelsection(int id)
{
return AccDbContext.siger_project_level_section.FirstOrDefault(f => f.id==id);
}
public siger_project_machine_attribution GetAttribution(int section)
{
return AccDbContext.siger_project_machine_attribution.FirstOrDefault(f => f.station==section && f.status==1);
}
public void Dispose() public void Dispose()
{ {
CncDbContext?.Dispose(); CncDbContext?.Dispose();
......
...@@ -20,7 +20,7 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -20,7 +20,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public string fixtureguid { get; set; } public string fixtureguid { get; set; }
/// <summary> /// <summary>
/// 工装Name /// 工装CODE
/// </summary> /// </summary>
public string fixturename { get; set; } public string fixturename { get; set; }
/// <summary> /// <summary>
......
...@@ -136,7 +136,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -136,7 +136,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
ProductName = p.product_name, ProductName = p.product_name,
Url=pd.image, Url=pd.image,
FixtureName=t.name, FixtureName=t.name,
FixtureGuid=t.guid, FixtureGuid=t.code,
ProductCode =q!=null? q.productcode:"", ProductCode =q!=null? q.productcode:"",
Location =l!=null? l.locationid:0, Location =l!=null? l.locationid:0,
}; };
...@@ -218,5 +218,29 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -218,5 +218,29 @@ namespace Siger.Middlelayer.AccRepository.Repositories
throw; throw;
} }
} }
public ResponsePlanlFixtureInfo GetPlanFixtureInfoByLocation(int projectId, int id)
{
var query = from d in _context.siger_project_product_plan_detail
join p in _context.siger_project_product_plan on d.PlanId equals p.id
join 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
join pd in _context.siger_project_product on p.product_id equals pd.id
where q.projectId == projectId && l.id == id
&& q.status == (int)RowState.Valid && t.status == (int)RowState.Valid && l.status == (int)RowState.Valid
select new ResponsePlanlFixtureInfo
{
OrderNumber = d.OrderNumber,
ProductName = p.product_name,
Url = pd.image,
FixtureName = t.name,
FixtureGuid = t.code,
ProductCode = q != null ? q.productcode : "",
Location = l != null ? l.locationid : 0,
Sn=l.sn
};
return query.FirstOrDefault();
}
} }
} }
...@@ -125,7 +125,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -125,7 +125,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{ {
FixtureGuid=q.guid, FixtureGuid=q.guid,
FixtureName=q.name, FixtureName=q.name,
FixtureCode=q.code,
Location=l.locationid Location=l.locationid
}; };
return query.FirstOrDefault(); return query.FirstOrDefault();
......
...@@ -20,18 +20,21 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -20,18 +20,21 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public IEnumerable<ResponseAutomationMachineStatus> GetSectionStatus(int projectId, int section,List<int>sections) public IEnumerable<ResponseAutomationMachineStatus> GetSectionStatus(int projectId, int section,List<int>sections)
{ {
var data = from atr in _context.siger_project_machine_attribution 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 lv in _context.siger_project_level_section on atr.station equals lv.id
join lm in _context.siger_automation_line_mode on lv.parentid equals lm.id into lstemp
from lm in lstemp.DefaultIfEmpty()
join ms in _context.siger_automation_machine_status on lv.id equals ms.section into mstemp 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 join plv in _context.siger_project_level_section on lv.parentid equals plv.id
from ms in mstemp.DefaultIfEmpty() from ms in mstemp.DefaultIfEmpty()
select new ResponseAutomationMachineStatus select new ResponseAutomationMachineStatus
{ {
sectionid = lv.id, sectionid = lv.id,
section =$"{ plv.title}-{lv.title}", section = $"{ plv.title}-{lv.title}",
lastupdate = ms!=null? ms.updatetime.ToString():"", lastupdate = ms != null ? ms.updatetime.ToString() : "",
enable =ms!=null? ms.enable:1, enable = ms != null ? ms.enable : 1,
status =ms!=null? ms.status:1, status = ms != null ? ms.status : 1,
linemode =lm!=null? lm.mode == 0 ? "手动模式" : "自动模式":"",
}; };
Expression<Func<ResponseAutomationMachineStatus, bool>> sectionsExpression = f => true; Expression<Func<ResponseAutomationMachineStatus, bool>> sectionsExpression = f => true;
......
...@@ -41,28 +41,49 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -41,28 +41,49 @@ namespace Siger.Middlelayer.AccRepository.Repositories
} }
/// <summary>
/// 长度10 任务编号 PLC限制
/// </summary>
/// <param name="trigerType"></param>
/// <returns></returns>
public string CrateTaskNumber(TaskTrigerType trigerType) public string CrateTaskNumber(TaskTrigerType trigerType)
{ {
var date = DateTime.Now; var date = DateTime.Now;
var lable = date.ToString(UnixTimeHelper.DateTimeFormatYmd)+date.Hour + date.Minute + date.Second; var serinum = date.DayOfYear+date.Month +date.Day+ date.Hour + date.Minute + date.Second + date.Millisecond;
var lableUnix = UnixTimeHelper.GetNow(); var dayofyear = GetDayOfYear(date);
var radon = new Random().Next(1000, 9999);
if (trigerType== TaskTrigerType.Auto) if (trigerType== TaskTrigerType.Auto)
{ {
return $"A{lableUnix}R{radon}T{lable}"; return $"A{date.Year}{dayofyear}{serinum}";
}else }
else
{ {
return $"M{lableUnix}R{radon}T{lable}"; return $"M{date.Year}{dayofyear}{serinum}";
} }
} }
/// <summary>
/// 工件长度10 PLC 限制
/// </summary>
/// <param name="productCode"></param>
/// <returns></returns>
public string CreateRandonSn(string productCode) public string CreateRandonSn(string productCode)
{ {
var date = DateTime.Now; var date = DateTime.Now;
var serinum = date.DayOfYear+date.Hour + date.Minute + date.Second + date.Millisecond; var serinum = date.DayOfYear + date.Month + date.Day + date.Hour + date.Minute + date.Second + date.Millisecond;
var dayofyear = GetDayOfYear(date);
var lable = $"{date.Year}{dayofyear}{serinum}";
return lable;
}
private string GetDayOfYear(DateTime dt)
{
var lable = dt.DayOfYear.ToString();
var result = string.Empty;
for (int i = 0;i< 3- lable.Length;i++)
{
result +="0";
}
return $"{result}{lable}";
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) 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)
...@@ -128,13 +149,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -128,13 +149,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories
actionTypeExpression = q => q.actionTypeid==actionType; actionTypeExpression = q => q.actionTypeid==actionType;
} }
Expression<Func<ResponseAutomationTasklist, bool>> triggerTimeTypeExpression = f => true; Expression<Func<ResponseAutomationTasklist, bool>> triggerTimeTypeExpression = f => true;
if (string.IsNullOrEmpty(tiggertime)) if (!string.IsNullOrEmpty(tiggertime))
{ {
triggerTimeTypeExpression = q => q.triggervalue == tiggertime.ToDateTime(); triggerTimeTypeExpression = q => q.triggervalue == tiggertime.ToDateTime();
} }
Expression<Func<ResponseAutomationTasklist, bool>> comptimeExpression = f => true; Expression<Func<ResponseAutomationTasklist, bool>> comptimeExpression = f => true;
if (actionType != 0) if (!string.IsNullOrEmpty(comptime))
{ {
comptimeExpression = q => q.complatevalue == comptime.ToDateTime(); comptimeExpression = q => q.complatevalue == comptime.ToDateTime();
} }
......
...@@ -21,6 +21,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -21,6 +21,14 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
/// <returns></returns> /// <returns></returns>
ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber); ResponsePlanlFixtureInfo GetPlanFixtureInfo(int projectId, string ordernumber);
/// <summary>
///
/// </summary>
/// <param name="projectId"></param>
/// <param name="ordernumber"></param>
/// <returns></returns>
ResponsePlanlFixtureInfo GetPlanFixtureInfoByLocation(int projectId, int id);
CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid); CommonImportResult ImportData(IEnumerable<FixtureToolsProductTemplate> list, int projectid, int userid);
/// <summary> /// <summary>
......
...@@ -34,6 +34,8 @@ namespace Siger.Middlelayer.AccRepository.Request ...@@ -34,6 +34,8 @@ namespace Siger.Middlelayer.AccRepository.Request
/// 加工程序号 ,上料完成后自动加工需要 /// 加工程序号 ,上料完成后自动加工需要
/// </summary> /// </summary>
public string Program { get; set; } public string Program { get; set; }
public int LineID { get; set; }
} }
public class ResponsePlC public class ResponsePlC
......
...@@ -17,6 +17,7 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -17,6 +17,7 @@ namespace Siger.Middlelayer.AccRepository.Response
public int enable { get; set; } public int enable { get; set; }
public int status { get; set; } public int status { get; set; }
public string lastupdate { get; set; } public string lastupdate { get; set; }
public string linemode { get; set; }
} }
public class ResponseAutomationMachineStatusTotal public class ResponseAutomationMachineStatusTotal
...@@ -28,6 +29,7 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -28,6 +29,7 @@ namespace Siger.Middlelayer.AccRepository.Response
} }
public class ResponseMachineMonitor public class ResponseMachineMonitor
{ {
public int linemode { get; set; }
public ResponseAutomationMachineStatusTotal sum { get; set; } public ResponseAutomationMachineStatusTotal sum { get; set; }
public List<ResponseAutomationMachineStatus> dts { get; set; } public List<ResponseAutomationMachineStatus> dts { get; set; }
......
...@@ -16,6 +16,10 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -16,6 +16,10 @@ namespace Siger.Middlelayer.AccRepository.Response
/// </summary> /// </summary>
public string FixtureGuid { get; set; } public string FixtureGuid { get; set; }
/// <summary> /// <summary>
/// 工装编号
/// </summary>
public string FixtureCode { get; set; }
/// <summary>
/// 产品名称 /// 产品名称
/// </summary> /// </summary>
public string ProductCode { get; set; } public string ProductCode { get; set; }
......
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