|
@@ -54,7 +54,7 @@
|
|
:key="item.id"
|
|
:key="item.id"
|
|
:label="item.label"
|
|
:label="item.label"
|
|
:value="item.value"
|
|
:value="item.value"
|
|
- :disabled="item.value=='TRANSFER_ENTRY'"
|
|
|
|
|
|
+ :disabled="item.value == 'TRANSFER_ENTRY'"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -185,11 +185,11 @@
|
|
v-if="type !== 'detail' && type !== 'audit'"
|
|
v-if="type !== 'detail' && type !== 'audit'"
|
|
>
|
|
>
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button
|
|
|
|
|
|
+ <!-- <el-button
|
|
size="mini"
|
|
size="mini"
|
|
@click="addSnCode(scope.row, scope.$index)"
|
|
@click="addSnCode(scope.row, scope.$index)"
|
|
>添加序列号</el-button
|
|
>添加序列号</el-button
|
|
- >
|
|
|
|
|
|
+ > -->
|
|
<el-button
|
|
<el-button
|
|
size="mini"
|
|
size="mini"
|
|
type="danger"
|
|
type="danger"
|
|
@@ -253,7 +253,6 @@
|
|
title="扫码入库"
|
|
title="扫码入库"
|
|
:visible.sync="scanDialogVisible"
|
|
:visible.sync="scanDialogVisible"
|
|
width="30%"
|
|
width="30%"
|
|
- :close-on-press-escape="false"
|
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
>
|
|
>
|
|
<el-form
|
|
<el-form
|
|
@@ -262,23 +261,25 @@
|
|
label-width="120px"
|
|
label-width="120px"
|
|
inline
|
|
inline
|
|
>
|
|
>
|
|
|
|
+ <!-- @blur="blurCode()" -->
|
|
<el-form-item label="条码" prop="bar_code">
|
|
<el-form-item label="条码" prop="bar_code">
|
|
<el-input
|
|
<el-input
|
|
v-model="scanGoodsForm.bar_code"
|
|
v-model="scanGoodsForm.bar_code"
|
|
ref="input"
|
|
ref="input"
|
|
@keyup.enter.native="toSearch()"
|
|
@keyup.enter.native="toSearch()"
|
|
- @blur="blurCode()"
|
|
|
|
:minlength="0"
|
|
:minlength="0"
|
|
:maxlength="100"
|
|
:maxlength="100"
|
|
></el-input>
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <!-- <el-form-item label="序列号" prop="sn_code">
|
|
|
|
|
|
+ <el-form-item label="序列号" prop="sn_code">
|
|
<el-input
|
|
<el-input
|
|
- v-model="scanGoodsForm.sn_code"
|
|
|
|
|
|
+ ref="sn_input"
|
|
|
|
+ v-model="sn_code"
|
|
|
|
+ @keyup.enter.native="toSnCode()"
|
|
:minlength="0"
|
|
:minlength="0"
|
|
:maxlength="100"
|
|
:maxlength="100"
|
|
></el-input>
|
|
></el-input>
|
|
- </el-form-item> -->
|
|
|
|
|
|
+ </el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<el-dialog
|
|
<el-dialog
|
|
@@ -402,7 +403,7 @@
|
|
<el-button @click="searchOrderAdd" type="primary">确 定</el-button>
|
|
<el-button @click="searchOrderAdd" type="primary">确 定</el-button>
|
|
</span>
|
|
</span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
- <el-dialog
|
|
|
|
|
|
+ <!-- <el-dialog
|
|
title="序列号"
|
|
title="序列号"
|
|
@close="closeSncode"
|
|
@close="closeSncode"
|
|
:visible.sync="snCodeVisible"
|
|
:visible.sync="snCodeVisible"
|
|
@@ -425,7 +426,7 @@
|
|
></el-input>
|
|
></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
- </el-dialog>
|
|
|
|
|
|
+ </el-dialog> -->
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -583,7 +584,7 @@ export default {
|
|
sku: "",
|
|
sku: "",
|
|
sn_code_list: [],
|
|
sn_code_list: [],
|
|
index: "",
|
|
index: "",
|
|
- snMultipleSelection:''
|
|
|
|
|
|
+ snMultipleSelection: "",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -639,14 +640,14 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
/* 订单列表选择 */
|
|
/* 订单列表选择 */
|
|
- handleSelOrderChange(val){
|
|
|
|
|
|
+ handleSelOrderChange(val) {
|
|
if (val.length > 1) {
|
|
if (val.length > 1) {
|
|
// 如果当前选中数量超过1,移除先前选中的,保留最后选中的
|
|
// 如果当前选中数量超过1,移除先前选中的,保留最后选中的
|
|
const lastSelected = val[val.length - 1];
|
|
const lastSelected = val[val.length - 1];
|
|
this.$refs.tables.clearSelection(); // 清除所有选中
|
|
this.$refs.tables.clearSelection(); // 清除所有选中
|
|
this.$refs.tables.toggleRowSelection(lastSelected, true); // 重新选中最后一个
|
|
this.$refs.tables.toggleRowSelection(lastSelected, true); // 重新选中最后一个
|
|
}
|
|
}
|
|
- this.snMultipleSelection=val
|
|
|
|
|
|
+ this.snMultipleSelection = val;
|
|
},
|
|
},
|
|
/* 返回出入明细 */
|
|
/* 返回出入明细 */
|
|
toBack() {
|
|
toBack() {
|
|
@@ -661,13 +662,30 @@ export default {
|
|
},
|
|
},
|
|
//扫序列号goodsExchangeAddForm.product_list[this.index].sn_code_list
|
|
//扫序列号goodsExchangeAddForm.product_list[this.index].sn_code_list
|
|
toSnCode() {
|
|
toSnCode() {
|
|
- API_GoodsExchange.getSnCode("in", this.sku, this.sn_code).then((res) => {
|
|
|
|
- /* this.sn_code_list.push(res); */
|
|
|
|
|
|
+ API_GoodsExchange.getSnCode("in", this.sku, this.sn_code.replace(/\s+/g, '')).then((res) => {
|
|
this.sn_code = "";
|
|
this.sn_code = "";
|
|
- this.snCodeVisible = false;
|
|
|
|
- this.goodsExchangeAddForm.product_list[this.index].sn_code_list.push(
|
|
|
|
- res
|
|
|
|
|
|
+ // 假设res是一个对象,我们根据res的某个属性(如sn)来检查重复
|
|
|
|
+ let exists = this.goodsExchangeAddForm.product_list[
|
|
|
|
+ this.index
|
|
|
|
+ ].sn_code_list.find(
|
|
|
|
+ (item) => item.sn_code === res.sn_code && item.sku === res.sku
|
|
);
|
|
);
|
|
|
|
+ if (!exists) {
|
|
|
|
+ this.goodsExchangeAddForm.product_list[this.index].sn_code_list.push(
|
|
|
|
+ res
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ /* this.goodsExchangeAddForm.product_list[this.index].sn_code_list.push(
|
|
|
|
+ res
|
|
|
|
+ ); */
|
|
|
|
+ this.goodsExchangeAddForm.product_list[this.index].num =
|
|
|
|
+ this.goodsExchangeAddForm.product_list[
|
|
|
|
+ this.index
|
|
|
|
+ ].sn_code_list.length;
|
|
|
|
+ this.scanGoodsForm.bar_code = "";
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.input.focus();
|
|
|
|
+ });
|
|
});
|
|
});
|
|
},
|
|
},
|
|
addSnCode(row, index) {
|
|
addSnCode(row, index) {
|
|
@@ -775,30 +793,31 @@ export default {
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
console.log(res);
|
|
console.log(res);
|
|
this.goodsExchangeAddForm.contract_product_list = res.data;
|
|
this.goodsExchangeAddForm.contract_product_list = res.data;
|
|
- this.scanDialogVisible = false;
|
|
|
|
|
|
+ //this.scanDialogVisible = false;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- searchOrderAdd(){
|
|
|
|
- if (this.snMultipleSelection.length >=1) {
|
|
|
|
|
|
+ searchOrderAdd() {
|
|
|
|
+ if (this.snMultipleSelection.length >= 1) {
|
|
API_GoodsExchange.getOneBySn(this.snMultipleSelection[0].sn).then(
|
|
API_GoodsExchange.getOneBySn(this.snMultipleSelection[0].sn).then(
|
|
(res) => {
|
|
(res) => {
|
|
- this.goodsExchangeAddForm.scan_order_sn=this.snMultipleSelection[0].sn
|
|
|
|
- this.goodsExchangeAddForm.scan_order_type=res.type
|
|
|
|
- this.goodsExchangeAddForm.order_id=res.id
|
|
|
|
- res.item_list.map(el=>{
|
|
|
|
- el.scan_order_item_id=el.id
|
|
|
|
- el.scan_order_id=res.id
|
|
|
|
- el.orderNum=el.num
|
|
|
|
- el.num=0
|
|
|
|
- el.sn_code_list=[]
|
|
|
|
- })
|
|
|
|
- this.goodsExchangeAddForm.product_list=res.item_list
|
|
|
|
- this.orderVisible=false
|
|
|
|
|
|
+ this.goodsExchangeAddForm.scan_order_sn =
|
|
|
|
+ this.snMultipleSelection[0].sn;
|
|
|
|
+ this.goodsExchangeAddForm.scan_order_type = res.type;
|
|
|
|
+ this.goodsExchangeAddForm.order_id = res.id;
|
|
|
|
+ res.item_list.map((el) => {
|
|
|
|
+ el.scan_order_item_id = el.id;
|
|
|
|
+ el.scan_order_id = res.id;
|
|
|
|
+ el.orderNum = el.num;
|
|
|
|
+ el.num = 0;
|
|
|
|
+ el.sn_code_list = [];
|
|
|
|
+ });
|
|
|
|
+ this.goodsExchangeAddForm.product_list = res.item_list;
|
|
|
|
+ this.orderVisible = false;
|
|
}
|
|
}
|
|
);
|
|
);
|
|
- }else{
|
|
|
|
- this.$message.error("请选择订单")
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error("请选择订单");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
// 查询订单编号
|
|
// 查询订单编号
|
|
@@ -806,21 +825,22 @@ export default {
|
|
if (this.goodsExchangeAddForm.sn !== undefined) {
|
|
if (this.goodsExchangeAddForm.sn !== undefined) {
|
|
API_GoodsExchange.getOneBySn(this.goodsExchangeAddForm.sn).then(
|
|
API_GoodsExchange.getOneBySn(this.goodsExchangeAddForm.sn).then(
|
|
(res) => {
|
|
(res) => {
|
|
- this.goodsExchangeAddForm.scan_order_sn=this.goodsExchangeAddForm.sn
|
|
|
|
- this.goodsExchangeAddForm.scan_order_type=res.type
|
|
|
|
- this.goodsExchangeAddForm.order_id=res.id
|
|
|
|
- res.item_list.map(el=>{
|
|
|
|
- el.scan_order_item_id=el.id
|
|
|
|
- el.scan_order_id=res.id
|
|
|
|
- el.orderNum=el.num
|
|
|
|
- el.num=0
|
|
|
|
- el.sn_code_list=[]
|
|
|
|
- })
|
|
|
|
- this.goodsExchangeAddForm.product_list=res.item_list
|
|
|
|
|
|
+ this.goodsExchangeAddForm.scan_order_sn =
|
|
|
|
+ this.goodsExchangeAddForm.sn;
|
|
|
|
+ this.goodsExchangeAddForm.scan_order_type = res.type;
|
|
|
|
+ this.goodsExchangeAddForm.order_id = res.id;
|
|
|
|
+ res.item_list.map((el) => {
|
|
|
|
+ el.scan_order_item_id = el.id;
|
|
|
|
+ el.scan_order_id = res.id;
|
|
|
|
+ el.orderNum = el.num;
|
|
|
|
+ el.num = 0;
|
|
|
|
+ el.sn_code_list = [];
|
|
|
|
+ });
|
|
|
|
+ this.goodsExchangeAddForm.product_list = res.item_list;
|
|
}
|
|
}
|
|
);
|
|
);
|
|
- } else{
|
|
|
|
- this.$message.error("请填写订单编号")
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error("请填写订单编号");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/* 通过id查询商品信息
|
|
/* 通过id查询商品信息
|
|
@@ -873,12 +893,36 @@ export default {
|
|
toSearch() {
|
|
toSearch() {
|
|
API_GoodsExchange.getProduct(
|
|
API_GoodsExchange.getProduct(
|
|
this.goodsExchangeAddForm.warehouse_id,
|
|
this.goodsExchangeAddForm.warehouse_id,
|
|
- this.scanGoodsForm.bar_code
|
|
|
|
|
|
+ this.scanGoodsForm.bar_code.replace(/\s+/g, '')
|
|
).then((res) => {
|
|
).then((res) => {
|
|
res.sn_code_list = [];
|
|
res.sn_code_list = [];
|
|
- this.goodsExchangeAddForm.product_list.push(res);
|
|
|
|
- this.scanGoodsForm.bar_code = "";
|
|
|
|
- this.scanDialogVisible = false;
|
|
|
|
|
|
+ this.sku = res.product_vo.sku;
|
|
|
|
+ // 查找当前商品是否已存在于列表中
|
|
|
|
+ const indexs = this.goodsExchangeAddForm.product_list.findIndex(
|
|
|
|
+ (el) => {
|
|
|
|
+ console.log("Comparing with:", el);
|
|
|
|
+ return (
|
|
|
|
+ el.goods_id === res.goods_id &&
|
|
|
|
+ el.product_id === res.product_id &&
|
|
|
|
+ el.warehouse_id === res.warehouse_id &&
|
|
|
|
+ el.product_vo.sku === res.product_vo.sku
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ // 如果商品不存在,则添加到列表
|
|
|
|
+ if (indexs === -1) {
|
|
|
|
+ this.index = this.goodsExchangeAddForm.product_list.length;
|
|
|
|
+ this.goodsExchangeAddForm.product_list.push(res);
|
|
|
|
+ } else {
|
|
|
|
+ this.index = indexs;
|
|
|
|
+ }
|
|
|
|
+ if (res.product_vo.have_sn) {
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.sn_input.focus();
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ /* this.scanDialogVisible = false; */
|
|
|
|
+ }
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 扫码入库
|
|
// 扫码入库
|
|
@@ -1021,8 +1065,8 @@ export default {
|
|
el.product_stock_id = el.id;
|
|
el.product_stock_id = el.id;
|
|
el.product_id = el.product_vo.id;
|
|
el.product_id = el.product_vo.id;
|
|
el.id = "";
|
|
el.id = "";
|
|
- if(!el.orderNum){
|
|
|
|
- el.scan_diff_num=el.orderNum-el.num
|
|
|
|
|
|
+ if (!el.orderNum) {
|
|
|
|
+ el.scan_diff_num = el.orderNum - el.num;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
if (this.$route.name === "editInventory") {
|
|
if (this.$route.name === "editInventory") {
|
|
@@ -1284,15 +1328,14 @@ export default {
|
|
this.goodsExchangeAddForm.change_time = Math.floor(
|
|
this.goodsExchangeAddForm.change_time = Math.floor(
|
|
this.goodsExchangeAddForm.change_time * 1000
|
|
this.goodsExchangeAddForm.change_time * 1000
|
|
);
|
|
);
|
|
- response.product_list.map(el=>{
|
|
|
|
- if(!el.sn_code_list){
|
|
|
|
- el.sn_code_list=[]
|
|
|
|
|
|
+ response.product_list.map((el) => {
|
|
|
|
+ if (!el.sn_code_list) {
|
|
|
|
+ el.sn_code_list = [];
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
this.goodsExchangeAddForm.distribution_name = response.staff_name;
|
|
this.goodsExchangeAddForm.distribution_name = response.staff_name;
|
|
- this.goodsExchangeAddForm.product_list =
|
|
|
|
- response.product_list;
|
|
|
|
- /* .map((item) => {
|
|
|
|
|
|
+ this.goodsExchangeAddForm.product_list = response.product_list;
|
|
|
|
+ /* .map((item) => {
|
|
//change_list
|
|
//change_list
|
|
item.name=item.goods_do.name
|
|
item.name=item.goods_do.name
|
|
item.sn=item.goods_do.sn
|
|
item.sn=item.goods_do.sn
|