Browse Source

修改记录

intex_online20241111
lijuncheng 4 weeks ago
parent
commit
4b5852df33
  1. 56
      src/pages.json
  2. 54
      src/pages/customerReturn/record/returnRecord.vue
  3. 75
      src/pages/deliver/record/deliverRecord.vue
  4. 219
      src/pages/issue/record/directIssue.vue
  5. 549
      src/pages/issue/record/directIssueByBatch.vue
  6. 48
      src/pages/productPutaway/record/fgDirectPutawayByBatch.vue
  7. 297
      src/pages/productPutaway/record/productPutawayRecord.vue
  8. 651
      src/pages/productPutaway/record/productPutawayRecordByBatch.vue
  9. 48
      src/pages/productPutaway/record/semiDirectPutawayByBatch.vue
  10. 2
      src/pages/productReceipt/coms/comProductRecordBatch.vue
  11. 118
      src/pages/productReceipt/record/productReceiptRecord.vue
  12. 492
      src/pages/productReceipt/record/productReceiptRecordByBatch.vue
  13. 90
      src/pages/scrap/record/scrapRecord.vue
  14. 12
      src/pages/transfer/record/deliverRecord.vue
  15. 43
      src/pages/transfer/record/receiptRecord.vue
  16. 482
      src/pages/transfer/record/receiptRecordByBatch.vue
  17. 12
      src/pages/unPlanned/record/issueRecord.vue
  18. 44
      src/pages/unPlanned/record/receiptRecord.vue
  19. 450
      src/pages/unPlanned/record/receiptRecordByBatch.vue

56
src/pages.json

@ -716,6 +716,35 @@
}
}
},
{
"path": "pages/issue/record/directIssueByBatch",
"style": {
"navigationBarTitleText": "直接发料",
"enablePullDownRefresh": false,
"titleNView": {
"autoBackButton": "true",
"buttons": [
//
{
"float": "right",
"fontSize": "58rpx", //
"text": "\ue696",
"fontSrc": "/static/ali_icon/iconfont.ttf"
},
{
"float": "right",
"fontSize": "52rpx", //
"text": "\ue6e2",
"fontSrc": "/static/ali_icon/iconfont.ttf"
}
]
}
}
},
{
"path": "pages/issue/record/directIssue0816",
"style": {
@ -1418,6 +1447,15 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/productReceipt/record/productReceiptRecordByBatch",
"style": {
"navigationBarTitleText": "制品收货记录",
"enablePullDownRefresh": false
}
},
{
"path": "pages/productPutaway/job/productPutawayJob",
"style": {
@ -1478,6 +1516,24 @@
}
},
{
"path": "pages/productPutaway/record/fgDirectPutawayByBatch",
"style": {
"navigationBarTitleText": "装配直接上架",
"enablePullDownRefresh": false
}
},
{
"path": "pages/productPutaway/record/semiDirectPutawayByBatch",
"style": {
"navigationBarTitleText": "预生产直接上架",
"enablePullDownRefresh": false
}
},
{

54
src/pages/customerReturn/record/returnRecord.vue

@ -70,6 +70,10 @@
createDetailInfo,
calcHandleQty
} from '@/common/record.js';
import {
calc
} from '@/common/calc.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
@ -109,7 +113,8 @@
toLocationAreaTypeList: [],
managementList: [],
toWarehouseCode: '',
toInventoryStatuses:""
toInventoryStatuses:"",
managementType:""
};
},
onLoad(option) {
@ -145,7 +150,18 @@
},
methods: {
getScanResult(result) {
getScanResult(result,managementTypeParams) {
this.managementType = managementTypeParams
console.log(managementTypeParams)
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result)
} else {
this.setData(result)
}
},
setData(result){
let balance = result.balance;
let label = result.label;
let pack = result.package;
@ -180,7 +196,39 @@
}
}
this.calcHandleQty();
},
setDataBatch(result){
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.packingNumber =pack.number
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
this.calcHandleQty();
},
showErrorMessage(message) {

75
src/pages/deliver/record/deliverRecord.vue

@ -8,7 +8,9 @@
<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" :index="index" :settingParam="dataContent"
<record-com-detail-card
:dataContent="item" :index="index" :settingParam="dataContent"
:isShowParentToLocation="false"
:isShowLocation="true" @removeItem="removeItem(index,item)" @updateData="updateData"
@removePack="removePack">
</record-com-detail-card>
@ -80,6 +82,9 @@
calcHandleQty
} from '@/common/record.js';
import {
calc
} from '@/common/calc.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
@ -115,7 +120,8 @@
customerCode : "",
dataContent:{},
managementList:[],
deliverType:''//CUSTTHIRD_PARTY
deliverType:'',//CUSTTHIRD_PARTY
managementType:""
};
},
onLoad(option) {
@ -162,7 +168,20 @@
mounted() {},
methods: {
getScanResult(result) {
getScanResult(result,managementTypeParams) {
this.managementType = managementTypeParams
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result)
} else {
this.setData(result)
}
},
setData(result){
let balance = result.balance;
let label = result.label;
let pack = result.package;
@ -197,8 +216,42 @@
}
}
this.calcHandleQty();
},
setDataBatch(result){
let balance = result.balance;
let label = result.label;
let pack = result.package;
let labelQty =result.label.qty;
let balanceQty =result.balance.qty;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
this.calcHandleQty();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
@ -228,12 +281,16 @@
},
openScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
if (this.businessType) {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
} else {
this.getBusinessType()
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {

219
src/pages/issue/record/directIssue.vue

@ -1,7 +1,7 @@
<template>
<view class="page-wraper">
<view class="">
<com-blank-view @goScan='getBusinessType' v-if="detailSource.length==0"></com-blank-view>
<com-blank-view @goScan='showFromLocationPopup' v-if="detailSource.length==0"></com-blank-view>
</view>
<view class="page-wraper" v-if="detailSource.length>0">
@ -9,18 +9,10 @@
<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-batch :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)"
:isShowModifedLocation="true"
@updateData="updateData"
@editLocation="showScanToLocation"
@removePack="removePack"
v-if="managementType == 'BY_BATCH'||managementType =='BY_QUANTITY' ">
</record-com-detail-card-batch>
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="true" @removeItem="removeItem(index,item)"
:isShowToLocation="false" :isShowParentToLocation="false" @updateData="updateData"
@removePack="removePack" v-else>
@removePack="removePack">
</record-com-detail-card>
</view>
@ -47,13 +39,9 @@
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
</view>
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'">
</win-scan-pack-and-location>
<!-- <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance> -->
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance>
<balanceQuery ref="refBalanceQuery" :businessTypeCode="businessTypeCode"></balanceQuery>
<comMessage ref="comMessage"></comMessage>
</view>
@ -85,8 +73,7 @@
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty,
calcHandleQtyAdd
calcHandleQty
} from '@/common/record.js';
import {
@ -94,11 +81,7 @@
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import {
Decimal
} from 'decimal.js'; //
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
@ -106,7 +89,6 @@
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordComDetailCardBatch from '@/mycomponents/record/recordComDetailCardBatch.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
@ -122,7 +104,6 @@
winScanLocation,
winScanPackAndLocation,
recordComDetailCard,
recordComDetailCardBatch,
recordDetailCard,
balanceSelect,
winComScanBalance,
@ -148,8 +129,7 @@
show: false,
positionInfo: "请选择生产线",
resultData: {},
itemCode: "",
managementType:''
itemCode: ""
};
},
onLoad(option) {
@ -197,22 +177,17 @@
this.businessType = res.businessType;
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.openScanPopup();
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
async getScanResult(result,managementTypeParams) {
this.managementType = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
this.setDataBatch(result);
}else{
this.setData(result);
}
getScanResult(result) {
this.setData(result);
},
async setData(result) {
setData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
@ -249,10 +224,8 @@
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
await this.getToLocationBalance(this.fromLocationCode,result)
this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == balance.batch &&
@ -341,140 +314,6 @@
}
calcHandleQty(this.detailSource);
},
async setDataBatch(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
// if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) {
// this.showErrorMessage("[" + balance.packingNumber + "[" + balance.batch + "][" + this
// .fromLocationCode + "]")
// return;
// }
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
var itemp = createItemInfo(balance, pack);
itemp.containerNumber=""
let newDetail = createDetailInfo(balance, pack); //
newDetail.fromLocationCode=balance.locationCode
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.handleQty = 0
newDetail.balanceQty =result.balance.qty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
// this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.batch == balance.batch &&
r.fromLocationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
//
//
//,
if (pack.parentNumber) {
var checkData = item.subList.find(r => {
if (r.packingNumber == pack.parentNumber &&
r.batch == balance.batch&&
r.fromLocationCode == balance.locationCode) {
return r;
}
})
if (checkData) {
//
this.showErrorMessage("扫描箱码[" + pack.number + "]批次[" + balance.batch +
"]的父包装已经扫描")
console.log("父包装已经扫描")
} else {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.fromLocationCode=balance.locationCode
newDetail.handleQty = 0
item.subList.push(newDetail);
}
} else {
//
var checkData = item.subList.find(r => {
if (r.batch == balance.batch&&
r.fromLocationCode == balance.locationCode) {
return r;
}
})
if (checkData) {
//
this.$refs.comMessage.showQuestionMessage("批次[" + balance
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
item.subList = [];
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.fromLocationCode=balance.locationCode
newDetail.handleQty = 0
newDetail.balanceQty =result.balance.qty;
item.subList.push(newDetail);
}
})
console.log("扫描的是父包装,是否移除子包装")
} else {
let newDetail = createDetailInfo(balance, pack);
newDetail.fromLocationCode=balance.locationCode
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.handleQty = 0
newDetail.balanceQty =result.balance.qty;
item.subList.push(newDetail);
}
}
// this.scanPopupGetFocus()
} else {
if (detail.scaned == true) {
// this.showErrorMessage("[" + detail.packingNumber + "[" + balance.batch + "]")
}
}
}
console.log(this.detailSource)
console.log(result.label)
calcHandleQtyAdd(this.detailSource, result.label);
// console.log(this.detailSource)
// for (let item of this.detailSource) {
// item.handleQty = new Decimal(0).toNumber();
// item.qty = new Decimal(0).toNumber();
// for (let detail of item.subList) {
// if (detail != undefined) {
// if (detail.scaned) {
// item.handleQty = calc.add(result.label.qty, detail.handleQty)
// detail.handleQty = calc.add(result.label.qty, detail.handleQty);
// }
// item.qty = calc.add(item.qty, detail.qty);
// }
// }
// }
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
@ -556,27 +395,22 @@
},
openScanPopup() {
if (this.businessType) {
// this.$refs.scanFromLocationCode.openScanPopup();
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
} else {
this.getBusinessType()
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopup(this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanFromLocationCode.openScanPopup();
this.$refs.scanLocationCode.openScanPopup();
})
},
closeScanPopup() {
if (this.$refs.scanFromLocationCode != undefined) {
this.$refs.scanFromLocationCode.closeScanPopup();
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
@ -613,13 +447,7 @@
...this.setRecordParams()
}
console.log("提交参数", JSON.stringify(params));
const isHaveItem =params.subList.find(item=>item.handleQty > item.balanceQty)
if(isHaveItem){
this.showErrorMessage(`物料号${isHaveItem.itemCode}`)
this.$refs.comMessage.showConfirmWarningModal('物料号'+isHaveItem.itemCode+'数量[' + isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']')
uni.hideLoading()
return
}
issueRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
@ -662,7 +490,6 @@
// detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty;
submitItem.package = "";
submitItem.balanceQty = detail.balanceQty;
submitItem.recordList = [{
toInventoryStatus: detail.inventoryStatus,
fromParentPackingNumber: detail.parentNumber,
@ -734,11 +561,7 @@
this.$forceUpdate();
},
getFromLocation(location) {
this.fromLocationCode = location.code;
this.fromLocationInfo = location;
this.openScanPopup();
},
clearData() {
this.fromLocationInfo = {};
this.fromLocationCode = '';

549
src/pages/issue/record/directIssueByBatch.vue

@ -0,0 +1,549 @@
<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-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" :index="index" :settingParam="dataContent"
:isShowFromLocation="true" @removeItem="removeItem(index,item)"
:isShowToLocation="false" :isShowParentToLocation="false" @updateData="updateData"
@removePack="removePack">
</record-com-detail-card>
</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-location ref="scanFromLocationCode" title="来源库位" @getLocation='getFromLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'">
</win-scan-pack-and-location>
<!-- <winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance> -->
<balanceQuery ref="refBalanceQuery" :businessTypeCode="businessTypeCode"></balanceQuery>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
issueRecordSubmit,
getWorkShopLineStation,
getBalanceByFilter
} 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,
calcHandleQty,
} from '@/common/record.js';
import {
getManagementPrecisions,
getPrecisionStrategyList,
getPrecisionStrategyParams
} from '@/common/balance.js';
import {
Decimal
} from 'decimal.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 balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import balanceQuery from '@/mycomponents/query/balanceQuery.vue'
export default {
components: {
winScanButton,
winScanPack,
requiredLocation,
comBlankView,
winScanLocation,
winScanPackAndLocation,
recordComDetailCard,
recordDetailCard,
balanceSelect,
winComScanBalance,
balanceQuery
},
data() {
return {
id: '',
dataContent: {}, //
detailSource: [], //
fromLocationInfo: {},
fromLocationCode: "",
fromLocationAreaTypeList: [],
toLocationAreaTypeList: [],
inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {},
showToLoaction: true,
recommendLocationList: [], //
fromWarehouseCode: '', //
businessTypeCode: "Issue",
positionList: [],
show: false,
positionInfo: "请选择生产线",
resultData: {},
itemCode: "",
managementType: ''
};
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
})
this.clearData();
this.getBusinessType()
// if (this.positionList.length == 0) {
getWorkShopLineStation().then(res => {
if (res.data != null && res.data.length > 0) {
this.positionList = res.data
} else {
this.showErrorMessage('未查找到位置信息');
}
}).catch(error => {
this.showErrorMessage(error);
})
// }
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
} else if (e.index == 1) {
this.$refs.refBalanceQuery.showDrawer();
this.closeScanPopup();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
getBusinessType() {
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.showFromLocationPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
getScanResult(result, managementTypeParams) {
this.managementType = managementTypeParams
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result);
} else {
this.setData(result);
}
},
async setData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} 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) {
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]重复扫描")
}
}
}
calcHandleQty(this.detailSource)
},
setDataBatch(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
calcHandleQty(this.detailSource)
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.scanPopupGetFocus()
}
});
},
showSelect() {
// if (this.editPosition) {
this.show = true
// }
},
confirmSelect(e) {
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label
console.log("位置", this.positionInfo)
this.workshopCode = e[0].value
this.productionLineCode = e[1].value
this.workStationCode = e[2].value
this.workShopName = e[0].label
this.productionLineName = e[1].label
this.workStationName = e[2].label
let shop = this.positionList.find(shop => shop.value == this.workshopCode);
if (shop != undefined && shop.children != undefined) {
let prodLine = shop.children.find(line => line.value == this.productionLineCode);
if (prodLine != undefined && prodLine.children != undefined) {
let station = prodLine.children.find(r => r.value == this.workStationCode);
if (station.rawLocationCode == '' && station.rawLocationCode == null) {
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择")
return;
} else {
this.rawLocationCode = station.rawLocationCode;
this.fgLocationCode = station.fgLocationCode;
}
} else {
this.showErrorMessage("生产线-工位基础信息维护错误")
}
} else {
this.showErrorMessage("车间-生产线基础信息维护错误")
}
//
let toLocationCode = ''
this.positionList.forEach(item => {
if (this.workshopCode == item.value) { //
item.children.find(child => {
if (this.productionLineCode == child.value) {
toLocationCode = child.children.find(subChild => this.workStationCode ==
subChild.value).rawLocationCode;
}
})
}
})
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = toLocationCode
detail.productionLineCode = this.productionLineCode
detail.workStationCode = this.workStationCode
})
})
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
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() {
if (this.businessType) {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
} else {
this.getBusinessType()
}
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.scanFromLocationCode.openScanPopup();
})
},
closeScanPopup() {
if (this.$refs.scanFromLocationCode != undefined) {
this.$refs.scanFromLocationCode.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
// scanLocationCode(location, code) {
// this.toLocationCode = code
// this.toLocationCode = location;
// },
commit() {
if (this.positionInfo == '请选择生产线' || !this.positionInfo) {
this.showErrorMessage("请选择生产线")
return
}
uni.showLoading({
title: "提交中....",
mask: true
});
//
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource);
//2:
getPrecisionStrategyList(precisionStrategyParams, res => {
if (res.success) {
this.managementList = res.list;
var params = {
...this.setRecordParams()
}
console.log("提交参数", JSON.stringify(params));
const isHaveItem = params.subList.find(item => item.handleQty > item.balanceQty)
if (isHaveItem) {
this.showErrorMessage(`物料号${isHaveItem.itemCode}`)
this.$refs.comMessage.showConfirmWarningModal('物料号' + isHaveItem.itemCode + '数量[' +
isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']')
uni.hideLoading()
return
}
issueRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成直接发料记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
setRecordParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
detail.packingNumber, detail.toLocationCode, detail.batch);
var 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;
// detail.toInventoryStatus = detail.inventoryStatus
// detail.toLocationCode = detail.toLocationCode
submitItem.qty = detail.handleQty;
submitItem.package = "";
submitItem.balanceQty = detail.balanceQty;
submitItem.recordList = [{
toInventoryStatus: detail.inventoryStatus,
fromParentPackingNumber: detail.parentNumber,
fromPackingNumber: info.packingNumber,
fromBatch: info.batch,
toPackingNumber: info.packingNumber,
toBatch: info.batch,
fromLocationCode: detail.locationCode,
toLocationCode: detail.toLocationCode,
handleQty: detail.handleQty,
fromPackUnit: detail.packUnit,
toPackUnit: detail.packUnit,
fromPackQty: detail.packQty,
toPackQty: detail.packQty
}]
subList.push(submitItem)
}
})
})
if (subList.length > 0) {
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode;
}
this.dataContent.subList = subList
this.dataContent.creator = creator;
this.dataContent.fromWarehouseCode = this.fromWarehouseCode;
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();
},
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationInfo = location;
this.fromLocationCode = code;
this.openScanPopup();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
updateData() {
calcHandleQty(this.detailSource);
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
if (item.qty == 0) {
this.detailSource.splice(i, 1)
}
}
this.$forceUpdate();
},
getFromLocation(location) {
this.fromLocationCode = location.code;
this.fromLocationInfo = location;
this.openScanPopup();
},
clearData() {
this.fromLocationInfo = {};
this.fromLocationCode = '';
this.fromWarehouseCode = '';
this.toWarehouseCode = '';
this.detailSource = [];
this.positionInfo = "请选择生产线";
this.itemCode = ""
}
}
}
</script>
<style scoped lang="scss">
</style>

48
src/pages/productPutaway/record/fgDirectPutawayByBatch.vue

@ -0,0 +1,48 @@
<template>
<view class="">
<productPutawayRecordByBatch :title="title" ref="productPutawayRecordByBatch" putawayType='assemble'></productPutawayRecordByBatch>
</view>
</template>
<script>
import productPutawayRecordByBatch from '@/pages/productPutaway/record/productPutawayRecordByBatch.vue'
export default {
components: {
productPutawayRecordByBatch
},
data() {
return {
title:''
};
},
onLoad(option){
this.title = option.title
},
onShow() {
if(this.$refs.productPutawayRecordByBatch!=undefined){
// this.$refs.productPutawayRecord.refresh();
}
},
onPullDownRefresh() {
// this.$refs.productPutawayRecord.refresh();
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
this.$refs.productPutawayRecordByBatch.toHome();
} else if (e.index == 1) {
this.$refs.productPutawayRecordByBatch.openFilter();
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
</style>

297
src/pages/productPutaway/record/productPutawayRecord.vue

@ -8,17 +8,10 @@
<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-batch :dataContent="item" :index="index" :settingParam="dataContent"
:isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)"
:isShowModifedLocation="true"
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation"
v-if="managementType == 'BY_BATCH'||managementType =='BY_QUANTITY' ">
</record-com-detail-card-batch >
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)"
:isShowModifedLocation="true"
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation"
v-else>
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation">
</record-com-detail-card>
</view>
</view>
@ -49,12 +42,6 @@
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getToLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></win-scan-location>
<win-scan-pack-and-location ref="winScanPackAndLocationRef" @getResult='getScanResult' :allowModifyLocation='false'>
</win-scan-pack-and-location>
<comMessage ref="comMessage"></comMessage>
<win-scan-location ref="winScanFromLocation" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
@ -63,8 +50,7 @@
import {
productPutawayRecordSubmit,
getrecommendLocationExpectin,
recommendLocationRemoveExpectin,
getBalanceByFilter
recommendLocationRemoveExpectin
} from '@/api/request2.js';
import {
goHome,
@ -72,8 +58,7 @@
deepCopyData
} from '@/common/basic.js';
import {
getPrecisionStrategyList,
getManagementPrecisions
getPrecisionStrategyList
} from '@/common/balance.js';
import {
@ -85,13 +70,8 @@
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty,
calcHandleQtyAdd
calcHandleQty
} from '@/common/record.js';
import {
calc
} from '@/common/calc.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
@ -101,8 +81,6 @@
import winScanPackage from '@/mycomponents/scan/winScanPackage.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCardBatch from '@/mycomponents/record/recordComDetailCardBatch.vue'
import {
updateTitle
} from '@/common/basic.js';
@ -116,9 +94,7 @@
recordComDetailCard,
winScanPackage,
winScanLocation,
winComScanBalance,
winScanPackAndLocation,
recordComDetailCardBatch
winComScanBalance
},
data() {
return {
@ -138,8 +114,7 @@
businessType: {},
managementList: [],
type: '',
editItem: null,
managementType:''
editItem: null
};
},
// type = 'assemble'
@ -173,143 +148,11 @@
},
methods: {
getScanResult(result,managementTypeParams) {
this.managementType = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
this.setDataBatch(result)
}else{
this.setData(result)
}
getScanResult(result) {
this.setData(result);
},
async setDataBatch(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
// itemp.containerNumber=""
let newDetail = createDetailInfo(balance, pack); //
newDetail.fromLocationCode=balance.locationCode
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
await this.getRecommendLocation(balance,result)
await this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.batch == balance.batch &&
r.fromLocationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
//
//
//,
if (pack.parentNumber) {
var checkData = item.subList.find(r => {
if (r.packingNumber == pack.parentNumber &&
r.batch == balance.batch&&
r.fromLocationCode == balance.locationCode) {
return r;
}
})
if (checkData) {
//
this.showErrorMessage("扫描箱码[" + pack.number + "]批次[" + balance.batch +
"]的父包装已经扫描")
console.log("父包装已经扫描")
} else {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.fromLocationCode=balance.locationCode
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
item.subList.push(newDetail);
}
} else {
//
var checkData = item.subList.find(r => {
if (r.parentNumber == pack.number &&
r.batch == balance.batch&&
r.fromLocationCode == balance.locationCode) {
return r;
}
})
if (checkData) {
//
this.$refs.comMessage.showQuestionMessage("箱码[" + checkData.parentNumber+"]" + "批次[" + balance
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
item.subList = [];
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.fromLocationCode=balance.locationCode
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
item.subList.push(newDetail);
calcHandleQtyAdd(this.detailSource,result.label);
}
})
console.log("扫描的是父包装,是否移除子包装")
} else {
let newDetail = createDetailInfo(balance, pack);
newDetail.fromLocationCode=balance.locationCode
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
item.subList.push(newDetail);
}
}
this.scanPopupGetFocus()
} else {
if (detail.scaned == true) {
// detail.handleQty = calc.add(detail.handleQty,result.label.qty)
// this.showErrorMessage("[" + detail.packingNumber + "[" + balance.batch + "]")
}
}
}
calcHandleQtyAdd(this.detailSource,result.label);
},
async setData(result) {
setData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
@ -336,11 +179,12 @@
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
await this.getRecommendLocation(balance,result)
await this.scanPopupGetFocus()
this.getRecommendLocation(balance)
this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.batch == balance.batch &&
if (r.packingNumber == pack.number &&
r.batch == balance.batch &&
r.fromLocationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
@ -421,15 +265,14 @@
this.scanPopupGetFocus()
} else {
if (detail.scaned == true) {
detail.handleQty = calc.add(detail.handleQty,result.label.qty)
// this.showErrorMessage("[" + detail.packingNumber + "[" + balance.batch + "]")
this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描")
}
}
}
calcHandleQty(this.detailSource);
},
async getRecommendLocation(balance,result) {
getRecommendLocation(balance) {
uni.showLoading({
title: '扫描中...',
mask: true
@ -442,88 +285,24 @@
batch: balance.batch
};
console.log(JSON.stringify(param))
await getrecommendLocationExpectin(param).then(async result1 => {
getrecommendLocationExpectin(param).then(result => {
uni.hideLoading();
let item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
if (res.itemCode == balance.itemCode && res.containerNumber == balance
.packingNumber) {
return res
}
})
item.toLocationCode = result1.data.code;
item.expectinNumber = result1.data.expectinNumber;
await this.getToLocationBalance(item.toLocationCode,result)
item.toLocationCode = result.data.code;
item.expectinNumber = result.data.expectinNumber;
this.$forceUpdate();
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
})
},
//
async getToLocationBalance(toLocationCode,result) {
uni.showLoading({
title: '查询中',
mask: true
})
var filters = []
if (result.package.parentNumber) {
var 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: this.toLocationAreaTypeList.join(',')
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
await getManagementPrecisions([result.package.itemCode], toLocationCode,async res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision == 'BY_BATCH') ? 'BY_BATCH' : ''
if(this.managementType == 'BY_BATCH'){
uni.hideLoading()
}else{
await getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
}
// callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
}
}
})
},
//
removeRecommendLocation(lst) {
let param = {
@ -571,9 +350,7 @@
openScanPopup() {
if (this.businessType) {
this.toLocationAreaTypeList = getDirectoryItemArray(this.businessType.inAreaTypes)
// this.$refs.scanPopup.openScanPopup(this.businessType);
this.openFromLocationScanPopup()
this.$refs.scanPopup.openScanPopup(this.businessType);
} else {
this.getBusinessType()
}
@ -596,18 +373,7 @@
this.$refs.scanPopup.losefocus();
}
},
openFromLocationScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.winScanPackAndLocationRef.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.winScanFromLocation.openScanPopup();
})
},
scanLocationCode(location, code) {
this.toLocationCode = code
this.detailSource.forEach(item => {
@ -626,15 +392,7 @@
});
var params = this.setParams()
console.log("提交" + JSON.stringify(params))
const isHaveItem =params.subList.find(item=>item.handleQty > item.balanceQty)
if(isHaveItem){
this.showErrorMessage(`物料号${isHaveItem.itemCode}`)
this.$refs.comMessage.showConfirmWarningModal('物料号'+isHaveItem.itemCode+'数量[' + isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']')
uni.hideLoading()
return
}
productPutawayRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
@ -745,14 +503,7 @@
getToLocationCode(location, code) {
this.editItem.toLocationCode = code;
},
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationInfo = location;
this.fromLocationCode = code;
this.openScanPopup();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();

651
src/pages/productPutaway/record/productPutawayRecordByBatch.vue

@ -0,0 +1,651 @@
<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" style="height: calc(100vh - 44px);">
<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" :index="index" :settingParam="dataContent"
:isShowStatus="true" :isShowToLocation='false' @removeItem="removeItem(index,item)"
:isShowModifedLocation="true"
@updateData="updateData" @removePack="removePack" @editLocation="showScanToLocation"
>
</record-com-detail-card>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer" v-if="detailSource.length>0">
<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_reject" style="margin-right:5px ;" hover-class="btn_commit_after"
@click="cancel">取消</button>
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
</view>
</view>
</view>
</view>
<win-scan-button v-if="detailSource.length>0" @goScan='openScanPopup'></win-scan-button>
<winComScanBalance ref="scanPopup" @getBalance='getScanResult' :bussinessCode="businessTypeCode">
</winComScanBalance>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getToLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></win-scan-location>
<win-scan-pack-and-location ref="winScanPackAndLocationRef" @getResult='getScanResult' :allowModifyLocation='false'>
</win-scan-pack-and-location>
<comMessage ref="comMessage"></comMessage>
<win-scan-location ref="winScanFromLocation" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
productPutawayRecordSubmit,
getrecommendLocationExpectin,
recommendLocationRemoveExpectin,
getBalanceByFilter
} from '@/api/request2.js';
import {
goHome,
getPackingNumberAndBatchByList,
deepCopyData
} from '@/common/basic.js';
import {
getPrecisionStrategyList,
getManagementPrecisions
} from '@/common/balance.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty,
} from '@/common/record.js';
import {
calc
} from '@/common/calc.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comProductionRecord from '@/pages/productionReceipt/coms/comProductionRecord.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import winScanPackage from '@/mycomponents/scan/winScanPackage.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import {
updateTitle
} from '@/common/basic.js';
export default {
components: {
winScanButton,
comProductionRecord,
requiredLocation,
comBlankView,
recordComDetailCard,
winScanPackage,
winScanLocation,
winComScanBalance,
winScanPackAndLocation,
},
data() {
return {
id: '',
scanCount: 0,
dataContent: {}, //
subList: [], //subList
detailSource: [], //
fromLocationCode: "",
toLocationCode: "",
fromLocationAreaTypeList: [],
tolocationTypeList: [],
toLocationAreaTypeList: [],
inInventoryStatus: "", //
outInventoryStatus: "", //:"",
businessTypeCode: "ProductPutaway",
businessType: {},
managementList: [],
type: '',
editItem: null,
managementType:''
};
},
// type = 'assemble'
// type = 'predict'
props: {
putawayType: 'assemble',
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses);
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
methods: {
getScanResult(result,managementTypeParams) {
this.managementType = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
this.setDataBatch(result)
}else{
this.setData(result)
}
},
async setData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
// itemp.containerNumber=""
let newDetail = createDetailInfo(balance, pack); //
newDetail.fromLocationCode=balance.locationCode
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
await this.getRecommendLocation(balance,result)
await this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.parentNumber &&
r.batch == balance.batch &&
r.fromLocationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if(detail == undefined){
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.fromLocationCode=balance.locationCode
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
item.subList.push(newDetail);
this.scanPopupGetFocus()
}else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + detail.packingNumber + "批次[" + balance.batch + "]重复扫描")
}
}
}
calcHandleQty(this.detailSource);
},
async setDataBatch(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
// itemp.containerNumber=""
let newDetail = createDetailInfo(balance, pack); //
newDetail.fromLocationCode=balance.locationCode
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.itemCode = balance.itemCode;
this.fromLocationCode = balance.locationCode
await this.getRecommendLocation(balance,result)
await this.scanPopupGetFocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.parentNumber &&
r.batch == balance.batch &&
r.fromLocationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if(detail == undefined){
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber = pack.parentNumber;
newDetail.packingNumber = pack.number
newDetail.packUnit = pack.packUnit;
newDetail.packQty = pack.packQty;
newDetail.fromLocationCode=balance.locationCode
if (balance.lableQty) {
newDetail.handleQty = balance.lableQty
}
item.subList.push(newDetail);
this.scanPopupGetFocus()
}else {
detail.handleQty = calc.add(detail.handleQty,result.label.qty)
}
}
calcHandleQty(this.detailSource);
},
async getRecommendLocation(balance,result) {
uni.showLoading({
title: '扫描中...',
mask: true
})
let param = {
expectinNumber: balance.packingNumber + "-" + Date.now(),
itemCode: balance.itemCode,
inventoryStatus: balance.inventoryStatus,
batch: balance.batch
};
console.log(JSON.stringify(param))
await getrecommendLocationExpectin(param).then(async result1 => {
uni.hideLoading();
let item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
item.toLocationCode = result1.data.code;
item.expectinNumber = result1.data.expectinNumber;
await this.getToLocationBalance(item.toLocationCode,result)
this.$forceUpdate();
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error);
})
},
//
async getToLocationBalance(toLocationCode,result) {
uni.showLoading({
title: '查询中',
mask: true
})
var filters = []
if (result.package.parentNumber) {
var 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: this.toLocationAreaTypeList.join(',')
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
await getManagementPrecisions([result.package.itemCode], toLocationCode,async res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision == 'BY_BATCH') ? 'BY_BATCH' : ''
if(this.managementType == 'BY_BATCH'){
uni.hideLoading()
}else{
await getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
}
// callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
}
}
})
},
//
removeRecommendLocation(lst) {
let param = {
expectinNumberList: lst,
};
recommendLocationRemoveExpectin(param).then(res => {
}).catch(err => {
this.showErrorMessage('【' + lst.join(',') + '】移除预占用失败,请在PC端的预占用中移除')
})
},
showScanToLocation(item) {
this.editItem = item;
setTimeout(r => {
this.$refs.scanLocationCode.openScanPopup();
})
},
showErrorMessage(message) {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, res => {
this.scanPopupGetFocus();
});
},
calcHandleQty() {
calcHandleQty(this.detailSource);
this.$forceUpdate();
},
removeItem(index, item) {
this.removeRecommendLocation([item.expectinNumber]);
this.detailSource.splice(index, 1)
},
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.removeRecommendLocation(item)
}
}
this.updateData();
},
openScanPopup() {
if (this.businessType) {
this.toLocationAreaTypeList = getDirectoryItemArray(this.businessType.inAreaTypes)
// this.$refs.scanPopup.openScanPopup(this.businessType);
this.openFromLocationScanPopup()
} else {
this.getBusinessType()
}
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus();
}
},
openFromLocationScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.winScanPackAndLocationRef.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.winScanFromLocation.openScanPopup();
})
},
scanLocationCode(location, code) {
this.toLocationCode = code
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code
})
})
},
commit() {
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
//
uni.showLoading({
title: "提交中....",
mask: true
});
var params = this.setParams()
console.log("提交" + JSON.stringify(params))
const isHaveItem =params.subList.find(item=>item.handleQty > item.balanceQty)
if(isHaveItem){
this.showErrorMessage(`物料号${isHaveItem.itemCode}`)
this.$refs.comMessage.showConfirmWarningModal('物料号'+isHaveItem.itemCode+'数量[' + isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']')
uni.hideLoading()
return
}
productPutawayRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成制品上架记录\n" + res.data)
let removeId = [];
this.detailSource.forEach(r => {
removeId.push(r.expectinNumber);
})
this.removeRecommendLocation(removeId);
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
// } else {
// uni.hideLoading();
// this.showErrorMessage(res.message);
// }
} else {
this.showErrorMessage("没有要提交的数据,请先扫描")
}
},
setPrecisionStrategParams() {
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 &&
detail.toLocationCode == res.locationCode) {
return res
}
})
//
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode
}
itemList.push(result)
}
}
})
})
return itemList;
},
setParams() {
let that = this;
var subList = []
var creator = this.$store.state.user.id
that.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var submitItem = deepCopyData(detail)
submitItem.itemCode = detail.itemCode;
submitItem.itemName = detail.package.itemName;
submitItem.itemDesc1 = detail.package.itemDesc1;
submitItem.itemDesc2 = detail.package.itemDesc2;
submitItem.inventoryStatus = detail.inventoryStatus;
submitItem.fromPackingNumber = detail.packingNumber;
submitItem.toPackingNumber = detail.packingNumber;
submitItem.fromParentPackingNumber = detail.parentNumber;
submitItem.fromBatch = detail.package.batch;
submitItem.toBatch = detail.package.batch;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = item.toLocationCode;
submitItem.qty = detail.handleQty;
submitItem.package = "";
subList.push(submitItem)
}
})
})
that.dataContent.subList = subList;
that.dataContent.creator = creator;
that.dataContent.type = that.putawayType;
return that.dataContent;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
getToLocationCode(location, code) {
this.editItem.toLocationCode = code;
},
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationInfo = location;
this.fromLocationCode = code;
this.openScanPopup();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
clearData() {
this.fromLocationCode = '';
this.subList = [];
this.detailSource = [];
this.toLocationCode = '';
this.dataContent = {}
},
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)
}
}
},
cancel() {
this.clearData();
this.openScanPopup();
}
}
}
</script>
<style scoped lang="scss">
</style>

48
src/pages/productPutaway/record/semiDirectPutawayByBatch.vue

@ -0,0 +1,48 @@
<template>
<view class="">
<productPutawayRecordByBatch :title="title" ref="productPutawayRecordByBatch" putawayType='predict'></productPutawayRecordByBatch>
</view>
</template>
<script>
import productPutawayRecordByBatch from '@/pages/productPutaway/record/productPutawayRecordByBatch.vue'
export default {
components: {
productPutawayRecordByBatch
},
data() {
return {
title:''
};
},
onLoad(option){
this.title = option.title
},
onShow() {
if(this.$refs.productPutawayRecordByBatch!=undefined){
this.$refs.productPutawayRecordByBatch.refresh();
}
},
onPullDownRefresh() {
this.$refs.productPutawayRecordByBatch.refresh();
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
this.$refs.productPutawayRecordByBatch.toHome();
} else if (e.index == 1) {
this.$refs.productPutawayRecordByBatch.openFilter();
}
},
methods: {
}
}
</script>
<style scoped lang="scss">
</style>

2
src/pages/productReceipt/coms/comProductRecordBatch.vue

@ -17,7 +17,7 @@
<uni-swipe-action-item @click="swipeClick($event,item,index)"
:right-options="item.scaned?scanOptions:detailOptions">
<balance :dataContent="item" :isShowStdPack="false" :isShowStatus="true"
:isShowPack="true" :isShowFromLocation="false"></balance>
:isShowPack="true" :isShowFromLocation="true"></balance>
<!-- <production-label :dataContent="item" :packageContent="item.package"
:isShowLocation="false">
</production-label> -->

118
src/pages/productReceipt/record/productReceiptRecord.vue

@ -8,11 +8,8 @@
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<com-product-record-batch :dataContent="item" :index="index" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack" v-if="managementType == 'BY_BATCH'||managementType =='BY_QUANTITY' ">
</com-product-record-batch >
<com-product-record :dataContent="item" :index="index" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack" v-else>
@updateData="updateData" @removePack="removePack">
</com-product-record>
</view>
<view class='split_line'></view>
@ -45,12 +42,6 @@
</view>
<win-scan-pack ref="scanPopup" @getResult='getScanResult' title="制品标签" headerType="HMQ"></win-scan-pack>
<win-scan-pack-and-location ref="winScanPackAndLocationRef" @getResult='getScanResult' :allowModifyLocation='false'>
</win-scan-pack-and-location>
<comMessage ref="comMessage"></comMessage>
<win-scan-location ref="winScanFromLocation" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
@ -88,20 +79,14 @@
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comProductRecord from '@/pages/productReceipt/coms/comProductRecord.vue'
import comProductRecordBatch from '@/pages/productReceipt/coms/comProductRecordBatch.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
export default {
components: {
winScanButton,
winScanPack,
comProductRecord,
comProductRecordBatch,
comBlankView,
winScanLocation,
winScanPackAndLocation,
},
data() {
return {
@ -123,7 +108,6 @@
workShopName: "",
productionLineName: "",
workStationName: "",
managementType:''
};
},
onLoad(option) {
@ -158,53 +142,7 @@
mounted() {},
methods: {
getScanResult(result,managementTypeParams ) {
this.managementType = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
this.setDataBatch(result)
}else{
this.setData(result)
}
},
async setDataBatch(result) {
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = this.createItemInfo(label, pack);
let newDetail = this.createDetailInfo(label, pack);
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == label.packingNumber &&
r.batch == label.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = this.createDetailInfo(label, pack);
newDetail.handleQty =0;
newDetail.balanceQty =result.balance.qty;
item.subList.push(newDetail);
} else {
if (detail.scaned == true) {
// this.showErrorMessage("[" + label.packingNumber + "[" + label.batch + "]")
}
}
}
this.calcHandleQtyAdd(result.label);
},
async setData(result) {
getScanResult(result) {
let label = result.label;
let pack = result.package;
@ -280,40 +218,14 @@
this.$forceUpdate();
},
calcHandleQtyAdd(label) {
for (let item of this.detailSource) {
item.handleQty = item.handleQty || new Decimal(0).toNumber();
for (let detail of item.subList) {
if (detail != undefined) {
item.handleQty = calc.add(item.handleQty,label.qty)
detail.handleQty = calc.add(detail.handleQty,label.qty)
}
}
}
console.log(this.detailSource)
this.scanPopupGetFocus();
this.$forceUpdate();
},
updateData() {
this.calcHandleQty();
},
openScanPopup() {
// this.$refs.scanPopup.openScanPopup();
this.openFromLocationScanPopup()
},
openFromLocationScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.winScanPackAndLocationRef.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
this.$refs.winScanFromLocation.openScanPopup();
})
this.$refs.scanPopup.openScanPopup();
},
commit() {
if (this.positionInfo == "请选择位置") {
this.showMessage("请先选择位置")
@ -328,21 +240,12 @@
});
this.managementList = [];
var precisionStrategParams = this.setPrecisionStrategParams()
getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交",params)
const isHaveItem =params.subList.find(item=>item.handleQty > item.balanceQty)
if(isHaveItem){
this.showErrorMessage(`物料号${isHaveItem.itemCode}`)
this.$refs.comMessage.showConfirmWarningModal('物料号'+isHaveItem.itemCode+'数量[' + isHaveItem.handleQty + ']不允许大于库存数量[' + isHaveItem.balanceQty + ']')
uni.hideLoading()
return
}
return
console.log("提交" + JSON.stringify(params))
productionReceiptRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
@ -476,14 +379,7 @@
this.$refs.scanPopup.losefocus();
}
},
getLocation(location, code) {
this.getFromLocationCode(location, code)
},
getFromLocationCode(location, code) {
this.fromLocationInfo = location;
this.fromLocationCode = code;
this.openScanPopup();
},
afterCloseMessage() {
this.scanPopupGetFocus();
},

492
src/pages/productReceipt/record/productReceiptRecordByBatch.vue

@ -0,0 +1,492 @@
<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="">
<com-product-record :dataContent="item" :index="index" @removeItem="removeItem(index,item)"
@updateData="updateData" @removePack="removePack">
</com-product-record>
</view>
<view class='split_line'></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="">
<view class="uni-flex uni-row u-col-center">
<text style="font-size: 32rpx;">位置 : </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>
<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 ref="scanPopup" @getResult='getScanResult' title="制品标签" headerType="HMQ"></win-scan-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
productionReceiptRecordSubmit,
getWorkShopLineStation
} from '@/api/request2.js';
import {
getPrecisionStrategyList
} from '@/common/balance.js';
import {
goHome,
getPackingNumberAndBatchByList,
deepCopyData
} from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import { Decimal } from 'decimal.js';//
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
} from '@/common/record.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPack from '@/mycomponents/scan/winScanPack.vue'
import comProductRecord from '@/pages/productReceipt/coms/comProductRecord.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
export default {
components: {
winScanButton,
winScanPack,
comProductRecord,
comBlankView,
},
data() {
return {
detailSource: [], //
toLocationCode: "",
fromLocationTypeList: [],
fromLocationCode: "",
businessType: {},
dataContent: {},
managementList: [],
show: false,
positionInfo: "请选择位置",
positionList: [],
productionLineCode: '',
rawLocationCode: "",
fgLocationCode: "",
workshopCode: "",
workStationCode: "",
workShopName: "",
productionLineName: "",
workStationName: "",
};
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
})
var typeCode = "ProductReceipt"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
getWorkShopLineStation().then(res => {
this.positionList = res.data
}).catch(error => {
})
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
mounted() {},
methods: {
getScanResult(result) {
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = this.createItemInfo(label, pack);
let newDetail = this.createDetailInfo(label, pack);
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == label.packingNumber &&
r.batch == label.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = this.createDetailInfo(label, pack);
item.subList.push(newDetail);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + label.batch + "]重复扫描")
}
}
}
this.calcHandleQty();
},
createItemInfo(label, pack) {
let item = {
itemCode: label.itemCode,
itemName: pack.itemName,
packQty: pack.packQty,
packUnit: pack.packUnit,
qty: new Decimal(label.qty).toNumber(),
handleQty: new Decimal(0).toNumber(),
uom: pack.uom,
subList: []
}
return item;
},
createDetailInfo(label, pack) {
let detail = deepCopyData(label);
detail.scaned = true;
detail.qty = new Decimal(label.qty).toNumber();
detail.handleQty = new Decimal(label.qty).toNumber();
detail.inventoryStatus = "OK"
detail.packQty = pack.packQty;
detail.packUnit = pack.packUnit;
detail.package = pack;
detail.label = label;
return detail;
},
calcHandleQty() {
for (let item of this.detailSource) {
item.handleQty = new Decimal(0).toNumber();
for (let detail of item.subList) {
if (detail != undefined) {
item.handleQty = calc.add(item.handleQty,detail.handleQty)
}
}
}
this.scanPopupGetFocus();
this.$forceUpdate();
},
updateData() {
this.calcHandleQty();
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
commit() {
if (this.positionInfo == "请选择位置") {
this.showMessage("请先选择位置")
return;
}
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
//
uni.showLoading({
title: "提交中....",
mask: true
});
this.managementList = [];
var precisionStrategParams = this.setPrecisionStrategParams()
getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交" + JSON.stringify(params))
productionReceiptRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成制品收货记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
})
} else {
this.showErrorMessage("没有要提交的数据,请先扫描")
}
},
setPrecisionStrategParams() {
var itemList = []
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
detail.toLocationCode = this.fgLocationCode;
var filterResult = itemList.filter(res => {
if (res.itemCode == item.itemCode &&
detail.toLocationCode == res.locationCode) {
return res
}
})
//
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode
}
itemList.push(result)
}
}
})
})
return itemList;
},
setParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var submitItem = deepCopyData(detail)
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
detail.packingNumber, detail.toLocationCode, detail.batch);
submitItem.itemCode = detail.itemCode;
submitItem.itemName = detail.package.itemName;
submitItem.itemDesc1 = detail.package.itemDesc1;
submitItem.itemDesc2 = detail.package.itemDesc2;
submitItem.inventoryStatus = detail.inventoryStatus;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.toPackingNumber = info.packingNumber;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.toContainerNumber = detail.containerNumber
submitItem.fromBatch = info.batch;
submitItem.toBatch = info.batch;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode;
submitItem.productionlineCode = this.productionLineCode;
submitItem.workStationCode = this.workStationCode;
submitItem.qty = detail.handleQty;
submitItem.package = "";
subList.push(submitItem)
}
})
})
this.dataContent.subList = subList;
this.dataContent.creator = creator;
this.dataContent.type = "predict";//使
this.dataContent.workshopCode = this.workshopCode;
return this.dataContent;
},
showMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.scanPopupGetFocus();
}
});
})
},
showErrorMessage(message) {
setTimeout(r => {
this.scanPopupLoseFocus();
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.scanPopupGetFocus();
}
});
})
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
scanPopupLoseFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.losefocus();
}
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
clearData() {
this.subList = [];
this.detailSource = [];
this.toLocationCode = '';
this.dataContent = {};
this.positionInfo = "请选择位置";
this.fgLocationCode = ""
},
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();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
updateData() {
this.calcHandleQty();
},
showSelect() {
this.show = !this.show
},
confirmSelect(e) {
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label
console.log("位置", this.positionInfo)
this.workshopCode = e[0].value
this.productionLineCode = e[1].value
this.workStationCode = e[2].value
this.workShopName = e[0].label
this.productionLineName = e[1].label
this.workStationName = e[2].label
let shop = this.positionList.find(shop => shop.value == this.workshopCode);
if (shop != undefined && shop.children != undefined) {
let prodLine = shop.children.find(line => line.value == this.productionLineCode);
if (prodLine != undefined && prodLine.children != undefined) {
let station = prodLine.children.find(r => r.value == this.workStationCode);
if (station.rawLocationCode == '' && station.rawLocationCode == null) {
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择")
return;
} else {
this.rawLocationCode = station.rawLocationCode;
this.fgLocationCode = station.fgLocationCode;
}
} else {
this.showErrorMessage("生产线-工位基础信息维护错误")
}
} else {
this.showErrorMessage("车间-生产线基础信息维护错误")
}
},
}
}
</script>
<style scoped lang="scss">
page {
width: 100%;
height: 100%;
background-color: #fff;
}
.page-wraper {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.page-main-list {
/* height: 80rpx;
line-height: 80rpx; */
text-align: center;
background: #e0e0e0;
}
</style>

90
src/pages/scrap/record/scrapRecord.vue

@ -8,8 +8,9 @@
<view class="" style=" text-align: center;font-size: 32rpx;font-weight: 700;margin-left: 20rpx;">
报废原因 :
</view>
<view class="" style="width: 75%;">
<uni-easyinput v-if="detailSource.length>0" v-model="reasonText" placeholder="请输入报废原因" maxlength='24'></uni-easyinput>
<view class="" style="width: 75%;">
<uni-easyinput v-if="detailSource.length>0" v-model="reasonText" placeholder="请输入报废原因"
maxlength='24'></uni-easyinput>
</view>
</view>
<view class='split_line'></view>
@ -18,14 +19,13 @@
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<record-com-detail-card-batch :dataContent="item" :index="index" :isShowFromLocation="true"
:isShowParentToLocation="false"
@removeItem="removeItem(index,item)" :isShowToLocation="false" @updateData="updateData"
@removePack="removePack"
:isShowParentToLocation="false" @removeItem="removeItem(index,item)"
:isShowToLocation="false" @updateData="updateData" @removePack="removePack"
v-if="managementType == 'BY_BATCH'||managementType =='BY_QUANTITY' ">
</record-com-detail-card-batch>
<record-com-detail-card v-else :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="true" @removeItem="removeItem(index,item)" @updateData="updateData"
:isShowToLocation="false"
<record-com-detail-card v-else :dataContent="item" :index="index"
:settingParam="dataContent" :isShowFromLocation="true"
@removeItem="removeItem(index,item)" @updateData="updateData" :isShowToLocation="false"
@removePack="removePack">
</record-com-detail-card>
</view>
@ -59,28 +59,27 @@
import {
scrapRecordSubmit
} from '@/api/request2.js';
import {
goHome,
deepCopyData
} from '@/common/basic.js';
import {
calc
} from '@/common/calc'
import {
getInventoryStatusDesc,
getDirectoryItemArray,
getScarpReasonList
} from '@/common/directory.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty,
calcHandleQtyAdd
} from '@/common/record.js';
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
@ -90,7 +89,7 @@
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordComDetailCardBatch from '@/mycomponents/record/recordComDetailCardBatch.vue'
export default {
components: {
winScanButton,
@ -115,12 +114,12 @@
businessType: {},
reasonList: [],
reasonText: "",
managementType:""
managementType: ""
};
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
title: option.title
})
this.reasonList = getScarpReasonList();
var typeCode = "Scrap"
@ -148,20 +147,20 @@
onPullDownRefresh() {},
mounted() {
},
methods: {
getScanResult(result,managementTypeParams) {
getScanResult(result, managementTypeParams) {
this.managementType = managementTypeParams
console.log("模式"+managementTypeParams)
console.log("模式" + managementTypeParams)
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result)
} else {
this.setData(result)
}
},
setDataBatch(result){
setDataBatch(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
@ -187,14 +186,14 @@
let newDetail = createDetailInfo(balance, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
detail.handleQty = calc.add(detail.handleQty, result.label.qty)
}
}
this.calcHandleQty(this.detailSource)
},
setData(result){
setData(result) {
let balance = result.balance;
let label = result.label;
let pack = result.package;
@ -255,12 +254,15 @@
},
openScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
if (this.businessType) {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
} else {
this.getBusinessType()
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {
@ -269,13 +271,13 @@
},
closeScanPopup() {
if(this.$refs.scanPopup!=undefined){
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if(this.$refs.scanPopup!=undefined){
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
@ -313,33 +315,33 @@
submitItem.itemName = detail.package.itemName;
submitItem.itemDesc1 = detail.package.itemDesc1;
submitItem.itemDesc2 = detail.package.itemDesc2;
submitItem.inventoryStatus = detail.inventoryStatus;
detail.fromPackingNumber = detail.packingNumber;
detail.toPackingNumber = detail.packingNumber;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.toContainerNumber = detail.containerNumber
submitItem.fromBatch = detail.batch;
submitItem.toBatch = detail.batch;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = "";
submitItem.reason = this.reasonText;
submitItem.qty = detail.handleQty;
submitItem.package ="";
submitItem.package = "";
subList.push(submitItem)
}
})
})
this.dataContent.subList =subList
this.dataContent.subList = subList
this.dataContent.creator = creator;
return this.dataContent;
},
showScanMessage(message) {
@ -366,7 +368,7 @@
this.clearData();
})
},
clearData(){
clearData() {
this.fromLocationCode = "";
this.reasonText = "";
this.detailSource = [];
@ -423,4 +425,4 @@
background: #e0e0e0;
}
</style>
</style>

12
src/pages/transfer/record/deliverRecord.vue

@ -262,11 +262,15 @@
},
openScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
if (this.businessType) {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
} else {
this.getBusinessType()
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {

43
src/pages/transfer/record/receiptRecord.vue

@ -97,8 +97,7 @@
businessType: {},
managementList: [],
dataContent: {},
toWarehouseCode: '',
managementType:import.meta.env.VITE_MANAGE_MODEL
toWarehouseCode: ''
};
},
@ -132,14 +131,7 @@
methods: {
getScanResult(result) {
var managementTypeParams =this.managementType
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result)
} else {
this.setData(result)
}
this.setData(result)
},
setData(result){
@ -174,37 +166,6 @@
}
this.calcHandleQty();
},
setDataBatch(result){
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(label, pack);
let newDetail = createDetailInfo(label, pack); //
newDetail.inventoryStatus = "OK"
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == label.packingNumber &&
r.batch == label.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(label, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
this.calcHandleQty();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {

482
src/pages/transfer/record/receiptRecordByBatch.vue

@ -0,0 +1,482 @@
<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" :index="index" :isShowFromLocation="false"
:isShowToLocation="false"
:isShowParentToLocation="false"
:allowModifyQty="true"
:queryBalance="false"
@removeItem="removeItem(index,item)" @updateData="updateData" @removePack="removePack">
</record-com-detail-card>
</view>
<view class='split_line'></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="">
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></requiredLocation>
</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 ref="scanPopup" @getResult='getScanResult'></win-scan-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
transferReceiptRecordSubmit
} from '@/api/request2.js';
import {
getPrecisionStrategyList
} from '@/common/balance.js';
import {
goHome,
deepCopyData,
getPackingNumberAndBatchByList
} from '@/common/basic.js';
import {
getInventoryStatusDesc,
getDirectoryItemArray
} from '@/common/directory.js';
import {
getBusinessType,
createItemInfo,
createDetailInfo,
calcHandleQty
} from '@/common/record.js';
import {
calc
} from '@/common/calc'
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 recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
export default {
components: {
winScanButton,
winScanPack,
requiredLocation,
comBlankView,
recordComDetailCard
},
data() {
return {
id: '',
subList: [], //subList
detailSource: [], //
toLocationCode: "",
toLocationAreaTypeList: [],
inInventoryStatus: "", //
outInventoryStatus: "", //
businessType: {},
managementList: [],
dataContent: {},
toWarehouseCode: '',
managementType:import.meta.env.VITE_MANAGE_MODEL
};
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title
})
var typeCode = "TransferReceipt"
getBusinessType(typeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
//
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {},
onPullDownRefresh() {},
methods: {
getScanResult(result) {
var managementTypeParams =this.managementType
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result)
} else {
this.setData(result)
}
},
setData(result){
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(label, pack);
let newDetail = createDetailInfo(label, pack); //
newDetail.inventoryStatus = "OK"
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == label.packingNumber &&
r.batch == label.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(label, pack);
item.subList.push(newDetail);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + label.packingNumber + "批次[" + balance.batch + "]重复扫描")
}
}
}
this.calcHandleQty();
},
setDataBatch(result){
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = createItemInfo(label, pack);
let newDetail = createDetailInfo(label, pack); //
newDetail.inventoryStatus = "OK"
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == label.packingNumber &&
r.batch == label.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(label, pack);
item.subList.push(newDetail);
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
this.calcHandleQty();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
calcHandleQty() {
calcHandleQty(this.detailSource)
this.$forceUpdate();
},
updateData() {
this.calcHandleQty();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
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() {
this.$refs.scanPopup.openScanPopup();
},
closeScanPopup() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.closeScanPopup();
}
},
scanPopupGetFocus() {
if (this.$refs.scanPopup != undefined) {
this.$refs.scanPopup.getfocus();
}
},
scanLocationCode(location, code) {
this.toLocationCode = code
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code
})
})
},
commit() {
if (this.toLocationCode == "") {
this.showMessage("请先选择目标库位")
return;
}
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
//
uni.showLoading({
title: "提交中....",
mask: true
});
this.managementList = [];
var precisionStrategParams = this.setPrecisionStrategParams()
getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交" + JSON.stringify(params))
transferReceiptRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成调拨入库记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
})
} else {
this.showErrorMessage("没有要提交的数据,请先扫描")
}
},
setPrecisionStrategParams() {
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 &&
detail.toLocationCode == res.locationCode) {
return res
}
})
//
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode
}
itemList.push(result)
}
}
})
})
return itemList;
},
setParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var submitItem = deepCopyData(detail)
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode,
detail.packingNumber, detail.toLocationCode, detail.batch);
submitItem.itemCode = detail.itemCode;
submitItem.itemName = detail.package.itemName;
submitItem.itemDesc1 = detail.package.itemDesc1;
submitItem.itemDesc2 = detail.package.itemDesc2;
submitItem.inventoryStatus = detail.inventoryStatus;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.toPackingNumber = info.packingNumber;
submitItem.fromContainerNumber = detail.containerNumber;
submitItem.toContainerNumber = detail.containerNumber
submitItem.fromBatch = info.batch;
submitItem.toBatch = info.batch;
submitItem.fromLocationCode = detail.locationCode;
submitItem.toLocationCode = detail.toLocationCode;
submitItem.qty = detail.handleQty;
submitItem.package = "";
subList.push(submitItem)
}
})
})
this.dataContent.subList = subList;
this.dataContent.creator = creator;
this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode;
this.dataContent.toWarehouseCode = this.toWarehouseCode;
return this.dataContent;
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
getLocation(location, code) {
},
getToLocationCode(location, code) {
this.toWarehouseCode = location.warehouseCode
// if (this.fromLocationCode == code) {
// uni.showToast({
// title: "[" + this.fromLocationCode + "][" + code + "]",
// duration: 2000
// })
// return
// }
this.toLocationCode = code;
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.toLocationCode = code
})
})
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
clearData() {
this.fromLocationCode = '';
this.subList = [];
this.detailSource = [];
this.toLocationCode = '';
this.dataContent = {}
this.toWarehouseCode = ""
},
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)
}
}
}
}
}
</script>
<style scoped lang="scss">
page {
width: 100%;
height: 100%;
background-color: #fff;
}
.page-wraper {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
}
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
.page-main-list {
/* height: 80rpx;
line-height: 80rpx; */
text-align: center;
background: #e0e0e0;
}
</style>

12
src/pages/unPlanned/record/issueRecord.vue

@ -129,11 +129,15 @@
methods: {
openScanPopup() {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
if (this.businessType) {
if (this.fromLocationCode == "") {
this.showFromLocationPopup();
return
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
} else {
this.getBusinessType()
}
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType);
},
showFromLocationPopup() {
this.$nextTick(() => {

44
src/pages/unPlanned/record/receiptRecord.vue

@ -109,7 +109,6 @@
dataContent: {},
managementList: [],
toLocationAreaTypeList:[],
managementType:import.meta.env.VITE_MANAGE_MODEL
}
},
@ -137,13 +136,7 @@
this.toLocationCode = code;
},
getScanResult(result) {
var managementTypeParams =this.managementType
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result)
} else {
this.setData(result)
}
this.setData(result)
},
setData(result){
@ -183,41 +176,6 @@
this.calcHandleQty();
},
setDataBatch(result){
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = this.createItemInfo(label, pack);
let newDetail = this.createDetailInfo(label, pack);
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.getfocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == pack.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = this.createDetailInfo(label, pack);
item.subList.push(newDetail);
this.getfocus()
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
this.calcHandleQty();
},
getfocus(){
if(this.$refs.scanPopup){
this.$refs.scanPopup.getfocus()

450
src/pages/unPlanned/record/receiptRecordByBatch.vue

@ -0,0 +1,450 @@
<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='split_line'></view>
<view class="page-main">
<uni-data-picker v-if="detailSource.length>0" style="padding: 20rpx; background-color:#fff;"
class='uni-data-picker' placeholder="请选择入库原因" popup-title="入库原因" :localdata="reasonList"
@change="reasonChange">
</uni-data-picker>
<scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class="">
<com-receipt-record
:dataContent="item" @removeItem="removeItem(index,item)"
@updateData="updateData"
:queryBalance="false"
:isShowLocation="false" @removePack="removePack">
</com-receipt-record>
</view>
<view class='split_line'></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="">
<requiredLocation title="目标库位" :locationCode="toLocationCode" @getLocation='getToLocationCode'
:locationAreaTypeList="toLocationAreaTypeList"></requiredLocation>
</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 ref="scanPopup" @getResult='getScanResult' :title="'箱码'" headerType="HPQ,HMQ"></win-scan-pack>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comReceiptRecord from '@/pages/unPlanned/coms/comReceiptRecord.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanPack from "@/mycomponents/scan/winScanPack.vue"
import {
unPlannedReceiptRecordbSubmit
} from '@/api/request2.js';
import {
getDirectoryItemArray,
getUnPlannedReceiptReasonList
} from '@/common/directory.js';
import {
getBusinessType,
} from '@/common/record.js';
import {
calc
} from '@/common/calc.js';
import {
Decimal
} from 'decimal.js'; //
import {
goHome,
deepCopyData,
getPackingNumberAndBatchByList
} from '@/common/basic.js';
import {
getPrecisionStrategyList
} from '@/common/balance.js';
export default {
components: {
comEmptyView,
winScanButton,
requiredLocation,
comReceiptRecord,
comBlankView,
winScanPack,
},
props: {
},
data() {
return {
toLocationCode: "",
toInventoryStatus: [],
businessType: {}, //
detailSource: [], //
businessTypeCode: "UnplannedReceipt",
reasonText: "",
reasonCode: "",
reasonList: [],
dataContent: {},
managementList: [],
toLocationAreaTypeList:[],
managementType:import.meta.env.VITE_MANAGE_MODEL
}
},
mounted() {
this.reasonList = getUnPlannedReceiptReasonList();
getBusinessType(this.businessTypeCode, res => {
if (res.success) {
this.businessType = res.businessType;
this.toLocationAreaTypeList = res.toLocationAreaTypeList;
this.openScanPopup();
} else {
this.showErrorMessage(res.message)
}
});
},
onLoad(option) {
},
methods: {
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
getToLocationCode(location, code) {
this.toLocationCode = code;
},
getScanResult(result) {
var managementTypeParams =this.managementType
if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result)
} else {
this.setData(result)
}
},
setData(result){
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = this.createItemInfo(label, pack);
let newDetail = this.createDetailInfo(label, pack);
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.getfocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == pack.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = this.createDetailInfo(label, pack);
item.subList.push(newDetail);
this.getfocus()
} else {
if (detail.scaned) {
this.showErrorMessage("箱码[" + pack.number + "]批次[" + pack.batch + "]已经扫描")
}
}
}
this.calcHandleQty();
},
setDataBatch(result){
let label = result.label;
let pack = result.package;
var item = this.detailSource.find(res => {
if (res.itemCode == label.itemCode) {
return res
}
})
if (item == undefined) {
var itemp = this.createItemInfo(label, pack);
let newDetail = this.createDetailInfo(label, pack);
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
this.getfocus()
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == pack.batch) {
return r;
}
})
if (detail == undefined) {
let newDetail = this.createDetailInfo(label, pack);
item.subList.push(newDetail);
this.getfocus()
} else {
detail.handleQty =calc.add(detail.handleQty, result.label.qty)
}
}
this.calcHandleQty();
},
getfocus(){
if(this.$refs.scanPopup){
this.$refs.scanPopup.getfocus()
}
},
createItemInfo(label, pack) {
let item = {
itemCode: pack.itemCode,
itemName: pack.itemName,
packQty: pack.packQty,
packUnit: pack.packUnit,
qty: new Decimal(label.qty).toNumber(),
handleQty: new Decimal(0).toNumber(),
uom: label.uom,
subList: []
}
return item;
},
createDetailInfo(label, pack) {
let detail = deepCopyData(label);
detail.scaned = true;
// Object.assign(detail, label)
detail.qty = new Decimal(label.qty).toNumber();
detail.handleQty = new Decimal(label.qty).toNumber();
detail.inventoryStatus = "OK"
detail.packQty = pack.packQty;
detail.packUnit = pack.packUnit;
label.inventoryStatus = "OK";
detail.package = pack;
detail.label = label;
detail.label.scaned = true
return detail;
},
calcHandleQty() {
for (let item of this.detailSource) {
item.handleQty = new Decimal(0).toNumber();
item.qty = new Decimal(0).toNumber();
for (let detail of item.subList) {
if (detail != undefined) {
item.handleQty = calc.add(item.handleQty, detail.handleQty)
item.qty = calc.add(item.qty, detail.qty);
}
}
}
this.$forceUpdate();
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.getfocus()
}
});
},
updateData() {
this.calcHandleQty();
},
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();
},
removeItem(index, item) {
this.detailSource.splice(index, 1)
},
commit() {
if (this.toLocationCode == "") {
this.showErrorMessage("请先选择目标库位")
return;
}
if (this.reasonText == '') {
this.showErrorMessage("请选择入库原因")
return;
}
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) {
//
uni.showLoading({
title: "提交中....",
mask: true
});
this.managementList = [];
var precisionStrategParams = this.setPrecisionStrategParams()
getPrecisionStrategyList(precisionStrategParams, res => {
if (res.success) {
this.managementList = res.list;
var params = this.setParams()
console.log("提交" + JSON.stringify(params))
unPlannedReceiptRecordbSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
this.showCommitSuccessMessage("提交成功\n生成计划外入库记录\n" + res.data)
} else {
this.showErrorMessage("提交失败[" + res.msg + "]")
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
})
} else {
this.showErrorMessage("没有要提交的数据,请先扫描")
}
},
setPrecisionStrategParams() {
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 &&
detail.toLocationCode == res.locationCode) {
return res
}
})
//
if (filterResult.length == 0) {
var result = {
itemCode: item.itemCode,
locationCode: detail.toLocationCode
}
itemList.push(result)
}
}
})
})
return itemList;
},
setParams() {
var subList = []
var creator = this.$store.state.user.id
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
if (detail.scaned) {
var submitItem = deepCopyData(detail)
var info = getPackingNumberAndBatchByList(this.managementList, detail.label
.itemCode,
detail.label.packingNumber, detail.toLocationCode, detail.label.batch);
submitItem.itemCode = detail.package.itemCode;
submitItem.itemName = detail.package.itemName;
submitItem.itemDesc1 = detail.package.itemDesc1;
submitItem.itemDesc2 = detail.package.itemDesc2;
submitItem.inventoryStatus = detail.inventoryStatus;
submitItem.fromPackingNumber = info.packingNumber;
submitItem.toPackingNumber = info.packingNumber;
// detail.fromContainerNumber = detail.containerNumber;
// detail.toContainerNumber = detail.containerNumber
submitItem.fromBatch = info.batch;
submitItem.toBatch = info.batch;
submitItem.fromLocationCode = "";
submitItem.toLocationCode = detail.toLocationCode;
submitItem.reason = this.reasonCode;
submitItem.qty = detail.handleQty;
submitItem.package = "";
subList.push(submitItem)
}
})
})
this.dataContent.subList = subList;
this.dataContent.creator = creator;
return this.dataContent;
},
reasonChange(e) {
if (e.detail.value.length == 0) {
this.reasonCode = ""
this.reasonText = ""
} else {
this.reasonCode = e.detail.value[0].value
this.reasonText = e.detail.value[0].text
}
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
this.clearData();
})
},
clearData() {
this.reasonCode = ""
this.reasonText = "";
this.detailSource = [];
this.managementList = [];
this.dataContent = {}
this.toLocationCode = ""
}
}
}
</script>
<style>
.page-main {
flex: 1;
position: relative;
}
.page-main-scroll {
position: relative;
margin-top: 2px;
}
</style>
Loading…
Cancel
Save