|
@@ -87,7 +87,7 @@
|
|
|
<div style="width: 100%; display: block">
|
|
|
<el-form-item style="width: 100%">
|
|
|
<el-table
|
|
|
- :data="goodsExchangeAddForm.contract_product_list"
|
|
|
+ :data="goodsExchangeAddForm.product_list"
|
|
|
border
|
|
|
:cell-style="{ textAlign: 'center' }"
|
|
|
:header-cell-style="{ textAlign: 'center' }"
|
|
@@ -105,7 +105,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="条码">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.bar_code }}
|
|
|
+ {{ scope.row.product_barcode }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="序列号">
|
|
@@ -123,9 +123,9 @@
|
|
|
{{ scope.row.goods_unit }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="订单数量">
|
|
|
+ <!-- <el-table-column label="订单数量">
|
|
|
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<el-table-column label="入库数量">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
@@ -139,13 +139,13 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="库存数量">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.already_num }}
|
|
|
+ {{ scope.row.usable_stock }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="差异">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- 入库减去库存 -->
|
|
|
- {{ scope.row.num - scope.row.already_num || 0 }}
|
|
|
+ {{ scope.row.num - scope.row.usable_stock || 0 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
@@ -157,7 +157,7 @@
|
|
|
size="mini"
|
|
|
type="danger"
|
|
|
@click="
|
|
|
- goodsExchangeAddForm.contract_product_list.splice(
|
|
|
+ goodsExchangeAddForm.product_list.splice(
|
|
|
scope.$index,
|
|
|
1
|
|
|
)
|
|
@@ -178,9 +178,15 @@
|
|
|
<el-button
|
|
|
v-if="type !== 'audit' && type !== 'detail'"
|
|
|
type="primary"
|
|
|
- @click="submitgoodsExchangeAddForm"
|
|
|
+ @click="savegoodsExchangeAddForm"
|
|
|
>保存
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="type !== 'audit' && type !== 'detail'"
|
|
|
+ type="primary"
|
|
|
+ @click="submitgoodsExchangeAddForm"
|
|
|
+ >入库
|
|
|
+ </el-button>
|
|
|
<el-button @click="printIng" v-if="type == 'audit'">打印</el-button>
|
|
|
<el-button @click="$router.back()">返回</el-button>
|
|
|
</div>
|
|
@@ -258,8 +264,7 @@
|
|
|
<el-table-column prop="name" label="商品名称"> </el-table-column>
|
|
|
<el-table-column prop="goods_style" label="规格型号"> </el-table-column>
|
|
|
<el-table-column prop="goods_unit" label="单位"> </el-table-column>
|
|
|
- <el-table-column prop="product_list.stock_num" label="库存数量">
|
|
|
- </el-table-column>
|
|
|
+ <!-- <el-table-column prop="product_list.stock_num" label="库存数量"> </el-table-column> -->
|
|
|
</el-table>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="closeGoosData">取 消</el-button>
|
|
@@ -316,7 +321,7 @@ export default {
|
|
|
orderList: [],
|
|
|
id: "",
|
|
|
type: "",
|
|
|
- /** 出库单表单*/
|
|
|
+ /** 入库单表单*/
|
|
|
goodsExchangeAddForm: {
|
|
|
contract_product_list: [],
|
|
|
/* additionalProp1: {
|
|
@@ -491,10 +496,25 @@ export default {
|
|
|
// 保存已选商品
|
|
|
submitGoosData() {
|
|
|
if (this.goodsList.length >= 1) {
|
|
|
- console.log(this.goodsList);
|
|
|
- this.goodsExchangeAddForm.product_list = this.goodsList;
|
|
|
- this.goodsExchangeAddForm.contract_product_list = this.goodsList;
|
|
|
- this.goodsVisible = false;
|
|
|
+ let ids=[]
|
|
|
+ const param_list={
|
|
|
+ warehouse_id:this.goodsExchangeAddForm.warehouse_id,
|
|
|
+ good_ids:ids
|
|
|
+ }
|
|
|
+ this.goodsList.forEach(el=>{
|
|
|
+ ids.push(el.id)
|
|
|
+ })
|
|
|
+ API_GoodsExchange.getStockByWarehouseGood(param_list).then(res=>{
|
|
|
+ res.map(el=>{
|
|
|
+ el.product_id=el.id
|
|
|
+ el.goods_id=el.id
|
|
|
+ })
|
|
|
+ this.goodsExchangeAddForm.product_list = res;
|
|
|
+ this.goodsExchangeAddForm.contract_product_list = res;
|
|
|
+ console.log(res);
|
|
|
+ this.goodsVisible = false;
|
|
|
+ })
|
|
|
+
|
|
|
} else {
|
|
|
this.$message.error("请选择商品信息");
|
|
|
}
|
|
@@ -611,7 +631,8 @@ export default {
|
|
|
this.warehouseList = response;
|
|
|
});
|
|
|
},
|
|
|
- submitgoodsExchangeAddForm() {
|
|
|
+ //保存
|
|
|
+ savegoodsExchangeAddForm(){
|
|
|
this.$refs["goodsExchangeAddForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
const { id } = this.goodsExchangeAddForm;
|
|
@@ -633,6 +654,8 @@ export default {
|
|
|
).real_name;
|
|
|
}
|
|
|
params.change_time = Math.floor(params.change_time / 1000);
|
|
|
+ //类型
|
|
|
+ params.save_or_submit="save"
|
|
|
if (!params.contract_product_list.length) {
|
|
|
this.$message.error("请选择商品!");
|
|
|
return;
|
|
@@ -664,6 +687,69 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //入库
|
|
|
+ submitgoodsExchangeAddForm() {
|
|
|
+ this.$refs["goodsExchangeAddForm"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ const { id } = this.goodsExchangeAddForm;
|
|
|
+ const params = this.MixinClone(this.goodsExchangeAddForm);
|
|
|
+ params.handled_by = this.deptListAll;
|
|
|
+ API_order.getOrderList({sn:this.goodsExchangeAddForm.sn}).then(res=>{
|
|
|
+ console.log(res.data);
|
|
|
+ params.order_id= Number(res.data[0].id)
|
|
|
+ })
|
|
|
+ params.staff_name = this.goodsExchangeAddForm.distribution_name;
|
|
|
+ if (params.warehouse_id) {
|
|
|
+ params.warehouse_name = this.warehouseList.find(
|
|
|
+ (ware) => ware.id === params.warehouse_id
|
|
|
+ ).name;
|
|
|
+ }
|
|
|
+ if (params.handled_by_id) {
|
|
|
+ params.handled_by = this.adminList.find(
|
|
|
+ (admin) => admin.id === params.handled_by_id
|
|
|
+ ).real_name;
|
|
|
+ }
|
|
|
+ params.change_time = Math.floor(params.change_time / 1000);
|
|
|
+ params.save_or_submit="submit"
|
|
|
+ if (!params.contract_product_list.length) {
|
|
|
+ this.$message.error("请选择商品!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ /* */ if (this.$route.name === "editInventory") {
|
|
|
+ params.contract_product_list.map(el=>{
|
|
|
+ el.product_id=el.id
|
|
|
+ el.goods_id=el.id
|
|
|
+ })
|
|
|
+ params.product_list.map(el=>{
|
|
|
+ el.product_id=el.id
|
|
|
+ el.goods_id=el.id
|
|
|
+ })
|
|
|
+ API_GoodsExchange.editWarehouseEntry(id,params).then((response) => {
|
|
|
+ this.$message.success("修改成功!");
|
|
|
+ const { callback } = this.$route.params;
|
|
|
+ if (typeof callback === "function") callback();
|
|
|
+ this.$store.dispatch("delCurrentViews", {
|
|
|
+ view: this.$route,
|
|
|
+ $router: this.$router,
|
|
|
+ });
|
|
|
+ this.$router.push({ name: "goodsExchange" });
|
|
|
+ });
|
|
|
+ } else if (this.$route.name === "addInventory") {
|
|
|
+ // 新增入库
|
|
|
+ API_GoodsExchange.warehouseEntry(params).then(() => {
|
|
|
+ this.$message.success("添加成功!");
|
|
|
+ const { callback } = this.$route.params;
|
|
|
+ if (typeof callback === "function") callback();
|
|
|
+ this.$store.dispatch("delCurrentViews", {
|
|
|
+ view: this.$route,
|
|
|
+ $router: this.$router,
|
|
|
+ });
|
|
|
+ this.$router.push({ name: "goodsExchange" });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
/* returngoodsExchangeAddForm() {
|
|
|
const { id } = this.goodsExchangeAddForm;
|
|
|
const params = this.MixinClone(this.goodsExchangeAddForm);
|
|
@@ -700,8 +786,11 @@ export default {
|
|
|
}, */
|
|
|
// 选择出库单
|
|
|
async handleSelectWarehouseEntryBatch() {
|
|
|
+ if (!this.goodsExchangeAddForm.warehouse_id) {
|
|
|
+ this.$message.error('请先选择仓库!')
|
|
|
+ return
|
|
|
+ }
|
|
|
API_GoodsExchange.getGoodsInfo().then((res) => {
|
|
|
- // console.log(res);
|
|
|
this.goodsData = res.data;
|
|
|
this.goodsVisible = true;
|
|
|
});
|
|
@@ -800,9 +889,13 @@ export default {
|
|
|
this.goodsExchangeAddForm.change_time * 1000
|
|
|
);
|
|
|
this.goodsExchangeAddForm.distribution_name = response.staff_name;
|
|
|
- this.goodsExchangeAddForm.contract_product_list =
|
|
|
- response.contract_product_list.map((item) => {
|
|
|
+ this.goodsExchangeAddForm.product_list =
|
|
|
+ response.product_list.map((item) => {
|
|
|
//change_list
|
|
|
+ item.name=item.goods_do.name
|
|
|
+ item.sn=item.goods_do.sn
|
|
|
+ item.sn_code=item.goods_do.sn_code
|
|
|
+ item.bar_code=item.goods_do.bar_code
|
|
|
item.entry_price = item.amount;
|
|
|
item.product_specification = item.specification;
|
|
|
item.product_unit = item.unit;
|