Mr.Shi
2023-09-06 eadee8087139a2c497284b24f507237619ac009b
Merge branch 'dev' of ssh://139.186.142.91:29418/productDev/dmMes into dev
已修改6个文件
508 ■■■■■ 文件已修改
minipro_standard/pages/index/index.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue 283 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
minipro_standard/pages_adjust/pages/spotCheck/spotCheck.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
minipro_standard/pages_adjust/pages/warehousingList/warehousingList.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
minipro_standard/util/utils.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
minipro_standard/pages/index/index.vue
@@ -21,10 +21,9 @@
                </view>
            </view>
        </u-sticky>
        <scroll-view v-if="projectList.length" :style="windowHeight - (statusbarHeight + navHeight + 120) + 'px'"
            scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
            refresher-background="lightgreen" @refresherpulling="scrolltolower" @refresherrefresh="scrolltoupper"
            @refresherrestore="onRestore" @refresherabort="onAbort">
        <scroll-view v-if="projectList.length" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
            :refresher-threshold="100" @refresherpulling="scrolltolower" @refresherrefresh="scrolltoupper"
        >
            <view v-for="(item, index) in projectList" :key="index">
                <view class="box_list">
                    <view class="box_list_item" @click="jump(item)">
@@ -181,13 +180,6 @@
                    .catch(err => {
                    })
            },
            onRestore() {
                this.triggered = 'restore'; // 需要重置
                console.log("onRestore");
            },
            onAbort() {
                console.log("onAbort");
            },
            scrolltolower() {
                this.page.page = 1
minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue
@@ -181,7 +181,17 @@
        <div class="details_dj" v-if="typeView === 1">
            <div class="details_dj_list">
                <u-swipe-action>
                <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="getLists">
                    <u-swipe-action v-for="(item, index) in djData" :key="index">
                        <u-swipe-action-item :options="options" @click="dele(item.id)">
                            <div class="details_dj_list_item">
                                <span>{{ item.attrName }}:{{ item.val }}</span>
                                <span>{{ item.userName }} {{ item.createTime }}</span>
                            </div>
                        </u-swipe-action-item>
                    </u-swipe-action>
                </scroll-view>
                <!-- <u-swipe-action>
                    <u-swipe-action-item v-for="(item, index) in djData" :key="index" :options="options"
                        @click="dele(item.id)">
                        <div class="details_dj_list_item">
@@ -189,7 +199,7 @@
                            <span>{{ item.userName }} {{ item.createTime }}</span>
                        </div>
                    </u-swipe-action-item>
                </u-swipe-action>
                </u-swipe-action> -->
            </div>
        </div>
        <!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
@@ -234,23 +244,41 @@
<script>
    import workOrderInfo from '@/components/workOrderInfo.vue'
    import {
        getBarcodeContent,
        queryById,
        getOrocessRecord,
        deleteCT,
        updateById,
        comfirmDone,
        comfirmDoneStandard,
        getListByCondition,
        allForStandard,
        pageDJ,
        deletedj,
        dealWorkorderRecordStandard,
        getWorkorderRecordListStandard,
        createMaterial,
        createMaterialStandard
    } from '@/util/api/WorkOrderAPI'
    import {
        categoryExtList,
        queryOne,
        queryList
    } from '@/util/api/PlanningAPI'
    import { REGULAR } from '@/util/utils'
    export default {
        components: {
            workOrderInfo
        },
        data() {
            return {
                workorderId: '',
                cate: [{
                        name: '生产'
                    },
                    {
                        name: '点检'
                    }
                ],
                    }],
                form: {
                    time: '',
                    efective: [],
@@ -264,35 +292,14 @@
                TimeShow: false,
                badShow: false,
                typeView: 0,
                feedingData: [{
                    id: 0,
                    materialName: '墙体砖',
                    procedureName: '压制',
                    qualityType: 1,
                    locationName: 'CP-01',
                    batch: '20230713',
                    num: 2,
                    maxNum: 10,
                    unitAttribute: 1,
                    unitName: '块'
                }],
                feedingData: [],
                options: [{
                    text: '删除',
                    style: {
                        backgroundColor: 'red',
                    }
                }],
                arrType: [{
                        name: '计时',
                        type: 1,
                        salary: 1000,
                    },
                    {
                        name: '计件',
                        type: 0,
                        salary: 100
                    },
                ],
                arrType: [],
                // 产出合格/不良
                produceFrom: {
                    qualifiedId: '',
@@ -300,18 +307,22 @@
                    undesirableId: '',
                    undesirable: 5 // 不良
                },
                djData: [{
                    attrName: '出水时间',
                    val: '2022-05-28 16:3',
                    userName: '张三 ',
                    createTime: '2022-05-28 16:32:'
                }],
                cateList: [{
                    active: false,
                    name: '毛刺',
                    num: 0
                }]
                djData: [],
                cateList: [],
                finished: true,
            };
        },
        onLoad(obj) {
            this.workorderId = obj.id
            this.queryByIds()
            this.getOrocessRecords()
            this.getData()
            uni.$on('spotAdd', () => {
                if (this.typeView == 1) {
                    this.pages.page = 1
                    this.pageDJs()
                }
            })
        },
        computed: {
            expectedSalary() {
@@ -354,22 +365,35 @@
                }
            }
        },
        onLoad(obj) {
            this.workorderId = obj.id
            queryById(this.workorderId)
                .then(res => {
        methods: {
            getData() {
                categoryExtList({
                    cateType: "3"
                }).then(res => {
                    if (res.code === 200) {
                        this.info = res.data
                        this.deviceId = res.data.pgmodel.id
                        res.data.forEach(item => {
                            item.active = false
                            item.num = ''
                        })
                        this.cateList = res.data
                    }
                })
        },
        methods: {
            click() {
            },
            clickIten(index) {
                this.typeView = index
                if (this.typeView == 1) {
                    this.pages.page = 1
                    this.finished = true
                    this.pageDJs()
                }
            },
            getLists() {
                if (!this.finished) {
                    return
                }
                this.finished = false
                this.pages.page += 1
                this.pageDJs()
            },
            timeConfirm({
                value
@@ -395,68 +419,165 @@
                    if (unitAttribute == 0 && num != '') {
                        if (!REGULAR.positiveInteger.test(num)) {
                            obj.num = obj.ynum
                            Toast({
                                message: '只能输入正整数'
                            })
                            uni.$u.toast('只能输入正整数')
                            return
                        }
                    }
                    if (unitAttribute == 1 && num != '') {
                        if (!REGULAR.number.test(num)) {
                            Toast({
                                message: '只能输入正整数或小数(最多四位)'
                            })
                            uni.$u.toast('只能输入正整数或小数(最多四位)')
                            obj.num = obj.ynum
                            return
                        }
                    }
                    if (num > maxNum) {
                        obj.num = obj.ynum
                        Toast.fail({
                            message: '超出工装总数'
                        })
                        uni.$u.toast('超出工装总数')
                        return
                    }
                } else if (type === 'C' && num > info.value.planNum) {
                    obj.num = obj.ynum
                    Toast.fail({
                        message: '产出数量不能超过计划数量'
                    })
                    uni.$u.toast('产出数量不能超过计划数量')
                    return
                }
                // updateById({ id, num }).then(res => {
                //   if (res.code === 200 && type === 'T') {
                //     getOrocessRecords()
                //   } else if (res.code === 200 && type === 'C') {
                //     // getOrocessRecordCC()
                //   }
                // })
            },
            clickPerformanceType(item, index) {
                this.form.index = index
                this.form.type = item.type
            },
            submit() {},
            jumpdj() {},
            pageDJs() {},
            submit() {
            },
            jumpdj() {
                uni.navigateTo({
                    url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}`
                })
            },
            pageDJs() {
                pageDJ({
                    capacity: this.pages.capacity,
                    page: this.pages.page,
                    model: {
                        workorderId: this.workorderId
                    }
                }).then(res => {
                    let {data} = res
                    if (data.page == 1) {
                        this.djData = []
                    }
                    this.djData.push(...data.records)
                    // loading.value = false
                }).catch(err => {
                    // loading.value = false
                    // finished.value = true
                })
                .finally(() => {
                    this.finished = true
                })
            },
            dele(id) {
                // deletedj(id)
                //     .then(res => {
                //       if (res.code === 200) {
                //         djData.value = []
                //         finished.value = false
                //         page.page = 1
                //         djData.value = []
                //         pageDJs()
                //       }
                //     })
                deletedj(id)
                    .then(res => {
                      if (res.code === 200) {
                        this.finished = false
                        this.pages.page = 1
                        this.pageDJs()
                      }
                    })
            },
            confirm() {
                // console.log('confirm');
                let isOpen = false
                this.cateList.forEach((item, index) => {
                    if (item.active) {
                        isOpen = true
                    }
                })
                if (!isOpen) {
                    uni.showToast({
                        title: '请选择不良项',
                        duration: 2000,
                        icon: 'none'
                    })
                    return
                }
                let arr = []
                let total = 0
                let name = ''
                this.cateList.forEach((item, index) => {
                    if (item.active) {
                        if (item.num <= 0) {
                            uni.showToast({
                                title: '不良数量必须大于0',
                                duration: 2000,
                                icon: 'none'
                            })
                            return
                        }
                        total = total += item.num
                        arr.push(item)
                        name += item.name + item.num + ';'
                    }
                })
                if (total != Number(this.produceFrom.undesirable)) {
                    uni.showToast({
                        title: '不良数必须等于产出不良数',
                        duration: 2000,
                        icon: 'none'
                    })
                    return
                }
                this.form.defective = arr
                this.form.defectiveName = name
                this.badShow = false
            },
            changeChecked(i) {
                this.cateList[i].active = !this.cateList[i].active
            },
            queryByIds() {
                queryById(this.workorderId)
                    .then(res => {
                        this.info = res.data
                        queryList({
                            deleted: 0,
                            departId: res.data.factoryId,
                            materialId: res.data.materialId,
                            procedureId: res.data.procedureId
                        }).then(result => {
                            if (result.code === 200) {
                                if (result.data && result.data.length > 0) {
                                    result.data.forEach((item, index) => {
                                        item.name = item.type == 0 ? '计件' : '计时'
                                        item.id = item.type
                                        item.active = index == 0
                                    })
                                    this.arrType = result.data
                                } else {
                                    this.arrType = []
                                }
                            }
                        })
                    })
            },
            getOrocessRecords() {
                this.feedingData = []
                allForStandard({
                    workorderId: this.workorderId,
                    type: 0
                }).then(res => {
                    if (res.code === 200) {
                        this.feedingData = res.data
                    }
                })
            },
            jumpTL() {
                uni.navigateTo({
                    // url: ''
                    url: `/pages_adjust/pages/manualFeed/manualFeed?id=${this.workorderId}`
                })
            }
        }
    }
minipro_standard/pages_adjust/pages/spotCheck/spotCheck.vue
@@ -33,8 +33,8 @@
                    <div class="tl_list_item" v-else-if="item.type === 0">
                        <div class="tl_list_item_label">属性值</div>
                        <div class="tl_list_item_go">
                            <u-radio-group v-model="item.num" placement="row">
                                <u-radio v-for="(item1, i) in item.data" :key="i" activeColor="#4275FC" :label="item1">
                            <u-radio-group v-model="item.num" placement="row" @change="radioSelect">
                                <u-radio v-for="(item1, i) in item.data" :key="i" activeColor="#4275FC" :name="item1" :label="item1">
                                </u-radio>
                            </u-radio-group>
                            <!-- <van-radio-group v-model="item.num" direction="horizontal">
@@ -266,11 +266,15 @@
                }
                this.formList.splice(index, 1)
            },
            radioSelect(v) {
                console.log(v);
            },
            submit() {
                let isOpen = true
                let attrList = []
                
                this.formList.forEach(item => {
                    console.log('-------', item);
                    if (item.type === 1) {
                        if (item.attribute === '' || item.num.length === 0) {
                            isOpen = false
@@ -303,6 +307,7 @@
                    id: this.workOrderId
                }).then(res => {
                    if (res.code === 200) {
                        uni.$emit('spotAdd')
                        uni.$u.toast('创建成功')
                        setTimeout(() => {
                            uni.navigateBack()
minipro_standard/pages_adjust/pages/warehousingList/warehousingList.vue
@@ -97,13 +97,8 @@
<script>
    import Search from '@/components/Search.vue'
    import LabelSelection from '@/components/LabelSelection.vue'
    import {
        orderTyepToStr
    } from '@/util/constData.js'
    import {
        getBoundList,
        pageCount
    } from "@/util/api/materialStorage";
    import { getBoundList, pageCount } from "@/util/api/materialStorage";
    import { orderTyepToStr } from '@/util/constData.js'
    export default {
        components: {
            Search,
minipro_standard/pages_adjust/pages/workOrderReporting/workOrderReporting.vue
@@ -172,21 +172,20 @@
                    </div>
                </div>
            </div>
        </div>
        <div class="details_dj" v-if="typeView === 1">
            <div class="details_dj_list">
                <u-swipe-action>
                    <u-swipe-action-item v-for="(item, index) in djData" :key="index" :options="options"
                        @click="dele(item.id)">
                <scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="getLists">
                    <u-swipe-action v-for="(item, index) in djData" :key="index">
                        <u-swipe-action-item :options="options" @click="dele(item.id)">
                        <div class="details_dj_list_item">
                            <span>{{ item.attrName }}:{{ item.val }}</span>
                            <span>{{ item.userName }} {{ item.createTime }}</span>
                        </div>
                    </u-swipe-action-item>
                </u-swipe-action>
                </scroll-view>
            </div>
        </div>
        <!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
@@ -249,6 +248,7 @@
        queryOne,
        queryList
    } from '@/util/api/PlanningAPI'
    import { REGULAR } from '@/util/utils'
    export default {
        components: {
            workOrderInfo
@@ -264,7 +264,7 @@
                ],
                form: {
                    time: '',
                    efective: [],
                    defective: [],
                    defectiveName: '',
                    durationName: '0小时0分钟',
                    duration: 0,
@@ -276,37 +276,14 @@
                typeView: 0,
                workorderId: '',
                info: {},
                feedingData: [
                    // {
                    //     id: 0,
                    //     materialName: '墙体砖',
                    //     procedureName: '压制',
                    //     qualityType: 1,
                    //     locationName: 'CP-01',
                    //     batch: '20230713',
                    //     num: 2,
                    //     maxNum: 10,
                    //     unitAttribute: 1,
                    //     unitName: '块'
                    // },
                ],
                feedingData: [],
                options: [{
                    text: '删除',
                    style: {
                        backgroundColor: 'red',
                    }
                }],
                arrType: [{
                        name: '计时',
                        type: 1,
                        salary: 1000,
                    },
                    {
                        name: '计件',
                        type: 0,
                        salary: 100
                    },
                ],
                arrType: [],
                // 产出合格/不良
                produceFrom: {
                    qualifiedId: '',
@@ -314,19 +291,10 @@
                    undesirableId: '',
                    undesirable: '' // 不良
                },
                djData: [{
                    attrName: '出水时间',
                    val: '2022-05-28 16:3',
                    userName: '张三 ',
                    createTime: '2022-05-28 16:32:'
                }],
                cateList: [
                    // {
                    //     active: false,
                    //     name: '毛刺',
                    //     num: 0
                    // },
                ],
                triggered: false,
                finished: true,
                djData: [],
                cateList: [],
                pages: {
                    capacity: 10,
                    page: 1,
@@ -339,6 +307,12 @@
            this.queryByIds()
            this.getOrocessRecords()
            this.getData()
            uni.$on('spotAdd', () => {
                if (this.typeView == 1) {
                    this.pages.page = 1
                    this.pageDJs()
                }
            })
        },
        computed: {
            expectedSalary() {
@@ -436,6 +410,10 @@
            },
            clickIten(index) {
                this.typeView = index
                if (this.typeView == 1) {
                    this.pages.page = 1
                    this.pageDJs()
                }
            },
            timeConfirm({
                value
@@ -502,7 +480,11 @@
                if (!num) return
                console.log(Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable))
                if ((Number(this.produceFrom.qualified) + Number(this.produceFrom.undesirable)) > this.info.planNum) {
                    uni.showToast({ title:'产出数量不能大于计划数量', duration: 2000, icon:'none' })
                    uni.showToast({
                        title: '产出数量不能大于计划数量',
                        duration: 2000,
                        icon: 'none'
                    })
                    return
                }
                if (num >= 0) {
@@ -521,34 +503,90 @@
                    } else {
                        this.produceFrom.undesirable = 0
                    }
                    uni.showToast({ title:'产出数量不能小于', duration: 2000, icon:'none' })
                    uni.showToast({
                        title: '产出数量不能小于',
                        duration: 2000,
                        icon: 'none'
                    })
                }
            },
            clickPerformanceType(item, index) {
                this.form.index = index
                this.form.type = item.type
            },
            submit() {},
            submit() {
                let createUnqualifiedDTOList = this.form.defective.map((item) => {
                    return {
                      categoryId: item.id,
                      unQualifiedNum: item.num
                    }
                  })
                  let createWorkorderRecordDTO = {
                    workorderId: this.workorderId,
                    duration: this.form.duration ? this.form.duration : 0,
                    qualifiedNum: this.produceFrom.qualified ? this.produceFrom.qualified : 0,
                    unQualifiedNum: this.produceFrom.undesirable ? this.produceFrom.undesirable : 0
                  }
                  // id: route.query.id
                  comfirmDoneStandard({
                    createUnqualifiedDTOList,
                    createWorkorderRecordDTO
                  }).then(res => {
                    if (res.code === 200) {
                            uni.$u.toast('报工成功')
                      setTimeout(() => {
                        uni.navigateBack({ data: 2})
                      }, 2000)
                    }
                  })
            },
            jumpdj() {
                uni.navigateTo({
                    url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}`
                })
            },
            pageDJs() {},
            getLists() {
                if (!this.finished) {
                    return
                }
                this.finished = false
                this.pages.page += 1
                this.pageDJs()
            },
            pageDJs() {
                pageDJ({
                    capacity: this.pages.capacity,
                    page: this.pages.page,
                    model: {
                        workorderId: this.workorderId
                    }
                }).then(res => {
                    let {data} = res
                    if (data.page == 1) {
                        this.djData = []
                    }
                    this.djData.push(...data.records)
                    // loading.value = false
                }).catch(err => {
                    // loading.value = false
                    // finished.value = true
                })
                .finally(() => {
                    this.finished = true
                })
            },
            dele(id) {
                // deletedj(id)
                //     .then(res => {
                //       if (res.code === 200) {
                //         djData.value = []
                //         finished.value = false
                //         page.page = 1
                //         djData.value = []
                //         pageDJs()
                //       }
                //     })
                deletedj(id)
                    .then(res => {
                        if (res.code === 200) {
                            this.finished = true
                            this.pages.page = 1
                            this.pageDJs()
                        }
                    })
            },
            confirm() {
                console.log('confirm', this.cateList);
                let isOpen = false
                this.cateList.forEach((item, index) => {
                    if (item.active) {
@@ -556,7 +594,11 @@
                    }
                })
                if (!isOpen) {
                    uni.showToast({ title:'请选择不良项', duration: 2000, icon:'none' })
                    uni.showToast({
                        title: '请选择不良项',
                        duration: 2000,
                        icon: 'none'
                    })
                    return
                }
                let arr = []
@@ -565,7 +607,11 @@
                this.cateList.forEach((item, index) => {
                    if (item.active) {
                        if (item.num <= 0) {
                            uni.showToast({ title:'不良数量必须大于0', duration: 2000, icon:'none' })
                            uni.showToast({
                                title: '不良数量必须大于0',
                                duration: 2000,
                                icon: 'none'
                            })
                            return
                        }
                        total = total += item.num
@@ -574,7 +620,11 @@
                    }
                })
                if (total != Number(this.produceFrom.undesirable)) {
                    uni.showToast({ title:'不良数必须等于产出不良数', duration: 2000, icon:'none' })
                    uni.showToast({
                        title: '不良数必须等于产出不良数',
                        duration: 2000,
                        icon: 'none'
                    })
                    return
                }
                this.form.defective = arr
minipro_standard/util/utils.js
@@ -42,4 +42,21 @@
    return [year, Sign, month , Sign, day, ' ', hour , ':', minute, ':', '00' ].join('');
}
export { gsdate, setTime, setTimeO }
/***
 * phoneRegular: 手机号验证
 * mailboxRegular: 邮箱验证
 * positiveInteger: 正整数
 * decimal: 小数(只支持四位小数)
 * positiveIntegerDecimal: 正整数小数(最多四位小数)
 * number:数字最多保留四位小数
 */
const REGULAR = {
    phoneRegular: /^1[3456789]\d{9}$/,
    mailboxRegular: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
    positiveInteger: /^[0-9]*[1-9][0-9]*$/,
    decimal: /^0$|^[1-9]\d{0,15}$|^[1-9]\d{0,15}\.{1}\d{1,4}$|^0\.{1}\d{1,4}$/g,
    positiveIntegerDecimal: /^([1-9][0-9]*|0)(\.[0-9]?[1-9][1-9][1-9])?$/,
    number: /^\d+(?:\.\d{1,4})?$/
}
export { gsdate, setTime, setTimeO, REGULAR }