This commit is contained in:
shijing 2022-01-13 16:48:20 +08:00
commit 42659b9b85
48 changed files with 878 additions and 249 deletions

View File

@ -196,7 +196,13 @@ export function getinputList(query) {
params: query params: query
}) })
} }
//消耗物料删除
export function deleteOperationeinput(id) {
return request({
url: `/wpm/operation_input/${id}/`,
method: 'delete',
})
}
//车间物料消耗 //车间物料消耗
@ -334,3 +340,21 @@ export function getcutList(query) {
}) })
} }
//军检
export function mtest(id,data) {
return request({
url: `/wpm/wproduct/${id}/mtest/`,
method: 'post',
data
})
}
//生成流程卡
export function getCard(id) {
return request({
url: `/wpm/wproduct/${id}/card/`,
method: 'GET',
})
}

View File

@ -1,6 +1,8 @@
<template> <template>
<div class="dashboard-container"> <div class="dashboard-container">
<el-card class="dashboardTopCard"> <el-card class="dashboardTopCard">
<div @click="openWord">wendanag</div>
<a href="http://www.xdocin.com/xdoc?_func=to&_format=html&_cache=1&_xdoc=http://47.95.0.242:2222/media/2021/09/07/004-%E8%AF%B7%E5%81%87%E5%8D%95_LL8uZdx.docx" target="_blank">XDOC</a>
<div class="CardTitleWrap"> <div class="CardTitleWrap">
<span class="verticalLine"></span><span class="dashboardCardTitle">数据统计</span> <span class="verticalLine"></span><span class="dashboardCardTitle">数据统计</span>
</div> </div>
@ -306,6 +308,9 @@ export default {
]) ])
}, },
methods:{ methods:{
openWord(){
window.open("http://47.95.0.242:2222/media/2021/09/07/004-%E8%AF%B7%E5%81%87%E5%8D%95_LL8uZdx.docx");
},
getStatisticsData(){ getStatisticsData(){
let that = this; let that = this;
let dat = new Date(); let dat = new Date();

View File

@ -36,6 +36,14 @@
<el-tag v-else>已军检</el-tag></template> <el-tag v-else>已军检</el-tag></template>
</el-table-column> </el-table-column>
<el-table-column label="是否售出">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_saled == false">未售出</el-tag>
<el-tag v-else>已售出</el-tag></template>
</el-table-column>
<el-table-column label="军检"> <el-table-column label="军检">
<template slot-scope="scope"> <template slot-scope="scope">
@ -45,7 +53,16 @@
<el-tag v-else-if="scope.row.is_mtestok == true">合格</el-tag></template> <el-tag v-else-if="scope.row.is_mtestok == true">合格</el-tag></template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])&&scope.row.act_state==30"
@click="handleMtest(scope)"
>军检
</el-link>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="iproductData.count > 0" v-show="iproductData.count > 0"
@ -54,15 +71,31 @@
:limit.sync="listQuery.page_size" :limit.sync="listQuery.page_size"
@pagination="getList" @pagination="getList"
/> />
<el-dialog title="军检" :visible.sync="dialogVisible">
<el-form :model="mtestform" label-width="130px"
label-position="right">
<el-form-item label="是否军检合格" prop="name">
<el-switch v-model="mtestform.is_mtestok"></el-switch>
</el-form-item>
<el-form-item label="军检备注" prop="name">
<el-input type="textarea" v-model="mtestform.remark_mtest"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submtest"> </el-button>
</div>
</el-dialog>
</el-card> </el-card>
</div> </div>
</template> </template>
<script> <script>
import { getiproductList,saleMtest} from "@/api/inm"; import { getiproductList} from "@/api/inm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { mtest } from "@/api/wpm";
import { genTree } from "@/utils"; import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -82,6 +115,9 @@ export default {
salesdetail:"", salesdetail:"",
saleproduct:"", saleproduct:"",
dialogVisible:false, dialogVisible:false,
mtestform:{
is_mtestok:false,
}
}; };
}, },
@ -104,10 +140,19 @@ export default {
}); });
}, },
handleMtest(scope){ handleMtest(scope){
this.saleproduct=scope.row.id; this.saleproduct=scope.row.id;
this.dialogVisible=true; this.dialogVisible=true;
}, },
submtest(){
mtest(this.saleproduct,this.mtestform).then((res)=>{
if(res.code >= 200)
{
this.$message.success("提交成功!");
this.dialogVisible=false;
}
});
}
}, },
}; };
</script> </script>

View File

@ -79,7 +79,7 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_update'])" v-if="checkPermission(['material_update'])&&scope.row.type!=5&&scope.row.type!=6"
type="primary" type="primary"
@click="handlebind(scope)" @click="handlebind(scope)"
>检查表 >检查表
@ -255,7 +255,6 @@
page_size: 20, page_size: 20,
}, },
activeName: "", activeName: "",
listLoading: true, listLoading: true,
dialogVisible: false, dialogVisible: false,
dialogType: "new", dialogType: "new",
@ -277,8 +276,9 @@
checkPermission, checkPermission,
//物料详情 //物料详情
handledetail(scope) { handledetail(scope)
this.$router.push({name: "MaterialDetail", params: {id: scope.row.id},}) {
this.$router.push({name: "MaterialDetail", params: { id: scope.row.id,type: scope.row.type }, })
}, },

View File

@ -13,7 +13,7 @@
</el-card> </el-card>
<el-tabs v-model="activeName" type="card" > <el-tabs v-model="activeName" type="card" >
<el-tab-pane label="对应的批次" name="3"> <el-tab-pane label="批次" name="3">
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
@ -21,6 +21,7 @@
border border
fit fit
stripe stripe
height="460"
highlight-current-row highlight-current-row
> >
@ -65,8 +66,8 @@
fit fit
stripe stripe
highlight-current-row highlight-current-row
height="100" height="460"
v-el-height-adaptive-table="{bottomOffset: 50}"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
@ -104,7 +105,7 @@
fit fit
stripe stripe
style="width: 100%" style="width: 100%"
height="300" height="460"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
@ -147,7 +148,41 @@
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="物料" name="4" v-if="this.type==1||this.type==2">
<el-table
:data="wproductList"
border
fit
stripe
style="width: 100%"
height="460"
>
<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.step_.name
}}</template>
</el-table-column>
<el-table-column label="状态" >
<template slot-scope="scope">{{
actstate_[scope.row.act_state]
}}</template>
</el-table-column>
<el-table-column label="仓库" >
<template slot-scope="scope" v-if=" scope.row.warehouse_">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
warehouse_
</el-table>
</el-tab-pane>
</el-tabs> </el-tabs>
</el-card> </el-card>
</div> </div>
@ -161,6 +196,8 @@
import {getmaterialbatchList} from "@/api/inm"; import {getmaterialbatchList} from "@/api/inm";
import {getOrderList } from "@/api/sam"; import {getOrderList } from "@/api/sam";
import {getMaterial } from "@/api/mtm"; import {getMaterial } from "@/api/mtm";
import {getwproductList } from "@/api/wpm";
import { upFile } from "@/api/file"; import { upFile } from "@/api/file";
import {genTree} from "@/utils"; import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -173,19 +210,36 @@
return { return {
materialdetail:"", materialdetail:"",
orderlist:"", orderlist:"",
wproductList:"",
productionplanList:"", productionplanList:"",
InventoryList:"", InventoryList:"",
activeName:'3', activeName:'3',
actstate_: {
6: "待复检",
10: "操作进行中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
8: "操作准备中",
26: "待夹层检验",
70: "报废",
},
}; };
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
this.material = this.$route.params.id; this.material = this.$route.params.id;
this.type=this.$route.params.type;
this.getMaterial(); this.getMaterial();
this.getOrderList(); this.getOrderList();
this.getplanList(); this.getplanList();
this.getmaterialbatchList(); this.getmaterialbatchList();
this.getwproductList();
}, },
methods: { methods: {
@ -224,7 +278,14 @@ getMaterial(){
}); });
}, },
getwproductList(){
getwproductList({material:this.material,page:0}).then((response) => {
if (response.data) {
this.wproductList = response.data;//半成品
}
});
}
}, },
}; };
</script> </script>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card >
<el-row :gutter="2"> <el-row :gutter="2">
<el-col :span="9" > <el-col :span="9" >
<el-card > <el-card >
@ -16,7 +16,7 @@
fit fit
stripe stripe
highlight-current-row highlight-current-row
height="660px"
@current-change="handleCurrentChange"> @current-change="handleCurrentChange">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
@ -24,7 +24,7 @@
<el-table-column label="产品编号"> <el-table-column label="产品编号">
<template slot-scope="scope"> {{ scope.row.number }}</template> <template slot-scope="scope"> {{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称"> <el-table-column label="产品名称" width="200px">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
@ -39,31 +39,7 @@
</el-table> </el-table>
</el-card> </el-card>
<el-card >
<el-descriptions class="margin-top" title="产品信息" :column="1" border>
<el-descriptions-item>
<template slot="label">
产品编号
</template>
{{products.number}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
产品名称
</template>
{{products.name}}
</el-descriptions-item>
</el-descriptions>
</el-card>
</el-col> </el-col>
<el-col :span="15" > <el-col :span="15" >
<el-card class="box-card"> <el-card class="box-card">
@ -72,7 +48,7 @@
font-weight: 700; font-weight: 700;
">工艺流程</span> ">工艺流程</span>
</div> </div>
<el-steps :active="values" spac="400px" align-center="" style="padding-top: 20px;"> <el-steps :active="values" spac="400px" align-center="" style="padding-top: 20px;height:80px">
<el-step :title="item.name" v-for="(item,index) in processoptions " :key="index" @click.native=stepclick(item.id)> <el-step :title="item.name" v-for="(item,index) in processoptions " :key="index" @click.native=stepclick(item.id)>
</el-step> </el-step>
@ -87,7 +63,7 @@
<el-button type="primary" icon="el-icon-plus" @click="handlesubproducationCreate" <el-button type="primary" icon="el-icon-plus" @click="handlesubproducationCreate"
>新增</el-button> >新增</el-button>
<el-table <el-table
height="190px"
:data="subproducationData" :data="subproducationData"
border border
fit fit
@ -176,8 +152,8 @@
</el-card> </el-card>
<el-tabs type="border-card"> <el-tabs type="border-card" style="height:310px">
<el-tab-pane label="输入物料"> <el-tab-pane label="输入物料" >
<el-button type="primary" icon="el-icon-plus" @click="handleinputCreate" <el-button type="primary" icon="el-icon-plus" @click="handleinputCreate"
>新增</el-button> >新增</el-button>
@ -187,7 +163,9 @@
border border
fit fit
stripe stripe
style="width: 100%" height="220px"
style="width: 100%;"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="物料编号" min-width="100"> <el-table-column label="物料编号" min-width="100">
@ -297,7 +275,7 @@
<template slot-scope="scope">{{ scope.row.material_.unit }}</template> <template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column> </el-table-column>
<el-table-column label="单位消耗"> <el-table-column label="单位产出">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="是否主产出"> <el-table-column label="是否主产出">
@ -348,7 +326,7 @@
</el-form-item> </el-form-item>
<el-form-item label="输出物料" prop="unit"> <el-form-item label="输出物料" prop="unit">
<el-select style="width: 50%" v-model="outputmaterial.material" placeholder="请选择"> <el-select filterable style="width: 50%" v-model="outputmaterial.material" placeholder="请选择">
<el-option <el-option
v-for="item in materialoptions" v-for="item in materialoptions"
:key="item.id" :key="item.id"
@ -440,11 +418,11 @@
label-width="80px" label-width="80px"
label-position="right" label-position="right"
> >
<!--
<el-form-item label="消耗量" prop="count"> <el-form-item label="消耗量" prop="count">
<el-input-number v-model="othermaterial.count" :min="0" placeholder="输入整数或小数" /> <el-input-number v-model="othermaterial.count" :min="0" placeholder="输入整数或小数" />
</el-form-item> </el-form-item>
!-->
<el-form-item label="输入物料" prop="unit"> <el-form-item label="输入物料" prop="unit">
<el-select filterable style="width: 50%" v-model="othermaterial.material" placeholder="请选择"> <el-select filterable style="width: 50%" v-model="othermaterial.material" placeholder="请选择">
<el-option <el-option
@ -651,7 +629,7 @@
</el-tabs> </el-tabs>
</el-col> </el-col>
</el-row> </el-row>
</el-card >
</div> </div>
</template> </template>
<script> <script>

View File

@ -105,13 +105,7 @@
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number
v-model="step.sort"
:min="-2147483648"
:max="2147483647"
></el-input-number>
</el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">

View File

@ -157,7 +157,7 @@
align="center" align="center"
label="操作" label="操作"
fixed="right" fixed="right"
width="220px" width="100px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@ -349,7 +349,7 @@
this.delivery_date = scope.row.delivery_date; this.delivery_date = scope.row.delivery_date;
this.dialogVisible = true; this.dialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["Form"].clearValidate(); this.$refs["Form"].resetFields();
}); });
}, },

View File

@ -44,14 +44,16 @@
}}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column label="最后检验结果"> <el-table-column label="最后检验结果">
<template slot-scope="scope" >{{ <template slot-scope="scope" >
scope.row.step_.name <el-span v-if="scope.row.last_test_result==false">不合格</el-span>
}}</template> <el-span v-if="scope.row.last_test_result==true">合格</el-span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="生成记录"> <el-table-column label="记录">
<template slot-scope="scope" >{{ <template slot-scope="scope" >
scope.row.step_.name <el-button @click="select(scope)">查看</el-button>
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
@ -72,7 +74,43 @@
</el-table> </el-table>
<!--检验记录-->
<el-dialog title="检验记录" :close-on-click-modal="false" :visible.sync="limitedCheckRecord">
<el-table
:data="recordList"
border
height="400"
>
<el-table-column type="index" width="50"/>
<el-table-column label="表单名称">
<template slot-scope="scope">{{ scope.row.form_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-link
v-if="!scope.row.is_submited"
@click="handleInspectionRecord(scope)"
>检验
</el-link>
<el-link
v-else
@click="handleRecordDetail(scope)"
>查看
</el-link>
<el-link
@click="delTestRecord(scope)"
>删除
</el-link>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="putin"> </el-button>
</div>
</el-dialog>
</el-card> </el-card>
@ -83,7 +121,7 @@
<script> <script>
import { getProductionplan,getsubproductionplanList } from "@/api/pm"; import { getProductionplan,getsubproductionplanList } from "@/api/pm";
import { getwproductList} from "@/api/wpm"; import { getwproductList,getrecordList} from "@/api/wpm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import {getTestRecord} from "@/api/qm"; import {getTestRecord} from "@/api/qm";
@ -98,7 +136,7 @@ export default {
}, },
activeName:"1", activeName:"1",
wproduct:[], wproduct:[],
limitedCheckRecord:false,
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
@ -173,7 +211,16 @@ export default {
this.$router.push({name: "processcard", params: { id: scope.row.id }, }) this.$router.push({name: "processcard", params: { id: scope.row.id }, })
}, },
//查看生产记录
select(scope)
{
this.limitedCheckRecord=true;
getrecordList({wproduct: scope.row.id,page:0}).then(res => {
if (res.code == 200) {
that.recordList = res.data.results;
}
})
}
}, },
}; };
</script> </script>

View File

@ -1,34 +1,55 @@
<template> <template>
<div class="app-container"> <div style="text-align: center">
<el-card style="margin-top: 2px">
流程卡界面正在更新 <table style=" margin: auto;margin-top:50px; font-family: verdana,arial,sans-serif;font-size:16px;backgroundColor:#bdf6be;color:#333333;border-width: 1px;border-color: #666666; border-collapse: collapse;">
</el-card> <tr v-for="(items,indexs) in card" :key="indexs+1">
<td v-for="(item,index) in card[indexs]" :key="index" style="border-width: 1px;
padding: 8px; border-style: solid; border-color: #a9c6c9;">
<el-span v-if="index>1&&indexs>0&&indexs!=9">
<el-tag type="success" v-for="(item1,index1) in item" :key="index1">
{{item1.action_by_name}}
{{item1.action_time}}
</el-tag>
</el-span>
<el-span v-else>{{item}}</el-span>
</td>
</tr>
</table>
</div> </div>
</template> </template>
<script> <script>
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { getProductionplan,getsubproductionplanList } from "@/api/pm"; import { getCard} from "@/api/wpm";
import { getMaterialList, getrecordformList, getrffieldList } from "@/api/mtm";
import customForm from "@/components/customForm/index";
import { getTestRecord ,getTestRecordItem} from "@/api/qm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default { export default {
components: { Pagination, customForm }, components: { Pagination },
data() { data() {
return { return {
card:{},
}; };
}, },
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
this.id = this.$route.params.id;
this.getCard();
}, },
methods: { methods: {
checkPermission, checkPermission,
getCard(){
getCard(this.id).then((response) => {
if (response.code==200) {
this.card = response.data;
}
});
}
}, },
}; };
</script> </script>

View File

@ -17,7 +17,7 @@
stripe stripe
highlight-current-row highlight-current-row
height="100" height="100"
v-el-height-adaptive-table="{bottomOffset: 40}" v-el-height-adaptive-table="{bottomOffset: 25}"
> >
<el-table-column <el-table-column
type="selection" type="selection"
@ -93,7 +93,7 @@
fit fit
stripe stripe
style="width: 100%" style="width: 100%"
height="310" height="300"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
@ -134,7 +134,7 @@
fit fit
stripe stripe
style="width: 100%" style="width: 100%"
height="320" height="280"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />

View File

@ -17,16 +17,16 @@
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="子计划编号"> <el-table-column label="子计划编号" width="100px">
<template slot-scope="scope">{{scope.row.id}}</template> <template slot-scope="scope">{{scope.row.number}}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称"> <el-table-column label="产品名称" width="180px">
<template slot-scope="scope">{{ scope.row.product_.name }}</template> <template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号"> <el-table-column label="产品型号">
<template slot-scope="scope">{{ scope.row.product_.specification }}</template> <template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="名称"> <el-table-column label="名称" width="160px">
<template slot-scope="scope">{{ scope.row.subproduction_.name }}</template> <template slot-scope="scope">{{ scope.row.subproduction_.name }}</template>
</el-table-column> </el-table-column>
@ -37,7 +37,7 @@
<el-table-column label="工序编号"> <el-table-column label="工序编号">
<template slot-scope="scope">{{ scope.row.process_.number }}</template> <template slot-scope="scope">{{ scope.row.process_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="子工序" width="160"> <el-table-column label="子工序" width="200">
<template slot-scope="scope" v-if="scope.row.steps"> <template slot-scope="scope" v-if="scope.row.steps">
<el-tag v-for="item in scope.row.steps" <el-tag v-for="item in scope.row.steps"
:key="item.number" :key="item.number"
@ -47,16 +47,16 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生产车间"> <el-table-column label="生产车间" width="100px">
<template slot-scope="scope">{{ scope.row.workshop_.name }}</template> <template slot-scope="scope">{{ scope.row.workshop_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产数量"> <el-table-column label="生产数量">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="开工时间"> <el-table-column label="开工时间" width="100px">
<template slot-scope="scope">{{ scope.row.start_date }}</template> <template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="完工时间"> <el-table-column label="完工时间" width="100px">
<template slot-scope="scope">{{ scope.row.end_date }}</template> <template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="下达状态"> <el-table-column label="下达状态">
@ -64,14 +64,14 @@
</el-table-column> </el-table-column>
<el-table-column label="创建时间"> <el-table-column label="创建时间" width="160px">
<template slot-scope="scope">{{ scope.row.create_time }}</template> <template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
width="100px" width="100px"
fixed="right"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" <el-link type="primary"
@ -147,7 +147,7 @@
> >
<el-table <el-table
:data="progressList" :data="xhwl"
border border
fit fit
stripe stripe
@ -158,10 +158,10 @@
<el-table-column label="预计产出/消耗"> <el-table-column label="预计消耗">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="实际产出/消耗"> <el-table-column label="实际消耗">
<template slot-scope="scope">{{ scope.row.count_real }}</template> <template slot-scope="scope">{{ scope.row.count_real }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产计划编号"> <el-table-column label="生产计划编号">
@ -181,7 +181,41 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-table
:data="ccwl"
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.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.subproduction_plan }}</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.material_.number }}</template>
</el-table-column>
<el-table-column label="物料型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="物料单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column>
</el-table>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false">取消</el-button> <el-button type="danger" @click="dialogVisibles = false">取消</el-button>
@ -211,7 +245,8 @@ export default {
page_size: 20, page_size: 20,
}, },
progressList:[], xhwl:[],
ccwl:[],
listLoading: true, listLoading: true,
dialogVisible: false, dialogVisible: false,
dialogVisibles: false, dialogVisibles: false,
@ -262,9 +297,24 @@ export default {
handleselectclick(scope) handleselectclick(scope)
{ {
this.dialogVisibles = true; this.dialogVisibles = true;
this.xhwl=[];
this.ccwl=[];
getProgress(scope.row.id).then((res) => { getProgress(scope.row.id).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.progressList = res.data;
res.data.forEach((item) => {
if(item.type==1)
{
this.xhwl.push(item);
}
else{
this.ccwl.push(item);
}
});
} }
}); });
}, },

View File

@ -316,12 +316,8 @@ export default {
//不合格玻璃审理单查看 //不合格玻璃审理单查看
handledetailbhg(scope) handledetailbhg(scope)
{ {
this.limitedRetrial=true;
ticketread(scope.row.ticket).then((response) => { this.$router.push({name:"ticketDetail",params:{ticketId:scope.row.ticket}})
if (response.data) {
this.customfieldList = response.data;
}
});
} }
}, },

View File

@ -1,12 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
<el-tabs v-model="activeName" type="card" >
<el-tab-pane label="总览" name="1" >
</el-tab-pane>
<el-tab-pane label="待检成品" name="2">
<el-table <el-table
:data="wproductList.results" :data="wproductList.results"
@ -16,33 +11,53 @@
highlight-current-row highlight-current-row
max-height="600" max-height="600"
> >
<el-table-column type="index" width="50"/> <el-table-column type="index" label="序号" width="50"/>
<el-table-column label="成品名称"> <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.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope"> <el-table-column label="任务编号">
{{ actstate_[scope.row.act_state] }} <template slot-scope="scope" v-if="scope.row.subproduction_plan_">{{ scope.row.subproduction_plan_.number }}</template>
</template> </el-table-column>
<el-table-column label="产品名称">
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="型号规格">
<template slot-scope="scope" v-if="scope.row.material_">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所在子工序"> <el-table-column label="军检状态">
<template slot-scope="scope">{{ scope.row.step_.name }}</template> <template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested==false">未军检</el-tag>
<el-tag v-if="scope.row.is_mtested==true">已军检</el-tag>
</template>
</el-table-column> </el-table-column>
<el-table-column label="军检结论">
<template slot-scope="scope"><el-tag v-if="scope.row.is_mtestok==false">不合格</el-tag>
<el-tag v-if="scope.row.is_mtestok==true">合格</el-tag></template>
</el-table-column>
<el-table-column label="仓库">
<template slot-scope="scope" v-if="scope.row.warehouse_">{{ scope.row.warehouse_.name }}</template>
</el-table-column>
<el-table-column label="检查表">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检查状态">
<template slot-scope="scope">{{ actstate_[scope.row.act_state]}}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['warehouse_update'])&&scope.row.test===null" v-if="checkPermission(['warehouse_update'])&&scope.row.act_state==30&&scope.row.is_mtested==false"
@click="handleInspection(scope)" @click="handleMtest(scope)"
>检验 >
</el-link> </el-link>
<el-link <el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope)" @click="checkRecord(scope)"
>检验记录 >检验记录
</el-link> </el-link>
@ -56,15 +71,77 @@
:limit.sync="listQuery.page_size" :limit.sync="listQuery.page_size"
@pagination="getList" @pagination="getList"
/> />
</el-tab-pane> <el-dialog title="军检" :visible.sync="dialogVisible">
<el-tab-pane label="合格成品" name="3"> <el-form :model="mtestform" label-width="130px"
label-position="right">
<el-form-item label="是否军检合格" prop="name">
<el-switch v-model="mtestform.is_mtestok"></el-switch>
</el-form-item>
<el-form-item label="军检备注" prop="name">
<el-input type="textarea" v-model="mtestform.remark_mtest"></el-input>
</el-form-item>
</el-tab-pane> </el-form>
<el-tab-pane label="不合格成品" name="4"> <div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submtest"> </el-button>
</div>
</el-dialog>
<el-dialog title="检验记录" :close-on-click-modal="false" :visible.sync="limitedCheckRecord">
<el-table
:data="recordList"
border
height="400"
>
<el-table-column type="index" width="50"/>
<el-table-column label="表单名称">
<template slot-scope="scope">{{ scope.row.form_.name }}</template>
</el-table-column>
<el-table-column label="检查类型">
<template slot-scope="scope">{{ checkTypes[scope.row.type] }}</template>
</el-table-column>
<el-table-column label="是否提交">
<template slot-scope="scope">
<span v-if="scope.row.is_submited">已提交</span>
<span v-else>未提交</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
</el-tab-pane> <el-link
</el-tabs> @click="handleRecordDetail(scope)"
>查看
</el-link>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
</div>
</el-dialog>
<el-dialog
width="60%"
:title="formName"
:visible.sync="recordVisible"
:close-on-click-modal="false"
@close="recordCancel"
>
<customForm
v-if="recordVisible"
:results="fieldList"
:hasPicture="hasPicture"
:formID="recordform"
:wproduct="wproduct"
:recordId="recordId"
:isDisabled="isDisabled"
@recordSubmit="recordSubmit"
@recordSave="recordSave"
@recordCancel="recordCancel"
/>
</el-dialog>
</el-card> </el-card>
@ -75,13 +152,15 @@
<script> <script>
import { getfifodetailList } from "@/api/inm"; import { getfifodetailList } from "@/api/inm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { createTestrecord } from "@/api/inm"; import { mtest,getwproductList } from "@/api/wpm";
import {getwproductList, wproductTest, wproductPutin, createputins} from "@/api/wpm"; import customForm from '@/components/customForm/index';
import { getrecordformList, getrffieldList} from "@/api/mtm";
import {getTestRecord,getTestRecordItem} from "@/api/qm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default { export default {
components: { Pagination }, components: { Pagination,customForm },
data() { data() {
return { return {
wproductList: { wproductList: {
@ -93,7 +172,54 @@ export default {
page_size: 20, page_size: 20,
}, },
activeName:"1" checkTypes: {
10: "子工序检验",
20: "工序检验",
30: "工序复检",
36: "夹层检验",
40: "成品检验",
},
actstate_: {
6: "待复检",
10: "操作进行中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
8: "操作准备中",
26: "待夹层检验",
70: "报废",
},
activeName:"1",
saleproduct:"",
dialogVisible:false,
mtestform:{
is_mtestok:false,
},
wproduct: null,
limitedCheckRecord: false,
recordList: [],
fieldList: [],
is_testok: "true",
recordformList: [],
customfieldList: [],
recordform: null,
recordId: null,
fifo_detail: "",
listQueryrecordform: {
page: 0,
},
recordVisible: false,
isDisabled: false,
hasPicture: false,
dialogFormVisible: false,
dialogFormVisibles: false,
limitedCheckRecord: false,
testrecord: {},
WarehouseData: "",
formName: '项目检查表',
}; };
}, },
computed: {}, computed: {},
@ -109,7 +235,7 @@ export default {
//待检成品列表 //待检成品列表
getList() { getList() {
this.listQuery.act_state = 60;
this.listQuery.material__type = 1; this.listQuery.material__type = 1;
getwproductList(this.listQuery).then((response) => { getwproductList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
@ -118,7 +244,76 @@ export default {
}); });
}, },
handleMtest(scope){
this.saleproduct=scope.row.id;
this.dialogVisible=true;
},
submtest(){
mtest(this.saleproduct,this.mtestform).then((res)=>{
if(res.code >= 200)
{
this.$message.success("提交成功!");
this.dialogVisible=false;
}
});
},
//检验记录
checkRecord(scope){
let that = this;
that.wproduct = scope.row.id;//成品ID
that.limitedCheckRecord = true;
getTestRecord({wproduct:scope.row.id,page:0}).then(res=>{
if(res.code==200){
that.recordList = res.data;
}else{
this.$message.error(res.msg);
}
})
},
//点击记录里的查看
handleRecordDetail(scope) {
let that = this;
that.fieldList = [];
that.recordVisible = false;
that.recordId = scope.row.id;
that.recordform = scope.row.form;
that.formName = scope.row.form_.name;
getrffieldList({form: this.recordform, page: 1, page_size: 100}).then((response) => {
if (response.data) {
that.hasPicture = false;
let fieldList = response.data.results;
that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
getTestRecordItem(scope.row.id).then((res) => {
let arr = [];
let fieldList = res.data.record_data;
for (let i = 0; i < that.fieldList.length; i++) {
let obj = that.fieldList[i];
obj.is_testok = null;
for (let j = 0; j < fieldList.length; j++) {
if (that.fieldList[i].field_key === fieldList[j].field_key) {
obj.id = fieldList[j].id;
obj.is_testok = fieldList[j].is_testok;
obj.field_value = fieldList[j].field_value;
}
}
arr.push(obj)
}
that.fieldList = arr;
that.$nextTick(() => {
that.isDisabled = true;
that.recordVisible = true;
});
})
}
});
},
}, },
}; };
</script> </script>

View File

@ -73,10 +73,12 @@
:data="wproduct" :data="wproduct"
border border
fit fit
row-key="id"
stripe stripe
style="width: 100%" style="width: 100%"
height="500" height="500"
> :load="load"
:tree-props="{children: 'children'}">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
@ -89,12 +91,18 @@
<template slot-scope="scope" >{{ <template slot-scope="scope" >{{
scope.row.step_.name scope.row.step_.name
}}</template> }}</template>
</el-table-column>
<el-table-column label="玻璃状态">
<template slot-scope="scope" >{{
scope.row.material_.name
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="状态" > <el-table-column label="状态" >
<template slot-scope="scope">{{ <template slot-scope="scope" >{{
actstate_[scope.row.act_state] actstate_[scope.row.act_state]
}}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="过程记录" label="过程记录"

View File

@ -41,24 +41,24 @@
v-el-height-adaptive-table="{bottomOffset: 42}" v-el-height-adaptive-table="{bottomOffset: 42}"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="合同名称" width="130" show-overflow-tooltip> <el-table-column label="合同名称" width="160" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="合同编号" > <el-table-column label="合同编号" width="160" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="合同金额(元)"> <el-table-column label="合同金额(元)" width="120">
<template slot-scope="scope">{{ scope.row.amount }}</template> <template slot-scope="scope">{{ scope.row.amount }}</template>
</el-table-column> </el-table-column>
<el-table-column label="开票金额(元)" > <el-table-column label="开票金额(元)" width="120" >
<template slot-scope="scope">{{ scope.row.invoice }}</template> <template slot-scope="scope">{{ scope.row.invoice }}</template>
</el-table-column> </el-table-column>
<el-table-column label="客户名称" width="130" show-overflow-tooltip> <el-table-column label="客户名称" width="130" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.customer_.name }}</template> <template slot-scope="scope">{{ scope.row.customer_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="签订日期" > <el-table-column label="签订日期" width="120" >
<template slot-scope="scope">{{ scope.row.sign_date }}</template> <template slot-scope="scope">{{ scope.row.sign_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="描述" width="130" show-overflow-tooltip> <el-table-column label="描述" width="130" show-overflow-tooltip>
@ -71,6 +71,7 @@
align="center" align="center"
label="操作" label="操作"
width="220px" width="220px"
fixed="right"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@ -112,7 +113,7 @@
<el-form <el-form
ref="Form" ref="Form"
:model="contract" :model="contract"
label-width="80px" label-width="130px"
label-position="right" label-position="right"
:rules="rule1" :rules="rule1"
> >
@ -122,10 +123,10 @@
<el-form-item label="合同编号" prop="number"> <el-form-item label="合同编号" prop="number">
<el-input v-model="contract.number" placeholder="合同编号" /> <el-input v-model="contract.number" placeholder="合同编号" />
</el-form-item> </el-form-item>
<el-form-item label="合同金额" prop="amount"> <el-form-item label="合同金额(元)" prop="amount">
<el-input v-model="contract.amount" placeholder="合同金额" /> <el-input v-model="contract.amount" placeholder="合同金额" />
</el-form-item> </el-form-item>
<el-form-item label="开票金额" prop="invoice"> <el-form-item label="开票金额(元)" prop="invoice">
<el-input v-model="contract.invoice" placeholder="开票金额" /> <el-input v-model="contract.invoice" placeholder="开票金额" />
</el-form-item> </el-form-item>
<el-form-item label="签订日期" prop="sign_date"> <el-form-item label="签订日期" prop="sign_date">

View File

@ -2,10 +2,10 @@
<div class="app-container"> <div class="app-container">
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
<el-descriptions title="基本信息" direction="vertical" :column="8" border> <el-descriptions title="基本信息" :column="8" :size="size" border>
<el-descriptions-item label="合同名称"> {{contractdetail.name}}</el-descriptions-item> <el-descriptions-item label="合同名称" > {{contractdetail.name}}</el-descriptions-item>
<el-descriptions-item label="编号" > {{contractdetail.number}}</el-descriptions-item> <el-descriptions-item label="编号" > {{contractdetail.number}}</el-descriptions-item>
<el-descriptions-item label="金额" :span="2" > {{contractdetail.amount}}</el-descriptions-item> <el-descriptions-item label="金额" > {{contractdetail.amount}}</el-descriptions-item>
<el-descriptions-item label="客户名称" v-if="contractdetail.customer"> {{contractdetail.customer_.name}} </el-descriptions-item> <el-descriptions-item label="客户名称" v-if="contractdetail.customer"> {{contractdetail.customer_.name}} </el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
@ -20,6 +20,7 @@
fit fit
stripe stripe
highlight-current-row highlight-current-row
height="510px"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />

View File

@ -121,7 +121,7 @@
> >
<el-form-item label="订单编号" prop="number"> <el-form-item label="订单编号" prop="number">
<el-input v-model="order.number" placeholder="订单编号" /> <el-input v-model="order.number" placeholder="订单编号自动生成" disabled="true" />
</el-form-item> </el-form-item>
<el-form-item label="所需产品" prop="product"> <el-form-item label="所需产品" prop="product">
<el-select style="width: 100%" v-model="order.product" placeholder="请选择"> <el-select style="width: 100%" v-model="order.product" placeholder="请选择">

View File

@ -19,10 +19,17 @@
<el-table-column label="半成品编号"> <el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column>
<el-table-column label="检测状态"> <el-table-column label="检测状态">
<template slot-scope="scope"> <template slot-scope="scope">
{{ actstate_[scope.row.act_state] }} {{ actstate_[scope.row.act_state] }}
</template> </template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所在子工序"> <el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template> <template slot-scope="scope">{{ scope.row.step_.name }}</template>
@ -99,11 +106,17 @@
<el-table-column label="半成品编号"> <el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="检测状态"> <el-table-column label="检测状态">
<template slot-scope="scope"> <template slot-scope="scope">
{{ actstate_[scope.row.act_state] }} {{ actstate_[scope.row.act_state] }}
</template> </template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所在子工序"> <el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template> <template slot-scope="scope">{{ scope.row.step_.name }}</template>
@ -159,13 +172,18 @@
<el-table-column label="半成品编号"> <el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="检测状态"> <el-table-column label="检测状态">
<template slot-scope="scope"> <template slot-scope="scope">
{{ actstate_[scope.row.act_state] }} {{ actstate_[scope.row.act_state] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column>
<el-table-column label="所在子工序"> <el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template> <template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column> </el-table-column>
@ -217,6 +235,9 @@
<template slot-scope="scope"> <template slot-scope="scope">
{{ actstate_[scope.row.act_state] }} {{ actstate_[scope.row.act_state] }}
</template> </template>
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所在子工序"> <el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template> <template slot-scope="scope">{{ scope.row.step_.name }}</template>
@ -225,6 +246,9 @@
<template slot-scope="scope"> <template slot-scope="scope">
{{ ng_sign_[scope.row.ng_sign] }} {{ ng_sign_[scope.row.ng_sign] }}
</template> </template>
</el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
@ -266,19 +290,26 @@
max-height="600" max-height="600"
> >
<el-table-column type="index" width="50"/> <el-table-column type="index" width="50"/>
<el-table-column label="半成品名称"> <el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template> <template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="半成品编号"> <el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="规格型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="检测状态"> <el-table-column label="检测状态">
<template slot-scope="scope"> <template slot-scope="scope">
{{ actstate_[scope.row.act_state] }} {{ actstate_[scope.row.act_state] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="子计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column>
<el-table-column label="所在子工序"> <el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template> <template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column> </el-table-column>

View File

@ -36,12 +36,7 @@
scope.row.create_by_.username scope.row.create_by_.username
}}</template> }}</template>
</el-table-column> </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="过程记录表"> <el-table-column label="过程记录表">
@ -141,7 +136,7 @@ export default {
handleoperation(scope) handleoperation(scope)
{ {
this.$router.push({name: "operationdo", params: { id: scope.row.id,is_submited:scope.row.is_submited }, }) this.$router.push({name: "operationdo", params: { id: scope.row.id,submited:scope.row.is_submited }, })
}, },
//大工序工序渲染 //大工序工序渲染
getProcessList() { getProcessList() {

View File

@ -3,6 +3,7 @@
<el-card> <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>基本信息</span> <span>基本信息</span>
<el-button style="float: right; padding: 3px 0" @click="readbook()" type="text">查看作业指导书</el-button> <el-button style="float: right; padding: 3px 0" @click="readbook()" type="text">查看作业指导书</el-button>
</div> </div>
<el-form <el-form
@ -30,7 +31,12 @@
disabled="disabled" disabled="disabled"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item >
<el-button type="primary" style="float: right" @click="handlesubmit()" v-if="operationData.is_submited==false"
>提交本次操作</el-button
>
</el-form-item>
<!--
<el-form-item label="边角料"> <el-form-item label="边角料">
<el-radio-group v-model="operationData.use_scrap"> <el-radio-group v-model="operationData.use_scrap">
<el-radio border <el-radio border
@ -44,7 +50,7 @@
<el-form-item label="备注" v-if="operationData.use_scrap"> <el-form-item label="备注" v-if="operationData.use_scrap">
<el-input type="textarea" v-model="operationData.remark"></el-input> <el-input type="textarea" v-model="operationData.remark"></el-input>
</el-form-item> </el-form-item>
!-->
<el-form-item v-if="operationData.use_scrap"> <el-form-item v-if="operationData.use_scrap">
<el-button type="primary" @click="scrapSubmit()">创建</el-button> <el-button type="primary" @click="scrapSubmit()">创建</el-button>
<el-button>取消</el-button> <el-button>取消</el-button>
@ -322,6 +328,16 @@
</el-table-column> </el-table-column>
<el-table-column prop="count" label="消耗数量"> <el-table-column prop="count" label="消耗数量">
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
type="danger"
@click="handleDeleteinput(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table> </el-table>
<el-dialog title="车间物料" :close-on-click-modal="false" :visible.sync="dialogTablepick"> <el-dialog title="车间物料" :close-on-click-modal="false" :visible.sync="dialogTablepick">
<el-table <el-table
@ -479,6 +495,17 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </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-switch
v-model="scope.row.use_scrap"
></el-switch>
</el-form-item>
</el-form>
</template>
</el-table-column> </el-table-column>
<!-- <el-table-column align="center" label="操作" width="100px"> <!-- <el-table-column align="center" label="操作" width="100px">
<template slot-scope="scope"> <template slot-scope="scope">
@ -500,7 +527,7 @@
<el-col span="8"> <el-col span="8">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>工装</span> <span>工装</span>
</div> </div>
<el-table <el-table
@ -526,11 +553,7 @@
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<el-card>
<el-button type="primary" style="float: right" @click="handlesubmit()" v-if="this.is_submited==false"
>提交本次操作</el-button
>
</el-card>
</div> </div>
</template> </template>
@ -559,7 +582,8 @@ import {
createTool, createTool,
createInputs, createInputs,
recordInit, recordInit,
createOutputs createOutputs,
deleteOperationeinput
} from "@/api/wpm"; } from "@/api/wpm";
import { getrffieldList,gettechdocList } from "@/api/mtm"; import { getrffieldList,gettechdocList } from "@/api/mtm";
@ -690,7 +714,7 @@ export default {
watch: {}, watch: {},
created() { created() {
this.id = this.$route.params.id; //操作ID this.id = this.$route.params.id; //操作ID
this.is_submited=this.$route.params.is_submited; //操作是否提交
this.getList(); //边角料 this.getList(); //边角料
this.getpwpList(); //半成品 this.getpwpList(); //半成品
this.getequList(); //设备 this.getequList(); //设备
@ -724,8 +748,8 @@ export default {
}, },
//如果使用边角料提交 //如果使用边角料提交
scrapSubmit() { scrapSubmit() {
this.scrapData.use_scrap = this.operationData.use_scrap; // this.scrapData.use_scrap = this.operationData.use_scrap;
this.scrapData.remark = this.operationData.remark; // this.scrapData.remark = this.operationData.remark;
createoperation(this.id, this.scrapData).then((res) => { createoperation(this.id, this.scrapData).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.$message.success("成功!"); this.$message.success("成功!");
@ -879,7 +903,23 @@ export default {
} }
}); });
}, },
//消耗物料删除
handleDeleteinput(scope) {
this.$confirm("确认删除该消耗物料操作?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteOperationeinput(scope.row.id);
this.getinputLists();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//车间领料批量提交 //车间领料批量提交
handlepicks() { handlepicks() {
@ -936,6 +976,7 @@ export default {
this.output.operation = this.id; this.output.operation = this.id;
this.output.subproduction_progress = scope.row.id; this.output.subproduction_progress = scope.row.id;
this.output.count = scope.row.output_count; this.output.count = scope.row.output_count;
this.output.use_scrap=scope.row.use_scrap;
createOutput(this.output).then((res) => { createOutput(this.output).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getoutputLists(); this.getoutputLists();
@ -957,6 +998,7 @@ export default {
"operation" :this.id, "operation" :this.id,
"subproduction_progress":item.id, "subproduction_progress":item.id,
"count": item.output_count, "count": item.output_count,
"use_scrap":item.use_scrap
}); });
} }

View File

@ -24,7 +24,7 @@
</el-table-column> </el-table-column>
<el-table-column label="产品名称"> <el-table-column label="产品名称">
<template slot-scope="scope">{{ <template slot-scope="scope">{{
scope.row.product_.name scope.row.plan_product_.name
}}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号"> <el-table-column label="产品型号">
@ -325,10 +325,8 @@
<template slot-scope="scope">{{ scope.row.material_.name }}</template> <template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所属子计划"> <el-table-column label="子计划编号">
<template slot-scope="scope">{{ <template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
scope.row.subproduction_plan
}}</template>
</el-table-column> </el-table-column>
<el-table-column label="备注"> <el-table-column label="备注">
<template slot-scope="scope">{{ scope.row.remark }}</template> <template slot-scope="scope">{{ scope.row.remark }}</template>

View File

@ -2,10 +2,11 @@ from django.db.models import base
from rest_framework import urlpatterns from rest_framework import urlpatterns
from django.urls import path, include from django.urls import path, include
from rest_framework.routers import DefaultRouter from rest_framework.routers import DefaultRouter
from apps.develop.views import CleanDataView, UpdateCuttingView from apps.develop.views import CleanDataView, UpdateCuttingView, UpdateLastTestResult
urlpatterns = [ urlpatterns = [
path('cleandata/', CleanDataView.as_view()), path('cleandata/', CleanDataView.as_view()),
path('update_cutting/', UpdateCuttingView.as_view()) path('update_cutting/', UpdateCuttingView.as_view()),
path('update_last_result/', UpdateLastTestResult.as_view())
] ]

View File

@ -47,3 +47,18 @@ class UpdateCuttingView(APIView):
WproductFlow.objects.filter(wproduct=i).update(coperation=op) WproductFlow.objects.filter(wproduct=i).update(coperation=op)
WpmServies.update_cutting_list_with_operation(op) WpmServies.update_cutting_list_with_operation(op)
return Response() return Response()
from apps.qm.models import TestRecord
class UpdateLastTestResult(APIView):
permission_classes = [IsAdminUser]
@transaction.atomic
def post(self, request, format=None):
"""
更新最后一次检验结果
"""
for i in WProduct.objects.all():
tr = TestRecord.objects.filter(wproduct=i, is_submited=True).order_by('-id').first()
if tr:
i.last_test_result = tr.is_testok
i.save()
return Response()

View File

@ -36,4 +36,3 @@ class Employee(CommonAModel):
def __str__(self): def __str__(self):
return self.name return self.name

View File

@ -2,12 +2,19 @@ from django_filters import rest_framework as filters
from apps.mtm.models import Material from apps.mtm.models import Material
from .models import IProduct, MaterialBatch from .models import IProduct, MaterialBatch
from django.utils import timezone
class MbFilterSet(filters.FilterSet): class MbFilterSet(filters.FilterSet):
material = filters.ModelMultipleChoiceFilter(field_name="material", queryset=Material.objects.all()) material = filters.ModelMultipleChoiceFilter(field_name="material", queryset=Material.objects.all())
tag = filters.CharFilter(method="filter_tag")
class Meta: class Meta:
model = MaterialBatch model = MaterialBatch
fields = ['material', 'warehouse'] fields = ['material', 'warehouse']
def filter_tag(self, queryset, name, value):
if value == 'expired':
queryset = queryset.exclude(expiration_date=None).filter(expiration_date__lte = timezone.now())
return queryset
class IProductFilterSet(filters.FilterSet): class IProductFilterSet(filters.FilterSet):

View File

@ -0,0 +1,25 @@
# Generated by Django 3.2.9 on 2022-01-13 01:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('inm', '0024_auto_20211227_0948'),
]
operations = [
migrations.RemoveField(
model_name='iproduct',
name='is_mtested',
),
migrations.RemoveField(
model_name='iproduct',
name='is_mtestok',
),
migrations.RemoveField(
model_name='iproduct',
name='remark_mtest',
),
]

View File

@ -2,7 +2,7 @@ from django.db import models
from django.db.models.base import Model from django.db.models.base import Model
import django.utils.timezone as timezone import django.utils.timezone as timezone
from django.db.models.query import QuerySet from django.db.models.query import QuerySet
from apps.system.models import CommonAModel, CommonBModel, Organization, User, Dict, File from apps.system.models import CommonADModel, CommonAModel, CommonBModel, Organization, User, Dict, File
from utils.model import SoftModel, BaseModel from utils.model import SoftModel, BaseModel
from simple_history.models import HistoricalRecords from simple_history.models import HistoricalRecords
from apps.mtm.models import Material from apps.mtm.models import Material
@ -50,7 +50,7 @@ class MaterialBatch(BaseModel):
class FIFO(CommonAModel): class FIFO(CommonADModel):
""" """
出入库记录 出入库记录
""" """

View File

@ -115,7 +115,7 @@ class FIFOItemViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
obj.fifo_item.save() obj.fifo_item.save()
return Response() return Response()
class FIFOViewSet(ListModelMixin, GenericViewSet): class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
""" """
出入库记录 出入库记录
""" """
@ -132,6 +132,12 @@ class FIFOViewSet(ListModelMixin, GenericViewSet):
return FIFOListSerializer return FIFOListSerializer
return super().get_serializer_class() return super().get_serializer_class()
def destroy(self, request, *args, **kwargs):
obj = self.get_object()
if obj.is_submited:
raise exceptions.APIException('该记录已审核,不可删除')
return super().destroy(request, *args, **kwargs)
@action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=FIFOInPurSerializer) @action(methods=['post'], detail=False, perms_map={'post':'*'}, serializer_class=FIFOInPurSerializer)
def in_pur(self, request, pk=None): def in_pur(self, request, pk=None):
""" """
@ -148,9 +154,9 @@ class FIFOViewSet(ListModelMixin, GenericViewSet):
审核通过 审核通过
""" """
obj = self.get_object() obj = self.get_object()
# for i in FIFOItem.objects.filter(fifo=obj): for i in FIFOItem.objects.filter(fifo=obj):
# if not i.is_testok: if not i.is_testok:
# raise APIException('未检验通过, 不可审核') raise APIException('未检验通过, 不可审核')
if obj.is_audited: if obj.is_audited:
raise APIException('该入库记录已审核通过') raise APIException('该入库记录已审核通过')
with transaction.atomic(): with transaction.atomic():
@ -166,7 +172,7 @@ class IProductViewSet(ListModelMixin, GenericViewSet):
半成品库存表 半成品库存表
""" """
perms_map = {'*': '*'} perms_map = {'*': '*'}
queryset = IProduct.objects.select_related('material', 'warehouse', 'wproduct__subproduction_plan__production_plan__order').filter(is_saled=False) queryset = IProduct.objects.select_related('material', 'warehouse', 'wproduct__subproduction_plan__production_plan__order')
serializer_class = IProductListSerializer serializer_class = IProductListSerializer
filterset_class = IProductFilterSet filterset_class = IProductFilterSet
search_fields = [] search_fields = []

View File

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View File

@ -1,7 +0,0 @@
from django.apps import AppConfig
class MnsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.mns'
verbose_name = '消息通知系统'

View File

@ -1,6 +0,0 @@
from django.db import models
from utils.model import BaseModel
# Create your models here.
class Notify(BaseModel)
pass

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

View File

@ -186,7 +186,7 @@ class RecordFormFieldViewSet(OptimizationMixin, CreateUpdateModelAMixin, ModelVi
queryset = RecordFormField.objects.all() queryset = RecordFormField.objects.all()
filterset_fields = ['field_type', 'form'] filterset_fields = ['field_type', 'form']
search_fields = ['field_name', 'field_key'] search_fields = ['field_name', 'field_key']
ordering = 'id' ordering = 'sort'
ordering_fields = ['sort', 'id'] ordering_fields = ['sort', 'id']
def get_serializer_class(self): def get_serializer_class(self):

View File

@ -7,7 +7,7 @@ from apps.wpm.services import WpmServies
class PlanFilterSet(filters.FilterSet): class PlanFilterSet(filters.FilterSet):
create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte') create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte')
create_time_end = filters.NumberFilter(field_name="create_time", lookup_expr='lte') create_time_end = filters.DateFilter(field_name="create_time", lookup_expr='lte')
tag = filters.CharFilter(method='filter_tag') tag = filters.CharFilter(method='filter_tag')
class Meta: class Meta:
model = ProductionPlan model = ProductionPlan

View File

@ -5,7 +5,7 @@ from apps.sam.models import Order
class OrderFilterSet(filters.FilterSet): class OrderFilterSet(filters.FilterSet):
create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte') create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte')
create_time_end = filters.NumberFilter(field_name="create_time", lookup_expr='lte') create_time_end = filters.DateFilter(field_name="create_time", lookup_expr='lte')
class Meta: class Meta:
model = Order model = Order
fields = ['product', 'contract', 'customer', 'create_time_start', 'create_time_end'] fields = ['product', 'contract', 'customer', 'create_time_start', 'create_time_end']
@ -13,6 +13,6 @@ class OrderFilterSet(filters.FilterSet):
class ContractFilterSet(filters.FilterSet): class ContractFilterSet(filters.FilterSet):
create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte') create_time_start = filters.DateFilter(field_name="create_time", lookup_expr='gte')
create_time_end = filters.NumberFilter(field_name="create_time", lookup_expr='lte') create_time_end = filters.DateFilter(field_name="create_time", lookup_expr='lte')
class Meta: class Meta:
fields = ['customer', 'create_time_start', 'create_time_end'] fields = ['customer', 'create_time_start', 'create_time_end']

View File

@ -38,7 +38,7 @@ class ContractSimpleSerializer(serializers.ModelSerializer):
class ContractCreateUpdateSerializer(serializers.ModelSerializer): class ContractCreateUpdateSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = Contract model = Contract
fields = ['name', 'number', 'amount', 'customer', 'sign_date', 'description'] fields = ['name', 'number', 'amount', 'customer', 'sign_date', 'description', 'invoice']
class OrderCreateUpdateSerializer(serializers.ModelSerializer): class OrderCreateUpdateSerializer(serializers.ModelSerializer):

View File

@ -2,7 +2,7 @@ from django_filters import rest_framework as filters
from apps.mtm.models import Material, Step from apps.mtm.models import Material, Step
from apps.wpm.services import WpmServies from apps.wpm.services import WpmServies
from .models import Operation, OperationMaterial, WMaterial, WProduct from .models import Operation, OperationMaterial, OperationRecord, WMaterial, WProduct
class WMaterialFilterSet(filters.FilterSet): class WMaterialFilterSet(filters.FilterSet):
@ -40,3 +40,14 @@ class CuttingFilterSet(filters.FilterSet):
class Meta: class Meta:
model = OperationMaterial model = OperationMaterial
fields = ['operation', 'subproduction_plan', 'material'] fields = ['operation', 'subproduction_plan', 'material']
class OperationRecordFilterSet(filters.FilterSet):
wproduct = filters.NumberFilter(method='filter_wproduct')
class Meta:
model = OperationRecord
fields = ['operation', 'form']
def filter_wproduct(self, queryset, name, value):
queryset = queryset.filter(operation__ow_operation__wproduct__id=value)
return queryset

View File

@ -0,0 +1,34 @@
# Generated by Django 3.2.9 on 2022-01-13 01:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wpm', '0045_auto_20220107_0917'),
]
operations = [
migrations.AddField(
model_name='wproduct',
name='last_test_result',
field=models.BooleanField(blank=True, null=True, verbose_name='最后一次检验结果'),
),
migrations.AlterField(
model_name='operationmaterial',
name='operation',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='om_operation', to='wpm.operation', verbose_name='关联的生产操作'),
),
migrations.AlterField(
model_name='wproduct',
name='child',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='wproduct_child', to='wpm.wproduct'),
),
migrations.AlterField(
model_name='wproductflow',
name='child',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='wproduct_child', to='wpm.wproductflow'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2022-01-13 01:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wpm', '0046_auto_20220113_0932'),
]
operations = [
migrations.AddField(
model_name='wproductflow',
name='last_test_result',
field=models.BooleanField(blank=True, null=True, verbose_name='最后一次检验结果'),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2022-01-13 07:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wpm', '0047_wproductflow_last_test_result'),
]
operations = [
migrations.AddField(
model_name='operationwproduct',
name='place',
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='摆放位置'),
),
]

View File

@ -107,6 +107,7 @@ class WProduct(CommonAModel):
is_mtested = models.BooleanField('是否军检', default=False) is_mtested = models.BooleanField('是否军检', default=False)
is_mtestok = models.BooleanField('是否军检合格', null=True, blank=True) is_mtestok = models.BooleanField('是否军检合格', null=True, blank=True)
remark_mtest = models.TextField('军检备注', null=True, blank=True) remark_mtest = models.TextField('军检备注', null=True, blank=True)
last_test_result = models.BooleanField('最后一次检验结果', null=True, blank=True)
@property @property
def last_process_test(self): def last_process_test(self):
@ -162,6 +163,7 @@ class WproductFlow(CommonAModel):
is_mtested = models.BooleanField('是否军检', default=False) is_mtested = models.BooleanField('是否军检', default=False)
is_mtestok = models.BooleanField('是否军检合格', null=True, blank=True) is_mtestok = models.BooleanField('是否军检合格', null=True, blank=True)
remark_mtest = models.TextField('军检备注', null=True, blank=True) remark_mtest = models.TextField('军检备注', null=True, blank=True)
last_test_result = models.BooleanField('最后一次检验结果', null=True, blank=True)
is_lastlog = models.BooleanField('是否该子计划下的最后一条日志', default=True) is_lastlog = models.BooleanField('是否该子计划下的最后一条日志', default=True)
change_str = models.CharField('变动描述', default='', max_length=1000) change_str = models.CharField('变动描述', default='', max_length=1000)
@ -209,6 +211,7 @@ class OperationWproduct(BaseModel):
material = models.ForeignKey(Material, verbose_name='操作时的物料状态', on_delete=models.CASCADE) material = models.ForeignKey(Material, verbose_name='操作时的物料状态', on_delete=models.CASCADE)
subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='当前子生产计划', on_delete=models.CASCADE, related_name='ow_subplan') subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='当前子生产计划', on_delete=models.CASCADE, related_name='ow_subplan')
ng_sign = models.PositiveSmallIntegerField('当时的不合格标记', choices= WProduct.ng_choices, null=True, blank=True) ng_sign = models.PositiveSmallIntegerField('当时的不合格标记', choices= WProduct.ng_choices, null=True, blank=True)
place = models.CharField('摆放位置', null=True, blank=True, max_length=200)
class Meta: class Meta:
unique_together = ( unique_together = (
('operation','wproduct') ('operation','wproduct')

View File

@ -244,15 +244,25 @@ class OperationDetailSerializer(serializers.ModelSerializer):
class OperationListSerializer(serializers.ModelSerializer): class OperationListSerializer(serializers.ModelSerializer):
create_by_ = UserSimpleSerializer(source='create_by', read_only=True) create_by_ = UserSimpleSerializer(source='create_by', read_only=True)
step_ = StepSimpleSerializer(source='step', read_only=True) step_ = StepSimpleSerializer(source='step', read_only=True)
wproduct_ = serializers.SerializerMethodField() # wproduct_ = serializers.SerializerMethodField()
count_work = serializers.SerializerMethodField()
equip_ = serializers.SerializerMethodField() equip_ = serializers.SerializerMethodField()
record_ = serializers.SerializerMethodField() record_ = serializers.SerializerMethodField()
class Meta: class Meta:
model = Operation model = Operation
fields = '__all__' fields = '__all__'
def get_wproduct_(self, obj): # def get_wproduct_(self, obj):
return WProduct.objects.filter(ow_wproduct__operation=obj).values('id', 'number') # return WProduct.objects.filter(ow_wproduct__operation=obj).values('id', 'number')
def get_count_work(self, obj):
from django.db.models.aggregates import Sum
count_work = 0
if obj.step.type == Step.STEP_TYPE_NOM:
count_work = OperationWproduct.objects.filter(operation=obj).count()
else:
count_work = OperationMaterial.objects.filter(operation=obj).aggregate(count_work=Sum('count'))['count_work']
return count_work
def get_equip_(self, obj): def get_equip_(self, obj):
return EquipmentSimpleSerializer(instance=Equipment.objects.filter(oe_equip__operation=obj), many=True).data return EquipmentSimpleSerializer(instance=Equipment.objects.filter(oe_equip__operation=obj), many=True).data
@ -360,6 +370,10 @@ class OperationWproductListSerializer(serializers.ModelSerializer):
model = OperationWproduct model = OperationWproduct
fields = '__all__' fields = '__all__'
class OperationWproductUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = OperationWproduct
fields = ['place']
class OperationSubmitSerializer(serializers.Serializer): class OperationSubmitSerializer(serializers.Serializer):
step = serializers.PrimaryKeyRelatedField(queryset=Step.objects.all(), label="子工序ID") step = serializers.PrimaryKeyRelatedField(queryset=Step.objects.all(), label="子工序ID")

View File

@ -94,6 +94,7 @@ class WpmServies(object):
wproduct.update_by = user wproduct.update_by = user
wproduct.update_time = timezone.now() wproduct.update_time = timezone.now()
wproduct.test = None wproduct.test = None
wproduct.last_test_result = is_testok
wproduct.save() wproduct.save()
# 添加日志 # 添加日志
cls.add_wproduct_flow_log(wproduct, 'test_ok' if is_testok else 'test_notok') cls.add_wproduct_flow_log(wproduct, 'test_ok' if is_testok else 'test_notok')

View File

@ -19,10 +19,10 @@ from apps.system.mixins import CreateUpdateModelAMixin, OptimizationMixin
from rest_framework.decorators import action from rest_framework.decorators import action
from apps.wf.models import Workflow from apps.wf.models import Workflow
from apps.wf.serializers import WorkflowSimpleSerializer from apps.wf.serializers import WorkflowSimpleSerializer
from apps.wpm.filters import CuttingFilterSet, WMaterialFilterSet, WProductFilterSet from apps.wpm.filters import CuttingFilterSet, OperationRecordFilterSet, WMaterialFilterSet, WProductFilterSet
from apps.wpm.models import OperationEquip, OperationWproduct, Pick, PickWproduct, WMaterial, WProduct, Operation, OperationMaterial, OperationRecord, OperationRecordItem, WprouctTicket from apps.wpm.models import OperationEquip, OperationWproduct, Pick, PickWproduct, WMaterial, WProduct, Operation, OperationMaterial, OperationRecord, OperationRecordItem, WprouctTicket
from apps.wpm.serializers import CuttingListSerializer, OperationEquipListSerializer, OperationEquipUpdateSerializer, OperationMaterialCreate1ListSerailizer, OperationMaterialCreate1Serailizer, OperationMaterialCreate2ListSerailizer, OperationMaterialCreate2Serailizer, OperationMaterialCreate3Serializer, OperationMaterialListSerializer, OperationRecordDetailSerializer, OperationRecordListSerializer, OperationRecordSubmitSerializer, OperationUpdateSerializer, OperationWproductListSerializer, OperationCreateSerializer, OperationDetailSerializer, OperationListSerializer, PickHalfSerializer, PickHalfsSerializer, PickSerializer, OperationInitSerializer, OperationSubmitSerializer, ScrapSerializer, WMaterialListSerializer, WProductCardSerializer, WProductDetailSerializer, WProductListSerializer, WplanPutInSerializer, WpmTestFormInitSerializer, WpmTestRecordCreateSerializer, WproductMtestSerializer, WproductPutInSerializer, WproductPutInsSerializer, WproductTicketListSerializer from apps.wpm.serializers import CuttingListSerializer, OperationEquipListSerializer, OperationEquipUpdateSerializer, OperationMaterialCreate1ListSerailizer, OperationMaterialCreate1Serailizer, OperationMaterialCreate2ListSerailizer, OperationMaterialCreate2Serailizer, OperationMaterialCreate3Serializer, OperationMaterialListSerializer, OperationRecordDetailSerializer, OperationRecordListSerializer, OperationRecordSubmitSerializer, OperationUpdateSerializer, OperationWproductListSerializer, OperationCreateSerializer, OperationDetailSerializer, OperationListSerializer, OperationWproductUpdateSerializer, PickHalfSerializer, PickHalfsSerializer, PickSerializer, OperationInitSerializer, OperationSubmitSerializer, ScrapSerializer, WMaterialListSerializer, WProductCardSerializer, WProductDetailSerializer, WProductListSerializer, WplanPutInSerializer, WpmTestFormInitSerializer, WpmTestRecordCreateSerializer, WproductMtestSerializer, WproductPutInSerializer, WproductPutInsSerializer, WproductTicketListSerializer
from rest_framework.response import Response from rest_framework.response import Response
from django.db import transaction from django.db import transaction
from rest_framework import exceptions, serializers from rest_framework import exceptions, serializers
@ -609,17 +609,19 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
step = op.step step = op.step
if op.is_submited: if op.is_submited:
raise exceptions.APIException('该操作已提交') raise exceptions.APIException('该操作已提交')
# 校验消耗产出是否正确填写
omis = OperationMaterial.objects.filter(operation=op, omis = OperationMaterial.objects.filter(operation=op,
type=SubprodctionMaterial.SUB_MA_TYPE_IN) type=SubprodctionMaterial.SUB_MA_TYPE_IN)
sps_omi_l = omis.values_list('subproduction_plan', flat=True)
omos = OperationMaterial.objects.filter(operation=op, omos = OperationMaterial.objects.filter(operation=op,
type=SubprodctionMaterial.SUB_MA_TYPE_OUT) type=SubprodctionMaterial.SUB_MA_TYPE_OUT)
# 校验消耗产出是否正确填写
if op.step.type == Step.STEP_TYPE_DIV:
sps_omi_l = omis.values_list('subproduction_plan', flat=True)
sps_omo_l = omos.filter(use_scrap=False).values_list('subproduction_plan', flat=True) sps_omo_l = omos.filter(use_scrap=False).values_list('subproduction_plan', flat=True)
if set(list(sps_omi_l)) == set(list(sps_omo_l)) or op.step.type == Step.STEP_TYPE_COMB: if set(list(sps_omi_l)) != set(list(sps_omo_l)):
pass
else:
raise exceptions.APIException('消耗与产出不一致') raise exceptions.APIException('消耗与产出不一致')
# 实际消耗物料校验
# 检查自定义表单填写 # 检查自定义表单填写
if OperationRecord.objects.filter(operation=op, is_filled=False).exists(): if OperationRecord.objects.filter(operation=op, is_filled=False).exists():
raise exceptions.APIException('存在自定义表单未填写') raise exceptions.APIException('存在自定义表单未填写')
@ -722,7 +724,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
class OperationWproductViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet): class OperationWproductViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin, GenericViewSet):
""" """
操作使用的半成品 操作使用的半成品
""" """
@ -733,6 +735,11 @@ class OperationWproductViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet
ordering_fields = ['id'] ordering_fields = ['id']
ordering = ['-id'] ordering = ['-id']
def get_serializer_class(self):
if self.action == 'update':
return OperationWproductUpdateSerializer
return super().get_serializer_class()
@transaction.atomic() @transaction.atomic()
def destroy(self, request, *args, **kwargs): def destroy(self, request, *args, **kwargs):
instance = self.get_object() instance = self.get_object()
@ -781,7 +788,7 @@ class OperationRecordViewSet(ListModelMixin, DestroyModelMixin, UpdateModelMixin
perms_map={'*':'*'} perms_map={'*':'*'}
queryset = OperationRecord.objects.select_related('operation', 'form').all() queryset = OperationRecord.objects.select_related('operation', 'form').all()
serializer_class = OperationRecordListSerializer serializer_class = OperationRecordListSerializer
filterset_fields = ['operation', 'form'] filterset_class = OperationRecordFilterSet
ordering_fields = ['id'] ordering_fields = ['id']
ordering = ['-id'] ordering = ['-id']