Browse Source

添加拆标签功能

intex
lijuncheng 2 weeks ago
parent
commit
964e24c55c
  1. 12
      src/api/request2.js
  2. 10
      src/mycomponents/balance/balance.vue
  3. 226
      src/mycomponents/qty/numbeIntegerrBox.vue
  4. 9
      src/mycomponents/record/recordComDetailCard.vue
  5. 9
      src/pages.json
  6. 391
      src/pages/label/record/splitLabel.vue
  7. 156
      src/pages/productionReturn/coms/comReturnDetailCardBatch.vue

12
src/api/request2.js

@ -4270,6 +4270,18 @@ export function splitPackageRecordSubmit(params) {
});
}
/**
* 拆包 英泰 提交
* @param {*} params
*/
export function splitPackageRecordForYtSubmit(params) {
return request({
url: baseApi + "/wms/packagesplit-main/createForYT",
method: "post",
data: params,
});
}
/**
* 合包 提交
* @param {*} params

10
src/mycomponents/balance/balance.vue

@ -4,7 +4,9 @@
<view>
<pack v-if="isShowParentPack &&dataContent.parentNumber" title="父包装"
:packingCode="dataContent.parentNumber"></pack>
<pack v-if="isShowPack && dataContent.packingNumber" :packingCode="dataContent.packingNumber"></pack>
<pack v-if="isShowPack && dataContent.packingNumber"
:isShowPackingNumberProps="isShowPackingNumberProps"
:packingCode="dataContent.packingNumber"></pack>
<batch v-if="isShowBatch && dataContent.batch" :batch="dataContent.batch"></batch>
<location title="来源库位" v-if="isShowFromLocation" :locationCode="dataContent.locationCode"></location>
<to-location title="目标库位" v-if="isShowToLocation" :locationCode="dataContent.toLocationCode">
@ -96,6 +98,12 @@
type: Boolean,
default: true
},
isShowPackingNumberProps: {
type: Boolean,
default: false
},
},
watch: {

226
src/mycomponents/qty/numbeIntegerrBox.vue

@ -0,0 +1,226 @@
<template>
<view class="uni-numbox">
<view @click="_calcValue('minus')" class="uni-numbox__minus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }">-</text>
</view>
<input :disabled="disabled" @input="onKeyInput" @blur="_onBlur" class="uni-numbox__value" type="number"
v-model="inputValue" />
<view @click="_calcValue('plus')" class="uni-numbox__plus uni-numbox-btns" :style="{background}">
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }">+</text>
</view>
</view>
</template>
<script>
/**
* NumberBox 数字输入框
* @description 带加减按钮的数字输入框
* @tutorial https://ext.dcloud.net.cn/plugin?id=31
* @property {Number} value 输入框当前值
* @property {Number} min 最小值
* @property {Number} max 最大值
* @property {Number} step 每次点击改变的间隔大小
* @property {String} background 背景色
* @property {Boolean} disabled = [true|false] 是否为禁用状态
* @event {Function} change 输入框值改变时触发的事件参数为输入框当前的 value
*/
export default {
name: "UniNumberBox",
emits: ['change'],
props: {
value: {
type: [Number, String],
default: 1
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
background: {
type: String,
default: '#f5f5f5'
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
inputValue: 0
};
},
watch: {
inputValue(newVal, oldVal) {
if (+newVal !== +oldVal) {
this.$emit("change", newVal);
}
}
},
created() {
this.inputValue = +this.value;
},
methods: {
setValue(value){
this.inputValue=value;
},
//
onKeyInput: function(event) {
//console.log( event.detail.value)
var hint = event.detail.value;
if (!Number.isInteger(hint)) {
//
var temp = hint.toString().match(/^\d+/)
if(Array.isArray(temp)){
this.inputValue =temp[0]
}else {
this.inputValue =temp
}
// this.inputValue = hint.toString().match(/^\d+/) || 0;
} else {
//
this.inputValue = hint;
}
},
//(minus:;plus:)
_calcValue(type) {
if (this.disabled) {
return;
}
const scale = this._getDecimalScale();
let value = this.inputValue * scale;
let step = this.step * scale;
if (type === "minus") {
value -= step;
if (value < (this.min * scale)) {
return;
}
if (value > (this.max * scale)) {
value = this.max * scale
}
} else if (type === "plus") {
value += step;
if (value > (this.max * scale)) {
return;
}
if (value < (this.min * scale)) {
value = this.min * scale
}
}
if ((value + '').length > 5) {
value = value.toFixed(0); //toFixed
}
this.inputValue = String(value / scale);
},
_getDecimalScale() {
let scale = 1;
//
// if (~~this.step !== this.step) {
// scale = Math.pow(10, (this.step + "").split(".")[1].length);
// }
return scale;
},
_onBlur(event) {
let value = event.detail.value;
if (!value) {
return;
}
value = +value;
if (value > this.max) {
value = this.max;
} else if (value < this.min) {
value = this.min;
}
this.inputValue = value;
/*小数点后保留四位*/
// if (value > 0) {
// event.detail.value =parseFloat(event.detail.value).toFixed(0)
// } else {
// event.detail.value =-parseFloat(event.detail.value).toFixed(0)
// }
//input
this.$nextTick(() => {
this.inputValue = event.detail.value;
})
}
}
};
</script>
<style lang="scss" scoped>
$box-height: 26px;
$bg: #f5f5f5;
$br: 2px;
$color: #333;
.uni-numbox {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
}
.uni-numbox-btns {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
padding: 0 8px;
background-color: $bg;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-numbox__value {
margin: 0 2px;
background-color: $bg;
width: 100px;
height: $box-height;
text-align: center;
font-size: 14px;
border-left-width: 0;
border-right-width: 0;
color: $color;
}
.uni-numbox__minus {
border-top-left-radius: $br;
border-bottom-left-radius: $br;
width: 64rpx;
}
.uni-numbox__plus {
border-top-right-radius: $br;
border-bottom-right-radius: $br;
width: 64rpx;
}
.uni-numbox--text {
// fix nvue
line-height: 20px;
font-size: 20px;
font-weight: 300;
color: $color;
}
.uni-numbox .uni-numbox--disabled {
color: #c0c0c0 !important;
/* #ifdef H5 */
cursor: not-allowed;
/* #endif */
}
</style>

9
src/mycomponents/record/recordComDetailCard.vue

@ -23,7 +23,9 @@
<uni-swipe-action-item @click="swipeClick($event,detail,index)"
:right-options="detail.scaned?scanOptions:detailOptions">
<balance :dataContent="detail" :isShowStdPack="false" :isShowStatus="isShowStatus"
:isShowPack="true" :isShowFromLocation="isShowFromLocation"
:isShowPack="true"
:isShowPackingNumberProps="isShowPackingNumberProps"
:isShowFromLocation="isShowFromLocation"
:isShowToLocation="isShowToLocation" :isShowParentPack="isShowParentPack">
</balance>
</uni-swipe-action-item>
@ -129,6 +131,11 @@
type: Boolean,
default: true
},
isShowPackingNumberProps: {
type: Boolean,
default: false
},
},

9
src/pages.json

@ -2668,6 +2668,15 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/label/record/splitLabel",
"style": {
"navigationBarTitleText": "拆标签",
"enablePullDownRefresh": false
}
},
{
"path": "pages/package/record/mergePackageRecord",
"style": {

391
src/pages/label/record/splitLabel.vue

@ -0,0 +1,391 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='openScanPopup' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<record-com-detail-card :dataContent="item" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack='updateData' :isShowToLocation="false"
:isShowPackingNumberProps="true" :isShowFromLocation="false" :isShowParentToLocation="false">
</record-com-detail-card>
</view>
</view>
<view class="uni-flex uni-row" style="margin-left: 30rpx;margin-top: 10rpx; ">
<text style="font-size: 35rpx; margin-right: 20rpx;">拆出数量 :</text>
<numbeIntegerrBox :min="1" :step="1" :max="9999999" @change="calcQty($event,splitCount)" :value="splitCount">
</numbeIntegerrBox>
<uom :uom="detailSource[0].uom"></uom>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after"
@click="$throttle(commit,2000,this)()">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-scan-pack ref="scanPopup" @getResult='getScanResult'></win-scan-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
goHome,
showConfirmMsg,
getCurrDateTime
} from '@/common/basic.js';
import {
splitPackageRecordForYtSubmit
} from '@/api/request2.js';
import {
calc
} from '@/common/calc.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
createItemInfo,
createDetailInfo,
calcHandleQty
} from '@/common/record.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recommendBalance from '@/mycomponents/balance/recommendBalance.vue'
import comPackageRecord from '@/pages/package/coms/comPackageRecord.vue'
import uom from '@/mycomponents/qty/uom.vue'
import numberBox from '@/mycomponents/qty/numberBox.vue'
import numbeIntegerrBox from '@/mycomponents/qty/numbeIntegerrBox.vue'
export default {
components: {
winScanButton,
winScanPack,
requiredLocation,
comBlankView,
winScanLocation,
winScanPackAndLocation,
recommendBalance,
recordComDetailCard,
comPackageRecord,
uom,
numberBox,
numbeIntegerrBox
},
data() {
return {
id: '',
detailSource: [], //
fromLocationCode: "",
toLocationCode: "",
fromLocationAreaTypeList: [],
inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {},
dataContent: {},
currentItemCode: "",
toPackingNumber: "",
itemCode: "",
splitCount: 1,
typeCode: "SplitPackage",
};
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
})
this.openScanPopup();
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
openScanPopup() {
setTimeout(res=>{
if (this.detailSource.length > 0) {
showConfirmMsg("拆包信息还没提交,是否要重新扫描?", res => {
if (res) {
this.clearData();
this.$refs.scanPopup.openScanPopup("");
}
})
} else {
this.$refs.scanPopup.openScanPopup("");
}
},100)
},
getScanResult(result) {
this.setData(result);
},
setData(result) {
let balance = result.balance;
let label = result.label;
let itemCode = result.label.itemCode
let batch = result.label.batch;
let pack = result.package;
pack.qty = result.label.qty;
pack.inventoryStatus = "OK"
this.fromPackUnit = pack.packUnit;
this.fromPack = pack;
var item = this.detailSource.find(res => {
if (res.itemCode == itemCode) {
return res
}
})
if (item == undefined) {
if (this.itemCode != "" && this.itemCode != itemCode) {
this.showErrorMessage("请扫描物料为【" + this.itemCode + "】的箱码")
return;
}
var itemp = createItemInfo(pack, pack);
itemp.handleQty = 0
let newDetail = createDetailInfo(pack, pack); //
newDetail.handleQty = 0
newDetail.scaned = false
newDetail.packingNumber = pack.number
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = itemCode;
this.closeScanPopup()
} else {
// var detail = item.subList.find(r => {
// if (r.packingNumber == pack.packingNumber &&
// r.batch == batch) {
// return r;
// }
// })
// if (detail == undefined) {
// let newDetail = createDetailInfo(pack, pack);
// newDetail.packingNumber=pack.number
// newDetail.handleQty = 0
// item.subList.push(newDetail);
// this.closeScanPopup()
// } else {
// if (detail.scaned == true) {
// this.showErrorMessage("[" + detail.packingNumber + "[" + balance.batch + "]")
// }
// }
}
this.calcHandleQty();
},
calcHandleQty() {
calcHandleQty(this.detailSource)
this.$forceUpdate();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
updateData() {
this.calcHandleQty();
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
if (item.qty == 0) {
this.detailSource.splice(i, 1)
}
}
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
commit() {
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
if (this.splitCount <= 0) {
this.showErrorMessage("拆出数量必须大于0")
return;
}
if (this.splitCount > this.detailSource[0].qty) {
this.showErrorMessage("拆出数量不能大于标签数量")
return;
}
uni.showLoading({
title: "提交中....",
mask: true
});
var params = this.setParams();
console.log("提交" + JSON.stringify(params))
splitPackageRecordForYtSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
let list = []
res.data.forEach(item => {
list.push({
itemCode: item.itemCode, //
itemName: item.itemName, //
packName: item.packName, //
packageCode: item.toPackingNumber, //
batch: item.toBatch, //
parentNumber: item.parentNumber, //
itemType: item.itemType, //
asnNumber: item.asnNumber, //ASN
supplierCode: item.supplierCode, //
qty: item.qty, //
printTimes: getCurrDateTime(), //
productionLineCode: item.productionLineCode, //线
barcodeString: item.barcodeString, //
barcodeBase64: '',
})
})
this.showCommitSuccessMessage("提交成功\n生成拆包记录\n", list)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
this.showErrorMessage("没有要提交的数据")
}
},
setParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
var subItem = {};
Object.assign(subItem, detail)
subItem.itemCode = subItem.itemCode;
subItem.itemName = detail.package.itemName;
subItem.itemDesc1 = detail.package.itemDesc1;
subItem.itemDesc2 = detail.package.itemDesc2;
subItem.fromInventoryStatus = subItem.inventoryStatus;
subItem.toInventoryStatus = subItem.inventoryStatus;
subItem.fromQty = subItem.qty
subItem.toQty = this.splitCount
subItem.fromPackingNumber = subItem.packingNumber;
subItem.toPackingNumber = subItem.packingNumber;
subItem.fromBatch = subItem.batch;
subItem.toBatch = subItem.batch;
subItem.locationCode = detail.locationCode;
subItem.package = ""
subItem.Records = ""
subList.push(subItem)
})
})
this.dataContent.subList = subList;
this.dataContent.creator = creator;
return this.dataContent;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
showCommitSuccessMessage(hint, pointData) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
if (pointData.length > 0) {
uni.navigateTo({
url: `/pages/point/index?points=${JSON.stringify(pointData)}`
});
}
})
},
clearData() {
this.detailSource = []
this.fromLocationCode = '';
this.currentItemCode = ""
this.dataContent = {}
this.itemCode = ""
this.splitCount = 1
},
calcQty(val) {
this.splitCount = val;
},
}
}
</script>
<style scoped lang="scss">
</style>

156
src/pages/productionReturn/coms/comReturnDetailCardBatch.vue

@ -0,0 +1,156 @@
<template>
<view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1" @change="">
<uni-collapse-item :open="true">
<template v-slot:title>
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty>
</template>
<view class="" v-for="(item,index) in dataContent.subList">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,item)"
:right-options="item.scaned?scanOptions:detailOptions">
<recommend :detail="item" :isShowLocation="false" :isShowFromLocation="false" :isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</uni-collapse-item>
</uni-collapse>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam"
@confirm="confirm">
</recommend-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationAreaTypeList="locationAreaTypeList"></win-scan-location>
<returnDetailInfoPopup ref="jobDetailPopup" :dataContent="showItem"></returnDetailInfoPopup>
<comMessage ref="message"></comMessage>
</view>
</template>
<script>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import jobDetailPopup from '@/mycomponents/detail/jobDetailPopup.vue'
import returnDetailInfoPopup from '@/pages/productionReturn/coms/returnDetailInfoPopup.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import {
getDetailOption,
getPurchaseReceiptOption
} from '@/common/array.js';
export default {
components: {
itemCompareQty,
recommend,
recommendQtyEdit,
jobDetailPopup,
returnDetailInfoPopup,
winScanLocation
},
props: {
dataContent: {
type: Object,
default: null
},
settingParam: {
type: Object,
default: null
},
locationAreaTypeList: {
type: Array,
default: null
},
},
watch: {
dataContent: {
handler(newName, oldName) {
if (this.dataContent.subList.length > 0) {
if (this.$refs.collapse1 != undefined && this.$refs.collapse1 != null) {
this.$nextTick(res => {
this.$refs.collapse1.resize()
})
}
}
},
immediate: true,
deep: true
}
},
data() {
return {
showItem: {},
editItem: {
record: {
}
},
locatonItem:{},
detailOptions: [],
scanOptions: []
}
},
mounted() {
if (this.detailOptions.length == 0) {
this.detailOptions = getDetailOption();
}
if (this.scanOptions.length == 0) {
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty,this.settingParam.allowModifyLocation)
}
},
methods: {
swipeClick(e, item) {
if (e.content.text == "详情") {
this.detail(item)
} else if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "库位") {
this.showLocation(item)
} else if (e.content.text == "移除") {
this.remove(item)
}
},
edit(item) {
this.editItem = item;
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty,item.labelQty);
},
showLocation(item) {
this.locatonItem =item;
this.$refs.scanLocationCode.openScanPopup();
},
//
getLocation(location, code) {
this.locatonItem.toLocationCode =code;
this.$emit('updateData')
},
detail(item) {
this.showItem = item;
this.$refs.jobDetailPopup.openPopup(item)
},
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
item.scaned = false
item.handleQty = null
this.$forceUpdate()
this.$emit('remove', item)
}
});
},
confirm(qty) {
this.editItem.handleQty = qty;
this.$emit('updateData')
}
}
}
</script>
<style>
</style>
Loading…
Cancel
Save