Browse Source

修改三方库

pda_nev
李俊城 11 months ago
parent
commit
79ce07c863
  1. 22
      fe/PDA/api/index.js
  2. 19
      fe/PDA/common/basic.js
  3. 17
      fe/PDA/common/calc.js
  4. 13
      fe/PDA/mycomponents/comjob/comJobScanDetail.vue
  5. 8
      fe/PDA/pages/task/thirdLocationJob.vue
  6. 112
      fe/PDA/pages/task/thirdLocationJobDetail.vue

22
fe/PDA/api/index.js

@ -1521,7 +1521,7 @@ export const getThirdLocationRequestDetail = (id) => request(
}); });
//三方库发料申请 完成 //三方库发料申请 完成
export const thirdLocationRequestFinish = (id) => promise( export const thirdLocationRequestFinish = (id) => request(
devUrl + "/api/pda/store/third-location-request/complete/"+id, { devUrl + "/api/pda/store/third-location-request/complete/"+id, {
method: 'post', method: 'post',
data: {} data: {}
@ -1529,14 +1529,14 @@ export const thirdLocationRequestFinish = (id) => promise(
//三方库发料申请 取消 //三方库发料申请 取消
export const thirdLocationRequestCancel = (id) => promise( export const thirdLocationRequestCancel = (id) => request(
devUrl + "/api/pda/store/third-location-request/cancel/"+id, { devUrl + "/api/pda/store/third-location-request/cancel/"+id, {
method: 'post', method: 'post',
data: {} data: {}
}) })
//三方库发料申请 终止 //三方库发料任务 终止
export const thirdLocationRequestClose = (id) => promise( export const thirdLocationRequestComplete = (id) => request(
devUrl + "/api/pda/job/third-location/close-job/"+id, { devUrl + "/api/pda/job/third-location/Complete/"+id, {
method: 'post', method: 'post',
data: {} data: {}
}) })
@ -1548,14 +1548,6 @@ export const getThirdLocationList = (params) => request(
data: params data: params
}); });
export const getThirdLocationList1 = (params) => request(
devUrl + "/api/pda/job/third-location/list", {
method: 'post',
data: {"condition":{"filters":[]},"Sorting":"","SkipCount":0,"MaxResultCount":20}
});
//根据Number 获取三方库收货任务 //根据Number 获取三方库收货任务
export const getThirdLocationJobByNumber = (number) => request( export const getThirdLocationJobByNumber = (number) => request(
@ -1579,8 +1571,8 @@ export const cancelTakeThirdLocationJob = (id) => request(
}); });
//提交三方库收货任务 //提交三方库收货任务
export const finshThirdLocationJob = (id, params) => request( export const finshThirdLocationJob = (params) => request(
devUrl + "/api/pda/job/third-location/finish/" + id, { // devUrl + "/api/pda/job/third-location/ExecuteDetail", { //
data: params, data: params,
method: "post" method: "post"
}) })

19
fe/PDA/common/basic.js

@ -432,4 +432,23 @@ export function navigateBack(backIndex) {
} else { } else {
history.back(); history.back();
} }
}
/**
* 深度克隆对象
* @param {*} target
*/
export function deepCopyData(target) {
// 克隆原始类型和null
if (!(target !== null && (typeof target === 'object' || typeof target === 'function'))) {
return target;
}
let cloneTarget = Array.isArray(target) ? [] : {};
// 克隆对象和数组
for (const key in target) {
cloneTarget[key] = deepCopyData(target[key]);
}
return cloneTarget;
} }

17
fe/PDA/common/calc.js

@ -0,0 +1,17 @@
/* 解决js计算精度问题 */
import { Decimal } from 'decimal.js';//引入
class Calc {
add(num1,num2) {
return new Decimal(num1).add(new Decimal(num2)).toNumber()
}
sub(num1,num2) {
return new Decimal(num1).sub(new Decimal(num2)).toNumber()
}
mul(num1,num2) {
return new Decimal(num1).mul(new Decimal(num2)).toNumber()
}
div(num1,num2) {
return new Decimal(num1).div(new Decimal(num2)).toNumber()
}
}
export const calc = new Calc();

13
fe/PDA/mycomponents/comjob/comJobScanDetail.vue

@ -20,7 +20,7 @@
<view class="cell_info" v-if="isShowOther"> <view class="cell_info" v-if="isShowOther">
<view class="text_lightblue">{{showOther}}</view> <view class="text_lightblue">{{showOther}}</view>
<view class="text_black text_bold">{{ allCount-scanCount}}</view> <view class="text_black text_bold">{{calcCount(allCount,scanCount)}}</view>
</view> </view>
<view class="cell_info" v-if="isShowShouRong"> <view class="cell_info" v-if="isShowShouRong">
<view class="text_lightblue">收容数</view> <view class="text_lightblue">收容数</view>
@ -35,6 +35,9 @@
getJobStatuStyle, getJobStatuStyle,
getJobStatuDesc, getJobStatuDesc,
} from '@/common/basic.js'; } from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import comJobTopInfo from '@/mycomponents/comjob/comJobTopInfo.vue' import comJobTopInfo from '@/mycomponents/comjob/comJobTopInfo.vue'
export default { export default {
@ -97,12 +100,16 @@
}, },
statusColor: function(val) { statusColor: function(val) {
return getJobStatuDesc(val); return getJobStatuDesc(val);
}, }
}, },
mounted() { mounted() {
}, },
methods: {} methods: {
calcCount(a,b){
return calc.sub(a,b)
}
}
} }
</script> </script>

8
fe/PDA/pages/task/thirdLocationJob.vue

@ -16,9 +16,9 @@
<script> <script>
import { import {
getThirdLocationList1, getThirdLocationList,
getThirdLocationJobByNumber, getThirdLocationJobByNumber,
thirdLocationRequestClose thirdLocationRequestComplete
} from '@/api/index.js'; } from '@/api/index.js';
import { import {
@ -99,7 +99,7 @@
title: "加载中", title: "加载中",
mask: true mask: true
}) })
thirdLocationRequestClose(item.id).then(res => { thirdLocationRequestComplete(item.id).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.error) { if (res.error) {
this.showMessage(res.error.message) this.showMessage(res.error.message)
@ -150,7 +150,7 @@
// isCreationTimeSorting: that.isTimeWindowSorting, // isCreationTimeSorting: that.isTimeWindowSorting,
// isToday: that.isToday // isToday: that.isToday
}; };
getThirdLocationList1(params) getThirdLocationList(params)
.then(res => { .then(res => {
uni.hideLoading(); uni.hideLoading();
if (type === "refresh") { if (type === "refresh") {

112
fe/PDA/pages/task/thirdLocationJobDetail.vue

@ -3,9 +3,12 @@
<view class=""> <view class="">
<view class="top_card"> <view class="top_card">
<com-job-scan-detail :jobContent="datacontent" :allCount="allCount" :scanCount="scanCount" scanHint="已收数量" <com-job-scan-detail :jobContent="datacontent" :allCount="allCount" :scanCount="scanCount" scanHint="已收数量"
:isShowOther="true" showOther="未发数量"> :isShowOther="true" showOther="未收数量" >
</com-job-scan-detail> </com-job-scan-detail>
</view> </view>
<view class="" style="background-color: #fff; padding: 20rpx; font-size: 32rpx;">
承接人 :{{datacontent.claimsUserName}}
</view>
<button v-if="showFinishButton" type="primary" @click="finish" style="margin: 20rpx;"> 任务终止</button> <button v-if="showFinishButton" type="primary" @click="finish" style="margin: 20rpx;"> 任务终止</button>
<scroll-view scroll-y="true" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" <scroll-view scroll-y="true" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll"
@ -22,6 +25,11 @@
<view class="font_xs text_lightblue">{{ item.itemDesc1 }}</view> <view class="font_xs text_lightblue">{{ item.itemDesc1 }}</view>
</view> </view>
</view> </view>
<view class="" style="margin-left: 20rpx; font-size: 35rpx;">
<view>未收数量 : {{item.notFinishQty }}</view>
<view>已收数量 : {{item.receivedQty}}</view>
<view>需求数量 : {{item.issuedQty}}</view>
</view>
<view class="list_form hold_form"> <view class="list_form hold_form">
<view class="uni-container"> <view class="uni-container">
<uni-table style="overflow-x: hidden;"> <uni-table style="overflow-x: hidden;">
@ -88,7 +96,7 @@
<win-collapse-location scanTitle='扫描目标库位' ref='comCollapseLocation' @getLocationCode='getDefaultToLocation' <win-collapse-location scanTitle='扫描目标库位' ref='comCollapseLocation' @getLocationCode='getDefaultToLocation'
@clear='clearDefaultLocation'> @clear='clearDefaultLocation'>
</win-collapse-location> </win-collapse-location>
<view class="new_btn_bot bot_pos uni-flex"> <view class="new_btn_bot bot_pos uni-flex" v-if="showBtn">
<button class="new_clear_btn btn_double" @click="cancel()">清空</button> <button class="new_clear_btn btn_double" @click="cancel()">清空</button>
<button class="new_save_btn btn_double" @click="submit()">提交</button> <button class="new_save_btn btn_double" @click="submit()">提交</button>
</view> </view>
@ -106,13 +114,18 @@
cancelTakeThirdLocationJob, cancelTakeThirdLocationJob,
finshThirdLocationJob, finshThirdLocationJob,
locations, locations,
thirdLocationRequestClose thirdLocationRequestComplete
} from '@/api/index.js'; } from '@/api/index.js';
import { import {
showConfirmMsg, showConfirmMsg,
goHome, goHome,
navigateBack navigateBack,
deepCopyData
} from '@/common/basic.js'; } from '@/common/basic.js';
import {
calc
} from '@/common/calc.js';
import winScanButton from '@/mycomponents/wincom/winScanButton.vue' import winScanButton from '@/mycomponents/wincom/winScanButton.vue'
import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue' import winMulitScan from '@/mycomponents/wincom/winMulitScan.vue'
import winScanByPack from '@/mycomponents/wincom/winScanByPack.vue' import winScanByPack from '@/mycomponents/wincom/winScanByPack.vue'
@ -155,22 +168,22 @@
scanCount: 0, scanCount: 0,
jobStatus: "", jobStatus: "",
toLocationInfo: null, toLocationInfo: null,
showFinishButton: false showFinishButton: false,
showBtn: true,
} }
}, },
onLoad(param) { onLoad(param) {
this.id = param.id; this.id = param.id;
if (param.jobStatus == 1) { this.getDetail();
this.receive((callback => {
this.getDetail();
}));
} else {
this.getDetail();
}
}, },
// //
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {
if (e.index === 0) { if (e.index === 0) {
if (this.datacontent.isClaims && this.datacontent.claimsUserId == localStorage.getItem('userId')) {
cancelTakeThirdLocationJob(this.id).then(res => {}).catch(error => {})
}
goHome(); goHome();
} else if (e.index === 1) { } else if (e.index === 1) {
window.location.reload(); window.location.reload();
@ -180,7 +193,7 @@
onBackPress(e) { onBackPress(e) {
// //
if (e.from == 'backbutton') { if (e.from == 'backbutton') {
if (this.jobStatus == 2) { if (this.datacontent.isClaims && this.datacontent.claimsUserId == localStorage.getItem('userId')) {
// //
cancelTakeThirdLocationJob(this.id).then(res => { cancelTakeThirdLocationJob(this.id).then(res => {
uni.navigateBack(); uni.navigateBack();
@ -190,6 +203,7 @@
} else { } else {
uni.navigateBack(); uni.navigateBack();
} }
return true; return true;
} }
}, },
@ -232,7 +246,7 @@
title: "加载中", title: "加载中",
mask: true mask: true
}) })
thirdLocationRequestClose(this.id).then(res => { thirdLocationRequestComplete(this.id).then(res => {
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: "终止成功" title: "终止成功"
@ -286,7 +300,7 @@
that.allCount = 0; that.allCount = 0;
that.details.forEach(res => { that.details.forEach(res => {
res.scaned = false; res.scaned = false;
that.allCount = that.allCount + res.recommendQty + res.handledQty that.allCount = that.allCount + res.issuedQty;
}) })
that.ispending = item.jobStatus === 2; that.ispending = item.jobStatus === 2;
this.getScanCount() this.getScanCount()
@ -295,6 +309,7 @@
} else { } else {
this.showFinishButton = false this.showFinishButton = false
} }
this.setReceived()
// that.toLocation = item.details[0].recommendLocationCode; // that.toLocation = item.details[0].recommendLocationCode;
}) })
@ -302,6 +317,38 @@
this.showMessage('未查找到详细信息') this.showMessage('未查找到详细信息')
}); });
}, },
setReceived(){
//
//
if (this.datacontent.isClaims) {
this.datacontent.jobStatus = 2
//
if (this.datacontent.claimsUserId == localStorage.getItem('userId')) {
this.showBtn = true
} else {
this.showBtn = false
}
} else {
//
this.receive((callback => {
if (callback) {
this.datacontent.isClaims = true;
this.datacontent.jobStatus = 2
this.showBtn = true
this.datacontent.claimsUserName = localStorage.getItem('userName')
this.datacontent.claimsUserId = localStorage.getItem('userId')
} else {
this.showBtn = false
this.datacontent.isClaims = false;
this.datacontent.jobStatus = 1
this.datacontent.claimsUserId = ""
}
}));
}
},
// //
getScanResult(result) { getScanResult(result) {
let item = this.details.find(r => { let item = this.details.find(r => {
@ -331,9 +378,8 @@
getScanCount() { getScanCount() {
this.scanCount = 0; this.scanCount = 0;
this.datacontent.details.forEach(res => { this.datacontent.details.forEach(res => {
this.scanCount = this.scanCount + res.handledQty this.scanCount = calc.add(this.scanCount,res.receivedQty )
}) })
}, },
closeScanPopup() { closeScanPopup() {
@ -402,10 +448,13 @@
title: "提交中...", title: "提交中...",
mask:true mask:true
}); });
this.setParams(); let params =this.setParams();
let params = JSON.stringify(this.datacontent); if (params.length== 0) {
console.log("提交", params); this.showMessage('请先扫描数据');
finshThirdLocationJob(this.id, params) return;
}
console.log("提交", JSON.stringify(params));
finshThirdLocationJob( params)
.then(res => { .then(res => {
uni.hideLoading(); uni.hideLoading();
if (res != null) { if (res != null) {
@ -418,19 +467,18 @@
}); });
}, },
setParams() { setParams() {
var commitDetails=[]
this.datacontent.details.forEach(res => { this.datacontent.details.forEach(res => {
// res.handledFromLocationCode = res.recommendFromLocationCode; if(res.scaned){
// res.handledFromLocationA rea = res.recommendFromLocationArea; res.toLocationCode = this.toLocationInfo.code;
// res.handledFromLocationGroup = res.recommendFromLocationGroup; res.toLocationArea = this.toLocationInfo.areaCode;
// res.handledFromLocationErpCode = res.recommendFromLocationErpCode
// res.handledFromWarehouseCode = res.recommendFromWarehouseCode; var data=deepCopyData(res);
data.recommendQty =res.handledQty;
res.toLocationCode = this.toLocationInfo.code; commitDetails.push(data)
res.toLocationArea = this.toLocationInfo.areaCode; }
// res.toLocationGroup = this.toLocationInfo.locationGroupCode;
// res.toLocationErpCode = this.toLocationInfo.erpLocationCode;
}) })
return commitDetails;
}, },

Loading…
Cancel
Save