chen.lin
昨天 7f686a5ea018786809135b5f970be114f815165e
组托优化
6个文件已修改
293 ■■■■ 已修改文件
common/request.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/listing/matnrPalletising.vue 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/login/index.vue 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/request.js
@@ -15,7 +15,11 @@
    return new Promise((resolve, reject) => {
        const token = uni.getStorageSync('token');
        // const URL = 'http://192.168.4.34:8085/rsf-server/pda' + url;
        const URL = 'http://127.0.0.1:8085/rsf-server/pda' + url;
        let baseUrl = uni.getStorageSync('baseUrl');
        if (!baseUrl) {
            baseUrl = 'http://127.0.0.1:8085/rsf-server/pda';
        }
        const URL = baseUrl+'/pda' + url;
        uni.request({
            url: URL,
            data: postData,
manifest.json
@@ -1,6 +1,6 @@
{
    "name" : "中扬wms",
    "appid" : "__UNI__AE0F207",
    "appid" : "__UNI__26FF7F0",
    "description" : "",
    "versionName" : "20250613",
    "versionCode" : 100,
@@ -113,5 +113,6 @@
        "devServer" : {
            "port" : 8133
        }
    }
    },
    "fallbackLocale" : "zh-Hans"
}
package-lock.json
@@ -1,5 +1,5 @@
{
  "name": "pda-master",
  "name": "pda-jdxaj",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
pages/listing/matnrPalletising.vue
@@ -9,16 +9,16 @@
                </view>
                <view class="cu-form-group">
                    <view class="title">物料编码</view>
                    <input placeholder="请扫描物料编码" v-model="matnrCode"></input>
                    <input placeholder="请扫描物料编码" v-model="matnrCode" @input="onMatnrCodeInput" @confirm="search"></input>
                    <text class='cuIcon-search text-blue' @click="search"></text>
                </view>
                <view class="cu-form-group">
                    <view class="title">票号</view>
                    <input placeholder="请扫描现品票号" v-model="fieldsIndex" @input="search()" focus></input>
                    <text class='cuIcon-close text-gray margin-right-xs' v-show="fieldsIndex!==''"
                        @click="clearCode"></text>
                    <!-- <text class='cuIcon-search text-blue' @click="search"></text> -->
                </view>
<!--                <view class="cu-form-group">-->
<!--                    <view class="title">票号</view>-->
<!--                    <input placeholder="请扫描现品票号" v-model="fieldsIndex" @input="search()" focus></input>-->
<!--                    <text class='cuIcon-close text-gray margin-right-xs' v-show="fieldsIndex!==''"-->
<!--                        @click="clearCode"></text>-->
<!--                    &lt;!&ndash; <text class='cuIcon-search text-blue' @click="search"></text> &ndash;&gt;-->
<!--                </view>-->
                <view class="cu-form-group">
                    <view class="title">ASN单号</view>
                    <input placeholder="请输入ASN单号" v-model="asnCode"></input>
@@ -72,11 +72,11 @@
                            <text class="text-grey ">{{item.splrBatch}}</text>
                        </view>
                    </view>
                    <view class="cu-item">
                        <view class="content">
                            <text class="text-black">票号:<text class="text-grey ">{{item.crushNo}}</text></text>
                        </view>
                    </view>
<!--                    <view class="cu-item">-->
<!--                        <view class="content">-->
<!--                            <text class="text-black">票号:<text class="text-grey ">{{item.crushNo}}</text></text>-->
<!--                        </view>-->
<!--                    </view>-->
                    <view class="cu-item">
                        <view class="content">
                            <text class="text-black">库存单位: <text class="text-grey ">{{item.stockUnit}}</text></text>
@@ -86,7 +86,7 @@
                        </view>
                    </view>
                    <view class="cu-item">
                        <view class="content">
                        <view class="content" v-if="item.asnCode">
                            <text class="text-black">可组盘数量:<text
                                    class="text-grey ">{{item.anfme - item.workQty - item.qty}}</text></text>
                        </view>
@@ -101,7 +101,7 @@
                                <view class="title text-blue"><text
                                        class="text-red text-xl vertical-middle">*</text>组盘数量:
                                </view>
                                <uni-number-box style="width: 70%;" :min="0" :max="max" :decimal="2" :step="0.000001"
                                <uni-number-box style="width: 70%;" :min="0" :max="max" :decimal="6" :step="1"
                                    v-model="item.receiptQty"></uni-number-box>
                            </view>
                        </view>
@@ -141,10 +141,10 @@
                range: [],
                asnCode: '',
                repeatClick: false,
                fieldsIndex: null,
                isconfirm: false,
                matnrCode: '',
                max: 99999999,
                searchTimer: null,
            }
        },
        computed: {
@@ -155,24 +155,56 @@
        },
        mounted() {},
        methods: {
            onMatnrCodeInput(e) {
                // 扫码输入时自动触发查询
                if (e.detail && e.detail.value && e.detail.value.trim() !== '') {
                    this.matnrCode = e.detail.value;
                    // 如果物料编码为"0",不请求接口
                    if (this.matnrCode.trim() === '0') {
                        return;
                    }
                    // 延迟一下再查询,避免频繁请求
                    if (this.searchTimer) {
                        clearTimeout(this.searchTimer);
                    }
                    this.searchTimer = setTimeout(() => {
                        this.getDet();
                    }, 500);
                }
            },
            async search() {
                // if (this.fieldsIndex.length < 25) {
                //     return;
                // }
                const find = this.list.find(el => el.trackCode === this.barcode);
                find ? this.scrollTo() : this.getDet();
                // 如果物料编码为空,不执行查询
                if (!this.matnrCode || this.matnrCode.trim() === '') {
                    return;
                }
                // 如果物料编码为"0",不请求接口
                if (this.matnrCode.trim() === '0') {
                    return;
                }
                // 直接调用查询方法
                this.getDet();
            },
            getDet() {
                let that = this;
                // 如果物料编码为"0",不请求接口
                if (that.matnrCode && that.matnrCode.trim() === '0') {
                    return;
                }
                // 检查是否有查询条件
                if ((!that.matnrCode || that.matnrCode.trim() === '') &&
                    (!that.asnCode || that.asnCode.trim() === '')) {
                    uni.showToast({
                        title: "请输入物料编码或ASN单号",
                        icon: "none",
                        position: 'top'
                    })
                    return;
                }
                let param = {
                    matnrCode: that.matnrCode.trim(),
                    asnCode: that.asnCode.trim(),
                    fieldsIndex: that.fieldsIndex.trim()
                    matnrCode: that.matnrCode ? that.matnrCode.trim() : '',
                    asnCode: that.asnCode ? that.asnCode.trim() : ''
                }
                that.getDetl(param);
            },
            clearCode() {
                this.fieldsIndex = ''
            },
            async getDetl(req) {
                let that = this;
@@ -180,28 +212,55 @@
                    title: "加载中...",
                    mask: true
                })
                // 构建请求参数,只传递非空值
                let requestParams = {};
                if (that.matnrCode && that.matnrCode.trim() !== '') {
                    requestParams.matnrCode = that.matnrCode.trim();
                }
                if (that.asnCode && that.asnCode.trim() !== '') {
                    requestParams.asnCode = that.asnCode.trim();
                    requestParams.code = that.asnCode.trim();
                }
                if (req && req.batch) {
                    requestParams.batch = req.batch;
                }
                const {
                    code,
                    data,
                    msg
                } = await request('/asnOrderItem/trackCode', {
                    matnrCode: that.matnrCode,
                    asnCode: that.asnCode,
                    code: that.asnCode,
                    fieldsIndex: that.fieldsIndex,
                    batch: req.batch
                }, "post")
                } = await request('/asnOrderItem/trackCode', requestParams, "post")
                console.log('查询参数:', requestParams);
                console.log('查询结果:', code, data);
                if (code === 200) {
                    if (!data || data.length === 0) {
                        console.warn('未找到可组托的物料,请检查:1.物料编码是否正确 2.物料是否已收货至收货区 3.是否还有可组托数量');
                        uni.showToast({
                            title: "未找到可组托的物料",
                            icon: "none",
                            position: 'top'
                        })
                        uni.hideLoading();
                        return;
                    }
                    for (var i = 0; i < data.length; i++) {
                        data[i].receiptQty = data[i].anfme - data[i].workQty;
                        data[i].crushNo = that.fieldsIndex;
                        // 计算可组盘数量 = 总数量 - 已执行数量 - 已收货数量
                        let anfme = data[i].anfme || 0;
                        let workQty = data[i].workQty || 0;
                        let qty = data[i].qty || 0;
                        data[i].receiptQty = anfme - workQty - qty;
                        // 确保可组盘数量不为负数
                        if (data[i].receiptQty < 0) {
                            data[i].receiptQty = 0;
                        }
                        data[i].selected = true;
                    }
                    that.fieldsIndex = null;
                    that.showBackData(data)
                    // 加载物料成功后,清空物料编码输入框
                    that.matnrCode = '';
                } else {
                    uni.showToast({
                        title: msg,
                        title: msg || "查询失败",
                        icon: "none",
                        position: 'top'
                    })
@@ -244,21 +303,14 @@
                }
            },
            showBackData(data) {
                let status;
                data.map(item => {
                    this.list.push(item)
                })
                let oldLength = this.list.length
                this.list = this.list.filter((item, index, self) =>
                    self.findIndex(i => (
                        i.id === item.id // 根据id去重
                    )) === index && item.isptResult === self[0].isptResult
                );
                let newLength = this.list.length
                if (oldLength > newLength) {
                    this.showMsg("新明细被过滤,请检查状态")
                }
                // 追加新物料到列表,只根据id去重,不限制质检结果
                data.forEach(item => {
                    // 检查是否已存在相同id的物料,如果不存在则追加
                    const exists = this.list.some(existingItem => existingItem.id === item.id);
                    if (!exists) {
                        this.list.push(item);
                    }
                });
            },
            showMsg(msg) {
                setTimeout(function() {
@@ -315,6 +367,19 @@
                    })
                    return;
                }
                // 校验所有物料的组盘数量不能为空、不能为0
                for (let i = 0; i < this.list.length; i++) {
                    const item = this.list[i];
                    if (item.receiptQty === null || item.receiptQty === undefined || item.receiptQty === '' || item.receiptQty === 0) {
                        uni.showToast({
                            title: `第${i + 1}个物料(${item.matnrCode || item.maktx || '未知'})的组盘数量不能为空或0`,
                            icon: "none",
                            position: 'top',
                            duration: 3000
                        })
                        return;
                    }
                }
                this.repeatClick = true
                const newArr = this.list.map(item => {
                    return {
pages/login/index.vue
@@ -1,5 +1,11 @@
<template>
    <view class="bodyView">
        <!-- 设置按钮 -->
        <view class="settings">
            <view class="settings-btn">
                <uni-icons type="gear" size="30" color="#707070" @click="settings"></uni-icons>
            </view>
        </view>
        <view class="topView">
            <image src="/static/img/login_top.png" mode="aspectFill">                
            </image>
@@ -16,7 +22,7 @@
            <view class="itemView">
                <view class="textType3">{{$t('login.user')}}:</view>
                <view class="input-wrapper">
                    <input class="uni-input" v-model="user.userName" focus :placeholder="$t('login.inputUser')" />
                    <input class="uni-input" v-model="user.userName" :placeholder="$t('login.inputUser')" />
                </view>
            </view>
            <view class="itemView">
@@ -58,6 +64,32 @@
                <button class="loadingButton" @click="onLogin()"  :loading="loading">{{btnText}}</button>
            </view>
        </view>
        <!-- 设置弹窗区域 -->
        <view>
            <uni-popup ref="inputDialog" type="dialog">
                <view class="popup">
                    <!-- 标题 -->
                    <view class="title">配置</view>
                    <view class="popup-item">
                        <view class="popup-item-left">IP:</view>
                        <view class="popup-item-right"><input type="text" v-model="url.ip"></view>
                    </view>
                    <view class="popup-item">
                        <view class="popup-item-left">端口:</view>
                        <view class="popup-item-right"><input type="text" v-model="url.port"></view>
                    </view>
                    <view class="popup-item">
                        <view class="popup-item-left">项目:</view>
                        <view class="popup-item-right"><input type="text" v-model="url.project"></view>
                    </view>
                    <view class="btn">
                        <view class="btn-left" @click="close">取消</view>
                        <view class="btn-right" @click="settingConfirm">确认</view>
                    </view>
                </view>
            </uni-popup>
        </view>
    </view>
</template>
@@ -80,6 +112,12 @@
                userName: '',
                password: '',
            },
            url: {
                ip: '',
                port: '',
                project: ''
            },
            baseUrl: '',
        }
    },
    computed:{
@@ -118,11 +156,20 @@
          this.applicationLocale = e.locale;
        })
        
        this.user = uni.getStorageSync('user')
        this.user = uni.getStorageSync('user')
        this.url = uni.getStorageSync('url')
        this.baseUrl = uni.getStorageSync('baseUrl')
        if (!this.user) {
            this.user = {
                userName: '',
                password: ''
            }
        }
        if (!this.url) {
            this.url = {
                ip: '',
                port: '',
                project: ''
            }
        }
    },
@@ -234,11 +281,44 @@
                this.showLanguageDropdown = false;
            }
        },
        // 设置窗口开启按钮
        settings() {
            this.$refs.inputDialog.open('')
        },
        // 设置窗口关闭按钮
        close() {
            this.$refs.inputDialog.close()
        },
        // 保存ip
        settingConfirm() {
            this.baseUrl = "http://" + this.url.ip + ':' + this.url.port + '/' + this.url.project
            uni.setStorageSync('baseUrl', this.baseUrl);
            uni.setStorageSync('url', this.url);
            uni.setStorageSync('project', 'tzsk')
            this.$refs.inputDialog.close()
        },
    }
}
</script>
<style>
<style>
    @import url('../../static/css/wms.css/wms.css');
    /* 设置区域 */
    .settings {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 999;
        min-height: 100rpx;
        padding: 20rpx;
    }
    .settings-btn {
        float: right;
        margin-right: 10rpx;
    }
    .helloText{
        font-family: a2;
        font-size: 20px;
@@ -254,6 +334,7 @@
        font-family: a4;
    }
    .bodyView{
        position: relative;
        display: flex;
        flex-direction: column;
        background-image: url("/static/img/login_backg.png");
uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue
@@ -51,6 +51,10 @@
                type: Number,
                default: 1
            },
            decimal: {
                type: Number,
                default: null
            },
            background: {
                type: String,
                default: '#f5f5f5'
@@ -113,7 +117,11 @@
                    }
                }
                this.inputValue = (value / scale).toFixed(String(scale).length - 1);
                // 如果指定了decimal属性,使用decimal;否则根据scale计算
                let decimalPlaces = this.decimal !== null && this.decimal !== undefined
                    ? this.decimal
                    : (String(scale).length - 1);
                this.inputValue = (value / scale).toFixed(decimalPlaces);
                this.$emit("change", +this.inputValue);
                // TODO vue2 兼容
                this.$emit("input", +this.inputValue);
@@ -121,7 +129,11 @@
                this.$emit("update:modelValue", +this.inputValue);
            },
            _getDecimalScale() {
                // 如果指定了decimal属性,优先使用decimal
                if (this.decimal !== null && this.decimal !== undefined) {
                    return Math.pow(10, this.decimal);
                }
                let scale = 1;
                // 浮点型
                if (~~this.step !== this.step) {
@@ -143,7 +155,11 @@
                    value = this.min;
                }
                const scale = this._getDecimalScale();
                this.inputValue = value.toFixed(String(scale).length - 1);
                // 如果指定了decimal属性,使用decimal;否则根据scale计算
                let decimalPlaces = this.decimal !== null && this.decimal !== undefined
                    ? this.decimal
                    : (String(scale).length - 1);
                this.inputValue = value.toFixed(decimalPlaces);
                this.$emit("change", +this.inputValue);
                this.$emit("input", +this.inputValue);
            },