| ¶Ô±ÈÐÂÎļþ |
| | |
| | | |
| | | //æ¤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 InOrder = this.buttons.find(x => x.value == 'StockOutbound'); |
| | | // if (InOrder) { |
| | | // InOrder.onClick = function () { |
| | | // let rows = this.$refs.table.getSelected(); |
| | | // if (rows.length == 0) return this.$error("è¯·éæ©æ°æ®!"); |
| | | // if (rows.length > 1) return this.$error("è¯·éæ©åæ¡æ°æ®!"); |
| | | // var keys = rows.map(x => { return x.stockId }); |
| | | // this.http |
| | | // .post("api/Task/Outbound?id="+keys[0], null, "æ°æ®å¤çä¸") |
| | | // .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(Math.abs((today - date) / (1000 * 60 * 60 * 24))); |
| | | return { date, diffInDays }; |
| | | }) |
| | | .reduce((closest, current) => (current.diffInDays < closest.diffInDays ? current : closest)) |
| | | .date; |
| | | |
| | | const daysSinceClosest = Math.ceil(Math.abs((today - closestDate) / (1000 * 60 * 60 * 24))); |
| | | return '<span style="color: #F56C6C">' + daysSinceClosest + "天" + '</span>'; |
| | | } else { |
| | | return '<span style="color: #F56C6C">' + "æ ä¿è´¨æ" + '</span>'; |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (column.field == 'proinventoryage') { |
| | | 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: #F56C6C">' + sum + row.details[0].unit + '</span>'; |
| | | } else { |
| | | return '<span style="color: #F56C6C">' + "1个" + '</span>'; |
| | | } |
| | | |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | 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; |
| | |
| | | |
| | | |
| | | let extension = { |
| | | components: {//卿æ©å
ç»ä»¶æç»ä»¶è·¯å¾ |
| | | //表åheaderãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridbody:'', |
| | | gridFooter: '', |
| | | //å¼¹åºæ¡(ä¿®æ¹ãç¼è¾ãæ¥ç)headerãcontentãfooter对åºä½ç½®æ©å
çç»ä»¶ |
| | | modelHeader: '', |
| | |
| | | modelFooter: '' |
| | | }, |
| | | buttons: [],//æ©å±çæé® |
| | | tableAction:"Sys_Role", |
| | | methods: {//äºä»¶æ©å± |
| | | onInited () { |
| | | this.height = this.height - 80; |
| | | this.editFormOptions.forEach(x => { |
| | | x.forEach(item => { |
| | | if (item.field == 'ParentId') { |
| | | item.title = "ä¸çº§è§è²"; |
| | | //设置任æèç¹é½è½éä¸(é»è®¤åªè½é䏿åä¸ä¸ªèç¹) |
| | | item.changeOnSelect = true; |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | onInit() { |
| | | //设置treetableçå¯ä¸å¼å段(è¿ä¸ªå段çå¼å¨è¡¨éé¢å¿
é¡»æ¯å¯ä¸ç) |
| | | this.rowKey="Role_Id"; |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | loadTreeChildren(tree, treeNode, resolve) { //å è½½åèç¹ |
| | | let url=`api/role/getTreeTableChildrenData?roleId=${tree.Role_Id}`; |
| | | this.http.post(url,{}).then(result=>{ |
| | | resolve(result.rows) |
| | | }) |
| | | }, |
| | | /***å è½½åå°æ°æ®è§Sys_RoleController.csæä»¶***/ |
| | | searchBefore(params){//夿å è½½æ ¹èç¹æåèç¹ |
| | | //æ²¡ææ¥è¯¢æ¡ä»¶ï¼é»è®¤æ¥è¯¢è¿åæææ ¹èç¹æ°æ® |
| | | if (!params.wheres.length) { |
| | | params.value=1; |
| | | } |
| | | return true; |
| | | onInited() { |
| | | } |
| | | } |
| | | }; |
| | |
| | | path: '/ToUserStockView', |
| | | name: 'ToUserStockView', |
| | | component: () => import('@/views/stock/ToUserStockView.vue') |
| | | }, { |
| | | path: '/ToUserProStockView', |
| | | name: 'ToUserProStockView', |
| | | component: () => import('@/views/stock/ToUserProStockView.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/ToUserProStockView.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: "proStockId", |
| | | footer: "Foots", |
| | | cnName: "æååºåè§å¾", |
| | | name: "proStockView", |
| | | url: "/proStockView/", |
| | | sortName: "proStockId", |
| | | }); |
| | | const editFormFields = ref({ |
| | | // palletCode: "", |
| | | // locationCode: "", |
| | | // locationName: "", |
| | | }); |
| | | const editFormOptions = ref([ |
| | | |
| | | ]); |
| | | const searchFormFields = ref({ |
| | | palletCode: "", |
| | | // locationCode: "", |
| | | materielCode:"", |
| | | batchNo:"", |
| | | specifyVer:"", |
| | | warehouseId:"7" |
| | | }); |
| | | const searchFormOptions = ref([ |
| | | [ |
| | | { title: "è¶æ¡å·", field: "palletCode",type: "like" }, |
| | | { title: "è´§ä½ç¶æ", field: "locationStatus" ,type: "selectList",dataKey: "locationStatusEnum",data: [],}, |
| | | { title: "åºåç¶æ", field: "stockStatus",type: "selectList",dataKey: "stockStatusEmun",data: [],}, |
| | | { title: "产åç¼ç ", field: "productCode",type: "like"}, |
| | | ], |
| | | [ |
| | | { title: "æ¹æ¬¡å·", field: "lotNumber",type: "like"}, |
| | | { title: "è´§ä½ç¼å·", field: "locationCode",type: "like" }, |
| | | { title: "ææ´¾çæ¬", field: "specifyVer",type: "like"}, |
| | | { title: "æå±ä»åº", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],}, |
| | | ], |
| | | [ |
| | | { title: "产åçæ¬", field: "productVersion",type: "like"}, |
| | | { title: "åºåå建æ¶é´",field: "createDate",type: "datetime"}, |
| | | ] |
| | | ]); |
| | | const columns = ref([ |
| | | { |
| | | field: "proStockId", |
| | | 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: 120, |
| | | align: "left", |
| | | bind: { key: "warehouses", data: [] }, |
| | | }, |
| | | { |
| | | field: "proStockAttribute", |
| | | title: "åºå屿§", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | bind: { key: "proStockAttributeEnum", data: [] }, |
| | | }, |
| | | { |
| | | field: "isFineWorks", |
| | | title: "æ¯å¦ç²¾å", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | bind: { key: "enableEnum", data: [] }, |
| | | }, |
| | | // { |
| | | // field: "roadwayNo", |
| | | // title: "å··éç¼å·", |
| | | // type: "decimal", |
| | | // width: 100, |
| | | // align: "left", |
| | | // hidden:true |
| | | // }, |
| | | { |
| | | field: "productCode", |
| | | title: "产åç¼ç ", |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "productVersion", |
| | | title: "çæ¬", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left" |
| | | }, |
| | | { |
| | | field: "specifyVer", |
| | | title: "ææ´¾çæ¬", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left" |
| | | }, |
| | | { |
| | | field: "dateCode", |
| | | title: "产å卿", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "proinventoryage", |
| | | title: "æååºé¾", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "lotNumber", |
| | | title: "äº§åæ¹å·", |
| | | type: "string", |
| | | width: 140, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "sumStocks", |
| | | title: "åºåæ°é", |
| | | type: "string", |
| | | width: 140, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "erpOrder", |
| | | title: "ERPå·¥å", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "moNumber", |
| | | title: "å¶é å·¥å", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "saleOrder", |
| | | title: "éå®è®¢å", |
| | | type: "string", |
| | | width: 200, |
| | | 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: 120, |
| | | 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: "ProStockInfoDetail", |
| | | columns: [ |
| | | { |
| | | field: "id", |
| | | title: "Id", |
| | | type: "int", |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "proStockId", |
| | | title: "åºåä¿¡æ¯ä¸»é®", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "bagNo", |
| | | title: "å
å
å·", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "productCode", |
| | | title: "产åç¼ç ", |
| | | type: "string", |
| | | width: 140, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "productVersion", |
| | | title: "产åçæ¬", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "dateCode", |
| | | title: "卿", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "saleOrder", |
| | | title: "éå®è®¢å", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "moNumber", |
| | | title: "å¶é 订å", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "erpOrder", |
| | | title: "ERPå·¥å", |
| | | type: "string", |
| | | width: 200, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "stockPcsQty", |
| | | title: "åºåPCSæ°", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "lotNumber", |
| | | title: "äº§åæ¹å·", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | // { |
| | | // field: "outboundQuantity", |
| | | // title: "åºåºPCSæ°é", |
| | | // type: "string", |
| | | // width: 90, |
| | | // align: "left", |
| | | // }, |
| | | // { |
| | | // field: "outSETQty", |
| | | // title: "åºåºSETæ°é", |
| | | // type: "string", |
| | | // width: 90, |
| | | // align: "left", |
| | | // }, |
| | | { |
| | | field: "xQty", |
| | | title: "Xæ°", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "xSite", |
| | | title: "Xä½", |
| | | type: "string", |
| | | width: 100, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "proOutDetailStatus", |
| | | title: "åºåç¶æ", |
| | | type: "int", |
| | | width: 120, |
| | | align: "left", |
| | | bind: { key: "stockStatusEmun", data: [] }, |
| | | }, |
| | | { |
| | | field: "weight", |
| | | title: "å
å
éé", |
| | | type: "string", |
| | | width: 80, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "creater", |
| | | title: "å建人", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | hidden: true |
| | | }, |
| | | { |
| | | field: "createDate", |
| | | title: "å建æ¶é´", |
| | | type: "datetime", |
| | | width: 130, |
| | | 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> |
| | | |
| | |
| | | { 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"}, |
| | | ], |
| | |
| | | } |
| | | } |
| | | |
| | | List<Dt_LocationInfo> allDefinedLocations = locationInfos |
| | | .Where(x => |
| | | (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && |
| | | x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && |
| | | x.LocationType == palletType.ObjToInt() && |
| | | !lockLocationCodes.Contains(x.LocationCode) |
| | | ) |
| | | .OrderByDescending(x => x.Depth) |
| | | .ThenBy(x => x.Layer) |
| | | .ThenBy(x => x.Column) |
| | | .ThenBy(x => x.Row) |
| | | .ToList(); |
| | | |
| | | //æªå®ä¹ç±»åçç©ºè´§ä½ |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList(); |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos |
| | | .Where(x => |
| | | (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && |
| | | x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && |
| | | x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && |
| | | !lockLocationCodes.Contains(x.LocationCode) |
| | | ) |
| | | .OrderByDescending(x => x.Depth) |
| | | .ThenBy(x => x.Layer) |
| | | .ThenBy(x => x.Column) |
| | | .ThenBy(x => x.Row) |
| | | .ToList(); |
| | | |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList(); |
| | | List<Dt_LocationInfo> _LocationInfos = definedTypeEmptyLocations; |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = new List<Dt_LocationInfo>(); |
| | | List<Dt_LocationInfo> definedLocations1_4 = new List<Dt_LocationInfo>(); // 1-4å±å·²å®ä¹è´§ä½ |
| | | List<Dt_LocationInfo> definedLocations5 = new List<Dt_LocationInfo>(); // 5å±å·²å®ä¹è´§ä½ |
| | | |
| | | if (heightType == 1) |
| | | { |
| | | definedLocations1_4 = allDefinedLocations.Where(x => x.Layer <= 4).ToList(); |
| | | definedLocations5 = allDefinedLocations.Where(x => x.Layer == 5).ToList(); |
| | | definedTypeEmptyLocations = definedLocations1_4; |
| | | // æªå®ä¹ç±»åä»
ä¿ç1-4å± |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x=>x.Layer <= 4).ToList(); |
| | | definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer <= 4).ToList(); |
| | | } |
| | | //else if(heightType == 2) |
| | | //{ |
| | | // undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 4).ToList(); |
| | | // definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 4).ToList(); |
| | | //} |
| | | else if (heightType == 2) |
| | | { |
| | | // ä»
ä¿ç5å± |
| | | definedTypeEmptyLocations = allDefinedLocations.Where(x => x.Layer == 5).ToList(); |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 5).ToList(); |
| | | definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 5).ToList(); |
| | | } |
| | | else |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => false).ToList(); |
| | | // å
¶ä»heightTypeï¼æ å¯ç¨è´§ä½ |
| | | definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => false).ToList(); |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => false).ToList(); |
| | | } |
| | | if (heightType==1 && !definedTypeEmptyLocations.Any()) |
| | | { |
| | | definedTypeEmptyLocations = _LocationInfos.Where(x => x.Layer == 5).ToList(); |
| | | } |
| | | |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | if (roadwayNo != "SC01_BC") |
| | |
| | | { |
| | | for (int i = 0; i < definedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo definedTypeEmptyLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, definedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | //å¤æè´§ä½ä¸¤æ·±å以䏿¯å¦åå¨åºåºéå®è´§ä½ |
| | | if (locationInfo?.Depth == 1) |
| | | Dt_LocationInfo currentLocation = definedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? usableLocation = GetUsableLocation_BC(locationInfos, currentLocation, palletType, palletTypeInfo); |
| | | |
| | | if (usableLocation?.Depth == 1) |
| | | { |
| | | Dt_LocationInfo? IsBebusyLocation = locationInfos.Where(x => x.Row == (locationInfo?.Row == 2 ? locationInfo?.Row - 1 : locationInfo?.Row + 1) && x.Column==locationInfo?.Column && x.Layer== locationInfo?.Layer).FirstOrDefault(); |
| | | if (IsBebusyLocation!=null && (IsBebusyLocation.LocationStatus<LocationStatusEnum.InStock.ObjToInt())) |
| | | int oppositeRow = usableLocation.Row == 2 ? usableLocation.Row - 1 : usableLocation.Row + 1; |
| | | Dt_LocationInfo? oppositeLocation = locationInfos.FirstOrDefault(x => |
| | | x.Row == oppositeRow && |
| | | x.Column == usableLocation.Column && |
| | | x.Layer == usableLocation.Layer |
| | | ); |
| | | if (oppositeLocation != null && (oppositeLocation.LocationStatus < LocationStatusEnum.InStock.ObjToInt())) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | if (locationInfo != null) |
| | | |
| | | if (usableLocation != null) |
| | | { |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = usableLocation.LocationCode, DateTime = DateTime.Now }); |
| | | return usableLocation; |
| | | } |
| | | } |
| | | } |
| | | if (undefinedTypeEmptyLocations.Any() && palletType!=PalletTypeEnum.SmallPallet.ObjToInt())//妿已å®ä¹ç±»åè´§ä½æªè¶
è¿æ¯ä¾ï¼ä¸ææªå®ä¹ç±»åçè´§ä½ |
| | | |
| | | if (heightType == 1 && definedLocations5.Any()) |
| | | { |
| | | List<Dt_LocationInfo> filtered5Locations = definedLocations5; |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | if (roadwayNo != "SC01_BC") |
| | | filtered5Locations = filtered5Locations.Where(x => x.Column % 2 == 1).ToList(); |
| | | else |
| | | filtered5Locations = filtered5Locations.Where(x => x.Column % 2 == 0).ToList(); |
| | | } |
| | | |
| | | for (int i = 0; i < filtered5Locations.Count; i++) |
| | | { |
| | | Dt_LocationInfo currentLocation = filtered5Locations[i]; |
| | | Dt_LocationInfo? usableLocation = GetUsableLocation_BC(locationInfos, currentLocation, palletType, palletTypeInfo); |
| | | |
| | | if (usableLocation?.Depth == 1) |
| | | { |
| | | int oppositeRow = usableLocation.Row == 2 ? usableLocation.Row - 1 : usableLocation.Row + 1; |
| | | Dt_LocationInfo? oppositeLocation = locationInfos.FirstOrDefault(x => |
| | | x.Row == oppositeRow && |
| | | x.Column == usableLocation.Column && |
| | | x.Layer == usableLocation.Layer |
| | | ); |
| | | if (oppositeLocation != null && (oppositeLocation.LocationStatus < LocationStatusEnum.InStock.ObjToInt())) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | if (usableLocation != null) |
| | | { |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = usableLocation.LocationCode, DateTime = DateTime.Now }); |
| | | return usableLocation; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (undefinedTypeEmptyLocations.Any() && palletType != PalletTypeEnum.SmallPallet.ObjToInt()) |
| | | { |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | |
| | | |
| | | for (int i = 0; i < undefinedTypeEmptyLocations.Count; i++) |
| | | { |
| | | Dt_LocationInfo undefinedTypeEmptyLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? locationInfo = GetUsableLocation_BC(locationInfos, undefinedTypeEmptyLocation, palletType, palletTypeInfo); |
| | | //å¤æè´§ä½ä¸¤æ·±å以䏿¯å¦åå¨åºåºéå®è´§ä½ |
| | | if (locationInfo?.Depth == 1) |
| | | Dt_LocationInfo currentLocation = undefinedTypeEmptyLocations[i]; |
| | | Dt_LocationInfo? usableLocation = GetUsableLocation_BC(locationInfos, currentLocation, palletType, palletTypeInfo); |
| | | |
| | | if (usableLocation?.Depth == 1) |
| | | { |
| | | Dt_LocationInfo? IsBebusyLocation = locationInfos.Where(x => x.Row == (locationInfo?.Row == 2 ? locationInfo?.Row - 1 : locationInfo?.Row + 1) && x.Column == locationInfo?.Column && x.Layer == locationInfo?.Layer).FirstOrDefault(); |
| | | if (IsBebusyLocation != null && (IsBebusyLocation.LocationStatus < LocationStatusEnum.InStock.ObjToInt())) |
| | | int oppositeRow = usableLocation.Row == 2 ? usableLocation.Row - 1 : usableLocation.Row + 1; |
| | | Dt_LocationInfo? oppositeLocation = locationInfos.FirstOrDefault(x => |
| | | x.Row == oppositeRow && |
| | | x.Column == usableLocation.Column && |
| | | x.Layer == usableLocation.Layer |
| | | ); |
| | | if (oppositeLocation != null && (oppositeLocation.LocationStatus < LocationStatusEnum.InStock.ObjToInt())) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | if (locationInfo != null) |
| | | { |
| | | //UpdateLocationStatus(locationInfo, palletType, LocationStatusEnum.Lock, locationInfo.WarehouseId); |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); |
| | | return locationInfo; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (usableLocation != null) |
| | | { |
| | | locationCaches_BC.Add(new LocationCache { LocationCode = usableLocation.LocationCode, DateTime = DateTime.Now }); |
| | | return usableLocation; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | |
| | | recevieOrderDetails.Add(recevieOrderDetail); |
| | | if (warehouse.WarehouseCode == WarehouseEnum.HA152.ToString() || warehouse.WarehouseCode == WarehouseEnum.HA58.ToString()) |
| | | { |
| | | string lotNo = item.LotNo.Substring(0, item.LotNo.IndexOf("-")); |
| | | string lotNo; |
| | | if (item.LotNo.Contains("-")) |
| | | { |
| | | lotNo = item.LotNo.Substring(0, item.LotNo.IndexOf("-")); |
| | | } |
| | | else |
| | | { |
| | | lotNo = item.LotNo; |
| | | } |
| | | Dt_CheckOrder? ExistcheckOrder = checkOrders.FirstOrDefault(x => x.LotNo == lotNo && x.MaterielCode == item.MaterielCode && x.PurchaseOrderNo == item.PurchaseOrderNo); |
| | | if (ExistcheckOrder == null) |
| | | { |
| | |
| | | { |
| | | if (webhookUrl == null || secret == null) |
| | | { |
| | | webhookUrl = "https://oapi.dingtalk.com/robot/send?access_token=fbc3aaf4133ea650d8116fb86b3ebfd0c5e0d46775966ce87893a41886bdf9dc"; |
| | | secret = "SECf221842b26356f22ccac84c4e60714e5287408ee8332a8f63503791382c3f5fb"; |
| | | webhookUrl = "https://oapi.dingtalk.com/robot/send?access_token=c3e05f2c6bcd595383ee02e713446174b9201bad91db216590620fe0acd4e75e"; |
| | | secret = "SEC617f06140fc7cbd8b91d3e203f270826320637af41e7423d756e62df40f62282"; |
| | | } |
| | | |
| | | // 1. å®ä¹ä»åºIDä¸ä»åºåç§°çæ å°å
³ç³»ï¼å¢å æåä»ï¼ |
| | | var warehouseIdToName = new Dictionary<int, string> |
| | | { |
| | | { 2, "油墨ä»" }, |
| | | { 3, "æ¿æä»" }, |
| | | { 4, "PPä»" }, |
| | | { 6, "æµè¯æ¶ä»" }, |
| | | { 7, "æåä»" }, // æ°å¢æåä» |
| | | { 11, "å¹²èä»" }, |
| | | { 12, "é»çä»" } |
| | | }; |
| | | |
| | | // 2. æ¶é´ç¸å
³é
ç½®ï¼ç¨äºçéè¶
è¿90å¤©çæ°æ® |
| | | var currentTime = DateTime.Now; |
| | | var ninetyDaysAgo = currentTime.AddDays(-90); |
| | | |
| | | // 3. å¤çåææä»ï¼ä»åºID â 7ï¼ |
| | | // 3.1 æ¥è¯¢æ è¯ç 为3ï¼è¿æï¼çä¸»è¡¨æ°æ®ï¼æé¤ä»åºID=5å7ï¼ |
| | | var expirationLabel3Stocks = BaseDal.Db.Queryable<Dt_StockInfo>() |
| | | .Where(s => s.Expirationlabel == 3 && s.WarehouseId != 5) |
| | | .Where(s => s.Expirationlabel == 3 && s.WarehouseId != 5 && s.WarehouseId != 7 && s.LocationCode != "" && s.LocationCode != null) |
| | | .ToList(); |
| | | |
| | | // 3.2 æ¥è¯¢è¶
è¿90天æªä¿®æ¹ï¼æªä½¿ç¨ï¼çä¸»è¡¨æ°æ®ï¼æé¤ä»åºID=5å7ï¼ |
| | | var over90DaysStocks = BaseDal.Db.Queryable<Dt_StockInfo>() |
| | | .Where(s => s.ModifyDate <= ninetyDaysAgo && s.Expirationlabel != 3 && s.WarehouseId != 5) |
| | | .Where(s => s.ModifyDate <= ninetyDaysAgo && s.Expirationlabel != 3 && s.WarehouseId != 5 && s.WarehouseId != 7 && s.LocationCode != "" && s.LocationCode != null) |
| | | .ToList(); |
| | | |
| | | if (!expirationLabel3Stocks.Any() && !over90DaysStocks.Any()) |
| | | // 4. å¤çæåä»ï¼ä»åºID = 7ï¼ |
| | | var proOver90DaysStocks = new List<Dt_ProStockInfo>(); |
| | | if (warehouseIdToName.ContainsKey(7)) |
| | | { |
| | | proOver90DaysStocks = BaseDal.Db.Queryable<Dt_ProStockInfo>() |
| | | .Where(s => s.WarehouseId == 7 && s.ModifyDate <= ninetyDaysAgo && s.LocationCode != "" && s.LocationCode != null) |
| | | .ToList(); |
| | | } |
| | | |
| | | // æ ç¬¦åæ¡ä»¶æ°æ®æ¶ç´æ¥è¿å |
| | | if (!expirationLabel3Stocks.Any() && !over90DaysStocks.Any() && !proOver90DaysStocks.Any()) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | // 5. æååææä¸»è¡¨æ°æ®çID |
| | | var expirationLabel3StockIds = expirationLabel3Stocks.Select(s => s.Id).ToList(); |
| | | var over90DaysStockIds = over90DaysStocks.Select(s => s.Id).ToList(); |
| | | |
| | | // 6. å
³èæ¥è¯¢åæææç»è¡¨æ°æ® |
| | | var expirationLabel3Details = expirationLabel3StockIds.Any() |
| | | ? BaseDal.Db.Queryable<Dt_StockInfoDetail>() |
| | | .Where(d => expirationLabel3StockIds.Contains(d.StockId)) |
| | |
| | | .ToList() |
| | | : new List<Dt_StockInfoDetail>(); |
| | | |
| | | var stockIdToWarehouseId = expirationLabel3Stocks |
| | | .Concat(over90DaysStocks) |
| | | .ToDictionary(s => s.Id, s => s.WarehouseId); |
| | | // 7. å¤çæåä»æç»æ°æ® |
| | | var proOver90DaysDetails = new List<Dt_ProStockInfoDetail>(); |
| | | if (proOver90DaysStocks.Any()) |
| | | { |
| | | var proStockIds = proOver90DaysStocks.Select(s => s.Id).ToList(); |
| | | proOver90DaysDetails = BaseDal.Db.Queryable<Dt_ProStockInfoDetail>() |
| | | .Where(d => proStockIds.Contains(d.ProStockId)) |
| | | .ToList(); |
| | | } |
| | | |
| | | // 8. 建ç«ä¸»è¡¨IDå°ä»åºIDçæ å°ï¼å
æ¬æåä»ï¼ |
| | | var stockIdToWarehouseId = new Dictionary<int, int>(); |
| | | |
| | | // 忿仿 å° |
| | | foreach (var stock in expirationLabel3Stocks.Concat(over90DaysStocks)) |
| | | { |
| | | if (!stockIdToWarehouseId.ContainsKey(stock.Id)) |
| | | { |
| | | stockIdToWarehouseId[stock.Id] = stock.WarehouseId; |
| | | } |
| | | } |
| | | |
| | | // æå仿 å° |
| | | foreach (var proStock in proOver90DaysStocks) |
| | | { |
| | | if (!stockIdToWarehouseId.ContainsKey(proStock.Id)) |
| | | { |
| | | stockIdToWarehouseId[proStock.Id] = proStock.WarehouseId; |
| | | } |
| | | } |
| | | |
| | | // 9. æä»åºåç»å¤çç©ææ°æ® |
| | | // 9.1 åææè¿æç©æ |
| | | var expirationLabel3Groups = expirationLabel3Details |
| | | .GroupBy(d => stockIdToWarehouseId[d.StockId]) |
| | | .ToDictionary(g => g.Key, g => g.Select(d => new |
| | | { |
| | | d.MaterielCode, |
| | | d.BatchNo |
| | | }).ToList()); |
| | | MaterielCode = d.MaterielCode, |
| | | BatchNo = d.BatchNo, |
| | | IsProStock = false // æ 记为éæåä» |
| | | }).Distinct().ToList()); |
| | | |
| | | // 9.2 åææè¶
è¿90天æªä½¿ç¨ç©æ |
| | | var over90DaysGroups = over90DaysDetails |
| | | .GroupBy(d => stockIdToWarehouseId[d.StockId]) |
| | | .ToDictionary(g => g.Key, g => g.Select(d => new |
| | | { |
| | | d.MaterielCode, |
| | | d.BatchNo |
| | | }).ToList()); |
| | | MaterielCode = d.MaterielCode, |
| | | BatchNo = d.BatchNo, |
| | | IsProStock = false // æ 记为éæåä» |
| | | }).Distinct().ToList()); |
| | | |
| | | // 9.3 æåä»è¶
è¿90天æªä½¿ç¨ç©æ |
| | | if (proOver90DaysDetails.Any()) |
| | | { |
| | | var proWarehouseId = 7; |
| | | var proGroup = proOver90DaysDetails |
| | | .GroupBy(d => stockIdToWarehouseId[d.ProStockId]) |
| | | .Select(g => new |
| | | { |
| | | WarehouseId = g.Key, |
| | | Materials = g.Select(d => new |
| | | { |
| | | MaterielCode = d.ProductCode, // æåä»ä½¿ç¨ProductCodeåæ®µ |
| | | BatchNo = d.LotNumber, // æåä»ä½¿ç¨LotNumberåæ®µ |
| | | IsProStock = true // æ 记为æåä» |
| | | }).Distinct().ToList() |
| | | }) |
| | | .FirstOrDefault(); |
| | | |
| | | if (proGroup != null) |
| | | { |
| | | // æ·»å å°over90DaysGroupsä¸ |
| | | if (over90DaysGroups.ContainsKey(proWarehouseId)) |
| | | { |
| | | over90DaysGroups[proWarehouseId].AddRange(proGroup.Materials); |
| | | } |
| | | else |
| | | { |
| | | over90DaysGroups[proWarehouseId] = proGroup.Materials; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 10. è·åæææ¶åçä»åºID |
| | | var allWarehouseIds = expirationLabel3Groups.Keys |
| | | .Union(over90DaysGroups.Keys) |
| | | .ToList(); |
| | | |
| | | // 11. åéééæ¶æ¯ |
| | | using (HttpClient httpClient = new HttpClient()) |
| | | { |
| | | foreach (var warehouseId in allWarehouseIds) |
| | | { |
| | | // 9.1 å¤çä»åºåç§°æ¾ç¤ºï¼ä¼å
ç¨æ å°åç§°ï¼æ æ å°æ¶æ¾ç¤ºåå§ID |
| | | var warehouseName = warehouseIdToName.TryGetValue(warehouseId, out var name) |
| | | ? name |
| | | : $"ä»åº{warehouseId}"; |
| | | |
| | | var messageParts = new List<string> |
| | | { |
| | | $"ã{warehouseName}ãç©ææé" |
| | | }; |
| | | // 11.1 æå»ºmarkdownæ ¼å¼æ¶æ¯ |
| | | var markdownContent = new StringBuilder(); |
| | | markdownContent.AppendLine($"## {warehouseName}ç©ææééç¥\n"); |
| | | |
| | | // æ·»å è¿æç©æä¿¡æ¯ |
| | | if (expirationLabel3Groups.TryGetValue(warehouseId, out var label3Materials) && label3Materials.Any()) |
| | | // ç»è®¡ä¿¡æ¯ |
| | | var expiredCount = expirationLabel3Groups.TryGetValue(warehouseId, out var expList) ? |
| | | expList.Count : 0; |
| | | |
| | | var over90Count = over90DaysGroups.TryGetValue(warehouseId, out var over90List) ? |
| | | over90List.Count : 0; |
| | | |
| | | // å¦ææ¯æåä»ï¼éè¦è¿æ»¤åºæåä»çæ°æ® |
| | | if (warehouseId == 7) |
| | | { |
| | | var label3Details = label3Materials |
| | | .Select(m => $"â¢ ç©æç¼ç ï¼{m.MaterielCode} | æ¹æ¬¡å·ï¼{m.BatchNo}") |
| | | .Aggregate((current, next) => $"{current}\n{next}"); |
| | | messageParts.Add($"ä¸ãè¿æç©æ\n{label3Details}"); |
| | | over90Count = over90List?.Count(m => m.IsProStock) ?? 0; |
| | | } |
| | | |
| | | // æ·»å è¶
è¿90天æªä½¿ç¨ç©æä¿¡æ¯ |
| | | if (over90DaysGroups.TryGetValue(warehouseId, out var over90Materials) && over90Materials.Any()) |
| | | markdownContent.AppendLine($"**ç»è®¡æ¦è§ï¼**"); |
| | | if (warehouseId == 7) |
| | | { |
| | | var over90Details = over90Materials |
| | | .Select(m => $"â¢ ç©æç¼ç ï¼{m.MaterielCode} | æ¹æ¬¡å·ï¼{m.BatchNo}") |
| | | .Aggregate((current, next) => $"{current}\n{next}"); |
| | | messageParts.Add($"äºãè¶
è¿90天æªä½¿ç¨ç©æ\n{over90Details}"); |
| | | markdownContent.AppendLine($"- è¶
è¿90天æªä½¿ç¨æåï¼{over90Count}æ¡"); |
| | | } |
| | | else |
| | | { |
| | | markdownContent.AppendLine($"- è¿æç©æï¼{expiredCount}æ¡"); |
| | | markdownContent.AppendLine($"- è¶
è¿90天æªä½¿ç¨ç©æï¼{over90Count}æ¡"); |
| | | } |
| | | markdownContent.AppendLine(); |
| | | |
| | | // 11.2 æ·»å è¿æç©æè¡¨æ ¼ï¼å¦æææ°æ®ä¸ä¸æ¯æåä»ï¼ |
| | | if (expiredCount > 0 && warehouseId != 7) |
| | | { |
| | | markdownContent.AppendLine("### ä¸ãè¿æç©æ"); |
| | | markdownContent.AppendLine("| åºå· | ç©æç¼ç | æ¹æ¬¡å· |"); |
| | | markdownContent.AppendLine("| :--- | :--- | :--- |"); |
| | | |
| | | int index = 1; |
| | | var expiredToShow = expList.Take(200); |
| | | foreach (var material in expiredToShow) |
| | | { |
| | | markdownContent.AppendLine($"| {index} | {material.MaterielCode} | {material.BatchNo} |"); |
| | | index++; |
| | | } |
| | | |
| | | var messageContent = string.Join("\n\n", messageParts); |
| | | if (expiredCount > 200) |
| | | { |
| | | markdownContent.AppendLine($"| ... | å
±{expiredCount}æ¡ï¼ä»
æ¾ç¤ºå200æ¡ | ... |"); |
| | | } |
| | | markdownContent.AppendLine(); |
| | | } |
| | | |
| | | // 11.3 æ·»å è¶
è¿90天æªä½¿ç¨ç©æè¡¨æ ¼ï¼å¦æææ°æ®ï¼ |
| | | if (over90Count > 0) |
| | | { |
| | | if (warehouseId == 7) |
| | | { |
| | | markdownContent.AppendLine("### è¶
è¿90天æªä½¿ç¨æå"); |
| | | } |
| | | else |
| | | { |
| | | markdownContent.AppendLine("### äºãè¶
è¿90天æªä½¿ç¨ç©æ"); |
| | | } |
| | | |
| | | markdownContent.AppendLine("| åºå· | ç©æç¼ç | æ¹æ¬¡å· |"); |
| | | markdownContent.AppendLine("| :--- | :--- | :--- |"); |
| | | |
| | | int index = 1; |
| | | var over90ToShow = warehouseId == 7 ? |
| | | over90List?.Where(m => m.IsProStock).Take(500) : |
| | | over90List?.Take(500); |
| | | |
| | | if (over90ToShow != null) |
| | | { |
| | | foreach (var material in over90ToShow) |
| | | { |
| | | markdownContent.AppendLine($"| {index} | {material.MaterielCode} | {material.BatchNo} |"); |
| | | index++; |
| | | } |
| | | |
| | | if (over90Count > (warehouseId == 7 ? 500 : 200)) |
| | | { |
| | | markdownContent.AppendLine($"| ... | å
±{over90Count}æ¡ï¼ä»
æ¾ç¤ºå{(warehouseId == 7 ? 500 : 200)}æ¡ | ... |"); |
| | | } |
| | | } |
| | | markdownContent.AppendLine(); |
| | | } |
| | | |
| | | // 11.4 æ·»å æ¶é´æ³åæç¤ºä¿¡æ¯ |
| | | markdownContent.AppendLine($"**æ¥åæ¶é´ï¼** {currentTime:yyyy-MM-dd HH:mm:ss}"); |
| | | if (warehouseId == 7) |
| | | { |
| | | markdownContent.AppendLine("**夿³¨ï¼** 请æåä»ç®¡ç人ååæ¶å¤çè¶
è¿90天æªä½¿ç¨çæåã"); |
| | | } |
| | | else |
| | | { |
| | | markdownContent.AppendLine("**夿³¨ï¼** 请ç¸å
³ä»åºç®¡ç人ååæ¶å¤ç以ä¸ç©æã"); |
| | | } |
| | | |
| | | var messageContent = markdownContent.ToString(); |
| | | |
| | | // 11.5 çæééæ¶æ¯æéçæ¶é´æ³åç¾å |
| | | var timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds(); |
| | | var sign = GenerateSign(timestamp, secret); |
| | | |
| | | var url = $"{webhookUrl.Split('?')[0]}?access_token={new Uri(webhookUrl).Query.Split('=')[1]}×tamp={timestamp}&sign={sign}"; |
| | | // 11.6 æå»ºéé请æ±URL |
| | | var uri = new Uri(webhookUrl); |
| | | var token = System.Web.HttpUtility.ParseQueryString(uri.Query)["access_token"]; |
| | | var baseUrl = uri.GetLeftPart(UriPartial.Path); |
| | | var url = $"{baseUrl}?access_token={token}×tamp={timestamp}&sign={sign}"; |
| | | |
| | | // æå»ºè¯·æ±ä½ï¼ç¬¦åéétextç±»åæ¶æ¯æ ¼å¼ï¼ |
| | | // 11.7 æå»ºè¯·æ±ä½ï¼ä½¿ç¨markdownæ ¼å¼ï¼ |
| | | var requestBody = new |
| | | { |
| | | msgtype = "text", |
| | | text = new { content = messageContent } |
| | | msgtype = "markdown", |
| | | markdown = new |
| | | { |
| | | title = $"{warehouseName}ç©ææé", |
| | | text = messageContent |
| | | }, |
| | | at = new |
| | | { |
| | | // å¯ä»¥æå®@æäºäººï¼å¦æä¸éè¦å¯ä»¥å é¤è¿é¨å |
| | | // atMobiles = new[] { "138xxxx8888" }, |
| | | // isAtAll = false |
| | | } |
| | | }; |
| | | |
| | | var jsonBody = JsonConvert.SerializeObject(requestBody); |
| | | var content = new StringContent(jsonBody, Encoding.UTF8, "application/json"); |
| | | |
| | | // 11.8 åéPOST请æ±å¹¶å¤çååº |
| | | var response = await httpClient.PostAsync(url, content); |
| | | if (!response.IsSuccessStatusCode) |
| | | { |
| | | var errorContent = await response.Content.ReadAsStringAsync(); |
| | | throw new Exception($"ã{warehouseName}ãæ¶æ¯åé失败ï¼ç¶æç ï¼{response.StatusCode}ï¼é误信æ¯ï¼{errorContent}"); |
| | | } |
| | | |
| | | // é¿å
åéé¢çè¿å¿« |
| | | await Task.Delay(1000); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // æè·å¼å¸¸å¹¶è¡¥å
ä¸ä¸æï¼ä¾¿äºé®é¢å®ä½ |
| | | throw new Exception($"ééæ¶æ¯æ¨éæ´ä½å¤±è´¥ï¼é误详æ
ï¼{ex.Message}", ex); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// çæå ç¾ç¾å |
| | | /// </summary> |
| | | /// <param name="timestamp">æ¶é´æ³</param> |
| | | /// <returns>ç¾å</returns> |
| | | // ééç¾åçææ¹æ³ |
| | | private string GenerateSign(long timestamp,string secret) |
| | | { |
| | | var stringToSign = $"{timestamp}\n{secret}"; |
| | | using (var hmacsha256 = new System.Security.Cryptography.HMACSHA256(Encoding.UTF8.GetBytes(secret))) |
| | | using (var hmac = new System.Security.Cryptography.HMACSHA256(Encoding.UTF8.GetBytes(secret))) |
| | | { |
| | | var hashBytes = hmacsha256.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)); |
| | | return Convert.ToBase64String(hashBytes).Replace("+", "%2B").Replace("/", "%2F"); |
| | | var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(stringToSign)); |
| | | return Convert.ToBase64String(hash); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | List<LocationCount> locationCounts = new List<LocationCount>(); |
| | | if (heightType == 1) |
| | | { |
| | | locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || (IsBCS ? false : x.LocationType == LocationTypeEnum.Undefined.ObjToInt())) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && (IsBCS ? !IsBCS : ("SC01_BC".Contains(x.RoadwayNo) ? x.Column % 2 == 0 : x.Column % 2 == 1)) && x.Layer <= 4 && roadwayNos.Contains(x.RoadwayNo)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || (IsBCS ? false : x.LocationType == LocationTypeEnum.Undefined.ObjToInt())) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && (IsBCS ? !IsBCS : ("SC01_BC".Contains(x.RoadwayNo) ? x.Column % 2 == 0 : x.Column % 2 == 1)) && x.Layer <= 5 && roadwayNos.Contains(x.RoadwayNo)).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | } |
| | | //else if(heightType == 2) |
| | | //{ |
| | |
| | | /// </summary> |
| | | /// <param name="orderId"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("FeedbackReceiveOrder")] |
| | | [HttpPost, HttpGet, Route("FeedbackReceiveOrder"),AllowAnonymous] |
| | | public WebResponseContent FeedbackReceiveOrder(int orderId) |
| | | { |
| | | return Service.FeedbackReceiveOrder(orderId); |