| ¶Ô±ÈÐÂÎļþ |
| | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | import { el } from "element-plus/es/locales.mjs"; |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { |
| | | |
| | | let SelectTake = this.buttons.find(x => x.value == 'SelectStockTake'); |
| | | if (SelectTake) { |
| | | SelectTake.onClick = function () { |
| | | let stockViews = this.$refs.table.getSelected(); |
| | | this.http |
| | | .post("api/Task/TakeOutbound",stockViews, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.refresh(); |
| | | }); |
| | | } |
| | | } |
| | | this.columns.forEach(column => { |
| | | if (column.field == 'materielCode') { |
| | | column.formatter = (row) => { |
| | | var str = ''; |
| | | var list = row.materielCode.split(','); |
| | | for (let index = 0; index < list.length; index++) { |
| | | str += list[index] + '<br>'; |
| | | } |
| | | return str = list[0] == "" ? "空箱" : str; |
| | | } |
| | | } |
| | | if (column.field == 'batchNo') { |
| | | column.formatter = (row) => { |
| | | var str = ''; |
| | | var list = row.batchNo.split(','); |
| | | for (let index = 0; index < list.length; index++) { |
| | | str += list[index] + '<br>'; |
| | | } |
| | | return str = list[0] == "" ? "æ " : str; |
| | | } |
| | | } |
| | | if (column.field == 'materielInfo') { |
| | | const today = new Date() |
| | | column.formatter = (row) => { |
| | | if (row.details.length > 0) { |
| | | const today = new Date(); |
| | | const closestDate = row.details |
| | | .map(x => { |
| | | const date = new Date(x.effectiveDate); |
| | | const diffInDays = Math.ceil((date - today) / (1000 * 60 * 60 * 24)); // æ¹ä¸ºè®¡ç®å©ä½å¤©æ° |
| | | return { date, diffInDays }; |
| | | }) |
| | | .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest)) |
| | | .date; |
| | | |
| | | const daysRemaining = Math.ceil((closestDate - today) / (1000 * 60 * 60 * 24)); |
| | | |
| | | row.expiryDays = daysRemaining; |
| | | |
| | | if (daysRemaining <= 0) { |
| | | return '<span style="color:rgb(30, 27, 27)">æ ä¿è´¨æ</span>'; |
| | | } else { |
| | | return '<span style="color: #F56C6C">' + daysRemaining + "天" + '</span>'; |
| | | } |
| | | } else { |
| | | row.expiryDays = null; |
| | | return '<span style="color:rgb(24, 18, 18)">æ ä¿è´¨æ</span>'; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (column.field == 'inventoryage') { |
| | | const today = new Date() |
| | | column.formatter = (row) => { |
| | | if (row.details.length > 0) { |
| | | const closestDate = row.details |
| | | .map(x => { |
| | | const date = new Date(x.createDate); |
| | | const ageInDays = Math.ceil((today - date) / (1000 * 60 * 60 * 24)); |
| | | return { date, ageInDays }; |
| | | }) |
| | | .reduce((closest, current) => (current.ageInDays < closest.ageInDays ? current : closest)) |
| | | .date; |
| | | |
| | | const inventoryAge = Math.ceil((today - closestDate) / (1000 * 60 * 60 * 24)); |
| | | |
| | | row.inventoryAge = inventoryAge; |
| | | |
| | | return `${inventoryAge} 天`; |
| | | } |
| | | // å¦ææ²¡ææç»ï¼è¿å空ææç¤ºä¿¡æ¯ |
| | | return '-'; |
| | | } |
| | | } |
| | | if (column.field == 'sumStock') { |
| | | column.formatter = (row) => { |
| | | if (row.details.length > 0) { |
| | | var sum = 0; |
| | | const closestDate = row.details |
| | | .map(x => { |
| | | sum += (x.stockQuantity) |
| | | }) |
| | | return '<span style="color: rgb(24, 18, 18)">' + sum.toFixed(3) + row.details[0].unit + '</span>'; |
| | | } else { |
| | | return '<span style="color: rgb(24, 18, 18)">' + "1个" + '</span>'; |
| | | } |
| | | |
| | | } |
| | | } |
| | | }) |
| | | this.columns.forEach((column) => { |
| | | column.cellStyle = (row) => { |
| | | if (row.expirationlabel !== undefined && row.expirationlabel !== null) { |
| | | if (row.expirationlabel === 2) { |
| | | return { background: 'yellow' }; |
| | | } else if (row.expirationlabel === 3) { |
| | | return { background: '#ffc0cb' }; |
| | | } |
| | | } |
| | | return {}; |
| | | }; |
| | | }); |
| | | |
| | | }, |
| | | onInited() { |
| | | //æ¡æ¶åå§åé
ç½®å |
| | | //妿è¦é
ç½®æç»è¡¨,卿¤æ¹æ³æä½ |
| | | //this.detailOptions.columns.forEach(column=>{ }); |
| | | this.detailOptions.summary = true; |
| | | this.detailOptions.columns.forEach(x => { |
| | | if (x.field == 'stockQuantity') { |
| | | x.summary = true; |
| | | //计ç®å¹³åå¼ |
| | | // x.summary = 'avg';//2023.05.03æ´æ°voltableæä»¶åæè½ä½¿ç¨ |
| | | //è®¾ç½®å°æ°æ¾ç¤ºä½æ°(é»è®¤2ä½) |
| | | // x.numberLength = 4; |
| | | } |
| | | }); |
| | | }, |
| | | 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; |
| | |
| | | path: '/proCollectOutOrder', |
| | | name: 'proCollectOutOrder', |
| | | component: () => import('@/views/outbound/proCollectOutOrder.vue') |
| | | }, { |
| | | path: '/ToUserStockView', |
| | | name: 'ToUserStockView', |
| | | component: () => import('@/views/stock/ToUserStockView.vue') |
| | | } |
| | | ] |
| | | export default viewgird |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | <template> |
| | | <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/stock/ToUserStockView.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: "stockId", |
| | | footer: "Foots", |
| | | cnName: "åºåè§å¾", |
| | | name: "StockView", |
| | | url: "/StockView/", |
| | | sortName: "stockId", |
| | | }); |
| | | const editFormFields = ref({ |
| | | palletCode: "", |
| | | locationCode: "", |
| | | locationName: "", |
| | | |
| | | }); |
| | | const editFormOptions = ref([ |
| | | |
| | | ]); |
| | | const searchFormFields = ref({ |
| | | palletCode: "", |
| | | // locationCode: "", |
| | | materielCode:"", |
| | | batchNo:"", |
| | | expirationlabel:"1", |
| | | |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "æçç¼å·", field: "palletCode",type: "like" }, |
| | | { title: "è´§ä½ç¼å·", field: "locationCode",type: "like" }, |
| | | { title: "è´§ä½ç¶æ", field: "locationStatus" ,type: "selectList",dataKey: "locationStatusEnum",data: [],}, |
| | | { title: "åºåç¶æ", field: "stockStatus",type: "selectList",dataKey: "stockStatusEmun",data: [],}, |
| | | ], |
| | | [ |
| | | { title: "ç©æç¼å·", field: "materielCode",type: "like"}, |
| | | { title: "æ¹æ¬¡å·", field: "batchNo",type: "like"}, |
| | | { title: "æå±ä»åº", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],}, |
| | | { title: "åºåå建æ¶é´",field: "createDate",type: "datetime"}, |
| | | ], |
| | | [ |
| | | { title: "ææææ¥è¯¢",field: "effectiveDate",type: "date"}, |
| | | {title: "ç©ææææ",field: "expirationlabel",type: "selectList",dataKey:"expirationlabelEnum",data:[]}, |
| | | { title: "åºé¾(å°äº)", field: "inventoryage",type: "string"}, |
| | | { title: "åºé¾(大äº)", field: "inventoryage1",type: "string"}, |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | | field: "stockId", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "palletCode", |
| | | title: "æçç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | link: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "locationCode", |
| | | title: "è´§ä½ç¼å·", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "locationName", |
| | | title: "è´§ä½åç§°", |
| | | type: "string", |
| | | width: 270, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "warehouseId", |
| | | title: "æå±ä»åº", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | bind: { key: "warehouses", data: [] }, |
| | | }, |
| | | { |
| | | field: "roadwayNo", |
| | | title: "å··éç¼å·", |
| | | type: "decimal", |
| | | width: 100, |
| | | align: "left", |
| | | hidden:true |
| | | }, |
| | | { |
| | | field: "materielCode", |
| | | title: "æå«ç©æç¼å·", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "batchNo", |
| | | title: "æå«ç©ææ¹æ¬¡", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left" |
| | | }, |
| | | { |
| | | field: "expirationlabel", |
| | | title: "ç©ææææ", |
| | | type: "string", |
| | | width: 140, |
| | | align: "left", |
| | | bind: { key: "expirationlabelEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "materielInfo", |
| | | title: "æå«ç©æææ©ä¸´æ", |
| | | type: "string", |
| | | width: 140, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "inventoryage", |
| | | title: "åºé¾", |
| | | type: "string", |
| | | width: 140, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "sumStock", |
| | | title: "æ»åºå", |
| | | type: "string", |
| | | width: 140, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "row", |
| | | title: "è´§ä½è¡", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "column", |
| | | title: "è´§ä½å", |
| | | type: "int", |
| | | width: 120, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "layer", |
| | | title: "è´§ä½å±", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "depth", |
| | | title: "è´§ä½æ·±åº¦", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "stockStatus", |
| | | title: "åºåç¶æ", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | bind: { key: "stockStatusEmun", data: [] }, |
| | | }, |
| | | |
| | | { |
| | | field: "locationType", |
| | | title: "è´§ä½ç±»å", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | bind:{key: "locationTypeEnum", data: []} |
| | | }, |
| | | { |
| | | field: "locationStatus", |
| | | title: "è´§ä½ç¶æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | bind: { key: "locationStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "enalbeStatus", |
| | | title: "ç¦ç¨ç¶æ", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | bind: { key: "enableStatusEnum", data: [] }, |
| | | }, |
| | | { |
| | | 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", |
| | | hidden:true |
| | | }, |
| | | ]); |
| | | const detail = ref({ |
| | | cnName: "åºåæç»ä¿¡æ¯", |
| | | table: "StockInfoDetail", |
| | | columns: [ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "stockId", |
| | | title: "åºåä¿¡æ¯ä¸»é®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "materielCode", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 110, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materielName", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 130, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "decimal", |
| | | width: 130, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "batchNo", |
| | | title: "æ¹æ¬¡å·", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materielSpec", |
| | | title: "è§æ ¼åå·", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "serialNumber", |
| | | title: "åºåå·", |
| | | type: "int", |
| | | width: 120, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "stockQuantity", |
| | | title: "åºåæ°é", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "outboundQuantity", |
| | | title: "åºåºæ°é", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "unit", |
| | | title: "åä½", |
| | | type: "string", |
| | | width: 50, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "productionDate", |
| | | title: "çäº§æ¥æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "effectiveDate", |
| | | title: "æææ¥æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "status", |
| | | title: "åºåæç»ç¶æ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | bind: { key: "stockStatusEmun", data: [] } |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "modifier", |
| | | title: "ä¿®æ¹äºº", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "modifyDate", |
| | | title: "ä¿®æ¹æ¶é´", |
| | | type: "datetime", |
| | | width: 160, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "remark", |
| | | title: "夿³¨", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | ], |
| | | sortName: "id", |
| | | key: "id", |
| | | }); |
| | | return { |
| | | table, |
| | | extend, |
| | | editFormFields, |
| | | editFormOptions, |
| | | searchFormFields, |
| | | searchFormOptions, |
| | | columns, |
| | | detail, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
| | | |
| | |
| | | palletCode: "", |
| | | locationCode: "", |
| | | locationName: "", |
| | | |
| | | }); |
| | | const editFormOptions = ref([ |
| | | |
| | |
| | | palletCode: "", |
| | | // locationCode: "", |
| | | materielCode:"", |
| | | batchNo:"" |
| | | batchNo:"", |
| | | expirationlabel:"", |
| | | |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | |
| | | .Where(x => x.LocationCode == param.Value.ToString()); |
| | | } |
| | | break; |
| | | case var name when name == nameof(Dt_StockInfo.PalletCode).FirstLetterToLower(): |
| | | if (!string.IsNullOrEmpty(param.Value?.ToString())) |
| | | { |
| | | sugarQueryable1 = sugarQueryable1 |
| | | .Where(x => x.PalletCode == param.Value.ToString()); |
| | | } |
| | | break; |
| | | |
| | | case var name when name == nameof(Dt_StockInfo.CreateDate).FirstLetterToLower(): |
| | | if (DateTime.TryParse(param.Value?.ToString(), out DateTime minDate)) |
| | |
| | | } |
| | | } |
| | | } |
| | | if(task.WarehouseId == 11 || task.WarehouseId == 4||task.WarehouseId == 13) |
| | | if(task.WarehouseId == 11 || task.WarehouseId == 4||task.WarehouseId == 12) |
| | | { |
| | | _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(stockInfo, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å é¤ : OperateTypeEnum.人工å é¤); |
| | | _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(stockInfo.Details, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å é¤ : OperateTypeEnum.人工å é¤); |