Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
d5d5799b92
|
@ -28,6 +28,15 @@ export function deleteCustomer(id, data) {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function getCustomer(id) {
|
||||||
|
return request({
|
||||||
|
url: `/sam/customer/${id}/`,
|
||||||
|
method: 'get',
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//合同
|
//合同
|
||||||
export function getContractList(query) {
|
export function getContractList(query) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -170,4 +179,27 @@ export function saleAudit(id) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//返回装箱文件
|
||||||
|
export function gePack(id) {
|
||||||
|
return request({
|
||||||
|
url: `/sam/sale_product/${id}/pack/`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//打包装箱文件确认
|
||||||
|
export function subPack(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/sam/sale_product/${id}/pack/`,
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
///未装箱备注
|
||||||
|
export function notPackremark(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/sam/sale_product/${id}/remark/`,
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -70,6 +70,12 @@
|
||||||
<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="scope.row.type==2"
|
||||||
|
type="primary"
|
||||||
|
@click="handlePack(scope)"
|
||||||
|
>装箱</el-link
|
||||||
|
>
|
||||||
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_update'])"
|
v-if="checkPermission(['warehouse_update'])"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleDetail(scope)"
|
@click="handleDetail(scope)"
|
||||||
|
@ -494,6 +500,11 @@ export default {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//装箱
|
||||||
|
handlePack(scope)
|
||||||
|
{
|
||||||
|
this.$router.push({name: "salesdetail", params: { id: scope.row.sale }, })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
scope.row.not_work_remark
|
scope.row.not_work_remark
|
||||||
}}</template>
|
}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="打卡时间">
|
||||||
|
<template slot-scope="scope">{{ scope.row.last_check_time }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column align="header-center" label="部门">
|
<el-table-column align="header-center" label="部门">
|
||||||
<template v-if="scope.row.dept_" slot-scope="scope">{{
|
<template v-if="scope.row.dept_" slot-scope="scope">{{
|
||||||
|
@ -135,9 +138,9 @@
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-calendar v-model="value">
|
<el-calendar v-model="value">
|
||||||
<template slot="dateCell" slot-scope="{ date, data }">
|
<template slot="dateCell" slot-scope="{ date, data }">
|
||||||
<p>
|
<p >
|
||||||
{{ data.day.split("-").slice(1).join("-") }}<br />
|
{{ data.day.split("-").slice(1).join("-") }}<br />
|
||||||
{{ dealMyDate(data.day) }}
|
{{ dealMyDate(data.day) }}
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
</el-calendar>
|
</el-calendar>
|
||||||
|
@ -219,7 +222,7 @@ export default {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
//今日到岗
|
//今日到岗
|
||||||
getList() {
|
getList() {
|
||||||
this.listQuery.fields = "number,name,is_atwork,dept_,id,not_work_remark";
|
this.listQuery.fields = "number,name,is_atwork,dept_,id,not_work_remark,last_check_time";
|
||||||
getEmployeeList(this.listQuery).then((response) => {
|
getEmployeeList(this.listQuery).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.userList = response.data;
|
this.userList = response.data;
|
||||||
|
|
|
@ -2,85 +2,114 @@
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div>
|
<div>
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||||
>新增销售记录</el-button
|
>新增销售发货</el-button
|
||||||
>
|
>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="listQuery.search"
|
v-model="listQuery.search"
|
||||||
placeholder="客户名称"
|
placeholder="客户名称"
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
@keyup.enter.native="handleFilter"
|
@keyup.enter.native="handleFilter"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
@click="handleFilter"
|
@click="handleFilter"
|
||||||
>搜索</el-button
|
>搜索</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-refresh-left"
|
icon="el-icon-refresh-left"
|
||||||
@click="resetFilter"
|
@click="resetFilter"
|
||||||
>重置</el-button
|
>重置</el-button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card >
|
<el-card>
|
||||||
<el-table
|
<el-table
|
||||||
|
|
||||||
:data="saleList.results"
|
:data="saleList.results"
|
||||||
border
|
border
|
||||||
fit
|
fit
|
||||||
stripe
|
stripe
|
||||||
highlight-current-row
|
highlight-current-row
|
||||||
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="产品名称" show-overflow-tooltip>
|
<el-table-column label="产品名称" show-overflow-tooltip>
|
||||||
<template slot-scope="scope" v-if="scope.row.product">{{ scope.row.product_.name }}</template>
|
<template slot-scope="scope" v-if="scope.row.product">{{
|
||||||
|
scope.row.product_.name
|
||||||
|
}}</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" v-if="scope.row.product">{{ scope.row.product_.specification }}</template>
|
<template slot-scope="scope" v-if="scope.row.product">{{
|
||||||
|
scope.row.product_.specification
|
||||||
|
}}</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" v-if="scope.row.customer">{{ scope.row.customer_.name }}</template>
|
<template slot-scope="scope" v-if="scope.row.customer">{{
|
||||||
|
scope.row.customer_.name
|
||||||
|
}}</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" v-if="scope.row.order">{{ scope.row.order_.number }}</template>
|
<template slot-scope="scope" v-if="scope.row.order">{{
|
||||||
|
scope.row.order_.number
|
||||||
|
}}</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" v-if="scope.row.order_">{{ scope.row.order_.contract_.name }}</template>
|
<template slot-scope="scope" v-if="scope.row.order_">{{
|
||||||
|
scope.row.order_.contract_.name
|
||||||
|
}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="是否审核" >
|
<el-table-column label="预计发货时间">
|
||||||
<template slot-scope="scope" > <el-tag v-if="scope.row.is_audited == false">否</el-tag>
|
<template slot-scope="scope">{{ scope.row.edelivery_date }}</template>
|
||||||
<el-tag v-else>是</el-tag></template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="预计发货数量">
|
||||||
<el-table-column>
|
<template slot-scope="scope">{{ scope.row.count }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="实际发货数量">
|
||||||
|
<template slot-scope="scope">{{ scope.row.count_real }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否审核">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link
|
<el-tag v-if="scope.row.is_audited == false">否</el-tag>
|
||||||
|
<el-tag v-else>是</el-tag></template
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="收货人">
|
||||||
|
<template slot-scope="scope">{{ scope.row.receiver }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="收货人电话">
|
||||||
|
<template slot-scope="scope">{{ scope.row.receiver_phone }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="收货人地址" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">{{
|
||||||
|
scope.row.receiver_address
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" fixed="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
v-if="checkPermission(['warehouse_delete'])"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleDetail(scope)"
|
@click="handleDetail(scope)"
|
||||||
>详情</el-link
|
>详情</el-link
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="scope.row.is_audited==false"
|
v-if="scope.row.is_audited == false"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleAudit(scope)"
|
@click="handleAudit(scope)"
|
||||||
>审核</el-link
|
>审核</el-link
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="scope.row.is_audited==false"
|
v-if="scope.row.is_audited == false"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click="handleDelete(scope)"
|
@click="handleDelete(scope)"
|
||||||
>删除</el-link
|
>删除</el-link
|
||||||
|
@ -100,98 +129,151 @@
|
||||||
:visible.sync="dialogVisible"
|
:visible.sync="dialogVisible"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
width="60%"
|
width="60%"
|
||||||
:title="dialogType === 'edit' ? '编辑销售信息' : '新增销售信息'"
|
:title="dialogType === 'edit' ? '编辑销售发货' : '新增销售发货'"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
ref="Form"
|
ref="Form"
|
||||||
:model="sale"
|
:model="sale"
|
||||||
label-width="80px"
|
label-width="100px"
|
||||||
label-position="right"
|
label-position="right"
|
||||||
|
|
||||||
|
|
||||||
>
|
>
|
||||||
<el-form-item label="关联订单" prop="name">
|
<el-form-item label="关联订单" prop="name">
|
||||||
<el-select style="width: 100%" v-model="sale.order" @change="selectorder" placeholder="请选择">
|
<el-select
|
||||||
<el-option
|
style="width: 100%"
|
||||||
v-for="item in orderoptions"
|
v-model="sale.order"
|
||||||
:key="item.id"
|
@change="selectorder"
|
||||||
:label="item.number"
|
placeholder="请选择"
|
||||||
:value="item.id">
|
>
|
||||||
</el-option>
|
<el-option
|
||||||
|
v-for="item in orderoptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.number"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="关联客户" prop="customer">
|
<el-form-item label="关联客户" prop="customer">
|
||||||
<el-select style="width: 100%" v-model="sale.customer" placeholder="请选择">
|
<el-select
|
||||||
<el-option
|
style="width: 100%"
|
||||||
v-for="item in customeroptions"
|
v-model="sale.customer"
|
||||||
:key="item.id"
|
@change="selectcustomer"
|
||||||
:label="item.name"
|
placeholder="请选择"
|
||||||
:value="item.id">
|
>
|
||||||
</el-option>
|
<el-option
|
||||||
|
v-for="item in customeroptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="关联合同" prop="contract">
|
||||||
|
<el-input v-model="sale.contract" placeholder="关联合同" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="所需产品" prop="product">
|
||||||
<el-form-item label="所需产品" prop="product">
|
<el-select
|
||||||
<el-select style="width: 100%" v-model="sale.product" @change="selectproduct" placeholder="请选择">
|
style="width: 100%"
|
||||||
<el-option
|
v-model="sale.product"
|
||||||
v-for="item in materialoptions"
|
@change="selectproduct"
|
||||||
:key="item.id"
|
placeholder="请选择"
|
||||||
:label="item.name"
|
>
|
||||||
:value="item.id">
|
<el-option
|
||||||
</el-option>
|
v-for="item in materialoptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="选择产品" prop="iproducts">
|
<el-form-item label="选择产品" prop="iproducts">
|
||||||
|
<el-table
|
||||||
|
:data="iproductoptions"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
stripe
|
||||||
|
highlight-current-row
|
||||||
|
ref="multipleTable"
|
||||||
|
height="200"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55"> </el-table-column>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="成品编号">
|
||||||
|
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table
|
<el-table-column label="成品批次">
|
||||||
|
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="成品名称">
|
||||||
|
<template slot-scope="scope">{{
|
||||||
|
scope.row.material_.name
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
:data="iproductoptions"
|
<el-table-column label="所在仓库">
|
||||||
border
|
<template slot-scope="scope">{{
|
||||||
fit
|
scope.row.warehouse_.name
|
||||||
stripe
|
}}</template>
|
||||||
highlight-current-row
|
</el-table-column>
|
||||||
ref="multipleTable"
|
<el-table-column label="是否已军检">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
|
||||||
|
<el-tag v-else>已军检</el-tag></template
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
>
|
<el-form-item label="预计发货时间" prop="edelivery_date">
|
||||||
<el-table-column
|
<el-date-picker
|
||||||
type="selection"
|
v-model="sale.edelivery_date"
|
||||||
width="55">
|
type="date"
|
||||||
</el-table-column>
|
placeholder="选择日期"
|
||||||
<el-table-column type="index" width="50" />
|
value-format="yyyy-MM-dd"
|
||||||
<el-table-column label="成品编号">
|
style="width: 100%"
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
>
|
||||||
</el-table-column>
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-table-column label="成品批次">
|
<el-form-item label="运输方式" prop="trans_mode">
|
||||||
<template slot-scope="scope">{{ scope.row.batch }}</template>
|
<el-select
|
||||||
</el-table-column>
|
style="width: 100%"
|
||||||
<el-table-column label="成品名称">
|
v-model="sale.trans_mode"
|
||||||
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
|
placeholder="请选择"
|
||||||
</el-table-column>
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-table-column label="所在仓库">
|
<el-form-item label="收货人" prop="receiver">
|
||||||
<template slot-scope="scope">{{ scope.row.warehouse_.name }}</template>
|
<el-input v-model="sale.receiver" placeholder="收货人" />
|
||||||
</el-table-column>
|
</el-form-item>
|
||||||
<el-table-column label="是否已军检">
|
<el-form-item label="联系电话" prop="receiver_phone">
|
||||||
<template slot-scope="scope">
|
<el-input
|
||||||
|
v-model="sale.receiver_phone"
|
||||||
|
placeholder="收货人联系电话"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="收货地址" prop="receiver_address">
|
||||||
|
<el-input v-model="sale.receiver_address" placeholder="收货地址" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
|
<el-input v-model="sale.remark" placeholder="备注" />
|
||||||
<el-tag v-else>已军检</el-tag></template>
|
</el-form-item>
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-table>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
||||||
|
@ -200,132 +282,177 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { createSale,getOrderList,getCustomerList,getSaleList,getOrder,deleteSale,getSale,saleAudit} from "@/api/sam";
|
import {
|
||||||
|
createSale,
|
||||||
|
getOrderList,
|
||||||
|
getCustomerList,
|
||||||
|
getSaleList,
|
||||||
|
getOrder,
|
||||||
|
deleteSale,
|
||||||
|
getSale,
|
||||||
|
saleAudit,
|
||||||
|
getCustomer
|
||||||
|
} from "@/api/sam";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
import { getMaterialList } from "@/api/mtm";
|
import { getMaterialList } from "@/api/mtm";
|
||||||
import { getiproductList,} from "@/api/inm";
|
import { getiproductList } from "@/api/inm";
|
||||||
import { genTree } from "@/utils";
|
import { genTree } from "@/utils";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
const defaulteSale = {
|
const defaulteSale = {
|
||||||
order:null,
|
order: null,
|
||||||
customer:null,
|
customer: null,
|
||||||
product:null
|
contract:"",
|
||||||
|
product: null,
|
||||||
|
edelivery_date: "",
|
||||||
|
trans_mode: null,
|
||||||
|
receiver: "",
|
||||||
|
receiver_phone: "",
|
||||||
|
receiver_address: "",
|
||||||
|
remark: "",
|
||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
sale: defaulteSale,
|
sale: defaulteSale,
|
||||||
saleList: {
|
saleList: {
|
||||||
count: 0,
|
count: 0,
|
||||||
},
|
},
|
||||||
listQuery: {
|
listQuery: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
iproducts:[],
|
iproducts: [],
|
||||||
orderoptions:[],
|
orderoptions: [],
|
||||||
customeroptions:[],
|
customeroptions: [],
|
||||||
materialoptions:[],
|
materialoptions: [],
|
||||||
iproductoptions:[],
|
iproductoptions: [],
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogType: "new",
|
dialogType: "new",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
value: 10,
|
||||||
|
label: "铁路快运",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 20,
|
||||||
|
label: "铁路慢运",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 30,
|
||||||
|
label: "铁路整车",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 40,
|
||||||
|
label: "汽车运输",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 50,
|
||||||
|
label: "空运",
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getCustomerLists();
|
this.getCustomerLists();
|
||||||
// this.getproductList();
|
// this.getproductList();
|
||||||
this.getOrderLists();
|
this.getOrderLists();
|
||||||
this.getMaterialList();
|
this.getMaterialList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
//关联订单
|
//关联订单
|
||||||
getOrderLists() {
|
getOrderLists() {
|
||||||
|
getOrderList({ page: 0 }).then((response) => {
|
||||||
getOrderList({page:0}).then((response) => {
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.orderoptions = response.data;
|
this.orderoptions = response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//选择订单变化
|
//选择订单变化
|
||||||
|
|
||||||
selectorder(selval)
|
selectorder(selval) {
|
||||||
{
|
|
||||||
getOrder(selval).then((response) => {
|
getOrder(selval).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.sale.customer = response.data.customer;
|
this.sale.customer = response.data.customer;
|
||||||
this.sale.product = response.data.product;
|
this.sale.product = response.data.product;
|
||||||
getiproductList({page:0,to_order:response.data.id}).then((response) => {
|
this.sale.contract = response.data.contract_.name;
|
||||||
|
this.sale.receiver = response.data.customer_.contact;
|
||||||
|
this.sale.receiver_phone = response.data.customer_.contact_phone;
|
||||||
|
this.sale.receiver_address = response.data.customer_.address;
|
||||||
|
|
||||||
|
getiproductList({
|
||||||
|
page: 0,
|
||||||
|
to_order: response.data.id,
|
||||||
|
state: 10,
|
||||||
|
}).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
this.iproductoptions = response.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
selectcustomer(selval)
|
||||||
|
{
|
||||||
|
getCustomer(selval).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.iproductoptions=response.data;
|
this.sale.receiver = response.data.contact;
|
||||||
}
|
this.sale.receiver_phone = response.data.contact_phone;
|
||||||
|
this.sale.receiver_address = response.data.address;
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
|
|
||||||
getSaleList(this.listQuery).then((response) => {
|
getSaleList(this.listQuery).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.saleList = response.data;
|
this.saleList = response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//关联客户
|
//关联客户
|
||||||
getCustomerLists() {
|
getCustomerLists() {
|
||||||
|
getCustomerList({ page: 0 }).then((response) => {
|
||||||
getCustomerList({page:0,}).then((response) => {
|
this.customeroptions = response.data;
|
||||||
|
|
||||||
this.customeroptions = response.data;
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
//选择产品
|
//选择产品
|
||||||
getMaterialList()
|
getMaterialList() {
|
||||||
{
|
getMaterialList({ type: 1, page: 0 }).then((response) => {
|
||||||
getMaterialList({type:1,page:0}).then((response) => {
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.materialoptions = response.data;
|
this.materialoptions = response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//成品
|
||||||
|
// getproductList() {
|
||||||
|
|
||||||
//成品
|
// getiproductList({page:0,material__type:1}).then((response) => {
|
||||||
// getproductList() {
|
// if (response.data) {
|
||||||
|
// this.iproductoptions=response.data;
|
||||||
// getiproductList({page:0,material__type:1}).then((response) => {
|
// }
|
||||||
// if (response.data) {
|
|
||||||
// this.iproductoptions=response.data;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
//根据选择的产品弹出对应库里的产品
|
//根据选择的产品弹出对应库里的产品
|
||||||
selectproduct(){
|
selectproduct() {
|
||||||
getiproductList({page:0,material__type:1,material:this.sale.product}).then((response) => {
|
getiproductList({
|
||||||
|
page: 0,
|
||||||
|
material__type: 1,
|
||||||
|
material: this.sale.product,
|
||||||
|
}).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.iproductoptions=response.data;
|
this.iproductoptions = response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
handleFilter() {
|
handleFilter() {
|
||||||
this.listQuery.page = 1;
|
this.listQuery.page = 1;
|
||||||
|
@ -335,17 +462,17 @@ selectproduct(){
|
||||||
this.listQuery = {
|
this.listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
}
|
};
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
handleCreate() {
|
handleCreate() {
|
||||||
this.sale = Object.assign({}, defaulteSale);
|
this.sale = Object.assign({}, defaulteSale);
|
||||||
this.dialogType = "new";
|
this.dialogType = "new";
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.iproducts=[];
|
this.iproducts = [];
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["Form"].resetFields();
|
this.$refs["Form"].resetFields();
|
||||||
this.iproductoptions=[];
|
this.iproductoptions = [];
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -387,21 +514,15 @@ selectproduct(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
this.$refs.multipleTable.selection.forEach((item) => {
|
||||||
|
this.iproducts.push(item.id);
|
||||||
|
});
|
||||||
|
|
||||||
this.$refs.multipleTable.selection.forEach((item) => {
|
this.sale.iproducts = this.iproducts;
|
||||||
this.iproducts.push(
|
|
||||||
item.id
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.sale.iproducts=this.iproducts;
|
|
||||||
createSale(this.sale).then((res) => {
|
createSale(this.sale).then((res) => {
|
||||||
if (res.code >= 200) {
|
if (res.code >= 200) {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
this.$message.success("成功");
|
this.$message.success("成功");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -413,32 +534,27 @@ selectproduct(){
|
||||||
},
|
},
|
||||||
|
|
||||||
//销售详情
|
//销售详情
|
||||||
handleDetail(scope){
|
handleDetail(scope) {
|
||||||
|
this.$router.push({ name: "salesdetail", params: { id: scope.row.id } });
|
||||||
this.$router.push({name: "salesdetail", params: { id: scope.row.id }, })
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//审核
|
//审核
|
||||||
handleAudit(scope){
|
handleAudit(scope) {
|
||||||
saleAudit(scope.row.id).then((res) => {
|
saleAudit(scope.row.id).then((res) => {
|
||||||
|
|
||||||
if (res.code >= 200) {
|
if (res.code >= 200) {
|
||||||
|
this.$message.success("审核成功成功");
|
||||||
this.$message.success("审核成功成功");
|
this.getList();
|
||||||
this.getList();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.trdiv >>> .el-transfer-panel{
|
.trdiv >>> .el-transfer-panel {
|
||||||
width:350px;
|
width: 350px;
|
||||||
}
|
}
|
||||||
.trdiv >>> .el-transfer__buttons{
|
.trdiv >>> .el-transfer__buttons {
|
||||||
width:110px
|
width: 110px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,131 +1,257 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|
||||||
<el-card style="margin-top: 2px">
|
<el-card style="margin-top: 2px">
|
||||||
<el-descriptions title="基本信息" direction="vertical" :column="8" border>
|
<el-descriptions title="基本信息" direction="vertical" :column="8" border>
|
||||||
<el-descriptions-item label="客户名称" v-if="salesdetail.customer"> {{salesdetail.customer_.name}}</el-descriptions-item>
|
<el-descriptions-item label="客户名称" v-if="salesdetail.customer">
|
||||||
<el-descriptions-item label="产品名称" v-if="salesdetail.product"> {{salesdetail.product_.name}}</el-descriptions-item>
|
{{ salesdetail.customer_.name }}</el-descriptions-item
|
||||||
<el-descriptions-item label="产品型号" :span="2" v-if="salesdetail.product"> {{salesdetail.product_.specification}}</el-descriptions-item>
|
|
||||||
<el-descriptions-item label="订单编号" v-if="salesdetail.order"> {{salesdetail.order_.number}} </el-descriptions-item>
|
|
||||||
<el-descriptions-item label="合同名称" v-if="salesdetail.order"> {{salesdetail.order_.contract_.name}}</el-descriptions-item>
|
|
||||||
</el-descriptions>
|
|
||||||
<el-card class="box-card">
|
|
||||||
<div slot="header" class="clearfix">
|
|
||||||
<span>关联产品信息</span>
|
|
||||||
</div>
|
|
||||||
<el-table
|
|
||||||
ref="singleTable"
|
|
||||||
:data="saleproduct"
|
|
||||||
highlight-current-row
|
|
||||||
style="width: 100%">
|
|
||||||
|
|
||||||
|
|
||||||
<el-table-column type="index" width="50" />
|
|
||||||
<el-table-column label="产品编号" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope">{{ scope.row.number }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="产品名称" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope" >{{ scope.row.iproduct_.material_.name }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="批次" >
|
|
||||||
<template slot-scope="scope" >{{ scope.row.iproduct_.batch }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="仓库">
|
|
||||||
<template slot-scope="scope">{{ scope.row.iproduct_.warehouse_.name }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="是否已军检">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
|
|
||||||
|
|
||||||
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
|
|
||||||
<el-tag v-else>已军检</el-tag></template>
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="军检">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
|
|
||||||
|
|
||||||
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
|
|
||||||
<el-tag v-else>合格</el-tag></template>
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
align="center"
|
|
||||||
label="操作"
|
|
||||||
width="220px"
|
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<el-descriptions-item label="产品名称" v-if="salesdetail.product">
|
||||||
|
{{ salesdetail.product_.name }}</el-descriptions-item
|
||||||
|
>
|
||||||
|
<el-descriptions-item
|
||||||
|
label="产品型号"
|
||||||
|
:span="2"
|
||||||
|
v-if="salesdetail.product"
|
||||||
|
>
|
||||||
|
{{ salesdetail.product_.specification }}</el-descriptions-item
|
||||||
|
>
|
||||||
|
<el-descriptions-item label="订单编号" v-if="salesdetail.order">
|
||||||
|
{{ salesdetail.order_.number }}
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="合同名称" v-if="salesdetail.order">
|
||||||
|
{{ salesdetail.order_.contract_.name }}</el-descriptions-item
|
||||||
|
>
|
||||||
|
</el-descriptions>
|
||||||
|
<el-card class="box-card">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>关联产品信息</span>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
ref="singleTable"
|
||||||
|
:data="saleproduct"
|
||||||
|
highlight-current-row
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="产品编号" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">{{ scope.row.number }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="产品名称" show-overflow-tooltip>
|
||||||
<el-link
|
<template slot-scope="scope">{{
|
||||||
v-if="checkPermission(['warehouse_delete'])"
|
scope.row.iproduct_.material_.name
|
||||||
type="danger"
|
}}</template>
|
||||||
@click="handleDelete(scope)"
|
</el-table-column>
|
||||||
>删除</el-link
|
<el-table-column label="批次">
|
||||||
|
<template slot-scope="scope">{{
|
||||||
|
scope.row.iproduct_.batch
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="仓库">
|
||||||
|
<template slot-scope="scope">{{
|
||||||
|
scope.row.iproduct_.warehouse_.name
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="是否已军检">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
|
||||||
|
<el-tag v-else>已军检</el-tag></template
|
||||||
>
|
>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
</el-table>
|
<el-table-column label="军检">
|
||||||
</el-card>
|
<template slot-scope="scope">
|
||||||
|
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
|
||||||
|
<el-tag v-else>合格</el-tag></template
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="装箱单号" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">{{ scope.row.packnum }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="未装箱说明" show-overflow-tooltip>
|
||||||
|
<template slot-scope="scope">{{ scope.row.remark }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center" label="操作" width="220px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['warehouse_delete'])"
|
||||||
|
type="primary"
|
||||||
|
@click="handlePack(scope)"
|
||||||
|
>装箱</el-link
|
||||||
|
>
|
||||||
|
|
||||||
</el-card>
|
<el-link
|
||||||
|
v-if="checkPermission(['warehouse_delete'])"
|
||||||
|
type="primary"
|
||||||
|
@click="handleNotPack(scope)"
|
||||||
|
>备注</el-link
|
||||||
|
>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['warehouse_delete'])"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope)"
|
||||||
|
>删除</el-link
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
width="60%"
|
||||||
|
:title="dialogType === 'edit' ? '编辑装箱单' : '新增装箱单'"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="packData"
|
||||||
|
label-width="100px"
|
||||||
|
label-position="right"
|
||||||
|
>
|
||||||
|
<el-form-item label="装箱单号" prop="packnum">
|
||||||
|
<el-input v-model="packData.packnum" placeholder="装箱单号" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="装箱文件确认" prop="iproducts">
|
||||||
|
<el-table
|
||||||
|
:data="packlist"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
stripe
|
||||||
|
highlight-current-row
|
||||||
|
ref="multipleTable"
|
||||||
|
height="300"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55"> </el-table-column>
|
||||||
|
<el-table-column type="index" width="50" label="序号" />
|
||||||
|
<el-table-column label="名称">
|
||||||
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="单位">
|
||||||
|
<template slot-scope="scope">{{ scope.row.unit }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="数量">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-form :model="scope.row">
|
||||||
|
<el-form-item size="mini">
|
||||||
|
<el-input-number
|
||||||
|
v-model="scope.row.count"
|
||||||
|
:min="0"
|
||||||
|
:value="0"
|
||||||
|
></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="库存数量">
|
||||||
|
<template slot-scope="scope" v-if="scope.row.material_">{{
|
||||||
|
scope.row.material_.count
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="安全库存数量">
|
||||||
|
<template slot-scope="scope" v-if="scope.row.material_">{{
|
||||||
|
scope.row.material_.count_safe
|
||||||
|
}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="dialogVisible = false"
|
||||||
|
>取消</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="submitPack">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisibles"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
width="60%"
|
||||||
|
title="未装箱备注"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="notpackData"
|
||||||
|
label-width="100px"
|
||||||
|
label-position="right"
|
||||||
|
>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="notpackData.remark" placeholder="未装箱备注" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="dialogVisibles = false"
|
||||||
|
>取消</el-button
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="submitnotPack">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</el-card>
|
||||||
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {getSale,getSaleproductList,deleteSaleproduct} from "@/api/sam";
|
import {
|
||||||
|
getSale,
|
||||||
|
getSaleproductList,
|
||||||
|
deleteSaleproduct,
|
||||||
|
gePack,
|
||||||
|
subPack,
|
||||||
|
notPackremark,
|
||||||
|
} from "@/api/sam";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
|
|
||||||
|
|
||||||
import { genTree } from "@/utils";
|
import { genTree } from "@/utils";
|
||||||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
|
const defaultepackData = {
|
||||||
|
packnum: ""
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
salesdetail: "",
|
||||||
salesdetail:"",
|
saleproduct: "",
|
||||||
saleproduct:"",
|
packlist: [],
|
||||||
|
dialogVisible: false,
|
||||||
|
dialogVisibles:false,
|
||||||
|
packData:defaultepackData,
|
||||||
|
notpackData:{remark:""},
|
||||||
|
detail: [],
|
||||||
|
saleproductId: null,
|
||||||
|
saleProductid:null,
|
||||||
|
dialogType: "new",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {},
|
computed: {},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
this.id = this.$route.params.id;
|
this.id = this.$route.params.id;
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getSaleproductLists();
|
this.getSaleproductLists();
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkPermission,
|
checkPermission,
|
||||||
//详情
|
//详情
|
||||||
getList() {
|
getList() {
|
||||||
|
|
||||||
getSale(this.id).then((response) => {
|
getSale(this.id).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.salesdetail = response.data;
|
this.salesdetail = response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getSaleproductLists()
|
getSaleproductLists() {
|
||||||
{
|
getSaleproductList({ sale: this.id, page: 0 }).then((response) => {
|
||||||
getSaleproductList({sale:this.id,page:0}).then((response) => {
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.saleproduct = response.data;
|
this.saleproduct = response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleDelete(scope) {
|
handleDelete(scope) {
|
||||||
this.$confirm("确认删除?", "警告", {
|
this.$confirm("确认删除?", "警告", {
|
||||||
confirmButtonText: "确认",
|
confirmButtonText: "确认",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
|
@ -140,7 +266,58 @@ export default {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//装箱操作
|
||||||
|
handlePack(scope) {
|
||||||
|
this.packData = Object.assign({}, scope.row);
|
||||||
|
this.dialogType = "new";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
|
||||||
|
});
|
||||||
|
gePack(scope.row.id).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
this.packlist = response.data.detail;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.saleproductId = scope.row.id;
|
||||||
|
},
|
||||||
|
|
||||||
|
submitPack() {
|
||||||
|
this.$refs.multipleTable.selection.forEach((item) => {
|
||||||
|
this.detail.push({
|
||||||
|
id: item.id,
|
||||||
|
count: item.count,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
console.log( this.detail);
|
||||||
|
this.packData.detail = this.detail;
|
||||||
|
subPack(this.saleproductId, this.packData).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getSaleproductLists();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//未装箱备注
|
||||||
|
handleNotPack(scope)
|
||||||
|
{
|
||||||
|
this.dialogVisibles=true;
|
||||||
|
this.saleProductid=scope.row.id;
|
||||||
|
}
|
||||||
|
,
|
||||||
|
submitnotPack()
|
||||||
|
{
|
||||||
|
notPackremark(this.saleProductid, this.notpackData).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getSaleproductLists();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -30,7 +30,7 @@ class HRMService:
|
||||||
update_all_user_facedata_cache()
|
update_all_user_facedata_cache()
|
||||||
try:
|
try:
|
||||||
results = face_recognition.compare_faces(face_datas,
|
results = face_recognition.compare_faces(face_datas,
|
||||||
unknown_face_encoding, tolerance=0.5)
|
unknown_face_encoding, tolerance=0.48)
|
||||||
except:
|
except:
|
||||||
return None, '人脸匹配失败'
|
return None, '人脸匹配失败'
|
||||||
for index, value in enumerate(results):
|
for index, value in enumerate(results):
|
||||||
|
|
|
@ -29,4 +29,4 @@ class IProductFilterSet(DynamicFieldsFilterMixin, filters.FilterSet):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IProduct
|
model = IProduct
|
||||||
fields = ['material', 'warehouse', 'batch', 'order', 'material__type', 'update_time_start', 'update_time_end',
|
fields = ['material', 'warehouse', 'batch', 'order', 'material__type', 'update_time_start', 'update_time_end',
|
||||||
'to_order', 'need_to_order']
|
'to_order', 'need_to_order', 'state']
|
||||||
|
|
|
@ -96,6 +96,13 @@ class FIFOItemCreateSerializer(serializers.ModelSerializer):
|
||||||
raise ValidationError('非采购订单')
|
raise ValidationError('非采购订单')
|
||||||
return super().create(validated_data)
|
return super().create(validated_data)
|
||||||
|
|
||||||
|
def validate_batch(self, value):
|
||||||
|
if value == '':
|
||||||
|
return value
|
||||||
|
elif len(value) > 6:
|
||||||
|
return value
|
||||||
|
raise ValidationError('批次号错误')
|
||||||
|
|
||||||
class FIFOItemUpdateSerializer(serializers.ModelSerializer):
|
class FIFOItemUpdateSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = FIFOItem
|
model = FIFOItem
|
||||||
|
@ -123,6 +130,13 @@ class FIFODetailInPurSerializer(serializers.ModelSerializer):
|
||||||
model = FIFOItem
|
model = FIFOItem
|
||||||
fields = ['material', 'count', 'batch', 'details', 'warehouse']
|
fields = ['material', 'count', 'batch', 'details', 'warehouse']
|
||||||
|
|
||||||
|
def validate_batch(self, value):
|
||||||
|
if value == '':
|
||||||
|
return value
|
||||||
|
elif len(value) > 6:
|
||||||
|
return value
|
||||||
|
raise ValidationError('批次号错误')
|
||||||
|
|
||||||
|
|
||||||
class MaterialBatchQuerySerializer(serializers.Serializer):
|
class MaterialBatchQuerySerializer(serializers.Serializer):
|
||||||
warehouse = serializers.IntegerField(label="仓库ID", required=False)
|
warehouse = serializers.IntegerField(label="仓库ID", required=False)
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
from itertools import count
|
||||||
from rest_framework.exceptions import ValidationError
|
from rest_framework.exceptions import ValidationError
|
||||||
from apps.inm.models import FIFOItemProduct, IProduct, Inventory, MaterialBatch, FIFO, FIFOItem
|
from apps.inm.models import FIFOItemProduct, IProduct, Inventory, MaterialBatch, FIFO, FIFOItem, WareHouse
|
||||||
|
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
|
||||||
|
|
||||||
class InmService:
|
class InmService:
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -53,18 +58,19 @@ class InmService:
|
||||||
o1 = Inventory.objects.get(material=material, warehouse=warehouse)
|
o1 = Inventory.objects.get(material=material, warehouse=warehouse)
|
||||||
temp_count = o1.count - i.count
|
temp_count = o1.count - i.count
|
||||||
if temp_count < 0:
|
if temp_count < 0:
|
||||||
raise ValidationError('库存不足,操作失败')
|
raise ValidationError('仓库库存不足,操作失败')
|
||||||
o1.count = temp_count
|
o1.count = temp_count
|
||||||
o1.save()
|
o1.save()
|
||||||
|
print(i.batch)
|
||||||
o2 = MaterialBatch.objects.get(material=material, warehouse=warehouse, batch=i.batch)
|
o2 = MaterialBatch.objects.get(material=material, warehouse=warehouse, batch=i.batch)
|
||||||
temp_count = o2.count - i.count
|
temp_count = o2.count - i.count
|
||||||
if temp_count < 0:
|
if temp_count < 0:
|
||||||
raise ValidationError('库存不足,操作失败')
|
raise ValidationError('批次库存不足,操作失败')
|
||||||
o2.count = temp_count
|
o2.count = temp_count
|
||||||
o2.save()
|
o2.save()
|
||||||
temp_count = material.count - i.count
|
temp_count = material.count - i.count
|
||||||
if temp_count < 0:
|
if temp_count < 0:
|
||||||
raise ValidationError('库存不足,操作失败')
|
raise ValidationError('物料库存不足,操作失败')
|
||||||
material.count = temp_count
|
material.count = temp_count
|
||||||
material.save()
|
material.save()
|
||||||
|
|
||||||
|
@ -73,3 +79,63 @@ class InmService:
|
||||||
# 生产领料的情况直接从IProduct中删除
|
# 生产领料的情况直接从IProduct中删除
|
||||||
numbers = FIFOItemProduct.objects.filter(fifoitem=i).values_list('number', flat=True)
|
numbers = FIFOItemProduct.objects.filter(fifoitem=i).values_list('number', flat=True)
|
||||||
IProduct.objects.filter(number__in=numbers).delete()
|
IProduct.objects.filter(number__in=numbers).delete()
|
||||||
|
# 销售的话已经处理了
|
||||||
|
# elif instance.type == FIFO.FIFO_TYPE_SALE_OUT:
|
||||||
|
# ips = FIFOItemProduct.objects.filter(fifoitem=i).values_list('iproduct', flat=True)
|
||||||
|
# IProduct.objects.filter(id__in=ips).update(state=IProduct.SALED)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sale_out_audit(cls, fifo:FIFO):
|
||||||
|
sale = fifo.sale
|
||||||
|
saleps = SaleProduct.objects.filter(sale=sale, packnum__isnull=True, remark__isnull=True)
|
||||||
|
if saleps.exists():
|
||||||
|
raise ValidationError('存在未装箱的产品')
|
||||||
|
# 创建出库条目
|
||||||
|
ips = IProduct.objects.filter(sale_iproduct__sale=sale,
|
||||||
|
sale_iproduct__packnum__isnull=False)
|
||||||
|
ips.update(state=IProduct.SALED)
|
||||||
|
items = ips.values('warehouse', 'material', 'batch').annotate(total=Count('id'))
|
||||||
|
for i in items:
|
||||||
|
warehouse = WareHouse.objects.get(id=i['warehouse'])
|
||||||
|
material = Material.objects.get(id=i['material'])
|
||||||
|
fifoitem = FIFOItem()
|
||||||
|
fifoitem.need_test = False
|
||||||
|
fifoitem.warehouse = warehouse
|
||||||
|
fifoitem.material = material
|
||||||
|
fifoitem.count = i['total']
|
||||||
|
fifoitem.batch = i['batch']
|
||||||
|
fifoitem.fifo = fifo
|
||||||
|
fifoitem.save()
|
||||||
|
items_p = ips.filter(warehouse=warehouse, batch=i['batch'])
|
||||||
|
ipxs = []
|
||||||
|
for i in items_p:
|
||||||
|
# 创建出库明细半成品
|
||||||
|
ip = {}
|
||||||
|
ip['fifoitem'] = fifoitem
|
||||||
|
ip['number'] = i.number
|
||||||
|
ip['material'] = i.material
|
||||||
|
ip['iproduct'] = i
|
||||||
|
ipxs.append(FIFOItemProduct(**ip))
|
||||||
|
FIFOItemProduct.objects.bulk_create(ipxs)
|
||||||
|
|
||||||
|
# 装箱附件处理
|
||||||
|
# ml = SalePack.objects.filter(sale_product__iproduct = ips
|
||||||
|
# ).values('packitem__material').annotate(count=Sum('count'))
|
||||||
|
# for i in ml:
|
||||||
|
# material = Material.objects.get(id=i['material'])
|
||||||
|
|
||||||
|
|
||||||
|
# 更新动态产品表情况
|
||||||
|
from apps.wpm.models import WProduct
|
||||||
|
WProduct.objects.filter(id__in=ips.values_list('wproduct', flat=True)).update(
|
||||||
|
act_state=WProduct.WPR_ACT_STATE_SELLED)
|
||||||
|
|
||||||
|
# 变更销售记录实际发货数
|
||||||
|
sale.count_real = ips.count()
|
||||||
|
sale.save()
|
||||||
|
# 变更订单状态
|
||||||
|
order = sale.order
|
||||||
|
if order:
|
||||||
|
order.delivered_count = IProduct.objects.filter(sale_iproduct__sale__order=order
|
||||||
|
, sale_iproduct__packnum__isnull=False).count()
|
||||||
|
order.save()
|
|
@ -184,24 +184,27 @@ class FIFOViewSet(ListModelMixin, DestroyModelMixin, GenericViewSet):
|
||||||
return Response()
|
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
|
||||||
def audit(self, request, pk=None):
|
def audit(self, request, pk=None):
|
||||||
"""
|
"""
|
||||||
审核通过
|
审核通过
|
||||||
"""
|
"""
|
||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
if not FIFOItem.objects.filter(fifo=obj).exists():
|
|
||||||
raise ValidationError('出入库条目为空')
|
|
||||||
for i in FIFOItem.objects.filter(fifo=obj, need_test=True):
|
|
||||||
if not i.is_testok:
|
|
||||||
raise APIException('未检验通过, 不可审核')
|
|
||||||
if obj.is_audited:
|
if obj.is_audited:
|
||||||
raise APIException('该入库记录已审核通过')
|
raise APIException('该入库记录已审核通过')
|
||||||
with transaction.atomic():
|
if obj.type == FIFO.FIFO_TYPE_SALE_OUT: # 如果是销售提货,需额外处理
|
||||||
obj.is_audited = True
|
InmService.sale_out_audit(obj)
|
||||||
obj.auditor = request.user
|
else:
|
||||||
obj.inout_date = timezone.now() # 也是审核日期
|
if not FIFOItem.objects.filter(fifo=obj).exists():
|
||||||
obj.save()
|
raise ValidationError('出入库条目为空')
|
||||||
InmService.update_inm(obj) # 更新库存
|
for i in FIFOItem.objects.filter(fifo=obj, need_test=True):
|
||||||
|
if not i.is_testok:
|
||||||
|
raise APIException('未检验通过, 不可审核')
|
||||||
|
obj.is_audited = True
|
||||||
|
obj.auditor = request.user
|
||||||
|
obj.inout_date = timezone.now() # 也是审核日期
|
||||||
|
obj.save()
|
||||||
|
InmService.update_inm(obj) # 更新库存
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CustomerCreateUpdateSerializer(serializers.ModelSerializer):
|
||||||
class CustomerSimpleSerializer(serializers.ModelSerializer):
|
class CustomerSimpleSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Customer
|
model = Customer
|
||||||
fields = ['id', 'name']
|
fields = ['id', 'name', 'address', 'contact', 'contact_phone']
|
||||||
|
|
||||||
class ContractSerializer(serializers.ModelSerializer):
|
class ContractSerializer(serializers.ModelSerializer):
|
||||||
customer_ = CustomerSimpleSerializer(source='customer', read_only=True)
|
customer_ = CustomerSimpleSerializer(source='customer', read_only=True)
|
||||||
|
|
|
@ -89,10 +89,11 @@ class SPackItemCreateSerializer(serializers.Serializer):
|
||||||
|
|
||||||
class SaleProductPackSerializer(serializers.ModelSerializer):
|
class SaleProductPackSerializer(serializers.ModelSerializer):
|
||||||
detail = SPackItemCreateSerializer(many=True)
|
detail = SPackItemCreateSerializer(many=True)
|
||||||
|
packnum = serializers.CharField(min_length=6)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SaleProduct
|
model = SaleProduct
|
||||||
fields = ['packnum', 'detail', 'remark']
|
fields = ['packnum', 'detail', 'remark']
|
||||||
|
|
||||||
|
|
||||||
class SRemarkItemCreateSerializer(serializers.Serializer):
|
class SRemarkItemCreateSerializer(serializers.Serializer):
|
||||||
remark = serializers.CharField()
|
remark = serializers.CharField(min_length=6)
|
||||||
|
|
|
@ -42,7 +42,8 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
||||||
if obj.is_audited:
|
if obj.is_audited:
|
||||||
raise exceptions.APIException('该销售记录已审核,不可删除')
|
raise exceptions.APIException('该销售记录已审核,不可删除')
|
||||||
obj.delete()
|
obj.delete()
|
||||||
IProduct.objects.filter(sale_iproduct__sale=obj).update()
|
IProduct.objects.filter(sale_iproduct__sale=obj).update(state=IProduct.SALE_OK)
|
||||||
|
return Response()
|
||||||
|
|
||||||
def create(self, request, *args, **kwargs):
|
def create(self, request, *args, **kwargs):
|
||||||
data = request.data
|
data = request.data
|
||||||
|
@ -89,46 +90,10 @@ class SaleViewSet(CreateUpdateModelAMixin, ListModelMixin, RetrieveModelMixin, C
|
||||||
fifo.create_by = request.user
|
fifo.create_by = request.user
|
||||||
fifo.number = 'CK' + ranstr(7)
|
fifo.number = 'CK' + ranstr(7)
|
||||||
fifo.save()
|
fifo.save()
|
||||||
# 创建出库条目
|
|
||||||
# ips = IProduct.objects.filter(sale_iproduct__sale=obj)
|
|
||||||
# items = ips.values('warehouse', 'material', 'batch').annotate(total=Count('id'))
|
|
||||||
# for i in items:
|
|
||||||
# warehouse = WareHouse.objects.get(id=i['warehouse'])
|
|
||||||
# material = Material.objects.get(id=i['material'])
|
|
||||||
# fifoitem = FIFOItem()
|
|
||||||
# fifoitem.need_test = False
|
|
||||||
# fifoitem.warehouse = warehouse
|
|
||||||
# fifoitem.material = material
|
|
||||||
# fifoitem.count = i['total']
|
|
||||||
# fifoitem.batch = i['batch']
|
|
||||||
# fifoitem.fifo = fifo
|
|
||||||
# fifoitem.save()
|
|
||||||
# items_p = ips.filter(warehouse=warehouse, batch=i['batch'])
|
|
||||||
# ipxs = []
|
|
||||||
# for i in items_p:
|
|
||||||
# # 创建出库明细半成品
|
|
||||||
# ip = {}
|
|
||||||
# ip['fifoitem'] = fifoitem
|
|
||||||
# ip['number'] = i.number
|
|
||||||
# ip['material'] = i.material
|
|
||||||
# ip['iproduct'] = i
|
|
||||||
# ipxs.append(FIFOItemProduct(**ip))
|
|
||||||
# FIFOItemProduct.objects.bulk_create(ipxs)
|
|
||||||
|
|
||||||
# 更新动态产品表情况
|
|
||||||
# from apps.wpm.models import WProduct
|
|
||||||
# WProduct.objects.filter(iproduct_wproduct__sale_iproduct__sale=obj).update(
|
|
||||||
# act_state=WProduct.WPR_ACT_STATE_SELLED)
|
|
||||||
# 更新库存
|
|
||||||
# InmService.update_inm(fifo)
|
|
||||||
# 变更销售提货审核状态
|
|
||||||
obj.is_audited = True
|
obj.is_audited = True
|
||||||
obj.save()
|
obj.save()
|
||||||
# 变更订单状态
|
|
||||||
# if obj.order:
|
|
||||||
# order = obj.order
|
|
||||||
# order.delivered_count = order.delivered_count + obj.count
|
|
||||||
# order.save()
|
|
||||||
return Response()
|
return Response()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue