Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
d3401e3fe9
|
|
@ -2,8 +2,8 @@
|
||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# base api
|
# base api
|
||||||
#VUE_APP_BASE_API = 'http://127.0.0.1:8000/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://47.95.0.242:2222/api'
|
||||||
|
|
||||||
|
|
||||||
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
@expand-change="handlerExpand"
|
@expand-change="handlerExpand"
|
||||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||||
>
|
>
|
||||||
<el-table-column label="任务编号">
|
<el-table-column label="任务编号" width="150">
|
||||||
<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="产品名称">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-row style="position: absolute;z-index: 2000;top: -38px;right: 150px;display: flex">
|
<el-row class="searchWrap">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="timeRange"
|
v-model="timeRange"
|
||||||
type="monthrange"
|
type="monthrange"
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div class="left" style=" width: 400px ;float: left;border-right: 1px solid #f7f7f7">
|
<div class="left leftTable">
|
||||||
<leftMenu
|
<leftMenu
|
||||||
:list="list"
|
:list="list"
|
||||||
ref="leftMenu"
|
ref="leftMenu"
|
||||||
|
|
@ -376,7 +376,7 @@
|
||||||
this.windowWidth=document.body.clientWidth?document.body.clientWidth:document.documentElement.clientWidth;
|
this.windowWidth=document.body.clientWidth?document.body.clientWidth:document.documentElement.clientWidth;
|
||||||
}
|
}
|
||||||
let currentYear = new Date().getFullYear();
|
let currentYear = new Date().getFullYear();
|
||||||
this.timeRange = [currentYear+'-01',currentYear+'-12'];
|
this.timeRange = [currentYear+'-01',(currentYear+1)+'-12'];
|
||||||
this.list = [...this.proList];
|
this.list = [...this.proList];
|
||||||
document.addEventListener("scroll", this.handleScroll);
|
document.addEventListener("scroll", this.handleScroll);
|
||||||
this.list=[...this.list];
|
this.list=[...this.list];
|
||||||
|
|
@ -385,7 +385,6 @@
|
||||||
this.setStoneLine();
|
this.setStoneLine();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
computedList() {
|
computedList() {
|
||||||
let arr = [];
|
let arr = [];
|
||||||
this.list.forEach(item => {
|
this.list.forEach(item => {
|
||||||
|
|
@ -1019,6 +1018,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
proList() {
|
||||||
|
this.list=[...this.proList];
|
||||||
|
this.handlerCheckList(this.list);
|
||||||
|
// this.proList = this.proList;
|
||||||
|
},
|
||||||
currentDaySize(newValue, oldValue) {
|
currentDaySize(newValue, oldValue) {
|
||||||
this.list.forEach(item => {
|
this.list.forEach(item => {
|
||||||
item.left = (item.left / oldValue.value) * newValue.value;
|
item.left = (item.left / oldValue.value) * newValue.value;
|
||||||
|
|
@ -1043,7 +1047,7 @@
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.chart {
|
.chart {
|
||||||
height: 280px;
|
height: 300px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
@ -1375,4 +1379,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.leftTable{
|
||||||
|
width: 400px ;
|
||||||
|
float: left;
|
||||||
|
height: 300px;
|
||||||
|
border-right: 1px solid #f7f7f7;
|
||||||
|
}
|
||||||
|
.searchWrap{
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2000;
|
||||||
|
top: -38px;
|
||||||
|
right: 150px;
|
||||||
|
display: flex
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@
|
||||||
<el-radio v-model="is_testok" :label="testokTrue">检查合格</el-radio>
|
<el-radio v-model="is_testok" :label="testokTrue">检查合格</el-radio>
|
||||||
<el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio>
|
<el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="dialog-footer" style="text-align: right">
|
<div class="dialog-footer" style="text-align: right" v-show="!isDisabled">
|
||||||
<el-button @click="recordCancel">取 消</el-button>
|
<el-button @click="recordCancel">取 消</el-button>
|
||||||
<el-button type="primary" @click="submitfield('1')">保存</el-button>
|
<el-button type="primary" @click="submitfield('1')">保存</el-button>
|
||||||
<el-button type="warning" @click="submitfield('2')">提交</el-button>
|
<el-button type="warning" @click="submitfield('2')">提交</el-button>
|
||||||
|
|
@ -182,6 +182,10 @@
|
||||||
hasPicture:{
|
hasPicture:{
|
||||||
type:Boolean,
|
type:Boolean,
|
||||||
default:false
|
default:false
|
||||||
|
},
|
||||||
|
isDisabled:{
|
||||||
|
type:Boolean,
|
||||||
|
default:false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
||||||
|
|
@ -786,6 +786,7 @@
|
||||||
fieldData(isSubmit){
|
fieldData(isSubmit){
|
||||||
let that = this;
|
let that = this;
|
||||||
that.field = []; //检查项目
|
that.field = []; //检查项目
|
||||||
|
debugger;
|
||||||
let submit = isSubmit=='1'?false:true;
|
let submit = isSubmit=='1'?false:true;
|
||||||
that.formData.forEach((item) => {
|
that.formData.forEach((item) => {
|
||||||
let field_value = 0;
|
let field_value = 0;
|
||||||
|
|
@ -801,12 +802,10 @@
|
||||||
is_hidden: item.is_hidden
|
is_hidden: item.is_hidden
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// that.testrecord.form = that.formID;//检查表
|
|
||||||
that.testrecord.record_data = that.field;//检查项列表
|
that.testrecord.record_data = that.field;//检查项列表
|
||||||
that.testrecord.is_testok = that.is_testok;//检查表检查结果
|
that.testrecord.is_testok = that.is_testok;//检查表检查结果
|
||||||
// that.testrecord.wproduct = that.wproductId;//半成品ID
|
|
||||||
// that.testrecord.is_submited = true;
|
|
||||||
that.testrecord.id = that.recordId;
|
that.testrecord.id = that.recordId;
|
||||||
|
debugger;
|
||||||
if(submit){//提交
|
if(submit){//提交
|
||||||
this.$emit('recordSubmit',that.testrecord);
|
this.$emit('recordSubmit',that.testrecord);
|
||||||
}else {//保存
|
}else {//保存
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,40 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="dashboard-container">
|
<div class="dashboard-container">
|
||||||
<el-badge :value="count.total_count" class="item" @click.native="gotoTicketPage">
|
<el-card>
|
||||||
<el-icon class="el-icon-s-management" style="font-size: 70px;color: #d29898"></el-icon>
|
<div class="cards">
|
||||||
</el-badge>
|
<div class="cardFirstText">本月:2</div>
|
||||||
<div></div>
|
<div class="cardSecondText">20</div>
|
||||||
<div class="dashboard-text">name: {{ name }}</div>
|
<div>合同总数</div>
|
||||||
<div class="dashboard-text">perms: <span v-for="perm in perms" :key="perm">{{ perm }}</span></div>
|
</div>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="cardFirstText">本月:20</div>
|
||||||
|
<div class="cardSecondText">20</div>
|
||||||
|
<div>生产订单总数</div>
|
||||||
|
</div>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="cardFirstText">在制:10</div>
|
||||||
|
<div class="cardSecondText">20</div>
|
||||||
|
<div>已排产生产任务</div>
|
||||||
|
</div>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="cardFirstText">本月:4</div>
|
||||||
|
<div class="cardSecondText">2</div>
|
||||||
|
<div>累计交付产品数</div>
|
||||||
|
</div>
|
||||||
|
<div class="cards">
|
||||||
|
<div class="cardFirstText">本月:2</div>
|
||||||
|
<div class="cardSecondText">2</div>
|
||||||
|
<div>累计不合格产品数</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<el-card>
|
||||||
|
<el-badge :value="count.total_count" class="item" @click.native="gotoTicketPage">
|
||||||
|
<el-icon class="el-icon-s-management" style="font-size: 70px;color: #d29898"></el-icon>
|
||||||
|
</el-badge>
|
||||||
|
<div></div>
|
||||||
|
<div class="dashboard-text">name: {{ name }}</div>
|
||||||
|
<div class="dashboard-text">perms: <span v-for="perm in perms" :key="perm">{{ perm }}</span></div>
|
||||||
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -37,11 +66,32 @@ export default {
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.dashboard {
|
.dashboard {
|
||||||
&-container {
|
&-container {
|
||||||
margin: 30px;
|
margin: 5px 6px;
|
||||||
}
|
}
|
||||||
&-text {
|
&-text {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
line-height: 46px;
|
line-height: 46px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.cards{
|
||||||
|
width: 240px;
|
||||||
|
color: #ffffff;
|
||||||
|
background: #abccec;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 10px;
|
||||||
|
line-height: 30px;
|
||||||
|
float: left;
|
||||||
|
margin: 15px;
|
||||||
|
.cardFirstText{
|
||||||
|
text-align: left;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
.cardSecondText{
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cards:hover{
|
||||||
|
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
stripe
|
stripe
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
height="300"
|
height="300"
|
||||||
|
@row-click="tableRowClick"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
|
|
||||||
|
|
@ -114,19 +115,11 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import {getPlanGantt} from "@/api/srm";
|
||||||
import gantt from "@/components/Gantt/index";
|
import gantt from "@/components/Gantt/index";
|
||||||
import { getordertoplan } from "@/api/sam";
|
import { getProductionplanList} from "@/api/pm";
|
||||||
import {
|
|
||||||
createProductionplan,
|
|
||||||
getProductionplanList,
|
|
||||||
createsubplan,
|
|
||||||
} from "@/api/pm";
|
|
||||||
import { getMaterialList } from "@/api/mtm";
|
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
|
|
||||||
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
|
||||||
const defaulteorderplan = {};
|
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination, gantt },
|
components: { Pagination, gantt },
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -164,17 +157,20 @@ export default {
|
||||||
this.getplanList();
|
this.getplanList();
|
||||||
},
|
},
|
||||||
//生产计划列表
|
//生产计划列表
|
||||||
|
tableRowClick(row){
|
||||||
//列表
|
|
||||||
getplanList() {
|
|
||||||
let that = this;
|
let that = this;
|
||||||
this.listLoading = true;
|
getPlanGantt({}).then(res=>{
|
||||||
getProductionplanList(this.listQuery).then((response) => {
|
if(res.code===200){
|
||||||
if (response.data) {
|
let arr =[],list=[];
|
||||||
this.productionplanList = response.data;
|
let li = res.data.results;
|
||||||
let list = response.data.results;
|
li.forEach((item)=>{
|
||||||
let arr = [];
|
if(item.id===row.id){
|
||||||
list.forEach((item) => {
|
list.push(item)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
debugger;
|
||||||
|
console.log(list);
|
||||||
|
list.forEach(item => {
|
||||||
if (!item.children || item.children.length < 1) {
|
if (!item.children || item.children.length < 1) {
|
||||||
let startTime = new Date(item.start_date).getTime();
|
let startTime = new Date(item.start_date).getTime();
|
||||||
let endTime = new Date(item.end_date).getTime();
|
let endTime = new Date(item.end_date).getTime();
|
||||||
|
|
@ -191,8 +187,84 @@ export default {
|
||||||
obj.productNum = item.product_.specification;
|
obj.productNum = item.product_.specification;
|
||||||
obj.isShow = true;
|
obj.isShow = true;
|
||||||
arr.push(obj);
|
arr.push(obj);
|
||||||
|
} else if (item.children && item.children.length >= 1) {
|
||||||
|
let startTime = new Date(item.start_date).getTime();
|
||||||
|
let endTime = new Date(item.end_date).getTime();
|
||||||
|
let temp =[];
|
||||||
|
let parentId = item.id;
|
||||||
|
let children = item.children;
|
||||||
|
children.forEach(child => {
|
||||||
|
let start = new Date(child.start_date).getTime();
|
||||||
|
let end = new Date(child.end_date).getTime();
|
||||||
|
let objChild = new Object();
|
||||||
|
objChild.name = child.number;
|
||||||
|
objChild.id = child.id;
|
||||||
|
objChild.top=50;
|
||||||
|
objChild.parentId=parentId;
|
||||||
|
objChild.startTime = start;
|
||||||
|
objChild.endTime = end;
|
||||||
|
objChild.planTime = [start,end];
|
||||||
|
objChild.per = child.count;
|
||||||
|
objChild.per1 = child.count_real;
|
||||||
|
objChild.type = 1;
|
||||||
|
objChild.productName = child.product_.name;
|
||||||
|
objChild.productNum = child.product_.specification;
|
||||||
|
objChild.isShow= true;
|
||||||
|
|
||||||
|
temp.push(objChild);
|
||||||
|
});
|
||||||
|
let obj=new Object();
|
||||||
|
obj.name=item.number;
|
||||||
|
obj.id=item.id;
|
||||||
|
obj.top=20;
|
||||||
|
obj.startTime=startTime;
|
||||||
|
obj.endTime=endTime;
|
||||||
|
obj.planTime = [startTime,endTime];
|
||||||
|
obj.per=item.count;
|
||||||
|
obj.per1=item.count_real;
|
||||||
|
obj.type=3;
|
||||||
|
obj.productName = item.product_.name;
|
||||||
|
obj.productNum = item.product_.specification;
|
||||||
|
obj.children = temp;
|
||||||
|
obj.isShow= true;
|
||||||
|
arr.push(obj);
|
||||||
}
|
}
|
||||||
|
that.proList = arr;
|
||||||
debugger;
|
debugger;
|
||||||
|
console.log(arr)
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
that.$message.error(res.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//列表
|
||||||
|
getplanList() {
|
||||||
|
let that = this;
|
||||||
|
this.listLoading = true;
|
||||||
|
getProductionplanList(this.listQuery).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
this.productionplanList = response.data;
|
||||||
|
let list = response.data.results;
|
||||||
|
let arr = [];
|
||||||
|
list.forEach((item) => {
|
||||||
|
// if (!item.children || item.children.length < 1) {
|
||||||
|
let startTime = new Date(item.start_date).getTime();
|
||||||
|
let endTime = new Date(item.end_date).getTime();
|
||||||
|
let obj = new Object();
|
||||||
|
obj.name = item.number;
|
||||||
|
obj.id = item.id;
|
||||||
|
obj.top = 20;
|
||||||
|
obj.startTime = startTime;
|
||||||
|
obj.endTime = endTime;
|
||||||
|
obj.planTime = [startTime, endTime];
|
||||||
|
obj.per = item.count;
|
||||||
|
obj.type = 1;
|
||||||
|
obj.productName = item.product_.name;
|
||||||
|
obj.productNum = item.product_.specification;
|
||||||
|
obj.isShow = true;
|
||||||
|
arr.push(obj);
|
||||||
|
// }
|
||||||
that.proList = arr;
|
that.proList = arr;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -377,6 +377,7 @@
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
<reviewForm
|
<reviewForm
|
||||||
|
v-if="limitedReview"
|
||||||
:results="fieldList"
|
:results="fieldList"
|
||||||
:originList="originList"
|
:originList="originList"
|
||||||
:formID="recordform"
|
:formID="recordform"
|
||||||
|
|
@ -397,11 +398,13 @@
|
||||||
@close="recordCancel"
|
@close="recordCancel"
|
||||||
>
|
>
|
||||||
<customForm
|
<customForm
|
||||||
|
v-if="recordVisible"
|
||||||
:results="fieldList"
|
:results="fieldList"
|
||||||
:hasPicture="hasPicture"
|
:hasPicture="hasPicture"
|
||||||
:formID="recordform"
|
:formID="recordform"
|
||||||
:wproduct="wproduct"
|
:wproduct="wproduct"
|
||||||
:recordId="recordId"
|
:recordId="recordId"
|
||||||
|
:isDisabled="isDisabled"
|
||||||
@recordSubmit="recordSubmit"
|
@recordSubmit="recordSubmit"
|
||||||
@recordSave="recordSave"
|
@recordSave="recordSave"
|
||||||
@recordCancel="recordCancel"
|
@recordCancel="recordCancel"
|
||||||
|
|
@ -706,6 +709,7 @@
|
||||||
mutipID: [],
|
mutipID: [],
|
||||||
wproduct: null,
|
wproduct: null,
|
||||||
isPost: false,
|
isPost: false,
|
||||||
|
isDisabled: false,
|
||||||
origin_test: null,
|
origin_test: null,
|
||||||
hasPicture: false,
|
hasPicture: false,
|
||||||
outerVisible: false,
|
outerVisible: false,
|
||||||
|
|
@ -1008,6 +1012,7 @@
|
||||||
}
|
}
|
||||||
that.fieldList = arr;
|
that.fieldList = arr;
|
||||||
that.$nextTick(()=>{
|
that.$nextTick(()=>{
|
||||||
|
that.isDisabled = false;
|
||||||
that.recordVisible = true;
|
that.recordVisible = true;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
@ -1050,7 +1055,45 @@
|
||||||
},
|
},
|
||||||
//点击记录里的查看
|
//点击记录里的查看
|
||||||
handleRecordDetail(scope){
|
handleRecordDetail(scope){
|
||||||
|
let that = this;
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
//半产品复检
|
//半产品复检
|
||||||
handleReview() {
|
handleReview() {
|
||||||
|
|
@ -1110,6 +1153,7 @@
|
||||||
that.hasPicture = true;
|
that.hasPicture = true;
|
||||||
}
|
}
|
||||||
that.$nextTick(()=>{
|
that.$nextTick(()=>{
|
||||||
|
that.isDisabled = false;
|
||||||
that.recordVisible = true;
|
that.recordVisible = true;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,6 @@
|
||||||
|
|
||||||
<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
|
|
||||||
v-if="checkPermission(['warehouse_update'])"
|
|
||||||
@click="handleInspection(scope)"
|
|
||||||
>检验
|
|
||||||
</el-link
|
|
||||||
>
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_update'])&&scope.row.test===null"
|
v-if="checkPermission(['warehouse_update'])&&scope.row.test===null"
|
||||||
@click="handleInspection(scope)"
|
@click="handleInspection(scope)"
|
||||||
|
|
@ -181,6 +175,7 @@
|
||||||
@close="recordCancel"
|
@close="recordCancel"
|
||||||
>
|
>
|
||||||
<customForm
|
<customForm
|
||||||
|
v-if="innerVisible"
|
||||||
:results="fieldList"
|
:results="fieldList"
|
||||||
:hasPicture="hasPicture"
|
:hasPicture="hasPicture"
|
||||||
:formID="recordform"
|
:formID="recordform"
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,14 @@ class PmService:
|
||||||
"""
|
"""
|
||||||
ret = {}
|
ret = {}
|
||||||
subplans = SubProductionPlan.objects.filter(production_plan=plan, is_deleted=False)
|
subplans = SubProductionPlan.objects.filter(production_plan=plan, is_deleted=False)
|
||||||
qs = subplans.values('process', 'process__name', 'process__number').annotate(count=Sum('main_count'),
|
qs = subplans.values('process', 'process__name', 'process__number').annotate(count=Sum('count'),
|
||||||
count_real=Sum('main_count_real'), count_ok=Sum('main_count_ok'), count_notok=Sum('main_count_notok'))
|
count_real=Sum('count_real'), count_ok=Sum('count_ok'), count_notok=Sum('count_notok'))
|
||||||
qs_list = list(qs)
|
qs_list = list(qs)
|
||||||
for i in qs_list:
|
for i in qs_list:
|
||||||
ret[i['process__number']] = {
|
ret[i['process__number']] = {
|
||||||
|
'process':i['process'],
|
||||||
|
'process_number':i['process__number'],
|
||||||
|
'process_name':i['process__name'],
|
||||||
'count':i['count'],
|
'count':i['count'],
|
||||||
'count_real':i['count_real'],
|
'count_real':i['count_real'],
|
||||||
'count_ok':i['count_ok'],
|
'count_ok':i['count_ok'],
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
if obj.is_submited:
|
if obj.is_submited:
|
||||||
raise exceptions.APIException('该记录已提交不可删除')
|
raise exceptions.APIException('该记录已提交不可删除')
|
||||||
|
WpmServies.add_wproduct_flow_log(obj.wproduct, 'test_delete')
|
||||||
return super().destroy(request, *args, **kwargs)
|
return super().destroy(request, *args, **kwargs)
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=TestRecordUpdateSerializer)
|
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=TestRecordUpdateSerializer)
|
||||||
|
|
@ -89,7 +90,7 @@ class TestRecordViewSet(ListModelMixin, UpdateModelMixin, RetrieveModelMixin, De
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
obj.is_submited=True
|
obj.is_submited=True
|
||||||
obj.save()
|
obj.save()
|
||||||
WpmServies.update_wproduct_by_test(obj, request.user)
|
WpmServies.update_wproduct_by_test(obj, request.user) # 这里已经做了日志记录和进度计算
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
# def create(self, request, *args, **kwargs):
|
# def create(self, request, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class SubplanGanttSerializer(serializers.ModelSerializer):
|
||||||
product_ = MaterialSimpleSerializer(source='product', read_only=True)
|
product_ = MaterialSimpleSerializer(source='product', read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SubProductionPlan
|
model = SubProductionPlan
|
||||||
fields = ['id', 'number', 'start_date', 'end_date', 'count', 'count_real', 'count_ok', 'start_date_real', 'end_date_real', 'process_']
|
fields = ['id', 'number', 'start_date', 'end_date', 'count', 'count_real', 'count_ok', 'start_date_real', 'end_date_real', 'process_', 'product_']
|
||||||
|
|
||||||
class PlanGanttSerializer(serializers.ModelSerializer):
|
class PlanGanttSerializer(serializers.ModelSerializer):
|
||||||
children = serializers.SerializerMethodField()
|
children = serializers.SerializerMethodField()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.2.9 on 2021-12-30 01:31
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('wpm', '0040_alter_wproductflow_number'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='wproductflow',
|
||||||
|
name='change_str',
|
||||||
|
field=models.CharField(default='', max_length=1000, verbose_name='变动描述'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -148,7 +148,9 @@ class WproductFlow(CommonAModel):
|
||||||
on_delete=models.SET_NULL, null=True, blank=True)
|
on_delete=models.SET_NULL, null=True, blank=True)
|
||||||
ticket = models.ForeignKey('wf.ticket', verbose_name='当前工单',
|
ticket = models.ForeignKey('wf.ticket', verbose_name='当前工单',
|
||||||
on_delete=models.SET_NULL, null=True, blank=True)
|
on_delete=models.SET_NULL, null=True, blank=True)
|
||||||
|
|
||||||
is_lastlog = models.BooleanField('是否该子计划下的最后一条日志', default=True)
|
is_lastlog = models.BooleanField('是否该子计划下的最后一条日志', default=True)
|
||||||
|
change_str = models.CharField('变动描述', default='', max_length=1000)
|
||||||
|
|
||||||
|
|
||||||
class Pick(CommonADModel):
|
class Pick(CommonADModel):
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,6 @@ class WpmServies(object):
|
||||||
participant_type=State.PARTICIPANT_TYPE_PERSONAL,
|
participant_type=State.PARTICIPANT_TYPE_PERSONAL,
|
||||||
intervene_type=0,
|
intervene_type=0,
|
||||||
participant=user)
|
participant=user)
|
||||||
|
|
||||||
|
|
||||||
# 更新子计划相关进度
|
|
||||||
cls.update_subproduction_progress_main(sp=wproduct.subproduction_plan)
|
|
||||||
else:# 如果不合格
|
else:# 如果不合格
|
||||||
wproduct.act_state = WProduct.WPR_ACT_STATE_NOTOK
|
wproduct.act_state = WProduct.WPR_ACT_STATE_NOTOK
|
||||||
# 需要走不合格品审理的工单
|
# 需要走不合格品审理的工单
|
||||||
|
|
@ -95,11 +91,15 @@ class WpmServies(object):
|
||||||
intervene_type=0,
|
intervene_type=0,
|
||||||
participant=user)
|
participant=user)
|
||||||
|
|
||||||
|
|
||||||
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.save()
|
wproduct.save()
|
||||||
|
# 添加日志
|
||||||
|
cls.add_wproduct_flow_log(wproduct, 'test_ok' if is_testok else 'test_notok')
|
||||||
|
# 更新子计划相关进度
|
||||||
|
cls.update_subproduction_progress_main(sp=wproduct.subproduction_plan)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def update_subproduction_progress_main(cls, sp:SubProductionPlan):
|
def update_subproduction_progress_main(cls, sp:SubProductionPlan):
|
||||||
|
|
@ -131,3 +131,18 @@ class WpmServies(object):
|
||||||
if count_mtestok >= plan.count:
|
if count_mtestok >= plan.count:
|
||||||
plan.state = ProductionPlan.PLAN_MTEST_DONE
|
plan.state = ProductionPlan.PLAN_MTEST_DONE
|
||||||
plan.save()
|
plan.save()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def add_wproduct_flow_log(cls, instance:WProduct, change_str:str=''):
|
||||||
|
"""
|
||||||
|
创建产品变动日志
|
||||||
|
"""
|
||||||
|
# update_fields = kwargs['update_fields']
|
||||||
|
WproductFlow.objects.filter(wproduct=instance, subproduction_plan=instance.subproduction_plan).update(is_lastlog=False)
|
||||||
|
ins = WproductFlow()
|
||||||
|
ins.wproduct = instance
|
||||||
|
for f in WproductFlow._meta.fields:
|
||||||
|
if f.name not in ['id', 'wproduct', 'is_lastlog']:
|
||||||
|
setattr(ins, f.name, getattr(instance, f.name, None))
|
||||||
|
ins.change_str = change_str
|
||||||
|
ins.save()
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ def handleTicket(sender, instance, created, **kwargs):
|
||||||
# 工单绑定半成品
|
# 工单绑定半成品
|
||||||
wproduct.ticket = instance
|
wproduct.ticket = instance
|
||||||
wproduct.save()
|
wproduct.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(wproduct, 'ticket_create')
|
||||||
|
|
||||||
# 检验员
|
# 检验员
|
||||||
if not ticket_data.get('tester', None):
|
if not ticket_data.get('tester', None):
|
||||||
|
|
@ -68,10 +69,7 @@ def handleTicket(sender, instance, created, **kwargs):
|
||||||
wt.save()
|
wt.save()
|
||||||
wp.ticket = None # 解除当前工单
|
wp.ticket = None # 解除当前工单
|
||||||
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||||
wp.save()
|
wp.save()
|
||||||
# 更新子计划合格进度
|
|
||||||
WpmServies.update_subproduction_progress_main(sp=sp)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise exceptions.APIException('返回步骤点错误')
|
raise exceptions.APIException('返回步骤点错误')
|
||||||
|
|
||||||
|
|
@ -82,18 +80,8 @@ def handleTicket(sender, instance, created, **kwargs):
|
||||||
wp.ticket = None # 解除当前工单
|
wp.ticket = None # 解除当前工单
|
||||||
wp.save()
|
wp.save()
|
||||||
|
|
||||||
|
# 添加日志
|
||||||
@receiver(post_save, sender=WProduct)
|
WpmServies.add_wproduct_flow_log(wp, 'ticket_finish')
|
||||||
def update_wproduct_log(sender, instance, created, **kwargs):
|
# 更新子计划合格进度
|
||||||
"""
|
WpmServies.update_subproduction_progress_main(sp=wp.subproduction_plan)
|
||||||
创建产品变动日志
|
|
||||||
"""
|
|
||||||
# update_fields = kwargs['update_fields']
|
|
||||||
WproductFlow.objects.filter(wproduct=instance, subproduction_plan=instance.subproduction_plan).update(is_lastlog=False)
|
|
||||||
ins = WproductFlow()
|
|
||||||
ins.wproduct = instance
|
|
||||||
for f in WproductFlow._meta.fields:
|
|
||||||
if f.name not in ['id', 'create_time', 'update_time', 'wproduct', 'is_lastlog']:
|
|
||||||
setattr(ins, f.name, getattr(instance, f.name, None))
|
|
||||||
ins.save()
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,23 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
||||||
wps.update(step=first_step,
|
wps.update(step=first_step,
|
||||||
act_state=WProduct.WPR_ACT_STATE_TORETEST, is_hidden=False, warehouse=None,
|
act_state=WProduct.WPR_ACT_STATE_TORETEST, is_hidden=False, warehouse=None,
|
||||||
subproduction_plan=sp, update_by=request.user, update_time=timezone.now())
|
subproduction_plan=sp, update_by=request.user, update_time=timezone.now())
|
||||||
for i in wps:
|
|
||||||
|
for m in i['wproducts']:
|
||||||
|
m.step = first_step
|
||||||
|
m.act_state = WProduct.WPR_ACT_STATE_TORETEST
|
||||||
|
m.is_hidden = False
|
||||||
|
m.warehouse = None
|
||||||
|
m.subproduction_plan = sp
|
||||||
|
m.update_by = request.user
|
||||||
|
m.update_time = timezone.now()
|
||||||
|
m.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(instance=m, change_str='pick_half')
|
||||||
pw = PickWproduct()
|
pw = PickWproduct()
|
||||||
pw.pick =pick
|
pw.pick =pick
|
||||||
pw.wproduct = i
|
pw.wproduct = m
|
||||||
pw.number = i.number
|
pw.number = m.number
|
||||||
pw.material = i.material
|
pw.material = m.material
|
||||||
pw.subproduction_plan = i.suproduction_plan
|
pw.subproduction_plan = m.subproduction_plan
|
||||||
pw.save()
|
pw.save()
|
||||||
sp.is_picked = True
|
sp.is_picked = True
|
||||||
sp.save()
|
sp.save()
|
||||||
|
|
@ -95,63 +105,63 @@ class WPlanViewSet(ListModelMixin, GenericViewSet):
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=WplanPutInSerializer)
|
# @action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=WplanPutInSerializer)
|
||||||
@transaction.atomic
|
# @transaction.atomic
|
||||||
def putin(self, request, pk=None):
|
# def putin(self, request, pk=None):
|
||||||
"""
|
# """
|
||||||
半成品入库
|
# 半成品入库
|
||||||
"""
|
# """
|
||||||
serializer= WplanPutInSerializer(data=request.data)
|
# serializer= WplanPutInSerializer(data=request.data)
|
||||||
serializer.is_valid(raise_exception=True)
|
# serializer.is_valid(raise_exception=True)
|
||||||
vdata = serializer.validated_data
|
# vdata = serializer.validated_data
|
||||||
subplan = self.get_object()
|
# subplan = self.get_object()
|
||||||
material = subplan.product
|
# material = subplan.product
|
||||||
batch = subplan.number
|
# batch = subplan.number
|
||||||
warehouse = vdata['warehouse']
|
# warehouse = vdata['warehouse']
|
||||||
wproducts = WProduct.objects.filter(subproduction_plan=subplan,
|
# wproducts = WProduct.objects.filter(subproduction_plan=subplan,
|
||||||
act_state=WProduct.WPR_ACT_STATE_OK, material=material, is_deleted=False)
|
# act_state=WProduct.WPR_ACT_STATE_OK, material=material, is_deleted=False)
|
||||||
if wproducts.exists():
|
# if wproducts.exists():
|
||||||
# 创建入库记录
|
# # 创建入库记录
|
||||||
remark = vdata.get('remark', '')
|
# remark = vdata.get('remark', '')
|
||||||
fifo = FIFO.objects.create(type=FIFO.FIFO_TYPE_DO_IN,
|
# fifo = FIFO.objects.create(type=FIFO.FIFO_TYPE_DO_IN,
|
||||||
is_audited=True, auditor=request.user, inout_date=timezone.now(), create_by=request.user, remark=remark)
|
# is_audited=True, auditor=request.user, inout_date=timezone.now(), create_by=request.user, remark=remark)
|
||||||
# 创建入库明细
|
# # 创建入库明细
|
||||||
fifoitem = FIFOItem()
|
# fifoitem = FIFOItem()
|
||||||
fifoitem.is_tested = True
|
# fifoitem.is_tested = True
|
||||||
fifoitem.is_testok = True
|
# fifoitem.is_testok = True
|
||||||
fifoitem.warehouse = warehouse
|
# fifoitem.warehouse = warehouse
|
||||||
fifoitem.material = material
|
# fifoitem.material = material
|
||||||
fifoitem.count = wproducts.count()
|
# fifoitem.count = wproducts.count()
|
||||||
fifoitem.batch = batch
|
# fifoitem.batch = batch
|
||||||
fifoitem.fifo = fifo
|
# fifoitem.fifo = fifo
|
||||||
fifoitem.subproduction_plan = subplan
|
# fifoitem.subproduction_plan = subplan
|
||||||
fifoitem.save()
|
# fifoitem.save()
|
||||||
# 创建入库明细半成品
|
# # 创建入库明细半成品
|
||||||
ips = []
|
# ips = []
|
||||||
for i in wproducts:
|
# for i in wproducts:
|
||||||
ip = {}
|
# ip = {}
|
||||||
ip['fifoitem'] = fifoitem
|
# ip['fifoitem'] = fifoitem
|
||||||
ip['wproduct'] = i
|
# ip['wproduct'] = i
|
||||||
ip['number'] = i.number
|
# ip['number'] = i.number
|
||||||
ip['material'] = material
|
# ip['material'] = material
|
||||||
ips.append(FIFOItemProduct(**ip))
|
# ips.append(FIFOItemProduct(**ip))
|
||||||
FIFOItemProduct.objects.bulk_create(ips)
|
# FIFOItemProduct.objects.bulk_create(ips)
|
||||||
# 创建IProduct
|
# # 创建IProduct
|
||||||
ips2 = []
|
# ips2 = []
|
||||||
for i in wproducts:
|
# for i in wproducts:
|
||||||
ip = {}
|
# ip = {}
|
||||||
ip['warehouse'] = warehouse
|
# ip['warehouse'] = warehouse
|
||||||
ip['batch'] = batch
|
# ip['batch'] = batch
|
||||||
ip['wproduct'] = i
|
# ip['wproduct'] = i
|
||||||
ip['number'] = i.number
|
# ip['number'] = i.number
|
||||||
ip['material'] = material
|
# ip['material'] = material
|
||||||
ips2.append(IProduct(**ip))
|
# ips2.append(IProduct(**ip))
|
||||||
IProduct.objects.bulk_create(ips2)
|
# IProduct.objects.bulk_create(ips2)
|
||||||
# 更新库存并修改半成品进行状态
|
# # 更新库存并修改半成品进行状态
|
||||||
update_inm(fifo)
|
# update_inm(fifo)
|
||||||
wproducts.update(act_sate=WProduct.WPR_ACT_STATE_INM, warehouse=warehouse, update_by=request.user, update_time=timezone.now())
|
# wproducts.update(act_sate=WProduct.WPR_ACT_STATE_INM, warehouse=warehouse, update_by=request.user, update_time=timezone.now())
|
||||||
|
|
||||||
return Response()
|
# return Response()
|
||||||
|
|
||||||
|
|
||||||
class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
|
class WMaterialViewSet(CreateUpdateModelAMixin, ListModelMixin, GenericViewSet):
|
||||||
|
|
@ -232,10 +242,12 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
||||||
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOCOMBTEST:
|
elif wproduct.act_state == WProduct.WPR_ACT_STATE_TOCOMBTEST:
|
||||||
savedict['type'] = TestRecord.TEST_COMB
|
savedict['type'] = TestRecord.TEST_COMB
|
||||||
tr = TestRecord.objects.create(**savedict)
|
tr = TestRecord.objects.create(**savedict)
|
||||||
|
# 更新wproduct
|
||||||
wproduct.test = tr
|
wproduct.test = tr
|
||||||
wproduct.update_by = request.user
|
wproduct.update_by = request.user
|
||||||
wproduct.update_time = timezone.now()
|
wproduct.update_time = timezone.now()
|
||||||
wproduct.save()
|
wproduct.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(wproduct, 'test_init')
|
||||||
# 创建检验条目
|
# 创建检验条目
|
||||||
for i in RecordFormField.objects.filter(form=form, is_deleted=False):
|
for i in RecordFormField.objects.filter(form=form, is_deleted=False):
|
||||||
tri = TestRecordItem()
|
tri = TestRecordItem()
|
||||||
|
|
@ -298,6 +310,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
||||||
i.update_by = request.user
|
i.update_by = request.user
|
||||||
i.update_time = timezone.now()
|
i.update_time = timezone.now()
|
||||||
i.save()
|
i.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(i, 'putins')
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=WproductPutInSerializer)
|
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=WproductPutInSerializer)
|
||||||
|
|
@ -345,6 +358,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
||||||
wproduct.act_state=WProduct.WPR_ACT_STATE_INM
|
wproduct.act_state=WProduct.WPR_ACT_STATE_INM
|
||||||
wproduct.warehouse=warehouse
|
wproduct.warehouse=warehouse
|
||||||
wproduct.save()
|
wproduct.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(wproduct, 'putin')
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=ScrapSerializer)
|
@action(methods=['post'], detail=True, perms_map={'post':'*'}, serializer_class=ScrapSerializer)
|
||||||
|
|
@ -370,6 +384,7 @@ class WProductViewSet(ListModelMixin, GenericViewSet):
|
||||||
obj.update_by = request.user
|
obj.update_by = request.user
|
||||||
obj.update_time = timezone.now()
|
obj.update_time = timezone.now()
|
||||||
obj.save()
|
obj.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(obj, 'scrap')
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
# @action(methods=['get'], detail=False, perms_map={'get':'*'})
|
# @action(methods=['get'], detail=False, perms_map={'get':'*'})
|
||||||
|
|
@ -445,7 +460,11 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
if instance.is_submited:
|
if instance.is_submited:
|
||||||
raise exceptions.APIException('该操作已提交')
|
raise exceptions.APIException('该操作已提交')
|
||||||
# 恢复半成品可操作
|
# 恢复半成品可操作
|
||||||
instance.wp_operation.all().update(act_state=WProduct.WPR_ACT_STATE_DOWAIT)
|
for i in instance.wp_operation.all():
|
||||||
|
i.act_state = WProduct.WPR_ACT_STATE_DOWAIT
|
||||||
|
i.update_by = request.user
|
||||||
|
i.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(i, 'operation_delete')
|
||||||
self.perform_destroy(instance)
|
self.perform_destroy(instance)
|
||||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
|
|
@ -465,9 +484,13 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
# 创建操作所用半成品关联记录
|
# 创建操作所用半成品关联记录
|
||||||
if 'wproducts' in vdata:
|
if 'wproducts' in vdata:
|
||||||
owps = []
|
owps = []
|
||||||
WProduct.objects.filter(pk__in=[x.id for x in vdata['wproducts']]).update(operation=op, act_state=WProduct.WPR_ACT_STATE_DOING)
|
|
||||||
splans = WpmServies.get_subplans_queryset_from_wproducts(vdata['wproducts'])
|
splans = WpmServies.get_subplans_queryset_from_wproducts(vdata['wproducts'])
|
||||||
for wpd in vdata['wproducts']:
|
for wpd in vdata['wproducts']:
|
||||||
|
wpd.operation= op
|
||||||
|
wpd.act_state = WProduct.WPR_ACT_STATE_DOING
|
||||||
|
wpd.update_by = request.user
|
||||||
|
wpd.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(wpd, 'operation_create')
|
||||||
owp = {}
|
owp = {}
|
||||||
owp['operation'] = op
|
owp['operation'] = op
|
||||||
owp['wproduct'] = wpd
|
owp['wproduct'] = wpd
|
||||||
|
|
@ -565,6 +588,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
wp.operation = None
|
wp.operation = None
|
||||||
wp.update_by = request.user
|
wp.update_by = request.user
|
||||||
wp.save()
|
wp.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(wp, 'operation_submit')
|
||||||
elif step.type == Step.STEP_TYPE_DIV:
|
elif step.type == Step.STEP_TYPE_DIV:
|
||||||
# 更新物料产出情况
|
# 更新物料产出情况
|
||||||
for i in OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT):
|
for i in OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT):
|
||||||
|
|
@ -572,9 +596,12 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
newstep, _ = WpmServies.get_next_step(i.subproduction_plan, step)
|
newstep, _ = WpmServies.get_next_step(i.subproduction_plan, step)
|
||||||
wpr = dict(material=i.material, step=newstep,
|
wpr = dict(material=i.material, step=newstep,
|
||||||
act_state=WProduct.WPR_ACT_STATE_DOWAIT, remark='',
|
act_state=WProduct.WPR_ACT_STATE_DOWAIT, remark='',
|
||||||
subproduction_plan=i.subproduction_plan)
|
subproduction_plan=i.subproduction_plan, create_by=request.user)
|
||||||
for x in range(i.count):
|
for x in range(i.count):
|
||||||
WProduct.objects.create(**wpr)
|
ins = WProduct.objects.create(**wpr)
|
||||||
|
# 添加日志
|
||||||
|
WpmServies.add_wproduct_flow_log(ins, 'operation_submit')
|
||||||
|
# 更新进度
|
||||||
WpmServies.update_subproduction_progress_main(sp=i.subproduction_plan)
|
WpmServies.update_subproduction_progress_main(sp=i.subproduction_plan)
|
||||||
elif step.type == Step.STEP_TYPE_COMB:
|
elif step.type == Step.STEP_TYPE_COMB:
|
||||||
oms_w = OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT,
|
oms_w = OperationMaterial.objects.filter(operation=op, type=SubprodctionMaterial.SUB_MA_TYPE_OUT,
|
||||||
|
|
@ -595,6 +622,7 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
|
||||||
WpmServies.update_subproduction_progress_main(sp=oms_w.subproduction_plan)
|
WpmServies.update_subproduction_progress_main(sp=oms_w.subproduction_plan)
|
||||||
wproduct.create_by = request.user
|
wproduct.create_by = request.user
|
||||||
wproduct.save()
|
wproduct.save()
|
||||||
|
WpmServies.add_wproduct_flow_log(wproduct, 'operation_submit')
|
||||||
# 隐藏原半成品
|
# 隐藏原半成品
|
||||||
wps = WProduct.objects.filter(ow_wproduct__operation = op)
|
wps = WProduct.objects.filter(ow_wproduct__operation = op)
|
||||||
wps.update(is_hidden=True, child=wproduct, update_by=request.user, update_time=timezone.now())
|
wps.update(is_hidden=True, child=wproduct, update_by=request.user, update_time=timezone.now())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue