Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215
| | |
| | | type: 'primary', |
| | | onClick: function () { |
| | | } |
| | | } |
| | | },{ |
| | | name: "é å® åº å ç ç¹", |
| | | icon: '', |
| | | class: '', |
| | | value: 'SelectStockTake', |
| | | type: 'warning', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | ,{ |
| | | name: "å æ® ç ç¹ æ ä½", |
| | | icon: '', |
| | | class: '', |
| | | value: 'OrderStockTake', |
| | | type: 'warning', |
| | | onClick: function () { |
| | | } |
| | | }, |
| | | ] |
| | | |
| | | export default buttons |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="showStockTakeBox" |
| | | :lazy="true" |
| | | :width="isMobile ? '95%' : '70%'" |
| | | :padding="24" |
| | | title="åºåçç¹æä½" |
| | | class="custom-vol-box" |
| | | > |
| | | <div class="stock-take-container"> |
| | | <div class="receipt-info"> |
| | | <el-tag type="primary" size="small" class="receipt-tag"> |
| | | å½åçç¹åæ®å·ï¼<span class="receipt-no">{{ orderNo }}</span> |
| | | </el-tag> |
| | | </div> |
| | | |
| | | <!-- æ ¸å¿è¾å
¥è¡¨å --> |
| | | <el-form |
| | | :model="formData" |
| | | ref="formRef" |
| | | label-width="100px" |
| | | class="stock-take-form" |
| | | @submit.prevent |
| | | > |
| | | <!-- æç®±å·è¾å
¥æ¡ --> |
| | | <el-form-item |
| | | label="æç®±å·ï¼" |
| | | name="boxNo" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·æ«ææè¾å
¥æç®±å·', |
| | | trigger: 'blur', |
| | | }, |
| | | { validator: validateBoxNo, trigger: 'blur' }, |
| | | ]" |
| | | class="form-item" |
| | | > |
| | | <el-input |
| | | ref="boxNoInputRef" |
| | | v-model="formData.boxNo" |
| | | placeholder="è¯·ä½¿ç¨æ«ç æªæ«ææç®±å·ï¼ææå¨è¾å
¥" |
| | | clearable |
| | | @keydown.enter="debouncedHandleBoxNoScan" |
| | | @blur="handleBoxNoBlur" |
| | | :disabled="loading" |
| | | class="custom-input" |
| | | :class="{ 'has-value': formData.boxNo.trim() }" |
| | | > |
| | | <template #append> |
| | | <el-button |
| | | icon="Search" |
| | | type="primary" |
| | | size="small" |
| | | @click="handleBoxNoScan" |
| | | :disabled="!formData.boxNo.trim() || loading" |
| | | class="input-btn" |
| | | ></el-button> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | <!-- æ¡ç è¾å
¥æ¡ --> |
| | | <el-form-item |
| | | label="çç¹æ¡ç ï¼" |
| | | name="barcode" |
| | | :rules="[ |
| | | { required: true, message: 'è¯·æ«ææè¾å
¥æ¡ç ', trigger: 'blur' }, |
| | | { validator: validateBarcode, trigger: 'blur' }, |
| | | ]" |
| | | class="form-item" |
| | | > |
| | | <el-input |
| | | ref="barcodeInputRef" |
| | | v-model="formData.barcode" |
| | | placeholder="è¯·ä½¿ç¨æ«ç æªæ«ææ¡ç ï¼ææå¨è¾å
¥" |
| | | clearable |
| | | @keydown.enter="debouncedHandleBarcodeScan" |
| | | :disabled="!formData.boxNo.trim() || loading" |
| | | class="custom-input" |
| | | :class="{ 'has-value': formData.barcode.trim() }" |
| | | > |
| | | <template #append> |
| | | <el-button |
| | | icon="Search" |
| | | type="primary" |
| | | size="small" |
| | | @click="handleBarcodeScan" |
| | | :disabled=" |
| | | !formData.boxNo.trim() || |
| | | !formData.barcode.trim() || |
| | | loading |
| | | " |
| | | class="input-btn" |
| | | ></el-button> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | <!-- åºåæ°éæ¡ï¼åªè¯»ï¼ --> |
| | | <el-form-item |
| | | label="åºåæ°éï¼" |
| | | name="stockQuantity" |
| | | class="form-item" |
| | | > |
| | | <el-input |
| | | v-model="formData.stockQuantity" |
| | | placeholder="æ«ææ¡ç åèªå¨å¡«å
" |
| | | readonly |
| | | class="custom-input custom-readonly-input" |
| | | :class="{ 'has-value': formData.stockQuantity }" |
| | | ></el-input> |
| | | </el-form-item> |
| | | |
| | | <!-- å®é
çç¹æ°é --> |
| | | <el-form-item |
| | | label="å®é
çç¹æ°éï¼" |
| | | name="actualQuantity" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: '请è¾å
¥å®é
çç¹æ°é', |
| | | trigger: 'blur', |
| | | }, |
| | | { type: 'number', message: '请è¾å
¥ææçæ°å', trigger: 'blur' }, |
| | | { validator: validateActualQuantity, trigger: 'blur' }, |
| | | ]" |
| | | class="form-item" |
| | | > |
| | | <el-input |
| | | v-model.number="formData.actualQuantity" |
| | | placeholder="请è¾å
¥å®é
çç¹æ°éï¼å¤§äº0ï¼" |
| | | type="number" |
| | | clearable |
| | | @keydown.enter="handleStockTakeComplete" |
| | | :disabled="!formData.stockQuantity || loading" |
| | | class="custom-input" |
| | | :class="{ 'has-value': formData.actualQuantity }" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- æä½æé®åºå --> |
| | | <div class="action-buttons"> |
| | | <el-button |
| | | type="info" |
| | | size="small" |
| | | @click="handleBoxReturn" |
| | | :disabled="!formData.boxNo.trim() || loading" |
| | | class="return-btn" |
| | | > |
| | | <Return /> æç®±ååº |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | size="small" |
| | | @click="handleStockTakeComplete" |
| | | :disabled=" |
| | | loading || |
| | | !formData.boxNo.trim() || |
| | | !formData.barcode.trim() || |
| | | !formData.stockQuantity || |
| | | !formData.actualQuantity |
| | | " |
| | | class="complete-btn" |
| | | > |
| | | <Check /> çç¹å®æ |
| | | </el-button> |
| | | <el-button |
| | | type="text" |
| | | size="small" |
| | | @click="handleCancel" |
| | | :disabled="loading" |
| | | class="cancel-btn" |
| | | > |
| | | åæ¶ |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, reactive, onMounted, nextTick, watch, defineEmits, computed } from "vue"; |
| | | import { ElMessage, ElTag, ElMessageBox } from "element-plus"; |
| | | import { Search, Check, Return } from "@element-plus/icons-vue"; |
| | | |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | import http from "@/api/http"; |
| | | |
| | | // ååºå¼åé - åæ®å· |
| | | const orderNo = ref(""); |
| | | |
| | | // æ´é²äºä»¶ |
| | | const emit = defineEmits(["close", "refresh", "box-returned"]); |
| | | |
| | | // ååºå¼æ°æ® |
| | | const showStockTakeBox = ref(false); |
| | | const formData = reactive({ |
| | | boxNo: "", // æç®±å· |
| | | barcode: "", // çç¹æ¡ç |
| | | stockQuantity: "", // åºåæ°éï¼åªè¯»ï¼ |
| | | actualQuantity: "", // å®é
çç¹æ°é |
| | | }); |
| | | const loading = ref(false); |
| | | const formRef = ref(null); |
| | | |
| | | // 模æ¿å¼ç¨ |
| | | const boxNoInputRef = ref(null); |
| | | const barcodeInputRef = ref(null); |
| | | |
| | | // æ£æµæ¯å¦ä¸ºç§»å¨ç«¯ |
| | | const isMobile = computed(() => { |
| | | return window.innerWidth < 768; |
| | | }); |
| | | |
| | | // ç»ä»¶æè½½æ¶èç¦å°æç®±å·è¾å
¥æ¡ |
| | | onMounted(() => { |
| | | nextTick(() => { |
| | | boxNoInputRef.value?.focus(); |
| | | }); |
| | | // çå¬çªå£å¤§å°åå |
| | | window.addEventListener("resize", () => {}); |
| | | }); |
| | | |
| | | // çå¬æç®±å·ååï¼æ¸
空åç»ç¸å
³å段 |
| | | watch( |
| | | () => formData.boxNo, |
| | | (newVal) => { |
| | | if (!newVal.trim()) { |
| | | formData.barcode = ""; |
| | | formData.stockQuantity = ""; |
| | | formData.actualQuantity = ""; |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | |
| | | // 鲿彿° |
| | | const debounce = (fn, delay = 100) => { |
| | | let timer = null; |
| | | return (...args) => { |
| | | if (timer) clearTimeout(timer); |
| | | timer = setTimeout(() => { |
| | | fn.apply(this, args); |
| | | }, delay); |
| | | }; |
| | | }; |
| | | |
| | | // æå¼å¼¹çªå¹¶æ¥æ¶åæ®å· |
| | | const open = (receiptNo) => { |
| | | showStockTakeBox.value = true; |
| | | orderNo.value = receiptNo; |
| | | // é置表å |
| | | formData.boxNo = ""; |
| | | formData.barcode = ""; |
| | | formData.stockQuantity = ""; |
| | | formData.actualQuantity = ""; |
| | | nextTick(() => { |
| | | boxNoInputRef.value?.focus(); |
| | | }); |
| | | }; |
| | | |
| | | // å
³éå¼¹çª |
| | | const handleCancel = (e) => { |
| | | e.stopPropagation(); |
| | | e.preventDefault(); |
| | | showStockTakeBox.value = false; |
| | | emit("close"); |
| | | orderNo.value = ""; |
| | | }; |
| | | |
| | | // æç®±å·éªè¯ï¼ä¼åï¼æå¼æ¶ä»
éªè¯é¿åº¦ï¼æ 弿¶è§¦åå¿
å¡«ï¼ |
| | | const validateBoxNo = (rule, value, callback) => { |
| | | // æå¼æ¶éªè¯é¿åº¦ |
| | | if (value && value.trim().length < 3) { |
| | | callback(new Error("æç®±å·é¿åº¦ä¸è½å°äº3ä½")); |
| | | } |
| | | // æ 弿¶ç±requiredè§åå¤çï¼è¿éä¸éå¤æç¤º |
| | | else { |
| | | callback(); |
| | | } |
| | | }; |
| | | |
| | | // æ¡ç éªè¯ï¼ä¼åï¼æå¼æ¶ä»
éªè¯é¿åº¦ï¼ |
| | | const validateBarcode = (rule, value, callback) => { |
| | | if (value && value.trim().length < 6) { |
| | | callback(new Error("æ¡ç é¿åº¦ä¸è½å°äº6ä½")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | |
| | | // å®é
çç¹æ°ééªè¯ï¼ä¼åï¼æå¼æ¶éªè¯åæ³æ§ï¼ |
| | | const validateActualQuantity = (rule, value, callback) => { |
| | | if (value === null || value === undefined) { |
| | | callback(new Error("请è¾å
¥å®é
çç¹æ°é")); |
| | | } else if (value <= 0) { |
| | | callback(new Error("å®é
çç¹æ°éå¿
须大äº0")); |
| | | } else if (!Number.isInteger(value)) { |
| | | callback(new Error("å®é
çç¹æ°éå¿
é¡»æ¯æ´æ°")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | |
| | | // æç®±å·å¤±ç¦å¤ç |
| | | const handleBoxNoBlur = () => { |
| | | if (formData.boxNo.trim() && boxNoInputRef.value?.input) { |
| | | boxNoInputRef.value.input.select(); |
| | | } |
| | | }; |
| | | |
| | | // æç®±å·æ«æéªè¯ï¼å端æ¥å£ï¼ |
| | | const validateBoxNoApi = async (boxNo) => { |
| | | try { |
| | | const res = await http.post( |
| | | `/api/TakeStockOrder/ValidateBoxNo?orderNo=${encodeURIComponent( |
| | | orderNo.value |
| | | )}&boxNo=${encodeURIComponent(boxNo)}`, |
| | | "éªè¯æç®±å·ä¸..." |
| | | ); |
| | | |
| | | if (!res.status) { |
| | | throw new Error(res.message || "æç®±å·éªè¯å¤±è´¥"); |
| | | } |
| | | return res.data; |
| | | } catch (error) { |
| | | throw error; |
| | | } |
| | | }; |
| | | |
| | | // æç®±å·æ«æå¤ç |
| | | const handleBoxNoScan = async () => { |
| | | if (!formRef.value) return; |
| | | // æå¨è§¦åéªè¯ï¼ä»
éªè¯å½ååæ®µï¼ |
| | | const valid = await formRef.value.validateField("boxNo"); |
| | | if (valid !== true) return; |
| | | |
| | | const boxNo = formData.boxNo.trim(); |
| | | if (!boxNo) return; |
| | | |
| | | try { |
| | | loading.value = true; |
| | | await validateBoxNoApi(boxNo); |
| | | ElMessage.success(`æç®±å· ${boxNo} éªè¯éè¿`); |
| | | nextTick(() => { |
| | | barcodeInputRef.value?.focus(); |
| | | }); |
| | | } catch (error) { |
| | | ElMessage.error(error.message); |
| | | nextTick(() => { |
| | | if (boxNoInputRef.value?.input) { |
| | | boxNoInputRef.value.input.select(); |
| | | } |
| | | }); |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æ¡ç æ«æéªè¯ï¼å端æ¥å£ï¼ |
| | | const validateBarcodeApi = async (boxNo, barcode) => { |
| | | try { |
| | | const res = await http.post( |
| | | `/api/TakeStockOrder/ValidateBarcode?boxNo=${encodeURIComponent( |
| | | boxNo |
| | | )}&barcode=${encodeURIComponent(barcode)}`, |
| | | "éªè¯æ¡ç ä¸..." |
| | | ); |
| | | |
| | | if (!res.status) { |
| | | throw new Error(res.message || "æ¡ç éªè¯å¤±è´¥"); |
| | | } |
| | | |
| | | if ( |
| | | res.data?.stockQuantity === undefined || |
| | | res.data?.stockQuantity === null |
| | | ) { |
| | | throw new Error("æªæ¥è¯¢å°è¯¥æ¡ç çåºåæ°é"); |
| | | } |
| | | |
| | | return res.data; |
| | | } catch (error) { |
| | | throw error; |
| | | } |
| | | }; |
| | | |
| | | // æ¡ç æ«æå¤ç |
| | | const handleBarcodeScan = async () => { |
| | | if (!formRef.value) return; |
| | | const valid = await formRef.value.validateField("barcode"); |
| | | if (valid !== true) return; |
| | | |
| | | const boxNo = formData.boxNo.trim(); |
| | | const barcode = formData.barcode.trim(); |
| | | if (!boxNo || !barcode) return; |
| | | |
| | | try { |
| | | loading.value = true; |
| | | const result = await validateBarcodeApi(boxNo, barcode); |
| | | formData.stockQuantity = result.stockQuantity; |
| | | ElMessage.success( |
| | | `æ¡ç ${barcode} éªè¯éè¿ï¼åºåæ°éï¼${result.stockQuantity}` |
| | | ); |
| | | nextTick(() => { |
| | | const actualQuantityInput = document.querySelector( |
| | | ".form-item:last-child .el-input__inner" |
| | | ); |
| | | actualQuantityInput?.focus(); |
| | | }); |
| | | } catch (error) { |
| | | ElMessage.error(error.message); |
| | | nextTick(() => { |
| | | if (barcodeInputRef.value?.input) { |
| | | barcodeInputRef.value.input.select(); |
| | | } |
| | | }); |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // çç¹å®ææäº¤ |
| | | const handleStockTakeComplete = async () => { |
| | | if (!formRef.value) return; |
| | | // å
¨è¡¨åéªè¯ |
| | | const valid = await formRef.value.validate(); |
| | | if (!valid) return; |
| | | |
| | | const { boxNo, barcode, actualQuantity, stockQuantity } = formData; |
| | | const receiptNo = orderNo.value; |
| | | |
| | | try { |
| | | loading.value = true; |
| | | |
| | | const res = await http.post( |
| | | "/api/TakeStockOrder/CompleteStockTake", |
| | | { |
| | | orderNo: receiptNo, |
| | | boxNo, |
| | | barcode, |
| | | actualQuantity, |
| | | stockQuantity, |
| | | }, |
| | | { |
| | | loadingText: "æäº¤çç¹æ°æ®ä¸...", |
| | | } |
| | | ); |
| | | |
| | | if (res.status) { |
| | | ElMessage.success("çç¹å®æï¼æäº¤æåï¼"); |
| | | formData.barcode = ""; |
| | | formData.stockQuantity = ""; |
| | | formData.actualQuantity = ""; |
| | | nextTick(() => { |
| | | barcodeInputRef.value?.focus(); |
| | | }); |
| | | emit("refresh"); |
| | | } else { |
| | | throw new Error(res.message || "çç¹æäº¤å¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | ElMessage.error(error.message || "ç½ç»å¼å¸¸ï¼æäº¤å¤±è´¥"); |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // æç®±ååºåè½ |
| | | const handleBoxReturn = async () => { |
| | | const boxNo = formData.boxNo.trim(); |
| | | if (!boxNo) { |
| | | ElMessage.warning("请å
è¾å
¥ææ«ææç®±å·"); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | await ElMessageBox.confirm(`ç¡®å®å°æç®±ã${boxNo}ãååºåï¼`, "ååºç¡®è®¤", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "info", |
| | | center: true, |
| | | confirmButtonClass: "el-button--primary", |
| | | cancelButtonClass: "el-button--text", |
| | | }); |
| | | |
| | | loading.value = true; |
| | | |
| | | const res = await http.post( |
| | | `/api/TakeStockOrder/ReturnBox?boxNo=${encodeURIComponent(boxNo)}&orderNo=${encodeURIComponent( |
| | | orderNo.value |
| | | )}`, |
| | | "æç®±ååºä¸..." |
| | | ); |
| | | |
| | | if (res.status) { |
| | | ElMessage.success(`æç®±ã${boxNo}ãååºæåï¼`); |
| | | formData.boxNo = ""; |
| | | formData.barcode = ""; |
| | | formData.stockQuantity = ""; |
| | | formData.actualQuantity = ""; |
| | | nextTick(() => { |
| | | boxNoInputRef.value?.focus(); |
| | | }); |
| | | emit("box-returned", boxNo); |
| | | } else { |
| | | throw new Error(res.message || "æç®±ååºå¤±è´¥"); |
| | | } |
| | | } catch (error) { |
| | | if (error.name !== "Cancel") { |
| | | ElMessage.error(error.message); |
| | | } |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // å¸¦é²æçæ«æå¤ç |
| | | const debouncedHandleBoxNoScan = debounce(async (e) => { |
| | | e.stopPropagation(); |
| | | e.preventDefault(); |
| | | await handleBoxNoScan(); |
| | | }, 100); |
| | | |
| | | const debouncedHandleBarcodeScan = debounce(async (e) => { |
| | | e.stopPropagation(); |
| | | e.preventDefault(); |
| | | await handleBarcodeScan(); |
| | | }, 100); |
| | | |
| | | // æ´é²æ¹æ³ |
| | | defineExpose({ |
| | | open, |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped> |
| | | /* 䏻容卿 ·å¼ - ä¼åé´è·åååºå¼ */ |
| | | .stock-take-container { |
| | | width: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 16px; |
| | | padding: 8px 0; |
| | | } |
| | | |
| | | /* åæ®ä¿¡æ¯æ ·å¼ - ä¼åè§è§å±çº§ */ |
| | | .receipt-info { |
| | | margin-bottom: 4px; |
| | | } |
| | | |
| | | .receipt-tag { |
| | | padding: 8px 16px; |
| | | font-size: 14px; |
| | | background-color: #e8f4f8 !important; |
| | | border-color: #409eff !important; |
| | | color: #1989fa !important; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1); |
| | | } |
| | | |
| | | .receipt-no { |
| | | font-weight: 600; |
| | | color: #1989fa; |
| | | margin-left: 6px; |
| | | } |
| | | |
| | | /* è¡¨åæ ·å¼ - ä¼åé´å½±åå
è¾¹è· */ |
| | | .stock-take-form { |
| | | width: 100%; |
| | | background-color: #ffffff; |
| | | padding: 20px; |
| | | border-radius: 12px; |
| | | box-shadow: 0 2px 12px rgba(64, 158, 255, 0.06); |
| | | border: 1px solid #f0f8fb; |
| | | } |
| | | |
| | | .form-item { |
| | | margin-bottom: 16px; |
| | | } |
| | | |
| | | /* è¾å
¥æ¡æ ¸å¿æ ·å¼ - ä¼åç¶ææ¾ç¤º */ |
| | | .custom-input { |
| | | width: 100%; |
| | | position: relative; |
| | | } |
| | | |
| | | /* æå¼æ¶éèå ä½ç¬¦ + ä¼åè¾¹æ¡ */ |
| | | .custom-input.has-value :deep(.el-input__inner) { |
| | | --el-input-placeholder-color: transparent; /* éèå ä½ç¬¦ */ |
| | | border-color: #8cc5ff; /* æµ
èè¾¹æ¡ï¼åºåæ å¼ç¶æ */ |
| | | background-color: #ffffff; |
| | | } |
| | | |
| | | .custom-input :deep(.el-input__inner) { |
| | | border-radius: 8px; |
| | | border-color: #e5f0fa; |
| | | transition: all 0.2s ease; |
| | | height: 42px; |
| | | line-height: 42px; |
| | | font-size: 14px; |
| | | background-color: #f8fbff; |
| | | padding: 0 12px; |
| | | } |
| | | |
| | | /* èç¦æ ·å¼ä¼å */ |
| | | .custom-input :deep(.el-input__inner:focus) { |
| | | border-color: #409eff; |
| | | box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.1); |
| | | background-color: #ffffff; |
| | | outline: none; |
| | | } |
| | | |
| | | /* æ¸
餿鮿 ·å¼ä¼å */ |
| | | .custom-input :deep(.el-input__clear) { |
| | | color: #91c9f7; |
| | | width: 18px; |
| | | height: 18px; |
| | | } |
| | | |
| | | .custom-input :deep(.el-input__clear:hover) { |
| | | color: #409eff; |
| | | } |
| | | |
| | | /* åªè¯»è¾å
¥æ¡æ ·å¼ - å¢å¼ºåºå度 */ |
| | | .custom-readonly-input :deep(.el-input__inner) { |
| | | background-color: #f0f8fb; |
| | | color: #1989fa; |
| | | font-weight: 500; |
| | | cursor: default; |
| | | border-color: #d1e7fd; |
| | | padding-right: 12px; |
| | | } |
| | | |
| | | /* è¾å
¥æ¡æé®æ ·å¼ - ä¼å尺寸åhoverææ */ |
| | | .input-btn { |
| | | border-radius: 0 8px 8px 0 !important; |
| | | height: 42px; |
| | | width: 48px; |
| | | background-color: #409eff; |
| | | border-color: #409eff; |
| | | transition: all 0.2s ease; |
| | | } |
| | | |
| | | .input-btn:hover { |
| | | background-color: #1989fa !important; |
| | | border-color: #1989fa !important; |
| | | box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2); |
| | | transform: translateY(-1px); |
| | | } |
| | | |
| | | /* 表åéªè¯éè¯¯æ ·å¼ - å
³é®ï¼æå¼æ¶ä¸æ¾ç¤ºéè¯¯è¾¹æ¡ */ |
| | | .form-item :deep(.el-form-item__error) { |
| | | font-size: 12px; |
| | | color: #f56c6c; |
| | | margin-top: 4px; |
| | | /* ä»
å¨è¾å
¥æ¡ä¸ºç©ºä¸éªè¯å¤±è´¥æ¶æ¾ç¤º */ |
| | | display: none; |
| | | } |
| | | |
| | | /* åªæè¾å
¥æ¡ä¸ºç©º + éªè¯å¤±è´¥æ¶æ¾ç¤ºé误æç¤º */ |
| | | .form-item:deep(.el-form-item--error) .custom-input:not(.has-value) + .el-form-item__error { |
| | | display: block; |
| | | } |
| | | |
| | | /* æå¼æ¶å³ä½¿éªè¯å¤±è´¥ï¼ä¹ä¸æ¾ç¤ºéè¯¯è¾¹æ¡ */ |
| | | .custom-input.has-value :deep(.el-input__inner.el-input__inner--error) { |
| | | border-color: #8cc5ff; |
| | | box-shadow: none; |
| | | } |
| | | |
| | | /* æä½æé®åºå - ä¼åé´è·åååºå¼ */ |
| | | .action-buttons { |
| | | display: flex; |
| | | justify-content: flex-end; |
| | | gap: 10px; |
| | | margin-top: 20px; |
| | | flex-wrap: wrap; |
| | | } |
| | | |
| | | /* ååºæé®æ ·å¼ - ä¼åäº¤äº */ |
| | | .return-btn { |
| | | border-radius: 8px; |
| | | padding: 9px 20px; |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | background-color: #e8f4f8; |
| | | border-color: #409eff; |
| | | color: #1989fa; |
| | | transition: all 0.2s ease; |
| | | } |
| | | |
| | | .return-btn:hover { |
| | | background-color: #d1e7fd !important; |
| | | border-color: #1989fa !important; |
| | | color: #1989fa !important; |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 2px 8px rgba(64, 158, 255, 0.15); |
| | | } |
| | | |
| | | .return-btn:disabled { |
| | | background-color: #f0f8fb !important; |
| | | border-color: #b3d8ff !important; |
| | | color: #91c9f7 !important; |
| | | cursor: not-allowed; |
| | | transform: none; |
| | | box-shadow: none; |
| | | } |
| | | |
| | | /* çç¹å®ææé®æ ·å¼ - ä¼åäº¤äº */ |
| | | .complete-btn { |
| | | border-radius: 8px; |
| | | padding: 9px 20px; |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | background-color: #409eff; |
| | | border-color: #409eff; |
| | | transition: all 0.2s ease; |
| | | } |
| | | |
| | | .complete-btn:hover { |
| | | background-color: #1989fa !important; |
| | | border-color: #1989fa !important; |
| | | transform: translateY(-1px); |
| | | box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2); |
| | | } |
| | | |
| | | .complete-btn:disabled { |
| | | background-color: #a0cfff !important; |
| | | border-color: #a0cfff !important; |
| | | color: #ffffff !important; |
| | | cursor: not-allowed; |
| | | transform: none; |
| | | box-shadow: none; |
| | | } |
| | | |
| | | /* åæ¶æé®æ ·å¼ - ä¼åç¹å»åºå */ |
| | | .cancel-btn { |
| | | color: #666666; |
| | | font-size: 14px; |
| | | transition: all 0.2s ease; |
| | | padding: 9px 20px; |
| | | border-radius: 8px; |
| | | min-width: 80px; |
| | | } |
| | | |
| | | .cancel-btn:hover { |
| | | color: #1989fa !important; |
| | | background-color: #f0f8fb !important; |
| | | } |
| | | |
| | | /* å¼¹çªæ´ä½æ ·å¼ - ä¼ååè§åé´å½± */ |
| | | .custom-vol-box { |
| | | border-radius: 16px !important; |
| | | overflow: hidden; |
| | | box-shadow: 0 8px 24px rgba(64, 158, 255, 0.12); |
| | | } |
| | | |
| | | .custom-vol-box :deep(.el-dialog__header) { |
| | | background-color: #e8f4f8; |
| | | border-bottom: 1px solid #d1e7fd; |
| | | padding: 16px 24px; |
| | | } |
| | | |
| | | .custom-vol-box :deep(.el-dialog__title) { |
| | | color: #1989fa; |
| | | font-size: 18px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .custom-vol-box :deep(.el-dialog__body) { |
| | | padding: 16px 24px; |
| | | } |
| | | |
| | | /* ååºå¼éé
- å°å±å¹ä¼å */ |
| | | @media (max-width: 768px) { |
| | | .stock-take-form { |
| | | padding: 16px; |
| | | } |
| | | |
| | | .form-item { |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .action-buttons { |
| | | justify-content: center; |
| | | } |
| | | |
| | | .custom-vol-box :deep(.el-dialog__header) { |
| | | padding: 12px 16px; |
| | | } |
| | | |
| | | .custom-vol-box :deep(.el-dialog__body) { |
| | | padding: 12px 16px; |
| | | } |
| | | } |
| | | </style> |
| | | |
| | | <style> |
| | | /* å
¨å±è¡¥å
æ ·å¼ - ç»ä¸ä¸»é¢ */ |
| | | .el-tag--primary { |
| | | --el-tag-bg-color: #e8f4f8; |
| | | --el-tag-border-color: #409eff; |
| | | --el-tag-text-color: #1989fa; |
| | | } |
| | | |
| | | /* å ä½ç¬¦æ ·å¼ - ç»ä¸é¢è² */ |
| | | .el-input__inner::-webkit-input-placeholder { |
| | | color: #b3d8ff; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .el-input__inner::-moz-placeholder { |
| | | color: #b3d8ff; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .el-input__inner:-ms-input-placeholder { |
| | | color: #b3d8ff; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .el-input__inner::placeholder { |
| | | color: #b3d8ff; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | /* ä¿¡æ¯æé®å
¨å±æ ·å¼ */ |
| | | .el-button--info { |
| | | --el-button-bg-color: #e8f4f8; |
| | | --el-button-border-color: #409eff; |
| | | --el-button-text-color: #1989fa; |
| | | --el-button-hover-bg-color: #d1e7fd; |
| | | --el-button-hover-border-color: #1989fa; |
| | | --el-button-hover-text-color: #1989fa; |
| | | } |
| | | |
| | | /* ç¡®è®¤å¼¹çªæ ·å¼ä¼å */ |
| | | .el-message-box { |
| | | border-radius: 12px !important; |
| | | box-shadow: 0 4px 20px rgba(64, 158, 255, 0.15); |
| | | } |
| | | |
| | | .el-message-box__header { |
| | | border-bottom: 1px solid #f0f8fb; |
| | | padding: 12px 20px; |
| | | } |
| | | |
| | | .el-message-box__title { |
| | | color: #1989fa; |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .el-message-box__content { |
| | | color: #666666; |
| | | font-size: 14px; |
| | | padding: 16px 20px; |
| | | } |
| | | |
| | | .el-message-box__btns { |
| | | padding: 12px 20px; |
| | | border-top: 1px solid #f0f8fb; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // èªå®ä¹æ©å±ä¸å¡ä»£ç |
| | | import gridBody from "./extend/OrderStockTake.vue"; |
| | | |
| | | let extension = { |
| | | components: { |
| | | // æ¥è¯¢ç颿©å±ç»ä»¶ï¼å°èªå®ä¹å¼¹çªæ³¨å为 gridBody ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: gridBody, // 对åºä½ ççç¹å¼¹çªç»ä»¶ |
| | | gridFooter: '', |
| | | // æ°å»º/ç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ï¼æ¤å¤ä¸ç¨ï¼çç©ºï¼ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', // æ éæå®è¡¨åï¼é»è®¤éç¨å½å页é¢è¡¨æ ¼ï¼ |
| | | buttons: { view: [], box: [], detail: [] }, // æ©å±æé®ï¼å¦éé¢å¤æ·»å å¯å¨æ¤é
ç½®ï¼ |
| | | methods: { |
| | | onInit() { |
| | | // æ¾å° value 为 "OrderStockTake" çæé®ï¼é卿¡æ¶ä¸æåé
置该æé®ï¼ |
| | | let OrderStockTakeBtn = this.buttons.find(x => x.value === 'OrderStockTake'); |
| | | if (OrderStockTakeBtn) { |
| | | // éåæé®ç¹å»äºä»¶ |
| | | OrderStockTakeBtn.onClick = function () { |
| | | // 1. è·åè¡¨æ ¼éä¸è¡æ°æ® |
| | | let rows = this.$refs.table.getSelected(); |
| | | if (rows.length === 0) return this.$error("è¯·éæ©ä¸æ¡çç¹åæ®æ°æ®ï¼"); |
| | | if (rows.length > 1) return this.$error("åªè½éæ©ä¸æ¡çç¹åæ®æ°æ®ï¼"); |
| | | |
| | | const selectedReceiptNo = rows[0].orderNo; |
| | | if (!selectedReceiptNo) return this.$error("éä¸çåæ®ç¼ºå°ææçåæ®å·ï¼"); |
| | | |
| | | // 3. è°ç¨èªå®ä¹å¼¹çªç open æ¹æ³ï¼å¹¶ä¼ éåæ®å·ï¼æ ¸å¿ï¼ç»å¼¹çªä¼ åï¼ |
| | | this.$refs.gridBody.open(selectedReceiptNo); |
| | | }; |
| | | } |
| | | |
| | | // 4. çå¬èªå®ä¹å¼¹çªçäºä»¶ï¼åæ¥ä¸»é¡µé¢æ°æ®ï¼ |
| | | this.$nextTick(() => { |
| | | const stockTakeComp = this.$refs.gridBody; |
| | | if (stockTakeComp) { |
| | | // çå¬å¼¹çªç "refresh" äºä»¶ï¼çç¹å®æåå·æ°ä¸»é¡µé¢ï¼ |
| | | stockTakeComp.$on('refresh', () => { |
| | | this.$refs.table.reload(); // å·æ°è¡¨æ ¼æ°æ® |
| | | }); |
| | | |
| | | // çå¬å¼¹çªç "box-returned" äºä»¶ï¼æç®±ååºå坿éå¤çï¼ |
| | | stockTakeComp.$on('box-returned', (boxNo) => { |
| | | this.$success(`æç®±ã${boxNo}ãååºæåï¼è¡¨æ ¼å°å·æ°ï¼`); |
| | | this.$refs.table.reload(); // ååºåä¹å·æ°è¡¨æ ¼ï¼å¯éï¼æ ¹æ®ä¸å¡éæ±ï¼ |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | onInited() { |
| | | // æ¡æ¶åå§å宿忧è¡ï¼å¦éé
ç½®æç»è¡¨å¯å¨æ¤æä½ï¼ |
| | | }, |
| | | searchBefore(param) { |
| | | // æ¥è¯¢åæ¦æªï¼å¯æ·»å é¢å¤æ¥è¯¢æ¡ä»¶ï¼å¦æéè¿æ»¤ï¼ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | // æ¥è¯¢åæ°æ®å¤çï¼å¦æ ¼å¼åæ¥æãç¶ææ¾ç¤ºï¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | // æ°å»ºä¿ååå¤çï¼æ¤å¤ä¸ç¨ï¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | // ç¼è¾ä¿ååå¤çï¼æ¤å¤ä¸ç¨ï¼ |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | // åå»è¡éä¸å½åè¡ï¼ä¼åç¨æ·ä½éªï¼ |
| | | this.$refs.table.$refs.table.toggleRowSelection(row); |
| | | }, |
| | | modelOpenAfter(row) { |
| | | // æ°å»º/ç¼è¾å¼¹çªæå¼åå¤çï¼æ¤å¤ä¸ç¨ï¼ |
| | | } |
| | | } |
| | | }; |
| | | |
| | | export default extension; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | }, |
| | | searchBefore(param) { |
| | | //ç颿¥è¯¢å,å¯ä»¥ç»param.wheresæ·»å æ¥è¯¢åæ° |
| | | //è¿åfalseï¼åä¸ä¼æ§è¡æ¥è¯¢ |
| | | return true; |
| | | }, |
| | | searchAfter(result) { |
| | | //æ¥è¯¢åï¼resultè¿åçæ¥è¯¢æ°æ®,å¯ä»¥å¨æ¾ç¤ºå°è¡¨æ ¼åå¤çè¡¨æ ¼çå¼ |
| | | return true; |
| | | }, |
| | | addBefore(formData) { |
| | | //æ°å»ºä¿ååformData为对象ï¼å
æ¬æç»è¡¨ï¼å¯ä»¥ç»ç»è¡¨å设置å¼ï¼èªå·±è¾åºçformDataçå¼ |
| | | return true; |
| | | }, |
| | | updateBefore(formData) { |
| | | //ç¼è¾ä¿ååformData为对象ï¼å
æ¬æç»è¡¨ãå é¤è¡çId |
| | | return true; |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //æ¥è¯¢çé¢ç¹å»è¡äºä»¶ |
| | | this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
| | | //(3)this.editFormFields.åæ®µ='xxx'; |
| | | //妿éè¦ç»ä¸ææ¡è®¾ç½®é»è®¤å¼ï¼è¯·éåthis.editFormOptionsæ¾å°å段é
置对åºdata屿§çkeyå¼ |
| | | //ç䏿就æè¾åºçï¼console.log(this.editFormOptions) |
| | | } |
| | | } |
| | | }; |
| | | export default extension; |
| | | |
| | |
| | | |
| | | import { createVNode, render, h, reactive } from 'vue'; |
| | | import { ElDialog, ElForm, ElFormItem, ElSelect, ElOption, ElButton, ElMessage, ElLoading } from 'element-plus'; |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | |
| | | } |
| | | } |
| | | }) |
| | | |
| | | let SelectTake = this.buttons.find(x => x.value == 'SelectStockTake'); |
| | | if (SelectTake) { |
| | | // æ¹ä¸ºç®å¤´å½æ°ç¡®ä¿thisæåVueç»ä»¶å®ä¾ |
| | | SelectTake.onClick = async () => { |
| | | // è·åé䏿°æ®ï¼ä¸åé»è¾ä¸è´ï¼ç¡®ä¿æ¯æ°ç»æ ¼å¼ï¼ |
| | | let stockViews = this.$refs.table.getSelected(); |
| | | |
| | | // æ°æ®æ ¡éªï¼è³å°éæ©ä¸æ¡æ°æ® |
| | | if (stockViews.length === 0) return ElMessage.error("è¯·éæ©éè¦æä½çæ°æ®!"); |
| | | |
| | | // ç«å°é项ï¼å¯æ ¹æ®å®é
ä¸å¡è°æ´é项å¼ï¼ |
| | | const stationOptions = [ |
| | | { label: "ç«å°2", value: "2-1" }, |
| | | { label: "ç«å°3", value: "3-1" }, |
| | | { label: "ç«å°4", value: "4-1" }, |
| | | ]; |
| | | |
| | | // åå»ºå¼¹çªæè½½èç¹ |
| | | const mountNode = document.createElement("div"); |
| | | document.body.appendChild(mountNode); |
| | | |
| | | // è¡¨åæ°æ®ï¼ç»å®éä¸çç«å°ï¼ |
| | | const formData = reactive({ |
| | | outStation: stationOptions[0].value, // é»è®¤éä¸ç¬¬ä¸ä¸ªç«å° |
| | | }); |
| | | |
| | | // å建弹çªVNode |
| | | const vnode = createVNode( |
| | | ElDialog, |
| | | { |
| | | title: "åºåæä½ - éæ©åºåºç«å°", |
| | | width: "500px", |
| | | modelValue: true, |
| | | appendToBody: true, |
| | | "onUpdate:modelValue": (isVisible) => { |
| | | if (!isVisible) { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | }, |
| | | style: { |
| | | padding: "20px 0", |
| | | borderRadius: "8px", |
| | | }, |
| | | }, |
| | | { |
| | | default: () => |
| | | h( |
| | | ElForm, |
| | | { |
| | | model: formData, |
| | | rules: { |
| | | outStation: [ |
| | | { required: true, message: "è¯·éæ©åºåºç«å°", trigger: "change" }, |
| | | ], |
| | | }, |
| | | ref: "stockTakeForm", // 表årefæ è¯ |
| | | labelWidth: "100px", |
| | | style: { |
| | | padding: "0 30px", |
| | | }, |
| | | }, |
| | | [ |
| | | // ç«å°éæ©ä¸ææ¡ |
| | | h(ElFormItem, { |
| | | label: "åºåºç«å°", |
| | | prop: "outStation", |
| | | style: { marginBottom: "24px" }, |
| | | }, [ |
| | | h(ElSelect, { |
| | | placeholder: "è¯·éæ©åºåºç«å°", |
| | | modelValue: formData.outStation, |
| | | "onUpdate:modelValue": (val) => { |
| | | formData.outStation = val; |
| | | }, |
| | | style: { |
| | | width: "100%", |
| | | height: "40px", |
| | | borderRadius: "4px", |
| | | borderColor: "#dcdfe6", |
| | | }, |
| | | }, stationOptions.map((station) => |
| | | h(ElOption, { label: station.label, value: station.value }) |
| | | )), |
| | | ]), |
| | | // åºé¨æé®åºå |
| | | h("div", { |
| | | style: { |
| | | textAlign: "right", |
| | | marginTop: "8px", |
| | | paddingRight: "4px", |
| | | }, |
| | | }, [ |
| | | // åæ¶æé® |
| | | h(ElButton, { |
| | | type: "text", |
| | | onClick: () => { |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | ElMessage.info("åæ¶åºåæä½"); |
| | | }, |
| | | style: { marginRight: "8px", color: "#606266" }, |
| | | }, "åæ¶"), |
| | | // ç¡®å®æé® |
| | | h(ElButton, { |
| | | type: "primary", |
| | | onClick: async () => { |
| | | // ç¡®ä¿è¡¨årefå·²æè½½ |
| | | await this.$nextTick(); |
| | | const formRef = vnode.component.refs.stockTakeForm; |
| | | |
| | | if (!formRef) { |
| | | ElMessage.error("表ååå§å失败ï¼è¯·éè¯"); |
| | | return; |
| | | } |
| | | |
| | | // 表åéªè¯ |
| | | try { |
| | | await formRef.validate(); |
| | | } catch (err) { |
| | | return; |
| | | } |
| | | |
| | | // æé 请æ±åæ°ï¼ |
| | | // 1. 请æ±ä½ï¼ç´æ¥ä¼ éstockViewsæ°ç»ï¼å¯¹åºå端List<StockViewDTO>ï¼ |
| | | // 2. outStationï¼éè¿æ¥è¯¢åæ°ä¼ éï¼å åç«¯æªæå®[FromBody]æ¥æ¶è¯¥åæ°ï¼ |
| | | const requestBody = stockViews; // ç´æ¥ä¼ éé䏿°ç»ï¼ç¡®ä¿æ°ç»å
å¯¹è±¡ç»æä¸StockViewDTOä¸è´ï¼ |
| | | const outStation = formData.outStation; |
| | | |
| | | // æ¥å£è¯·æ±ï¼Postæ¹å¼ï¼è¯·æ±ä½ä¼ stockViewsæ°ç»ï¼outStationæ¼å°URLæ¥è¯¢åæ° |
| | | try { |
| | | // æ¼æ¥æ¥è¯¢åæ°ï¼å¦æoutStationæç¹æ®å符ï¼å¯ä½¿ç¨encodeURIComponentå¤çï¼ |
| | | const url = `api/Task/TakeOutbound?outStation=${encodeURIComponent(outStation)}`; |
| | | |
| | | const x = await this.http.post( |
| | | url, // 带æ¥è¯¢åæ°çURL |
| | | requestBody, // 请æ±ä½ï¼stockViewsæ°ç» |
| | | "æ°æ®å¤çä¸" |
| | | ); |
| | | |
| | | if (!x.status) { |
| | | ElMessage.error(x.message || "åºåæä½å¤±è´¥"); |
| | | return; |
| | | } |
| | | |
| | | ElMessage.success("æä½æå"); |
| | | this.refresh(); // åå·æ°é»è¾ä¿ç |
| | | } catch (error) { |
| | | console.error("åºåæ¥å£è¯·æ±å¤±è´¥ï¼", error); |
| | | ElMessage.error("请æ±å¤±è´¥ï¼è¯·ç¨åéè¯"); |
| | | } finally { |
| | | // æ 论æå失败ï¼å
³éå¼¹çª |
| | | render(null, mountNode); |
| | | document.body.removeChild(mountNode); |
| | | } |
| | | }, |
| | | style: { borderRadius: "4px", padding: "8px 20px" }, |
| | | }, "ç¡®å®æä½"), |
| | | ]), |
| | | ]), |
| | | } |
| | | ); |
| | | |
| | | // ç»å®appä¸ä¸æï¼ç¡®ä¿å¼¹çªå
ç»ä»¶æ£å¸¸å·¥ä½ï¼ |
| | | vnode.appContext = this.$.appContext; |
| | | render(vnode, mountNode); |
| | | }; |
| | | } |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | |
| | | component: () => import('@/views/system/Log.vue'), |
| | | meta: { |
| | | } |
| | | }, { |
| | | path: '/takeStockOrder', |
| | | name: 'takeStockOrder', |
| | | component: () => import('@/views/inbound/takeStockOrder.vue') |
| | | }, { |
| | | path: '/takeStockOrderDetail', |
| | | name: 'takeStockOrderDetail', |
| | | component: () => import('@/views/inbound/takeStockOrderDetail.vue') |
| | | } |
| | | ] |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | <template> |
| | | <!-- <div> |
| | | <assemble-dist></assemble-dist> |
| | | </div> --> |
| | | <view-grid |
| | | ref="grid" |
| | | :columns="columns" |
| | | :detail="detail" |
| | | :editFormFields="editFormFields" |
| | | :editFormOptions="editFormOptions" |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend" |
| | | > |
| | | </view-grid> |
| | | </template> |
| | | <script> |
| | | import extend from "@/extension/inbound/takeStockOrder.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | // import AssembleDistVue from '../charts/AssembleDist.vue'; |
| | | export default defineComponent({ |
| | | // components: { |
| | | // 'assemble-dist': AssembleDistVue, |
| | | // }, |
| | | setup() { |
| | | //使ç¨ç»ä»¶AssembleDist |
| | | const table = ref({ |
| | | key: "id", |
| | | footer: "Foots", |
| | | cnName: "çç¹å", |
| | | name: "takeStockOrder", |
| | | url: "/TakeStockOrder/", |
| | | sortName: "id", |
| | | }); |
| | | |
| | | const searchFormFields = ref({ |
| | | orderNo:"" |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "åæ®ç¼å·", field: "orderNo", type: "like" }, |
| | | ] |
| | | ]); |
| | | |
| | | const editFormFields = ref({ |
| | | orderNo:"", |
| | | warehouseId: "", |
| | | remark:"" |
| | | }); |
| | | const editFormOptions = ref([ |
| | | [ |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "string", |
| | | readonly: "true", |
| | | }, |
| | | { |
| | | title: "ä»åº", |
| | | field: "warehouseId", |
| | | type: "select", |
| | | dataKey: "warehouses", |
| | | data: [], |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | } |
| | | ] |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "orderNo", |
| | | title: "çç¹åå·", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "takeStockStatus", |
| | | title: "çç¹ç¶æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | bind: { key: "takeStockStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "allPalletCode", |
| | | title: "åæ®çç¹æç", |
| | | type: "string", |
| | | width: 600, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "modifier", |
| | | title: "ä¿®æ¹äºº", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "modifyDate", |
| | | title: "ä¿®æ¹æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "åºåºç«å°", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | ]); |
| | | const detail = ref({ |
| | | cnName: "çç¹æç»", |
| | | table: "Dt_TakeStockOrderDetail", |
| | | columns: [ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "takeStockId", |
| | | title: "çç¹å主é®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "takePalletCode", |
| | | title: "çç¹æç", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "takeDetalStatus", |
| | | title: "çç¹æç»ç¶æ", |
| | | type: "int", |
| | | width: 130, |
| | | align: "left", |
| | | bind: { key: "takeStockDetailStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "materielCode", |
| | | title: "ç©æç¼ç ", |
| | | type: "string", |
| | | width: 110, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "materielName", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "batchNo", |
| | | title: "æ¹æ¬¡å·", |
| | | type: "string", |
| | | width: 130, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "materielSpec", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "sysQty", |
| | | title: "è´¦é¢æ°é", |
| | | type: "decimal", |
| | | width: 90, |
| | | align: "left", |
| | | required: true, |
| | | edit: { type: "decimal" } |
| | | }, |
| | | { |
| | | field: "qty", |
| | | title: "å®çæ°é", |
| | | type: "decimal", |
| | | width: 90, |
| | | align: "left", |
| | | required: true, |
| | | edit: { type: "decimal" } |
| | | }, |
| | | { |
| | | field: "unit", |
| | | title: "åä½", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "modifier", |
| | | title: "ä¿®æ¹äºº", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "modifyDate", |
| | | title: "ä¿®æ¹æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | ], |
| | | sortName: "id", |
| | | key: "id", |
| | | }); |
| | | return { |
| | | table, |
| | | extend, |
| | | editFormFields, |
| | | editFormOptions, |
| | | searchFormFields, |
| | | searchFormOptions, |
| | | columns, |
| | | detail, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | <template> |
| | | <!-- <div> |
| | | <assemble-dist></assemble-dist> |
| | | </div> --> |
| | | <view-grid |
| | | ref="grid" |
| | | :columns="columns" |
| | | :detail="detail" |
| | | :editFormFields="editFormFields" |
| | | :editFormOptions="editFormOptions" |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend" |
| | | > |
| | | </view-grid> |
| | | </template> |
| | | <script> |
| | | import extend from "@/extension/inbound/takeStockOrderDetail.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | // import AssembleDistVue from '../charts/AssembleDist.vue'; |
| | | export default defineComponent({ |
| | | // components: { |
| | | // 'assemble-dist': AssembleDistVue, |
| | | // }, |
| | | setup() { |
| | | //使ç¨ç»ä»¶AssembleDist |
| | | const table = ref({ |
| | | key: "id", |
| | | footer: "Foots", |
| | | cnName: "çç¹å", |
| | | name: "TakeStockOrderDetail", |
| | | url: "/TakeStockOrderDetail/", |
| | | sortName: "id", |
| | | }); |
| | | |
| | | const searchFormFields = ref({ |
| | | orderNo:"" |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "çç¹åæ®", field: "takeStockNo", type: "like" }, |
| | | { title: "çç¹æç®±", field: "takePalletCode", type: "like" }, |
| | | { title: "ç©æç¼å·", field: "materielCode", type: "like" }, |
| | | { title: "æ¹æ¬¡å·", field: "batchNo", type: "like" }, |
| | | |
| | | ], |
| | | [ |
| | | { title: "æ¡ç ", field: "barcode", type: "like" }, |
| | | { title: "ä»åº", field: "warehouseCode", type: "like" }, |
| | | { title: "ååº", field: "factoryArea", type: "like" }, |
| | | { title: "ä¾åºåç¼å·", field: "supplyCode", type: "like" }, |
| | | ], |
| | | [ |
| | | { title: "å建人", field: "creater", type: "like" }, |
| | | { title: "å建æ¶é´", field: "createDate", type: "datetime" }, |
| | | ] |
| | | ]); |
| | | |
| | | const editFormFields = ref({ |
| | | orderNo:"", |
| | | warehouseId: "", |
| | | remark:"" |
| | | }); |
| | | const editFormOptions = ref([ |
| | | [ |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "string", |
| | | readonly: "true", |
| | | }, |
| | | { |
| | | title: "ä»åº", |
| | | field: "warehouseId", |
| | | type: "select", |
| | | dataKey: "warehouses", |
| | | data: [], |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | } |
| | | ] |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "takeStockId", |
| | | title: "çç¹å主é®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "takeStockNo", |
| | | title: "çç¹åæ®", |
| | | type: "string", |
| | | width: 145, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "takePalletCode", |
| | | title: "çç¹æç®±", |
| | | type: "string", |
| | | width: 110, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | |
| | | { |
| | | field: "materielCode", |
| | | title: "ç©æç¼ç ", |
| | | type: "string", |
| | | width: 130, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "materielName", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "batchNo", |
| | | title: "æ¹æ¬¡å·", |
| | | type: "string", |
| | | width: 130, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "barcode", |
| | | title: "æ¡ç ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "sysQty", |
| | | title: "è´¦é¢æ°é", |
| | | type: "decimal", |
| | | width: 90, |
| | | align: "left", |
| | | required: true, |
| | | edit: { type: "decimal" } |
| | | }, |
| | | { |
| | | field: "qty", |
| | | title: "å®çæ°é", |
| | | type: "decimal", |
| | | width: 90, |
| | | align: "left", |
| | | required: true, |
| | | edit: { type: "decimal" } |
| | | }, |
| | | { |
| | | field: "unit", |
| | | title: "åä½", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "takeDetalStatus", |
| | | title: "çç¹æç»ç¶æ", |
| | | type: "int", |
| | | width: 130, |
| | | align: "left", |
| | | bind: { key: "takeStockDetailStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "warehouseCode", |
| | | title: "ä»åºç¼å·", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "factoryArea", |
| | | title: "ååº", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "supplyCode", |
| | | title: "ä¾åºåç¼å·", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | ]); |
| | | const detail = ref({ |
| | | cnName: "çç¹æç»", |
| | | table: "Dt_TakeStockOrderDetail", |
| | | columns: [ |
| | | |
| | | ], |
| | | sortName: "id", |
| | | key: "id", |
| | | }); |
| | | return { |
| | | table, |
| | | extend, |
| | | editFormFields, |
| | | editFormOptions, |
| | | searchFormFields, |
| | | searchFormOptions, |
| | | columns, |
| | | detail, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Attributes; |
| | | |
| | | namespace WIDESEA_DTO.Inbound |
| | | { |
| | | public class CompleteStockTakeDTO |
| | | { |
| | | |
| | | public string orderNo { get; set; } |
| | | |
| | | public string boxNo { get; set; } |
| | | |
| | | public string barcode { get; set; } |
| | | |
| | | public decimal actualQuantity { get; set; } |
| | | |
| | | public decimal stockQuantity { get; set; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IInboundService |
| | | { |
| | | public interface ITakeStockOrderDetailService:IService<Dt_TakeStockOrderDetail> |
| | | { |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IInboundService |
| | | { |
| | | public interface ITakeStockOrderService : IService<Dt_TakeStockOrder> |
| | | { |
| | | WebResponseContent ValidateBoxNo(string orderNo, string boxNo); |
| | | |
| | | WebResponseContent ValidateBarcode(string boxNo, string barcode); |
| | | |
| | | WebResponseContent CompleteStockTake([FromBody] CompleteStockTakeDTO completeStockTakeDTO); |
| | | |
| | | WebResponseContent ReturnBox(string orderNo, string boxNo); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_InboundService |
| | | { |
| | | public class TakeStockOrderDetailService : ServiceBase<Dt_TakeStockOrderDetail, IRepository<Dt_TakeStockOrderDetail>>, ITakeStockOrderDetailService |
| | | |
| | | { |
| | | public IRepository<Dt_TakeStockOrderDetail> Repository => BaseDal; |
| | | public TakeStockOrderDetailService(IRepository<Dt_TakeStockOrderDetail> BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Core.Helper; |
| | | using Microsoft.AspNetCore.Mvc.RazorPages; |
| | | using WIDESEA_Core.Enums; |
| | | using SqlSugar; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Common.StockEnum; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.ReturnMES; |
| | | using MailKit.Search; |
| | | using static System.Collections.Specialized.BitVector32; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_IBasicService; |
| | | |
| | | namespace WIDESEA_InboundService |
| | | { |
| | | public class TakeStockOrderService : ServiceBase<Dt_TakeStockOrder, IRepository<Dt_TakeStockOrder>>, ITakeStockOrderService |
| | | { |
| | | public IRepository<Dt_TakeStockOrder> Repository => BaseDal; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder; |
| | | private readonly IRepository<Dt_StockInfo> _stockInfoRepository; |
| | | private readonly IRepository<Dt_TakeStockOrderDetail> _takeStockOrderDetail; |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | public TakeStockOrderService(IRepository<Dt_TakeStockOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfo> stockInfoRepository,IRepository<Dt_TakeStockOrderDetail> takeStockOrderDetail,IRepository<Dt_Task> taskRepository,ILocationInfoService locationInfoService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _takeStockOrder = takeStockOrder; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _takeStockOrderDetail = takeStockOrderDetail; |
| | | _taskRepository = taskRepository; |
| | | _locationInfoService = locationInfoService; |
| | | } |
| | | |
| | | public WebResponseContent ValidateBoxNo(string orderNo, string boxNo) |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockInfoRepository.QueryFirst(x => x.PalletCode == boxNo); |
| | | if (stockInfo == null) { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥æçåºå"); |
| | | } |
| | | if(stockInfo.StockStatus != StockStatusEmun.çç¹åºåºå®æ.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error("该æçå¤äºéçç¹ç¶æï¼è¯·æ£æ¥çç¹ä»»å¡"); |
| | | } |
| | | Dt_TakeStockOrder takeStockOrder = _takeStockOrder.QueryFirst(x=>x.OrderNo == orderNo); |
| | | if (takeStockOrder == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥çç¹åæ®"); |
| | | } |
| | | if (takeStockOrder.AllPalletCode.Contains(",")) |
| | | { |
| | | var remarkValues = takeStockOrder.AllPalletCode |
| | | .Split(',') |
| | | .Select(s => s.Trim()) |
| | | .Where(s => !string.IsNullOrWhiteSpace(s)) |
| | | .ToList(); |
| | | if (remarkValues.Count == 0) |
| | | { |
| | | return WebResponseContent.Instance.Error("çç¹åç®±å·ä»
å
å«éå·ï¼æ ææç®±å·æ°æ®"); |
| | | } |
| | | |
| | | bool isMatch = remarkValues.Any(val => val.Equals(boxNo, StringComparison.OrdinalIgnoreCase)); |
| | | if (!isMatch) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç®±å·ã{boxNo}ãæªå¨çç¹åç®±å·ã{takeStockOrder.Remark}ã䏿¾å°å¹é
项"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | bool isMatch = takeStockOrder.Remark.Trim().Equals(boxNo, StringComparison.OrdinalIgnoreCase); |
| | | if (!isMatch) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ç®±å·ã{boxNo}ãä¸çç¹åç®±å·ã{takeStockOrder.Remark}ãä¸å¹é
"); |
| | | } |
| | | } |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent ValidateBarcode(string boxNo, string barcode) |
| | | { |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == boxNo).Includes(x => x.Details).First(); |
| | | if(stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥æç®±åºåä¿¡æ¯"); |
| | | } |
| | | if(stockInfo.Details == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥æç®±åºå"); |
| | | } |
| | | List<string> barcodes = stockInfo.Details.Select(x => x.Barcode).ToList(); |
| | | |
| | | bool isMatch = barcodes.Any(val => val.Equals(barcode, StringComparison.OrdinalIgnoreCase)); |
| | | if (!isMatch) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æ¡ç ã{barcode}ãæªå¨ã{boxNo}ãæç®±æ¡ç 䏿¾å°å¹é
项"); |
| | | } |
| | | var stockDetail = stockInfo.Details.FirstOrDefault(x=>x.Barcode == barcode); |
| | | |
| | | var resultData = new { stockQuantity = stockDetail.StockQuantity }; |
| | | |
| | | return WebResponseContent.Instance.OK(data:resultData); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent CompleteStockTake([FromBody] CompleteStockTakeDTO completeStockTakeDTO) |
| | | { |
| | | try |
| | | { |
| | | Dt_TakeStockOrder takeStockOrder = _takeStockOrder.QueryFirst(x=>x.OrderNo == completeStockTakeDTO.orderNo); |
| | | if (takeStockOrder == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥çç¹åæ®"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == completeStockTakeDTO.boxNo).Includes(x=>x.Details).First(); |
| | | if(stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥æçåºå"); |
| | | } |
| | | Dt_StockInfoDetail stockInfoDetail = stockInfo.Details.FirstOrDefault(x => x.Barcode == completeStockTakeDTO.barcode); |
| | | if(stockInfoDetail == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æ¡ç åºåæ°æ®æªæ¾å°å¹é
æ°æ®"); |
| | | } |
| | | Dt_TakeStockOrderDetail takeStockOrderDetail = new Dt_TakeStockOrderDetail() |
| | | { |
| | | TakeStockId = takeStockOrder.Id, |
| | | MaterielCode = stockInfoDetail.MaterielCode, |
| | | MaterielName = stockInfoDetail.MaterielName??"", |
| | | BatchNo = stockInfoDetail.BatchNo, |
| | | TakePalletCode = completeStockTakeDTO.boxNo, |
| | | TakeDetalStatus = TakeStockDetailStatusEnum.çç¹å®æ.ObjToInt(), |
| | | Unit = stockInfoDetail.Unit, |
| | | SysQty = completeStockTakeDTO.stockQuantity, |
| | | Qty =completeStockTakeDTO.actualQuantity, |
| | | Remark = completeStockTakeDTO.stockQuantity-completeStockTakeDTO.actualQuantity>=0 ?"çäº":"çç", |
| | | barcode = completeStockTakeDTO.barcode, |
| | | WarehouseCode = stockInfoDetail.WarehouseCode??"", |
| | | FactoryArea = stockInfoDetail.FactoryArea, |
| | | SupplyCode = stockInfoDetail.SupplyCode??"", |
| | | TakeStockNo = takeStockOrder.OrderNo, |
| | | |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _takeStockOrderDetail.AddData(takeStockOrderDetail); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent ReturnBox(string orderNo, string boxNo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_TakeStockOrder takeStockOrder = _takeStockOrder.QueryFirst(x=>x.OrderNo == orderNo); |
| | | if(takeStockOrder == null) |
| | | { |
| | | return content.Error("æªæ¾å°è¯¥çç¹åæ®"); |
| | | } |
| | | var stock = _stockInfoRepository.QueryFirst(x => x.PalletCode == boxNo); |
| | | |
| | | if (stock == null) |
| | | { |
| | | return content.Error($"æªæ¾å°æç{boxNo}åºåä¿¡æ¯ä¸å
许ååº"); |
| | | } |
| | | |
| | | var task = _taskRepository.QueryFirst(x => x.PalletCode == boxNo); |
| | | |
| | | |
| | | if (task != null) |
| | | { |
| | | return content.Error($"æç{boxNo}åå¨ä»»å¡ååºå¤±è´¥!"); |
| | | } |
| | | if(stock.StockStatus != StockStatusEmun.çç¹åºåºå®æ.ObjToInt()) |
| | | { |
| | | return content.Error("该æçç¶æä¸å¯¹,ä¸å
许çç¹å
¥åº"); |
| | | } |
| | | stock.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | |
| | | takeStockOrder.TakeStockStatus = TakeStockStatusEnum.çç¹å®æ.ObjToInt(); |
| | | // åé
æ°è´§ä½ |
| | | var newLocation = _locationInfoService.AssignLocation(stock.LocationType); |
| | | |
| | | var newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = takeStockOrder.Remark, |
| | | Grade = 0, |
| | | PalletCode = boxNo, |
| | | NextAddress = "", |
| | | OrderNo = takeStockOrder.OrderNo, |
| | | Roadway = newLocation.RoadwayNo, |
| | | SourceAddress = takeStockOrder.Remark, |
| | | TargetAddress = newLocation.LocationCode, |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = TaskTypeEnum.InInventory.ObjToInt(), |
| | | PalletType = stock.PalletType, |
| | | WarehouseId = stock.WarehouseId |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockInfoRepository.UpdateData(stock); |
| | | _takeStockOrder.UpdateData(takeStockOrder); |
| | | _taskRepository.AddData(newTask); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | //var moveResult = await _eSSApiService.MoveContainerAsync(new MoveContainerRequest |
| | | //{ |
| | | // slotCode = movestations[station], |
| | | // containerCode = palletCode |
| | | //}); |
| | | return content.OK(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | using SqlSugar; |
| | | using Magicodes.ExporterAndImporter.Core; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// ä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | [ExporterHeader(DisplayName = "主é®")] |
| | | public int Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹åä¸»é® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "çç¹å主é®")] |
| | | [ExporterHeader(DisplayName = "çç¹å主é®")] |
| | | public int TakeStockId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æç¼ç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "ç©æç¼ç ")] |
| | | [ExporterHeader(DisplayName = "ç©æç¼ç ")] |
| | | public string MaterielCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æåç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 200, ColumnDescription = "ç©æåç§°")] |
| | | [ExporterHeader(DisplayName = "ç©æåç§°")] |
| | | public string MaterielName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¹æ¬¡å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "æ¹æ¬¡å·")] |
| | | [ExporterHeader(DisplayName = "æ¹æ¬¡å·")] |
| | | public string BatchNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æè§æ ¼ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "ç©æè§æ ¼")] |
| | | [ExporterHeader(DisplayName = "ç©æè§æ ¼")] |
| | | public string MaterielSpec { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä»ä½ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åä»ä½")] |
| | | [ExporterHeader(DisplayName = "åä»ä½")] |
| | | public string LocationCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹æç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "çç¹æç")] |
| | | [ExporterHeader(DisplayName = "çç¹æç")] |
| | | public string TakePalletCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹æç»ç¶æ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "çç¹æç»ç¶æ")] |
| | | [ExporterHeader(DisplayName = "çç¹æç»ç¶æ")] |
| | | public int TakeDetalStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "åä½")] |
| | | [ExporterHeader(DisplayName = "åä½")] |
| | | public string Unit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è´¦é¢æ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "è´¦é¢æ°é")] |
| | | [ExporterHeader(DisplayName = "è´¦é¢æ°é")] |
| | | public decimal SysQty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// å®çæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "å®çæ°é")] |
| | | [ExporterHeader(DisplayName = "å®çæ°é")] |
| | | public decimal Qty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "夿³¨")] |
| | | [ExporterHeader(DisplayName = "夿³¨")] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¡ç |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "æ¡ç ")] |
| | | [ExporterHeader(DisplayName = "æ¡ç ")] |
| | | public string barcode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç©æä»åº |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "ç©æä»åº")] |
| | | [ExporterHeader(DisplayName = "ç©æä»åº")] |
| | | public string WarehouseCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ååº |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 10, ColumnDescription = "ååº")] |
| | | [ExporterHeader(DisplayName = "ååº")] |
| | | public string FactoryArea { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºåç¼å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "ä¾åºåç¼å·")] |
| | | [ExporterHeader(DisplayName = "ä¾åºåç¼å·")] |
| | | public string SupplyCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// çç¹ååæ® |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "çç¹ååæ®")] |
| | | [ExporterHeader(DisplayName = "çç¹ååæ®")] |
| | | public string TakeStockNo { get; set; } |
| | | } |
| | | } |
| | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "takeStockStatusEnum": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | Type type = typeof(TakeStockStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TakeStockStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TakeStockStatusEnum).GetField(((TakeStockStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "takeStockDetailStatusEnum": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | Type type = typeof(TakeStockDetailStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TakeStockDetailStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TakeStockDetailStatusEnum).GetField(((TakeStockDetailStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | } |
| | | return result; |
| | | } |
| | |
| | | private readonly IRepository<Dt_AllocateMaterialInfo_Hty> _allocateMaterialInfo_Hty; |
| | | private readonly HttpClientHelper _httpClientHelper; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IRepository<Dt_TakeStockOrder> _takeStockOrder; |
| | | public IRepository<Dt_Task> Repository => BaseDal; |
| | | |
| | | private Dictionary<string, SqlSugar.OrderByType> _taskOrderBy = new() |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService) : base(BaseDal) |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_StockInfo> stockRepository, ILocationInfoService locationInfoService, IInboundOrderService inboundOrderService, ILocationStatusChangeRecordService locationStatusChangeRecordService, IESSApiService eSSApiService, ILogger<TaskService> logger, IStockService stockService, IRecordService recordService, IInboundOrderDetailService inboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IInvokeMESService invokeMESService, IOutStockLockInfoService outStockLockInfoService, IAllocateService allocateService, IRepository<Dt_OutboundBatch> outboundBatchRepository, IRepository<Dt_ReCheckOrder> reCheckOrderRepository, IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IMaterialUnitService materialUnitService, ITask_HtyService task_HtyService, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfo, IRepository<Dt_AllocateMaterialInfo_Hty> allocateMaterialInfo_Hty, HttpClientHelper httpClientHelper, IBasicService basicService,IRepository<Dt_TakeStockOrder> takeStockOrder) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _allocateMaterialInfo_Hty = allocateMaterialInfo_Hty; |
| | | _httpClientHelper = httpClientHelper; |
| | | _basicService = basicService; |
| | | _takeStockOrder = takeStockOrder; |
| | | } |
| | | |
| | | public async Task TaskStatusChange(string taskNum, TaskStatusEnum taskStatusEnum) |
| | |
| | | return TaskCompleted(TaskNum); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çç¹åºåºå®æ |
| | | /// </summary> |
| | | public WebResponseContent OutInventoryTaskCompleted(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | task = BaseDal.QueryFirst(x => x.TaskNum == task.TaskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | var SourceAddress = task.SourceAddress; |
| | | Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.QueryFirst(x=>x.PalletCode == task.PalletCode); |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == SourceAddress); |
| | | if (stockInfo == null) return WebResponseContent.Instance.Error("æªæ¾å°åºåä¿¡æ¯"); |
| | | if (locationInfo == null) return WebResponseContent.Instance.Error("æªæ¾å°è´§ä½ä¿¡æ¯"); |
| | | //è·å对åºçç¹å |
| | | Dt_TakeStockOrder takeStockOrder = _takeStockOrder.Db.Queryable<Dt_TakeStockOrder>().Where(x => x.OrderNo == task.OrderNo).Includes(x => x.Details).First(); |
| | | if (takeStockOrder == null) |
| | | { |
| | | return content.Error($"çç¹å{task.OrderNo}ä¸åå¨"); |
| | | } |
| | | if (takeStockOrder.TakeStockStatus != TakeStockStatusEnum.çç¹ä¸.ObjToInt()) |
| | | { |
| | | return content.Error($"çç¹å{task.OrderNo}çç¹å·²å®æææªå¼å§"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.åºåºéå®.ObjToInt()) |
| | | { |
| | | return content.Error($"{stockInfo.PalletCode}åºåç¶æä¸æ£ç¡®"); |
| | | } |
| | | if (locationInfo.LocationStatus != LocationStatusEnum.Lock.ObjToInt()) |
| | | { |
| | | return content.Error($"{locationInfo.LocationCode}è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.çç¹åºåºå®æ.ObjToInt(); |
| | | stockInfo.LocationCode = ""; |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | //è´§ä½åå¨è®°å½ |
| | | _basicService.LocationInfoService.UpdateData(locationInfo); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, LocationStatusEnum.Free.ObjToInt(), takeStockOrder?.OrderNo ?? "", task.TaskNum); |
| | | _stockRepository.UpdateData(stockInfo); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çç¹å
¥åºå®æ |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> InInventoryTaskCompleted(Dt_Task task) |
| | | { |
| | | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | if (locationInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°å¯¹åºçç»ç¹è´§ä½ä¿¡æ¯"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).First(); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°æç对åºçç»çä¿¡æ¯"); |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | if (locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | |
| | | |
| | | var beforelocationStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.PalletCode = task.PalletCode; |
| | | stockInfo.LocationCode = task.TargetAddress; |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | _stockRepository.UpdateData(stockInfo); |
| | | var result = _task_HtyService.DeleteAndMoveIntoHty(task, OperateTypeEnum.人工å é¤); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | if (!result) |
| | | { |
| | | await Db.Deleteable(task).ExecuteCommandAsync(); |
| | | } |
| | | try |
| | | { |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforelocationStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _logger.LogInformation($"InEmptyTaskCompleted AddLocationStatusChangeRecord : {ex.Message} "); |
| | | } |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return await Task.FromResult(WebResponseContent.Instance.Error(ex.Message)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | TargetAddress = outStation, |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType.ObjToInt(), |
| | | // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | //TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | }; |
| | |
| | | } |
| | | //è·åè´§ä½ |
| | | List<string> locStrs = stockInfos.Select(x => x.LocationCode).ToList(); |
| | | List<Dt_LocationInfo> locationInfos = (List<Dt_LocationInfo>)_locationInfoService.Db.Queryable<Dt_LocationInfo>().Where(x => locStrs.Contains(x.LocationCode)); |
| | | List<Dt_LocationInfo> locationInfos =_locationInfoService.Db.Queryable<Dt_LocationInfo>().Where(x => locStrs.Contains(x.LocationCode)).ToList(); |
| | | if (stockInfos.Count != locationInfos.Count) |
| | | { |
| | | string? locStr = locStrs.FirstOrDefault(x => !locationInfos.Select(x => x.LocationCode).ToList().Contains(x)); |
| | |
| | | WarehouseId = stockInfos.FirstOrDefault().WarehouseId, |
| | | TakeStockStatus = TakeStockStatusEnum.çç¹ä¸.ObjToInt(), |
| | | OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.PDCodeRule)), |
| | | Details = new List<Dt_TakeStockOrderDetail>() |
| | | AllPalletCode = string.Join(",", stockInfos.Select(item => item.PalletCode).Where(palletCode => !string.IsNullOrEmpty(palletCode))), |
| | | Remark = outStation |
| | | |
| | | }; |
| | | foreach (var item in stockInfos) |
| | | { |
| | |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.UpdateData(stockInfos); |
| | | BaseDal.Db.InsertNav(takeStockOrder); |
| | | _takeStockOrder.AddData(takeStockOrder); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(tasks); |
| | | _locationInfoService.UpdateData(locationInfos); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Inbound |
| | | { |
| | | /// <summary> |
| | | /// çç¹å |
| | | /// </summary> |
| | | [Route("api/TakeStockOrder")] |
| | | [ApiController] |
| | | public class TakeStockOrderController : ApiBaseController<ITakeStockOrderService, Dt_TakeStockOrder> |
| | | { |
| | | public TakeStockOrderController(ITakeStockOrderService service) : base(service) |
| | | { |
| | | } |
| | | /// <summary> |
| | | /// æç®±éªè¯ |
| | | /// </summary> |
| | | [HttpPost,HttpGet, Route("ValidateBoxNo"), AllowAnonymous] |
| | | public WebResponseContent ValidateBoxNo(string orderNo , string boxNo) |
| | | { |
| | | return Service.ValidateBoxNo(orderNo,boxNo); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¡ç éªè¯ |
| | | /// </summary> |
| | | [HttpPost, HttpGet, Route("ValidateBarcode"), AllowAnonymous] |
| | | public WebResponseContent ValidateBarcode( string boxNo,string barcode) |
| | | { |
| | | return Service.ValidateBarcode(boxNo, barcode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çç¹å®æè®°å½ |
| | | /// </summary> |
| | | [HttpPost, HttpGet, Route("CompleteStockTake"), AllowAnonymous] |
| | | public WebResponseContent CompleteStockTake([FromBody] CompleteStockTakeDTO completeStockTakeDTO) |
| | | { |
| | | return Service.CompleteStockTake(completeStockTakeDTO); |
| | | } |
| | | /// <summary> |
| | | /// çç¹æç®±ååº |
| | | /// </summary> |
| | | [HttpPost, HttpGet, Route("ReturnBox"), AllowAnonymous] |
| | | public WebResponseContent ReturnBox(string orderNo, string boxNo) |
| | | { |
| | | return Service.ReturnBox(orderNo, boxNo); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_IInboundService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers.Inbound |
| | | { |
| | | [Route("api/TakeStockOrderDetail")] |
| | | [ApiController] |
| | | public class TakeStockOrderDetailController : ApiBaseController<ITakeStockOrderDetailService, Dt_TakeStockOrderDetail> |
| | | { |
| | | public TakeStockOrderDetailController(ITakeStockOrderDetailService service) : base(service) |
| | | { |
| | | } |
| | | } |
| | | } |