Commit 9f261137 by yucheng.jiang
parents 281394cc 64e411d3
...@@ -709,6 +709,17 @@ export default { ...@@ -709,6 +709,17 @@ export default {
'9000484': '数据库创建失败', '9000484': '数据库创建失败',
'9000485': '数据表创建失败', '9000485': '数据表创建失败',
'9000486': '标签来源未维护', '9000486': '标签来源未维护',
'9000487': '只能读取txt文件',
'9000488': '程序版本号不能为空',
'9000489': '存在相同程序号的程序已审核,是否覆盖原来程序记录?',
'9000490': '记录已存在,请删除后添加',
'9000491': '人员未找到',
'9000492': '默认展示已存在',
'9000493': '未找到储位类别',
'9000494': '未找到工装类别',
'9000495': '未找到工装信息',
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9100000': 'Departments cannot be empty', '9100000': 'Departments cannot be empty',
'9100001': 'Position cannot be empty', '9100001': 'Position cannot be empty',
......
...@@ -742,6 +742,11 @@ export default { ...@@ -742,6 +742,11 @@ export default {
'9000490': '记录已存在,请删除后添加', '9000490': '记录已存在,请删除后添加',
'9000491': '人员未找到', '9000491': '人员未找到',
'9000492': '默认展示已存在', '9000492': '默认展示已存在',
'9000493': '未找到储位类别',
'9000494': '未找到工装类别',
'9000495': '未找到工装信息',
'9000496': 'ID重复',
'9000497': '父级和子级不能相同',
'9100000': '部门不能为空', '9100000': '部门不能为空',
......
...@@ -45,46 +45,60 @@ ...@@ -45,46 +45,60 @@
type="text" type="text"
class="searchInput" class="searchInput"
style="width: 300px" style="width: 300px"
@keyup.enter="getWorkOrderInfo()" v-model="code"
@on-keyup.enter="getWorkOrderInfo()"
/> />
</div> </div>
<div class="row"> <div class="row">
<p class="flex"> <p class="flex">
<span class="infoLabel">工单信息:</span> <span class="infoLabel">工单信息:</span>
<span class="info"></span> <span class="info">{{
orderDetail.orderNumber
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel">产品编号:</span> <span class="infoLabel">产品编号:</span>
<span class="info"></span> <span class="info">{{
orderDetail.productCode
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel">产品名称:</span> <span class="infoLabel">产品名称:</span>
<span class="info"></span> <span class="info">{{
orderDetail.productName
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel">工件编号:</span> <span class="infoLabel">工件编号:</span>
<span class="info"></span> <span class="info">{{
orderDetail.sn
}}</span>
</p> </p>
</div> </div>
<div class="row"> <div class="row">
<p class="flex"> <p class="flex">
<span class="infoLabel">状态:</span> <span class="infoLabel">状态:</span>
<span class="info"></span> <span class="info">{{
orderDetail.status
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel">储位编号:</span> <span class="infoLabel">储位编号:</span>
<span class="info"></span> <span class="info">{{
orderDetail.location
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel">工装编号:</span> <span class="infoLabel">工装编号:</span>
<span class="info"></span> <span class="info">{{
orderDetail.fixtureGuid
}}</span>
</p> </p>
<Button type="primary" @click="modal = true"
>储位选择</Button
>
</div> </div>
<div> <div>
<Button type="primary">准备上料</Button> <Button type="primary" @click="feedReady()"
>准备上料</Button
>
<Button type="primary">安装完成</Button> <Button type="primary">安装完成</Button>
</div> </div>
</TabPane> </TabPane>
...@@ -105,25 +119,33 @@ ...@@ -105,25 +119,33 @@
<span class="infoLabel" <span class="infoLabel"
>工单信息:</span >工单信息:</span
> >
<span class="info"></span> <span class="info">{{
orderDetail.orderNumber
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel" <span class="infoLabel"
>产品编号:</span >产品编号:</span
> >
<span class="info"></span> <span class="info">{{
orderDetail.productCode
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel" <span class="infoLabel"
>产品名称:</span >产品名称:</span
> >
<span class="info"></span> <span class="info">{{
orderDetail.productName
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel" <span class="infoLabel"
>工件编号:</span >工件编号:</span
> >
<span class="info"></span> <span class="info">{{
orderDetail.sn
}}</span>
</p> </p>
</div> </div>
<div class="row"> <div class="row">
...@@ -131,19 +153,25 @@ ...@@ -131,19 +153,25 @@
<span class="infoLabel" <span class="infoLabel"
>状态:</span >状态:</span
> >
<span class="info"></span> <span class="info">{{
orderDetail.code
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel" <span class="infoLabel"
>储位编号:</span >储位编号:</span
> >
<span class="info"></span> <span class="info">{{
orderDetail.location
}}</span>
</p> </p>
<p class="flex"> <p class="flex">
<span class="infoLabel" <span class="infoLabel"
>工装编号:</span >工装编号:</span
> >
<span class="info"></span> <span class="info">{{
orderDetail.fixtureGuid
}}</span>
</p> </p>
</div> </div>
<div> <div>
...@@ -173,7 +201,8 @@ ...@@ -173,7 +201,8 @@
class="tableClass" class="tableClass"
:data="data1" :data="data1"
:columns="columns1" :columns="columns1"
:max-height="200" @on-current-change="handleRowChange"
highlight-row
></Table> ></Table>
</div> </div>
<div slot="footer"> <div slot="footer">
...@@ -209,15 +238,13 @@ export default { ...@@ -209,15 +238,13 @@ export default {
attr1: false, //上料、下料、上下料 attr1: false, //上料、下料、上下料
attr2: false, //上料、下料、上下料 attr2: false, //上料、下料、上下料
modal: false, modal: false,
code: "", //工令单
columns1: [ columns1: [
{ {
title: this.$t("1008"), title: this.$t("1008"),
key: "xuhao", key: "xuhao",
render: (h, params) => { render: (h, params) => {
return h( return h("span", params.index + 1);
"span",
params.index + 1
);
}, },
width: 70, width: 70,
}, },
...@@ -244,10 +271,7 @@ export default { ...@@ -244,10 +271,7 @@ export default {
title: this.$t("1008"), title: this.$t("1008"),
key: "xuhao", key: "xuhao",
render: (h, params) => { render: (h, params) => {
return h( return h("span", params.index + 1);
"span",
params.index+ 1
);
}, },
width: 70, width: 70,
}, },
...@@ -265,6 +289,9 @@ export default { ...@@ -265,6 +289,9 @@ export default {
}, },
], ],
data2: [], data2: [],
orderDetail: {},
detailobj: {},
sectionid: 0,
}; };
}, },
created() { created() {
...@@ -314,6 +341,7 @@ export default { ...@@ -314,6 +341,7 @@ export default {
change2(index) { change2(index) {
this.b = index; this.b = index;
let status = this.stationList[index].status; let status = this.stationList[index].status;
this.sectionid = this.stationList[index].section;
if (status == 1) { if (status == 1) {
this.attr2 = true; this.attr2 = true;
} }
...@@ -326,7 +354,6 @@ export default { ...@@ -326,7 +354,6 @@ export default {
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;
} }
}) })
.catch((err) => { .catch((err) => {
...@@ -335,9 +362,21 @@ export default { ...@@ -335,9 +362,21 @@ export default {
}, },
// 获取工单信息 // 获取工单信息
getWorkOrderInfo() { getWorkOrderInfo() {
this.request("", "", "") let data = {
code: this.code,
};
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;
this.orderDetail = Object.assign(
{},
this.orderDetail,
obj
);
} else {
this.$Message.error(this.$t(res.data, msg));
} }
}) })
.catch((err) => { .catch((err) => {
...@@ -347,30 +386,37 @@ export default { ...@@ -347,30 +386,37 @@ export default {
feedReady() { feedReady() {
// 准备上料 // 准备上料
if (this.sectionid == 0) {
this.$Message.error("请选择工位");
}
let data = { let data = {
section: 13, section: this.sectionid,
code: "234324", code: this.orderDetail.fixtureGuid,
}; };
this.request("/acc/AutomationOperate/Loading", data, "post").thne((res) => { this.request("/acc/AutomationOperate/Loading", data, "post").thne(
if (res.data.ret == 1) { (res) => {
if (res.data.ret == 1) {
console.log(res.data.data);
} else {
this.$Message.error(this.$t(res.data.msg));
}
} }
}); );
}, },
installOver() { installOver() {
// 安装完成 // 安装完成
let data = { let data = {
section: 13 section: 13,
}; };
this.request("", data, "post").thne( this.request("", data, "post").thne((res) => {
(res) => { if (res.data.ret == 1) {
if (res.data.ret == 1) {
}
} }
); });
},
handleRowChange(currentRow, oldCurrentRow) {
this.detailobj = currentRow;
}, },
request(url, data, type) { request(url, data, type) {
if (type == "get") { if (type == "get") {
return this.axios return this.axios
......
<template> <template>
<div class="testdiv"> <div class="testdiv">
工装装配信息
<div class="divborder"> <div class="divborder">
<h2>基本信息</h2> <h2>基本信息</h2>
<div class="newSearchDiv"> <div class="newSearchDiv">
<div class="filter"> <div class="filter">
<label>工装类别:</label> <label>工装类别:</label>
<Select <Cascader
label-in-value
clearable
filterable
class="searchSelect" class="searchSelect"
> :data="typeTree"
</Select> clearable
change-on-select
v-model="category"
@on-change="getCategory"
></Cascader>
</div> </div>
<div class="filter"> <div class="filter">
<label>工装编号:</label> <label>工装编号:</label>
<Select <Input type="text" class="searchInput" v-model="number" />
label-in-value </div>
clearable <div class="filter">
filterable <label>工装名称:</label>
class="searchSelect" <Input type="text" class="searchInput" v-model="name" />
>
</Select>
</div> </div>
<div class="filter"> <div class="filter">
<label>状态:</label> <label>状态:</label>
...@@ -30,8 +28,11 @@ ...@@ -30,8 +28,11 @@
label-in-value label-in-value
clearable clearable
filterable filterable
v-model="state"
class="searchSelect" class="searchSelect"
> >
<Option :value="1">可用</Option>
<Option :value="0">停用</Option>
</Select> </Select>
</div> </div>
...@@ -83,12 +84,12 @@ ...@@ -83,12 +84,12 @@
:on-error="handleError" :on-error="handleError"
:format="['xlsx']" :format="['xlsx']"
> --> > -->
<Button <Button
type="primary" type="primary"
class="fourWord" class="fourWord"
icon="md-cloud-upload" icon="md-cloud-upload"
>{{ $t("1006") }}</Button >{{ $t("1006") }}</Button
> >
<!-- </Upload> --> <!-- </Upload> -->
<Button <Button
type="primary" type="primary"
...@@ -115,6 +116,122 @@ ...@@ -115,6 +116,122 @@
</div> </div>
</div> </div>
</div> </div>
<Modal
class="newModalClass"
v-model="modal"
:styles="{ width: '700px' }"
>
<p slot="header">
<span v-show="type == 1">{{ $t("1002") }}</span>
<span v-show="type == 2">{{ $t("1003") }}</span>
</p>
<div class="demo-spin-col">
<Spin fix v-if="spinShow">
<div>正在上传...</div>
</Spin>
<div class="filter">
<label>父工装类别:</label>
<Cascader
class="searchSelect"
:data="typeTree"
v-model="parentType"
change-on-select
@on-change="getCategory1"
></Cascader>
</div>
<div class="filter">
<label><i>*</i>父工装名称:</label>
<Select
v-model="toolingId1"
label-in-value
clearable
filterable
filter-by-label
class="searchSelect"
>
<Option
v-for="(item, index) in toolingList1"
:value="item.id"
:key="index"
:label="item.name + '#' + item.code"
>{{ item.name + "#" + item.code }}</Option
>
</Select>
</div>
<div style="padding-left: 50px">
<div class="filter">
<label>子工装类别:</label>
<Cascader
class="searchSelect"
:data="typeTree"
v-model="sonType"
change-on-select
@on-change="getCategory2"
></Cascader>
</div>
<div class="filter">
<label><i>*</i>子工装名称:</label>
<Select
v-model="toolingId2"
label-in-value
clearable
filterable
filter-by-label
class="searchSelect"
>
<Option
v-for="(item, index) in toolingList2"
:value="item.id"
:key="index"
:label="item.name + '#' + item.code"
>{{ item.name + "#" + item.code }}</Option
>
</Select>
</div>
</div>
<div class="filter">
<label>备注:</label>
<Input type="text" class="searchInput" v-model="remark" />
</div>
<div>
<label>上传文件:</label>
<div class="accountInfoUploadFile">
<Upload
ref="upload"
:show-upload-list="false"
:on-success="handleSuccess1"
:before-upload="handleBeforeUpload"
:on-error="handleError1"
type="drag"
:headers="headers"
:action="UploadAction"
>
<div class="descicon" style="">
<Icon type="md-cloud-upload" size="15"></Icon>
<span>上传文件</span>
</div>
</Upload>
<div v-show="filename" class="hasfile">
{{ filename
}}<Icon
@click.native="delfile"
type="ios-close-circle"
size="15"
/>
</div>
</div>
</div>
</div>
<div slot="footer">
<Button type="text" size="large" @click="modal = false">{{
$t("1033")
}}</Button>
<Button type="primary" size="large" @click="addPost()">{{
$t("1011")
}}</Button>
</div>
</Modal>
</div> </div>
</template> </template>
...@@ -122,7 +239,17 @@ ...@@ -122,7 +239,17 @@
export default { export default {
data() { data() {
return { return {
columns1:[ //导入方法
action:
this.axios.publicPath +
"wms/Upload/Submit?templateName=StorageLocation",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
nonce: localStorage.getItem("nonce"),
sign: localStorage.getItem("sign"),
},
columns1: [
{ {
type: "index2", type: "index2",
title: this.$t("1008"), title: this.$t("1008"),
...@@ -135,106 +262,293 @@ export default { ...@@ -135,106 +262,293 @@ export default {
}, },
}, },
{ {
title:'工装类型', title: "工装类型",
key:'category' key: "category",
}, },
{ {
title:'管理类型', title: "管理类型",
key:'managetype', key: "managetype",
render:(h,params)=>{ render: (h, params) => {
let str = ''; let str = "";
if(params.row.managetype===1){ if (params.row.managetype === 1) {
str = '单件'; str = "单件";
}else if(params.row.managetype===2){ } else if (params.row.managetype === 2) {
str = '批次'; str = "批次";
} }
return h('span',str); return h("span", str);
} },
}, },
{ {
title:'工装料号', title: "工装料号",
key:'partnumber' key: "partnumber",
}, },
{ {
title:'工装名称', title: "工装名称",
key:'name' key: "name",
}, },
{ {
title:'工装编号', title: "工装编号",
key:'code' key: "code",
}, },
{ {
title:'规格型号', title: "规格型号",
key:'specification' key: "specification",
}, },
{ {
title:'数量', title: "数量",
key:'number' key: "number",
}, },
{ {
title:'状态', title: "状态",
key:'status', key: "status",
render:(h,params)=>{ render: (h, params) => {
let str = ''; let str = "";
if(params.row.status===1){ if (params.row.status === 1) {
str = '可用'; str = "可用";
}else{ } else {
str = '停用'; str = "停用";
} }
return h('span',str); return h("span", str);
} },
}, },
{ {
title:'备注', title: "备注",
key:'remark' key: "remark",
}, },
{ {
title:'附件', title: "附件",
key:'filename', key: "filename",
render:(h,params)=>{ render: (h, params) => {
return h('span',{ return h(
style:{ "span",
color:'#2b85e4', {
cursor:'pointer' style: {
color: "#2b85e4",
cursor: "pointer",
},
on: {
click: () => {
let name = params.row.filename;
let url = params.row.fileurl;
if (url) {
this.downFile(url, name);
}
},
},
}, },
on:{ params.row.filename
click:()=>{ );
let name = params.row.filename; },
let url = params.row.fileurl;
if(url){
this.downFile(url,name);
}
}
}
},params.row.filename);
}
}, },
{ {
title:'维护人', title: "维护人",
key:'updator' key: "updator",
}, },
{ {
title:'维护时间', title: "维护时间",
key:'updatetime' key: "updatetime",
} },
], ],
data1: [], data1: [],
total: 0, total: 0,
page: 1, page: 1,
pagesize: 10, pagesize: 10,
modal: false,
type: 0,
typeTree: [],
category: [],
categoryId: 0,
number: "",
name: "",
state: "",
parentType: [],
sonType: [],
parentId: 0,
sonId: 0,
remark: "",
toolingList1: [],
toolingList2: [],
toolingId1: 0,
toolingId2: 0,
spinShow: false,
fileurl: "",
filename: "",
UploadAction: this.axios.publicPath + "config/upload/UploadImage",
}; };
}, },
created() { created() {
this.columns1 = this.$time.initTableTitle(this.columns1); this.columns1 = this.$time.initTableTitle(this.columns1);
this.initFrockType();
}, },
methods: { methods: {
search(page,pagesize){}, search(page, pagesize) {
add(){}, let data = {
edit(){}, category: this.categoryId, //工装类型id
dele(){}, code: this.number,
loadExcel(){}, name: this.name,
exportEecel(){}, // state: this.state, //0停用 1可用
page: this.page,
pagesize: this.pagesize,
// toexcel: 0, //0查询 1导出
};
this.request(
"/acc/FixtureToolsAssembly/GetPageList",
data,
"get"
).then((res) => {
if (res.data.ret == 1) {
this.data1 = res.data.data;
}
});
},
add() {
this.modal = true;
this.type = 1;
},
addPost() {
let data = {
parentid: this.toolingId1, //父级工装ID
fixturetoolid: this.toolingId2, //工装ID
fileurl: this.fileurl, //url
filename: this.filename, //附件名称
status: 1,
};
this.request("/acc/AutomationLocation/Add", data, "post").then(
(res) => {
if (res.data.ret == 1) {
} else {
this.$Message.error(this.$t(res.data.msg));
}
}
);
},
edit() {},
dele() {},
loadExcel() {},
exportEecel() {},
//工装类型
initFrockType() {
this.axios
.request({
url: "/acc/FixtureTools/GetCategoryList",
method: "get",
})
.then((res) => {
if (res.data.ret == 1) {
let arr = res.data.data;
this.contentTree(arr);
this.typeTree = arr;
}
});
},
getCategory(val) {
this.category = val;
this.categoryId =
this.category.length > 0
? this.category[this.category.length - 1]
: 0;
},
getCategory1(val) {
this.parentType = val;
this.parentId =
this.parentType.length > 0
? this.parentType[this.parentType.length - 1]
: 0;
console.log(val);
console.log(this.parentId);
if (this.parentId != 0) {
this.getToolingList(1);
}
},
getCategory2(val) {
this.sonType = val;
this.sonId =
this.sonType.length > 0
? this.sonType[this.sonType.length - 1]
: 0;
if (this.sonId != 0) {
this.getToolingList(2);
}
},
getToolingList(index) {
let id = 0;
id = index == 1 ? this.parentId : this.sonId;
console.log(index);
this.request(
"/acc/FixtureTools/GetFixtureToolList?categoryid=" + id,
"",
"get"
).then((res) => {
if (res.data.ret == 1) {
if (index == 1) {
this.toolingList1 = res.data.data;
}
if (index == 2) {
this.toolingList2 = res.data.data;
}
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
contentTree(arr) {
arr.forEach((ele) => {
ele.disabled = false;
if (
ele.children != undefined &&
ele.children != null &&
ele.children.length != 0
) {
this.contentTree(ele.children);
} else {
ele.children = [];
}
});
},
/*********文件上传 start******** */
handleBeforeUpload(file) {
this.spinShow = true;
if (!file) {
this.spinShow = false;
return false;
}
},
handleSuccess1(res, file) {
this.spinShow = false;
if (res.ret == 1) {
this.$Message.success(this.$t("100378"));
this.filename = file.name;
this.fileurl = res.data;
} else {
this.$Message.error(this.$t(res.msg + ""));
}
},
handleError1() {
this.spinShow = false;
this.$Message.error(this.$t("600512") + "!");
},
delfile() {
this.filename = "";
this.fileurl = "";
},
/*********文件上传 end******** */
request(url, data, type) {
if (type == "get") {
return this.axios.request({
url: url,
params: data,
method: type,
});
} else {
return this.axios.request({
url: url,
data,
method: type,
});
}
},
}, },
}; };
</script> </script>
......
...@@ -654,7 +654,6 @@ export default { ...@@ -654,7 +654,6 @@ export default {
}); });
}, },
linechange(i) { linechange(i) {
console.log(1111111111);
this.a = i; this.a = i;
this.line = this.lineList[i]; this.line = this.lineList[i];
this.initstations(this.line.id); this.initstations(this.line.id);
...@@ -672,7 +671,7 @@ export default { ...@@ -672,7 +671,7 @@ export default {
axios axios
.request({ .request({
url: url:
"http://localhost:8105/acc/SectionProperty/GetSections" "/acc/SectionProperty/GetSections"
, ,
params, params,
method: "get", method: "get",
...@@ -715,6 +714,22 @@ export default { ...@@ -715,6 +714,22 @@ export default {
this.b = i; this.b = i;
this.station = this.stationList[i]; this.station = this.stationList[i];
this.initproduct(this.station.id); this.initproduct(this.station.id);
this.initSn(this.station.id)
},
initSn(sectionid){
if (sectionid > 0) {
axios
.request({
url:
"/acc/SectionProperty/GetSn?productId=" + productid + "&sectionId=" + sectionid,
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
this.qrcode = res.data.data;
}
});
}
}, },
productchange(i) { productchange(i) {
this.c = i; this.c = i;
...@@ -730,7 +745,7 @@ export default { ...@@ -730,7 +745,7 @@ export default {
axios axios
.request({ .request({
url: url:
"/acc/SectionProperty/GetRouteByProduct?productId=" + productid, "/acc/SectionProperty/GetRouteByProduct?productId=" + productid + "&sectionId=" + sectionid,
method: "get", method: "get",
}) })
.then((res) => { .then((res) => {
......
...@@ -28,9 +28,10 @@ namespace Siger.ApiACC.Controllers ...@@ -28,9 +28,10 @@ namespace Siger.ApiACC.Controllers
private readonly ISigerDict _sigerDict; private readonly ISigerDict _sigerDict;
private readonly IAutomationTaskListRepository _automationTaskList; private readonly IAutomationTaskListRepository _automationTaskList;
private readonly ISigerProjectMachineAttributionRepository _sigerProjectMachineAttribution; private readonly ISigerProjectMachineAttributionRepository _sigerProjectMachineAttribution;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
public AutomationController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection,IAutomationLineMode automationLineMode,IAutomationMachineStatus automationMachineStatus,ISigerDict sigerDict,IAutomationTaskListRepository automationTaskList, public AutomationController(IUnitOfWork unitOfWork,ISigerProjectLevelSectionRepository sigerProjectLevelSection,IAutomationLineMode automationLineMode,IAutomationMachineStatus automationMachineStatus,ISigerDict sigerDict,IAutomationTaskListRepository automationTaskList,
ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution) ISigerProjectMachineAttributionRepository sigerProjectMachineAttribution, IAutomationFixtureMonitor automationFixtureMonitor)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -39,6 +40,7 @@ namespace Siger.ApiACC.Controllers ...@@ -39,6 +40,7 @@ namespace Siger.ApiACC.Controllers
_sigerDict = sigerDict; _sigerDict = sigerDict;
_automationTaskList = automationTaskList; _automationTaskList = automationTaskList;
_sigerProjectMachineAttribution = sigerProjectMachineAttribution; _sigerProjectMachineAttribution = sigerProjectMachineAttribution;
_automationFixtureMonitor = automationFixtureMonitor;
} }
/// <summary> /// <summary>
...@@ -181,7 +183,7 @@ namespace Siger.ApiACC.Controllers ...@@ -181,7 +183,7 @@ namespace Siger.ApiACC.Controllers
public IActionResult TaskResult([FromBody]RequestAutomationTaskResult request) public IActionResult TaskResult([FromBody]RequestAutomationTaskResult request)
{ {
//1.检查Tasklist //1.检查Tasklist
var taskObj = _automationTaskList.Get(f => f.guid == request.guid); var taskObj = _automationTaskList.Get(f => f.no== request.guid);
if (taskObj == null) if (taskObj == null)
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
...@@ -311,8 +313,28 @@ namespace Siger.ApiACC.Controllers ...@@ -311,8 +313,28 @@ namespace Siger.ApiACC.Controllers
} }
} }
/// <summary>
/// 创建自动任务
/// </summary>
/// <param name="machineStatus"></param>
/// <param name="actionType"></param>
/// <param name="taskAction"></param>
void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction) void CreateTask(siger_automation_machine_status machineStatus,TaskActionType actionType, TaskAction taskAction)
{ {
//j检查工装监控状态
var monitor = _automationFixtureMonitor.Get(f => f.section == machineStatus.section);
if (monitor==null)
{
Logger.WriteLineInfo($"CreateTask 工装监控状态无数据,请确认业务链正确 ");
return;
}
if (monitor.section==0)
{
Logger.WriteLineInfo($"CreateTask 工装监控状态无当前工站信息,请确认业务链正确 ");
return;
}
_automationTaskList.Insert(new siger_automation_task_list _automationTaskList.Insert(new siger_automation_task_list
{ {
...@@ -328,9 +350,16 @@ namespace Siger.ApiACC.Controllers ...@@ -328,9 +350,16 @@ namespace Siger.ApiACC.Controllers
send = 0, send = 0,
operater = 0, operater = 0,
status = 1, status = 1,
fixtureguid=monitor.fixtureguid,
productcode=monitor.productCode,
locationid=monitor.locationId,
ordercode=monitor.ordernumber,
sn=monitor.sn,
remark="自动任务" remark="自动任务"
}); });
if (_unitOfWork.Commit() > 0) if (_unitOfWork.Commit() > 0)
Logger.WriteLineInfo($"CreateTask 工站 完成"); Logger.WriteLineInfo($"CreateTask 工站 完成");
else else
......
...@@ -23,20 +23,79 @@ namespace Siger.ApiACC.Controllers ...@@ -23,20 +23,79 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository; private readonly IAutomationFixtureToolsCategoryRepository _toolsCategoryRepository;
private readonly IAutomationFixtureToolsRepository _toolsRepository; private readonly IAutomationFixtureToolsRepository _toolsRepository;
private readonly IAutomationLocationRepository _autoLocationRepository; private readonly IAutomationLocationRepository _autoLocationRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor;
private readonly IProductRouteRepository _routeRepository;
public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository, public AutomationLocationController(IUnitOfWork unitOfWork, IAutomationFixtureToolsCategoryRepository toolsCategoryRepository,
IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository) IAutomationFixtureToolsRepository toolsRepository, IAutomationLocationRepository autoLocationRepository,
IAutomationFixtureMonitor fixtureMonitor, IProductRouteRepository routeRepository)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_toolsCategoryRepository = toolsCategoryRepository; _toolsCategoryRepository = toolsCategoryRepository;
_toolsRepository = toolsRepository; _toolsRepository = toolsRepository;
_autoLocationRepository = autoLocationRepository; _autoLocationRepository = autoLocationRepository;
_fixtureMonitor = fixtureMonitor;
_routeRepository = routeRepository;
} }
[HttpGet]
public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize) public IActionResult GetPageList(string wavehouseid, string locationid, int page, int pagesize)
{ {
var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize); var data = _autoLocationRepository.GetPagedList(wavehouseid.ToInt(), locationid.ToInt(), ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize); var list = new List<ResponseAutomationLocation>();
var locations = _autoLocationRepository.GetLocationList(ProjectId);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
foreach (var item in data.Data)
{
if(item.fixturetoolid > 0 && string.IsNullOrEmpty(item.sn))
{
item.materialstate = 1;//有工装无工件
}
else if(item.fixturetoolid > 0 && !string.IsNullOrEmpty(item.sn))
{
item.materialstate = 2;//有工装有工件
}
else if (item.fixturetoolid <= 0 && string.IsNullOrEmpty(item.sn))
{
item.materialstate = 3;//无工装无工件
}
else if (item.fixturetoolid <= 0 && string.IsNullOrEmpty(item.sn))
{
item.materialstate = 4;//无工装有工件
}
var loca = locations.FirstOrDefault(q => q.locationid == item.locaid);
if(loca != null)
{
var locas = GetParentLocations(loca.id, locations);
var locationIds = locas.Select(q => q.id).ToList();
locationIds = locationIds.Distinct().ToList();
locationIds.Reverse();
item.locationIds = locationIds;
}
var cates = GetParentCategoryList(item.cate_guid, categorys);
var cateIds = cates.Select(q => q.id).ToList();
cateIds.Reverse();
item.categoryIds = cateIds;
list.Add(item);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
}
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;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentCategoryList(t.parent, sections)));
}
private IEnumerable<siger_wms_storage_location> GetParentLocations(int pid, IEnumerable<siger_wms_storage_location> types)
{
var query = from c in types where c.id == pid select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentLocations(t.parentid, types)));
} }
[HttpPost] [HttpPost]
...@@ -66,7 +125,7 @@ namespace Siger.ApiACC.Controllers ...@@ -66,7 +125,7 @@ namespace Siger.ApiACC.Controllers
var entity = new siger_automation_location var entity = new siger_automation_location
{ {
guid = Guid.NewGuid().ToString(), guid = Guid.NewGuid().ToString(),
locationid = req.locationid.ToInt(), locationid = location.locationid,
fixturetools = fixturetool.guid, fixturetools = fixturetool.guid,
attachment = req.fileurl, attachment = req.fileurl,
filename = req.filename, filename = req.filename,
...@@ -115,7 +174,7 @@ namespace Siger.ApiACC.Controllers ...@@ -115,7 +174,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
entity.locationid = req.locationid.ToInt(); entity.locationid = location.locationid;
entity.fixturetools = fixturetool.guid; entity.fixturetools = fixturetool.guid;
entity.attachment = req.fileurl; entity.attachment = req.fileurl;
entity.filename = req.filename; entity.filename = req.filename;
......
...@@ -33,9 +33,10 @@ namespace Siger.ApiACC.Controllers ...@@ -33,9 +33,10 @@ namespace Siger.ApiACC.Controllers
private readonly IProductPlanRepository _productPlan; private readonly IProductPlanRepository _productPlan;
private readonly IAutomationFixtureMonitor _automationFixtureMonitor; private readonly IAutomationFixtureMonitor _automationFixtureMonitor;
private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct; private readonly IAutomationFixtureToolsProductRepository _automationFixtureToolsProduct;
private readonly IAutomationFixtureToolsRepository _automationFixtureTools;
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) IProductPlanDetails planDetails,IProductPlanRepository productPlan,IAutomationFixtureMonitor automationFixtureMonitor ,IAutomationFixtureToolsProductRepository automationFixtureToolsProduct,IAutomationFixtureToolsRepository automationFixtureTools)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sigerProjectLevelSection = sigerProjectLevelSection; _sigerProjectLevelSection = sigerProjectLevelSection;
...@@ -47,6 +48,7 @@ namespace Siger.ApiACC.Controllers ...@@ -47,6 +48,7 @@ namespace Siger.ApiACC.Controllers
_productPlan = productPlan; _productPlan = productPlan;
_automationFixtureMonitor = automationFixtureMonitor; _automationFixtureMonitor = automationFixtureMonitor;
_automationFixtureToolsProduct = automationFixtureToolsProduct; _automationFixtureToolsProduct = automationFixtureToolsProduct;
_automationFixtureTools = automationFixtureTools;
} }
/// <summary> /// <summary>
...@@ -139,6 +141,8 @@ namespace Siger.ApiACC.Controllers ...@@ -139,6 +141,8 @@ namespace Siger.ApiACC.Controllers
var result = new ResponsePlanlFixtureInfo var result = new ResponsePlanlFixtureInfo
{ {
OrderNumber = monitor.ordernumber, OrderNumber = monitor.ordernumber,
FixtureGuid=monitor.fixtureguid,
FixtureName=monitor.fixturename,
ProductCode=monitor.productCode, ProductCode=monitor.productCode,
ProductName=monitor.productName, ProductName=monitor.productName,
Sn=monitor.sn, Sn=monitor.sn,
...@@ -159,7 +163,7 @@ namespace Siger.ApiACC.Controllers ...@@ -159,7 +163,7 @@ namespace Siger.ApiACC.Controllers
var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code); var result = _automationFixtureToolsProduct.GetPlanFixtureInfo(ProjectId, code);
if (result==null) if (result==null)
{ {
throw new BadRequestException(CncEnum.PlanHasExist); throw new BadRequestException(AccEnum.FixtureOrderNulll);
} }
var sn = _automationTaskList.CreateRandonSn(result.ProductCode); var sn = _automationTaskList.CreateRandonSn(result.ProductCode);
result.Sn = sn; result.Sn = sn;
...@@ -179,18 +183,32 @@ namespace Siger.ApiACC.Controllers ...@@ -179,18 +183,32 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var machineStatus = _automationMachineStatus.Get(f => f.machineid==machineAttr.machine); var machineStatus = _automationMachineStatus.Get(f => f.machineid == machineAttr.machine);
if (machineStatus==null) if (machineStatus == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
if (machineStatus.enable==0)
{ {
throw new BadRequestException(AccEnum.MachineDisable); // throw new BadRequestException(CommonEnum.RecordNotFound);
//上料设备状态与PLC 无关,
//需要手动插入
_automationMachineStatus.Insert(new siger_automation_machine_status
{
enable = 1,
section = loading.section,
machineid = machineAttr.machine,
projectId = ProjectId,
status = (int)Automation.MachineStatus.Produce,
updatetime = DateTime.Now
});
} }
if(machineStatus.status!=(int)Automation.MachineStatus.Waiting) else
{ {
throw new BadRequestException(AccEnum.MachineBusy); if (machineStatus.enable == 0)
{
throw new BadRequestException(AccEnum.MachineDisable);
}
if (machineStatus.status != (int)Automation.MachineStatus.Waiting)
{
throw new BadRequestException(AccEnum.MachineBusy);
}
} }
if (!_automationTaskList.CanTask(ProjectId,loading.section)) if (!_automationTaskList.CanTask(ProjectId,loading.section))
{ {
...@@ -208,7 +226,8 @@ namespace Siger.ApiACC.Controllers ...@@ -208,7 +226,8 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CncEnum.PlanHasExist); throw new BadRequestException(CncEnum.PlanHasExist);
} }
//检查工装 //检查工装
var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code); var fixtureToolsObj = _automationFixtureTools.GetProductFixtureLocation(ProjectId,loading.guid);
//var fixtureToolsObj = _automationFixtureToolsProduct.GetFixtureInfoByProductCode(ProjectId, plan.product_code);
if (fixtureToolsObj == null) if (fixtureToolsObj == null)
{ {
throw new BadRequestException(AccEnum.FixtureToolsIsNone); throw new BadRequestException(AccEnum.FixtureToolsIsNone);
...@@ -248,6 +267,7 @@ namespace Siger.ApiACC.Controllers ...@@ -248,6 +267,7 @@ namespace Siger.ApiACC.Controllers
_automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor _automationFixtureMonitor.Insert(new siger_automation_fixture_tools_monitor
{ {
fixtureguid=fixtureToolsObj.FixtureGuid, fixtureguid=fixtureToolsObj.FixtureGuid,
fixturename=fixtureToolsObj.FixtureName,
projectId=ProjectId, projectId=ProjectId,
section=loading.section, section=loading.section,
sn=sn, sn=sn,
......
...@@ -37,7 +37,30 @@ namespace Siger.ApiACC.Controllers ...@@ -37,7 +37,30 @@ namespace Siger.ApiACC.Controllers
public IActionResult GetPageList(string category, string code, string name, int page, int pagesize) public IActionResult GetPageList(string category, string code, string name, int page, int pagesize)
{ {
var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, ProjectId, page, pagesize); var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize); var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var list = new List<ResponseAumationFixtureToolsAssembly>();
foreach(var item in data.Data)
{
var cates = GetParentCategoryList(item.cate_guid, categorys);
var cateIds = cates.Select(q => q.id).ToList();
cateIds.Reverse();
item.categoryids = cateIds;
var parentcates = GetParentCategoryList(item.parentcate_guid, categorys);
var parentcateIds = parentcates.Select(q => q.id).ToList();
parentcateIds.Reverse();
item.parentcategoryids = parentcateIds;
list.Add(item);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
}
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;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentCategoryList(t.parent, sections)));
} }
[HttpGet] [HttpGet]
...@@ -55,22 +78,50 @@ namespace Siger.ApiACC.Controllers ...@@ -55,22 +78,50 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.ParameterMiss); throw new BadRequestException(RequestEnum.ParameterMiss);
} }
if(req.parentid == req.fixturetoolid)
{
throw new BadRequestException(RequestEnum.ParentSonSame);
}
var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId); var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId);
var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId); if (parent == null)
if (son == null)
{ {
throw new BadRequestException(RequestEnum.FixtureToolNotFound); throw new BadRequestException(RequestEnum.FixtureToolNotFound);
} }
if (parent == null) var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId);
if (son == null)
{ {
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
} }
var parentGuid = parent?.guid ?? ""; var parentGuid = parent.guid;
var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid); var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid);
if (exsit != null) if (exsit != null)
{ {
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if(parentExsit != null)
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
if (_toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid) == null)
{
var parentEntity = new siger_automation_fixture_tools_assembly
{
guid = Guid.NewGuid().ToString(),
parent = "",
son = parent.guid,
creator = UserId,
createtime = DateTime.Now,
attachment = req.fileurl,
filename = req.filename,
projectId = ProjectId,
updatetime = DateTime.Now,
updator = UserId,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
};
_toolsAssemblyRepository.Insert(parentEntity);
}
var entity = new siger_automation_fixture_tools_assembly var entity = new siger_automation_fixture_tools_assembly
{ {
...@@ -104,24 +155,57 @@ namespace Siger.ApiACC.Controllers ...@@ -104,24 +155,57 @@ namespace Siger.ApiACC.Controllers
{ {
throw new BadRequestException(RequestEnum.ParameterMiss); throw new BadRequestException(RequestEnum.ParameterMiss);
} }
if (!string.IsNullOrEmpty(req.parentid) && !string.IsNullOrEmpty(req.fixturetoolid) &&
req.parentid == req.fixturetoolid)
{
throw new BadRequestException(RequestEnum.ParentSonSame);
}
var entity = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.id == req.id); var entity = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.id == req.id);
if(entity == null) if(entity == null)
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(CommonEnum.RecordNotFound);
} }
var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId); var parent = _toolsRepository.Get(q => q.id == req.parentid.ToInt() && q.projectId == ProjectId);
if (parent == null)
{
throw new BadRequestException(RequestEnum.FixtureToolNotFound);
}
var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId); var son = _toolsRepository.Get(q => q.id == req.fixturetoolid.ToInt() && q.projectId == ProjectId);
if (son == null) if (son == null)
{ {
throw new BadRequestException(RequestEnum.FixtureToolNotFound); throw new BadRequestException(RequestEnum.FixtureToolNotFound);
} }
var parentGuid = parent?.guid ?? ""; var parentGuid = parent.guid;
var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid && var exsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == son.guid && q.parent == parentGuid &&
q.id != req.id); q.id != req.id);
if (exsit != null) if (exsit != null)
{ {
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if (parentExsit != null)
{
throw new BadRequestException(RequestEnum.LevelCountError);
}
if (_toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid) == null)
{
var parentEntity = new siger_automation_fixture_tools_assembly
{
guid = Guid.NewGuid().ToString(),
parent = "",
son = parent.guid,
creator = UserId,
createtime = DateTime.Now,
attachment = req.fileurl,
filename = req.filename,
projectId = ProjectId,
updatetime = DateTime.Now,
updator = UserId,
status = req.status.ToInt() == (int)RowState.Valid ? (int)RowState.Valid : (int)RowState.Invalid,
};
_toolsAssemblyRepository.Insert(parentEntity);
}
entity.parent = parent?.guid ?? ""; entity.parent = parent?.guid ?? "";
entity.son = son.guid; entity.son = son.guid;
......
...@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository; ...@@ -14,6 +14,11 @@ using Siger.Middlelayer.Repository;
using Siger.Middlelayer.Repository.Extensions; using Siger.Middlelayer.Repository.Extensions;
using System.Linq; using System.Linq;
using Siger.Middlelayer.Repository.Entities; using Siger.Middlelayer.Repository.Entities;
using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Utility.Helpers;
using Siger.Middlelayer.Utility.ImportEntities;
using System.IO;
using Siger.Middlelayer.Log;
namespace Siger.ApiACC.Controllers namespace Siger.ApiACC.Controllers
{ {
...@@ -31,9 +36,9 @@ namespace Siger.ApiACC.Controllers ...@@ -31,9 +36,9 @@ namespace Siger.ApiACC.Controllers
_toolsRepository = toolsRepository; _toolsRepository = toolsRepository;
} }
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize) 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); var data = _toolsRepository.GetPagedList(category.ToInt(), code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize, toexcel);
var list = new List<ResponseFixtureTools>(); var list = new List<ResponseFixtureTools>();
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList(); var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
foreach(var item in data.Data) foreach(var item in data.Data)
...@@ -44,9 +49,62 @@ namespace Siger.ApiACC.Controllers ...@@ -44,9 +49,62 @@ namespace Siger.ApiACC.Controllers
item.categoryids = cateIds; item.categoryids = cateIds;
list.Add(item); list.Add(item);
} }
if (toexcel.ToInt() == 1)
{
return ExportExcel(data.Data);
}
return new PagedObjectResult(list, data.Total, page, pagesize); return new PagedObjectResult(list, data.Total, page, pagesize);
} }
private IActionResult ExportExcel(IEnumerable<ResponseFixtureTools> data)
{
var rootDir = FileSystemHelper.GetPhysicalFolders(FileSystemHelper.CommonFileSetting.PhysicalFolder, FileSystemHelper.ExportFileName);
if (!data.Any())
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var dataList = new List<FixtureToolsTemplate>();
foreach (var item in data)
{
dataList.Add(new FixtureToolsTemplate
{
Catgeory = item.category,
Name = item.name,
Manage = item.managetype == 1 ? "单件" : "批次",
PartNumber = item.partnumber,
Code = item.code,
Specfication = item.specification,
Number = item.number.ToString(),
Status = item.status == 1 ? "可用" : "停用",
Remark = item.remark
});
}
if (dataList.Any())
{
EpPlusExcelHelper<FixtureToolsTemplate> helper = null;
try
{
helper = new EpPlusExcelHelper<FixtureToolsTemplate>();
var temporaryFileName = $"工装台账_FixtureToolsData_{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 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) 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; var query = from c in sections where c.guid == parentId select c;
...@@ -191,30 +249,59 @@ namespace Siger.ApiACC.Controllers ...@@ -191,30 +249,59 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(CommonEnum.Fail); throw new BadRequestException(CommonEnum.Fail);
} }
[HttpGet] [HttpGet]
public IActionResult GetFxitureTooolList() public IActionResult GetCategoryPageList(string id, int page, int pagesize, string toexcel = "")
{ {
var list = _toolsRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).Select( var data = _toolsCategoryRepository.GetPagedList(id.ToInt(), ProjectId, page, pagesize, toexcel);
q => new if(toexcel.ToInt() == 1)
{ {
q.id, return ExportCategoryExcel(data.Data);
q.code, }
q.partnumber, return new PagedObjectResult(data.Data, data.Total, page, pagesize);
q.name,
q.specification,
q.number
}).ToList();
return new ObjectResult(list);
} }
private IActionResult ExportCategoryExcel(IEnumerable<ResponseFixtureToolsCategory> data)
{
var rootDir = FileSystemHelper.GetPhysicalFolders(FileSystemHelper.CommonFileSetting.PhysicalFolder, FileSystemHelper.ExportFileName);
if (!data.Any())
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var dataList = new List<FixtureToolsCategoryTemplate>();
[HttpGet] foreach (var item in data)
public IActionResult GetCategoryPageList(string id, int page, int pagesize) {
{ dataList.Add(new FixtureToolsCategoryTemplate
var data = _toolsCategoryRepository.GetPagedList(id.ToInt(), ProjectId, page, pagesize); {
return new PagedObjectResult(data.Data, data.Total, page, pagesize); Fixture = item.name,
Parent = item.parentname
});
}
if (dataList.Any())
{
EpPlusExcelHelper<FixtureToolsCategoryTemplate> helper = null;
try
{
helper = new EpPlusExcelHelper<FixtureToolsCategoryTemplate>();
var temporaryFileName = $"工装类型_FixtureToolsCategoryData_{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 Category Data failed, error:" + e);
throw new BadRequestException(RequestEnum.ExportFailed);
}
finally
{
helper?.Dispose();
}
}
throw new BadRequestException(CommonEnum.Fail);
} }
[HttpPost] [HttpPost]
...@@ -370,5 +457,13 @@ namespace Siger.ApiACC.Controllers ...@@ -370,5 +457,13 @@ namespace Siger.ApiACC.Controllers
} }
return resp; return resp;
} }
[HttpGet]
public IActionResult GetFixtureToolList(string categoryid)
{
var list = _toolsRepository.GetDataList(categoryid.ToInt(), ProjectId);
return new ObjectResult(list);
}
} }
} }
...@@ -36,10 +36,28 @@ namespace Siger.ApiACC.Controllers ...@@ -36,10 +36,28 @@ namespace Siger.ApiACC.Controllers
_productRepository = productRepository; _productRepository = productRepository;
} }
[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)
{ {
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);
return new PagedObjectResult(data.Data, data.Total, page, pagesize); 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)
{
var cates = GetParentCategoryList(item.cate_guid, categorys);
var cateIds = cates.Select(q => q.id).ToList();
cateIds.Reverse();
item.categoryids = cateIds;
list.Add(item);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
}
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;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentCategoryList(t.parent, sections)));
} }
[HttpPost] [HttpPost]
...@@ -72,6 +90,7 @@ namespace Siger.ApiACC.Controllers ...@@ -72,6 +90,7 @@ namespace Siger.ApiACC.Controllers
fixturetools = fixtureTool.guid, fixturetools = fixtureTool.guid,
remark = req.remark, remark = req.remark,
productid = req.productid.ToInt(), productid = req.productid.ToInt(),
productcode = product.code,
projectId = ProjectId, projectId = ProjectId,
createtime = DateTime.Now, createtime = DateTime.Now,
updatetime = DateTime.Now, updatetime = DateTime.Now,
...@@ -123,6 +142,7 @@ namespace Siger.ApiACC.Controllers ...@@ -123,6 +142,7 @@ namespace Siger.ApiACC.Controllers
entity.fixturetools = fixtureTool.guid; entity.fixturetools = fixtureTool.guid;
entity.remark = req.remark; entity.remark = req.remark;
entity.productid = req.productid.ToInt(); entity.productid = req.productid.ToInt();
entity.productcode = product.code;
entity.updatetime = DateTime.Now; entity.updatetime = DateTime.Now;
entity.updator = UserId; entity.updator = UserId;
entity.filename = req.filename; entity.filename = req.filename;
......
...@@ -23,14 +23,17 @@ namespace Siger.ApiACC.Controllers ...@@ -23,14 +23,17 @@ namespace Siger.ApiACC.Controllers
private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository; private readonly IAutomationSectionPropertyRepository _sectionPropertyRepository;
private readonly ISigerProjectLevelSectionRepository _levelSectionRepository; private readonly ISigerProjectLevelSectionRepository _levelSectionRepository;
private readonly IProductionBeatSetRepository _beatSetRepository; private readonly IProductionBeatSetRepository _beatSetRepository;
private readonly IAutomationFixtureMonitor _fixtureMonitor;
public SectionPropertyController(IUnitOfWork unitOfWork, IAutomationSectionPropertyRepository sectionPropertyRepository, public SectionPropertyController(IUnitOfWork unitOfWork, IAutomationSectionPropertyRepository sectionPropertyRepository,
ISigerProjectLevelSectionRepository levelSectionRepository, IProductionBeatSetRepository beatSetRepository) ISigerProjectLevelSectionRepository levelSectionRepository, IProductionBeatSetRepository beatSetRepository,
IAutomationFixtureMonitor fixtureMonitor)
{ {
_unitOfWork = unitOfWork; _unitOfWork = unitOfWork;
_sectionPropertyRepository = sectionPropertyRepository; _sectionPropertyRepository = sectionPropertyRepository;
_levelSectionRepository = levelSectionRepository; _levelSectionRepository = levelSectionRepository;
_beatSetRepository = beatSetRepository; _beatSetRepository = beatSetRepository;
_fixtureMonitor = fixtureMonitor;
} }
[HttpGet] [HttpGet]
...@@ -44,10 +47,11 @@ namespace Siger.ApiACC.Controllers ...@@ -44,10 +47,11 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(sections); return new ObjectResult(sections);
} }
public IActionResult GetRouteByProduct(string productId) [HttpGet]
public IActionResult GetRouteByProduct(string productId, int sectionId)
{ {
var list = _beatSetRepository.GetList(q => q.projectID == ProjectId && q.status == (int)RowState.Valid && q.product_name.ToInt() == productId.ToInt()). var list = _beatSetRepository.GetList(q => q.projectID == ProjectId && q.status == (int)RowState.Valid && q.product_name.ToInt() == productId.ToInt() &&
Select(q => new q.section_id == sectionId).Select(q => new
{ {
q.id, q.id,
name = q.route_name, name = q.route_name,
...@@ -56,5 +60,13 @@ namespace Siger.ApiACC.Controllers ...@@ -56,5 +60,13 @@ namespace Siger.ApiACC.Controllers
return new ObjectResult(list); return new ObjectResult(list);
} }
[HttpGet]
public IActionResult GetSn(int sectionid)
{
var monitor = _fixtureMonitor.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.section == sectionid).OrderByDescending(q => q.updatetime).
FirstOrDefault();
return new ObjectResult(monitor?.sn ?? "");
}
} }
} }
using FluentScheduler; using FluentScheduler;
using NPOI.SS.Formula.Functions;
using Siger.Middlelayer.Log; using Siger.Middlelayer.Log;
using Module = Siger.Middlelayer.Common.Module; using Module = Siger.Middlelayer.Common.Module;
...@@ -11,7 +12,8 @@ namespace Siger.ApiACC.Tasks ...@@ -11,7 +12,8 @@ namespace Siger.ApiACC.Tasks
//Logger.RegisterLogEngine(Module.Acc); //Logger.RegisterLogEngine(Module.Acc);
//Schedule<AccCalculateTraceJob>().ToRunNow().AndEvery(30).Minutes(); //Schedule<AccCalculateTraceJob>().ToRunNow().AndEvery(30).Minutes();
Logger.RegisterTxtLogEngine(Module.Acc);
Schedule<AutoMES>().ToRunNow().AndEvery(10).Seconds();
} }
} }
} }
using FluentScheduler; using FluentScheduler;
using Newtonsoft.Json;
using Siger.Middlelayer.AccRepository.Request;
using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Configuration;
using Siger.Middlelayer.Common.Helpers;
using Siger.Middlelayer.Common.Log;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -12,19 +18,103 @@ namespace Siger.ApiACC.Tasks ...@@ -12,19 +18,103 @@ namespace Siger.ApiACC.Tasks
public void Execute() public void Execute()
{ {
throw new NotImplementedException(); Logger.WriteLineInfo($"execute mes job");
var projectId = GetProjectId();
var hostDic = GetHost();
if (projectId==0 || !hostDic.Any())
{
Logger.WriteLineInfo($"配置未完整");
return;
}
using (DBhelper dbhelper = new DBhelper())
{
var tasklist = dbhelper.GetTaskList(projectId);
if (!tasklist.Any())
{
Logger.WriteLineInfo($"无任务下发");
return;
}
var tasks = tasklist.OrderBy(s => s.actiontype);
var task = tasks.FirstOrDefault();
var sendToPLC = new RequestPLC
{
RStation = task.sectionid,
Fixture = task.fixtureguid,
RequestForm = task.no,
RobotStep = (int)task.action,
StorageNo = task.locationid,
SN = task.sn,
Program = task.programnumber
};
var result = PushTask(hostDic,sendToPLC, out string message);
if (!result)
{
Logger.WriteLineError($"TASK 下发失败 : {message}");
return;
}
task.send = 1;
if (!dbhelper.UpdateTask(task))
{
Logger.WriteLineError($"更新TASK 下发状态失败");
}
}
} }
public void Dispose() public void Dispose()
{ {
throw new NotImplementedException();
} }
/// <summary>
/// 下发任务
/// </summary>
/// <param name="ip"></param>
/// <param name="port"></param>
/// <param name="request"></param>
/// <param name="msg"></param>
private bool PushTask(string ip,RequestPLC request,out string msg)
{
msg = string.Empty;
try
{
var param = JsonHelper.SerializerToJsonString(request);
var retstring = HttpHelper.HttpPost($"{ip}{CommonConst.SenTaskToMES}", "application/json", param);
var result = JsonConvert.DeserializeObject<ResponsePlC>(retstring);
if (result.return_code != 0)
{
msg = $"PushTask failed,URL{ip} input:{param } result :{result.return_desc}";
return false;
}
return true;
}catch(Exception ex)
{
msg = ex.ToString();
}
return false;
}
//获取TaskList private int GetProjectId()
private List<int>GetTaskList()
{ {
var _pid = ConfigManager.GetValue("ProjectSetting", "ProjectId", string.Empty);
if (string.IsNullOrEmpty(_pid))
Logger.WriteLineError("DbSetting about [ProjectSetting] ProjectId not found.");
return int.Parse(_pid);
}
private string GetHost()
{
var host = ConfigManager.GetValue("ProjectSetting", "Host", string.Empty);
if (string.IsNullOrEmpty(host))
{
Logger.WriteLineError("DbSetting about [ProjectSetting] Host not found.");
return null;
}
return host;
return new List<int>();
} }
} }
} }
using Siger.Middlelayer.AccRepository; using Siger.Middlelayer.AccRepository;
using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.CncRepository; using Siger.Middlelayer.CncRepository;
using Siger.Middlelayer.Repository; using Siger.Middlelayer.Repository;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using static Siger.Middlelayer.Share.Enum.ModuleEnum.Automation;
namespace Siger.ApiACC.Tasks namespace Siger.ApiACC.Tasks
{ {
public class DBhelper public class DBhelper : IDisposable
{ {
private static DBhelper _helper;
public static DBhelper Instance = _helper ?? (_helper = new DBhelper());
public ApiCncDbContext CncDbContext; private readonly ApiCncDbContext CncDbContext;
public ApiAccDbContext AccDbContext; private readonly ApiAccDbContext AccDbContext;
public ApiConfigDbContext ConfigDbContext; private readonly ApiConfigDbContext ConfigDbContext;
static DBhelper() public DBhelper()
{
}
public void LoadDbContext()
{ {
CncDbContext = new ApiCncDbContext(); CncDbContext = new ApiCncDbContext();
AccDbContext = new ApiAccDbContext(); AccDbContext = new ApiAccDbContext();
ConfigDbContext = new ApiConfigDbContext(); ConfigDbContext = new ApiConfigDbContext();
} }
public List<int> GetTaskList()
internal bool CanTask(int projectId, int section)
{ {
return new List<int>(); var taskObj = AccDbContext.siger_automation_task_list.FirstOrDefault(f => f.projectId == projectId && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
if (taskObj == null)
return true;
else
return false;
}
/// <summary>
/// 获取未推送tasklist
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public IEnumerable<siger_automation_task_list> GetTaskList(int projectId)
{
var taskObjs = AccDbContext.siger_automation_task_list.Where(f => f.projectId == projectId && f.send==0 && f.status >= (int)TaskResultStatus.Cancel && f.status < (int)TaskResultStatus.Complated);
return taskObjs;
}
public siger_automation_fixture_tools_monitor GetMonitor(int section)
{
return AccDbContext.siger_automation_fixture_tools_moniter.FirstOrDefault(f => f.section == section);
}
public bool UpdateTask(siger_automation_task_list taskNo)
{
AccDbContext.siger_automation_task_list.Update(taskNo);
return AccDbContext.SaveChanges() > 0;
} }
public void Dispose() public void Dispose()
{ {
...@@ -37,5 +62,6 @@ namespace Siger.ApiACC.Tasks ...@@ -37,5 +62,6 @@ namespace Siger.ApiACC.Tasks
AccDbContext?.Dispose(); AccDbContext?.Dispose();
ConfigDbContext?.Dispose(); ConfigDbContext?.Dispose();
} }
} }
} }
...@@ -9,7 +9,7 @@ namespace Siger.ApiCNC.Tasks ...@@ -9,7 +9,7 @@ namespace Siger.ApiCNC.Tasks
{ {
public CncRegistry() public CncRegistry()
{ {
Schedule<ProduceEfficiencyJob>().ToRunNow().AndEvery(1).Days().At(3,0); //Schedule<ProduceEfficiencyJob>().ToRunNow().AndEvery(1).Days().At(3,0);
} }
} }
} }
...@@ -1127,5 +1127,67 @@ namespace Siger.ApiWMS.Controllers ...@@ -1127,5 +1127,67 @@ namespace Siger.ApiWMS.Controllers
return query.ToList().Concat(query.ToList().SelectMany(t => GetSonTypes(t.id, types))); return query.ToList().Concat(query.ToList().SelectMany(t => GetSonTypes(t.id, types)));
} }
[HttpGet]
public IActionResult GetLocationTree(int warehouseid)
{
var locationTypes = locationtype.GetList(q => q.projectid == ProjectId && q.status == (int)RowState.Valid).ToList();
var sonLocationTypes = GetSonTypes(0, locationTypes).ToList();
var lastLocationId = sonLocationTypes.LastOrDefault()?.id ?? 0;
var allLocas = location.GetList(q => q.projectid == ProjectId && q.status == (int)RowState.Valid).ToList();
var locations = allLocas.Where(q => q.typeid == lastLocationId);
if(warehouseid > 0)
{
locations = locations.Where(q => q.storageid == warehouseid);
}
var locationTreeList = new List<LevelSectionTree>();
foreach(var loca in locations)
{
var locas = GetParentLocations(loca.id, allLocas.Select(q => new LevelSectionTree
{
id = q.id,
pid = q.parentid,
title = q.realname,
name = q.realname
}));
locationTreeList.AddRange(locas);
}
var locationTree = locationTreeList.GroupBy(q => q.id).Select(q => q.FirstOrDefault()).ToList();
return new ObjectResult(ConvertToTree(locationTree));
}
private IEnumerable<LevelSectionTree> GetParentLocations(int pid, IEnumerable<LevelSectionTree> types)
{
var query = from c in types where c.id == pid select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentLocations(t.pid, types)));
}
private IList<LevelSectionTree> ConvertToTree(IEnumerable<LevelSectionTree> models)
{
var section = new Dictionary<int, LevelSectionTree>();
foreach (var item in models)
{
section.Add(item.id, item);
}
var result = new List<LevelSectionTree>();
foreach (var item in section.Values)
{
if (item.pid == 0)
{
result.Add(item);
}
else
{
if (section.ContainsKey(item.pid))
{
section[item.pid].AddChilrden(item);
}
}
}
return result;
}
} }
} }
\ No newline at end of file
...@@ -105,5 +105,7 @@ ...@@ -105,5 +105,7 @@
/// 罗美特追溯附件 存放路径 /// 罗美特追溯附件 存放路径
/// </summary> /// </summary>
public const string MetekAttachmentFilePath = "attachment"; public const string MetekAttachmentFilePath = "attachment";
public const string SenTaskToMES = "/distributiontask";
} }
} }
...@@ -327,6 +327,8 @@ namespace Siger.Middlelayer.Common.ModuleEnum ...@@ -327,6 +327,8 @@ namespace Siger.Middlelayer.Common.ModuleEnum
TaskProcessing, TaskProcessing,
[Description("产品工装未找到")] [Description("产品工装未找到")]
FixtureToolsIsNone, FixtureToolsIsNone,
[Description("未找到工装信息")]
FixtureOrderNulll
} }
public enum SeriNumCfg public enum SeriNumCfg
......
...@@ -1473,5 +1473,8 @@ namespace Siger.Middlelayer.Common ...@@ -1473,5 +1473,8 @@ namespace Siger.Middlelayer.Common
[Description("ID重复")] [Description("ID重复")]
IDExist, IDExist,
[Description("父级和子级不能相同")]
ParentSonSame,
} }
} }
using Siger.Middlelayer.Utility.ExcelImport;
namespace Siger.Middlelayer.Utility.ImportEntities
{
public class FixtureToolsCategoryTemplate : ImportBase
{
[ExcelColumn("工装类型*")]
public string Fixture { get; set; }
[ExcelColumn("上级类型")]
public string Parent { get; set; }
}
public class FixtureToolsTemplate : 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("备注")]
public string Remark { get; set; }
}
public class FixtureToolsProductTemplate : ImportBase
{
[ExcelColumn("工装编号*")]
public string FixtureTool { get; set; }
[ExcelColumn("产品名称*")]
public string Product { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
}
public class FixtureToolsAssmeblyTemplate : ImportBase
{
[ExcelColumn("父工装编号*")]
public string ParentFixtureTool { get; set; }
[ExcelColumn("子工装编号*")]
public string FixtureTool { get; set; }
[ExcelColumn("备注")]
public string Remark { get; set; }
}
}
...@@ -22,7 +22,6 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -22,7 +22,6 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 附件 /// 附件
/// </summary> /// </summary>
public string attachment { get; set; } public string attachment { get; set; }
public string fileurl { get; set; }
/// <summary> /// <summary>
/// 附件名称 /// 附件名称
/// </summary> /// </summary>
......
...@@ -11,6 +11,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -11,6 +11,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public string fixtureguid { get; set; } public string fixtureguid { get; set; }
/// <summary> /// <summary>
/// 工装名称
/// </summary>
public string fixturename { get; set; }
/// <summary>
/// 当前工站ID /// 当前工站ID
/// </summary> /// </summary>
public int section { get; set; } public int section { get; set; }
......
...@@ -25,6 +25,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -25,6 +25,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 更新时间 /// 更新时间
/// </summary> /// </summary>
public DateTime updatetime { get; set; } public DateTime updatetime { get; set; }
/// <summary>
/// 程序号
/// </summary>
public string program { get; set; }
} }
} }
...@@ -16,6 +16,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -16,6 +16,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
public string no { get; set; } public string no { get; set; }
/// <summary> /// <summary>
/// 工装GUID
/// </summary>
public string fixtureguid { get; set; }
/// <summary>
/// 工位ID /// 工位ID
/// </summary> /// </summary>
public int sectionid { get; set; } public int sectionid { get; set; }
...@@ -40,6 +44,10 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -40,6 +44,10 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// </summary> /// </summary>
public int productid { get; set; } public int productid { get; set; }
/// <summary> /// <summary>
/// 产品code
/// </summary>
public string productcode { get; set; }
/// <summary>
/// 工序ID /// 工序ID
/// </summary> /// </summary>
public int processid { get; set; } public int processid { get; set; }
...@@ -51,10 +59,7 @@ namespace Siger.Middlelayer.AccRepository.Entities ...@@ -51,10 +59,7 @@ namespace Siger.Middlelayer.AccRepository.Entities
/// 储位位置 /// 储位位置
/// </summary> /// </summary>
public int locationid { get; set; } public int locationid { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string fixtureguid { get; set; }
/// <summary> /// <summary>
/// Task 执行动作类型 1 手动 2 自动 /// Task 执行动作类型 1 手动 2 自动
......
...@@ -26,7 +26,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -26,7 +26,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var query = from q in _context.siger_automation_fixture_tools_assembly var query = from q in _context.siger_automation_fixture_tools_assembly
join t1 in _context.siger_automation_fixture_tools on q.parent equals t1.guid into tt1 join t1 in _context.siger_automation_fixture_tools on q.parent equals t1.guid into tt1
from t1 in tt1.DefaultIfEmpty() from t1 in tt1.DefaultIfEmpty()
join c1 in _context.siger_automation_fixture_tools_category on t1.category equals c1.guid join c1 in _context.siger_automation_fixture_tools_category on t1.category equals c1.guid into cc1
from c1 in cc1.DefaultIfEmpty()
join t2 in _context.siger_automation_fixture_tools on q.son equals t2.guid join t2 in _context.siger_automation_fixture_tools on q.son equals t2.guid
join c2 in _context.siger_automation_fixture_tools_category on t2.category equals c2.guid join c2 in _context.siger_automation_fixture_tools_category on t2.category equals c2.guid
join u in _context.siger_project_user on q.updator equals u.mid into uu join u in _context.siger_project_user on q.updator equals u.mid into uu
...@@ -48,7 +49,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -48,7 +49,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename = q.filename, filename = q.filename,
categoryid = c2.id, categoryid = c2.id,
category = c2.name, category = c2.name,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "" updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
cate_guid = t2.guid,
parentcate_guid = t1.guid
}; };
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true; Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true;
if (category > 0) if (category > 0)
......
...@@ -7,6 +7,7 @@ using Siger.Middlelayer.AccRepository.Entities; ...@@ -7,6 +7,7 @@ using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface; using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response; using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common; using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Repository.Data.Acc; using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged; using Siger.Middlelayer.Repository.Paged;
...@@ -20,7 +21,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -20,7 +21,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
_context = context; _context = context;
} }
public IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize) public IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize, string toexcel = "")
{ {
Expression<Func<ResponseFixtureToolsCategory, bool>> FunNum = f => true; Expression<Func<ResponseFixtureToolsCategory, bool>> FunNum = f => true;
var query = from q in _context.siger_automation_fixture_tools_category var query = from q in _context.siger_automation_fixture_tools_category
...@@ -42,9 +43,17 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -42,9 +43,17 @@ namespace Siger.Middlelayer.AccRepository.Repositories
{ {
FunNum = q => q.id == id; FunNum = q => q.id == id;
} }
var entities = query.Where(FunNum).OrderBy(q => q.parentid).OrderBy(q => q.createtime).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList(); if(toexcel.ToInt() == 1)
var totalCount = query.Where(FunNum).Count(); {
return new PagedCollectionResult<ResponseFixtureToolsCategory>(entities, totalCount); var entities = query.Where(FunNum).OrderBy(q => q.parentid).OrderBy(q => q.createtime).AsNoTracking().ToList();
return new PagedCollectionResult<ResponseFixtureToolsCategory>(entities, entities.Count);
}
else
{
var entities = query.Where(FunNum).OrderBy(q => q.parentid).OrderBy(q => q.createtime).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList();
var totalCount = query.Where(FunNum).Count();
return new PagedCollectionResult<ResponseFixtureToolsCategory>(entities, totalCount);
}
} }
} }
} }
...@@ -28,7 +28,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -28,7 +28,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
where q.projectId == projectId && q.productcode==productCode && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid where q.projectId == projectId && q.productcode==productCode && q.status == (int)RowState.Valid && t.status == (int)RowState.Valid
select new ResponseProductFixtureInfo select new ResponseProductFixtureInfo
{ {
FixtureId=t.id, FixtureName=t.name,
FixtureGuid=t.guid, FixtureGuid=t.guid,
ProductCode=q.productcode, ProductCode=q.productcode,
Location=l.locationid, Location=l.locationid,
...@@ -61,7 +61,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -61,7 +61,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename = q.filename, filename = q.filename,
partnumber = t.partnumber, partnumber = t.partnumber,
specfication = t.specification, specfication = t.specification,
productcode = p.code productcode = p.code,
cate_guid = c.guid ?? ""
}; };
Expression<Func<ResponseAumationFixtureToolsProduct, bool>> categoryExpression = f => true; Expression<Func<ResponseAumationFixtureToolsProduct, bool>> categoryExpression = f => true;
if (category > 0) if (category > 0)
...@@ -89,17 +90,18 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -89,17 +90,18 @@ namespace Siger.Middlelayer.AccRepository.Repositories
var query = from d in _context.siger_project_product_plan_detail 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 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 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 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 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
select new ResponsePlanlFixtureInfo select new ResponsePlanlFixtureInfo
{ {
OrderNumber = ordernumber, OrderNumber = ordernumber,
ProductName = p.product_name, ProductName = p.product_name,
FixtureName=t.name,
ProductCode = q.productcode, FixtureGuid=t.guid,
Location = l.locationid, ProductCode =q!=null? q.productcode:"",
Location =l!=null? l.locationid:0,
}; };
return query.FirstOrDefault(); return query.FirstOrDefault();
} }
......
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
...@@ -6,6 +7,7 @@ using Siger.Middlelayer.AccRepository.Entities; ...@@ -6,6 +7,7 @@ using Siger.Middlelayer.AccRepository.Entities;
using Siger.Middlelayer.AccRepository.Repositories.Interface; using Siger.Middlelayer.AccRepository.Repositories.Interface;
using Siger.Middlelayer.AccRepository.Response; using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Common; using Siger.Middlelayer.Common;
using Siger.Middlelayer.Common.Extensions;
using Siger.Middlelayer.Repository.Data.Acc; using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Extensions; using Siger.Middlelayer.Repository.Extensions;
using Siger.Middlelayer.Repository.Paged; using Siger.Middlelayer.Repository.Paged;
...@@ -21,7 +23,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -21,7 +23,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
} }
public IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state, public IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
int projectid, int page, int pagesize) int projectid, int page, int pagesize, string toexcel = "")
{ {
var query = from q in _context.siger_automation_fixture_tools var query = from q in _context.siger_automation_fixture_tools
join p in _context.siger_automation_fixture_tools_category on q.category equals p.guid join p in _context.siger_automation_fixture_tools_category on q.category equals p.guid
...@@ -69,9 +71,62 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -69,9 +71,62 @@ namespace Siger.Middlelayer.AccRepository.Repositories
stateExpression = q => q.status == state; stateExpression = q => q.status == state;
} }
var expression = categoryExpression.And(codeExpression).And(nameExpression).And(stateExpression); var expression = categoryExpression.And(codeExpression).And(nameExpression).And(stateExpression);
var entities = query.Where(expression).OrderByDescending(q => q.id).Skip((page - 1) * pagesize).Take(pagesize).AsNoTracking().ToList(); if(toexcel.ToInt() == 1)
var totalCount = query.Where(expression).Count(); {
return new PagedCollectionResult<ResponseFixtureTools>(entities, totalCount); var entities = query.Where(expression).OrderByDescending(q => q.id).AsNoTracking().ToList();
return new PagedCollectionResult<ResponseFixtureTools>(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<ResponseFixtureTools>(entities, totalCount);
}
}
public IEnumerable<ResponseFixtureTools> GetDataList(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
where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseFixtureTools
{
id = q.id,
name = q.name,
guid = q.guid,
cate_guid = p.guid,
categoryid = p.id,
category = p.name,
managetype = q.managetype,
partnumber = q.partnumber,
specification = q.specification,
number = q.number,
remark = q.remark,
code = q.code,
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
if (categoryid > 0)
{
query = query.Where(q => q.categoryid == categoryid);
}
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList();
return entities;
}
public ResponseProductFixtureInfo GetProductFixtureLocation(int projectId, string guid)
{
var query = from q in _context.siger_automation_fixture_tools
join l in _context.siger_automation_location on q.guid equals l.guid
select new ResponseProductFixtureInfo
{
FixtureGuid=q.guid,
FixtureName=q.name,
Location=l.locationid
};
return query.FirstOrDefault();
} }
} }
} }
...@@ -30,11 +30,16 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -30,11 +30,16 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join w in _context.siger_wms_storage on l.storageid equals w.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 join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty() 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
from r in rr.DefaultIfEmpty()
where q.projectId == projectid && q.status == (int)RowState.Valid where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocation select new ResponseAutomationLocation
{ {
id = q.id, id = q.id,
locationid = l.id, locationid = l.id,
locaid = q.locationid,
location = l.name, location = l.name,
wavehouseid = w.id, wavehouseid = w.id,
wavehouse = w.name, wavehouse = w.name,
...@@ -48,7 +53,11 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -48,7 +53,11 @@ namespace Siger.Middlelayer.AccRepository.Repositories
remark = q.remark, remark = q.remark,
updator = u.name ?? "", updator = u.name ?? "",
status = q.status, status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "" 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(),
cate_guid = c.guid ?? ""
}; };
Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true; Expression<Func<ResponseAutomationLocation, bool>> wavehouseidExpression = f => true;
if (wavehouseid > 0) if (wavehouseid > 0)
...@@ -68,7 +77,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -68,7 +77,12 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public siger_wms_storage_location GetLocation(int id, int projectid) public siger_wms_storage_location GetLocation(int id, int projectid)
{ {
return _context.siger_wms_storage_location.FirstOrDefault(q => q.locationid == id && q.projectId == projectid && q.status == (int)RowState.Valid); return _context.siger_wms_storage_location.FirstOrDefault(q => q.id == id && q.projectId == projectid && q.status == (int)RowState.Valid);
}
public IEnumerable<siger_wms_storage_location> GetLocationList(int projectid)
{
return _context.siger_wms_storage_location.Where(q => q.projectId == projectid && q.status == (int)RowState.Valid);
} }
public IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid) public IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid)
...@@ -78,10 +92,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -78,10 +92,13 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join c in _context.siger_automation_fixture_tools_category on t.category equals c.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.locationid equals l.locationid
join w in _context.siger_wms_storage on l.storageid equals w.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 where q.projectId == projectid && q.status == (int)RowState.Valid
select new ResponseAutomationLocationList select new ResponseAutomationLocationList
{ {
id = q.id, id = q.id,
fixtureguid = t.guid,
locationid = l.locationid, locationid = l.locationid,
location = l.realname, location = l.realname,
locationcode = l.serial_number, locationcode = l.serial_number,
...@@ -91,9 +108,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -91,9 +108,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
fixturetoolid = t.id, fixturetoolid = t.id,
code = t.code, code = t.code,
name = t.name, name = t.name,
materialsn = "TestData" materialsn = m.sn ?? ""
}; };
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList(); var entities = query.AsNoTracking().ToList();
return entities; return entities;
} }
} }
......
...@@ -7,6 +7,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -7,6 +7,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{ {
public interface IAutomationFixtureToolsCategoryRepository : IAccRepositoryBase<siger_automation_fixture_tools_category> public interface IAutomationFixtureToolsCategoryRepository : IAccRepositoryBase<siger_automation_fixture_tools_category>
{ {
IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize); IPagedCollectionResult<ResponseFixtureToolsCategory> GetPagedList(int id, int projectid, int page, int pagesize, string toexcel = "");
} }
} }
...@@ -2,12 +2,17 @@ ...@@ -2,12 +2,17 @@
using Siger.Middlelayer.AccRepository.Response; using Siger.Middlelayer.AccRepository.Response;
using Siger.Middlelayer.Repository.Data.Acc; using Siger.Middlelayer.Repository.Data.Acc;
using Siger.Middlelayer.Repository.Paged; using Siger.Middlelayer.Repository.Paged;
using System.Collections.Generic;
namespace Siger.Middlelayer.AccRepository.Repositories.Interface namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{ {
public interface IAutomationFixtureToolsRepository : IAccRepositoryBase<siger_automation_fixture_tools> public interface IAutomationFixtureToolsRepository : IAccRepositoryBase<siger_automation_fixture_tools>
{ {
IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state, IPagedCollectionResult<ResponseFixtureTools> GetPagedList(int category, string code, string name, int state,
int projectid, int page, int pagesize); int projectid, int page, int pagesize, string toexcel = "");
IEnumerable<ResponseFixtureTools> GetDataList(int categoryid, int projectid);
ResponseProductFixtureInfo GetProductFixtureLocation(int projectId, string guid);
} }
} }
...@@ -14,5 +14,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface ...@@ -14,5 +14,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
siger_wms_storage_location GetLocation(int id, int projectid); siger_wms_storage_location GetLocation(int id, int projectid);
IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid); IEnumerable<ResponseAutomationLocationList> GetDataList(int projectid);
IEnumerable<siger_wms_storage_location> GetLocationList(int projectid);
} }
} }
...@@ -19,5 +19,6 @@ namespace Siger.Middlelayer.AccRepository.Request ...@@ -19,5 +19,6 @@ namespace Siger.Middlelayer.AccRepository.Request
/// 完成状态 /// 完成状态
/// </summary> /// </summary>
public int status { get; set; } public int status { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Siger.Middlelayer.AccRepository.Request
{
public class RequestPLC
{
/// <summary>
/// 工件唯一识别SN
/// </summary>
public String SN { get; set; }
/// <summary>
/// 工装唯一编号GUID
/// </summary>
public string Fixture { get; set; }
/// <summary>
/// 任务唯一编号
/// </summary>
public string RequestForm { get; set; }
/// <summary>
/// 机器人动作指令
/// </summary>
public int RobotStep { get; set; }
/// <summary>
/// 发起地
/// </summary>
public int RStation { get; set; }
/// <summary>
/// 储位位置编号
/// </summary>
public int StorageNo { get; set; }
/// <summary>
/// 加工程序号 ,上料完成后自动加工需要
/// </summary>
public string Program { get; set; }
}
public class ResponsePlC
{
public int return_code { get; set; }
public string return_desc { get; set; }
}
}
...@@ -11,6 +11,11 @@ namespace Siger.Middlelayer.AccRepository.Request ...@@ -11,6 +11,11 @@ namespace Siger.Middlelayer.AccRepository.Request
{ {
public int section { get; set; } public int section { get; set; }
public string code { get; set; } public string code { get; set; }
/// <summary>
/// 工装GUID
/// </summary>
public string guid { get; set; }
} }
/// <summary> /// <summary>
/// 安装完成 /// 安装完成
......
...@@ -111,6 +111,10 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -111,6 +111,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public string updatetime { get; set; } public string updatetime { get; set; }
public string fileurl { get; set; } public string fileurl { get; set; }
public string filename { get; set; } public string filename { get; set; }
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
} }
public class ResponseAumationFixtureToolsAssembly public class ResponseAumationFixtureToolsAssembly
...@@ -130,5 +134,10 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -130,5 +134,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public int status { get; set; } public int status { get; set; }
public string fileurl { get; set; } public string fileurl { get; set; }
public string filename { get; set; } public string filename { get; set; }
public string parentcate_guid { get; set; }
public List<int> parentcategoryids { get; set; } = new List<int>();
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
} }
} }
...@@ -11,6 +11,7 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -11,6 +11,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// 储位位置 /// 储位位置
/// </summary> /// </summary>
public int locationid { get; set; } public int locationid { get; set; }
public int locaid { get; set; }
public string location { get; set; } public string location { get; set; }
public int wavehouseid { get; set; } public int wavehouseid { get; set; }
public string wavehouse { get; set; } public string wavehouse { get; set; }
...@@ -47,6 +48,10 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -47,6 +48,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public string updatetime { get; set; } public string updatetime { get; set; }
public int status { get; set; } public int status { get; set; }
public List<int> locationIds { get; set; } = new List<int>();
public List<int> categoryIds { get; set; } = new List<int>();
public string cate_guid { get; set; }
} }
public class ResponseAutomationLocationList public class ResponseAutomationLocationList
...@@ -71,6 +76,7 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -71,6 +76,7 @@ namespace Siger.Middlelayer.AccRepository.Response
/// 工装ID /// 工装ID
/// </summary> /// </summary>
public int fixturetoolid { get; set; } public int fixturetoolid { get; set; }
public string fixtureguid { get; set; }
public string code { get; set; } public string code { get; set; }
public string name { get; set; } public string name { get; set; }
public string materialsn { get; set; } public string materialsn { get; set; }
......
...@@ -7,9 +7,10 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -7,9 +7,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public class ResponseProductFixtureInfo public class ResponseProductFixtureInfo
{ {
/// <summary> /// <summary>
/// 工装ID /// 工装名称
/// </summary> /// </summary>
public int FixtureId { get; set; } public string FixtureName { get; set; }
/// <summary> /// <summary>
/// GUID /// GUID
/// </summary> /// </summary>
...@@ -34,6 +35,8 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -34,6 +35,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public string ProductCode { get; set; } public string ProductCode { get; set; }
public string ProductName { get; set; } public string ProductName { get; set; }
public int status { get; set; } public int status { get; set; }
public string FixtureName { get; set; }
public string FixtureGuid { get; set; }
public int Location { get; set; } public int Location { get; set; }
public string Sn { get; set; } public string Sn { get; set; }
} }
......
...@@ -269,9 +269,6 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` ( ...@@ -269,9 +269,6 @@ CREATE TABLE IF NOT EXISTS `siger_automation_location` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置', `locationid` int(11) NOT NULL DEFAULT 0 COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID', `fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`materialid` int(11) NOT NULL DEFAULT 0 COMMENT '物料ID',
`processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID',
`materialstate` int(11) NOT NULL DEFAULT 0 COMMENT '物料状态',
`attachment` varchar(200) 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 '附件名称', `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 '备注', `remark` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
...@@ -327,17 +324,17 @@ CREATE TABLE IF NOT EXISTS `siger_automation_section_route` ( ...@@ -327,17 +324,17 @@ CREATE TABLE IF NOT EXISTS `siger_automation_section_route` (
CREATE TABLE IF NOT EXISTS `siger_automation_task_list` ( CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`no` 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, `fixtureguid` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID', `sectionid` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID',
`trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方', `trigger` int(1) NOT NULL DEFAULT 0 COMMENT '触发方',
`tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型', `tasktype` int(1) NOT NULL DEFAULT 0 COMMENT '任务类型',
`materialid` int(11) NOT NULL DEFAULT 0 COMMENT '工件ID', `sn` int(11) NOT NULL DEFAULT 0 COMMENT '工件ID',
`ordercode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工单号', `ordercode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工单号',
`productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID', `productid` int(11) NOT NULL DEFAULT 0 COMMENT '产品ID',
`productcode` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '产品CODE',
`processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID', `processid` int(11) NOT NULL DEFAULT 0 COMMENT '工序ID',
`programnumber` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '程序号', `programnumber` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '程序号',
`locationid` int(11) NOT NULL COMMENT '储位位置', `locationid` int(11) NOT NULL COMMENT '储位位置',
`fixturetools` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工装GUID',
`action` int(1) NOT NULL DEFAULT 0 COMMENT '动作', `action` int(1) NOT NULL DEFAULT 0 COMMENT '动作',
`actiontype` int(11) NOT NULL DEFAULT 0 COMMENT '动作类型', `actiontype` int(11) NOT NULL DEFAULT 0 COMMENT '动作类型',
`projectid` int(11) NOT NULL DEFAULT 0, `projectid` int(11) NOT NULL DEFAULT 0,
...@@ -354,19 +351,22 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` ( ...@@ -354,19 +351,22 @@ CREATE TABLE IF NOT EXISTS `siger_automation_task_list` (
-- ---------------------------- -- ----------------------------
-- 设备可用状态 -- 设备可用状态
-- Table structure for siger_automation_task_list -- Table structure for siger_automation_machine_status
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `siger_automation_machine_status`; DROP TABLE IF EXISTS `siger_automation_machine_status`;
CREATE TABLE `siger_automation_machine_status` ( CREATE TABLE `siger_automation_machine_status` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int NOT NULL AUTO_INCREMENT,
`section` int(11) NOT NULL DEFAULT 0 COMMENT '工位ID', `section` int NOT NULL DEFAULT '0' COMMENT '工位ID',
`machineid` int(11) NOT NULL DEFAULT 0 COMMENT '工位对应设备ID', `machineid` int NOT NULL DEFAULT '0' COMMENT '工位对应设备ID',
`projectid` int(11) NOT NULL DEFAULT 0, `projectid` int NOT NULL DEFAULT '0',
`enable` int(1) NOT NULL DEFAULT 1 COMMENT '设备可用状态 0:不可用 1:可用', `enable` int NOT NULL DEFAULT '1' COMMENT '设备可用状态 0:不可用 1:可用',
`status` int(1) NOT NULL DEFAULT 1 COMMENT '完工状态 0:取消 1:待生产 2:生产中 3:生产完成 ', `status` int NOT NULL DEFAULT '1' COMMENT '完工状态 0:取消 1:待生产 2:生产中 3:生产完成 ',
`updatetime` datetime(0) NULL DEFAULT NULL COMMENT '操作时间', `updatetime` datetime DEFAULT NULL COMMENT '操作时间',
`program` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '程序号',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS=1;
-- ---------------------------- -- ----------------------------
...@@ -417,6 +417,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` ( ...@@ -417,6 +417,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`projectid` int(11) NOT NULL DEFAULT 0, `projectid` int(11) NOT NULL DEFAULT 0,
`fixtureguid` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工装ID', `fixtureguid` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工装ID',
`fixturename` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工装名称',
`section` int(11) NOT NULL DEFAULT 0 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 '当前绑定工件', `sn` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '当前绑定工件',
`route` int(1) NOT NULL DEFAULT 1 COMMENT '工序ID', `route` int(1) NOT NULL DEFAULT 1 COMMENT '工序ID',
...@@ -430,4 +431,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` ( ...@@ -430,4 +431,7 @@ CREATE TABLE `siger_automation_fixture_tools_moniter` (
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1; 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