From 1ad14f5a3e1f4a86e8f6bde8d80a65aae8a05d6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=BF=97=E5=9B=BD?= <854933521@qq.com>
Date: Mon, 4 Nov 2024 13:30:20 +0800
Subject: [PATCH] =?UTF-8?q?page/repleinsh/job=20=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E8=BF=81=E7=A7=BB=208/8-10/25?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/pages/repleinsh/job/repleinshDetail.vue | 70 ++-
.../repleinsh/job/repleinshDetailBatch.vue | 514 ++++++++++++++++++
src/pages/repleinsh/job/repleinshJob.vue | 351 ++++++------
3 files changed, 741 insertions(+), 194 deletions(-)
create mode 100644 src/pages/repleinsh/job/repleinshDetailBatch.vue
diff --git a/src/pages/repleinsh/job/repleinshDetail.vue b/src/pages/repleinsh/job/repleinshDetail.vue
index 7ec42dd0..401d6789 100644
--- a/src/pages/repleinsh/job/repleinshDetail.vue
+++ b/src/pages/repleinsh/job/repleinshDetail.vue
@@ -23,7 +23,7 @@
-
+
@@ -151,7 +151,7 @@ const receive = (callback) => {
const getDetail = () => {
proxy.$modal.loading('加载中....')
getRepleinshJobDetail(id.value)
- .then((res) => {
+ .then(async (res) => {
uni.hideLoading()
if (res.data == null) {
showMessage('未获取到详情')
@@ -162,7 +162,7 @@ const getDetail = () => {
toLocationCode.value = subList.value[0].toLocationCode
console.log(`库位${toLocationCode.value}`)
toLocationAreaTypeList.value = getDirectoryItemArray(jobContent.value.toAreaTypes)
- detailSource.value = getDataSource(detailSource.value, subList.value)
+ detailSource.value = await getDataSource(detailSource.value, subList.value)
if (scanMessage.value) {
comScanIssuePackRef.value.openScanPopupForJobSimulate(detailSource.value, jobContent.value, scanMessage.value)
}
@@ -193,7 +193,56 @@ const resizeCollapse = () => {
})
})
}
+const clickSubmit = () => {
+ let str = ""
+ var totalQty = 0;
+ var taskQty = 0;
+ detailSource.value.forEach(detail => {
+ detail.Items.forEach(item => {
+ taskQty = calc.add(taskQty, item.qty)
+ item.Locations.forEach(lco => {
+ lco.Batchs.forEach(batch => {
+ batch.Records.forEach(record => {
+ if (batch.qty != record.qty) {
+ let tempHandleQty = 0
+ if (record.qty) {
+ tempHandleQty = record.qty
+ } else {
+ tempHandleQty = 0
+ }
+ if (batch.qty != 0) {
+ str +=
+ `包装号【${record.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${batch.qty}】不一致\n`
+ }
+ }
+ if (record) {
+ let hanleQty = record.qty ? record.qty : 0
+ totalQty = calc.add(totalQty, hanleQty)
+ }
+ })
+ })
+ })
+ })
+ })
+ if (str) {
+ str = '任务明细未全部完成,是否提交?\n' + str
+ }
+ if (totalQty != taskQty) {
+ str = "扫描数量[" + totalQty + "]与任务数量不一致[" + taskQty + "],是否提交"
+ comMessageRef.value.showQuestionMessage1(str, 'red', res => {
+ if (res) {
+ //防止重复点击
+ proxy.$throttle(submitJob, 2000, proxy)()
+ } else {
+ this.scanPopupGetFocus()
+ }
+ });
+ } else {
+ //防止重复点击
+ proxy.$throttle(submitJob, 2000, proxy)()
+ }
+}
const submit = () => {
const scanCount = getScanCount(subList.value)
@@ -240,12 +289,23 @@ const setSubmitParamsAndSubmit = () => {
const submitJob = () => {
proxy.$modal.loading('提交中....')
+ let itemCodes = []
+ detailSource.value.forEach(item => {
+ item.Items.forEach(cur=>{
+ itemCodes.push(cur.itemCode)
+ })
+ })
const params = setParams()
+ if (!params.subList || params.subList.length == 0) {
+ uni.hideLoading()
+ showErrorMessage("请扫描您需要提交的补料任务")
+ return
+ }
repleinshJobSubmit(params)
.then((res) => {
uni.hideLoading()
if (res.data) {
- showCommitSuccessMessage(`提交成功
生成补料记录
${res.data}`)
+ showCommitSuccessMessage(`提交成功\n生成补料记录\n${res.data}`)
} else {
showErrorMessage(`提交失败[${res.msg}]`)
}
@@ -273,8 +333,6 @@ const setParams = () => {
const record = {}
record.handleQty = r.qty
- // record.fromPackingNumber = r
- // .packingNumber;
record.fromBatch = r.batch
record.fromContainerNumber = r.containerNumber
diff --git a/src/pages/repleinsh/job/repleinshDetailBatch.vue b/src/pages/repleinsh/job/repleinshDetailBatch.vue
new file mode 100644
index 00000000..d66925c6
--- /dev/null
+++ b/src/pages/repleinsh/job/repleinshDetailBatch.vue
@@ -0,0 +1,514 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/repleinsh/job/repleinshJob.vue b/src/pages/repleinsh/job/repleinshJob.vue
index 3c750401..765baf5e 100644
--- a/src/pages/repleinsh/job/repleinshJob.vue
+++ b/src/pages/repleinsh/job/repleinshJob.vue
@@ -1,11 +1,10 @@
-
+
@@ -30,9 +29,9 @@ import {getRepleinshJobList, cancleTakeRepleinshJob, closeTakeRepleinshJob, getI
import { goHome, updateTitle } from '@/common/basic.js'
import { getDetailOption, getDetailGiveupOption, getDetailCloseOption } from '@/common/array.js'
-import {
- getBusinessType
-} from '@/common/record.js';
+import {planRefreshTime, repleinshJobFilter} from '@/common/config.js';
+import {getManagementPrecisions} from '@/common/balance.js';
+import {getBusinessType} from '@/common/record.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
@@ -77,9 +76,15 @@ const productionLineCode = ref('')
const productionlineList = ref([])
const fromLocationCode = ref('')
const filterItemCode = ref('')
+const timer = ref(null)
+const managementList = ref([])
+const managementType = ref('')
+const fromInventoryStatuses = ref('')
+const fromLocationAreaTypeList = ref([])
+
onShow(() => {
nextTick(() => {
- getList('refresh',fromLocationCode.value, filterItemCode.value)
+ getList('refresh')
})
})
onLoad((option) => {
@@ -96,10 +101,10 @@ onReachBottom(() => {
if (loadingType.value == 'loading' || loadingType.value == 'nomore') {
return
}
- getList('more',fromLocationCode.value,filterItemCode.value)
+ getList('more')
})
onPullDownRefresh(() => {
- getList('refresh',fromLocationCode.value,filterItemCode.value)
+ getList('refresh')
})
// 后退按钮
onBackPress((options) => {
@@ -115,54 +120,92 @@ onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome()
} else if (e.index == 1) {
- filter.value.openFilter()
+ filter.value.openFilterParams(uni.getStorageSync(repleinshJobFilter))
}
})
-const getList = (type, fromLocationCode = '', filterItemCode = '') => {
- proxy.$modal.loading('加载中....')
- loadingType.value = 'loading'
- if (type === 'refresh') {
- pageNo.value = 1
- jobList.value = []
+const timerRefresh = ()=> {
+ getList('refresh')
+ stopRefresh();
+ timer.value = setInterval(function() {
+ getList('refresh')
+ }, planRefreshTime)
+}
+const stopRefresh = ()=> {
+ if (timer.value) {
+ clearInterval(timer.value);
+ timer.value = null;
}
+}
+const setQueryParam = ()=> {
+ let filterParams = []
+ const queryParams = uni.getStorageSync(repleinshJobFilter)
- const filters = []
- if (checkedToday.value) {
- filters.push({
- column: 'create_time',
- action: 'betweeen',
- value: todayTime.value
+ //只看当天
+ if (queryParams.creationTime ) {
+ filterParams.push({
+ column: "create_time",
+ action: "betweeen",
+ value: queryParams.creationTime
})
}
-
- filters.push({
- column: 'status',
- action: 'in',
- value: status.value
- })
- filters.push({
- column: 'accept_user_id',
- action: '==',
- value: store.id
- })
- if (fromLocationCode != '') {
- // 来源库位
- filters.push({
- column: 'fromLocationCode',
- action: '==',
- value: fromLocationCode
+ //只看待处理
+ if (queryParams.status) {
+ filterParams.push({
+ column: "status",
+ action: "in",
+ value: queryParams.status
+ })
+ }else {
+ filterParams.push({
+ column: "status",
+ action: "in",
+ value: "1,2"
+ })
+ }
+ // 来源库位
+ if (queryParams.fromLocationCode) {
+ filterParams.push({
+ column: "fromLocationCode",
+ action: "==",
+ value: queryParams.fromLocationCode
})
}
- if (filterItemCode != '') {
- // 物料代码
- filters.push({
+ //物料代码
+ if (queryParams.itemCode) {
+ filterParams.push({
column: "itemCode",
action: "like",
- value: filterItemCode
+ value: queryParams.itemCode
})
}
+ //来源库区
+ if (queryParams.fromAreaCode) {
+ filterParams.push({
+ column: "fromAreaCode",
+ action: "==",
+ value: queryParams.fromAreaCode
+ })
+ }
+ //到库区
+ if (queryParams.toAreaCode) {
+ filterParams.push({
+ column: "toAreaCode",
+ action: "==",
+ value: queryParams.toAreaCode
+ })
+ }
+ return filterParams;
+}
+const getList = (type, fromLocationCode = '', filterItemCode = '') => {
+ proxy.$modal.loading('加载中....')
+ loadingType.value = 'loading'
+ if (type === 'refresh') {
+ pageNo.value = 1
+ jobList.value = []
+ }
+ const queryFiltersParams = setQueryParam()
const params = {
- filters,
+ filters:queryFiltersParams,
pageNo: pageNo.value,
pageSize: pageSize.value,
// sort: 'number',
@@ -193,7 +236,7 @@ const getList = (type, fromLocationCode = '', filterItemCode = '') => {
loadingType.value = ''
updateTitle(title.value)
uni.hideLoading()
- showErrorMessage(error)
+ showMessage(error)
})
}
const fromLocationCodeQuery = (fromLocationCode) => {
@@ -202,8 +245,68 @@ const fromLocationCodeQuery = (fromLocationCode) => {
getList('refresh', fromLocationCode.value, filterItemCode.value)
}
const openJobDetail = (item, scanMessageParams = '') => {
- proxy.$tab.navigateTo(`./repleinshDetail?id=${item.masterId}&status=${item.status}&scanMessage=${scanMessage.value}&title=${title.value}`)
- scanMessage.value = ''
+ getJobInfoByNumber(item.number,scanMessageParams, item)
+}
+const getJobInfoByNumber = (number,scanMessage, item)=> {
+ proxy.$modal.loading('加载中....')
+ let filters = []
+ filters.push({
+ column: "status",
+ action: "in",
+ value: '1,2'
+ })
+ filters.push({
+ column: "number",
+ action: "==",
+ value: number
+ })
+
+ const params = {
+ filters: filters,
+ pageNo: 1,
+ pageSize: pageSize.value,
+ }
+ getRepleinshJobList(params).then(res => {
+ uni.hideLoading();
+ if (res.data.list.length == 0) {
+ showMessage('未查找到' + '【' + number + '】的发料任务');
+ } else {
+ let result = res.data.list[0];
+ if(result.acceptUserId&&result.acceptUserId!=store.id){
+ comMessageRef.value.showErrorMessage("任务号["+result.number+"]已经被["+result.acceptUserName+"]承接,无法执行", res => {
+ if (res) {
+ scanPopup.value?.getfocus()
+ getList('refresh')
+ }
+ });
+ return;
+ }
+ getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => {
+ if (ret.success) {
+ managementList.value = ret.list;
+ managementType.value = managementList.value.some(cur => cur.ManagementPrecision == 'BY_BATCH') ?
+ 'BY_BATCH' : ''
+ if (managementType.value == 'BY_BATCH') {
+ uni.navigateTo({
+ url: './repleinshDetailBatch?id=' + result.masterId + '&status=' + result.status +
+ '&scanMessage=' +
+ scanMessage + '&title=' + title.value
+ });
+ } else {
+ uni.navigateTo({
+ url: './repleinshDetail?id=' + result.masterId + '&status=' + result.status +
+ '&scanMessage=' +
+ scanMessage + '&title=' + title.value
+ });
+ }
+ }
+ })
+ scanMessage.value = ""
+ }
+ }).catch(error => {
+ uni.hideLoading();
+ showMessage(error);
+ })
}
const selectedItem = (item) => {
openJobDetail(item)
@@ -278,59 +381,7 @@ const closeJob = (id) => {
showMessage(error)
})
}
-const switchChangeToday = (state, creationTime) => {
- checkedToday.value = state
- todayTime.value = creationTime
- getList('refresh')
-}
-const switchChangeWait = (state, jobStatus) => {
- checkedWaitTask.value = state;
- waitTask.value = state
- status.value = jobStatus
- getList('refresh')
-}
-const getScanNumber = (code) => {
- getDataListByType(code)
-}
-const getDataListByType = (code) => {
- proxy.$modal.loading('加载中....')
- const filters = []
- filters.push({
- column: 'status',
- action: 'in',
- value: '1,2'
- })
- filters.push({
- column: 'number',
- action: '==',
- value: code
- })
- filters.push({
- column: 'accept_user_id',
- action: '==',
- value: store.id
- })
- const params = {
- filters,
- pageNo: 1,
- pageSize: 100,
- sort: 'number',
- by: 'desc'
- }
- getRepleinshJobList(params)
- .then((res) => {
- uni.hideLoading()
- if (res.data.list.length == 0) {
- showMessage('未查找到' + `【${code}】的补料任务`)
- } else {
- openJobDetail(res.data.list[0])
- }
- })
- .catch((error) => {
- uni.hideLoading()
- showMessage(error)
- })
-}
+
const showMessage = (message) => {
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
@@ -345,79 +396,8 @@ const openScanPopup = () => {
}
}
const getListByFilter = ( param )=>{
- uni.showLoading({
- title: "加载中....",
- mask: true
- });
- let filters = []
- if (checkedToday.value) {
- filters.push({
- column: "create_time",
- action: "betweeen",
- value: todayTime.value
- })
- }
-
- filters.push({
- column: "status",
- action: "in",
- value: status.value
- })
-
- filters.push({
- column: "accept_user_id",
- action: "==",
- value:store.id
- })
-
- if (param.fromLocationCode) {
- // 来源库位
- fromLocationCode.value = param.fromLocationCode
- filters.push({
- column: "fromLocationCode",
- action: "==",
- value: param.fromLocationCode
- })
- }else{
- fromLocationCode.value = ''
- }
- // if (param.productionLine) {
- // // 生产线
- // filters.push({
- // column: "productionLineCode",
- // action: "==",
- // value: param.productionLine
- // })
- // }
- if (param.itemCode) {
- // 物料代码
- filterItemCode.value = param.itemCode
- filters.push({
- column: "itemCode",
- action: "like",
- value: param.itemCode
- })
- }else{
- filterItemCode.value = ''
- }
- let params = {
- filters: filters,
- pageNo: 1,
- pageSize: 100,
- }
- getList('refresh', fromLocationCode.value, filterItemCode.value)
- // getIssueJobList(params).then(res => {
- // uni.hideLoading();
- // if (res.data.total == 0) {
- // showMessage('未查找到补料任务');
- // } else if (res.data.total == 1) {
- // openJobDetail(res.data.list[0]);
- // } else {
- // showItemList(res.data.list);
- // }
- // }).catch(error => {
- // showMessage(error)
- // })
+ uni.setStorageSync(repleinshJobFilter,params)
+ getList('refresh')
}
const selectItem = (item) => {
scanPopup.value.closeScanPopup()
@@ -460,11 +440,6 @@ const getScanResult = (result) => {
action: '==',
value: result.label.itemCode
},
- {
- column: 'accept_user_id',
- action: '==',
- value: store.id
- },
{
column: "fromLocationCode",
action: "==",
@@ -496,11 +471,11 @@ const getScanResult = (result) => {
selectItem(list[0])
}
} else {
- showMessage(`按来源库位[${balance.locationCode}]批次[${result.label.batch}]物料号[${result.label.itemCode}]未查找到任务
` + `扫描[${result.scanMessage}]`)
+ showMessage(`按来源库位[${balance.locationCode}]批次[${result.label.batch}]物料号[${result.label.itemCode}]未查找到任务\n` + `扫描[${result.scanMessage}]`)
}
})
.catch((error) => {
- showMessage(`${error}
扫描[${result.scanMessage}]`)
+ showMessage(`${error}\n扫描[${result.scanMessage}]`)
})
} catch (e) {
showMessage(e.message)
@@ -508,17 +483,17 @@ const getScanResult = (result) => {
}
}
const getBusinessTypeFunc = ()=> {
- getBusinessType(this.businessTypeCode, res => {
+ getBusinessType(businessTypeCode.value, res => {
if (res.success) {
- this.businessType = res.businessType;
- this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses).split(',');
- this.fromLocationAreaTypeList = res.fromLocationAreaTypeList
- // this.openScanPopup();
+ businessType.value = res.businessType;
+ fromInventoryStatuses.value = res.fromInventoryStatuses.split(',');
+ fromLocationAreaTypeList.value = res.fromLocationAreaTypeList
} else {
- this.showErrorMessage(res.message)
+ showMessage(res.message)
}
});
}
+