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