diff --git a/api/request2.js b/api/request2.js index 45b1d8b6..366316b1 100644 --- a/api/request2.js +++ b/api/request2.js @@ -2296,13 +2296,82 @@ export function getProductionReturnRequestDetail(id) { } /** - * 生产退料申请 提交 - * @param {*} params + * 生产退料申请 处理 + * @param {*} id + * */ -export function productionReturnRequestSubmit(params) { +export function productionReturnRequestHandle(id) { return request({ - url: baseApi + "/wms/purchasereturn-request-main/submit", + url: baseApi + "/wms/productionreturn-request-main/handle?id=" + id, method: "put", + data: {}, + }); +} + +/** + * 生产退料申请 提交审批 + * @param {*} id + * + */ +export function productionReturnRequestSubmitApprove(id) { + return request({ + url: baseApi + "/wms/productionreturn-request-main/submit?id=" + id, + method: "put", + data: {}, + }); +} + +/** + * 生产退料申请 审批通过 + * @param {*} id + * + */ + +export function productionReturnRequestSubmitApproveAgree(id) { + return request({ + url: baseApi + "/wms/productionreturn-request-main/agree?id=" + id, + method: "put", + data: {}, + }); +} + +/** + * 生产退料申请 审批驳回 + * @param {*} id + * + */ +export function productionReturnRequestSubmitApproveRefused(id) { + return request({ + url: baseApi + "/wms/productionreturn-request-main/refused?id=" + id, + method: "put", + data: {}, + }); +} + +/** + * 生产退料申请 关闭 + * @param {*} id + * + */ +export function productionReturnRequestClose(id) { + return request({ + url: baseApi + "/wms/productionreturn-request-main/close?id=" + id, + method: "put", + data: {}, + }); +} + + + +/** + * 生产退料申请 创建 + * @param {*} params + */ + +export function productionReturnRequestCreate(params) { + return request({ + url: baseApi + "/wms/productionreturn-request-main/create", + method: "post", data: params, }); } diff --git a/pages.json b/pages.json index b86ffb87..9b3d427a 100644 --- a/pages.json +++ b/pages.json @@ -529,7 +529,34 @@ { "path": "pages/productionReturn/request/returnToStoreRequest", "style": { - "navigationBarTitleText": "生产退料合格申请", + "navigationBarTitleText": "生产合格退料申请", + "enablePullDownRefresh": true, + "titleNView": { + // "autoBackButton": "true", + "buttons": [ + // 右边按钮 + { + "float": "right", + "fontSize": "58rpx", //按钮上文字的大小 + "text": "\ue696", + "fontSrc": "/static/ali_icon/iconfont.ttf" + + }, + { + + "float": "right", + "fontSize": "52rpx", //按钮上文字的大小 + "text": "\ue6e2", + "fontSrc": "/static/ali_icon/iconfont.ttf" + } + ] + } + } + }, + { + "path": "pages/productionReturn/request/returnToStoreRequestSubmit", + "style": { + "navigationBarTitleText": "生产合格退料申请", "enablePullDownRefresh": true, "titleNView": { // "autoBackButton": "true", diff --git a/pages/inspect/job/inspectDetail.vue b/pages/inspect/job/inspectDetail.vue index 98cd0d1f..3f4bae60 100644 --- a/pages/inspect/job/inspectDetail.vue +++ b/pages/inspect/job/inspectDetail.vue @@ -440,7 +440,7 @@ detail.sampleQty = detail.qty; detail.failedQty = detail.failedQty; detail.crackQty = detail.crackQty; - detail.notPassedQty = detail.notPassedQty; + detail.notPassedQty = Number(detail.receiveQty)-Number(detail.crackQty); // detail.goodQty = detail.handleQty - detail.failedQty - detail.crackQty; detail.inspectUser = this.$store.state.user.id @@ -456,18 +456,12 @@ detail.toInventoryStatus = "NOK" } } - // detail.singlePrice = detail.balance.singlePrice; - // detail.amount = detail.balance.singlePrice * detail.handleQty; - - // detail.arriveDate = detail.balance.arriveDate; - // detail.produceDate = detail.balance.produceDate; - // detail.expireDate = detail.balance.expireDate; } else { detail.sampleQty = detail.qty; detail.failedQty = 0; detail.crackQty = 0; - detail.notPassedQty = 0; + detail.notPassedQty = Number(detail.receiveQty)-Number(detail.crackQty);; detail.goodQty = detail.qty; detail.inspectUser = this.$store.state.user.id detail.toInventoryStatus = "OK" diff --git a/pages/inspect/job/inspectResult.vue b/pages/inspect/job/inspectResult.vue index 3946deaa..7cb69a90 100644 --- a/pages/inspect/job/inspectResult.vue +++ b/pages/inspect/job/inspectResult.vue @@ -366,7 +366,7 @@ this.jobContent.subList.forEach(res => { res.handleQty = res.qty res.failedQty = 0; - res.notPassedQty = 0; + res.notPassedQty = res.failedQty; res.crackQty = 0; res.goodQty = res.qty; res.failedReason = ""; @@ -405,7 +405,7 @@ this.jobContent.subList.forEach(res => { res.handleQty = res.qty res.failedQty = res.qty; - res.notPassedQty = res.qty; + res.notPassedQty = res.failedQty; res.crackQty = 0; res.goodQty = 0; res.failedReason = ""; @@ -432,7 +432,7 @@ this.jobContent.subList.forEach(res => { res.handleQty = res.qty res.failedQty = 0; - res.notPassedQty = 0; + res.notPassedQty = res.failedQty; res.crackQty = 0; res.goodQty = res.qty; res.failedReason = ""; diff --git a/pages/issue/job/issueDetail.vue b/pages/issue/job/issueDetail.vue index 0e62f073..e60ac841 100644 --- a/pages/issue/job/issueDetail.vue +++ b/pages/issue/job/issueDetail.vue @@ -1,9 +1,13 @@ <template> <view class="page-wraper"> <view class="page-main"> - <!-- <view class="" style="padding: 15rpx;font-size: 35rpx; "> - 车间代码 : {{jobContent.workShopCode}} - </view> --> + <view style="margin: 5px;"> + <job-top :dataContent="jobContent"></job-top> + <view class="card_content"> + 申请单号 : {{jobContent.requestNumber}} + </view> + <u-line /> + </view> <scroll-view scroll-y="true" class=""> <view v-for="(toLocation, index) in detailSource"> @@ -62,6 +66,7 @@ import comScanIssuePack from '@/pages/issue/coms/comScanIssuePack.vue' import comMessage from '@/mycomponents/common/comMessage.vue' import comIssueRequestInfo from '@/pages/issue/coms/comIssueRequestInfo.vue' + import jobTop from '@/mycomponents/job/jobTop.vue' export default { name: 'issueDetail', @@ -71,7 +76,8 @@ comIssueDetailCard, comIssueRequestInfo, comScanIssuePack, - comMessage + comMessage, + jobTop }, data() { return { diff --git a/pages/productionReturn/coms/comReturnRequestCreator.vue b/pages/productionReturn/coms/comReturnRequestCreator.vue new file mode 100644 index 00000000..d083a7ff --- /dev/null +++ b/pages/productionReturn/coms/comReturnRequestCreator.vue @@ -0,0 +1,91 @@ +<template> + <view class=""> + <uni-collapse ref="collapse"> + <uni-collapse-item :open="true"> + <template v-slot:title> + <view class="" style="font-size: 32rpx;"> + <view class="" > + 车间 : {{dataContent.workShopName}} ({{dataContent.workshopCode}}) + </view> + + <view class=""> + 总数量 : {{dataContent.totalQty}} + </view> + </view> + + </template> + <u-line /> + <uni-swipe-action ref="swipeAction"> + <view v-for="(item, index) in dataContent.subList" :key="index"> + <uni-swipe-action-item> + <view class="" style="font-size: 32rpx;margin: 10rpx;"> + <view class=""> + 生产线 : {{item.productionLineName}}({{item.productionLineCode}}) + </view> + <view class=""> + 工位 : {{item.workStationName}} ({{item.workStationCode}}) + </view> + <view class=""> + 物品代码 : {{item.itemCode}} + </view> + <view class=""> + 物品名称 : {{item.itemName}} + </view> + + <view class="uni-flex uni-row uni-center"> + <view class=""> + 数量 : {{item.qty}} 单位 : + </view> + <view class=""> + <uom :uom="item.uom"></uom> + </view> + + </view> + + </view> + </uni-swipe-action-item> + <u-line /> + </view> + </uni-swipe-action> + + </uni-collapse-item> + </uni-collapse> + + + </view> +</template> + +<script> + import uom from '@/mycomponents/qty/uom.vue' + export default { + components: { + uom + }, + data() { + return { + + } + }, + props: { + dataContent: { + type: Object, + default: {} + }, + }, + methods: { + update(){ + this.$nextTick(r => { + this.$refs.collapse.resize() + }); + } + + + + + + } + } +</script> + +<style> +</style> diff --git a/pages/productionReturn/coms/comReturnRequestPopup.vue b/pages/productionReturn/coms/comReturnRequestPopup.vue new file mode 100644 index 00000000..1cb8c11f --- /dev/null +++ b/pages/productionReturn/coms/comReturnRequestPopup.vue @@ -0,0 +1,372 @@ +<template> + <view class=""> + <uni-popup ref="popup" :maskClick="false"> + <view class="uni-flex uni-column pop_customer"> + <view class="" style="padding:10rpx"> + <view class="uni-flex u-col-center uni-row space-between" style="padding: 10rpx 10rpx 20rpx 10rpx"> + <view class="" style="font-size: 35rpx;"> + {{title}} + </view> + <image style="width: 35rpx;height: 35rpx;" src="/static/icons/icons_close.svg" + @click="closeRequestPopup()"></image> + </view> + <u-line /> + <view class="uni-flex uni-column" style="background-color: white; "> + <view class="uni-flex uni-column "> + <view class="uni-flex uni-row padding title u-col-center"> + <text>位置 : </text> + <view class="uni-flex u-col-center uni-row" @click="showSelect"> + <view class="" style="margin-left: 20rpx;"> + {{positionInfo}} + </view> + <u-select v-model="show" mode="mutil-column-auto" :list="positionList" + @confirm="confirmSelect"></u-select> + </view> + + </view> + <u-line /> + + + <view class="title padding" style="display: flex;"> + <text style=" flex-shrink: 0;">物料:</text> + <view class="" style="width: 100% ;"> + {{itemCode}} + </view> + <view class=""> + <image src="/static/search.svg" mode="" + style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;" @click="itemCodeClick"> + </image> + </view> + + </view> + + <u-line /> + + <view class="uni-flex uni-row padding title u-col-center"> + <text>数量 : </text> + <view class="uni-flex uni-row uni-center" + style="align-items: center;margin-left: 20rpx;"> + <uni-number-box :value="counQty" @change="change" style='margin-left: 10rpx;' + :focus="numberFocus" @blur='numberFocus = false'> + </uni-number-box> + <uom :uom="uom"></uom> + + </view> + </view> + <u-line /> + </view> + </view> + </view> + <view class="uni-flex uni-row hide_border"> + <button class="btn_edit_big_cancle" hover-class="btn_edit_big_after" @click="cancel()">取消</button> + <button class="btn_edit_big_confirm" hover-class="btn_edit_big_after" @click="confirm()">确认</button> + </view> + </view> + </uni-popup> + <win-scan-item ref="scanPopup" title='物料代码' @getScanCode='getScanCode'> + </win-scan-item> + <comMessage ref="comMessage"></comMessage> + </view> +</template> + +<script> + import { + getBasicLocationByCode, + getBasicItemByCode, + getProductionlineItem, + getWorkShopLineStation + } from '@/api/request2.js'; + import { + getLocationTypeName, + getListLocationTypeDesc, + checkDirectoryItemExist + } from '@/common/directory.js'; + import uom from '@/mycomponents/qty/uom.vue' + import balanceStatus from '@/mycomponents/status/balanceStatus.vue' + import comMessage from '@/mycomponents/common/comMessage.vue' + import winScanItem from '@/mycomponents/scan/winScanItem.vue' + + + export default { + components: { + uom, + balanceStatus, + comMessage, + winScanItem + }, + data() { + return { + // itemCode: 'CE115F11161AG', + workshopCode: "", //车间 + workShopName: "", + productionLineCode: "", //生产线 + productionLineName: "", + workStationCode: "", //工位 + workStationName: "", + itemCode: '请扫描物料信息', + itemName: "", + qty: 0, + rawLocationCode: "", + fgLocationCode: "", + itemCodeFocus: false, + requestInfo: null, + itemCodeList: [], + isCheckItemCode: false, + counQty: 0, + editPosition: true, + numberFocus: false, + uom: "", + positionInfo: "请选择位置", + show: false, + isModifiedPosition: true, + positionList: [], + list: [{ + value: 1, + label: '车间1', + children: [{ + value: 2, + label: '生产线1', + children: [{ + value: 3, + label: '工位1' + }, + { + value: 4, + label: '工位2' + } + ] + }, + { + value: 5, + label: '生产线2', + children: [{ + value: 6, + label: '工位1' + }, + { + value: 7, + label: '工位2' + } + ] + } + ] + }, + { + value: 8, + label: '车间2', + children: [{ + value: 9, + label: '生产线1', + children: [{ + value: 10, + label: '工位1' + }, + { + value: 10, + label: '工位2' + } + ] + }, { + value: 9, + label: '生产线2', + children: [{ + value: 10, + label: '工位1' + }, + { + value: 10, + label: '工位2' + } + ] + }, + + + ] + } + ] + } + }, + props: { + title: { + type: String, + default: '需求信息' + }, + }, + methods: { + openRequestPopup(editPosition) { + if (this.positionList.length == 0) { + getWorkShopLineStation().then(res => { + this.positionList = res.data + }).catch(error => { + + }) + } + + this.editPosition = editPosition; + if (this.isModifiedPosition) { + this.isModifiedPosition = false + } else { + this.itemCode = ""; + this.uom = "" + this.qty = 0 + this.itemCodeGetFocus(); + } + + this.$refs.popup.open('bottom') + }, + closeRequestPopup() { + this.$refs.popup.close() + }, + locationConfirm() { + //查询库位信息 + this.checkLocatioCode(); + }, + itemCodeClick() { + this.$refs.scanPopup.openScanPopup(); + }, + + itemCodeGetFocus() { + this.itemCodeFocus = true; + }, + itemCodeLoseFocus() { + this.itemCodeFocus = false; + }, + selectedItem(item) { + this.itemCode = item.itemCode; + this.checkItemCode(); + }, + + confirm() { + if (this.itemCode == "" || !this.isCheckItemCode) { + this.showErrorMessage("请输入物料", "itemCode") + return + } + if (this.qty == 0) { + this.showErrorMessage("数量必须大于0") + return + } + + if (this.rawLocationCode == '') { + this.showErrorMessage(this.workStationName + "的原材料库位为空") + return + } + this.callback('add'); + }, + + checkItemCode(itemCode) { + //校验物料 + getBasicItemByCode(itemCode).then(res => { + uni.hideLoading(); + this.$refs.scanPopup.closeScanPopup(); + if (res.data != null && res.data.list.length > 0) { + this.itemCode = res.data.list[0].code; + this.itemName = res.data.list[0].name + this.isCheckItemCode = true; + this.numberFocus = true + this.uom = res.data.list[0].uom + } else { + this.showErrorMessage('未查找到物料【' + this.itemCode + '】', "itemCode"); + } + + }).catch(error => { + uni.hideLoading(); + this.showErrorMessage(error, "itemCode"); + }) + }, + + + callback(action) { + let item = { + positionInfo: this.positionInfo, + workshopCode: this.workshopCode, //车间 + workShopName: this.workShopName, + productionLineCode: this.productionLineCode, //生产线 + productionLineName: this.productionLineName, + workStationCode: this.workStationCode, //工位 + workStationName: this.workStationName, + rawLocationCode: this.rawLocationCode, + fgLocationCode: this.fgLocationCode, + itemCode: this.itemCode, + itemName: this.itemName, + uom: this.uom, + qty: this.qty + }; + this.closeRequestPopup(); + this.$emit("confirm", action, item); + }, + + showErrorMessage(message, type) { + setTimeout(r => { + this.$refs.comMessage.showErrorMessage(message, res => { + if (type == "itemCode") { + this.itemCodeGetFocus(); + } else { + this.numberFocus = true; + } + }) + if (type == "itemCode") { + this.itemCode = "" + this.isCheckItemCode = false; + } + }) + }, + change(value) { + this.qty = value; + }, + cancel(e) { + this.closeRequestPopup(); + }, + showSelect() { + if (this.editPosition) { + this.show = true + } + + }, + confirmSelect(e) { + this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label + console.log("位置", this.positionInfo) + this.workshopCode = e[0].value + this.productionLineCode = e[1].value + this.workStationCode = e[2].value + this.workShopName = e[0].label + this.productionLineName = e[1].label + this.workStationName = e[2].label + + let shop = this.positionList.find(shop => shop.value == this.workshopCode); + if (shop != undefined && shop.children != undefined) { + let prodLine = shop.children.find(line => line.value == this.productionLineCode); + if (prodLine != undefined && prodLine.children != undefined) { + let station = prodLine.children.find(r => r.value == this.workStationCode); + if (station.rawLocationCode == '' && station.rawLocationCode == null) { + this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择") + return; + } else { + this.rawLocationCode = station.rawLocationCode; + this.fgLocationCode = station.fgLocationCode; + } + } else { + this.showErrorMessage("生产线-工位基础信息维护错误") + } + } else { + this.showErrorMessage("车间-生产线基础信息维护错误") + } + }, + + getScanCode(code) { + if (code == "") { + this.showErrorMessage('物料号不能为空') + return; + } + this.itemCode = ""; + this.checkItemCode(code) + }, + + } + } +</script> + +<style lang="scss"> + .title { + font-size: 30rpx; + } +</style> diff --git a/pages/productionReturn/coms/comScanReturnPack.vue b/pages/productionReturn/coms/comScanReturnPack.vue new file mode 100644 index 00000000..1b2bc367 --- /dev/null +++ b/pages/productionReturn/coms/comScanReturnPack.vue @@ -0,0 +1,508 @@ +<template> + <view> + <uni-popup ref="popup" :maskClick='false'> + <view class=""> + <view class="popup_box"> + <view class="pop_title"> + 扫描箱码 + <text class="fr" @click="closeScanPopup()">关闭</text> + </view> + <!-- <view class="uni-flex uni-row" style="align-items: center; + background-color: #fff; + margin-left: 20rpx; + margin-right: 20rpx; + padding:20rpx; + border-radius: 8rpx;"> + <view class="uni-center"> + 位置 : + </view> + <view class="" style="width: 75%;padding: 0rpx"> + <view class="uni-flex u-col-center uni-row" @click="showSelect"> + <view class="" style="margin-left: 15rpx;font-size: 30rpx;"> + {{positionInfo}} + </view> + <u-select v-model="show" mode="mutil-column-auto" :list="positionList" :defaultValue="defaultValueList" + @confirm="confirmSelect"></u-select> + </view> + </view> + </view> --> + <!-- <u-line class='line_color'></u-line> --> + + <view class="uni-flex uni-row" style="align-items: center; + background-color: #fff; + margin-left: 20rpx; + margin-right: 20rpx; + margin-top: 8rpx; + border-radius: 8rpx;"> + <view class="uni-center" style="width: 25%; "> + 来源库位 + </view> + <view class="" style="width: 75%; padding: 8rpx;"> + <uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" + @confirm="fromLocationUpdate"></uni-combox> + </view> + </view> + + <view class=""> + <view class=""> + <win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" + :isShowHistory="false"> + </win-com-scan> + + <view style="width: 100%;"> + <view style="width: 100%;" v-if="issueRecord.length>0"> + <view class="uni-flex uni-row space-between u-col-center"> + <view class="" style="padding: 10rpx;"> + 历史记录 + </view> + <view class="" style="padding-right: 10rpx;"> + <u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon> + </view> + </view> + <u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'> + </u-line> + <scroll-view scroll-y="true" class="scroll-view" + v-if="expand&&issueRecord.length>0"> + <view class="uni-flex u-col" v-for="(record,index) in issueRecord"> + <view style="width: 100%;"> + <uni-swipe-action ref="swipeAction"> + <uni-swipe-action-item @click="swipeClick($event,record,index)" + :right-options="scanOptions"> + <view style="padding: 0px 10px"> + <balance :dataContent="record" :isShowLocation="false" + :isShowStdPack="false"></balance> + </view> + </uni-swipe-action-item> + </uni-swipe-action> + <u-line class='line_color'></u-line> + </view> + </view> + </scroll-view> + </view> + </view> + </view> + </view> + </view> + </view> + </uni-popup> + <balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> + <com-message ref="comMessage"></com-message> + <balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> + </view> +</template> + +<script> + import comMessage from '@/mycomponents/common/comMessage.vue' + import winComScan from '@/mycomponents/scan/winComScan.vue' + import balance from '@/mycomponents/balance/balance.vue' + import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue' + import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' + + import { + getDetailOption, + getDetailEditRemoveOption + } from '@/common/array.js'; + import { + getWorkShopLineStation + } from '@/api/request2.js'; + + import { + getBalanceByManagementPrecision + } from '@/common/balance.js'; + + export default { + name: 'winScanPack', + components: { + comMessage, + winComScan, + balance, + balanceQtyEdit, + balanceSelect + }, + props: { + title: { + type: String, + default: '' + }, + + }, + data() { + return { + dataContent: {}, + jobContent: {}, + expendIcon: 'arrow-down', + show: false, + scanList: [], + toLocation: null, + toLocationCode: '', + fromLocationList: [], + fromLocationCode: '', + fromLocation: null, + issueRecord: [], //发料历史 + expand: true, + scanOptions: {}, + editItem: {}, + positionInfo: "请选择位置", + positionList: [], + defaultValueList: [], + fromInventoryStatuses :"", + } + }, + created() { + + }, + watch: {}, + mounted() { + this.detailOptions = getDetailOption(); + this.scanOptions = getDetailEditRemoveOption(); + }, + methods: { + + + openScanPopup(content, jobcontent) { + this.issueRecord = []; + this.dataContent = content; + this.jobContent = jobcontent; + this.initData(); + // this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode + + // "-" + this.jobContent.subList[0].workStationCode + this.$refs.popup.open('bottom'); + }, + + closeScanPopup() { + this.$refs.popup.close(); + this.$emit("closeScan") + //清除数据,恢复默认值 + // Object.assign(this.$data, this.$options.data()); + }, + + initData() { + let that = this; + that.fromLocationList = []; + if (that.dataContent != null) { + that.fromInventoryStatuses = this.jobContent.outInventoryStatuses + that.toLocation = that.dataContent[0]; + that.toLocationCode = that.dataContent[0].toLocationCode; + that.fromLocationList = that.getFromLocationList(); + } + }, + showBalanceSelect(items) { + this.$refs.balanceSelect.openPopup(items); + }, + + getFromLocationList() { + let list = []; + let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode); + if (location != undefined) { + location.Items.forEach(item => { + item.Locations.forEach(f => { + list.push(f.fromLocationCode) + }) + }) + this.fromLocationCode = list[0]; + return list; + } else { + this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => { + this.toLocationCode = ''; + }); + } + }, + + fromLocationUpdate(fromlocation) { + let location = this.fromLocationList.find(r => r == fromlocation) + if (location == undefined) { + this.fromLocationCode = '' + this.showErrorMessage('发料库位【' + fromlocation + '】不存在') + } + }, + onScan(result) { + try { + let that = this; + + if (that.fromLocationCode == '') { + that.showErrorMessage('请选择来源库位', res => { + that.$refs.toLocationCombox.onFocus(); + }); + return; + } + let packageInfo = result.package; + let itemCode = result.label.itemCode; + let packingCode = result.label.packingNumber; + let lot = result.label.batch; + let item = that.toLocation.Items.find(r => r.itemCode == itemCode); + if (item == undefined) { + that.showErrorMessage('未查找到零件【' + itemCode + '】的发料明细', + res => { + that.getfocus(); + } + ) + return; + } else { + //查找库存信息 + uni.showLoading({ + title: '加载中', + mask: true + }) + getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses, balanceRes => { + if (balanceRes.success) { + if (balanceRes.data.list.length == 0) { + this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录', + res => { + this.packGetFocus(); + }) + } else if (balanceRes.data.list.length == 1) { + let balance = balanceRes.data.list[0]; + this.afterGetBalance(result.label, balance,packageInfo); + } else { + this.showBalanceSelect(balanceRes.data.list); + } + } else { + this.showErrorMessage(balanceRes.message.message); + } + uni.hideLoading(); + }); + } + } catch (e) { + this.showErrorMessage(e.stack) + uni.hideLoading(); + } + }, + selectBalanceItem(balance) { + this.afterGetBalance(this.label, balance); + }, + + afterGetBalance(label, balance,packageInfo) { + try { + let that = this; + let itemCode = label.itemCode; + let packingCode = label.packingNumber; + let lot = label.batch; + let item = that.toLocation.Items.find(r => r.itemCode == itemCode); + let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); + if (fromLocation != undefined) { + let batch = fromLocation.Batchs.find(r => r.batch == lot); + if (batch != undefined) { + if (batch.Records == undefined) { + batch.Records = []; + } + + let record = batch.Records.find(r => r.packingNumber == packingCode); + if (record == undefined) { + //如果有推荐箱码 + if (batch.Recommends.length > 0) { + let recommend = batch.Recommends.find(r => r.packingNumber == packingCode); + if (recommend != undefined) { + that.addRecord(batch, label, balance,packageInfo) + } else { + //允许修改箱码 + if (this.jobContent.allowModifyPackingNumber == 'TRUE') { + that.addRecord(batch, label, balance,packageInfo); + } else { + that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', + res => { + that.getfocus(); + } + ) + } + } + } else { + that.addRecord(batch, label, balance,packageInfo) + } + } else { + that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', + res => { + that.getfocus(); + } + ) + } + } else { + if (this.jobContent.AllowModifyBatch == null) { + this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot + + '】的发料明细,是否要继续发料?', res => { + if (res) { + let batch = that.createBatchInfo(label, balance); + fromLocation.Batchs.unshift(batch); + } + }) + } else { + that.showErrorMessage('未查找到批次【' + lot + '】的发料明细', + res => { + that.getfocus(); + }); + } + } + } else { + that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发料明细', + res => { + that.getfocus(); + } + ) + } + } catch (e) { + that.showErrorMessage(e.stack, + res => { + that.getfocus(); + } + ) + } + }, + + createBatchInfo(data, balance) { + let batch = { + batch: data.lot, + qty: 0, + uom: data.uom, + handleQty: Number(data.qty), + Records: [] + } + let record = this.creatRecord(data, balance); + batch.Records.push(record); + this.issueRecord.unshift(record) + return batch; + }, + + creatRecord(label, balance,packageInfo) { + balance.stdPackQty = packageInfo.stdPackQty + balance.stdPackUnit = packageInfo.stdPackUnit + let record = { + itemCode: label.itemCode, + packingNumber: label.packingNumber, + batch: label.batch, + qty: Number(label.qty)>Number(balance.qty)?Number(balance.qty):Number(label.qty), + uom: balance.uom, + inventoryStatus: balance.inventoryStatus, + balance: balance, + toLocationCode: this.toLocationCode, + supplierCode: label.supplierCode + } + return record; + }, + + calcBatchHandleQty(batch) { + let handleQty = 0; + batch.Records.forEach(res => { + handleQty += Number(res.qty) + }) + batch.handleQty = handleQty; + }, + + addRecord(batch, label, balance,packageInfo) { + let record = this.creatRecord(label, balance,packageInfo); + batch.Records.push(record); + this.issueRecord.unshift(record) + this.calcBatchHandleQty(batch); + this.getfocus(); + }, + + getfocus() { + if (this.$refs.comscan != undefined) { + this.$refs.comscan.getfocus(); + } + }, + + losefocus() { + if (this.$refs.comscan != undefined) { + this.$refs.comscan.losefocus(); + } + }, + + expands() { + this.expand = !this.expand; + this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up" + }, + + swipeClick(e, item, index) { + if (e.content.text == "详情") { + this.detail(item) + } else if (e.content.text == "编辑") { + this.edit(item) + } else if (e.content.text == "移除") { + this.remove(item, index) + } + }, + edit(item) { + this.editItem = item; + // item.balance.balanceQty = item.balance.qty; + item.balance.balanceQty = item.balance.qty; + this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty); + }, + + detail(item) { + this.showItem = item; + this.$refs.receiptHint.openScanPopup() + }, + remove(record, index) { + this.showQuestionMessage("确定移除扫描信息?", + res => { + if (res) { + record.qty = 0; + this.issueRecord.splice(index, 1) + + let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode); + if (item != undefined) { + item.Locations.forEach(l => { + let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b + .batch == record.batch); + let rIndex = batch.Records.findIndex(r => r.packingNumber == record + .packingNumber && r + .batch == record.batch); + batch.Records.splice(rIndex, 1); + }) + } + this.$emit('updateData', item); + } + }); + }, + + packGetFocus() { + this.$refs.comscan.getfocus(); + }, + packLoseFocus() { + this.$refs.comscan.losefocus(); + }, + showMessage(message, callback) { + setTimeout(r => { + this.packLoseFocus(); + this.$refs.comMessage.showMessage(message, callback); + }) + }, + showErrorMessage(message, callback) { + setTimeout(r => { + this.packLoseFocus(); + this.$refs.comMessage.showErrorMessage(message, callback); + + }) + }, + showQuestionMessage(message, callback) { + setTimeout(r => { + this.packLoseFocus(); + this.$refs.comMessage.showQuestionMessage(message, callback); + }) + }, + confirm(val) { + this.editItem.qty = Number(val); + this.$emit('updateData', this.editItem) + }, + cancle() { + this.closeScanPopup() + } + } + } +</script> + +<style lang="scss"> + button { + border: none; + } + + button::after { + border: none + } + + .scroll-view { + overflow-y: scroll; + height: auto; + max-height: 300rpx; + padding: 10rpx; + } +</style> diff --git a/pages/productionReturn/request/returnToHoldRequest.vue b/pages/productionReturn/request/returnToHoldRequest.vue index b763866e..f46e1b77 100644 --- a/pages/productionReturn/request/returnToHoldRequest.vue +++ b/pages/productionReturn/request/returnToHoldRequest.vue @@ -35,6 +35,11 @@ } from '@/common/record.js'; import { getProductionReturnRequestList, + productionReturnRequestHandle, + productionReturnRequestSubmitApprove, + productionReturnRequestSubmitApproveAgree, + productionReturnRequestSubmitApproveRefused, + productionReturnRequestClose } from '@/api/request2.js'; import { goHome, @@ -73,7 +78,7 @@ detailAndHandleOption: [], detailAndCloseOption: [], showOptions: [], - fromType: "requestType", + fromType: "ReturnToHold", loadingType: "nomore", businessCode: "ReturnToHold" @@ -115,7 +120,6 @@ }, methods: { - requestConfirm(action, item) {}, openRequestInfoPopup(item) { this.$refs.requestInfoPopup.openPopup(item) @@ -149,6 +153,7 @@ action: "==", value: this.businessCode }) + var params = { filters: filters, pageNo: this.pageNo, @@ -174,13 +179,13 @@ this.requestList = type === "refresh" ? list : this.requestList.concat(list); this.pageNo++; - updateTitle("生产隔离退料申请(" + this.totalCount + ")"); + updateTitle("生产合格退料申请(" + this.totalCount + ")"); }).catch(error => { if (type === "refresh") { uni.stopPullDownRefresh(); } - updateTitle("生产隔离退料申请"); + updateTitle("生产合格退料申请"); this.loadingType = ""; uni.hideLoading(); that.showMessage(error) @@ -205,27 +210,47 @@ openScanDetailPopup() { uni.navigateTo({ - url: "../record/returnToHold?fromType=" + this.fromType + url: "./returnToStoreRequestSubmit?fromType=" + this.fromType }) }, - swipeClick(e, dataContent) { + var text = clearTirmAndWrap(e.content.text) if (e.content.text == "详情") { - console.log("详情", dataContent.id) this.openRequestInfoPopup(dataContent); } else if (e.content.text == "处理") { - console.log("处理") + this.showQuestionMessage("确定要处理当前申请吗?",res=>{ + this.productionReturnRequestHandle(dataContent.id) + }) } else if (e.content.text == "审批") { - console.log("审批") + this.showQuestionMessage("确定要审批当前申请吗?",res=>{ + this.productionReturnRequestSubmitApprove(dataContent.id) + }) } else if (e.content.text == "审批通过") { - console.log("审批通过") + this.showQuestionMessage("确定要审批通过当前申请吗?",res=>{ + this.productionReturnRequestSubmitApproveAgree(dataContent.id) + }) } else if (e.content.text == "审批驳回") { - console.log("审批驳回") + this.showQuestionMessage("确定要审批驳回当前申请吗?",res=>{ + this.productionReturnRequestSubmitApproveRefused(dataContent.id) + }) } else if (e.content.text == "关闭") { - console.log("关闭") + this.showQuestionMessage("确定要关闭当前申请吗?",res=>{ + this.productionReturnRequestClose(dataContent.id) + }) } }, + + showQuestionMessage(hint,callBack){ + this.$refs.comMessage.showQuestionMessage(hint, + res => { + if (res) { + callBack() + } + }); + }, + + switchChangeWait(state, jobStatus) { this.checkedWaitTask = state; this.status = jobStatus; @@ -274,6 +299,82 @@ } }); }, + productionReturnRequestSubmitApprove(id) { + productionReturnRequestSubmitApprove(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请提交审批成功" + }) + } else { + this.showMessage("申请提交审批失败") + } + + }).catch(error => { + this.showMessage(error) + }) + + }, + productionReturnRequestClose(id) { + productionReturnRequestClose(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请关闭成功" + }) + } else { + this.showMessage("申请关闭失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, + productionReturnRequestSubmitApproveAgree(id) { + productionReturnRequestSubmitApproveAgree(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请审批通过成功" + }) + } else { + this.showMessage("申请审批通过失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, + productionReturnRequestSubmitApproveRefused(id) { + productionReturnRequestSubmitApproveRefused(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请审批驳回成功" + }) + } else { + this.showMessage("申请审批驳回失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, + productionReturnRequestHandle(id) { + productionReturnRequestHandle(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请处理成功" + }) + } else { + this.showMessage("申请处理失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, } } diff --git a/pages/productionReturn/request/returnToStoreRequest.vue b/pages/productionReturn/request/returnToStoreRequest.vue index cfd869bf..9c7ebbfe 100644 --- a/pages/productionReturn/request/returnToStoreRequest.vue +++ b/pages/productionReturn/request/returnToStoreRequest.vue @@ -35,6 +35,11 @@ } from '@/common/record.js'; import { getProductionReturnRequestList, + productionReturnRequestHandle, + productionReturnRequestSubmitApprove, + productionReturnRequestSubmitApproveAgree, + productionReturnRequestSubmitApproveRefused, + productionReturnRequestClose } from '@/api/request2.js'; import { goHome, @@ -73,7 +78,7 @@ detailAndHandleOption: [], detailAndCloseOption: [], showOptions: [], - fromType: "requestType", + fromType: "ReturnToStore", loadingType: "nomore", businessCode: "ReturnToStore" @@ -205,27 +210,47 @@ openScanDetailPopup() { uni.navigateTo({ - url: "../record/returnToStore?fromType=" + this.fromType + url: "./returnToStoreRequestSubmit?fromType=" + this.fromType }) }, - swipeClick(e, dataContent) { + var text = clearTirmAndWrap(e.content.text) if (e.content.text == "详情") { - console.log("详情", dataContent.id) this.openRequestInfoPopup(dataContent); } else if (e.content.text == "处理") { - console.log("处理") + this.showQuestionMessage("确定要处理当前申请吗?",res=>{ + this.productionReturnRequestHandle(dataContent.id) + }) } else if (e.content.text == "审批") { - console.log("审批") + this.showQuestionMessage("确定要审批当前申请吗?",res=>{ + this.productionReturnRequestSubmitApprove(dataContent.id) + }) } else if (e.content.text == "审批通过") { - console.log("审批通过") + this.showQuestionMessage("确定要审批通过当前申请吗?",res=>{ + this.productionReturnRequestSubmitApproveAgree(dataContent.id) + }) } else if (e.content.text == "审批驳回") { - console.log("审批驳回") + this.showQuestionMessage("确定要审批驳回当前申请吗?",res=>{ + this.productionReturnRequestSubmitApproveRefused(dataContent.id) + }) } else if (e.content.text == "关闭") { - console.log("关闭") + this.showQuestionMessage("确定要关闭当前申请吗?",res=>{ + this.productionReturnRequestClose(dataContent.id) + }) } }, + + showQuestionMessage(hint,callBack){ + this.$refs.comMessage.showQuestionMessage(hint, + res => { + if (res) { + callBack() + } + }); + }, + + switchChangeWait(state, jobStatus) { this.checkedWaitTask = state; this.status = jobStatus; @@ -274,6 +299,82 @@ } }); }, + productionReturnRequestSubmitApprove(id) { + productionReturnRequestSubmitApprove(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请提交审批成功" + }) + } else { + this.showMessage("申请提交审批失败") + } + + }).catch(error => { + this.showMessage(error) + }) + + }, + productionReturnRequestClose(id) { + productionReturnRequestClose(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请关闭成功" + }) + } else { + this.showMessage("申请关闭失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, + productionReturnRequestSubmitApproveAgree(id) { + productionReturnRequestSubmitApproveAgree(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请审批通过成功" + }) + } else { + this.showMessage("申请审批通过失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, + productionReturnRequestSubmitApproveRefused(id) { + productionReturnRequestSubmitApproveRefused(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请审批驳回成功" + }) + } else { + this.showMessage("申请审批驳回失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, + productionReturnRequestHandle(id) { + productionReturnRequestHandle(id).then(res => { + if (res.data) { + this.getList("refresh") + uni.showToast({ + title: "申请处理成功" + }) + } else { + this.showMessage("申请处理失败") + } + + }).catch(error => { + this.showMessage(error) + }) + }, } } diff --git a/pages/productionReturn/request/returnToStoreRequestSubmit.vue b/pages/productionReturn/request/returnToStoreRequestSubmit.vue new file mode 100644 index 00000000..28d6b4c6 --- /dev/null +++ b/pages/productionReturn/request/returnToStoreRequestSubmit.vue @@ -0,0 +1,198 @@ +<template> + <view class="page-wraper"> + <view class="" v-if='detailSource.subList.length==0'> + <com-blank-view @goScan='goScan(true)'></com-blank-view> + </view> + <view v-else class="page-wraper"> + <view class="page-main"> + <comReturnRequestCreator ref="issueRequest" :dataContent="detailSource"> + </comReturnRequestCreator> + <button class="btn_add" @click="goScan(false)">+去添加</button> + </view> + + <div class="btn_bottom"> + <view class="" style="display: flex;flex-direction: row;"> + <view class=""> + <button class="btn_commit" hover-class="btn_commit_after" @click="submit()">提交</button> + </view> + </view> + </div> + + <comScanReturnPack ref="comScanIssuePack"> + </comScanReturnPack> + <comMessage ref="comMessage"></comMessage> + </view> + </view> + <comReturnRequestPopup ref="comIssueRequestPopup" @confirm='requestConfirm'></comReturnRequestPopup> +</template> + +<script> + import { + productionReturnRequestCreate, + } from '@/api/request2.js'; + + import { + goHome, + updateTitle, + navigateBack, + getRemoveOption, + } from '@/common/basic.js'; + + import comBlankView from '@/mycomponents/common/comBlankView.vue' + import comReturnRequestPopup from '@/pages/productionReturn/coms/comReturnRequestPopup.vue' + import jobDetailPopup from '@/mycomponents/job/jobDetailPopup.vue' + import comScanReturnPack from '@/pages/productionReturn/coms/comScanReturnPack.vue' + import comMessage from '@/mycomponents/common/comMessage.vue' + import comReturnRequestCreator from '@/pages/productionReturn/coms/comReturnRequestCreator.vue' + + export default { + name: '', + components: { + comBlankView, + comReturnRequestPopup, + jobDetailPopup, + comScanReturnPack, + comMessage, + comReturnRequestCreator + }, + data() { + return { + jobContent: {}, //任务内容 + subList: [], //接口返回的任务subList + detailSource: { + subList: [] + }, //绑定在页面上的数据源 + detailOptions: [], + scanOptions: [], + requestList: [], //需求信息 + fromType: '', + title: "" + + } + }, + mounted() { + this.goScan(true) + }, + onLoad(option) { + this.fromType = option.fromType + if (this.fromType == 'ReturnToStore') { + this.title = "生产合格退料申请" + } else if (this.fromType == 'ReturnToHold') { + this.title = "生产隔离退料申请" + } + updateTitle(this.title) + + }, + methods: { + goScan(editPosition) { + this.$refs.comIssueRequestPopup.openRequestPopup(editPosition); + }, + + //确定需求信息 + requestConfirm(action, item) { + + if (this.detailSource.subList.length == 0) { + this.detailSource = { + workshopCode: item.workshopCode, + status: "1", + totalQty: 0, + subList: [] + } + var subItem = { + productionLineCode: item.productionLineCode, + workStationCode: item.workStationCode, + itemCode: item.itemCode, + itemName: item.itemName, + inventoryStatus:"OK", + batch:"000000", + packingNumber:"", + fromLocationCode:item.rawLocationCode, + qty: item.qty, + uom: item.uom + } + this.detailSource.subList.push(subItem) + } else { + var result = this.detailSource.subList.filter(res => { + if (res.itemCode == item.itemCode) { + return res + } + }) + + //没有添加数据 + if (result.length == 0) { + var subItem = { + productionLineCode: item.productionLineCode, + workStationCode: item.workStationCode, + itemCode: item.itemCode, + itemName: item.itemName, + qty: item.qty, + uom: item.uom + } + + this.detailSource.subList.push(subItem) + + } else { + //有了更新数据 + result[0].qty += item.qty + + } + } + this.caclcQty(); + if (this.$refs.issueRequest != undefined) { + this.$refs.issueRequest.update() + } + }, + + caclcQty() { + var totalQty = 0; + this.detailSource.subList.forEach(res => { + totalQty += res.qty + }) + this.detailSource.totalQty = totalQty; + }, + + setParams() { + if(this.fromType=="ReturnToStore"){ + this.detailSource.isOK = true + }else if(this.fromType=="ReturnToHold"){ + this.detailSource.isOK = false + }else { + this.detailSource.isOK = false + } + return this.detailSource + }, + submit() { + uni.showLoading({ + title: "提交中....", + mask: true + }); + var params = this.setParams() + console.log("提交参数", JSON.stringify(params)); + // productionReturnRequestCreate(params).then(res => { + // uni.hideLoading() + // if (res.data) { + // this.showCommitSuccessMessage("提交成功<br>生成发料申请" + res.data) + // } else { + // this.showErrorMessage("提交失败[" + res.msg + "]") + // } + // }).catch(error => { + // uni.hideLoading() + // this.showErrorMessage(error) + // }) + }, + showCommitSuccessMessage(hint) { + this.$refs.comMessage.showSuccessMessage(hint, res => { + navigateBack(1) + }) + }, + showErrorMessage(message) { + this.$refs.comMessage.showErrorMessage(message, res => { + if (res) {} + }); + }, + } + } +</script> + +<style> +</style> diff --git a/pages/putaway/coms/comPutawayJobCard.vue b/pages/putaway/coms/comPutawayJobCard.vue index 6da43026..4f19c5d3 100644 --- a/pages/putaway/coms/comPutawayJobCard.vue +++ b/pages/putaway/coms/comPutawayJobCard.vue @@ -12,19 +12,10 @@ <view class="task_item"> <view class="task_text"> <view class=""> - 客户名称 : {{dataContent.customerName}} + 客户代码 : {{dataContent.supplierCode}} </view> </view> </view> - - <view class="task_item"> - <view class="task_text"> - <view class=""> - 物品代码 : {{dataContent.itemCode}} - </view> - </view> - </view> - </view> </job-com-main-card> </template> diff --git a/pages/putaway/job/putawayDetail.vue b/pages/putaway/job/putawayDetail.vue index 83281c14..225a0933 100644 --- a/pages/putaway/job/putawayDetail.vue +++ b/pages/putaway/job/putawayDetail.vue @@ -1,5 +1,12 @@ <template> <view class="page-wraper"> + <view style="margin: 5px;"> + <job-top :dataContent="jobContent"></job-top> + <view class="card_content"> + 申请单号 : {{jobContent.requestNumber}} + </view> + <u-line /> + </view> <view class="page-main"> <scroll-view scroll-y="true" class="page-main-scroll"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> @@ -15,7 +22,6 @@ </view> - <view class="page-footer"> <view class="uni-flex u-col-center space-between padding_10" style="background-color:ghostwhite; width: 100%; "> @@ -74,7 +80,9 @@ import comDetailCard from "@/mycomponents/detail/comDetailCard.vue" import putawayDetailInfoPopup from '@/pages/putaway/coms/putawayDetailInfoPopup.vue' import comMessage from '@/mycomponents/common/comMessage.vue' - + import jobTop from '@/mycomponents/job/jobTop.vue' + + export default { components: { winScanButton, @@ -82,7 +90,8 @@ requiredLocation, comDetailCard, putawayDetailInfoPopup, - comMessage + comMessage, + jobTop }, data() { return { diff --git a/static/config.json b/static/config.json index 4f688e61..471c6bba 100644 --- a/static/config.json +++ b/static/config.json @@ -18,7 +18,7 @@ "request_url": { "name": "request_url", - "value": "http://dev.ccwin-in.com:25100/api/admin-api", + "value": "http://192.168.0.178:12080/admin-api", "dev2": "http://192.168.0.157:12080/admin-api", "chefang": "http://192.168.0.178:12080/admin-api", "chenxinming": "http://192.168.0.230:12080/admin-api",