diff --git a/hb_client/src/components/Gantt/components/dashLeftMenu.vue b/hb_client/src/components/Gantt/components/dashLeftMenu.vue index 2df8e74..fa9672d 100644 --- a/hb_client/src/components/Gantt/components/dashLeftMenu.vue +++ b/hb_client/src/components/Gantt/components/dashLeftMenu.vue @@ -19,7 +19,11 @@ @expand-change="handlerExpand" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" > - + + diff --git a/hb_client/src/components/Gantt/dashGantt.vue b/hb_client/src/components/Gantt/dashGantt.vue index 4947167..6f8b486 100644 --- a/hb_client/src/components/Gantt/dashGantt.vue +++ b/hb_client/src/components/Gantt/dashGantt.vue @@ -827,7 +827,7 @@ Math.round(end / this.currentDaySize.value) * this.currentDaySize.value -this.currentDaySize.value; this.currentProjectMsg = { - name: this.computedList[index].name, + name: this.computedList[index].name?this.computedList[index].name:'', allTime: (end - start) / this.currentDaySize.value + 1, per: this.computedList[index].per, per1: this.computedList[index].per1, diff --git a/hb_client/src/components/customForm/index.vue b/hb_client/src/components/customForm/index.vue index 97a0760..81627ee 100644 --- a/hb_client/src/components/customForm/index.vue +++ b/hb_client/src/components/customForm/index.vue @@ -243,7 +243,7 @@ that.img = new Image(); that.img.crossOrigin = 'anonymous'; let value = imag[0].field_value?imag[0].field_value:imag[0].draw_template; - that.img = 'http://47.95.0.242:2222'+value; + that.img = 'http://49.232.14.174:2222'+value; setTimeout(function(){ that.canvasInit(); },500); diff --git a/hb_client/src/components/customForm/review.vue b/hb_client/src/components/customForm/review.vue index 7f4d601..c410230 100644 --- a/hb_client/src/components/customForm/review.vue +++ b/hb_client/src/components/customForm/review.vue @@ -327,8 +327,8 @@ }); that.img = new Image(); that.img.crossOrigin = ''; - that.img = 'http://47.95.0.242:2222'+imag[0].field_value; - that.originImg = 'http://47.95.0.242:2222'+imag[0].origin_value; + that.img = 'http://49.232.14.174:2222'+imag[0].field_value; + that.originImg = 'http://49.232.14.174:2222'+imag[0].origin_value; listJudge.forEach(item => { let obj = new Object(); obj = item; diff --git a/hb_client/src/views/pm/plandetails.vue b/hb_client/src/views/pm/plandetails.vue index 4c4fb99..c41a538 100644 --- a/hb_client/src/views/pm/plandetails.vue +++ b/hb_client/src/views/pm/plandetails.vue @@ -106,7 +106,7 @@
{{item.field_name}}: - +
diff --git a/hb_client/src/views/qm/producttest.vue b/hb_client/src/views/qm/producttest.vue index 33675b0..10c9e74 100644 --- a/hb_client/src/views/qm/producttest.vue +++ b/hb_client/src/views/qm/producttest.vue @@ -145,7 +145,7 @@
{{item.field_name}}: - +
diff --git a/hb_client/src/views/qm/taskrecordfrom.vue b/hb_client/src/views/qm/taskrecordfrom.vue index 55e67a2..9b9c359 100644 --- a/hb_client/src/views/qm/taskrecordfrom.vue +++ b/hb_client/src/views/qm/taskrecordfrom.vue @@ -79,7 +79,7 @@
{{item.field_name}}: - +
diff --git a/hb_client/src/views/wpm/firstCheck.vue b/hb_client/src/views/wpm/firstCheck.vue index d3159b2..0dbe011 100644 --- a/hb_client/src/views/wpm/firstCheck.vue +++ b/hb_client/src/views/wpm/firstCheck.vue @@ -186,10 +186,10 @@
{{item.field_name}}: - +
- +
检验结果: 检验合格 diff --git a/hb_client/src/views/wpm/need.vue b/hb_client/src/views/wpm/need.vue index c05e711..aa54500 100644 --- a/hb_client/src/views/wpm/need.vue +++ b/hb_client/src/views/wpm/need.vue @@ -651,7 +651,7 @@
{{item.field_name}}: - +
diff --git a/hb_server/apps/develop/tasks.py b/hb_server/apps/develop/tasks.py index a7345dc..eb46aa2 100644 --- a/hb_server/apps/develop/tasks.py +++ b/hb_server/apps/develop/tasks.py @@ -10,14 +10,15 @@ def backup_database(): """ 备份数据库 """ - ret = os.popen('sudo pg_dump -U postgres -d hberp -f /home/lighthouse/hberp_backup.sql') - return Response() + completed = subprocess.run('sudo pg_dump "user=postgres password=zcDsj2021 dbname=hberp" > /home/lighthouse/hberp_backup.sql', + shell=True, capture_output=True, text=True) + return completed @shared_task def reload_server(): os.chdir('/home/lighthouse/hberp') - ret = subprocess.run('sudo git pull && sudo service supervisor reload') - return Response(ret.read()) + completed = subprocess.run('sudo git pull && sudo service supervisor reload', shell=True, capture_output=True, text=True) + return completed diff --git a/hb_server/apps/develop/views.py b/hb_server/apps/develop/views.py index 0cad10c..90b29ca 100644 --- a/hb_server/apps/develop/views.py +++ b/hb_server/apps/develop/views.py @@ -13,6 +13,7 @@ from apps.wf.models import Ticket from apps.wpm.models import Operation, OperationMaterial, WProduct, WproductFlow from apps.wpm.services import WpmService from apps.em.tasks import update_equip_state_by_next_check_date +from rest_framework.exceptions import APIException # Create your views here. class CleanDataView(APIView): @@ -123,10 +124,18 @@ class UpdateFIFONumber(APIView): class ReloadServer(APIView): permission_classes = [IsAdminUser] def post(self, request): - reload_server() + completed = reload_server() + if completed.returncode == 0: + return Response() + else: + raise APIException(completed.stdout) class BackupDatabase(APIView): permission_classes = [IsAdminUser] def post(self, request): - backup_database() \ No newline at end of file + completed = backup_database() + if completed.returncode == 0: + return Response() + else: + raise APIException(completed.stdout) \ No newline at end of file diff --git a/hb_server/apps/inm/services.py b/hb_server/apps/inm/services.py index 8be61b7..8ee155d 100644 --- a/hb_server/apps/inm/services.py +++ b/hb_server/apps/inm/services.py @@ -5,6 +5,8 @@ from apps.mtm.models import Material from apps.sam.models import SalePack, SaleProduct from django.db.models import Count from django.db.models.aggregates import Sum +import logging +logger = logging.getLogger('log') class InmService: @classmethod @@ -12,7 +14,8 @@ class InmService: """ 更新库存(正反) """ - if instance.type in [FIFO.FIFO_TYPE_PUR_IN, FIFO.FIFO_TYPE_DO_IN]: # 采购入库, 生产入库 + if instance.type in [FIFO.FIFO_TYPE_PUR_IN, + FIFO.FIFO_TYPE_DO_IN, FIFO.FIFO_TYPE_OTHER_IN]: # 采购入库, 生产入库, 其他入库 # 更新相关表 for i in FIFOItem.objects.filter(fifo=instance): material = i.material diff --git a/hb_server/apps/sam/migrations/0016_sale_iproducts.py b/hb_server/apps/sam/migrations/0016_sale_iproducts.py new file mode 100644 index 0000000..00c6f8d --- /dev/null +++ b/hb_server/apps/sam/migrations/0016_sale_iproducts.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.9 on 2022-02-26 00:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('inm', '0032_auto_20220222_0941'), + ('sam', '0015_sale_ship_pic'), + ] + + operations = [ + migrations.AddField( + model_name='sale', + name='iproducts', + field=models.ManyToManyField(through='sam.SaleProduct', to='inm.IProduct'), + ), + ] diff --git a/hb_server/apps/sam/models.py b/hb_server/apps/sam/models.py index ba9a809..12ef0a8 100644 --- a/hb_server/apps/sam/models.py +++ b/hb_server/apps/sam/models.py @@ -94,6 +94,7 @@ class Sale(CommonADModel): receiver_address = models.CharField('收获地址', null=True, blank=True, max_length=200) remark = models.CharField('备注', null=True, blank=True, max_length=200) ship_pic = models.CharField('物流图片', max_length=200, null=True, blank=True) + iproducts = models.ManyToManyField('inm.iproduct', through='sam.saleproduct') class SaleProduct(BaseModel): """ diff --git a/hb_server/apps/sam/views_sale.py b/hb_server/apps/sam/views_sale.py index ed18874..1889abc 100644 --- a/hb_server/apps/sam/views_sale.py +++ b/hb_server/apps/sam/views_sale.py @@ -36,7 +36,8 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C elif self.action == 'retrieve': return SaleListSerializer return super().get_serializer_class() - + + @transaction.atomic def destroy(self, request, *args, **kwargs): obj = self.get_object() if obj.is_audited: @@ -161,6 +162,8 @@ class SaleProductViewSet(ListModelMixin, DestroyModelMixin, CreateModelMixin, Ge }) return Response(SaleProductPackDetailSerializer(instance=obj).data) elif request.method == 'POST': + if obj.sale.is_audited: + raise exceptions.APIException('该销售记录已审核,不可装箱') serializer = SaleProductPackSerializer(data=request.data) serializer.is_valid(raise_exception=True) vdata = serializer.validated_data @@ -180,6 +183,8 @@ class SaleProductViewSet(ListModelMixin, DestroyModelMixin, CreateModelMixin, Ge 不装箱备注 """ obj = self.get_object() + if obj.sale.is_audited: + raise exceptions.APIException('该销售记录已审核,不可填写备注') serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) vdata = serializer.validated_data diff --git a/hb_server/apps/system/permission.py b/hb_server/apps/system/permission.py index bcb94ac..7b218d3 100644 --- a/hb_server/apps/system/permission.py +++ b/hb_server/apps/system/permission.py @@ -8,6 +8,7 @@ def get_permission_list(user): """ 获取权限列表,可用redis存取 """ + perms_list = ['visitor'] if user.is_superuser: perms_list = ['admin'] else: @@ -43,21 +44,19 @@ class RbacPermission(BasePermission): perms = cache.get(request.user.username + '__perms') if not perms: perms = get_permission_list(request.user) - if perms: - if 'admin' in perms: - return True - elif not hasattr(view, 'perms_map'): - return True - else: - perms_map = view.perms_map - _method = request._request.method.lower() - if perms_map: - for key in perms_map: - if key == _method or key == '*': - if perms_map[key] in perms or perms_map[key] == '*': - return True - return False + + if 'admin' in perms: + return True + elif not hasattr(view, 'perms_map'): + return True else: + perms_map = view.perms_map + _method = request._request.method.lower() + if perms_map: + for key in perms_map: + if key == _method or key == '*': + if perms_map[key] in perms or perms_map[key] == '*': + return True return False def has_object_permission(self, request, view, obj):