This commit is contained in:
shilixia 2021-11-23 15:20:49 +08:00
parent b990bd535e
commit fd15d0a299
8 changed files with 2383 additions and 43 deletions

View File

@ -2,8 +2,8 @@
ENV = 'development'
# base api
VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
#VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
#VUE_APP_BASE_API = 'http://127.0.0.1:8000/api'
VUE_APP_BASE_API = 'http://47.95.0.242:2222/api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,

View File

@ -81,3 +81,12 @@ export function createPick_need(id, data) {
data
})
}
//生产进度表
export function getprogressList(query) {
return request({
url: '/pm/subproduction_progress/',
method: 'get',
params: query
})
}

View File

@ -68,4 +68,188 @@ export function wproductPutin(id, data) {
data
})
}
//车间领半成品
export function getpickhalfList(id) {
return request({
url: `/wpm/subplan/${id}/pick_half/`,
method: 'get'
})
}
//子计划半成品领料
export function createpickhalf(id, data) {
return request({
url: `/wpm/subplan/${id}/pick_half/`,
method: 'post',
data
})
}
//车间点击对应工序的子工序,创建操作记录
export function createOperation(data) {
return request({
url: '/wpm/operation/',
method: 'post',
data
})
}
//生产记录操作记录列表
export function getoperationList(query) {
return request({
url: '/wpm/operation/',
method: 'get',
params: query
})
}
//生产操作,提交边角料
export function createoperation(id, data) {
return request({
url: `/wpm/operation/${id}/`,
method: 'put',
data
})
}
//调取一条操作记录
export function getoperation(id) {
return request({
url: `/wpm/operation/${id}/`,
method: 'get'
})
}
//操作使用的半成品列表
export function getoperationwproductList(query) {
return request({
url: '/wpm/operation_wproduct/',
method: 'get',
params: query
})
}
//操作半成品删除
export function deleteOperationwproduct(id) {
return request({
url: `/wpm/operation_wproduct/${id}/`,
method: 'delete',
})
}
//删除操作记录
export function deleteOperation(id) {
return request({
url: `/wpm/operation/${id}/`,
method: 'delete',
})
}
//操作设备
export function getequList(query) {
return request({
url: '/wpm/operation_equip/',
method: 'get',
params: query
})
}
//操作设备删除
export function deleteOperationequip(id) {
return request({
url: `/wpm/operation_equip/${id}/`,
method: 'delete',
})
}
//操作自定义表
export function getrecordList(query) {
return request({
url: '/wpm/operation_record/',
method: 'get',
params: query
})
}
//操作提交自定义表
export function createRecord(id, data) {
return request({
url: `/wpm/operation_record/${id}/submit/`,
method: 'post',
data
})
}
//操作消耗物料
export function getinputList(query) {
return request({
url: '/wpm/operation_input/',
method: 'get',
params: query
})
}
//车间物料消耗
export function createInput(data) {
return request({
url: '/wpm/operation_input/',
method: 'post',
data
})
}
//操作,产出物料
export function getoutputList(query) {
return request({
url: '/wpm/operation_output/',
method: 'get',
params: query
})
}
//产出物料
export function createOutput(data) {
return request({
url: '/wpm/operation_output/',
method: 'post',
data
})
}
//提交本次操作
export function submitOperation(id, data) {
return request({
url: `/wpm/operation/${id}/submit/`,
method: 'post',
data
})
}
//操作,工序工装
export function gettoolList(query) {
return request({
url: '/wpm/operation_tool/',
method: 'get',
params: query
})
}
//操作工序工装
export function createTool(data) {
return request({
url: '/wpm/operation_tool/',
method: 'post',
data
})
}

View File

@ -185,6 +185,20 @@ export const asyncRoutes = [
component: () => import('@/views/wpm/worktask'),
meta: { title: '车间任务', icon: 'example', perms: ['index_manage'] }
},
{
path: 'operation',
name: 'operation',
component: () => import('@/views/wpm/operation'),
meta: { title: '车间操作', icon: 'example', perms: ['index_manage'] }
}
,
{
path: 'operationdo',
name: 'operationdo',
component: () => import('@/views/wpm/operationdo'),
meta: { title: '车间操作跳转界面', icon: 'example', perms: ['index_manage'] },
hidden: true
},
{
path: 'need/:id',
name: 'need',

View File

@ -0,0 +1,138 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>操作记录表</span>
</div>
<el-table
:data="operationList.results"
border
fit
stripe
style="width: 100%"
max-height="700"
>
<el-table-column type="index" width="50" />
<el-table-column label="子工序工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="是否提交">
<template slot-scope="scope">
<el-span v-if="scope.row.is_submited"></el-span>
<el-span v-else></el-span></template
>
</el-table-column>
<el-table-column label="创建人">
<template slot-scope="scope">{{
scope.row.create_by_.username
}}</template>
</el-table-column>
<el-table-column label="是否使用边角料">
<template slot-scope="scope">
<el-span v-if="scope.row.use_scrap"></el-span>
<el-span v-else></el-span></template
>
</el-table-column>
<el-table-column label="自定义表单数">
<template slot-scope="scope">{{ scope.row.record_count }}</template>
</el-table-column>
<el-table-column label="涉及半成品数">
<template slot-scope="scope">{{ scope.row.wproduct_count }}</template>
</el-table-column>
<el-table-column label="设备数量">
<template slot-scope="scope">{{ scope.row.equip_count }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleoperation(scope)"
>前往操作</el-link>
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleDelete(scope)"
>删除</el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="operationList.count > 0"
:total="operationList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import { getoperationList, deleteOperation } from "@/api/wpm";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
operationList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
};
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id;
this.getList();
},
methods: {
checkPermission,
//订单列表
getList() {
getoperationList(this.listQuery).then((response) => {
if (response.data) {
this.operationList = response.data;
}
this.listLoading = false;
});
},
handleoperation(scope)
{
this.$router.push({name: "operationdo", params: { id: scope.row.id }, })
},
//操作记录删除
handleDelete(scope) {
this.$confirm("确认该操作删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOperation(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
},
};
</script>

View File

@ -0,0 +1,792 @@
<template>
<div class="app-container">
<el-card >
<el-card >
<div slot="header" class="clearfix">
<span>基本信息</span>
</div>
<el-form
ref="form"
inline="true"
:model="operationData"
label-width="80px"
>
<el-form-item label="子工序">
<el-input
v-model="operationData.step_.name"
disabled="disabled"
></el-input>
</el-form-item>
<el-form-item label="创建人">
<el-input
v-model="operationData.create_by_.username"
disabled="disabled"
></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-input
v-model="operationData.create_time"
disabled="disabled"
></el-input>
</el-form-item>
<el-form-item label="边角料">
<el-radio-group v-model="operationData.use_scrap">
<el-radio
:label="item.value"
:key="item.value"
v-for="item in scrap"
>{{ item.lable }}</el-radio
>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" v-if="operationData.use_scrap">
<el-input type="textarea" v-model="operationData.remark"></el-input>
</el-form-item>
<el-form-item v-if="operationData.use_scrap">
<el-button type="primary" @click="scrapSubmit()">创建</el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</el-card>
<el-row gutter="24">
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>半成品</span>
</div>
<template>
<el-table :data="operationwpData" border
fit
stripe highlight-current-row
height="230" style="width: 100%" >
<el-table-column type="index" width="50" />
<el-table-column prop="subproduction_plan_.number" label="子计划编号">
</el-table-column>
<el-table-column prop="number" label="半成品编号">
</el-table-column>
<el-table-column prop="material_.name" label="半成品名称">
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleDeletewproduct(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</template>
</el-card>
</el-col>
<el-col span="8" >
<el-card class="box-card" >
<div slot="header" class="clearfix">
<span>设备</span>
</div>
<template>
<el-table :data="equData" border
fit
stripe highlight-current-row
height="230" style="width: 100%" >
<el-table-column prop="equip_.number" label="设备编号">
</el-table-column>
<el-table-column prop="equip_.name" label="设备名称">
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleDeletequip(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</template>
</el-card>
</el-col>
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>自定义表格</span>
</div>
<template>
<el-table :data="recordData" border
fit
stripe highlight-current-row
height="230" style="width: 100%">
<el-table-column prop="form_.name" label="表名">
</el-table-column>
<el-table-column label="是否填写">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_filled == false">未填写</el-tag>
<el-tag v-else>已填写</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handlerecord(scope)"
>填写表单</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog
:model="tableForm"
:visible.sync="dialogVisibleForm"
:title="tableForm.name"
>
<el-form label-width="80px" label-position="right">
<el-row v-for="(item, $index) in fieldList" :key="$index">
<el-form-item
v-if="item.field_type === 'string'"
:label="item.field_name"
>
<el-input placeholder="请输入" v-model="item.sort" />
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'int'"
:label="item.field_name"
>
<el-input
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'float'"
:label="item.field_name"
>
<el-input
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'date'"
:label="item.field_name"
>
<el-date-picker
v-model="item.create_time"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'datetime'"
:label="item.field_name"
>
<el-date-picker
v-model="item.create_time"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'select'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="item.sort"
placeholder="请选择"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'selects'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="optio"
multiple
placeholder="请选择"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
</el-row>
</el-form>
<span slot="footer">
<el-button type="danger" @click="dialogVisibleForm = false"
>取消</el-button
>
<el-button type="primary" @click="recordconfirm()"
>提交</el-button
>
</span>
</el-dialog>
</template>
</el-card>
</el-col>
</el-row>
<el-row gutter="24">
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>消耗物料</span>
<el-button
style="float: right; padding: 3px 0"
type="text"
@click="dialogTablepick = true"
>从车间领料</el-button
>
</div>
<template>
<el-table :data="inputData" border
fit
stripe highlight-current-row
height="230" style="width: 100%">
<el-table-column
prop="subproduction_plan_.number"
label="子计划编号"
>
</el-table-column>
<el-table-column prop="batch" label="物料批次"> </el-table-column>
<el-table-column prop="material_.name" label="物料名称">
</el-table-column>
<el-table-column prop="material_.unit" label="物料单位">
</el-table-column>
<el-table-column prop="count" label="消耗数量"> </el-table-column>
</el-table>
<el-dialog title="车间物料" :visible.sync="dialogTablepick">
<el-table
:data="wmaterialData"
border
fit
stripe
style="width: 100%"
max-height="400"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料名称">
<template slot-scope="scope">{{
scope.row.material_.name
}}</template>
</el-table-column>
<el-table-column label="物料单位">
<template slot-scope="scope">{{
scope.row.material_.unit
}}</template>
</el-table-column>
<el-table-column label="物料批次">
<template slot-scope="scope">{{ scope.row.batch }}</template>
</el-table-column>
<el-table-column label="车间物料数量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="实际使用数量" width="140px">
<template slot-scope="scope">
<el-form :model="scope.row" widht="100px">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.pick_count"
:min="0"
:controls="false"
:value="0"
></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handlepick(scope)"
>提交</el-link
>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
</el-card>
</el-col>
<el-col span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>产出物料</span>
<el-button
style="float: right; padding: 3px 0"
type="text"
@click="dialogTableoutput = true"
>选择产出</el-button
>
</div>
<el-table :data="outputData" border
fit
stripe highlight-current-row
height="230" style="width: 100%">
<el-table-column
prop="subproduction_plan_.number"
label="子计划编号"
>
</el-table-column>
<el-table-column prop="material_.name" label="物料名称">
</el-table-column>
<el-table-column prop="material_.unit" label="物料单位">
</el-table-column>
<el-table-column prop="count" label="产出数量"> </el-table-column>
</el-table>
<el-dialog title="产出物料" :visible.sync="dialogTableoutput">
<el-table
:data="tprogressData"
border
fit
stripe
style="width: 100%"
max-height="400"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料名称">
<template slot-scope="scope">{{
scope.row.material_.name
}}</template>
</el-table-column>
<el-table-column label="物料单位">
<template slot-scope="scope">{{
scope.row.material_.unit
}}</template>
</el-table-column>
<el-table-column label="应产数量">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="实际产出数量">
<template slot-scope="scope">{{
scope.row.count_real
}}</template>
</el-table-column>
<el-table-column label="检验合格数量">
<template slot-scope="scope">{{ scope.row.count_ok }}</template>
</el-table-column>
<el-table-column label="本操作产出数量" width="140px">
<template slot-scope="scope">
<el-form :model="scope.row" widht="100px">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.output_count"
:min="0"
:controls="false"
:value="0"
></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleoutput(scope)"
>提交</el-link
>
</template>
</el-table-column>
</el-table>
</el-dialog>
</el-card>
</el-col>
<el-col span="8" >
<el-card class="box-card" >
<div slot="header" class="clearfix">
<span>工序工装</span>
</div>
</el-card>
</el-col>
</el-row>
<el-button type="primary"
@click="handlesubmit()"
>提交本次操作</el-button
>
</el-card>
</div>
</template>
<style scoped>
.box-card {
height: 300px;
}
</style>
</style>
<script>
import {
getoperation,
createoperation,
getoperationwproductList,
getequList,
getrecordList,
getinputList,
getwmaterialList,
createInput,
getoutputList,
createOutput,
createRecord,
submitOperation,
deleteOperationequip,
deleteOperationwproduct,
gettoolList,
createTool
} from "@/api/wpm";
import { getrffieldList } from "@/api/mtm";
import checkPermission from "@/utils/permission";
import { getprogressList } from "@/api/pm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default {
components: { Pagination },
data() {
return {
operationList: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
scrap: [
{ lable: "使用", value: true },
{ lable: "不使用", value: false },
],
listQueryfield: {
page: 1,
page_size: 20,
},
operationData: "",
scrapData: {},
dialogVisibleForm: false,
tableForm: {
name: "",
},
listQueryrecordform: {
page: 1,
page_size: 20,
},
recordformList: {
count: 0,
},
fieldList: {
count: 0,
},
listQueryfield: {
page: 1,
page_size: 20,
},
highoptions: [
{ value: 1, label: "<" },
{ value: 2, label: "<=" },
],
lowoptions: [
{ value: 1, label: ">" },
{ value: 2, label: ">=" },
],
highoptionss_: {
1: "<",
2: "<=",
},
lowoptionss_: {
1: ">",
2: ">=",
},
options_: {
string: "文本",
int: "整数",
float: "小数",
date: "日期",
datetime: "日期时间",
select: "单选",
selects: "多选",
},
fieldtypeoptions: [
{
value: "string",
label: "文本",
},
{
value: "int",
label: "整数",
},
{
value: "float",
label: "小数",
},
{
value: "date",
label: "日期",
},
{
value: "time",
label: "时间",
},
{
value: "datetime",
label: "日期时间",
},
{
value: "select",
label: "单选",
},
{
value: "selects",
label: "多选",
},
],
formID: "",
dialogTablepick: false,
dialogTableoutput: false,
picks: {},
output: {},
record_data: [],
record: {},
};
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id; //操作ID
this.getList(); //边角料
this.getpwpList(); //半成品
this.getequList(); //设备
this.getrecordList(); //自定义表
this.getinputList(); //物料消耗
this.getoutputList(); //产出物料
this.getwmaterialList();
this.getprogressList(); //产出物料调出
},
methods: {
checkPermission,
//是否使用边角料
getList() {
getoperation(this.id).then((response) => {
if (response.data) {
this.operationData = response.data;
}
this.listLoading = false;
});
},
//如果使用边角料提交
scrapSubmit() {
this.scrapData.use_scrap = this.operationData.use_scrap;
this.scrapData.remark = this.operationData.remark;
createoperation(this.id, this.scrapData).then((res) => {
if (res.code >= 200) {
this.$message.success("成功!");
this.getList(); //
}
});
},
//操作使用的半成品
getpwpList() {
getoperationwproductList({ operation: this.id, page: 0 }).then(
(response) => {
if (response.data) {
this.operationwpData = response.data;
}
this.listLoading = false;
}
);
},
//操作半成品删除
handleDeletewproduct(scope)
{
this.$confirm("确认删除该半成品?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOperationwproduct(scope.row.id);
this.getpwpList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//操作设备
getequList() {
getequList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.equData = response.data;
}
this.listLoading = false;
});
},
//操作删除设备
handleDeletequip(scope)
{
alert(scope.row.equip_.id);
this.$confirm("确认删除该设备?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOperationequip(scope.row.id);
this.getequList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//操作自定义表
getrecordList() {
getrecordList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.recordData = response.data;
}
this.listLoading = false;
});
},
//调出表单内容
handlerecord(scope) {
this.tableForm = Object.assign({}, scope.row); // copy obj
this.formID = scope.row.id;
this.listQueryfield.form = scope.row.form_.id;
this.listQueryfield.page = 0;
getrffieldList(this.listQueryfield).then((response) => {
if (response.data) {
this.fieldList = response.data;
}
});
this.dialogVisibleForm = true;
},
//提交表单内容
recordconfirm() {
let _this = this;
_this.record_data = []; //检查项目
this.fieldList.forEach((item) => {
_this.record_data.push({
form_field: item.id,
field_value: item.sort,
});
});
this.record.record_data = _this.record_data;
createRecord(this.formID, this.record).then((res) => {
if (res.code >= 200) {
this.$message.success("创建成功!");
this.getrecordList();
this.dialogVisibleForm = false;
}
});
},
//操作消耗物料列表
getinputList() {
getinputList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.inputData = response.data;
}
this.listLoading = false;
});
},
//从车间领料
getwmaterialList() {
getwmaterialList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.wmaterialData = response.data;
}
});
},
//车间物料消耗提交
handlepick(scope) {
this.picks.operation = this.id;
this.picks.wmaterial = scope.row.id;
this.picks.count = scope.row.pick_count;
createInput(this.picks).then((res) => {
if (res.code >= 200) {
this.$message.success("创建成功!");
this.getinputList();
this.dialogTablepick = false;
}
});
},
//操作产出物料列表
getoutputList() {
getoutputList({ operation: this.id, page: 0 }).then((response) => {
if (response.data) {
this.outputData = response.data;
}
this.listLoading = false;
});
},
//产出物料选择
getprogressList() {
getprogressList({ operation: this.id, page: 0, type: 2 }).then(
(response) => {
if (response.data) {
this.tprogressData = response.data;
}
this.listLoading = false;
}
);
},
//车间产出物料提交
handleoutput(scope) {
this.output.operation = this.id;
this.output.subproduction_progress = scope.row.id;
this.output.count = scope.row.output_count;
createOutput(this.output).then((res) => {
if (res.code >= 200) {
this.$message.success("创建成功!");
this.getoutputList();
this.dialogTableoutput = false;
}
});
},
//提交本次操作
handlesubmit(){
submitOperation(this.id).then((res) => {
if (res.code >= 200) {
this.$message.success("操作提交成功!");
}
});
}
},
};
</script>

View File

@ -60,7 +60,7 @@
</template>
</el-table-column>
<el-table-column label="生产主产品">
<template slot-scope="scope" v-if="main_product">{{
<template slot-scope="scope" >{{
scope.row.main_product_.name
}}</template>
</el-table-column>
@ -74,9 +74,15 @@
<el-table-column align="center" label="操作" width="130px">
<template slot-scope="scope">
<el-link @click="handleNeed(scope)"
<el-link type="success" v-if="scope.row.is_picked==false" @click="handleNeed(scope)"
>领料</el-link
>
<el-link type="success" v-if="scope.row.is_picked" @click="handleNeed(scope)"
>继续领料</el-link
>
<el-link type="primary" @click="handlepick(scope)"
>领半成品</el-link
>
</template>
</el-table-column>
</el-table>
@ -107,7 +113,7 @@
type="primary"
@click="handleAll()"
style="float: right"
>显示全部子计划</el-button
>显示全部</el-button
>
</el-card>
<el-card class="box-card">
@ -193,6 +199,82 @@
</el-row>
</el-tab-pane>
</el-tabs>
<el-dialog title="领半成品" :visible.sync="dialogTableVisiblepick">
<el-table :data="bcplist" style="width: 100%">
<el-table-column prop="material_.name" label="物料名称">
</el-table-column>
<el-table-column prop="material_.number" label="物料编号">
</el-table-column>
<el-table-column prop="material_.specification" label="物料规格">
</el-table-column>
<el-table-column prop="material_.unit" label="物料单位">
</el-table-column>
<el-table-column prop="count" label="所需物料数量">
</el-table-column>
<el-table-column prop="count_real" label="已领物料数量">
</el-table-column>
<el-table-column prop="count_pick" label="实际产出/消耗">
</el-table-column>
<el-table-column
align="center"
label="操作"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
@click="handleReceive(scope)"
>领半成品</el-link >
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogTableVisiblepick = false"> </el-button>
<el-button type="primary" @click="bcpllSubmit"> </el-button>
</div>
</el-dialog>
<el-dialog title="半成品列表" :visible.sync="dialogTableVisiblepicks">
<el-table
:data="wproductslist"
border
fit
stripe
highlight-current-row
max-height="600"
@selection-change="handleSelectionChangess"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" width="50" />
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="所属子计划">
<template slot-scope="scope">{{ scope.row.subproduction_plan }}</template>
</el-table-column>
<el-table-column label="备注">
<template slot-scope="scope">{{ scope.row.remark }}</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogTableVisiblepicks = false"> </el-button>
<el-button type="primary" @click="wproductSubmit"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisiblenw" width="80%" title="领料">
<el-card class="box-card">
@ -557,7 +639,10 @@ import {
getwmaterialList,
submitWork,
getwproductList,
getsubplanList
getsubplanList,
getpickhalfList,
createpickhalf,
createOperation
} from "@/api/wpm";
import { getiproductList } from "@/api/inm";
import { createWork } from "@/api/wpm";
@ -598,6 +683,8 @@ export default {
id: "",
dialogTableVisible:false,
dialogVisible: false,
dialogTableVisiblepick:false,
dialogTableVisiblepicks:false,
dialogType: "new",
dialogVisiblework: false,
dialogVisiblenw: false,
@ -625,10 +712,11 @@ export default {
wproducts: [],
otherforms: [],
from: [],
workdata: {},
Operation: {},
wproductdata: {},
workData:{},
bcplist:"",
wproductslist:"",
};
},
process: "",
@ -723,7 +811,7 @@ export default {
getwproductList({page:0,step__process:this.process}).then((response) => {
if (response.data) {
this.wproductData = response.data;
//console.log( this.wproductData)
console.log( this.wproductData)
}
});
},
@ -778,6 +866,7 @@ export default {
});
},
//领料
handleNeed(scope) {
this.need = Object.assign({}, defaulteneed);
@ -807,6 +896,77 @@ export default {
}
});
},
//领半成品
handlepick(scope){
this.dialogTableVisiblepick=true;
this.spid = scope.row.id;
getpickhalfList(this.spid).then((res) => {
if (res.code >= 200) {
this.bcplist = res.data;
}
});
},
//根据半成品ID+检测状态调取未入库半成品
handleReceive(scope){
this.dialogTableVisiblepicks=true;
this.bcpxlID=scope.row.id;
getwproductList({material:scope.row.material,act_state:3,page:0}).then((res) => {
if (res.code >= 200) {
this.wproductslist = res.data;
}
});
},
handleSelectionChangess(val){
this.bcpproducts= [];
val.forEach((item) => {
this.bcpproducts.push(item.id);
});
},
wproductSubmit()
{
this.dialogTableVisiblepicks = false;
this.bcplist.forEach((item) => {
if(item.id == this.bcpxlID)
{
item.iproducts=this.bcpproducts;
}
});
},
//提交领的半成品
bcpllSubmit()
{
this.bcplists=[];//新的半成品表
this.bcplist.forEach((item) => {
this.bcplists.push({
"id":item.id,
"wproducts": item.iproducts
});
});
console.log(this.bcplists);
createpickhalf(this.spid,this.bcplists).then((res) => {
if (res.code >= 200) {
this.$message.success("半成品领料成功!");
this.dialogTableVisiblepick=false;
}
});
},
prev() {
--this.values;
if (this.values < 0) this.values = 0;
@ -826,40 +986,14 @@ export default {
this.step = item.id;
// console.log(this.wpID);
this.values = 0;
this.workdata.step = item.id;
this.workdata.wproducts = this.wpID;
if (this.subproduction_plan != "") {
this.workdata.subproduction_plan = this.subproduction_plan;
}
this.Operation.step = item.id;
this.Operation.wproducts = this.wpID;
createWork(this.workdata).then((res) => {
createOperation(this.Operation).then((res) => {
if (res.code >= 200) {
this.dialogVisiblework = true;
this.forms = res.data.forms;
this.otherforms = res.data.forms.slice(0); //渲染生产表
this.otherforms.shift();
//console.log(this.otherforms)
this.$message.success("操作记录创建成功!");
this.$router.push({name: "operation", params: { id: item.id }, })
if (
res.data.forms[0].input !== undefined &&
res.data.forms[0].input.length > 0
) {
this.input = res.data.forms[0].input; //消耗
this.showPrise1 = true;
} else {
this.showPrise1 = false;
}
if (
res.data.forms[0].output !== undefined &&
res.data.forms[0].output.length > 0
) {
this.output = res.data.forms[0].output; //产出
this.showPrise = true;
} else {
this.showPrise = false;
}
this.wproducts = res.data.forms[0].wproducts;
}
});
},

File diff suppressed because it is too large Load Diff