| | |
| | | import { |
| | | config |
| | | } from '../../common/config'; |
| | | import message from '../../tuniao-ui/libs/function/message'; |
| | | const innerAudioContext = uni.createInnerAudioContext(); |
| | | export default { |
| | | data() { |
| | |
| | | endTypeRange: [], |
| | | sns: "", |
| | | receiveOrderId: 0, |
| | | warehouseId:"" |
| | | warehouseId:"", |
| | | toastQueue: [], // æç¤ºéå |
| | | isShowingToast: false |
| | | } |
| | | }, |
| | | |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | showToast(options) { |
| | | this.toastQueue.push(options); |
| | | this.processToastQueue(); |
| | | }, |
| | | |
| | | // å¤çæç¤ºéå |
| | | processToastQueue() { |
| | | // 妿æ£å¨æ¾ç¤ºæç¤ºæéå为空ï¼å䏿§è¡ |
| | | if (this.isShowingToast || this.toastQueue.length === 0) return; |
| | | |
| | | this.isShowingToast = true; |
| | | const toastOptions = this.toastQueue.shift(); |
| | | |
| | | // æ¾ç¤ºæç¤º |
| | | this.$refs.uToast.show({ |
| | | ...toastOptions, |
| | | complete: () => { |
| | | // æç¤ºå
³éåå¤çä¸ä¸ä¸ª |
| | | this.isShowingToast = false; |
| | | this.processToastQueue(); |
| | | } |
| | | }); |
| | | }, |
| | | inputDialogToggle(itemCode) { |
| | | this.itemCode = itemCode; |
| | | this.$refs.inputDialog.open() |
| | |
| | | }); |
| | | }, |
| | | submit() { |
| | | if (this.sns == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æå
ç®±æ ç¾", |
| | | type: 'error' |
| | | // æåçäº§æ¥æï¼æ ¼å¼ä¸º"çäº§æ¥æï¼YYYY-MM"ï¼ |
| | | const productionDateStr = this.ProductionDate.replace('çäº§æ¥æï¼', ''); |
| | | if (!productionDateStr) { |
| | | this.showToast({ |
| | | title: "æªè·åå°çäº§æ¥æ", |
| | | type: 'error' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // è§£æçäº§æ¥æçå¹´æ |
| | | const [prodYear, prodMonth] = productionDateStr.split('-').map(Number); |
| | | |
| | | // è·åå½åæ¥æçå¹´æ |
| | | const currentDate = new Date(); |
| | | const currentYear = currentDate.getFullYear(); |
| | | const currentMonth = currentDate.getMonth() + 1; |
| | | |
| | | // æ¯è¾å¹´ææ¯å¦ä¸è´ |
| | | const isDateMismatch = prodYear !== currentYear || prodMonth !== currentMonth; |
| | | if (isDateMismatch) { |
| | | this.showToast({ |
| | | title: "è¯¥ç©æçäº§æ¥æçå¹´æä¸å½åå¹´æä¸ä¸è´", |
| | | type: 'warning', |
| | | duration: 1500 |
| | | }); |
| | | } |
| | | |
| | | // åæç确认æ¶è´§é»è¾ |
| | | if (this.sns == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "è¯·æ«æå
ç®±æ ç¾", |
| | | type: 'error' |
| | | }) |
| | | return; |
| | | } |
| | | if (this.Quantity == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "请è¾å
¥å®é
æ°é", |
| | | type: 'error' |
| | | }) |
| | | return; |
| | | } |
| | | if(this.warehouseId==2){ |
| | | //æ¿æ¢æå®ä¸¤ä¸ªå符é´çå符 |
| | | this.sns = this.sns.replace(/(Q:)([^,PO]+)(,PO)/, (match, p1, p2, p3) => { |
| | | return p1 + this.Quantity + p3; |
| | | }); |
| | | } |
| | | const sendRequest = () => { |
| | | this.$u.post('/api/ReceiveOrderDetail/AddReceiveOrderDetail?serNum=' + this.sns + '&orderNo=' + this |
| | | .orderNo, {}).then(res => { |
| | | if (res.status) { |
| | | this.PurchaseOrderNo="éè´åå·ï¼"; |
| | | this.matCode="ç©æç¼ç ï¼"; |
| | | this.LotNo="ç©ææ¹æ¬¡ï¼"; |
| | | this.orderQty="è®¢åæ°éï¼"; |
| | | this.ProductionDate="çäº§æ¥æï¼"; |
| | | this.EffectiveDate="æææ¥æï¼"; |
| | | this.Quantity=""; |
| | | setTimeout(() => { |
| | | this.innerCode=""; |
| | | this.focus=false; |
| | | }, 100); |
| | | this.orderInfo=[]; |
| | | this.sns = ""; |
| | | this.$refs.uToast.show({ |
| | | title:"确认æ¶è´§æå", |
| | | type: "success" |
| | | }) |
| | | } else { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }) |
| | | } |
| | | }) |
| | | return; |
| | | |
| | | }; |
| | | // å¦æææ¥æä¸å¹é
æç¤ºï¼çå¾
æç¤ºå®æååéè¯·æ± |
| | | if (isDateMismatch) { |
| | | setTimeout(sendRequest, 1500); // çå¾
1.5ç§ï¼ä¸æç¤ºæ¶é¿ä¸è´ï¼ |
| | | } else { |
| | | sendRequest(); // æ²¡ææ¥ææç¤ºï¼ç«å³åéè¯·æ± |
| | | } |
| | | if (this.Quantity == "") { |
| | | this.$refs.uToast.show({ |
| | | title: "请è¾å
¥å®é
æ°é", |
| | | type: 'error' |
| | | }) |
| | | return; |
| | | } |
| | | if(this.warehouseId==2){ |
| | | //æ¿æ¢æå®ä¸¤ä¸ªå符é´çå符 |
| | | this.sns = this.sns.replace(/(Q:)([^,PO]+)(,PO)/, (match, p1, p2, p3) => { |
| | | return p1 + this.Quantity + p3; |
| | | }); |
| | | } |
| | | this.$u.post('/api/ReceiveOrderDetail/AddReceiveOrderDetail?serNum=' + this.sns + '&orderNo=' + this |
| | | .orderNo, {}).then(res => { |
| | | if (res.status) { |
| | | this.PurchaseOrderNo="éè´åå·ï¼"; |
| | | this.matCode="ç©æç¼ç ï¼"; |
| | | this.LotNo="ç©ææ¹æ¬¡ï¼"; |
| | | this.orderQty="è®¢åæ°éï¼"; |
| | | this.ProductionDate="çäº§æ¥æï¼"; |
| | | this.EffectiveDate="æææ¥æï¼"; |
| | | this.Quantity=""; |
| | | setTimeout(() => { |
| | | this.innerCode=""; |
| | | this.focus=false; |
| | | }, 100); |
| | | this.orderInfo=[]; |
| | | this.sns = ""; |
| | | this.$refs.uToast.show({ |
| | | title: "确认æ¶è´§æå", |
| | | type: "success" |
| | | }) |
| | | } else { |
| | | this.$refs.uToast.show({ |
| | | title: res.message, |
| | | type: "error" |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | submit1() { |
| | | this.$u.post('/api/ReceiveOrder/FeedbackReceiveOrder?orderId=' + this |