Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
9e5efe57d4
|
@ -0,0 +1 @@
|
||||||
|
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M108.8 44.322H89.6v-5.36c0-9.04-3.308-24.163-25.6-24.163-23.145 0-25.6 16.881-25.6 24.162v5.361H19.2v-5.36C19.2 15.281 36.798 0 64 0c27.202 0 44.8 15.281 44.8 38.961v5.361zm-32 39.356c0-5.44-5.763-9.832-12.8-9.832-7.037 0-12.8 4.392-12.8 9.832 0 3.682 2.567 6.808 6.407 8.477v11.205c0 2.718 2.875 4.962 6.4 4.962 3.524 0 6.4-2.244 6.4-4.962V92.155c3.833-1.669 6.393-4.795 6.393-8.477zM128 64v49.201c0 8.158-8.645 14.799-19.2 14.799H19.2C8.651 128 0 121.359 0 113.201V64c0-8.153 8.645-14.799 19.2-14.799h89.6c10.555 0 19.2 6.646 19.2 14.799z"/></svg>
|
After Width: | Height: | Size: 623 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M124.884 109.812L94.256 79.166c-.357-.357-.757-.629-1.129-.914a50.366 50.366 0 0 0 8.186-27.59C101.327 22.689 78.656 0 50.67 0 22.685 0 0 22.688 0 50.663c0 27.989 22.685 50.663 50.656 50.663 10.186 0 19.643-3.03 27.6-8.201.286.385.557.771.9 1.114l30.628 30.632a10.633 10.633 0 0 0 7.543 3.129c2.728 0 5.457-1.043 7.543-3.115 4.171-4.157 4.171-10.915.014-15.073M50.671 85.338C31.557 85.338 16 69.78 16 50.663c0-19.102 15.557-34.661 34.67-34.661 19.115 0 34.657 15.559 34.657 34.675 0 19.102-15.557 34.661-34.656 34.661"/></svg>
|
After Width: | Height: | Size: 600 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M0 54.857h54.796v18.286H36.531V128H18.265V73.143H0V54.857zm127.857-36.571H91.935V128H72.456V18.286H36.534V0h91.326l-.003 18.286z"/></svg>
|
After Width: | Height: | Size: 211 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg width="130" height="130" xmlns="http://www.w3.org/2000/svg"><path d="M63.444 64.996c20.633 0 37.359-14.308 37.359-31.953 0-17.649-16.726-31.952-37.359-31.952-20.631 0-37.36 14.303-37.358 31.952 0 17.645 16.727 31.953 37.359 31.953zM80.57 75.65H49.434c-26.652 0-48.26 18.477-48.26 41.27v2.664c0 9.316 21.608 9.325 48.26 9.325H80.57c26.649 0 48.256-.344 48.256-9.325v-2.663c0-22.794-21.605-41.271-48.256-41.271z" stroke="#979797"/></svg>
|
After Width: | Height: | Size: 440 B |
|
@ -9,7 +9,7 @@
|
||||||
<dv-decoration-8 class="dv-dec-8" :color="['#568aea', '#000000']" />
|
<dv-decoration-8 class="dv-dec-8" :color="['#568aea', '#000000']" />
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="title-text">
|
<div class="title-text">
|
||||||
<span style="margin-right: 20px">*航玻车间</span><span>可视化平台</span>
|
<span style="margin-right: 20px">航玻生产</span><span>管理系统</span>
|
||||||
</div>
|
</div>
|
||||||
<dv-decoration-6
|
<dv-decoration-6
|
||||||
class="dv-dec-6"
|
class="dv-dec-6"
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
<div class="cardsWrap" @click="toDetail('1')">
|
<div class="cardsWrap" @click="toDetail('1')">
|
||||||
<div class="svgIconWrap">
|
<div class="svgIconWrap">
|
||||||
<svg-icon
|
<svg-icon
|
||||||
icon-class="form"
|
|
||||||
class="svgIcon"
|
class="svgIcon"
|
||||||
|
icon-class="contract"
|
||||||
|
:className="'svgIcon'"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="totalCountWrap">
|
<div class="totalCountWrap">
|
||||||
|
@ -18,16 +19,14 @@
|
||||||
<span class="totalCount">{{contractTotalCurrent}}</span>
|
<span class="totalCount">{{contractTotalCurrent}}</span>
|
||||||
<span>个</span>
|
<span>个</span>
|
||||||
</div>
|
</div>
|
||||||
<!--<div style="height: 35px;line-height: 35px;font-size: 16px;color: #333333">
|
|
||||||
<span>本年合同总数:</span>
|
|
||||||
</div>-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cardsWrap" @click="toDetail('2')">
|
<div class="cardsWrap" @click="toDetail('2')">
|
||||||
<div class="svgIconWrap">
|
<div class="svgIconWrap">
|
||||||
<svg-icon
|
<svg-icon
|
||||||
icon-class="form"
|
|
||||||
class="svgIcon"
|
class="svgIcon"
|
||||||
|
icon-class="order"
|
||||||
|
:className="'svgIcon'"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="totalCountWrap">
|
<div class="totalCountWrap">
|
||||||
|
@ -41,8 +40,9 @@
|
||||||
<div class="cardsWrap" @click="toDetail('3')">
|
<div class="cardsWrap" @click="toDetail('3')">
|
||||||
<div class="svgIconWrap">
|
<div class="svgIconWrap">
|
||||||
<svg-icon
|
<svg-icon
|
||||||
icon-class="form"
|
|
||||||
class="svgIcon"
|
class="svgIcon"
|
||||||
|
icon-class="productionTask"
|
||||||
|
:className="'svgIcon'"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="totalCountWrap">
|
<div class="totalCountWrap">
|
||||||
|
@ -56,8 +56,9 @@
|
||||||
<div class="cardsWrap" @click="toDetail('4')">
|
<div class="cardsWrap" @click="toDetail('4')">
|
||||||
<div class="svgIconWrap">
|
<div class="svgIconWrap">
|
||||||
<svg-icon
|
<svg-icon
|
||||||
icon-class="form"
|
icon-class="product"
|
||||||
class="svgIcon"
|
class="svgIcon"
|
||||||
|
:className="'svgIcon'"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="totalCountWrap">
|
<div class="totalCountWrap">
|
||||||
|
@ -71,8 +72,9 @@
|
||||||
<div class="cardsWrap" @click="toDetail('5')">
|
<div class="cardsWrap" @click="toDetail('5')">
|
||||||
<div class="svgIconWrap">
|
<div class="svgIconWrap">
|
||||||
<svg-icon
|
<svg-icon
|
||||||
icon-class="form"
|
icon-class="unqualified"
|
||||||
class="svgIcon"
|
class="svgIcon"
|
||||||
|
:className="'svgIcon'"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="totalCountWrap">
|
<div class="totalCountWrap">
|
||||||
|
@ -1064,9 +1066,9 @@
|
||||||
.cardsWrap:nth-child(1) {
|
.cardsWrap:nth-child(1) {
|
||||||
.svgIconWrap {
|
.svgIconWrap {
|
||||||
background: #e9f3ff;
|
background: #e9f3ff;
|
||||||
|
|
||||||
.svgIcon {
|
.svgIcon {
|
||||||
color: #409EFF;
|
color: #409EFF;
|
||||||
|
fill: #409EFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
auto-complete="on"
|
auto-complete="on"
|
||||||
><svg-icon
|
><svg-icon
|
||||||
slot="prefix"
|
slot="prefix"
|
||||||
icon-class="user"
|
icon-class="userName"
|
||||||
class="el-input__icon input-icon"
|
class="el-input__icon input-icon"
|
||||||
/></el-input>
|
/></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
@ -126,6 +126,24 @@ class FaceLogin(CreateAPIView):
|
||||||
if user:
|
if user:
|
||||||
refresh = RefreshToken.for_user(user)
|
refresh = RefreshToken.for_user(user)
|
||||||
# 可设为在岗
|
# 可设为在岗
|
||||||
|
now = timezone.now()
|
||||||
|
now_local = timezone.localtime()
|
||||||
|
if 8<=now_local.hour<=17:
|
||||||
|
ins, created = ClockRecord.objects.get_or_create(
|
||||||
|
create_by = user, create_time__hour__range = [8,18],
|
||||||
|
create_time__year=now_local.year, create_time__month=now_local.month,
|
||||||
|
create_time__day=now_local.day,
|
||||||
|
defaults={
|
||||||
|
'type':ClockRecord.ClOCK_WORK1,
|
||||||
|
'create_by':user,
|
||||||
|
'create_time':now
|
||||||
|
})
|
||||||
|
# 设为在岗
|
||||||
|
if created:
|
||||||
|
user.is_atwork = True
|
||||||
|
user.last_check_time = now
|
||||||
|
user.save()
|
||||||
|
|
||||||
return Response({
|
return Response({
|
||||||
'refresh': str(refresh),
|
'refresh': str(refresh),
|
||||||
'access': str(refresh.access_token),
|
'access': str(refresh.access_token),
|
||||||
|
|
|
@ -22,6 +22,13 @@ class ResourceCalSerializer(serializers.Serializer):
|
||||||
id = serializers.IntegerField(label='产品ID')
|
id = serializers.IntegerField(label='产品ID')
|
||||||
count = serializers.IntegerField(label='生产数量')
|
count = serializers.IntegerField(label='生产数量')
|
||||||
|
|
||||||
|
class ResourceConvertSerializer(serializers.Serializer):
|
||||||
|
id = serializers.IntegerField(label='半成品ID')
|
||||||
|
count = serializers.IntegerField(label='折合数量')
|
||||||
|
|
||||||
|
class ResourceConvertListSerializer(serializers.ListSerializer):
|
||||||
|
child = ResourceConvertSerializer()
|
||||||
|
|
||||||
class ResourceCalListSerializer(serializers.ListSerializer):
|
class ResourceCalListSerializer(serializers.ListSerializer):
|
||||||
child = ResourceCalSerializer()
|
child = ResourceCalSerializer()
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from apps.inm.serializers import MaterialBatchSerializer
|
||||||
from apps.mtm.models import Material, Step, SubProduction, SubprodctionMaterial
|
from apps.mtm.models import Material, Step, SubProduction, SubprodctionMaterial
|
||||||
from apps.pm.filters import PlanFilterSet, SubproductionProgressFilterSet
|
from apps.pm.filters import PlanFilterSet, SubproductionProgressFilterSet
|
||||||
from apps.system.mixins import CreateUpdateModelAMixin
|
from apps.system.mixins import CreateUpdateModelAMixin
|
||||||
from apps.pm.serializers import GenSubPlanSerializer, PickNeedSerializer, PlanDestorySerializer, ProductionPlanCreateFromOrderSerializer, ProductionPlanSerializer, ResourceCalListSerializer, ResourceCalSerializer, SubProductionPlanListSerializer, SubProductionPlanUpdateSerializer, SubProductionProgressSerializer
|
from apps.pm.serializers import GenSubPlanSerializer, PickNeedSerializer, PlanDestorySerializer, ProductionPlanCreateFromOrderSerializer, ProductionPlanSerializer, ResourceCalListSerializer, ResourceCalSerializer, ResourceConvertListSerializer, ResourceConvertSerializer, SubProductionPlanListSerializer, SubProductionPlanUpdateSerializer, SubProductionProgressSerializer
|
||||||
from rest_framework.mixins import CreateModelMixin, ListModelMixin, RetrieveModelMixin, UpdateModelMixin
|
from rest_framework.mixins import CreateModelMixin, ListModelMixin, RetrieveModelMixin, UpdateModelMixin
|
||||||
from apps.pm.models import ProductionPlan, SubProductionProgress, SubProductionPlan
|
from apps.pm.models import ProductionPlan, SubProductionProgress, SubProductionPlan
|
||||||
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
from rest_framework.viewsets import GenericViewSet, ModelViewSet
|
||||||
|
@ -216,30 +216,91 @@ class ResourceViewSet(GenericViewSet):
|
||||||
rdata = request.data
|
rdata = request.data
|
||||||
serializer = self.get_serializer(data=rdata)
|
serializer = self.get_serializer(data=rdata)
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
|
productIdList = []
|
||||||
|
productList = []
|
||||||
|
for i in rdata:
|
||||||
|
if i['id'] not in productIdList:
|
||||||
|
productIdList.append(i['id'])
|
||||||
|
productList.append(i)
|
||||||
|
else:
|
||||||
|
index = productIdList.index(i['id'])
|
||||||
|
productList[index]['count'] = productList[index]['count'] + i['count']
|
||||||
|
|
||||||
res_d_list = []
|
res_d_list = []
|
||||||
res = []
|
res = []
|
||||||
for i in rdata:
|
for i in productList:
|
||||||
# 计算输入物料
|
# 计算输入物料
|
||||||
materials = SubprodctionMaterial.objects.filter(subproduction__product__id=i['id'],
|
materials = SubprodctionMaterial.objects.filter(subproduction__product__id=i['id'],
|
||||||
subproduction__is_deleted=False, is_deleted=False,
|
subproduction__is_deleted=False, is_deleted=False,
|
||||||
material__type__in=[Material.MA_TYPE_MAINSO,
|
type= SubprodctionMaterial.SUB_MA_TYPE_IN).order_by(
|
||||||
Material.MA_TYPE_HELPSO], type= SubprodctionMaterial.SUB_MA_TYPE_IN).order_by('material__number')\
|
'material__type', 'material__number')\
|
||||||
.values('material__id', 'material__name',
|
.values('material__id', 'material__name',
|
||||||
'material__number', 'material__type',
|
'material__number', 'material__type',
|
||||||
'count', 'material__count', 'material__count_safe')
|
'count', 'material__count', 'material__count_safe')
|
||||||
l_m = list(materials)
|
l_m = list(materials)
|
||||||
for m in l_m:
|
for m in l_m:
|
||||||
if m['material__id'] in res_d_list:
|
if m['material__id'] in res_d_list:
|
||||||
index = res_d_list.index(m['material__id'])
|
if m['material__type'] in [Material.MA_TYPE_MAINSO, Material.MA_TYPE_HELPSO]:
|
||||||
res[index]['count'] = res[index]['count'] + m['count']*i['count']
|
index = res_d_list.index(m['material__id'])
|
||||||
|
res[index]['count'] = res[index]['count'] + m['count']*i['count']
|
||||||
else:
|
else:
|
||||||
res_d_list.append(m['material__id'])
|
res_d_list.append(m['material__id'])
|
||||||
res.append({'id':m['material__id'], 'name':m['material__name'],
|
item = {'id':m['material__id'], 'name':m['material__name'],
|
||||||
'type':m['material__type'], 'number':m['material__number'],
|
'type':m['material__type'], 'number':m['material__number'],
|
||||||
'count':m['count']*i['count'], 'inv_count':m['material__count'],
|
'count': None,'inv_count':m['material__count'],
|
||||||
'count_safe':m['material__count_safe']})
|
'count_safe':m['material__count_safe']}
|
||||||
|
if item['type'] in [Material.MA_TYPE_MAINSO, Material.MA_TYPE_HELPSO]:
|
||||||
|
item['count'] = m['count']*i['count']
|
||||||
|
res.append(item)
|
||||||
return Response(res)
|
return Response(res)
|
||||||
|
|
||||||
|
@action(methods=['post'], detail=False, perms_map={'post':'resource_cal'}, serializer_class=ResourceConvertListSerializer)
|
||||||
|
def convert(self, request, pk=None):
|
||||||
|
rdata = request.data
|
||||||
|
serializer = self.get_serializer(data=rdata)
|
||||||
|
serializer.is_valid(raise_exception=True)
|
||||||
|
res_d_list = []
|
||||||
|
res = []
|
||||||
|
half_list = rdata
|
||||||
|
while half_list:
|
||||||
|
fitem = half_list[0]
|
||||||
|
sm = SubprodctionMaterial.objects.filter(
|
||||||
|
type= SubprodctionMaterial.SUB_MA_TYPE_OUT,
|
||||||
|
is_deleted = False,
|
||||||
|
material__id = fitem['id']
|
||||||
|
).first()
|
||||||
|
if sm:
|
||||||
|
spn = sm.subproduction
|
||||||
|
sm_left_l = list(SubprodctionMaterial.objects.filter(
|
||||||
|
subproduction = spn,
|
||||||
|
type= SubprodctionMaterial.SUB_MA_TYPE_IN,
|
||||||
|
is_deleted = False,
|
||||||
|
).order_by('material__number')\
|
||||||
|
.values('material__id', 'material__name',
|
||||||
|
'material__number', 'material__type',
|
||||||
|
'count', 'material__count', 'material__count_safe'))
|
||||||
|
|
||||||
|
for i in sm_left_l:
|
||||||
|
if i['material__type'] == Material.MA_TYPE_HALFGOOD:
|
||||||
|
item = {
|
||||||
|
'id':i['material__id'],
|
||||||
|
'count':(i['count']*fitem['count'])/(sm.count)
|
||||||
|
}
|
||||||
|
half_list.append(item)
|
||||||
|
else:
|
||||||
|
if i['material__id'] in res_d_list:
|
||||||
|
index = res_d_list.index(i['material__id'])
|
||||||
|
res[index]['count'] = res[index]['count'] + \
|
||||||
|
(i['count']*fitem['count'])/(sm.count)
|
||||||
|
else:
|
||||||
|
res_d_list.append(i['material__id'])
|
||||||
|
item = {
|
||||||
|
'id': i['material__id'],
|
||||||
|
'count':(i['count']*fitem['count'])/(sm.count)
|
||||||
|
}
|
||||||
|
res.append(item)
|
||||||
|
del(half_list[0])
|
||||||
|
return Response(res)
|
||||||
|
|
||||||
@action(methods=['post'], detail=False, perms_map={'post':'resource_cal_equip'}, serializer_class=ResourceCalListSerializer)
|
@action(methods=['post'], detail=False, perms_map={'post':'resource_cal_equip'}, serializer_class=ResourceCalListSerializer)
|
||||||
def cal_equip(self, request, pk=None):
|
def cal_equip(self, request, pk=None):
|
||||||
|
@ -256,4 +317,4 @@ class ResourceViewSet(GenericViewSet):
|
||||||
steps = Step.objects.filter(usedstep__is_deleted=False, usedstep__subproduction__in=subproductions)
|
steps = Step.objects.filter(usedstep__is_deleted=False, usedstep__subproduction__in=subproductions)
|
||||||
equips = Equipment.objects.filter(step_equips__in=steps, is_deleted=False).distinct()
|
equips = Equipment.objects.filter(step_equips__in=steps, is_deleted=False).distinct()
|
||||||
serializer = EquipmentSimpleSerializer(instance=equips, many=True)
|
serializer = EquipmentSimpleSerializer(instance=equips, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
Loading…
Reference in New Issue