Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
shilixia 2022-03-01 13:53:32 +08:00
commit 4acdd5a615
6 changed files with 22 additions and 12 deletions

View File

@ -98,7 +98,7 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
for index, i in enumerate(subps): for index, i in enumerate(subps):
steps = Step.objects.filter(usedstep__subproduction=i, usedstep__subproduction__is_deleted=False, steps = Step.objects.filter(usedstep__subproduction=i, usedstep__subproduction__is_deleted=False,
usedstep__is_deleted=False, is_deleted=False usedstep__is_deleted=False, is_deleted=False
).values('id', 'number', 'name', 'usedstep__remark', need_test=F('usedstep__need_test')) ).order_by('number').values('id', 'number', 'name', 'usedstep__remark', need_test=F('usedstep__need_test'))
instance = SubProductionPlan.objects.create(production_plan=production_plan, subproduction=i, instance = SubProductionPlan.objects.create(production_plan=production_plan, subproduction=i,
start_date=production_plan.start_date, end_date=production_plan.end_date, start_date=production_plan.start_date, end_date=production_plan.end_date,
workshop=i.process.workshop, process=i.process, create_by=request.user, workshop=i.process.workshop, process=i.process, create_by=request.user,

View File

@ -200,9 +200,9 @@ class PermissionViewSet(ModelViewSet):
queryset = Permission.objects.all() queryset = Permission.objects.all()
serializer_class = PermissionSerializer serializer_class = PermissionSerializer
pagination_class = None pagination_class = None
search_fields = ['name'] search_fields = ['name', 'method']
ordering_fields = ['sort'] ordering_fields = ['sort', 'id', 'method']
ordering = ['pk'] ordering = ['sort']
class OrganizationViewSet(ModelViewSet): class OrganizationViewSet(ModelViewSet):

View File

@ -64,6 +64,8 @@ class PickSerializer(serializers.Serializer):
fifo = FIFO.objects.create(type=FIFO.FIFO_TYPE_DO_OUT, fifo = FIFO.objects.create(type=FIFO.FIFO_TYPE_DO_OUT,
inout_date=timezone.now(), create_by=self.context['request'].user, inout_date=timezone.now(), create_by=self.context['request'].user,
number = 'CK' + ranstr(7)) number = 'CK' + ranstr(7))
if len(picks)<=0:
raise exceptions.APIException('没有领料项目')
for i in picks: for i in picks:
isLowLevel = False isLowLevel = False
# 更新出库详情 # 更新出库详情
@ -116,8 +118,9 @@ class PickSerializer(serializers.Serializer):
subproduction_plan=sp) subproduction_plan=sp)
sp.is_picked=True sp.is_picked=True
sp.state = SubProductionPlan.SUBPLAN_STATE_WORKING #生产中 sp.state = SubProductionPlan.SUBPLAN_STATE_WORKING #生产中
sp.state_date_real = timezone.now() #实际开工日期 if sp.start_date_real is None:
sp.save() sp.start_date_real = timezone.now()#实际开工日期
sp.save()
# 创建领料记录 # 创建领料记录
pick = Pick() pick = Pick()
pick.subproduction_plan = sp pick.subproduction_plan = sp

View File

@ -76,8 +76,9 @@ class WpmService(object):
if wt.step.process == test.step.process: if wt.step.process == test.step.process:
wproduct.ng_sign = None wproduct.ng_sign = None
ticket = wt.ticket ticket = wt.ticket
ticket_data = wt.ticket_data ticket_data = ticket.ticket_data
ticket_data['retest_result'] = 1 ticket_data['retest_result'] = 1
ticket.ticket_data = ticket_data
ticket.update_by = user ticket.update_by = user
ticket.save() ticket.save()
# 创建处理日志 # 创建处理日志

View File

@ -71,7 +71,9 @@ def handleTicket(sender, instance, created, **kwargs):
elif decision in [WProduct.NG_ACCEPT, WProduct.NG_PERMIT]: elif decision in [WProduct.NG_ACCEPT, WProduct.NG_PERMIT]:
wp.act_state = WProduct.WPR_ACT_STATE_OK wp.act_state = WProduct.WPR_ACT_STATE_OK
if wp.test_wproduct.filter(is_submited=True).order_by('-id').last().type == TestRecord.TEST_PROCESS_RE: # 获取最后一次检验
test= wp.test_wproduct.filter(is_submited=True).order_by('-id').last()
if test.type == TestRecord.TEST_PROCESS_RE or test.is_midtesting:
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
wp.ng_sign = decision wp.ng_sign = decision
wt.save() wt.save()

View File

@ -163,7 +163,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
'to_order').prefetch_related('wp_child') 'to_order').prefetch_related('wp_child')
serializer_class = WProductListSerializer serializer_class = WProductListSerializer
filterset_class = WProductFilterSet filterset_class = WProductFilterSet
search_fields = ['number'] search_fields = ['number', 'material__name', 'subproduction_plan__number']
ordering_fields = ['id'] ordering_fields = ['id']
ordering = ['id'] ordering = ['id']
@ -315,7 +315,7 @@ class WProductViewSet(ListModelMixin, RetrieveModelMixin, GenericViewSet):
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(), is_audited=True, auditor=request.user, inout_date=timezone.now(),
create_by=request.user, remark=remark) create_by=request.user, remark=remark, number='RK'+ranstr(7))
# 创建入库明细 # 创建入库明细
fifoitem = FIFOItem() fifoitem = FIFOItem()
fifoitem.warehouse = warehouse fifoitem.warehouse = warehouse
@ -660,8 +660,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
if set(list(sps_omi_l)) != set(list(sps_omo_l)): if set(list(sps_omi_l)) != set(list(sps_omo_l)):
raise exceptions.APIException('消耗与产出不一致') raise exceptions.APIException('消耗与产出不一致')
else: else:
if omis.exists() and processId !=1: # 不是冷加工 pass
raise exceptions.APIException('请选择消耗物料') # if omis.exists() and processId !=1: # 不是冷加工
# raise exceptions.APIException('请选择消耗物料')
# 检查自定义表单填写 # 检查自定义表单填写
if OperationRecord.objects.filter(operation=op, is_filled=False).exists(): if OperationRecord.objects.filter(operation=op, is_filled=False).exists():
@ -712,6 +713,9 @@ class OperationViewSet(ListModelMixin, RetrieveModelMixin, CreateModelMixin, Upd
wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT wp.act_state = WProduct.WPR_ACT_STATE_DOWAIT
if needTest: if needTest:
wp.act_state = WProduct.WPR_ACT_STATE_TOTEST wp.act_state = WProduct.WPR_ACT_STATE_TOTEST
if wp.test:# 如果有正在进行的工序中检验
wp.test.is_submited = False
wp.test.save()
wp.operation = None wp.operation = None
wp.update_by = request.user wp.update_by = request.user