diff --git a/hb_client/README-zh.md b/hb_client/README-zh.md index d248632..9701f92 100644 --- a/hb_client/README-zh.md +++ b/hb_client/README-zh.md @@ -1,6 +1,6 @@ # vue-admin-template -> 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。 +> 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & & iconfont & permission control & lint,这些搭建后台必要的东西。 [线上地址](http://panjiachen.github.io/vue-admin-template) diff --git a/hb_client/src/api/cms.js b/hb_client/src/api/cms.js new file mode 100644 index 0000000..ef35a86 --- /dev/null +++ b/hb_client/src/api/cms.js @@ -0,0 +1,38 @@ +import request from '@/utils/request' +//获取文章列表 +export function getArticles(data) { + return request({ + url: '/cms/article/', + method: 'get', + params: data + }) +} +//获取某个文章 +export function getArticle(id) { + return request({ + url: `/cms/article/${id}/`, + method: 'get', + }) +} +//新增文章 +export function createArticle(data) { + return request({ + url: '/cms/article/', + method: 'post', + data + }) +} +// +export function updateArticle(id,data) { + return request({ + url: `/cms/article/${id}/`, + method: 'put', + data + }) +} +export function deleteArticle(id) { + return request({ + url: `/cms/article/${id}/`, + method: 'delete' + }) +} diff --git a/hb_client/src/api/srm.js b/hb_client/src/api/srm.js index ea364db..83aed02 100644 --- a/hb_client/src/api/srm.js +++ b/hb_client/src/api/srm.js @@ -7,6 +7,14 @@ export function getPlanGantt(data) { params: data }) } +//计划数量统计 +export function planCount(data) { + return request({ + url: '/srm/plan/count/', + method: 'post', + data + }) +} //合格率 export function getProcessYield(data) { return request({ @@ -15,6 +23,14 @@ export function getProcessYield(data) { data }) } +//工序当前进度 +export function getProcessNow(data) { + return request({ + url: '/srm/process/now/', + method: 'post', + data + }) +} //到岗统计 export function getatwork(data) { return request({ @@ -24,3 +40,20 @@ export function getatwork(data) { }) } +//产品数量统计 +export function productCount(data) { + return request({ + url: '/srm/product/count/', + method: 'post', + data + }) +} +//订单数量统计 +export function orderCount(data) { + return request({ + url: '/srm/order/count/', + method: 'post', + data + }) +} + diff --git a/hb_client/src/router/index.js b/hb_client/src/router/index.js index 7a25709..1b9cb25 100644 --- a/hb_client/src/router/index.js +++ b/hb_client/src/router/index.js @@ -1,7 +1,7 @@ import Vue from 'vue' import Router from 'vue-router' -Vue.use(Router) +Vue.use(Router); /* Layout */ import Layout from '@/layout' @@ -608,6 +608,21 @@ export const asyncRoutes = [ }, ] }, + { + path: '/cms', + component: Layout, + redirect: '/cms/article', + name: '企业资讯', + meta: { title: '', icon: 'home', perms: ['cms_manage'] }, + children: [ + { + path: 'article', + name: 'article', + component: () => import('@/views/cms/article'), + meta: { title: '新闻资讯', icon: 'home', perms: ['article'] } + }, + ] + }, { path: '/system', component: Layout, diff --git a/hb_client/src/views/bigScreen/bottomRight.vue b/hb_client/src/views/bigScreen/bottomRight.vue index 51989cd..6481401 100644 --- a/hb_client/src/views/bigScreen/bottomRight.vue +++ b/hb_client/src/views/bigScreen/bottomRight.vue @@ -6,7 +6,7 @@
- 企业咨询 + 企业资讯
@@ -14,7 +14,10 @@
- +
@@ -26,7 +29,7 @@ export default { data () { return { cdata:{}, - config: { + /* config: { header: ['消息', '发布时间'], data: [ ['张思', '2022-03-05'], @@ -53,7 +56,7 @@ export default { index: false, // columnWidth: [50], align: ['center'] - } + }*/ } }, watch: { @@ -87,6 +90,14 @@ export default { deep: true } }, + props:{ + configArticle:{ + type:Object, + default:()=>{ + return {} + } + } + }, mounted () { this.drawTimingFn(); }, @@ -101,39 +112,7 @@ export default { }, 3600000); }, setData () { - this.config = { - header: ['消息', '发布时间'], - data: [ - ['张思', '2022-03-05'], - ['李森', '2022-03-05'], - ['王师', '2022-03-05'], - ['赵迪', '2022-03-05'], - ['孟津', '2022-03-05'], - ['张思', '2022-03-05'], - ['李森', '2022-03-05'], - ['王师', '2022-03-05'], - ['赵迪', '2022-03-05'], - ['孟津', '2022-03-05'], - ['孙东课', '2022-03-05'], - ['周神秘', '2022-03-05'], - ['吴老弟', '2022-03-05'], - ['郑成功', '2022-03-05'], - ['冯宝宝', '2022-03-05'], - ['孙东课', '2022-03-05'], - ['周神秘', '2022-03-05'], - ['吴老弟', '2022-03-05'], - ['郑成功', '2022-03-05'], - ['冯宝宝', '2022-03-05'] - ], - rowNum: 15, //表格行数 - headerHeight: 35, - headerBGC: '#0f1325', //表头 - oddRowBGC: '#0f1325', //奇数行 - evenRowBGC: '#171c33', //偶数行 - index: false, - // columnWidth: [50], - align: ['center'] - } + this.config = this.configArticle; } } }; diff --git a/hb_client/src/views/bigScreen/centerLeft1.vue b/hb_client/src/views/bigScreen/centerLeft1.vue index 98ba8f4..9b84107 100644 --- a/hb_client/src/views/bigScreen/centerLeft1.vue +++ b/hb_client/src/views/bigScreen/centerLeft1.vue @@ -21,9 +21,9 @@
@@ -45,63 +45,12 @@ data() { return { options: {}, - numberData: [ - { - number: { - number: [15], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '今日产量' - }, - { - number: { - number: [1144], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '年累计完成量' - }, - { - number: { - number: [361], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '在制品数量' - }, - { - number: { - number: [361], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '不合格数量' - }, - - ], cdata: { xData: ["冷加工", "热弯", "化学钢化"], seriesData: [ {value: 25, name: "冷加工"}, {value: 20, name: "热弯"}, - {value: 35, name: "化学钢化"} + {value: 30, name: "化学钢化"} ] } } @@ -109,6 +58,14 @@ components: { Echart }, + props:{ + numberData:{ + type:Array, + default:()=>{ + return [] + } + } + }, mounted() { this.changeTiming() }, @@ -166,8 +123,12 @@ }, 3000) }, changeNumber() { - this.numberData.forEach((item, index) => { - item.number.number[0] += ++index + this.numberData.forEach((item) => { + /*item.number.number[0] += ++index + item.number = {...item.number}*/ + let num = 0; + item.number.number[0] = 0; + item.number.number[0] = num; item.number = {...item.number} }) } diff --git a/hb_client/src/views/bigScreen/centerLeft2.vue b/hb_client/src/views/bigScreen/centerLeft2.vue index 76caa5b..1d75039 100644 --- a/hb_client/src/views/bigScreen/centerLeft2.vue +++ b/hb_client/src/views/bigScreen/centerLeft2.vue @@ -21,9 +21,9 @@
@@ -45,63 +45,13 @@ data() { return { options: {}, - numberData: [ - { - number: { - number: [15], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '今日产量' - }, - { - number: { - number: [1144], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '年累计完成量' - }, - { - number: { - number: [361], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '在制品数量' - }, - { - number: { - number: [361], - toFixed: 1, - textAlign: 'left', - content: '{nt}', - style: { - fontSize: 24 - } - }, - text: '不合格数量' - }, - ], cdata: { xData: ["镀膜", "夹层", "包边", "装框"], seriesData: [ {value: 10, name: "镀膜"}, - {value: 5, name: "夹层"}, + {value: 13, name: "夹层"}, {value: 15, name: "包边"}, - {value: 25, name: "装框"} + {value: 20, name: "装框"} ] } } @@ -109,6 +59,14 @@ components: { Echart }, + props:{ + numberDataTwo:{ + type:Array, + default:()=>{ + return [] + } + } + }, mounted() { this.changeTiming() }, @@ -164,8 +122,10 @@ }, 3000) }, changeNumber() { - this.numberData.forEach((item, index) => { - item.number.number[0] += ++index + this.numberDataTwo.forEach((item) => { + let num = 0; + item.number.number[0] = 0; + item.number.number[0] = num; item.number = {...item.number} }) } diff --git a/hb_client/src/views/bigScreen/index.vue b/hb_client/src/views/bigScreen/index.vue index b9b7fbb..929ab43 100644 --- a/hb_client/src/views/bigScreen/index.vue +++ b/hb_client/src/views/bigScreen/index.vue @@ -50,45 +50,61 @@
-
+
-
+ +
+
- +
+
- +
- -
- + +
+ - +
- - + + - +
@@ -110,8 +126,9 @@ import bottomRight from './bottomRight' import {getPlanGantt} from "@/api/srm"; import {getProductionplanList} from "@/api/pm"; - import {getProcessYield} from "@/api/srm"; + import {getProcessYield,productCount,getProcessNow,planCount,orderCount} from "@/api/srm"; import {getContractList, getOrderList} from "@/api/sam"; + import {getArticles} from "@/api/cms"; export default { mixins: [drawMixin], @@ -236,7 +253,7 @@ unit: '%' }, water: { - data: [24, 45], + data: [45, 90], shape: 'roundRect', formatter: '{value}%', waveNum: 3 @@ -277,18 +294,9 @@ }, //人员到岗 userConfig: { - header: ['姓名', '部门', '到岗情况'], + header: ['姓名', '到岗情况'], data: [ - ['张思', '一车间', "已到岗"], - ['李森', '一车间', "已到岗"], - ['王师', '一车间', "未到岗"], - ['赵迪', '一车间', "已到岗"], - ['孟津', '一车间', "已到岗"], - ['孙东课', '一车间', "已到岗"], - ['周神秘', '二车间', "已到岗"], - ['吴老弟', '二车间', "未到岗"], - ['郑成功', '二车间', "已到岗"], - ['冯宝宝', '二车间', "已到岗"] + ['冯宝宝', "已到岗"] ], rowNum: 7, //表格行数 headerHeight: 35, @@ -296,6 +304,127 @@ oddRowBGC: '#0f1325', //奇数行 evenRowBGC: '#171c33', //偶数行 index: false, + columnWidth: [70], + align: ['center'] + }, + //车间一 + numberData: [ + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '今日产量' + }, + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '年累计完成量' + }, + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '在制品数量' + }, + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '不合格数量' + }, + + ], + limitedOne:false, + //车间二 + numberDataTwo: [ + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '今日产量' + }, + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '年累计完成量' + }, + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '在制品数量' + }, + { + number: { + number: [0], + toFixed: 0, + textAlign: 'left', + content: '{nt}', + style: { + fontSize: 24 + } + }, + text: '不合格数量' + }, + + ], + limitedTwo:false, + configArticle: { + header: ['标题','置顶','作者', '发布时间'], + data: [ + ['郑成功', '2022-03-05'], + ['冯宝宝', '2022-03-05'] + ], + rowNum: 15, //表格行数 + headerHeight: 40, + headerBGC: '#0f1325', //表头 + oddRowBGC: '#0f1325', //奇数行 + evenRowBGC: '#171c33', //偶数行 + index: false, // columnWidth: [50], align: ['center'] }, @@ -336,6 +465,9 @@ that.getCenterData(); that.getCenterRight2Data(); that.getUserList(); + that.getOneData();//车间一 + that.getTwoData();//车间二 + that.getArticle(); }, beforeDestroy() { clearInterval(this.timing) @@ -365,9 +497,12 @@ }, getCenterData() { let that = this; + let dat = new Date(); + let Year = dat.getFullYear(); + let month = dat.getMonth() + 1; + let searchTime = Year + '-' + month + '-01'; that.numberShow = false; - //合同 - getContractList({ + getContractList({ //合同 type: 'big_screen', page: 1, page_size: 1, @@ -380,13 +515,47 @@ page: 1, page_size: 1, create_time_start: that.create_time_start - }).then((response) => { - if (response.data) { - that.titleItem[1].number.number[0] = response.data.count; - getProductionplanList({type: 'big_screen', page: 1, page_size: 1, tag: 'working'}).then((response) => { - if (response.data) { - that.titleItem[2].number.number[0] = response.data.count; - that.numberShow = true; + }).then((respons) => {//订单 + if (respons.data) { + that.titleItem[1].number.number[0] = respons.data.count; + getProductionplanList({type: 'big_screen', page: 1, page_size: 1, tag: 'working'}).then((respon) => { + if (respon.data) { + that.titleItem[2].number.number[0] = respon.data.count; + productCount({type: 'big_screen',datetime_start:searchTime,tag:1}).then(respo=>{ + if (respo.data) { + that.titleItem[3].number.number[0] = respo.data.count_selled; + that.titleItem[4].number.number[0] = respo.data.count_notok; + let mtestCount = respo.data.count_mtestok + respo.data.count_mtestnotok; + that.titleItem[5].number.number[0] = Math.floor((respo.data.count_mtestok/mtestCount)*100); + that.rate[0].tips = Math.floor((respo.data.count_ok/respo.data.count)*100); + getProcessNow({type: 'big_screen'}).then(res=>{//工序生产进度 + if (res.data) { + let list = res.data; + let data = []; + list.forEach(item => { + let obj = new Object(); + obj.name = item.process__name; + let value = Math.floor(item.count/item.count_real * 100); + obj.value = value>100?100:value; + data.push(obj) + }); + that.ranking.data = data; + //任务完成率 + /* planCount({type: 'big_screen'}).then(res=>{ + debugger; + })*/ + //准时交付率 + /*getOrderList({type: 'big_screen',page: 1, page_size: that.warningPageSize, tag: 'near_delivery'}).then((response) => { + if (response.data) { + that.warningList = response.data.results; + that.warningTotal = response.data.count; + } + });*/ + that.numberShow = true; + } + }) + } + }); } }); } @@ -418,6 +587,52 @@ } }); }, + //一车间 + getOneData(){ + let that = this; + that.limitedOne = false; + let dat = new Date(); + let Year = dat.getFullYear(); + let month = dat.getMonth() + 1; + let searchTime = Year + '-' + month + '-01'; + let searchYear = Year + '-' + '01-01'; + productCount({type: 'big_screen',datetime_start:searchTime,tag:2,dept:1}).then(response=>{ + if (response.data) { + that.numberData[0].number.number[0] = response.data.count; + that.numberData[2].number.number[0] = response.data.count_doing; + that.numberData[3].number.number[0] = response.data.count_notok; + productCount({type: 'big_screen',datetime_start:searchYear,tag:2,dept:1}).then(res=>{ + if (res.data) { + that.numberData[1].number.number[0] = res.data.count; + that.limitedOne = true; + } + }); + } + }); + }, + //二车间 + getTwoData(){ + let that = this; + that.limitedTwo = false; + let dat = new Date(); + let Year = dat.getFullYear(); + let month = dat.getMonth() + 1; + let searchTime = Year + '-' + month + '-01'; + let searchYear = Year + '-' + '01-01'; + productCount({type: 'big_screen',datetime_start:searchTime,tag:2,dept:2}).then(response=>{ + if (response.data) { + that.numberDataTwo[0].number.number[0] = response.data.count; + that.numberDataTwo[2].number.number[0] = response.data.count_doing; + that.numberDataTwo[3].number.number[0] = response.data.count_notok; + productCount({type: 'big_screen',datetime_start:searchYear,tag:2,dept:2}).then(res=>{ + if (res.data) { + that.numberDataTwo[1].number.number[0] = res.data.count; + that.limitedTwo = true; + } + }); + } + }); + }, //人员到岗情况列表 getUserList() { let that = this; @@ -429,7 +644,7 @@ list.forEach(item => { let obj = []; obj.push(item.name); - obj.push(item.dept_.name); + // obj.push(item.dept_.name); if (item.is_atwork) { obj.push("已到岗") } else { @@ -442,6 +657,32 @@ } }); }, + //企业资讯 + getArticle(){ + let that = this; + getArticles({type: 'big_screen',page:0}).then((response) => { + if (response.data) { + // this.configArticle = response.data; + let list = response.data; + let data=[]; + list.forEach(item => { + let obj = []; + obj.push(item.title); + if(item.is_top===false){ + obj.push('未置顶'); + }else{ + obj.push('已置顶'); + } + obj.push(item.author); + obj.push(item.create_time); + data.push(obj) + }); + that.configArticle.data=data; + } + }); + }, + + //任务完成进度 } } diff --git a/hb_client/src/views/cms/article.vue b/hb_client/src/views/cms/article.vue new file mode 100644 index 0000000..4aee150 --- /dev/null +++ b/hb_client/src/views/cms/article.vue @@ -0,0 +1,269 @@ + + + diff --git a/hb_client/src/views/dashboard/index.vue b/hb_client/src/views/dashboard/index.vue index 9103f1c..f5ace61 100644 --- a/hb_client/src/views/dashboard/index.vue +++ b/hb_client/src/views/dashboard/index.vue @@ -55,7 +55,7 @@
本月交付产品
- 30 + {{selledTotalCurrent}}
@@ -67,7 +67,7 @@
本月不合格产品
- 30 + {{notokTotalCurrent}}
@@ -337,7 +337,7 @@ import {getmaterialbatchList} from "@/api/inm"; import gantt from "@/components/Gantt/dashGantt"; import {getpEquipmentList} from "@/api/equipment"; - import {getProcessYield, getPlanGantt} from "@/api/srm"; + import {getProcessYield, getPlanGantt,productCount} from "@/api/srm"; import {getContractList, getOrderList} from "@/api/sam"; import {getToken} from '@/utils/auth' // get token from cookie export default { @@ -408,8 +408,8 @@ orderTotalCurrent: null, planTotalCount: null,//已排产任务总数 planTotalCurrent: null, - rderTotalCount: null,//累计交付产品总数 - derTotalCount: null,//累计不合格产品总数 + selledTotalCurrent: null,//累计交付产品总数 + notokTotalCurrent: null,//累计不合格产品总数 listLoadingPlan: false, listLoadingEm: false, listLoadingUser: false, @@ -490,22 +490,12 @@ that.currentDay = dat.getDate(); let create_time_start = that.currentYear + '-' + that.currentMonth + '-01'; //获取合同数 - getContractList({page: 1, page_size: 1}).then((response) => { - if (response.data) { - that.contractTotalCount = response.data.count; - } - }); getContractList({page: 1, page_size: 1, create_time_start: create_time_start}).then((response) => { if (response.data) { that.contractTotalCurrent = response.data.count; } }); //获取生产订单数 - getOrderList({page: 1, page_size: 1}).then((response) => { - if (response.data) { - that.orderTotalCount = response.data.count; - } - }); getOrderList({page: 1, page_size: 1, create_time_start: create_time_start}).then((response) => { if (response.data) { that.orderTotalCurrent = response.data.count; @@ -517,13 +507,19 @@ that.planTotalCount = response.data.count; } }); + //本月在制任务 getProductionplanList({page: 1, page_size: 1, tag: 'working'}).then((response) => { if (response.data) { that.planTotalCurrent = response.data.count; } }); - //获取交付产品 - + //本月交付产品&本月不合格产品 + productCount({datetime_start:create_time_start,tag:1}).then(respo=>{ + if (respo.data) { + that.selledTotalCurrent = respo.data.count_selled; + that.notokTotalCurrent = respo.data.count_notok; + } + }); //获取不合格产品 //获取成品率 diff --git a/hb_server/apps/cms/views.py b/hb_server/apps/cms/views.py index 0d918e9..f1ebf9a 100644 --- a/hb_server/apps/cms/views.py +++ b/hb_server/apps/cms/views.py @@ -16,7 +16,7 @@ class ArticleViewSet(CreateUpdateModelAMixin, ModelViewSet): filterset_fields = ['is_top', 'is_published'] serializer_class = ArticleListSerializer search_fields = ['title', 'author'] - ordering = ['is_published', 'is_top', 'update_time'] + ordering = ['-is_published', '-is_top', '-update_time'] def get_serializer_class(self): if self.action in ['create', 'update']: diff --git a/hb_server/apps/hrm/filters.py b/hb_server/apps/hrm/filters.py index 0fd0be5..185a846 100644 --- a/hb_server/apps/hrm/filters.py +++ b/hb_server/apps/hrm/filters.py @@ -21,7 +21,7 @@ class EmployeeFilterSet(DynamicFieldsFilterMixin, filters.FilterSet): class Meta: model = Employee - fields = ['job_state'] + fields = ['job_state', 'show_atwork'] class NotWorkRemarkFilterSet(filters.FilterSet): diff --git a/hb_server/apps/hrm/migrations/0009_employee_show_atwork.py b/hb_server/apps/hrm/migrations/0009_employee_show_atwork.py new file mode 100644 index 0000000..83650ec --- /dev/null +++ b/hb_server/apps/hrm/migrations/0009_employee_show_atwork.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.9 on 2022-03-17 03:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('hrm', '0008_auto_20220222_1112'), + ] + + operations = [ + migrations.AddField( + model_name='employee', + name='show_atwork', + field=models.BooleanField(default=True, verbose_name='是否展示在岗状态'), + ), + ] diff --git a/hb_server/apps/hrm/models.py b/hb_server/apps/hrm/models.py index 091c2b1..b9482fe 100644 --- a/hb_server/apps/hrm/models.py +++ b/hb_server/apps/hrm/models.py @@ -31,8 +31,10 @@ class Employee(CommonAModel): job_state = models.IntegerField('在职状态', choices=jobstate_choices, default=1) face_data = models.JSONField('人脸识别数据', null=True, blank=True) is_atwork = models.BooleanField('当前在岗', default=False) + show_atwork = models.BooleanField('是否展示在岗状态', default=True) last_check_time = models.DateTimeField('打卡时间', null=True, blank=True) not_work_remark = models.CharField('当前未打卡说明', null=True, blank=True, max_length=200) + class Meta: verbose_name = '员工补充信息' verbose_name_plural = verbose_name diff --git a/hb_server/apps/sam/migrations/0017_contract_watch_num.py b/hb_server/apps/sam/migrations/0017_contract_watch_num.py new file mode 100644 index 0000000..906b4fe --- /dev/null +++ b/hb_server/apps/sam/migrations/0017_contract_watch_num.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.9 on 2022-03-17 03:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sam', '0016_sale_iproducts'), + ] + + operations = [ + migrations.AddField( + model_name='contract', + name='watch_num', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='监管协议号'), + ), + ] diff --git a/hb_server/apps/sam/models.py b/hb_server/apps/sam/models.py index 12ef0a8..26581aa 100644 --- a/hb_server/apps/sam/models.py +++ b/hb_server/apps/sam/models.py @@ -39,7 +39,7 @@ class Contract(CommonAModel): customer = models.ForeignKey(Customer, verbose_name='关联客户', on_delete=models.CASCADE, related_name='contact_customer') sign_date = models.DateField('签订日期') description = models.CharField('描述', max_length=200, blank=True, null=True) - + watch_num = models.CharField('监管协议号', max_length=100, null=True, blank=True) class Meta: verbose_name = '合同信息' verbose_name_plural = verbose_name diff --git a/hb_server/apps/sam/serializers.py b/hb_server/apps/sam/serializers.py index 8b3df60..31d2ab0 100644 --- a/hb_server/apps/sam/serializers.py +++ b/hb_server/apps/sam/serializers.py @@ -32,12 +32,12 @@ class ContractSerializer(serializers.ModelSerializer): class ContractSimpleSerializer(serializers.ModelSerializer): class Meta: model = Contract - fields = ['id', 'name', 'number'] + fields = ['id', 'name', 'number', 'watch_num'] class ContractCreateUpdateSerializer(serializers.ModelSerializer): class Meta: model = Contract - fields = ['name', 'number', 'amount', 'customer', 'sign_date', 'description', 'invoice'] + fields = ['name', 'number', 'amount', 'customer', 'sign_date', 'description', 'invoice', 'watch_num'] class OrderCreateUpdateSerializer(serializers.ModelSerializer): diff --git a/hb_server/apps/srm/views.py b/hb_server/apps/srm/views.py index 631380b..f84f5e9 100644 --- a/hb_server/apps/srm/views.py +++ b/hb_server/apps/srm/views.py @@ -147,7 +147,8 @@ class AtWorkCountView(CreateAPIView): ) ret = ClockRecord.objects.filter( update_time__year = vdata['year'], - update_time__month = vdata['month'] + update_time__month = vdata['month'], + create_by__show_atwork = True ).values( user_id = F('create_by'), number = F('create_by__employee_user__number'), diff --git a/hb_server/apps/wpm/migrations/0055_alter_wproductflow_child.py b/hb_server/apps/wpm/migrations/0055_alter_wproductflow_child.py new file mode 100644 index 0000000..9585114 --- /dev/null +++ b/hb_server/apps/wpm/migrations/0055_alter_wproductflow_child.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.9 on 2022-03-17 00:30 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('wpm', '0054_auto_20220315_1500'), + ] + + operations = [ + migrations.AlterField( + model_name='wproductflow', + name='child', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='wpf_child', to='wpm.wproduct'), + ), + ] diff --git a/hb_server/apps/wpm/models.py b/hb_server/apps/wpm/models.py index b408f18..085a20d 100644 --- a/hb_server/apps/wpm/models.py +++ b/hb_server/apps/wpm/models.py @@ -100,7 +100,7 @@ class WProduct(CommonAModel): act_state = models.IntegerField( '进行状态', default=0, choices=act_state_choices) is_hidden = models.BooleanField('是否隐藏', default=False) - child = models.ForeignKey('self', blank=True, null=True, + child = models.ForeignKey('wpm.wproduct', blank=True, null=True, on_delete=models.CASCADE, related_name='wp_child') remark = models.CharField('备注', max_length=200, null=True, blank=True) subproduction_plan = models.ForeignKey(SubProductionPlan, verbose_name='当前子生产计划', on_delete=models.CASCADE, @@ -176,7 +176,7 @@ class WproductFlow(CommonAModel): act_state = models.IntegerField( '进行状态', default=0, choices=WProduct.act_state_choices) is_hidden = models.BooleanField('是否隐藏', default=False) - child = models.ForeignKey('self', blank=True, null=True, + child = models.ForeignKey('wpm.wproduct', blank=True, null=True, on_delete=models.CASCADE, related_name='wpf_child') remark = models.CharField('备注', max_length=200, null=True, blank=True) subproduction_plan = models.ForeignKey( diff --git a/hb_server/apps/wpm/services.py b/hb_server/apps/wpm/services.py index 74af318..4440122 100644 --- a/hb_server/apps/wpm/services.py +++ b/hb_server/apps/wpm/services.py @@ -177,7 +177,7 @@ class WpmService(object): for i in instances: ins = WproductFlow() ins.wproduct = i - for f in WproductFlow.__meta.fields: + for f in WproductFlow._meta.fields: if f.name not in ['id', 'wproduct', 'is_lastlog']: setattr(ins, f.name, getattr(i, f.name, None)) ins.change_str = change_str