Browse Source

发料任务

intex_online20241111
zhang_li 3 weeks ago
parent
commit
5b29f2b0da
  1. 41
      src/common/detail.js
  2. 7
      src/mycomponents/qty/recommendQtyEdit.vue
  3. 7
      src/pages.json
  4. 87
      src/pages/issue/coms/comIssueDetailCardBatch.vue
  5. 16
      src/pages/issue/job/issueDetail.vue
  6. 764
      src/pages/issue/job/issueDetailBatch.vue
  7. 38
      src/pages/issue/job/issueJob.vue
  8. 171
      src/pages/productReceipt/coms/comProductRecordBatch.vue
  9. 118
      src/pages/productReceipt/record/productReceiptRecord.vue

41
src/common/detail.js

@ -41,10 +41,49 @@ export function getTreeDataSource(dataList) {
})
)
}
return items;
}
export function getThreeDataSource(data) {
let items = []
// let obj ={
// ...data.subList[0]
// }
// console.log(12)
// data.subList.forEach((item)=>{
// item.threeList = [{
// fromLocationCode:item.fromLocationCode,
// batch:item.batch,
// handleQty:0,
// qty:item.qty,
// inventoryStatus:item.inventoryStatus,
// toLocationCode:item.toLocationCode,
// }]
// item.packList=[{
// scaned : false,
// scanDate: new Date()
// }]
// })
// obj.subList = data.subList
// items.push(obj)
// return items;
data.subList.forEach((item)=>{
item.subList = [{
fromLocationCode:item.fromLocationCode,
batch:item.batch,
handleQty:0,
qty:item.qty,
inventoryStatus:item.inventoryStatus,
toLocationCode:item.toLocationCode,
// packList:[{
// scaned : false,
// scanDate: new Date()
// }]
}]
})
items = data.subList
return items;
}
export function getDataSource(subList) {
let items = [];
subList.forEach(detail => {

7
src/mycomponents/qty/recommendQtyEdit.vue

@ -41,6 +41,13 @@
</view>
</view>
<view class='split_line'></view>
<view class="uni-flex uni-row space-between padding title u-col-center" >
<text>库存数量 : </text>
<view class="uni-flex uni-row uni-center" style="align-items: center;">
<text class="text_recommend">{{Number(dataContent.balanceQty)}}</text>
<uom :uom="dataContent.uom"></uom>
</view>
</view>
</view>
</view>
</view>

7
src/pages.json

@ -636,6 +636,13 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/issue/job/issueDetailBatch",
"style": {
"navigationBarTitleText": "发料任务详情",
"enablePullDownRefresh": false
}
},
{
"path": "pages/issue/job/issueJob0816",
"style": {

87
src/pages/issue/coms/comIssueDetailCardBatch.vue

@ -3,40 +3,30 @@
<!-- <requiredLocation title="需求库位" :locationCode="dataContent.toLocationCode"
:isShowEdit="dataContent.allowModifyLocation==1"></requiredLocation> -->
<view v-for="(item,index) in dataContent.Items">
<view>
<uni-collapse ref="collapse">
<uni-collapse-item :open="true">
<uni-collapse-item :open="true" :class="dataContent.scaned?'scan_view':''">
<template v-slot:title>
<view class="split_line"></view>
<!-- 物品 -->
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="itemCoceClick($event,item,index)"
:right-options="removeOptions">
<item-qty :dataContent="item" :handleQty="item.handleQty"></item-qty>
</uni-swipe-action-item>
</uni-swipe-action>
<!-- <com-issue-request-info :workShopCode="dataContent.workShopCode" :dataContent="dataContent">
</com-issue-request-info> -->
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty" :isShowBalanceQty='false'></item-qty>
</template>
<view v-for="(loacation,locatonIndex) in item.Locations">
<view v-if="locatonIndex ==0">
<view class="uni-flex uni-row space-between">
<!-- 推荐库位 -->
<location :locationCode="loacation.fromLocationCode">
</location>
<uni-swipe-action ref="swipeAction" style="margin-top: 10px;"
v-for="(item,index) in dataContent.subList">
<uni-swipe-action-item
:right-options="(item.scaned&&isEdit)?editAndRemoveOptions : item.scaned? removeOptions:options" @click="itemCoceClick($event,item,index)">
<view class="" :class="item.scaned?'scan_view':''">
<recommend :detail="item" :isShowLocation="false" :isShowFromLocation="true" :isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</view>
<view v-for="(batch,batchIndex) in loacation.Batchs">
<batch :batch="batch.detail.batch" v-if="batchIndex ==0"></batch>
</view>
</view>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
</uni-collapse-item>
</uni-collapse>
</view>
</view>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
<!-- <balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> -->
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm">
</recommend-qty-edit>
<detail-info-popup ref="detailInfoPopup"></detail-info-popup>
<comMessage ref="message"></comMessage>
</template>
@ -54,6 +44,7 @@
import detailInfoPopup from '@/pages/productionReceipt/coms/detailInfoPopup.vue'
import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue'
import batch from '@/mycomponents/balance/batch.vue'
import qtyEdit from '@/mycomponents/qty/qtyEdit.vue'
import {
getDetailOption,
getEditRemoveOption,
@ -73,17 +64,21 @@
location,
detailInfoPopup,
comIssueRequestInfo,
batch
batch,
},
props: {
dataContent: {
type: Object,
default: {}
type: Array,
default: []
},
settingParam: {
type: Object,
default: {}
},
isEdit: {
type: Boolean,
default: true
},
},
watch: {
@ -97,7 +92,8 @@
batchItem: {},
detailOptions: [],
scanOptions: [],
removeOptions: []
removeOptions: [],
editAndRemoveOptions:[]
}
},
@ -105,17 +101,18 @@
this.detailOptions = getDetailOption();
this.scanOptions = getEditRemoveOption();
this.removeOptions = getRemoveOption()
this.editAndRemoveOptions = getEditRemoveOption()
console.log(888,this.dataContent)
},
methods: {
resizeCollapse() {
this.$nextTick(r => {
this.$refs.collapse.forEach(r => {
r.childrens.forEach(i => {
this.$refs.collapse.resize()
this.$refs.collapse.childrens.forEach(i => {
i.init();
})
r.resize();
})
});
},
swipeClick(e, batch,
@ -132,18 +129,19 @@
},
itemCoceClick(e, item, index) {
if (e.content.text == "移除") {
this.dataContent.Items.splice(index, 1);
this.$emit('removeItemCode')
if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "移除") {
// this.dataContent.subList.splice(index, 1);
item.scaned = false
item.handleQty=0
this.$emit('updateData')
}
},
edit(batch, item) {
let that = this;
that.editItem = item;
that.batchItem = batch;
item.balance.balanceQty = item.balance.qty;
that.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty);
edit(item) {
this.editItem = item;
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
},
detail(item) {
@ -167,13 +165,8 @@
});
},
confirm(val) {
this.editItem.qty = val;
this.editItem.handleQty = Number(val);
this.$emit('updateData', this.editItem)
// let qty = 0;
// this.batchItem.Records.forEach(r => {
// qty += Number(r.qty);
// })
// this.batchItem.handleQty = qty;
}
}
}

16
src/pages/issue/job/issueDetail.vue

@ -15,18 +15,11 @@
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource">
<!-- <work-station :workshopCode="jobContent.workShopCode"
:productionLineCode="toLocation.productionLineCode"
:workStationCode="toLocation.workStationCode" :rawLocationCode="toLocation.toLocationCode">
</work-station> -->
<comIssueDetailCardBatch ref='comIssueDetailCard' :dataContent="toLocation" :settingParam="jobContent"
@updateData='updateData' v-if="managementType == 'BY_BATCH'">
</comIssueDetailCardBatch>
<com-issue-detail-card
ref='comIssueDetailCard'
:dataContent="toLocation"
:settingParam="jobContent"
@updateData='updateData' v-else>
@updateData='updateData'>
</com-issue-detail-card>
<view class="split_line"></view>
</view>
@ -46,7 +39,7 @@
<win-scan-button @goScan='openScanDetailPopup'></win-scan-button>
<com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'
@afterScan='afterScan' :locationCode='fromLocationCode'>
@afterScan='afterScan'>
</com-scan-issue-pack>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
@ -115,8 +108,7 @@
jobStatus: "",
scanMessage: '',
managementList: [],
managementType: "",
fromLocationCode:''
managementType: ""
};
},
@ -301,7 +293,7 @@
this.showErrorMessage("请扫描您需要提交的发料任务")
return
}
console.log("提交参数", params);
console.log("提交参数", JSON.stringify(params));
issueJobSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {

764
src/pages/issue/job/issueDetailBatch.vue

@ -0,0 +1,764 @@
<template>
<view class="page-wraper">
<view class="page-header">
<view class="header-view">
<view class="header_job_top">
<job-top :dataContent="jobContent"></job-top>
</view>
<work-station :workshopCode="jobContent.workShopCode"
:productionLineCode="jobContent.detailProductionLineCode"
:workStationCode="jobContent.detailWorkStationCode"
:rawLocationCode="jobContent.detailToLocationCode">
</work-station>
</view>
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource">
<comIssueDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent"
@updateData='updateData'>
</comIssueDetailCardBatch>
<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>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="autoCommit()">提交</button>
</view>
</view>
</view>
<win-scan-button @goScan='openScanPopup'></win-scan-button>
<!-- <com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'
@afterScan='afterScan' :locationCode='fromLocationCode'>
</com-scan-issue-pack> -->
<winScanPackAndLocation :balanceFromInventoryStatuses="false" :toLocationCode="jobToLocationCode" ref="scanPopup"
@getResult='getScanResult' :noShowBalanceMessage="false" @confirm='confirmFromLocation'>
</winScanPackAndLocation>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import {
takeIssueJob,
cancleTakeIssueJob,
getIssueJobDetail,
issueJobSubmit
} from '@/api/request2.js';
import {
goHome,
navigateBack,
getRemoveOption,
getCurrDateTime,
getDirectoryItemArray,
getPackingNumberAndBatch,
deepCopyData,
compareAsc,
} from '@/common/basic.js';
import {
getDataSource
} from '@/pages/issue/js/issue.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import {
calc
} from '@/common/calc.js';
import {
getTreeDataSource,
calcTreeHandleQty,
getScanCount,
getThreeDataSource
} from '@/common/detail.js';
import {
calcHandleQtyAdd
} from '@/common/record.js';
import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue'
import comIssueDetailCard from '@/pages/issue/coms/comIssueDetailCard.vue'
import comIssueDetailCardBatch from '@/pages/issue/coms/comIssueDetailCardBatch.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
import workStation from '@/mycomponents/workStation/workStation.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
export default {
name: 'issueDetail',
components: {
jobDetailPopup,
winScanButton,
comIssueDetailCard,
comScanIssuePack,
jobTop,
workStation,
balanceSelect,
comIssueDetailCardBatch,
winScanPackAndLocation
},
data() {
return {
id: '',
jobContent: {}, //
subList: [], //subList
detailSource: [], //
detailOptions: [],
scanOptions: [],
jobStatus: "",
scanMessage: '',
managementList: [],
managementType: "",
fromLocationCode:''
};
},
props: {
},
onLoad(option) {
uni.setNavigationBarTitle({
title: option.title + '详情'
});
this.id = option.id;
this.scanMessage = option.scanMessage || '';
if (this.id != undefined) {
//
if (option.status == "1") {
this.receive((callback => {
this.getDetail();
}));
} else {
this.getDetail();
}
}
},
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
//
onBackPress(e) {
//
if (e.from === 'backbutton') {
if (this.jobStatus == "2") {
//
cancleTakeIssueJob(this.id).then(res => {
uni.navigateBack();
}).catch(error => {
uni.navigateBack();
})
} else {
uni.navigateBack();
}
return true;
}
},
watch: {
locationTypes(newVal) {
let value = newVal;
},
},
mounted: function() {
// this.resizeCollapse();
},
methods: {
resizeCollapse() {
this.$nextTick(r => {
this.$refs.comIssueDetailCardBatch.forEach(r => {
r.resizeCollapse();
})
});
},
//
receive(callback) {
if (this.id != null) {
takeIssueJob(this.id).then(res => {
callback();
}).catch(error => {
this.showErrorMessage(error)
})
}
},
getDetail() {
var that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getIssueJobDetail(that.id).then(res => {
uni.hideLoading();
if (res.data == null) {
that.showMessage('未获取到详情');
} else {
if (res.data.subList.length > 0) {
that.jobContent = res.data;
that.jobStatus = res.data.status
that.subList = res.data.subList;
that.detailSource = getThreeDataSource(that.jobContent)
console.log(455,that.detailSource)
that.jobContent.detailToLocationCode = res.data.subList[0].toLocationCode
that.fromLocationCode = that.subList[0].fromLocationCode
//
if (this.scanMessage) {
this.openScanPopupSimulate(this.scanMessage);
}
setTimeout(r => {
that.resizeCollapse();
}, 100)
// that.detailSource.forEach(r => {
// r.subList.forEach(s => {
// if (this.scanedPackingNumber && this.scanedPackingNumber == s
// .packingNumber) {
// s.scaned = true
// s.cancleScanedHiht = true
// //
// this.openScanPopupSimulate(s);
// this.scanedPackingNumber = ''
// }
// })
// })
} else {
that.showMessage('列表数据为0');
}
}
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error)
})
},
closeScan() {
this.resizeCollapse();
},
getScanResult(result, managementTypeParams) {
console.log(222,result)
this.managementType = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
this.setDataBatch(result)
}else{
this.setData(result)
}
},
setDataBatch(result) {
try {
let that = this
this.balanceinfo = result.balance
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
var qty = result.label.qty;
var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode;
if (!result.balance) {
this.showMessage("没有库存余额")
return;
}
console.log(9558,result)
// var inventoryStatus = "OK";
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
var itemDetail = detail.subList.find(r => {
return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode
})
if (itemDetail == undefined) {
var isExit;
for (let subItem of detail.subList) {
var item;
// for (let pack of subItem.packList) {
// if (pack.batch == batch) {
// item = pack;
// isExit = pack;
// break;
// }
// }
// if (item != undefined) {
// subItem.scaned = true
// subItem.handleQty = 0;
// item = undefined
// }
}
if (isExit == undefined) {
// this.showErrorMessage("" + batch + "" + result
// .fromLocationCode + "")
detail.subList.push({
scaned:true,
fromLocationCode:this.fromLocationCode,
batch:result.label.batch,
handleQty:result.label.qty,
qty:result.balance.qty,
inventoryStatus:result.balance.inventoryStatus,
toLocation:result.balance.toLocation,
balance:result.balance,
balanceQty:result.balance.qty,
packQty:result.package.packQty,
packUnit:result.package.packUnit,
uom:result.balance.uom,
// packList:[{
// scaned : true,
// handleQty : Number(result.label.qty),
// toLocationCode : result.balance.toLocationCode,
// }]
})
console.log(999,detail)
detail.handleQty = 0
detail.qty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
detail.qty = calc.add(detail.qty,item.qty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
setTimeout(r => {
that.resizeCollapse();
that.$forceUpdate()
}, 100)
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
// this.showMessage("" + batch + "")
} else {
isExit.scaned = true
let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else {
qty = Number(result.label.qty);
}
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = this.toLocationCode;
}
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.balance = result.balance,
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{ // cur.handleQty = calc.add(detail.handleQty,item.handleQty) // })
})
// calcHandleQtyAdd(this.detailSource, result.label);
}
this.continueScan()
this.$forceUpdate()
} else {
var scanedLength = 0;
// itemDetail.packList.forEach(res => {
// if (res.scaned) {
// scanedLength++;
// }
// })
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (itemDetail.scaned ) {
// this.showMessage("" + packingNumber + "")
// calcHandleQtyAdd(this.detailSource, result.label);
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom,
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
})
} else {
itemDetail.scaned = true;
this.detailSource[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
itemDetail.scaned = true
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom
itemDetail.packQty=result.package.packQty
itemDetail.packUnit=result.package.packUnit
// itemDetail.toInventoryStatus = "OK"
// itemDetail.packList.forEach(pac => {
// pac.scaned = true
// pac.handleQty = Number(result.label.qty);
// pac.toLocationCode = result.balance.toLocationCode;
// })
detail.handleQty = 0
detail.subList.forEach(item=>{
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{ // cur.handleQty = calc.add(detail.handleQty,item.handleQty) // })
})
// calcTreeHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
}
}
}
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.packingNumber = ''
})
})
} catch (e) {
this.showMessage(e.message)
}
},
//
continueScan() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
} else {
this.scanPopupGetFocus();
}
},
submit() {
uni.showLoading({
title: "提交中....",
mask: true
});
//
var itemCodes = []
let locationCode = this.detailSource[0].toLocationCode
this.detailSource.forEach(toLocation => {
itemCodes.push(toLocation.itemCode)
})
//
getManagementPrecisions(itemCodes, locationCode, res => {
if (res.success) {
this.managementList = res.list;
this.submitJob();
} else {
uni.hideLoading();
this.showErrorMessage(res.message);
}
});
},
submitJob() {
var params = this.setParams()
// if (!params.subList || params.subList.length == 0) {
// uni.hideLoading()
// this.showErrorMessage("")
// return
// }
const isTrue = params.subList.some(item=>{
return item.recordList.some(cur=>cur.scaned) == true
})
if(!isTrue){
uni.hideLoading()
this.showErrorMessage("请扫描您需要提交的发料任务")
return
}
// return
console.log("提交参数", params);
issueJobSubmit(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)
})
},
setParams() {
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
console.log(2343,this.detailSource)
this.detailSource.forEach(toLocationCode => {
let obj = toLocationCode
obj.recordList = []
let obj1 ={}
let arr = toLocationCode.subList.filter(item=>item.scaned)
arr.forEach(record=>{
obj1.supplierCode = record.supplierCode;
obj1.batch = record.batch;
obj1.copyContent =record.copyContent;
obj1.fromInventoryStatus =record.fromInventoryStatus;
obj1.fromLocationCode =record.fromLocationCode;
obj1.handleQty =record.handleQty;
obj1.inventoryStatus =record.fromInventoryStatus;
obj1.packQty =record.packQty;
obj1.packUnit =record.packUnit;
obj1.packingNumber =record.packingNumber;
obj1.qty =record.qty;
obj1.scaned =record.scaned;
obj1.inventoryStatus =record.fromInventoryStatus;
obj1.inventoryStatus =record.fromInventoryStatus;
obj1.toLocationCode =record.toLocationCode;
let single_price = record.balance.singlePrice == null ? 0 : record.balance.singlePrice;
record.singlePrice = single_price;
record.amount = single_price *record.qty;
obj.recordList.push(obj1)
})
subList.push(obj)
})
this.jobContent.subList = subList
this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
return this.jobContent;
},
cancel() {
let that = this;
this.$refs.comMessage.showQuestionMessage('是否要清空已扫描的物料和目标库位信息?', res => {
if (res) {
that.clearInfo();
}
});
},
clearInfo() {
this.dataContent.itemCodeList.forEach(res => {
if (res.recommendList != null) {
res.recommendList.forEach(res1 => {
if (res1.locationCodeList != null) {
res1.locationCodeList.forEach(res2 => {
if (res2.packingCodeList != null) {
res2.packingCodeList.forEach(res3 => {
res3.itemCode = "";
res3.qty = 0;
})
}
})
}
})
}
})
},
updateData(record) {
this.detailSource.forEach(item=>{
item.handleQty = 0
item.subList.forEach(cur=>{
item.handleQty = calc.add(cur.handleQty,item.handleQty)
})
})
},
afterScan() {
this.resizeCollapse();
// this.autoCommit()
},
autoCommit(){
// this.$throttle(this.submit, 2000, this)()
let str=""
let str1=""
var totalQty =0;
var taskQty =0;
console.log(this.detailSource)
this.detailSource.forEach(detail => {
detail.subList.forEach(item => {
if(item.scaned){
taskQty =calc.add(taskQty,item.qty)
totalQty =calc.add(totalQty,item.handleQty)
if(item.handleQty<item.qty){
str += `批次【${item.batch}】提交数量【${item.handleQty}】与任务物料数量【${item.qty}】不一致\n`
}
if(item.handleQty>item.balance.qty){
str1 += `批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}`
}
}
})
})
if(str){
str = '任务明细未全部完成,是否提交?\n' + str
}
console.log(333,str1)
if(str1){
this.$refs.comMessage.showQuestionMessage1(str1, 'red', res => {
})
return
}
if(totalQty!=taskQty){
str ="扫描数量["+totalQty+"]与任务数量不一致["+taskQty+"],是否提交"
this.$refs.comMessage.showQuestionMessage1(str, 'red', res => {
if (res) {
//
this.$throttle(this.submit, 2000, this)()
} else {
// this.detailSource.forEach(detail => {
// detail.Items.forEach(item => {
// taskQty =calc.add(taskQty,item.qty)
// item.Locations.forEach(lco => {
// lco.Batchs.forEach(batch => {
// batch.Records = []
// })
// })
// })
// })
// this.$refs.comScanIssuePack.clearList()
this.scanPopupGetFocus()
}
});
}else {
//
this.$throttle(this.submit, 2000, this)()
}
},
scanPopupGetFocus() {
if (this.$refs.comScanIssuePack) {
this.$refs.comScanIssuePack.getfocus();
}
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
this.afterCloseMessage()
}
});
},
showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message);
},
showCommitSuccess() {
this.$refs.comMessage.showCommitSuccess();
},
showCommitSuccessMessage(hint) {
this.$refs.comMessage.showSuccessMessage(hint, res => {
navigateBack(1)
})
},
showRescanMessage(message) {
this.$refs.comMessage.showRescanMessage(message);
},
afterCloseMessage() {
this.scanPopupGetFocus();
},
closeScanMessage() {
this.scanPopupGetFocus();
},
confirm(data) {
this.dataContent = data;
},
confirmResult(result) {
this.dataContent = result;
this.$forceUpdate();
},
openScanPopup() {
let fromlocationCode = '';
let fromlocationList = [];
for (var i = 0; i < this.detailSource.length; i++) {
let item = this.detailSource[i];
item.subList.forEach(l => {
//
var location = fromlocationList.find(res => res == l.fromLocationCode)
if (location == undefined) {
fromlocationList.push(l.fromLocationCode);
}
//
if (fromlocationCode == '') {
if (!l.scaned) {
fromlocationCode = l.fromLocationCode;
}
}
})
}
this.$refs.scanPopup.openScanPopupForJob(fromlocationCode, fromlocationList, this.jobContent);
},
openScanPopupSimulate(scanMessage) {
this.$refs.comScanIssuePack.openScanPopupForJobSimulate(this.detailSource, this.jobContent, scanMessage);
},
closeScanPopup() {
// this.updateCommitBtn();
},
confirmFromLocation(fromLocationCodeParams){
this.fromLocationCode = fromLocationCodeParams
}
}
};
</script>
<style scoped lang="scss">
.uni-numbox__value {
width: 40px;
}
button[disabled] {
background-color: #3C9CFF;
color: #fff;
opacity: 0.7;
}
// /deep/ .input-value {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item__title-text {
// font-size: 16px;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 0px;
// border-bottom-color: #ebeef5;
// }
// /deep/ .uni-collapse-item--border {
// border-bottom-width: 1px;
// border-bottom-color: #ebeef5;
// }
</style>

38
src/pages/issue/job/issueJob.vue

@ -61,6 +61,11 @@
getDetailGiveupOption,
getDetailCloseOption
} from '@/common/array.js';
import {
getManagementPrecisions
} from '@/common/balance.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
@ -355,8 +360,7 @@
openJobDetail(item, scanMessage = '') {
this.getJobInfoByNumber(item.number, scanMessage)
this.getJobInfoByNumber(item, scanMessage)
},
showItemList(itemList) {
@ -433,7 +437,7 @@
})
},
getJobInfoByNumber(number, scanMessage) {
getJobInfoByNumber(item, scanMessage) {
let that = this;
uni.showLoading({
title: "加载中....",
@ -448,7 +452,7 @@
filters.push({
column: "number",
action: "==",
value: number
value: item.number
})
var params = {
@ -475,11 +479,27 @@
return;
}
uni.navigateTo({
url: './issueDetail?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' +
scanMessage + '&title=' + this.title
});
getManagementPrecisions([item.itemCode], item.fromLocationCode, res => {
if (res.success) {
this.managementList = res.list;
this.managementType = this.managementList&&this.managementList[0]&&this.managementList[0].ManagementPrecision
if(this.managementType == 'BY_BATCH'){
uni.navigateTo({
url: './issueDetailBatch?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' +
scanMessage + '&title=' + this.title
});
}else{
uni.navigateTo({
url: './issueDetail?id=' + result.masterId + '&status=' + result.status +
'&scanMessage=' +
scanMessage + '&title=' + this.title
});
}
}
})
this.scanMessage = ""
}
}).catch(error => {

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

@ -0,0 +1,171 @@
<template>
<view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1" @change="">
<uni-collapse-item :open="true">
<template v-slot:title>
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="removeData($event,dataContent)" :right-options="removeOptions">
<item-qty :dataContent="dataContent" :handleQty="dataContent.handleQty"
:isShowBalance="true"></item-qty>
</uni-swipe-action-item>
</uni-swipe-action>
</template>
<view class='split_line'></view>
<view class="" v-for="(item,index) in dataContent.subList">
<uni-swipe-action ref="swipeAction">
<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>
<!-- <production-label :dataContent="item" :packageContent="item.package"
:isShowLocation="false">
</production-label> -->
</uni-swipe-action-item>
</uni-swipe-action>
</view>
</uni-collapse-item>
</uni-collapse>
<!-- <recommend-qty-edit ref="recommendQtyEdit" :dataContent="editItem" :handleQty="editItem.qty" @confirm="confirm" :isShowStatus="isShowStatus"></recommend-qty-edit> -->
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" ></balance-qty-edit>
<package-detail-popup ref='packageDetailPopup'>
</package-detail-popup>
<comMessage ref="comMessage"></comMessage>
</view>
</template>
<script>
import itemQty from '@/mycomponents/item/itemQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import productionLabel from '@/mycomponents/balance/productionLabel.vue'
import record from '@/mycomponents/record/record.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import packageDetailPopup from '@/mycomponents/package/packageDetailPopup.vue'
import balance from '@/mycomponents/balance/balance.vue'
import {
getDetailOption,
getDetailEditRemoveOption,
getClearOption
} from '@/common/array.js';
export default {
components: {
itemQty,
recommend,
packageDetailPopup,
productionLabel,
recommendQtyEdit,
record,
balance,
balanceQtyEdit
},
props: {
dataContent: {
type: Object,
default: {}
},
settingParam: {
type: Object,
default: {}
},
fromInventoryStatus: {
type: String,
default: ""
},
toInventoryStatus: {
type: String,
default: ""
},
isShowStatus: {
type: Boolean,
default: false
}
},
watch: {
dataContent: {
handler(newName, oldName) {
if (this.dataContent.subList.length > 0) {
if (this.$refs.collapse1 != undefined) {
this.$nextTick(res => {
this.$refs.collapse1.resize()
})
}
}
},
immediate: true,
deep: true
}
},
data() {
return {
option: [],
title: "推荐详情",
showItem: {},
editItem: {},
detailOptions: [],
scanOptions: [],
removeOptions: [],
dataList: []
}
},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getDetailEditRemoveOption();
this.removeOptions = getClearOption();
},
methods: {
removeData(e, dataContent) {
if (e.content.text == "清空") {
this.$refs.comMessage.showQuestionMessage("确定清空物料及箱码信息?",
res => {
if (res) {
this.$emit('removeItem')
// this.$emit('removeItem', this.dataContent)
}
});
}
},
swipeClick(e, item, index) {
if (e.content.text == "详情") {
this.detail(item.package)
} else if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "移除") {
this.remove(item, index)
}
},
edit(item) {
this.editItem = item;
this.$refs.balanceQtyEdit.openEditPopup(this.editItem, this.editItem.handleQty);
// this.$refs.recommendQtyEdit.openEditPopup(item.qty);
},
detail(packageInfo) {
this.showItem = packageInfo;
this.$refs.packageDetailPopup.openPopup(packageInfo)
},
remove(item, index) {
this.$refs.comMessage.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
this.dataContent.subList.splice(index, 1)
this.$emit('removePack')
}
});
},
confirm(qty) {
this.editItem.handleQty = qty;
this.$emit('updateData')
}
}
}
</script>
<style>
</style>

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

@ -8,8 +8,11 @@
<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">
@updateData="updateData" @removePack="removePack" v-else>
</com-product-record>
</view>
<view class='split_line'></view>
@ -42,6 +45,12 @@
</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>
@ -79,14 +88,20 @@
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 {
@ -108,6 +123,7 @@
workShopName: "",
productionLineName: "",
workStationName: "",
managementType:''
};
},
onLoad(option) {
@ -142,7 +158,53 @@
mounted() {},
methods: {
getScanResult(result) {
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) {
let label = result.label;
let pack = result.package;
@ -218,14 +280,40 @@
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.$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();
})
},
commit() {
if (this.positionInfo == "请选择位置") {
this.showMessage("请先选择位置")
@ -240,12 +328,21 @@
});
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))
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
productionReceiptRecordSubmit(params).then(res => {
uni.hideLoading()
if (res.data) {
@ -379,7 +476,14 @@
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();
},

Loading…
Cancel
Save