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

This commit is contained in:
shijing 2022-03-15 10:29:30 +08:00
commit 76fdd2eea6
13 changed files with 514 additions and 258 deletions

View File

@ -150,3 +150,11 @@ export function itemfiles(id, data) {
data data
}) })
} }
//其他出库
export function outOther(data) {
return request({
url: `/inm/fifo/out_other/`,
method: 'POST',
data
})
}

View File

@ -393,8 +393,8 @@
], ],
state_: { state_: {
10: "合格", 10: "合格",
40: "禁用", 40: "禁用",
50: "报废",
}, },
options: [ options: [
{ {
@ -404,6 +404,11 @@
{ {
value: 40, value: 40,
label: "禁用", label: "禁用",
}
,
{
value: 50,
label: "报废",
}, },
], ],
listQuery: { listQuery: {

View File

@ -8,7 +8,7 @@
icon="el-icon-plus" icon="el-icon-plus"
@click="handlecgCreate" @click="handlecgCreate"
> >
新增采购入库 采购入库
</el-button> </el-button>
<el-button <el-button
v-if="checkPermission(['fifo_in_other'])" v-if="checkPermission(['fifo_in_other'])"
@ -16,7 +16,15 @@
icon="el-icon-plus" icon="el-icon-plus"
@click="handleCreate" @click="handleCreate"
> >
新增其他入库 其他入库
</el-button>
<el-button
v-if="checkPermission(['fifo_out_other'])"
type="primary"
icon="el-icon-plus"
@click="handleoutCreate"
>
其他出库
</el-button> </el-button>
<el-input <el-input
v-model="listQuery.search" v-model="listQuery.search"
@ -54,12 +62,11 @@
height="100" height="100"
v-el-height-adaptive-table="{ bottomOffset: 42 }" v-el-height-adaptive-table="{ bottomOffset: 42 }"
> >
<el-table-column type="index" width="50"/> <el-table-column type="index" width="50" />
<el-table-column label="记录编号" prop="number"> <el-table-column label="记录编号" prop="number"> </el-table-column>
</el-table-column>
<el-table-column label="操作人员"> <el-table-column label="操作人员">
<template slot-scope="scope" v-if="scope.row.create_by"> <template slot-scope="scope" v-if="scope.row.create_by">
{{scope.row.create_by_.name}} {{ scope.row.create_by_.name }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="出/入库时间" prop="inout_date"> <el-table-column label="出/入库时间" prop="inout_date">
@ -73,12 +80,11 @@
<el-tag v-else>已审核</el-tag> <el-tag v-else>已审核</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" prop="create_time"> <el-table-column label="创建时间" prop="create_time"> </el-table-column>
</el-table-column>
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['fifo_pack'])&&scope.row.type==2" v-if="checkPermission(['fifo_pack']) && scope.row.type == 2"
type="primary" type="primary"
@click="handlePack(scope)" @click="handlePack(scope)"
> >
@ -92,7 +98,9 @@
查看 查看
</el-link> </el-link>
<el-link <el-link
v-if="checkPermission(['fifo_hear'])&&scope.row.is_audited == false" v-if="
checkPermission(['fifo_hear']) && scope.row.is_audited == false
"
type="primary" type="primary"
@click="handleAudit(scope)" @click="handleAudit(scope)"
> >
@ -141,16 +149,121 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button <el-button type="danger" @click="dialogVisibles = false">
type="danger"
@click="dialogVisibles = false"
>
取消 取消
</el-button> </el-button>
<el-button <el-button type="primary" @click="confirminpur('Form1')">
type="primary" 确认
@click="confirminpur('Form1')" </el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogVisibleout"
:close-on-click-modal="false"
title="新增出库记录"
> >
<el-form
ref="Formout"
:model="outfifo"
label-width="80px"
label-position="right"
:rules="rule1"
>
<div v-for="(item, index) in outfifo.details" :key="index">
<el-row>
<el-col :span="10" style="margin-right: 10px">
<el-form-item
class="material_batch"
label="批次:"
:prop="'details.' + index + '.material_batch'"
>
<el-select
v-model="item.material_batch"
filterable
size="small"
>
<el-option
v-for="item in materialbatchoptions"
:key="item.id"
:value="item.id"
:label="item.batch"
>
<span style="float: left">{{ item.batch }}</span>
<span
style="float: right; color: #8492a6; font-size: 13px"
>{{ item.material_.name }}</span
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" style="margin-right: 50px">
<el-form-item
class="count"
label="出库数量"
:prop="'details.' + index + '.count'"
>
<el-input-number
v-model="item.count"
:min="0"
></el-input-number>
</el-form-item>
</el-col>
<!-- 删除按钮 -->
<el-col :span="1">
<el-tooltip
class="item"
effect="dark"
content="删除"
placement="top"
>
<el-button
@click="deleteItem1(index)"
style="
border: none;
background: none;
padding: 0px;
margin-top: 4px;
"
>
<i class="el-icon-remove-outline" style="font-size: 20px"></i>
</el-button>
</el-tooltip>
</el-col>
</el-row>
</div>
<div>
<el-tooltip
class="item"
effect="dark"
content="添加条件"
placement="top"
>
<el-button
@click="addConditions1"
style="
cursor: pointer;
width: 95%;
color: #fe000c;
border: 1px dashed #fe000c;
height: 40px;
padding: 0px;
margin-top: 2px;
margin-left: 20px;
font-size: 26px;
"
>
+
</el-button>
</el-tooltip>
</div>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibleout = false">
取消
</el-button>
<el-button type="primary" @click="confirmoutfifo('Formout')">
确认 确认
</el-button> </el-button>
</div> </div>
@ -247,7 +360,7 @@
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
style="width:100%" style="width: 100%"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -309,23 +422,25 @@
</div> </div>
</template> </template>
<script> <script>
import { import {
getfifoList, getfifoList,
createInventory, createInventory,
createInother, createInother,
getWarehouseList, getWarehouseList,
deleteFifoitem, deleteFifoitem,
getmaterialbatchList,
deleteFifo, deleteFifo,
audit, audit,
} from "@/api/inm"; outOther,
import {getPuorderList} from "@/api/pum"; } from "@/api/inm";
import checkPermission from "@/utils/permission"; import { getPuorderList } from "@/api/pum";
import {getpVendorList} from "@/api/vendor"; import checkPermission from "@/utils/permission";
import {getMaterialList} from "@/api/mtm"; import { getpVendorList } from "@/api/vendor";
import {getUserList} from "@/api/user"; import { getMaterialList } from "@/api/mtm";
import {genTree} from "@/utils"; import { getUserList } from "@/api/user";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import { genTree } from "@/utils";
const defaulteinventory = { import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaulteinventory = {
vendor: null, vendor: null,
details: [ details: [
{ {
@ -335,12 +450,22 @@
batch: "", //批次 batch: "", //批次
}, },
], ],
}; };
export default { const defaulteoutfifo = {
components: {Pagination}, details: [
{
material_batch: null,
count: null,
},
],
};
export default {
components: { Pagination },
data() { data() {
return { return {
inventory: defaulteinventory, inventory: defaulteinventory,
outfifo: defaulteoutfifo,
dialogVisibleout: false,
fifoList: { fifoList: {
count: 0, count: 0,
}, },
@ -350,6 +475,7 @@
3: "采购入库", 3: "采购入库",
4: "生产入库", 4: "生产入库",
5: "其他入库", 5: "其他入库",
6:"其他出库",
}, },
inpur: {}, inpur: {},
listQuery: { listQuery: {
@ -357,6 +483,7 @@
page_size: 20, page_size: 20,
}, },
puorderoptions: [], puorderoptions: [],
materialbatchoptions: [],
warehouseData: [], warehouseData: [],
materialoptions: [], materialoptions: [],
vendoroptions: [], vendoroptions: [],
@ -365,7 +492,7 @@
dialogType: "new", dialogType: "new",
dialogVisibles: false, dialogVisibles: false,
rule1: { rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}], name: [{ required: true, message: "请输入", trigger: "blur" }],
}, },
}; };
}, },
@ -395,13 +522,13 @@
handleDetail(scope) { handleDetail(scope) {
this.$router.push({ this.$router.push({
name: "fifodetail", name: "fifodetail",
params: {id: scope.row.id, pu_order: scope.row.pu_order}, params: { id: scope.row.id, pu_order: scope.row.pu_order },
}); });
}, },
//供应商列表 //供应商列表
getListgys() { getListgys() {
getpVendorList({page: 0}).then((response) => { getpVendorList({ page: 0 }).then((response) => {
if (response.data) { if (response.data) {
this.vendoroptions = response.data; this.vendoroptions = response.data;
} }
@ -409,7 +536,7 @@
}, },
//采购订单 //采购订单
getpuorderList() { getpuorderList() {
getPuorderList({page: 0}).then((response) => { getPuorderList({ page: 0 }).then((response) => {
if (response.data) { if (response.data) {
this.puorderoptions = response.data; this.puorderoptions = response.data;
} }
@ -427,7 +554,7 @@
}, },
//仓库 //仓库
getlists() { getlists() {
getWarehouseList({page: 0}).then((response) => { getWarehouseList({ page: 0 }).then((response) => {
if (response.data) { if (response.data) {
this.warehouseData = genTree(response.data); this.warehouseData = genTree(response.data);
} }
@ -437,7 +564,18 @@
handlecgCreate() { handlecgCreate() {
this.dialogVisibles = true; this.dialogVisibles = true;
}, },
addConditions1() {
if (this.outfifo.details.length <= 10) {
this.outfifo.details.push({
material_batch: null,
count: null,
});
} else {
this.$message("最多可添加十项条件");
}
},
addConditions() { addConditions() {
if (this.inventory.details.length <= 10) { if (this.inventory.details.length <= 10) {
this.inventory.details.push({ this.inventory.details.push({
warehouse: "", //仓库 warehouse: "", //仓库
@ -452,16 +590,21 @@
deleteItem(index) { deleteItem(index) {
this.inventory.details.splice(index, 1); this.inventory.details.splice(index, 1);
}, },
deleteItem1(index) {
this.outfifo.details.splice(index, 1);
},
//物料 //物料
getmaterialList() { getmaterialList() {
this.listLoading = true; this.listLoading = true;
getMaterialList({pageoff: true}).then((response) => { getMaterialList({ pageoff: true }).then((response) => {
if (response.data) { if (response.data) {
this.materialoptions = genTree(response.data); this.materialoptions = genTree(response.data);
} }
this.listLoading = false; this.listLoading = false;
}); });
}, },
//其他入库
handleCreate() { handleCreate() {
this.inventory.details = [ this.inventory.details = [
{ {
@ -478,6 +621,38 @@
this.$refs["Form"].clearValidate(); this.$refs["Form"].clearValidate();
}); });
}, },
//其他出库
handleoutCreate() {
this.outfifo.details = [
{
material_batch: null,
count: null,
},
];
this.outfifo = Object.assign({}, defaulteoutfifo);
this.dialogVisibleout = true;
getmaterialbatchList({ page: 0 }).then((response) => {
if (response.data) {
this.materialbatchoptions = response.data;
}
});
this.$nextTick(() => {
this.$refs["Formout"].clearValidate();
});
},
confirmoutfifo() {
console.log(this.outfifo);
outOther(this.outfifo).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisibleout = false;
this.$message.success("成功");
}
});
},
//审核 //审核
handleAudit(scope) { handleAudit(scope) {
this.$confirm("是否通过?", "提示", { this.$confirm("是否通过?", "提示", {
@ -534,8 +709,11 @@
}, },
//装箱 //装箱
handlePack(scope) { handlePack(scope) {
this.$router.push({name: "salesdetail", params: {id: scope.row.sale},}) this.$router.push({
} name: "salesdetail",
params: { id: scope.row.sale },
});
}, },
}; },
};
</script> </script>

View File

@ -95,7 +95,7 @@
</el-card> </el-card>
<el-dialog <el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:title="dialogType === 'edit' ? '编辑设备' : '新增设备'" :title="dialogType === 'edit' ? '编辑供应商' : '新增供应商'"
> >
<el-form <el-form
ref="Form" ref="Form"

View File

@ -49,6 +49,9 @@
</el-table-column> </el-table-column>
<el-table-column label="生产数量" > <el-table-column label="生产数量" >
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="状态" width="110">
<template slot-scope="scope">{{ state_[scope.row.state] }}</template>
</el-table-column> </el-table-column>
<el-table-column label="计划开工时间" > <el-table-column label="计划开工时间" >
<template slot-scope="scope">{{ scope.row.start_date }}</template> <template slot-scope="scope">{{ scope.row.start_date }}</template>
@ -88,6 +91,16 @@ export default {
productionplan:"", productionplan:"",
orderdetail:"", orderdetail:"",
state_: {
10: "制定中",
20: "已下达",
30: "已接受",
40: "生产中",
50: "已完成",
60: "军检完成",
70: "暂停",
80: "终止",
},
}; };
}, },

View File

@ -76,7 +76,7 @@
<el-table-column label="装箱单号" show-overflow-tooltip> <el-table-column label="装箱单号" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.packnum }}</template> <template slot-scope="scope">{{ scope.row.packnum }}</template>
</el-table-column> </el-table-column>
<el-table-column label="未装箱说明" show-overflow-tooltip> <el-table-column label="备注" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.remark }}</template> <template slot-scope="scope">{{ scope.row.remark }}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">

View File

@ -4,7 +4,7 @@ from rest_framework.response import Response
from celery import shared_task from celery import shared_task
import os import os
import subprocess import subprocess
from server.settings_pro import DATABASES, BACKUP_DATABASE_PATH from server.settings_pro import DATABASES, BACKUP_PATH, SH_PATH
@shared_task @shared_task
def backup_database(): def backup_database():
@ -17,14 +17,14 @@ def backup_database():
DATABASES['default']['USER'], DATABASES['default']['USER'],
DATABASES['default']['PASSWORD'], DATABASES['default']['PASSWORD'],
DATABASES['default']['NAME'], DATABASES['default']['NAME'],
BACKUP_DATABASE_PATH, BACKUP_PATH + '/database',
name) name)
completed = subprocess.run(command, shell=True, capture_output=True, text=True) completed = subprocess.run(command, shell=True, capture_output=True, text=True)
return completed return completed
@shared_task @shared_task
def reload_server(): def reload_server():
command = 'bash /home/lighthouse/hberp/hb_server/sh/git.sh' command = 'bash {}/git.sh'.format(SH_PATH)
completed = subprocess.run(command, shell=True, capture_output=True, text=True) completed = subprocess.run(command, shell=True, capture_output=True, text=True)
return completed return completed
@ -36,7 +36,7 @@ def reload_server_only():
@shared_task @shared_task
def backup_media(): def backup_media():
command = 'bash /home/lighthouse/hberp/hb_server/sh/backup_media.sh' command = 'bash {}/backup_media.sh'.format(SH_PATH)
completed = subprocess.run(command, shell=True, capture_output=True, text=True) completed = subprocess.run(command, shell=True, capture_output=True, text=True)
return completed return completed

View File

@ -17,11 +17,13 @@ class Equipment(CommonAModel):
EQUIP_STATE_LIMIT = 20 EQUIP_STATE_LIMIT = 20
EQUIP_STATE_FIX = 30 EQUIP_STATE_FIX = 30
EQUIP_STATE_DISABLE = 40 EQUIP_STATE_DISABLE = 40
EQUIP_STATE_scrap = 50
state_choices = ( state_choices = (
(EQUIP_STATE_OK, '完好'), (EQUIP_STATE_OK, '完好'),
(EQUIP_STATE_LIMIT, '限用'), (EQUIP_STATE_LIMIT, '限用'),
(EQUIP_STATE_FIX, '在修'), (EQUIP_STATE_FIX, '在修'),
(EQUIP_STATE_DISABLE, '禁用') (EQUIP_STATE_DISABLE, '禁用'),
(EQUIP_STATE_scrap, '报废')
) )
state2_choices = ( state2_choices = (

View File

@ -69,12 +69,14 @@ class FIFO(CommonADModel):
FIFO_TYPE_PUR_IN = 3 FIFO_TYPE_PUR_IN = 3
FIFO_TYPE_DO_IN = 4 FIFO_TYPE_DO_IN = 4
FIFO_TYPE_OTHER_IN = 5 FIFO_TYPE_OTHER_IN = 5
FIFO_TYPE_OTHER_OUT = 6
type_choices = ( type_choices = (
(FIFO_TYPE_DO_OUT, '生产领料'), (FIFO_TYPE_DO_OUT, '生产领料'),
(FIFO_TYPE_SALE_OUT, '销售提货'), (FIFO_TYPE_SALE_OUT, '销售提货'),
(FIFO_TYPE_PUR_IN, '采购入库'), (FIFO_TYPE_PUR_IN, '采购入库'),
(FIFO_TYPE_DO_IN, '生产入库'), (FIFO_TYPE_DO_IN, '生产入库'),
(FIFO_TYPE_OTHER_IN, '其他入库') (FIFO_TYPE_OTHER_IN, '其他入库'),
(FIFO_TYPE_OTHER_OUT, '其他出库')
) )
number = models.CharField('记录编号', max_length=100) number = models.CharField('记录编号', max_length=100)
type = models.IntegerField('出入库类型', default=1) type = models.IntegerField('出入库类型', default=1)

View File

@ -77,23 +77,31 @@ class FIFOListSerializer(serializers.ModelSerializer):
fields = '__all__' fields = '__all__'
class FIFOItemCreateSerializer(serializers.ModelSerializer): class FIFOItemCreateSerializer(serializers.ModelSerializer):
material_batch = serializers.PrimaryKeyRelatedField(queryset=MaterialBatch.objects.all(), label="物料批次ID", required=False)
class Meta: class Meta:
model = FIFOItem model = FIFOItem
fields = ['warehouse', fields = ['warehouse',
'material', 'batch', 'fifo', 'files', 'pu_order_item', 'count', 'expiration_date'] 'material', 'batch', 'fifo', 'files', 'pu_order_item', 'count', 'expiration_date', 'material_batch']
def create(self, validated_data): def create(self, validated_data):
fifo = validated_data['fifo'] fifo = validated_data['fifo']
if fifo.is_audited: if fifo.is_audited:
raise ValidationError('该出入库记录已审核') raise ValidationError('该出入库记录已审核')
pu_order_item = validated_data.get('pu_order_item', None) pu_order_item = validated_data.get('pu_order_item', None)
if pu_order_item: material_batch = validated_data.pop('material_batch', None)
if fifo.type == FIFO.FIFO_TYPE_PUR_IN and pu_order_item is None:
raise ValidationError('采购入库需关联采购项')
else:
if fifo.pu_order != pu_order_item.pu_order: if fifo.pu_order != pu_order_item.pu_order:
raise ValidationError('项目与采购订单不一致') raise ValidationError('项目与采购订单不一致')
validated_data['material']=pu_order_item.material validated_data['material']=pu_order_item.material
if fifo.type == FIFO.FIFO_TYPE_OTHER_OUT and material_batch is None:
raise ValidationError('其他出库需关联批次号')
else: else:
if fifo.pu_order is not None: validated_data['material'] = material_batch.material
raise ValidationError('非采购订单') validated_data['batch'] = material_batch.batch
validated_data['warehouse'] = material_batch.warehouse
return super().create(validated_data) return super().create(validated_data)
def validate_batch(self, value): def validate_batch(self, value):
@ -106,7 +114,7 @@ class FIFOItemCreateSerializer(serializers.ModelSerializer):
class FIFOItemUpdateSerializer(serializers.ModelSerializer): class FIFOItemUpdateSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = FIFOItem model = FIFOItem
fields = ['warehouse', 'batch', 'files', 'count', 'expiration_date'] fields = ['files', 'count', 'expiration_date']
class FIFOItemSerializer(serializers.ModelSerializer): class FIFOItemSerializer(serializers.ModelSerializer):
warehouse_ = WareHouseSimpleSerializer(source='warehouse', read_only=True) warehouse_ = WareHouseSimpleSerializer(source='warehouse', read_only=True)
@ -142,11 +150,41 @@ class MaterialBatchQuerySerializer(serializers.Serializer):
warehouse = serializers.IntegerField(label="仓库ID", required=False) warehouse = serializers.IntegerField(label="仓库ID", required=False)
materials = serializers.ListField(child=serializers.IntegerField(label="物料ID"), required=False) materials = serializers.ListField(child=serializers.IntegerField(label="物料ID"), required=False)
class FIFODetailOutOtherSerializer(serializers.Serializer):
material_batch = serializers.PrimaryKeyRelatedField(queryset=MaterialBatch.objects.all(), label="物料批次ID")
count = serializers.IntegerField(label="数量", min_value=0)
class FIFOOutOtherSerializer(serializers.ModelSerializer):
"""
其他出库序列化
"""
details = FIFODetailOutOtherSerializer(many=True, required=True)
class Meta:
model = FIFO
fields = ['details']
def create(self, validated_data):
details = validated_data.pop('details')
with transaction.atomic():
validated_data['type'] = FIFO.FIFO_TYPE_OTHER_OUT
validated_data['number'] = 'CK' + ranstr(7)
obj = FIFO(**validated_data)
obj.save()
for i in details:
mb = i.pop('material_batch')
i['material'] = mb.material
i['batch'] = mb.batch
i['warehouse'] = mb.warehouse
i['fifo'] = obj
FIFOItem.objects.create(**i)
return obj
class FIFOInOtherSerializer(serializers.ModelSerializer): class FIFOInOtherSerializer(serializers.ModelSerializer):
""" """
其他入库序列化 其他入库序列化
""" """
details = FIFODetailInPurSerializer(many=True, required=False) details = FIFODetailInPurSerializer(many=True, required=True)
vendor = serializers.PrimaryKeyRelatedField(label='供应商ID', vendor = serializers.PrimaryKeyRelatedField(label='供应商ID',
queryset=Vendor.objects.all()) queryset=Vendor.objects.all())
class Meta: class Meta:

View File

@ -59,7 +59,7 @@ class InmService:
pu_order_item.delivered_count = delivered_count pu_order_item.delivered_count = delivered_count
pu_order_item.save() pu_order_item.save()
elif instance.type in [FIFO.FIFO_TYPE_DO_OUT, FIFO.FIFO_TYPE_SALE_OUT]: # 生产领料 销售出库 elif instance.type in [FIFO.FIFO_TYPE_DO_OUT, FIFO.FIFO_TYPE_SALE_OUT, FIFO.FIFO_TYPE_OTHER_OUT]: # 生产领料 销售出库
# 更新相关表 # 更新相关表
for i in FIFOItem.objects.filter(fifo=instance): for i in FIFOItem.objects.filter(fifo=instance):
material = i.material material = i.material

View File

@ -6,7 +6,7 @@ from rest_framework.viewsets import GenericViewSet, ModelViewSet
from apps.inm.filters import IProductFilterSet, MbFilterSet from apps.inm.filters import IProductFilterSet, MbFilterSet
from apps.inm.models import FIFO, FIFOItem, IProduct, MaterialBatch, WareHouse, Inventory from apps.inm.models import FIFO, FIFOItem, IProduct, MaterialBatch, WareHouse, Inventory
from apps.inm.serializers import FIFOInOtherSerializer, FIFOItemCreateSerializer, FIFOItemSerializer, FIFOInPurSerializer, FIFOItemUpdateSerializer, FIFOListSerializer, IProductListSerializer, \ from apps.inm.serializers import FIFOInOtherSerializer, FIFOItemCreateSerializer, FIFOItemSerializer, FIFOInPurSerializer, FIFOItemUpdateSerializer, FIFOListSerializer, FIFOOutOtherSerializer, IProductListSerializer, \
InmTestRecordCreateSerializer, MaterialBatchQuerySerializer, MaterialBatchSerializer, WareHouseSerializer, \ InmTestRecordCreateSerializer, MaterialBatchQuerySerializer, MaterialBatchSerializer, WareHouseSerializer, \
WareHouseCreateUpdateSerializer, InventorySerializer WareHouseCreateUpdateSerializer, InventorySerializer
from apps.inm.services import InmService from apps.inm.services import InmService
@ -183,6 +183,17 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
serializer.save(create_by=request.user) serializer.save(create_by=request.user)
return Response() return Response()
@action(methods=['post'], detail=False, perms_map={'post': 'fifo_out_other'},
serializer_class=FIFOOutOtherSerializer)
def out_other(self, request, pk=None):
"""
其他出库
"""
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
serializer.save(create_by=request.user)
return Response()
@action(methods=['post'], detail=True, perms_map={'post': 'fifo_audit'}, serializer_class=serializers.Serializer) @action(methods=['post'], detail=True, perms_map={'post': 'fifo_audit'}, serializer_class=serializers.Serializer)
@transaction.atomic @transaction.atomic
def audit(self, request, pk=None): def audit(self, request, pk=None):

View File

@ -44,7 +44,6 @@ class RbacPermission(BasePermission):
perms = cache.get(request.user.username + '__perms') perms = cache.get(request.user.username + '__perms')
if not perms: if not perms:
perms = get_permission_list(request.user) perms = get_permission_list(request.user)
if 'admin' in perms: if 'admin' in perms:
return True return True
elif not hasattr(view, 'perms_map'): elif not hasattr(view, 'perms_map'):