Browse Source

增加组件

hella_online_20240829
niexiting 4 months ago
parent
commit
d8d9a98fcc
  1. 6
      .env.development
  2. 4
      src/mycomponents/scan/winComScan.vue
  3. 98
      src/mycomponents/scan/winScanPackage.vue
  4. 168
      src/pages/material/materialDowngrade.vue

6
.env.development

@ -1,7 +1,7 @@
VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api #VITE_BASE_URL=http://dev.ccwin-in.com:25300/api/admin-api
VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api #VITE_BASE_URL_IMAGE=http://dev.ccwin-in.com:25300/api/admin-api
#VITE_BASE_URL=http://172.21.32.13:81/api/admin-api #VITE_BASE_URL_IMAGE=http://172.21.32.13:81/admin-api VITE_BASE_URL=http://172.21.32.13:81/api/admin-api VITE_BASE_URL_IMAGE=http://172.21.32.13:81/admin-api
# 租户配置 VITE_TENANT='[{"text":"长春1379","value":1},{"text":"成都1397","value":2},{"text":"长春2379","value":3}]' # 租户配置 VITE_TENANT='[{"text":"长春1379","value":1},{"text":"成都1397","value":2},{"text":"长春2379","value":3}]'
# 是否是测试环境 # 是否是测试环境

4
src/mycomponents/scan/winComScan.vue

@ -23,7 +23,7 @@
</view> </view>
<view style="width: 100%;"> <view style="width: 100%;">
<view style="width: 100%;" v-if="isShowHistory"> <view style="width: 100%;" v-if="isShowHistory&&scanList.length>0">
<view class="uni-flex uni-row space-between u-col-center"> <view class="uni-flex uni-row space-between u-col-center">
<view class="" style="padding: 10rpx;"> <view class="" style="padding: 10rpx;">
历史记录 历史记录
@ -33,7 +33,7 @@
</view> </view>
</view> </view>
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'></u-line> <u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'></u-line>
<scroll-view scroll-y="true" class="scroll-view" v-if="expand&&scanList.length>0" <scroll-view scroll-y="true" class="scroll-view" v-if="expand"
style="height: 70px;"> style="height: 70px;">
<view class="uni-flex u-col" v-for="(item,index) in scanList"> <view class="uni-flex u-col" v-for="(item,index) in scanList">
<view style="width: 100%;max-height: 100px;"> <view style="width: 100%;max-height: 100px;">

98
src/mycomponents/scan/winScanPackage.vue

@ -14,20 +14,24 @@
</view> </view>
<view class=""> <view class="">
<view class=""> <view class="">
<win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult" :headerType="headerType" <win-com-scan ref="comscan" :placeholder="title" @getResult="getScanResult"
:isShowHistory="isShowHistory" :clearResult="true"></win-com-scan> :headerType="headerType" :isShowHistory="isShowHistory" :clearResult="true"></win-com-scan>
</view> </view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<!-- 模拟扫描功能 --> <!-- 模拟扫描功能 -->
<win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType" :isShowHistory="false" :clearResult="true"></win-com-scan> <win-com-scan v-show="false" ref="comscansimulate" @getResult="getScanResult" :headerType="headerType"
:isShowHistory="false" :clearResult="true"></win-com-scan>
<comMessage ref="comMessage" @afterClose="getfocus"></comMessage> <comMessage ref="comMessage" @afterClose="getfocus"></comMessage>
</view> </view>
</template> </template>
<script> <script>
import winComScan from '@/mycomponents/scan/winComScan.vue' import winComScan from '@/mycomponents/scan/winComScan.vue'
import {
getBalanceByFilter
} from '@/api/request2.js';
export default { export default {
name: 'winScanPack', name: 'winScanPack',
@ -43,21 +47,22 @@
type: Boolean, type: Boolean,
default: true default: true
}, },
headerType:{ headerType: {
type: String, type: String,
default: 'HPQ' default: 'HPQ,HMQ'
} }
}, },
data() { data() {
return { return {
show: false, show: false,
businessType: null
} }
}, },
created() { created() {
}, },
methods: { methods: {
simulateScan(item){ simulateScan(item) {
this.$refs.comscansimulate.setItemCodeSimulate(item.copyContent) this.$refs.comscansimulate.setItemCodeSimulate(item.copyContent)
this.$refs.comscansimulate.clickScanMsg(); this.$refs.comscansimulate.clickScanMsg();
}, },
@ -67,32 +72,103 @@
}, 200) }, 200)
}, },
openScanPopupByBusinessType(businessType) {
setTimeout(res => {
this.$refs.popup.open('bottom')
this.businessType = businessType;
}, 200)
},
closeScanPopup() { closeScanPopup() {
this.$refs.popup.close(); this.$refs.popup.close();
this.$emit("close", ''); this.$emit("close", '');
}, },
scanClick() { scanClick() {
if(this.$refs.comscan){ if (this.$refs.comscan) {
this.$refs.comscan.clickScanMsg(); this.$refs.comscan.clickScanMsg();
} }
}, },
cancelClick() { cancelClick() {
if(this.$refs.comscan){ if (this.$refs.comscan) {
this.$refs.comscan.clearScanValue(); this.$refs.comscan.clearScanValue();
} }
}, },
getScanResult(result) { getScanResult(result) {
if (result.success) { if (result.success) {
this.$emit("getResult", result); this.getBalance(result, res => {
result.balance = res;
this.$emit("getResult", result);
})
} else { } else {
this.showMessage(result.message) this.showMessage(result.message)
} }
}, },
getBalance(result, callback) {
var filters = []
let label = result.label;
let packageInfo = result.package;
if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: label.packingNumber
})
}
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
if (this.businessType != null) {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.businessType.inInventoryStatuses
})
}
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
if (res.length == 0) {
this.showErrorMessage('未查找到该包装的库存余额', res => {
this.packGetFocus();
})
} else {
callback(res.data)
}
}).catch(err => {
this.showErrorMessage(err.message);
})
},
getfocus() { getfocus() {
if (this.$refs.comscan != undefined) { if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus(); this.$refs.comscan.getfocus();
@ -121,4 +197,4 @@
height: auto; height: auto;
max-height: 300rpx; max-height: 300rpx;
} }
</style> </style>

168
src/pages/material/materialDowngrade.vue

@ -39,8 +39,8 @@
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</view> </view>
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'> <win-scan-package ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'>
</win-scan-pack> </win-scan-package>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
<!-- <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' <!-- <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> --> :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> -->
@ -85,7 +85,7 @@
} from '@/common/balance.js'; } from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue' import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue' import winScanPackage from '@/mycomponents/scan/winScanPackage.vue'
// import requiredLocation from '@/mycomponents/location/requiredLocation.vue' // import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue' import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue" import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
@ -94,7 +94,7 @@
export default { export default {
components: { components: {
winScanButton, winScanButton,
winScanPack, winScanPackage,
// requiredLocation, // requiredLocation,
comBlankView, comBlankView,
winScanLocation, winScanLocation,
@ -115,7 +115,7 @@
showToLoaction: true, showToLoaction: true,
recommendLocationList: [], // recommendLocationList: [], //
fromWarehouseCode: '', // fromWarehouseCode: '', //
businessTypeCode: "PurchasePutaway" businessTypeCode: "Relegate"
}; };
}, },
onLoad(option) { onLoad(option) {
@ -152,101 +152,10 @@
let poLine =label.poLine; let poLine =label.poLine;
let poNumber =label.poNumber; let poNumber =label.poNumber;
let supplierCode=label.supplierCode; let supplierCode=label.supplierCode;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
//
this.getRecommendLocation(balance, pack, toLocation => {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.toLocationCode = toLocation.locationCode;
newDetail.toWarehouseCode = toLocation.toWarehouseCode;
newDetail.poLine=poLine;
newDetail.poNumber=poNumber;
newDetail.supplierCode=supplierCode;
newDetail.fromInventoryStatus = balance.inventoryStatus;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
calcHandleQty(this.detailSource);
})
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == balance.packingNumber &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
this.getRecommendLocation(balance, pack, toLocation => {
let newDetail = createDetailInfo(balance, pack);
newDetail.toLocationCode = toLocation.locationCode;
newDetail.toWarehouseCode = toLocation.toWarehouseCode;
newDetail.poLine=poLine;
newDetail.poNumber=poNumber;
newDetail.supplierCode=supplierCode;
newDetail.fromInventoryStatus = balance.inventoryStatus;
item.subList.push(newDetail);
calcHandleQty(this.detailSource);
});
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中")
}
}
}
},
//
getRecommendLocation(balance, pack, callback) {
uni.showLoading({
title: '扫描中...',
mask: true
})
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode);
if (recommend == undefined) {
let param = {
itemCode: balance.itemCode,
batch: balance.batch,
inventoryStatus: balance.inventoryStatus,
supplierCode: pack.supplierCode,
businessCode: this.businessTypeCode
};
console.log(JSON.stringify(param))
getPutawayRecommendLocation(param).then(res => {
this.recommendLocationList.push({
itemCode: balance.itemCode,
locationCode: res.data.code,
toWarehouseCode:res.data.toWarehouseCode
})
var result = {
locationCode: res.data.code,
toWarehouseCode:res.data.toWarehouseCode
}
callback(result);
uni.hideLoading();
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
})
} else {
callback(recommend);
}
}, },
showErrorMessage(message) { showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => { this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {} if (res) {}
@ -270,19 +179,10 @@
this.detailSource.splice(index, 1) this.detailSource.splice(index, 1)
this.updateData(); this.updateData();
}, },
removePack() {
for (var i = 0; i < this.detailSource.length; i++) {
var item = this.detailSource[i];
if (item.subList.length == 0) {
this.detailSource.splice(i, 1)
}
}
this.updateData();
},
openScanPopup() { openScanPopup() {
this.$refs.scanPopup.openScanPopup(this.businessType); this.$refs.scanPopup.openScanPopupByBusinessType(this.businessType);
}, },
showFromLocationPopup() { showFromLocationPopup() {
@ -342,38 +242,7 @@
}); });
}, },
getItemAndLocationRelations() {
var itemList = []
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
detail.toLocationCode = this.toLocationCode;
var filterResult = itemList.filter(res => {
if (res.itemCode == item.itemCode &&
res.locationCode == detail.toLocationCode &&
res.batch == detail.batch &&
res.inventoryStatus == detail.inventoryStatus) {
return res
}
})
//
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode,
batch: detail.batch,
inventoryStatus: detail.inventoryStatus,
}
itemList.push(result)
}
}
})
})
return itemList;
},
setRecordParams() { setRecordParams() {
var subList = [] var subList = []
var creator = this.$store.state.user.id var creator = this.$store.state.user.id
@ -431,22 +300,7 @@
getLocation(location, code) { getLocation(location, code) {
this.getFromLocationCode(location, code) this.getFromLocationCode(location, code)
}, },
getFromLocationCode(location, code) {
this.fromLocationInfo = location;
this.fromLocationCode = code;
this.openScanPopup();
},
getToLocationCode(location, code) {
if (this.fromLocationCode == code) {
uni.showToast({
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致",
duration: 2000
})
return
}
this.toLocationCode = code;
},
showCommitSuccessMessage(hint) { showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => { this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clear(); this.clear();

Loading…
Cancel
Save