<template>
|
<view class="overflow" style="padding-bottom: 150px">
|
<cu-custom bgColor="bg-white" :isBack="true">
|
<block slot="backText"> </block>
|
<block slot="content">
|
<span v-if="orderType == 1">整体拣货</span>
|
<span v-if="orderType == 2">逐件拣货</span>
|
</block>
|
</cu-custom>
|
<!-- <view class="flex justify-end align-center padding_right30rpx padding10">
|
<text class="fontSize12rpx"> 操作人:{{ operator }} </text>
|
</view> -->
|
<modal-code ref="resmodal" :rescode="rescode" :resmessage="resmessage" />
|
<u-select
|
v-model="containerVisible"
|
:list="containerList"
|
@confirm="containerConfirm"
|
></u-select>
|
<u-select
|
v-model="containerVisibleDo"
|
:list="containerListDo"
|
@confirm="containerConfirmDo"
|
></u-select>
|
<view class="" v-if="renameFocus">
|
<u-form
|
labelPosition="left"
|
label-width="180rpx"
|
:model="warehouse"
|
ref="warehouseRef"
|
>
|
<u-row
|
class="border_bottom margin_top10rpx padding_left25rpx"
|
style="background-color: #fff"
|
>
|
<u-col span="12">
|
<u-form-item
|
label="容器编号:"
|
prop="containerCode"
|
required
|
class="uFormItem"
|
>
|
<u-input
|
:focus="curFoucus"
|
v-model.trim="warehouse.containerCode"
|
@confirm="getOutWarehouse(1)"
|
:clearable="false"
|
@focus="warehouse.containerCode = ''"
|
placeholder="请扫码录入"
|
>
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
<!-- 逐件拣货2 -->
|
<u-row
|
class="border_bottom margin_top10rpx padding_left25rpx"
|
style="background-color: #fff"
|
v-if="this.orderType == 2"
|
>
|
<u-col span="10">
|
<u-form-item label="下架单号:" prop="DoOrderNo" class="uFormItem">
|
<u-input
|
v-model.trim="warehouse.DoOrderNo"
|
placeholder="请录入或扫码"
|
@focus="warehouse.DoOrderNo = ''"
|
class="width"
|
:clearable="false"
|
@confirm="orderBlurDo"
|
>
|
</u-input>
|
</u-form-item>
|
</u-col>
|
<u-col span="2" @tap="containerFocusDo">
|
<span class="fontSize15rpx">选择</span>
|
<u-icon name="arrow-right" size="14" class="fontSize15rpx"></u-icon>
|
</u-col>
|
</u-row>
|
|
<!-- 逐件拣货2 -->
|
<u-row
|
class="border_bottom margin_top10rpx padding_left25rpx"
|
style="background-color: #fff"
|
v-if="this.orderType == 2"
|
>
|
<u-col span="12">
|
<u-form-item label="物料跟踪码:" class="uFormItem">
|
<u-input
|
v-model="warehouse.SNCode"
|
@focus="warehouse.SNCode = ''"
|
placeholder="请录入或扫码"
|
@confirm="getOutWarehouse"
|
:clearable="false"
|
>
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
|
<!-- 整体拣货1 -->
|
<u-row
|
class="border_bottom margin_top10rpx padding_left25rpx"
|
style="background-color: #fff"
|
v-if="this.orderType == 1"
|
>
|
<u-col span="12">
|
<u-form-item label="物料编号:" class="uFormItem">
|
<u-input
|
v-model="warehouse.materialCode"
|
@focus="warehouse.materialCode = ''"
|
placeholder="请录入或扫码"
|
@blur="getMaterialDetails"
|
>
|
</u-input>
|
</u-form-item>
|
</u-col>
|
</u-row>
|
</u-form>
|
<view>
|
<view
|
v-for="(item, eindex) in singlist"
|
:key="eindex"
|
style="width: 100vw; display: flex; margin: 5px auto"
|
>
|
<u-swipe-action
|
:show="item.show"
|
:index="eindex"
|
@click="longpress"
|
@open="open"
|
:options="options"
|
style="width: 100vw"
|
>
|
<view
|
class="fontSize32rpx background_fff padding10"
|
:class="item.showItem ? 'bg_item' : ''"
|
style="width: 100vw"
|
>
|
<u-row>
|
<u-col span="1">
|
<view
|
class="flex justify-center align-center"
|
style="
|
background-color: #f18202;
|
color: #fff;
|
border-radius: 50%;
|
width: 40rpx;
|
height: 40rpx;
|
"
|
>
|
{{ eindex + 1 }}
|
</view>
|
</u-col>
|
<u-col span="11">
|
<view class="color_f18202">
|
{{ item.materialCode }}-{{ item.materialName }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row v-if="orderType == 2">
|
<u-col span="12">
|
<view class="color_80 padding_left25rpx">
|
下架单号:{{ item.relationNo }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row v-if="orderType == 2">
|
<u-col span="12">
|
<view class="color_80 padding_left25rpx">
|
物料跟踪码:{{ item.snCode }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="color_80 padding_left25rpx">
|
分拣需求数:{{ item.quantity }}
|
</view>
|
</u-col>
|
<u-col span="6">
|
<view class="color_80">
|
库位编号:{{ item.containerCode }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="6">
|
<view class="color_80 padding_left25rpx">
|
已分拣数:{{ item.pickQuantity }}
|
</view>
|
</u-col>
|
<u-col span="6" class="flex" v-if="orderType == 1">
|
<view class="color_80"> 实际分拣数: </view>
|
<input
|
class="border_bottom_f18202 text-left color_f18202 fontSize32rpx"
|
style="
|
background-color: #f2f2f2;
|
height: 70rpx;
|
width: 100rpx;
|
"
|
v-model="item.uncollectedQuantity"
|
type="number"
|
@blur="changeNum(item)"
|
placeholder=""
|
/>
|
</u-col>
|
|
<u-col span="5" class="flex" v-if="orderType == 2">
|
<view class="color_f18202">
|
实际分拣数:{{ item.uncollectedQuantity }}
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
</u-swipe-action>
|
</view>
|
</view>
|
<u-popup
|
v-model="detailshow"
|
border-radius="14"
|
@close="detailshow = false"
|
mode="bottom"
|
>
|
<view class="pop">
|
<h2 class="text_align_center padding_bottom18 padding15">物料信息</h2>
|
<scroll-view
|
scroll-y="true"
|
style="height: 50vh; margin-bottom: 140rpx"
|
>
|
<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>
|
<view class="line flex justify-between">
|
<text class="text-gray">容器编号</text>
|
<text>{{ materlist.containerCode }}</text>
|
</view>
|
|
<view class="line flex justify-between">
|
<text class="text-gray">关联单号</text>
|
<text>{{ materlist.relationNo }}</text>
|
</view>
|
<view class="line flex justify-between ">
|
<text class="text-gray">异常原因:</text>
|
<input class="textyc" v-model="materlist.exceptionReason"></input>
|
</view>
|
<view class="line flex justify-between">
|
<text class="text-gray">异常数量:</text>
|
<input
|
type="number" class="textyc"
|
v-model="materlist.exceptionQuality"
|
></input>
|
</view>
|
</scroll-view>
|
</view>
|
<button-modal
|
:cleaningShow="true"
|
allTitle="重置"
|
cleaningTitle="异常汇报"
|
@allsubmit="init(1)"
|
@submit="init(2)"
|
/>
|
</u-popup>
|
<button-modal
|
:empTytowerShow="true"
|
cleaningTitle="返回"
|
garmenTitle="下一步"
|
@submit="next"
|
@reset="rest"
|
/>
|
</view>
|
<view class="" v-if="!renameFocus">
|
<view>
|
<view
|
v-for="(item, eindex) in arr"
|
:key="eindex"
|
class="fontSize32rpx padding10 margin_top10rpx background_fff"
|
>
|
<u-row>
|
<u-col span="12" class="flex">
|
<view
|
class="flex justify-center align-center"
|
style="
|
background-color: #f18202;
|
color: #fff;
|
border-radius: 50vh;
|
width: 20px;
|
height: 20px;
|
"
|
>
|
{{ eindex + 1 }}
|
</view>
|
<view class="padding_left10rpx color_f18202">
|
{{ item.materialCode }}-{{ item.materialName }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row v-if="orderType == 2">
|
<u-col span="12">
|
<view class="color_80 padding_left25rpx">
|
下架单号:{{ item.relationNo }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row v-if="orderType == 2">
|
<u-col span="12">
|
<view class="color_80 padding_left25rpx">
|
物料跟踪码:{{ item.snCode }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="12">
|
<view class="color_80 padding_left25rpx">
|
库位编号:{{ item.containerCode }}
|
</view>
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="8">
|
<view class="color_80 padding_left25rpx">
|
需求分拣:{{ item.quantity }}
|
</view>
|
</u-col>
|
<u-col span="4" class="color_80">
|
已分拣数:{{ item.pickQuantity }}
|
</u-col>
|
</u-row>
|
<u-row>
|
<u-col span="8">
|
<view class="color_80 padding_left25rpx">
|
实际分拣:{{ item.uncollectedQuantity }}
|
</view>
|
</u-col>
|
<u-col span="4">
|
<view class="color_f18202">
|
剩余:{{
|
Number(
|
item.quantity - item.pickQuantity - item.uncollectedQuantity
|
).toFixed(3)
|
}}
|
</view>
|
</u-col>
|
</u-row>
|
</view>
|
</view>
|
</view>
|
<button-modal
|
v-if="!renameFocus"
|
:empTytowerShow="true"
|
cleaningTitle="上一步"
|
garmenTitle="分拣完成"
|
@submit="submit"
|
@reset="back"
|
/>
|
</view>
|
</template>
|
|
<script>
|
import ButtonModal from "../../components/buttonModal.vue";
|
import ModalCode from "../../components/ModalCode.vue";
|
import {
|
getOutWarehousePO,
|
addWarehouseDetailsPO,
|
addSortExceptionFlagConfirm,
|
} from "../../api/sort.js";
|
import { getDate } from "../../utils/dateTime.js";
|
import { getAllOrderDo } from "../../api/deliver.js";
|
export default {
|
data() {
|
return {
|
curFoucus: true,
|
ermNum: "",
|
contLabel: 1,
|
containerVisibleDo: false,
|
containerListDo: [],
|
containerVisible: false,
|
containerList: [],
|
renameFocus: true,
|
detailshow: false,
|
rescode: 0,
|
resmessage: "",
|
modalshow: false,
|
action: this.$myHOST + "/sysFileInfo/uploadImages",
|
singlist: [], //物料详情
|
arr: [],
|
materlist: {}, //物料详情数据
|
warehouse: {
|
containerCode: "",
|
DoOrderNo: "",
|
SNCode: "",
|
},
|
activeIndex: 100,
|
detailable: false,
|
materialCode: "", //物料编号
|
warehouseRules: {},
|
options: [
|
{
|
text: "详情",
|
style: {
|
backgroundColor: "#fc9f35",
|
},
|
},
|
],
|
operator: "",
|
Datetime: getDate(),
|
orderType: "",
|
};
|
},
|
components: {
|
ButtonModal,
|
ModalCode,
|
},
|
onLoad(option) {
|
if (option.orderType) {
|
this.orderType = option.orderType;
|
}
|
},
|
onReady() {
|
this.$refs.warehouseRef.setRules(this.warehouseRules);
|
},
|
mounted() {
|
this.operator = JSON.parse(uni.getStorageSync("userInfo")).name;
|
},
|
computed: {
|
containerCode() {
|
return this.warehouse.containerCode;
|
},
|
},
|
watch: {
|
containerCode(val) {
|
if (!val) {
|
this.detailable = false;
|
}
|
},
|
},
|
methods: {
|
//DO容器选择 0712
|
containerConfirmDo(context) {
|
this.warehouse.DoOrderNo = context[0].value;
|
this.orderBlurDo();
|
},
|
//DO容器聚焦事件
|
containerFocusDo() {
|
getAllOrderDo({
|
OrderType: 5,
|
page: 1,
|
pageSize: 20,
|
orderStatus: 1, //处理中
|
}).then((res) => {
|
if (res.result && res.result.items) {
|
var arr = res.result.items;
|
this.containerListDo = arr.reduce((curr, item) => {
|
curr.push({
|
label: item.orderNo,
|
// label: item.orderNo + '; 时间:' + item.createTime ,
|
value: item.orderNo,
|
});
|
return curr;
|
}, []);
|
}
|
this.containerVisibleDo = true;
|
});
|
},
|
// DO单号
|
orderBlurDo() {
|
if (this.warehouse.DoOrderNo == "") {
|
return;
|
}
|
this.containerFocus();
|
},
|
|
//打印
|
init(param) {
|
if (param == 1) {
|
// 重置
|
this.materlist.exceptionReason = "";
|
this.materlist.exceptionQuality = 0;
|
return;
|
}
|
|
if (!this.materlist.exceptionReason) {
|
this.detailshow = false;
|
this.rescode = 400;
|
this.resmessage = `异常原因不能为空`;
|
this.$refs.resmodal.show = true;
|
return;
|
}
|
|
if (!this.materlist.exceptionQuality) {
|
this.detailshow = false;
|
this.rescode = 400;
|
this.resmessage = `异常数量大于0`;
|
this.$refs.resmodal.show = true;
|
return;
|
}
|
if(Number(this.materlist.exceptionQuality) > Number(this.materlist.uncollectedQuantity) ){
|
this.detailshow = false;
|
this.rescode = 400;
|
this.resmessage = `异常数量大于实际分拣数`;
|
this.$refs.resmodal.show = true;
|
return;
|
}
|
if (param == 2) {
|
// 异常汇报
|
this.detailshow = false;
|
debugger;
|
addSortExceptionFlagConfirm({
|
ContainerCode: this.materlist.containerCode,
|
ExceptionReason: this.materlist.exceptionReason,
|
SortExceptionFlagDetailsConfirmList: [
|
{
|
ContainerSortId: this.materlist.id,
|
...this.materlist,
|
},
|
],
|
}).then((res) => {
|
this.rescode = res.code;
|
this.resmessage = res.message;
|
this.$refs.resmodal.show = true;
|
if (res.code == 200) {
|
this.renameFocus = true;
|
this.resmessage = "异常汇报成功";
|
this.warehouse.containerCode = this.materlist.containerCode;
|
this.materlist = {};
|
this.getOutWarehouse(1)
|
}
|
});
|
}
|
},
|
//获取print date print time
|
getCurrentDate() {
|
let date = new Date();
|
let year = date.getFullYear(); //年
|
let month = date.getMonth() + 1; //月
|
month = month >= 10 ? month : "0" + month;
|
let day = date.getDate(); //日
|
day = day >= 10 ? day : "0" + day;
|
let hour = date.getHours(); //时
|
hour = hour >= 10 ? hour : "0" + hour;
|
let min = date.getMinutes(); //分
|
min = min >= 10 ? min : "0" + min;
|
let second = date.getSeconds(); //秒
|
second = second >= 10 ? second : "0" + second;
|
return {
|
date: `${day}.${month}.${year}`,
|
time: `${hour}:${min}:${second}`,
|
formate: `${year}/${month}/${day}`,
|
};
|
},
|
//容器选择 8888
|
containerConfirm(context) {
|
this.getOutWarehouse();
|
},
|
//容器聚焦事件
|
containerFocus() {
|
this.getContainerList();
|
},
|
//获取当前区域的需要分拣的容器列表
|
getContainerList() {
|
if (this.warehouse.DoOrderNo == "") {
|
uni.showToast({
|
title: "请选择或者DO单号",
|
icon: "none",
|
duration: 2000,
|
});
|
return;
|
}
|
this.getOutWarehouse();
|
},
|
//查询物料
|
getOutWarehouse() {
|
this.$refs.warehouseRef.validate((valid) => {
|
if (valid) {
|
if (!this.warehouse.containerCode) {
|
uni.showToast({
|
title: "容器编号必填!",
|
icon: "none",
|
duration: 2000,
|
});
|
return;
|
}
|
this.focu = false;
|
let params = {
|
ContainerCode: this.warehouse.containerCode,
|
RelationNo: this.warehouse.DoOrderNo,
|
SNCode: this.warehouse.SNCode,
|
OrderType: 5,
|
};
|
getOutWarehousePO(params).then((res) => {
|
if (res.code == 200) {
|
var resArr = res.result;
|
if (resArr.length == 0) {
|
this.resmessage = "查无物料数据";
|
this.rescode = 400;
|
this.$refs.resmodal.show = true;
|
this.singlist = [];
|
} else {
|
// 整体拣货
|
if (this.orderType == 1) {
|
resArr.map((item) => {
|
item.uncollectedQuantity = Number(
|
Number(item.quantity) - Number(item.pickQuantity)
|
).toFixed(3);
|
item.showItem = false;
|
return item;
|
});
|
}
|
// 逐件拣货
|
if (this.orderType == 2) {
|
resArr.map((item) => {
|
item.uncollectedQuantity = Number(
|
Number(item.quantity) - Number(item.pickQuantity)
|
).toFixed(3);
|
item.showItem = false;
|
return item;
|
});
|
}
|
this.singlist = resArr;
|
}
|
} else {
|
this.resmessage = res.message;
|
this.rescode = res.code;
|
this.$refs.resmodal.show = true;
|
}
|
});
|
}
|
});
|
},
|
//判断此物料编号是否存在
|
getMaterialDetails() {
|
// this.materialCode = getAttrValue(this.materialCode, 'PARTSNUMBER')
|
if (this.warehouse.materialCode !== "") {
|
//获取当前物料 + 批次的所有数据
|
const arr = this.singlist.reduce((curr, item, index) => {
|
if (item.materialCode == this.warehouse.materialCode) {
|
curr.push(index);
|
}
|
return curr;
|
}, []);
|
|
if (arr.length > 0) {
|
arr.forEach((item) => {
|
this.singlist[item].showItem = true;
|
this.singlist.unshift(...this.singlist.splice(item, 1));
|
});
|
} else {
|
uni.showModal({
|
title: "提示",
|
content: "当前分拣单中不需分拣此物料",
|
showCancel: false,
|
});
|
}
|
}
|
},
|
//详情
|
longpress(index, eindex) {
|
this.singlist[index].exceptionQuality = 0;
|
this.materlist = this.singlist[index];
|
this.activeIndex = index;
|
this.detailshow = true;
|
},
|
// 如果打开一个的时候,不需要关闭其他,则无需实现本方法
|
open(index) {
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
// 原本为'false',再次设置为'false'会无效
|
this.singlist[index].show = true;
|
this.singlist.map((val, idx) => {
|
if (index != idx) this.singlist[idx].show = false;
|
});
|
},
|
//改变组盘数量
|
changeNum(val) {
|
if (
|
parseFloat(val.uncollectedQuantity) < 0 ||
|
val.uncollectedQuantity == ""
|
) {
|
uni.showModal({
|
title: "提示",
|
content: "分拣数量不能小于0",
|
showCancel: false,
|
});
|
}
|
// val.uncollectedQuantity = Number(val.uncollectedQuantity.toString().match(/^\d+(?:\.\d{0,2})?/)) // 保留两位小数
|
// let num1 = Number(Number(val.quantity) - Number(val.sortingQuantity)).toFixed(3) //必须保留3位小数 -否则会造成剩余物料是小数的时候,无法收货
|
// 越库-数量不计入 造成bug
|
if (parseFloat(val.uncollectedQuantity) > Number(val.quantity)) {
|
uni.showModal({
|
title: "提示",
|
content: "分拣数量不能大于需求数",
|
showCancel: false,
|
});
|
}
|
},
|
//确认
|
next() {
|
if (this.singlist.length == 0) {
|
this.rescode = 400;
|
this.resmessage = `没有可操作的物料`;
|
this.$refs.resmodal.show = true;
|
return;
|
} else {
|
if (this.orderType == 1) {
|
this.arr = this.singlist.reduce((curr, item) => {
|
let { uncollectedQuantity, quantity, ...rest } = item;
|
if (Number(item.uncollectedQuantity) > 0) {
|
curr.push(item);
|
}
|
return curr;
|
}, []);
|
} else {
|
this.arr = this.singlist;
|
}
|
console.log(this.arr);
|
this.renameFocus = false;
|
}
|
},
|
submit() {
|
let sortingLists = this.arr.reduce((curr, item) => {
|
let { uncollectedQuantity, quantity, ...rest } = item;
|
if (Number(item.uncollectedQuantity) > 0) {
|
curr.push({
|
...rest,
|
OccQuality: item.uncollectedQuantity,
|
ContainerSortId: item.id,
|
});
|
}
|
return curr;
|
}, []);
|
if (sortingLists.length <= 0) {
|
uni.showToast({
|
title: "没有需要提交的数据!",
|
icon: "none",
|
duration: 2000,
|
});
|
return;
|
}
|
let params = {
|
ContainerCode: this.warehouse.containerCode,
|
SortDetailsConfirmlist: sortingLists,
|
};
|
uni.showModal({
|
title: "提示",
|
content: "确定是否分拣?",
|
showCancel: true,
|
cancelColor: "#333333",
|
success: (res) => {
|
if (res.confirm) {
|
addWarehouseDetailsPO(params).then((res) => {
|
this.rescode = res.code;
|
this.resmessage = res.message;
|
this.$refs.resmodal.show = true;
|
if (res.code == 200) {
|
this.renameFocus = true;
|
this.resmessage = "拣货成功";
|
this.resetData();
|
}
|
});
|
} else if (res.cancel) {
|
}
|
},
|
});
|
},
|
//数据重置
|
resetData() {
|
this.warehouse.gridNumber = 1;
|
this.warehouse.useNumber = 0;
|
this.warehouse.exitNumber = 0;
|
this.materialCode = "";
|
this.arr = [];
|
this.singlist = [];
|
},
|
//回库
|
rest() {
|
uni.navigateTo({
|
url: `/pages/index/index`,
|
});
|
},
|
//上一步
|
back() {
|
this.renameFocus = true;
|
},
|
},
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.bg_item {
|
background: #ffebcd !important;
|
}
|
|
.textyc{
|
margin-top: 10px;
|
}
|
</style>
|