<template>
|
<view class="overflow" style="padding-bottom:400px">
|
<!-- 顶部 -->
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText"></block>
|
<block slot="content">物料合并</block>
|
</cu-custom>
|
<!-- 操作人 -->
|
<!-- <view class="flex justify-end align-center padding_right30rpx padding_top12rpx">
|
<text class="fontSize12rpx"> 操作人:{{operator}} </text>
|
</view> -->
|
|
<div class="boxProp">
|
<view class="line">
|
<text class="text-gray">
|
<span style="display: inline-block;width: 75px;">新跟踪码 </span>
|
</text>
|
<text>
|
{{ materlist.snCode }}
|
</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">数量</text>
|
<text>{{ materlist.quantity }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料编号</text>
|
<text>{{ materlist.materialCode }}</text>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">物料名称</text>
|
<text>{{ materlist.materialName }}</text>
|
</view>
|
</div>
|
|
<!-- 遮挡层 -->
|
<modal-code ref="resmodal" :rescode='rescode' :resmessage='resmessage' />
|
<view class="">
|
<u-form labelPosition="left" :model="warehouse" label-width="180rpx" ref="warehouseRef">
|
<u-row class="border_bottom margin_top10rpx background_fff padding_left25rpx">
|
<u-col span="12">
|
<u-form-item required label="物料跟踪码:" class="uFormItem">
|
<u-input v-model.trim="warehouse.snCode" placeholder="请录入或扫码" @focus="warehouse.snCode = ''"
|
class="width padding_left25rpx" :focus="true" @confirm="materialBlur(1)">
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
</u-form>
|
<view v-for="(item, eindex) in singlist" :key="eindex" class="margin_top10rpx">
|
<u-swipe-action :show="item.show" :index="eindex" @click="longpredel" @open="open" @close="close"
|
:options="options">
|
<view class="fontSize32rpx background_fff padding10" :class="item.isYueku == '是' ? 'bg_item' : ''"
|
style="width: 100vw">
|
<u-row>
|
<u-col span="12">
|
<label class="flex align-center">
|
<text class="flex justify-center align-center circkle06">{{ eindex + 1 }}</text>
|
<view class="color_f18202 padding_left10rpx" style="flex: 1; word-break: break-all">
|
{{ item.materialCode }}-{{ item.materialName }}
|
</view>
|
</label>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="padding_left25rpx" style="color: #808080">
|
跟踪码:{{ item.snCode }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="padding_left25rpx" style="color: #808080">
|
批次:{{ item.batch }}
|
</view>
|
</u-col>
|
</u-row>
|
<!-- <u-row>
|
<u-col span="7">
|
<view class="padding_left25rpx" style="color: #808080">
|
最高库存数:{{ Number(item.maxImumqty).toFixed(3) }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="color: #808080">
|
库存数:{{ Number(item.stockQty).toFixed(3) }}
|
</view>
|
</u-col>
|
</u-row> -->
|
<!-- <u-row>
|
<u-col span="7">
|
<view class="padding_left25rpx" style="color: #808080">
|
行号:{{ item.asnLineNumber }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="color: #808080">
|
转换率:{{ item.translateRate }}
|
</view>
|
</u-col>
|
</u-row> -->
|
|
<u-row>
|
<u-col span="7">
|
<view class="padding_left25rpx" style="color: #808080">
|
容器编号:{{ item.containerCode }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="color: #808080">
|
库存单位:{{ item.materialUnit }}
|
</view>
|
</u-col>
|
</u-row>
|
|
<u-row>
|
<u-col span="7">
|
<view class="padding_left25rpx" style="color: #808080">
|
库存状态:{{ item.stockStatusName }}
|
</view>
|
</u-col>
|
<u-col span="5">
|
<view class="" style="color: #f18202">
|
数量:{{ Number(item.quantity).toFixed(3) }}
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
</u-swipe-action>
|
</view>
|
|
<button-modal :empTytowerShow='true' cleaningTitle="打印" garmenTitle='确认' @submit='submit' @reset='print' />
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from '@/components/buttonModal.vue'
|
import ModalCode from '@/components/ModalCode.vue'
|
import { getSGjRuKuMaterialHander, addWarehouseHbHander,outBoundOrderHander } from '@/api/hander/hander.js'
|
export default {
|
data() {
|
return {
|
renameFocus: true,
|
detailshow: false,
|
rescode: 0,
|
autoFoucs: true,
|
resmessage: "",
|
current: 0, //滑块默认值
|
singlist: [], //物料详情
|
materlist: {
|
snCode:"",
|
quantity:0,
|
materialCode:"",
|
materialName:"",
|
}, //物料详情数据
|
warehouse: {
|
snCode: '',
|
quantity: 0
|
},
|
warehouseRules: {
|
snCode: [{
|
required: true,
|
message: '物料跟踪码不能为空',
|
trigger: 'blur'
|
}]
|
},
|
options: [
|
{
|
text: '删除',
|
style: {
|
backgroundColor: '#fc4b4b'
|
}
|
}
|
]
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode,
|
},
|
onLoad() {
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules)
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync('userInfo')).name
|
},
|
methods: {
|
//物料查询
|
materialBlur() {
|
if (!this.warehouse.snCode) {
|
this.resmessage = "请扫物料跟踪码";
|
this.rescode = 400;
|
this.showBtn = 0;
|
this.$refs.resmodal.show = true;
|
return
|
}
|
getSGjRuKuMaterialHander({
|
page: 1,
|
pageSize: 1,
|
SNCodeForPda: this.warehouse.snCode
|
}).then((res) => {
|
if (res.code == 200) {
|
var arrList = res.result.items;
|
if (arrList.length == 0) {
|
this.resmessage = "暂无数据";
|
this.rescode = 400;
|
this.showBtn = 0;
|
this.$refs.resmodal.show = true;
|
}
|
if (Array.isArray(arrList) && arrList.length >= 1) {
|
var IDM = arrList[0].snCode;
|
var arrNo = this.singlist.findIndex((v) => v.snCode == IDM);
|
if (arrNo == -1) {
|
this.singlist.unshift(arrList[0]);
|
this.$forceUpdate()
|
|
if (this.singlist.length == 1) {
|
this.materlist = JSON.parse(JSON.stringify(arrList[0]));
|
this.materlist.snCode = "HB_" + arrList[0].snCode;
|
// this.materlist.materialCode = arrList[0].materialCode
|
// this.materlist.materialName = arrList[0].materialName
|
}
|
this.materlist.quantity = this.singlist.reduce((prev, next) => {
|
let num = Number(prev) + Number(next.quantity);
|
return Number(num).toFixed(3);
|
}, 0);
|
} else {
|
this.resmessage = `跟踪码${arrList[0].snCode}已存在!`;
|
this.rescode = 400;
|
this.showBtn = 0;
|
this.$refs.resmodal.show = true;
|
}
|
|
// var stockQty = arrList[0].stockQty || 0;
|
// var allHe = Number(arrList[0].quantity + stockQty).toFixed(3);
|
// //最高库存maxImumqty < 收货数quantity + 库存数stockQty
|
// if (arrList[0].maxImumqty && arrList[0].maxImumqty > 0 &&
|
// (arrList[0].maxImumqty < allHe)) {
|
// uni.showModal({
|
// title: "提示",
|
// content: "超出最高库存,是否继续收货?",
|
// showCancel: true,
|
// cancelColor: "#333333",
|
// success: (res) => {
|
// if (res.confirm) {
|
// arrList.forEach((item) => {
|
// var arrNo = this.singlist.findIndex((v) => v.id == item.id);
|
// if (arrNo == -1) {
|
// this.singlist.unshift(item);
|
// }
|
// });
|
// } else if (res.cancel) {
|
// }
|
// },
|
// });
|
// } else {
|
// arrList.forEach((item) => {
|
// var arrNo = this.singlist.findIndex((v) => v.id == item.id);
|
// if (arrNo == -1) {
|
// this.singlist.unshift(item);
|
// }
|
// });
|
// }
|
} else {
|
this.resmessage = "暂无数据";
|
this.rescode = 400;
|
this.showBtn = 0;
|
this.$refs.resmodal.show = true;
|
}
|
}
|
});
|
},
|
//删除详情
|
longpredel(index, eindex) {
|
if (eindex == 0) {
|
uni.showModal({
|
title: "提示",
|
content: "是否确认删除?",
|
showCancel: true,
|
cancelColor: "#333333",
|
success: (res) => {
|
if (res.confirm) {
|
|
if(this.singlist.length == 1 ){ // 只剩一个
|
this.singlist.splice(index, 1);
|
this.materlist = {}
|
}else{
|
this.singlist.splice(index, 1);
|
var itemNew = this.singlist[this.singlist.length - 1]
|
debugger
|
this.materlist.snCode = "HB_" + itemNew.snCode;
|
this.materlist.materialCode = itemNew.materialCode;
|
this.materlist.materialName = itemNew.materialName;
|
this.materlist.quantity = this.singlist.reduce((prev, next) => {
|
let num = Number(prev) + Number(next.quantity);
|
return Number(num).toFixed(3);
|
}, 0);
|
}
|
|
} else if (res.cancel) {
|
}
|
},
|
});
|
} else {
|
this.materlist = this.singlist[index]
|
this.detailshow = true
|
}
|
},
|
//卡片选中
|
click(e) {
|
e.cardNum = true
|
this.$forceUpdate()
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].cardNum = true;
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
})
|
this.$forceUpdate()
|
},
|
close(index) {
|
this.singlist[index].show = false;
|
this.singlist[index].cardNum = false;
|
this.$forceUpdate()
|
},
|
|
//确认
|
submit() {
|
if (this.singlist.length <= 1) {
|
uni.showToast({
|
title: "请扫码跟踪码",
|
icon: "none",
|
duration: 2000,
|
});
|
return
|
}
|
var list = []
|
this.singlist.forEach((item) => {
|
list.push(item.snCode)
|
})
|
uni.showModal({
|
title: '提示',
|
content: '是否确认物料合并?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
addWarehouseHbHander({
|
quantity: this.materlist.quantity,
|
snCode: this.materlist.snCode,
|
'snCodeList': list
|
}).then((res) => {
|
this.rescode = res.code
|
this.resmessage = "物料合并成功"
|
this.$refs.resmodal.show = true
|
if (res.code == 200) {
|
this.renameFocus = true
|
this.rest()
|
}
|
})
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
|
},
|
//清楚选中
|
rest() {
|
this.warehouse.snCode = '';
|
|
this.materlist.snCode = '';
|
this.materlist.quantity = 0;
|
this.materlist.materialCode = "";
|
this.materlist.materialName = "";
|
this.autoFoucs = true
|
this.singlist = [];
|
},
|
print(){
|
if (this.singlist.length <= 0) {
|
uni.showToast({
|
title: "请扫码跟踪码",
|
icon: "none",
|
duration: 2000,
|
});
|
return
|
}
|
if (!this.materlist.snCode) {
|
uni.showToast({
|
title: "请扫码跟踪码",
|
icon: "none",
|
duration: 2000,
|
});
|
return
|
}
|
uni.showModal({
|
title: '提示',
|
content: '是否确认打印?',
|
showCancel: true,
|
cancelColor: '#333333',
|
success: (res => {
|
if (res.confirm) {
|
var {orderNo,relationNo ,orderNoLineNumber,relationNoLineNumber, ...rest } = this.materlist
|
var param = [
|
{
|
...rest,
|
orderNo:this.materlist.relationNo,
|
PrintType:1, //打印类型:物料跟踪码
|
typeForPda:2 // 物料拆分1 物料合并2
|
}
|
]
|
outBoundOrderHander(param).then((res) => {
|
this.rescode = res.code
|
this.resmessage = res.message
|
this.$refs.resmodal.show = true
|
if (res.code == 200) {
|
this.resmessage = "打印成功"
|
}
|
})
|
} else if (res.cancel) {
|
|
}
|
})
|
});
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.title-wrap {
|
background-color: white;
|
margin-top: 10px;
|
}
|
|
.boxProp {
|
position: fixed;
|
bottom: 150rpx;
|
left: 0;
|
width: 100%;
|
z-index: 9;
|
}
|
</style>
|