Browse Source

page/repleinsh/record 文件迁移 8/8-10/25

hella_vue3
王志国 3 weeks ago
parent
commit
834c19b9fb
  1. 156
      src/pages/repleinsh/record/directRepleinshRecord.vue
  2. 514
      src/pages/repleinsh/record/directRepleinshRecord1.vue
  3. 4
      src/pages/repleinsh/record/repleinshRecord.vue
  4. 2
      src/pages/repleinsh/record/repleinshRecordV1.vue

156
src/pages/repleinsh/record/directRepleinshRecord.vue

@ -38,6 +38,7 @@
<win-scan-button @goScan="openScanPopup"></win-scan-button>
</view>
<winComScanBalance ref="scanPopup" @getBalance="getScanResult" :bussinessCode="businessTypeCode"> </winComScanBalance>
<balanceQuery ref="refBalanceQuery" :businessTypeCode="businessTypeCode"></balanceQuery>
<com-message ref="comMessageRef" />
</view>
</template>
@ -66,6 +67,7 @@ import winScanPackAndLocation from '@/mycomponents/scan/winScanPackAndLocation.v
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import balanceQuery from '@/mycomponents/query/balanceQuery.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import { useCountStore } from '@/store'
// store
@ -91,6 +93,7 @@ const itemCode = ref('')
const balanceSelectRef = ref({})
const managementList = ref([])
const managementType= ref('')
// const positionList = ref([])
// const show = ref(false)
// const positionInfo = ref('线')
@ -98,6 +101,7 @@ const comMessageRef = ref()
const show = ref(false)
const scanPopup = ref()
const scanLocationCode = ref()
const refBalanceQuery = ref(null)
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title
@ -109,6 +113,9 @@ onLoad((option) => {
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome()
}else if (e.index == 1) {
refBalanceQuery.value.showDrawer();
closeScanPopup();
}
})
const getBusinessType = () => {
@ -176,12 +183,12 @@ const getBalance = (label, packageInfo, callback) => {
const getScanResult = (result) => {
setData(result)
}
const setData = (result) => {
const setData = async (result) => {
const { balance } = result
const { label } = result
const pack = result.package
if (fromLocationCode.value && fromLocationCode.value != balance.locationCode) {
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]在库位[${fromLocationCode.value}]没有库存余额`)
showErrorMessage(`批次[${balance.batch}]在库位[${fromLocationCode.value}]没有库存余额`)
return
}
@ -210,31 +217,152 @@ const setData = (result) => {
itemp.subList.push(newDetail)
detailSource.value.push(itemp)
itemCode.value = balance.itemCode
fromLocationCode.value = balance.locationCode.scanPopupGetFocus()
fromLocationCode.value = balance.locationCode
await getToLocationBalance(this.toLocationCode,result)
} else {
const detail = item.subList.find((r) => {
if (r.packingNumber == pack.number && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) {
if (r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) {
return r
}
})
if (detail == undefined) {
const newDetail = createDetailInfo(balance, pack)
newDetail.parentNumber = pack.parentNumber
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit
newDetail.packQty = pack.packQty
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
//
//
//,
if (pack.parentNumber) {
let checkData = item.subList.find(r => {
if (r.packingNumber == pack.parentNumber &&
r.batch == balance.batch) {
return r;
}
})
if (checkData) {
//
showErrorMessage("箱码[" + pack.number + "]批次[" + balance.batch +
"]的父包装已经扫描")
} else {
const newDetail = createDetailInfo(balance, pack)
newDetail.parentNumber = pack.parentNumber
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit
newDetail.packQty = pack.packQty
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
item.subList.push(newDetail)
}
}else {
//
let checkData = item.subList.find(r => {
if (r.parentNumber == pack.number &&
r.batch == balance.batch) {
return r;
}
})
if (checkData) {
//
comMessageRef.value.showQuestionMessage("扫描箱码[" + checkData.parentNumber + "]" + "批次[" + balance
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
item.subList = [];
const newDetail = createDetailInfo(balance, pack)
newDetail.parentNumber = pack.parentNumber
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit
newDetail.packQty = pack.packQty
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
item.subList.push(newDetail)
}
})
console.log("扫描的是父包装,是否移除子包装")
} else {
const newDetail = createDetailInfo(balance, pack)
newDetail.parentNumber = pack.parentNumber
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit
newDetail.packQty = pack.packQty
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
item.subList.push(newDetail)
}
}
item.subList.push(newDetail)
scanPopupGetFocus()
} else if (detail.scaned == true) {
showErrorMessage(`箱码[${detail.packingNumber}批次[${balance.batch}]已经在列表中`)
detail.handleQty = calc.add(detail.handleQty, result.label.qty)
// showErrorMessage(`[${detail.packingNumber}[${balance.batch}]`)
}
}
calcHandleQty(detailSource.value)
}
//
const getToLocationBalance = async (toLocationCode, result)=> {
uni.showLoading({
title: '查询中',
mask: true
})
let filters = []
if (result.package.parentNumber) {
let packingNumber = result.package.parentNumber + "," + result.package.number;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
})
}
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
})
filters.push({
column: "batch",
action: "==",
value: result.package.batch
})
filters.push({
column: "areaType",
action: "in",
value: toLocationAreaTypeList.value.join(',')
})
const params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
await getManagementPrecisions([result.package.itemCode], toLocationCode, async res => {
if (res.success) {
managementList.value = res.list;
managementType.value = managementList.value.some(item => item.ManagementPrecision == 'BY_BATCH') ?
'BY_BATCH' : ''
if (managementType.value == 'BY_BATCH') {
uni.hideLoading()
} else {
await getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
}
// callback(res.data)
}).catch(err => {
showErrorMessage(err.message);
})
}
}
})
}
const updateData = () => {
calcHandleQty(detailSource.value)
for (let i = 0; i < detailSource.value.length; i++) {
@ -309,7 +437,7 @@ const commit = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成直接补料记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成直接补料记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}

514
src/pages/repleinsh/record/directRepleinshRecord1.vue

@ -0,0 +1,514 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
<view class="page-header">
<view class="header_item">
来源库位 : {{ fromLocationCode }}
</view>
<view class='split_line'></view>
</view>
<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="">
<recordDetailCard :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack">
</recordDetailCard>
</view>
</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="uni-row uni-flex">
<text>生产线:</text>
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="" style="margin-left: 20rpx;">
{{ positionInfo }}
</view>
<u-select v-model="show" mode="mutil-column-auto" :list="positionList"
@confirm="confirmSelect"></u-select>
</view>
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'>
</win-scan-pack-and-location>
<comMessage ref="comMessage"></comMessage>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
</view>
</template>
<script setup lang="ts">
import {
repleinshRecordSubmit,
getWorkShopLineStation,
getPutawayRecommendLocation
} from '@/api/request2.js';
import {
goHome,
getPackingNumberAndBatchByList,
deepCopyData
} from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcTreeHandleQty
} from '@/common/record.js';
import {
getManagementPrecisions,
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import {ref, onMounted} from 'vue';
import {onLoad, onNavigationBarButtonTap} from '@dcloudio/uni-app';
import { useCountStore } from '@/store'
const store = useCountStore()
const id = ref('');
const dataContent = ref({}); //
const detailSource = ref([]); //
const fromLocationInfo = ref({});
const fromLocationCode = ref("");
const fromLocationAreaTypeList = ref([]);
const toLocationAreaTypeList = ref([]);
const inInventoryStatus = ref(""); //
const outInventoryStatus = ref(""); //
const businessType = ref({});
const showToLoaction = ref(true);
const recommendLocationList = ref([]); //
const fromWarehouseCode = ref(''); //
const businessTypeCode = ref("Repleinment");
const positionList = ref([]);
const show = ref(false);
const positionInfo = ref("请选择生产线");
const toWarehouseCode = ref('')
const toLocationCode = ref('')
const managementList = ref([])
const workshopCode = ref('')
const productionLineCode = ref('')
const workStationCode = ref('')
const workShopName = ref('')
const productionLineName = ref('')
const workStationName = ref('')
const rawLocationCode = ref('')
const fgLocationCode = ref('')
const scanPopup = ref(null);
const scanLocationCode = ref(null);
const comMessage = ref(null);
//
onLoad(option => {
clearData();
getBusinessType(businessTypeCode.value, res => {
if (res.success) {
businessType.value = res.businessType;
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList;
toLocationAreaTypeList.value = res.toLocationAreaTypeList;
showFromLocationPopup();
} else {
showErrorMessage(res.message);
}
});
getWorkShopLineStation().then(res => {
if (res.data != null && res.data.length > 0) {
positionList.value = res.data;
} else {
showErrorMessage('未查找到位置信息');
}
}).catch(error => {
showErrorMessage(error);
});
});
onNavigationBarButtonTap(e => {
if (e.index === 0) {
goHome();
}
});
//
const getScanResult = (result) => {
const balance = result.balance;
const label = result.label;
const pack = result.package;
const item = detailSource.value.find(res => res.itemCode == balance.itemCode);
if (fromWarehouseCode.value == '') {
fromWarehouseCode.value = balance.warehouseCode;
}
if (item == undefined) {
const itemp = createItemInfo(balance, pack);
const newDetail = createDetailInfo(balance, pack);
itemp.subList.push(newDetail);
const dataList = pack.subList;
detailSource.value.push(itemp);
detailSource.value.forEach(res => {
res.subList.forEach(pack => {
pack.packList = dataList.filter(c => c.parentNumber == pack.packingNumber);
pack.packList.forEach(pac => {
pac.parentPackingNumber = pac.parentNumber;
pac.packingNumber = pac.number;
pac.inventoryStatus = "OK";
pac.scaned = true;
});
});
});
} else {
const itemDetail = item.subList.find(r => r.packingNumber == balance.packingNumber && r.batch == balance.batch);
if (itemDetail != undefined) {
showErrorMessage(`箱码[${balance.packingNumber}]批次[${balance.batch}]已经在列表中`);
}
}
};
const getRecommendLocation = (balance, pack, callback) => {
uni.showLoading({
title: '扫描中...',
mask: true
});
const recommend = recommendLocationList.value.find(r => r.itemCode == balance.itemCode);
if (recommend == undefined) {
const param = {
itemCode: balance.itemCode,
batch: balance.batch,
inventoryStatus: balance.inventoryStatus,
supplierCode: pack.supplierCode,
businessCode: businessTypeCode.value
};
console.log(JSON.stringify(param));
getPutawayRecommendLocation(param).then(res => {
recommendLocationList.value.push({
itemCode: balance.itemCode,
locationCode: res.data.code
});
callback(res.data);
uni.hideLoading();
}).catch(error => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
callback(recommend);
}
};
const calcTreeHandleQty = () => {
for (let item of detailSource.value) {
item.qty = 0;
for (let detail of item.subList) {
if (detail != undefined) {
item.qty = calc.add(item.qty, detail.qty);
}
}
}
// Vue 3
};
const showSelect = () => {
show.value = true;
};
const confirmSelect = (e) => {
positionInfo.value = `${e[0].label}-${e[1].label}-${e[2].label}`;
console.log("位置", positionInfo.value);
workshopCode.value = e[0].value;
productionLineCode.value = e[1].value;
workStationCode.value = e[2].value;
workShopName.value = e[0].label;
productionLineName.value = e[1].label;
workStationName.value = e[2].label;
const shop = positionList.value.find(shop => shop.value == workshopCode.value);
if (shop != undefined && shop.children != undefined) {
const prodLine = shop.children.find(line => line.value == productionLineCode.value);
if (prodLine != undefined && prodLine.children != undefined) {
const station = prodLine.children.find(r => r.value == workStationCode.value);
if (station.rawLocationCode == '' || station.rawLocationCode == null) {
showErrorMessage(`${workStationName.value}的原材料库位为空,请重新选择`);
return;
} else {
rawLocationCode.value = station.rawLocationCode;
fgLocationCode.value = station.fgLocationCode;
}
} else {
showErrorMessage("生产线-工位基础信息维护错误");
}
} else {
showErrorMessage("车间-生产线基础信息维护错误");
}
let toLocationCode = '';
positionList.value.forEach(item => {
if (workshopCode.value == item.value) { //
item.children.find(child => {
if (productionLineCode.value == child.value) {
toLocationCode = child.children.find(subChild => workStationCode.value == subChild.value).rawLocationCode;
}
});
}
});
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = toLocationCode;
});
});
};
const removeItem = (index, item) => {
detailSource.value.splice(index, 1);
};
const removePack = () => {
for (let i = 0; i < detailSource.value.length; i++) {
const item = detailSource.value[i];
if (item.subList.length == 0) {
detailSource.value.splice(i, 1);
}
}
updateData();
};
const openScanPopup = () => {
if (fromLocationCode.value == "") {
showFromLocationPopup();
return;
}
scanPopup.value.openScanPopupForType(fromLocationCode.value, businessType.value);
};
const showFromLocationPopup = () => {
nextTick(() => {
scanLocationCode.value.openScanPopup();
});
};
const closeScanPopup = () => {
if (scanPopup.value != undefined) {
scanPopup.value.closeScanPopup();
}
};
const scanPopupGetFocus = () => {
if (scanPopup.value != undefined) {
scanPopup.value.getfocus();
}
};
const commit = () => {
uni.showLoading({
title: "提交中....",
mask: true
});
const precisionStrategyParams = getPrecisionStrategyParams(detailSource.value);
getPrecisionStrategyList(precisionStrategyParams, res => {
if (res.success) {
managementList.value = res.list;
const params = {...setRecordParams()};
console.log("提交参数", JSON.stringify(params));
repleinshRecordSubmit(params).then(res => {
uni.hideLoading();
if (res.data) {
showCommitSuccessMessage(`提交成功\n生成直接补料记录\n${res.data}`);
} else {
showErrorMessage(`提交失败[${res.msg}]`);
}
}).catch(error => {
uni.hideLoading();
showErrorMessage(error);
});
} else {
uni.hideLoading();
showErrorMessage(res.message);
}
});
};
const getItemAndLocationRelations = () => {
const itemList = [];
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
detail.toLocationCode = toLocationCode.value;
const 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) {
const result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode,
batch: detail.batch,
inventoryStatus: detail.inventoryStatus,
};
itemList.push(result);
}
}
});
});
return itemList;
};
const setRecordParams = () => {
const subList = [];
const creator = store.id;
detailSource.value.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
const info = getPackingNumberAndBatchByList(managementList.value, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch);
const submitItem = deepCopyData(detail);
submitItem.toPackingNumber = info.packingNumber;
submitItem.toBatch = info.batch;
submitItem.toContainerNumber = detail.containerNumber;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.fromBatch = info.batch;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode;
submitItem.qty = detail.handleQty;
submitItem.package = "";
submitItem.recordList = [{
toInventoryStatus: detail.inventoryStatus,
fromPackingNumber: info.packingNumber,
fromBatch: info.batch,
toPackingNumber: info.packingNumber,
toBatch: info.batch,
fromLocationCode: detail.locationCode,
toLocationCode: detail.toLocationCode,
handleQty: detail.handleQty
}];
subList.push(submitItem);
}
});
});
if (subList.length > 0) {
dataContent.value.toWarehouseCode = subList[0].toWarehouseCode;
}
dataContent.value.subList = subList;
dataContent.value.creator = creator;
dataContent.value.fromWarehouseCode = fromWarehouseCode.value;
return dataContent.value;
};
const showMessage = (message) => {
comMessage.value.showMessage(message, res => {
});
};
const showErrorMessage = (message) => {
comMessage.value.showErrorMessage(message, res => {
});
};
const showScanMessage = (message) => {
comMessage.value.showScanMessage(message);
};
const afterCloseMessage = () => {
scanPopupGetFocus();
};
const closeScanMessage = () => {
scanPopupGetFocus();
};
const getLocation = (location, code) => {
getFromLocationCode(location, code);
};
const getFromLocationCode = (location, code) => {
fromLocationInfo.value = location;
fromLocationCode.value = code;
openScanPopup();
};
const getToLocationCode = (location, code) => {
if (fromLocationCode.value == code) {
uni.showToast({
title: `来源库位[${fromLocationCode.value}]不能与目标库位[${code}]一致`,
duration: 2000
});
return;
}
toLocationCode.value = code;
};
const showCommitSuccessMessage = (hint) => {
comMessage.value.showSuccessMessage(hint, res => {
clearData();
});
};
const updateData = () => {
for (let i = 0; i < detailSource.value.length; i++) {
const item = detailSource.value[i];
if (item.qty == 0) {
detailSource.value.splice(i, 1);
}
}
};
const clearData = () => {
fromLocationInfo.value = {};
fromLocationCode.value = '';
fromWarehouseCode.value = '';
toWarehouseCode.value = '';
detailSource.value = [];
};
</script>
<style scoped lang="scss">
</style>

4
src/pages/repleinsh/record/repleinshRecord.vue

@ -304,7 +304,7 @@ export default {
item.subList.push(newDetail)
this.scanPopupGetFocus()
} else if (detail.scaned == true) {
this.showErrorMessage(`箱码[${detail.packingNumber}批次[${balance.batch}]已经在列表中`)
this.showErrorMessage(`箱码[${detail.packingNumber}批次[${balance.batch}]重复扫描`)
}
}
calcHandleQty(this.detailSource)
@ -404,7 +404,7 @@ export default {
.then((res) => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage(`提交成功<br>生成直接补料记录<br>${res.data}`)
this.showCommitSuccessMessage(`提交成功\n生成直接补料记录\n${res.data}`)
} else {
this.showErrorMessage(`提交失败[${res.msg}]`)
}

2
src/pages/repleinsh/record/repleinshRecordV1.vue

@ -294,7 +294,7 @@ const submitJob = () => {
.then((res) => {
uni.hideLoading()
if (res.data) {
showCommitSuccessMessage(`提交成功<br>生成补料记录<br>${res.data}`)
showCommitSuccessMessage(`提交成功\n生成补料记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}

Loading…
Cancel
Save