一些bug修复

This commit is contained in:
caoqianming 2022-03-01 10:27:45 +08:00
parent 54023e8c89
commit 2d834246fa
2 changed files with 6 additions and 3 deletions

View File

@ -98,7 +98,7 @@ class ProductionPlanViewSet(CreateUpdateModelAMixin, ListModelMixin, CreateModel
for index, i in enumerate(subps):
steps = Step.objects.filter(usedstep__subproduction=i, usedstep__subproduction__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,
start_date=production_plan.start_date, end_date=production_plan.end_date,
workshop=i.process.workshop, process=i.process, create_by=request.user,

View File

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