+
-
+
+
+
-
+
+
-
+
-
-
-
-
+
+
-
+
@@ -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