| | |
| | | let loadingInstance; |
| | | let loadingStatus = false; |
| | | if (process.env.NODE_ENV == 'development') { |
| | | axios.defaults.baseURL = 'http://192.168.12.118:8098/'; |
| | | axios.defaults.baseURL = 'http://192.168.12.101:8098/'; |
| | | } |
| | | else if (process.env.NODE_ENV == 'debug') { |
| | | axios.defaults.baseURL = 'http://192.168.12.101:8098/'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /***************************************************************************************** |
| | | ** Author:jxx 2022 |
| | | ** QQ:283591387 |
| | | **宿´ææ¡£è§ï¼http://v2.volcore.xyz/document/api ã代ç çæé¡µé¢ViewGridã |
| | | **常ç¨ç¤ºä¾è§ï¼http://v2.volcore.xyz/document/vueDev |
| | | **åå°æä½è§ï¼http://v2.volcore.xyz/document/netCoreDev |
| | | *****************************************************************************************/ |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | | modelHeader: '', |
| | | modelBody: '', |
| | | modelFooter: '' |
| | | }, |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | //示ä¾ï¼å¨æé®çæå颿·»å ä¸ä¸ªæé® |
| | | // this.buttons.unshift({ //ä¹å¯ä»¥ç¨pushæè
spliceæ¹æ³æ¥ä¿®æ¹buttonsæ°ç» |
| | | // name: 'æé®', //æé®åç§° |
| | | // icon: 'el-icon-document', //æé®å¾æ vue2çæ¬è§iviewææ¡£iconï¼vue3çæ¬è§element uiææ¡£icon(注æä¸æ¯element pulsææ¡£) |
| | | // type: 'primary', //æé®æ ·å¼vue2çæ¬è§iviewææ¡£buttonï¼vue3çæ¬è§element uiææ¡£button |
| | | // onClick: function () { |
| | | // this.$Message.success('ç¹å»äºæé®'); |
| | | // } |
| | | // }); |
| | | |
| | | //示ä¾ï¼è®¾ç½®ä¿®æ¹æ°å»ºãç¼è¾å¼¹åºæ¡å段æ ç¾çé¿åº¦ |
| | | // this.boxOptions.labelWidth = 150; |
| | | }, |
| | | 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; |
| | |
| | | path: '/dt_geometry_data_detectionline', |
| | | name: 'dt_geometry_data_detectionline', |
| | | component: () => import('@/views/widesea_wms/baseinfo/dt_geometry_data_detectionline.vue') |
| | | } ,{ |
| | | path: '/dt_info_to_mes', |
| | | name: 'dt_info_to_mes', |
| | | component: () => import('@/views/widesea_wms/tomes/dt_info_to_mes.vue') |
| | | }] |
| | | |
| | | export default viewgird |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- |
| | | *Authorï¼jxx |
| | | *Contactï¼283591387@qq.com |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *ä¸å¡è¯·å¨@/extension/widesea_wms/tomes/dt_info_to_mes.jsæ¤å¤ç¼å |
| | | --> |
| | | <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/widesea_wms/tomes/dt_info_to_mes.js"; |
| | | import { ref, defineComponent } from "vue"; |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: 'ID', |
| | | footer: "Foots", |
| | | cnName: 'ä¿¡æ¯åæ¥MES', |
| | | name: 'tomes/dt_info_to_mes', |
| | | url: "/dt_info_to_mes/", |
| | | sortName: "ID" |
| | | }); |
| | | const editFormFields = ref({}); |
| | | const editFormOptions = ref([]); |
| | | const searchFormFields = ref({"State":""}); |
| | | const searchFormOptions = ref([[{"dataKey":"infoStates","data":[],"title":"ç¶æ","field":"State","type":"select"}]]); |
| | | const columns = ref([{field:'ID',title:'ID',type:'int',width:80,hidden:true,readonly:true,require:true,align:'left'}, |
| | | {field:'Info',title:'ç³è¯·åæ°ä¿¡æ¯',type:'string',width:220,require:true,align:'left'}, |
| | | {field:'ActionName',title:'æ¹æ³å',type:'string',width:120,require:true,align:'left'}, |
| | | {field:'State',title:'ç¶æ',type:'bool',bind:{ key:'infoStates',data:[]},width:80,require:true,align:'left'}, |
| | | {field:'Createtime',title:'å建æ¶é´',type:'datetime',sort:true,width:140,require:true,align:'left',sort:true}, |
| | | {field:'Remark',title:'夿³¨',type:'string',width:160,require:true,align:'left'}, |
| | | {field:'Message',title:'è¿ååæ°ä¿¡æ¯',type:'string',width:220,align:'left'}, |
| | | {field:'Successtime',title:'æåæ¶é´',type:'datetime',sort:true,width:140,align:'left',sort:true}]); |
| | | const detail = ref({ |
| | | cnName: "#detailCnName", |
| | | table: "#detailTable", |
| | | columns: [], |
| | | sortName: "", |
| | | key: "" |
| | | }); |
| | | return { |
| | | table, |
| | | extend, |
| | | editFormFields, |
| | | editFormOptions, |
| | | searchFormFields, |
| | | searchFormOptions, |
| | | columns, |
| | | detail, |
| | | }; |
| | | }, |
| | | }); |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *å¦ææ°æ®åºå段åçååï¼è¯·å¨ä»£ç çå¨éæ°çææ¤Model |
| | | */ |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.ComponentModel.DataAnnotations.Schema; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Entity.SystemModels; |
| | | |
| | | namespace WIDESEA_Entity.DomainModels |
| | | { |
| | | [Entity(TableCnName = "ä¿¡æ¯åæ¥MES",TableName = "dt_info_to_mes")] |
| | | public partial class dt_info_to_mes:BaseEntity |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | [Key] |
| | | [Display(Name ="ID")] |
| | | [Column(TypeName="int")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings=false)] |
| | | public int ID { get; set; } |
| | | |
| | | /// <summary> |
| | | ///åæ°ä¿¡æ¯ |
| | | /// </summary> |
| | | [Display(Name ="åæ°ä¿¡æ¯")] |
| | | [Column(TypeName="nvarchar(max)")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings=false)] |
| | | public string Info { get; set; } |
| | | |
| | | /// <summary> |
| | | ///æ¹æ³å |
| | | /// </summary> |
| | | [Display(Name ="æ¹æ³å")] |
| | | [MaxLength(255)] |
| | | [Column(TypeName="nvarchar(255)")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings=false)] |
| | | public string ActionName { get; set; } |
| | | |
| | | /// <summary> |
| | | ///ç¶æ |
| | | /// </summary> |
| | | [Display(Name ="ç¶æ")] |
| | | [Column(TypeName="bit")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings=false)] |
| | | public bool State { get; set; } |
| | | |
| | | /// <summary> |
| | | ///å建æ¶é´ |
| | | /// </summary> |
| | | [Display(Name ="å建æ¶é´")] |
| | | [Column(TypeName="datetime")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings=false)] |
| | | public DateTime Createtime { get; set; } |
| | | |
| | | /// <summary> |
| | | ///夿³¨ |
| | | /// </summary> |
| | | [Display(Name ="夿³¨")] |
| | | [MaxLength(255)] |
| | | [Column(TypeName="varchar(255)")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings=false)] |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | ///è¿ååæ°ä¿¡æ¯ |
| | | /// </summary> |
| | | [Display(Name ="è¿ååæ°ä¿¡æ¯")] |
| | | [Column(TypeName="nvarchar(max)")] |
| | | public string Message { get; set; } |
| | | |
| | | /// <summary> |
| | | ///æåæ¶é´ |
| | | /// </summary> |
| | | [Display(Name ="æåæ¶é´")] |
| | | [Column(TypeName="datetime")] |
| | | public DateTime? Successtime { get; set; } |
| | | |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *å¦ææ°æ®åºå段åçååï¼è¯·å¨ä»£ç çå¨éæ°çææ¤Model |
| | | */ |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.ComponentModel.DataAnnotations.Schema; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Entity.SystemModels; |
| | | |
| | | namespace WIDESEA_Entity.DomainModels |
| | | { |
| | | |
| | | public partial class dt_info_to_mes |
| | | { |
| | | //æ¤å¤é
ç½®åæ®µ(åæ®µé
ç½®è§æ¤modelçå¦ä¸ä¸ªpartial),å¦æè¡¨ä¸æ²¡ææ¤å段请å ä¸ [NotMapped]屿§ï¼å¦åä¼å¼å¸¸ |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using WIDESEA_Entity.MappingConfiguration; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | |
| | | namespace WIDESEA_Entity.MappingConfiguration |
| | | { |
| | | public class dt_info_to_mesMapConfig : EntityMappingConfiguration<dt_info_to_mes> |
| | | { |
| | | public override void Map(EntityTypeBuilder<dt_info_to_mes> |
| | | builderTable) |
| | | { |
| | | //b.Property(x => x.StorageName).HasMaxLength(45); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | if (task.agv_taskstate == AGVTaskStateEnum.Complete1.ToString()) |
| | | { |
| | | var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress); |
| | | if (station2 == null) throw new Exception("æªæ¾å°ç»ç¹å°åï¼"); |
| | | ////空æä»»å¡éä¿®æ¹é»è¾ |
| | | if (station2.stationCode.Contains("X")) |
| | | station2.quantity = 0;// task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 0 : task.agv_qty; //task.agv_qty; |
| | |
| | | else if (task.agv_taskstate == AGVTaskStateEnum.Complete.ToString()) |
| | | { |
| | | var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress); |
| | | if (station1 == null) throw new Exception("æªæ¾å°èµ·ç¹å°åï¼"); |
| | | #region MyRegion |
| | | //if (station1.stationCode.Contains("S")) |
| | | // station1.quantity = 0; |
| | |
| | | /// </summary> |
| | | /// <param name="task"></param> |
| | | /// <exception cref="Exception"></exception> |
| | | public static MES_Response UploadMESInfo(dt_agvtask task) |
| | | public static void UploadMESInfo(dt_agvtask task) |
| | | { |
| | | object obj = new object(); //ä¸ä¼ MESæ°æ® |
| | | string mesData = "";//è¿åæ°æ® |
| | | string ActionName = ""; //è°ç¨MESæ¹æ³å |
| | | string name = ""; |
| | | MES_Response requestMes = new MES_Response(); |
| | |
| | | } |
| | | VOLContext context = new VOLContext(); |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); |
| | | if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString() /*|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceOutbound.ToString()*/|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceCarry.ToString()) |
| | | Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context); |
| | | if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString() || task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceCarry.ToString()) |
| | | { |
| | | if(task.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString()) |
| | | { |
| | |
| | | { |
| | | foreach (var item in task.bindSN.Split(",")) |
| | | { |
| | | //var work = workinfoRepository.Find(x => x.SN == item && x.processCode == "28").FirstOrDefault(); |
| | | detail detail = new detail(); |
| | | detail.sn = item; |
| | | detail.jobID = task.jobID; |
| | |
| | | { |
| | | WorkOrder = task.jobID, |
| | | zoneID = task.agv_fromaddress, |
| | | //processCode = task.agv_worktype.ToString(), |
| | | details = list, |
| | | layerNo = 1, |
| | | stackID = "1", |
| | |
| | | ActionName = "agvOutWarehouse";//AGV->MES车轮åºåº |
| | | name = "AGV忥MES车轮åºåº"; |
| | | } |
| | | else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString() /*|| task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString()*/) |
| | | else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString()) |
| | | { |
| | | foreach (var item in task.bindSN.Split(",")) |
| | | { |
| | |
| | | { |
| | | WorkOrder = task.jobID, |
| | | zoneID = task.agv_toaddress, |
| | | //processCode = task.agv_worktype.ToString(), |
| | | details = list, |
| | | layerNo = 1, |
| | | stackID = "1", |
| | |
| | | ActionName = "agvInWarehouse";//AGV->MES车轮å
¥åº |
| | | name = "AGV忥MES车轮å
¥åº"; |
| | | } |
| | | //else if (task.agv_tasktype == "Transfer") //ç§»åºåºå åºå
ç§»åº |
| | | else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_Carry.ToString()) //ç§»åºåºå åºå
ç§»åº |
| | | { |
| | | List<detail1> list1 = new List<detail1>(); //è½¦è½®ä¿¡æ¯ |
| | |
| | | ActionName = "agvMoveWarehouse";//AGV->MESè½¦è½®ç§»åº |
| | | name = "AGV忥MES车轮ABåºç§»åº"; |
| | | } |
| | | //else if (task.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceCarry.ToString())// å¤åç§»åº |
| | | //{ |
| | | // var mes_head = FreeDB.Select<dt_mes_head>().Where(x => x.jobID == task.jobID).First(); |
| | | // agvTransferListPara agvTransferListPara = new agvTransferListPara() |
| | | // { |
| | | // transferListID = task.agv_tasknum, |
| | | // materialCode = mes_head.materialCode, |
| | | // details = list, |
| | | // drawingNoVer = mes_head.drawingNoVer, |
| | | // fromWarehouse = "AGVåº", |
| | | // toWarehouse = "æ¯è½®åº", |
| | | // Operator = task.agv_userid, |
| | | // updateTime = task.agv_createtime.ToString(), |
| | | // }; |
| | | // obj = agvTransferListPara; |
| | | // ActionName = "agvTransferList"; |
| | | // name = "AGV忥MES车轮移åºABåº->BCåº"; |
| | | //} |
| | | else |
| | | { |
| | | requestMes.code = "200"; |
| | | requestMes.Type = "success"; |
| | | return requestMes; |
| | | } |
| | | |
| | | var postJson = JsonConvert.SerializeObject(obj); |
| | | mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + ActionName); |
| | | if (mesData.Contains("è¿æ¥å°è¯å¤±è´¥")) |
| | | throw new Exception(mesData); |
| | | requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData); |
| | | |
| | | if (requestMes.code == "200" && requestMes.Type == "success") |
| | | if (string.IsNullOrEmpty(postJson)) |
| | | { |
| | | //æ¥å¿è®°å½ä¸ä¼ æ°æ®æå |
| | | WriteWMSLog.LogAdd(task.agv_tasknum, "æå", "MES", "WMS", JsonConvert.SerializeObject(obj), mesData, name, ActionName, requestMes.message); |
| | | dt_info_to_mes info_To_Mes = new dt_info_to_mes() |
| | | { |
| | | Info = postJson, |
| | | ActionName = ActionName, |
| | | Createtime = DateTime.Now, |
| | | Remark = name, |
| | | State = false |
| | | }; |
| | | mesRepository.Add(info_To_Mes, true); |
| | | } |
| | | else |
| | | throw new Exception(requestMes.message); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | requestMes.message = ex.Message; |
| | | WriteWMSLog.LogAdd(task.agv_tasknum, "失败", "MES", "WMS", JsonConvert.SerializeObject(obj), mesData, name, ActionName, ex.Message); |
| | | |
| | | } |
| | | return requestMes; |
| | | //finally |
| | | //{ |
| | | // WriteWMSLog.LogAdd(task.agv_tasknum, "失败", "MES", "WMS", JsonConvert.SerializeObject(obj), mesData, name, ActionName, requestMes.message); |
| | | //} |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Confluent.Kafka; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Xml.Linq; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm.MES_Info; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.Repositories; |
| | | |
| | | namespace WIDESEA_WMS.Common |
| | | { |
| | | public class ToMes |
| | | { |
| | | public static void InfoToMes() |
| | | { |
| | | try |
| | | { |
| | | VOLContext context = new VOLContext(); |
| | | Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context); |
| | | var infos = mesRepository.Find(x => !x.State).OrderBy(x => x.Createtime).ToList(); |
| | | foreach (var info in infos) |
| | | { |
| | | try |
| | | { |
| | | var mesData = Request.RequestData(info.Info, MESAPIAddress.IPAddress_MES + info.ActionName); |
| | | if (mesData.Contains("è¿æ¥å°è¯å¤±è´¥")) throw new Exception(mesData); |
| | | if (mesData.Contains("åä¸ä¸ªæ æ³è¿æ¥çç½ç»å°è¯äºä¸ä¸ªå¥æ¥åæä½")) throw new Exception(mesData); |
| | | var requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData); |
| | | |
| | | if (requestMes.code == "200" && requestMes.Type == "success") |
| | | { |
| | | info.State = true; |
| | | info.Successtime = DateTime.Now; |
| | | info.Message = requestMes.message; |
| | | } |
| | | else |
| | | throw new Exception(requestMes.message); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | info.Message = ex.Message; |
| | | } |
| | | mesRepository.Update(info, x => new { x.State, x.Successtime, x.Message }, true); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *Repositoryæä¾æ°æ®åºæä½ï¼å¦æè¦å¢å æ°æ®åºæä½è¯·å¨å½åç®å½ä¸Partialæä»¶å¤¹Idt_info_to_mesRepositoryç¼åæ¥å£ |
| | | */ |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseProvider; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_Core.Extensions.AutofacManager; |
| | | namespace WIDESEA_WMS.IRepositories |
| | | { |
| | | public partial interface Idt_info_to_mesRepository : IDependency,IRepository<dt_info_to_mes> |
| | | { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | */ |
| | | using WIDESEA_Core.BaseProvider; |
| | | using WIDESEA_Entity.DomainModels; |
| | | |
| | | namespace WIDESEA_WMS.IServices |
| | | { |
| | | public partial interface Idt_info_to_mesService : IService<dt_info_to_mes> |
| | | { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *ææå
³äºdt_info_to_mesç±»çä¸å¡ä»£ç æ¥å£åºå¨æ¤å¤ç¼å |
| | | */ |
| | | using WIDESEA_Core.BaseProvider; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_Core.Utilities; |
| | | using System.Linq.Expressions; |
| | | namespace WIDESEA_WMS.IServices |
| | | { |
| | | public partial interface Idt_info_to_mesService |
| | | { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *Repositoryæä¾æ°æ®åºæä½ï¼å¦æè¦å¢å æ°æ®åºæä½è¯·å¨å½åç®å½ä¸Partialæä»¶å¤¹dt_info_to_mesRepositoryç¼å代ç |
| | | */ |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_Core.BaseProvider; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Core.Extensions.AutofacManager; |
| | | using WIDESEA_Entity.DomainModels; |
| | | |
| | | namespace WIDESEA_WMS.Repositories |
| | | { |
| | | public partial class dt_info_to_mesRepository : RepositoryBase<dt_info_to_mes> , Idt_info_to_mesRepository |
| | | { |
| | | public dt_info_to_mesRepository(VOLContext dbContext) |
| | | : base(dbContext) |
| | | { |
| | | |
| | | } |
| | | public static Idt_info_to_mesRepository Instance |
| | | { |
| | | get { return AutofacContainerModule.GetService<Idt_info_to_mesRepository>(); } } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *ææå
³äºdt_info_to_mesç±»çä¸å¡ä»£ç åºå¨æ¤å¤ç¼å |
| | | *å¯ä½¿ç¨repository.è°ç¨å¸¸ç¨æ¹æ³ï¼è·åEF/Dapperçä¿¡æ¯ |
| | | *妿éè¦äºå¡è¯·ä½¿ç¨repository.DbContextBeginTransaction |
| | | *ä¹å¯ä½¿ç¨DBServerProvider.æå¨è·åæ°æ®åºç¸å
³ä¿¡æ¯ |
| | | *ç¨æ·ä¿¡æ¯ãæéãè§è²ç使ç¨UserContext.Currentæä½ |
| | | *dt_info_to_mesService对å¢ãå ãæ¹æ¥ã导å
¥ã导åºãå®¡æ ¸ä¸å¡ä»£ç æ©å±åç
§ServiceFunFilter |
| | | */ |
| | | using WIDESEA_Core.BaseProvider; |
| | | using WIDESEA_Core.Extensions.AutofacManager; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using System.Linq; |
| | | using WIDESEA_Core.Utilities; |
| | | using System.Linq.Expressions; |
| | | using WIDESEA_Core.Extensions; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Microsoft.AspNetCore.Http; |
| | | using WIDESEA_WMS.IRepositories; |
| | | |
| | | namespace WIDESEA_WMS.Services |
| | | { |
| | | public partial class dt_info_to_mesService |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | private readonly Idt_info_to_mesRepository _repository;//è®¿é®æ°æ®åº |
| | | |
| | | [ActivatorUtilitiesConstructor] |
| | | public dt_info_to_mesService( |
| | | Idt_info_to_mesRepository dbRepository, |
| | | IHttpContextAccessor httpContextAccessor |
| | | ) |
| | | : base(dbRepository) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _repository = dbRepository; |
| | | //å¤ç§æ·ä¼ç¨å°è¿init代ç ï¼å
¶ä»æ
åµå¯ä»¥ä¸ç¨ |
| | | //base.Init(dbRepository); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *Authorï¼jxx |
| | | *Contactï¼283591387@qq.com |
| | | *代ç ç±æ¡æ¶çæ,æ¤å¤ä»»ä½æ´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *ææä¸å¡ç¼åå
¨é¨åºå¨Partialæä»¶å¤¹ä¸dt_info_to_mesServiceä¸Idt_info_to_mesServiceä¸ç¼å |
| | | */ |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.IServices; |
| | | using WIDESEA_Core.BaseProvider; |
| | | using WIDESEA_Core.Extensions.AutofacManager; |
| | | using WIDESEA_Entity.DomainModels; |
| | | |
| | | namespace WIDESEA_WMS.Services |
| | | { |
| | | public partial class dt_info_to_mesService : ServiceBase<dt_info_to_mes, Idt_info_to_mesRepository> |
| | | , Idt_info_to_mesService, IDependency |
| | | { |
| | | public dt_info_to_mesService(Idt_info_to_mesRepository repository) |
| | | : base(repository) |
| | | { |
| | | Init(repository); |
| | | } |
| | | public static Idt_info_to_mesService Instance |
| | | { |
| | | get { return AutofacContainerModule.GetService<Idt_info_to_mesService>(); } } |
| | | } |
| | | } |
| | |
| | | toWarehouseName = "Agvåº", |
| | | Operator = UserContext.Current.UserName, |
| | | }; |
| | | Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context); |
| | | |
| | | var postJson = JsonConvert.SerializeObject(moveWarehousePara); |
| | | var mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvMoveWarehouse"); |
| | | if (mesData.Contains("è¿æ¥å°è¯å¤±è´¥")) |
| | | throw new Exception(mesData); |
| | | MES_Response requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData); |
| | | if (requestMes.code == "200" && requestMes.Type == "success") |
| | | dt_info_to_mes info_To_Mes = new dt_info_to_mes() |
| | | { |
| | | //æ¥å¿è®°å½ä¸ä¼ æ°æ®æå |
| | | WriteWMSLog.LogAdd("", "æå", "MES", "WMS", postJson, mesData, "äººå·¥åæ¥MES车轮移åº", "agvMoveWarehouse", requestMes.message); |
| | | Info = postJson, |
| | | ActionName = "agvMoveWarehouse", |
| | | Createtime = DateTime.Now, |
| | | Remark = "äººå·¥åæ¥MES车轮移åº", |
| | | State = false |
| | | }; |
| | | mesRepository.Add(info_To_Mes, true); |
| | | |
| | | inventory.stationCode = stationCode; |
| | | _repository.Update(inventory, true); |
| | | WriteDBLog.Write($"æå¨ç§»åºåºå ", str, LogState.Sucess, "WMS", UserContext.Current.UserName); |
| | | } |
| | | else |
| | | { |
| | | WriteWMSLog.LogAdd("", "失败", "MES", "WMS", postJson, mesData, "äººå·¥åæ¥MES车轮移åº", "agvMoveWarehouse", requestMes.message); |
| | | throw new Exception("äººå·¥åæ¥MES车轮移åºå¤±è´¥ï¼" + requestMes.message); |
| | | } |
| | | WriteDBLog.Write($"人工移åº", str, LogState.Sucess, "WMS", UserContext.Current.UserName); |
| | | |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Message = ex.Message; |
| | | WriteDBLog.Write($"æå¨ç§»åºåºå ", new { éè¯¯ä¿¡æ¯ = ex.Message, æ°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName); |
| | | WriteDBLog.Write($"人工移åº", new { éè¯¯ä¿¡æ¯ = ex.Message, æ°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName); |
| | | } |
| | | return content; |
| | | //return base.Update(saveModel); |
| | | } |
| | | /// <summary> |
| | | /// å é¤åºå |
| | |
| | | KeyList.Add(key); |
| | | } |
| | | var inventoryList = _repository.Find(x => KeyList.Contains(x.ID.ToString())).ToList(); |
| | | //str = $"{string.Join('ã', inventoryList.Select(t => t.SN).ToArray())}"; |
| | | foreach (var inventorys in inventoryList.GroupBy(x => x.stationCode)) |
| | | { |
| | | try |
| | |
| | | } |
| | | agvInWarehousePara outWarehousePara = new agvInWarehousePara() |
| | | { |
| | | //WorkOrder = task.jobID, |
| | | zoneID = inventorys.Key, |
| | | //processCode = task.agv_worktype.ToString(), |
| | | details = lists, |
| | | layerNo = 1, |
| | | stackID = "1", |
| | | warehouseName = "Agvåº", |
| | | Operator = UserContext.Current.UserName, |
| | | }; |
| | | Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context); |
| | | var postJson = JsonConvert.SerializeObject(outWarehousePara); |
| | | var mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvOutWarehouse"); |
| | | if (mesData.Contains("è¿æ¥å°è¯å¤±è´¥")) throw new Exception(mesData); |
| | | MES_Response requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData); |
| | | if (requestMes.code == "200" && requestMes.Type == "success") |
| | | dt_info_to_mes info_To_Mes = new dt_info_to_mes() |
| | | { |
| | | //æ¥å¿è®°å½ä¸ä¼ æ°æ®æå |
| | | WriteWMSLog.LogAdd("", "æå", "MES", "WMS", postJson, mesData, "äººå·¥åæ¥MES车轮åºåº", "agvOutWarehouse", requestMes.message); |
| | | Info = postJson, |
| | | ActionName = "agvOutWarehouse", |
| | | Createtime = DateTime.Now, |
| | | Remark = "äººå·¥åæ¥MES车轮åºåº", |
| | | State = false |
| | | }; |
| | | mesRepository.Add(info_To_Mes, true); |
| | | |
| | | foreach (var inventory in inventorys) |
| | | { |
| | | var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); |
| | | station.quantity = station.quantity - 1; |
| | | if (station.quantity == 0) |
| | | if (station.quantity < 1) |
| | | { |
| | | station.quantity = 0; |
| | | station.stationType = string.Empty; |
| | | station.heatNumber = string.Empty; |
| | | station.Number = string.Empty; |
| | |
| | | stationinfoRepository.Update(station, true); |
| | | _repository.Delete(inventory, true); |
| | | } |
| | | WriteDBLog.Write($"æå¨å é¤åºå ", $"è´§ä½ç¼å·ï¼{inventorys.Key}ï¼SNå·ï¼{str}", LogState.Sucess, "WMS", UserContext.Current.UserName); |
| | | } |
| | | else |
| | | { |
| | | WriteWMSLog.LogAdd("", "失败", "MES", "WMS", postJson, mesData, "äººå·¥åæ¥MES车轮åºåº", "agvOutWarehouse", requestMes.message); |
| | | throw new Exception("äººå·¥åæ¥MES车轮åºåºå¤±è´¥ï¼" + requestMes.message); |
| | | } |
| | | WriteDBLog.Write($"人工åºåºæå ", $"è´§ä½ç¼å·ï¼{inventorys.Key}ï¼SNå·ï¼{str}", LogState.Sucess, "WMS", UserContext.Current.UserName); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Message = ex.Message; |
| | | WriteDBLog.Write($"æå¨å é¤åºå ", new { éè¯¯ä¿¡æ¯ = ex.Message, æ°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName); |
| | | WriteDBLog.Write($"人工åºåºå¤±è´¥ ", new { éè¯¯ä¿¡æ¯ = ex.Message, æ°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName); |
| | | } |
| | | |
| | | } |
| | | content.OK(); |
| | | //content = base.Del(keys, delList); |
| | | //WriteDBLog.Write($"æå¨å é¤åºå ", str, LogState.Sucess, "WMS", UserContext.Current.UserName); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Message = ex.Message; |
| | | WriteDBLog.Write($"æå¨å é¤åºå ", new { éè¯¯ä¿¡æ¯ = ex.Message, æ°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName); |
| | | WriteDBLog.Write($"人工åºåºå¤±è´¥ ", new { éè¯¯ä¿¡æ¯ = ex.Message, æ°æ® = str }, LogState.Error, "WMS", UserContext.Current.UserName); |
| | | } |
| | | |
| | | return content; |
| | |
| | | task.agv_finishedtime = DateTime.Now; |
| | | |
| | | #region 忥MESåºå
¥åºä¿¡æ¯ |
| | | var mes = HandleTask_Mes.UploadMESInfo(task); |
| | | if (mes.code != "200" && mes.Type != "success") |
| | | throw new Exception(mes.message); |
| | | HandleTask_Mes.UploadMESInfo(task); |
| | | #endregion |
| | | |
| | | HandleTask.Updateinventory(task); |
| | |
| | | } |
| | | agvInWarehousePara outWarehousePara = new agvInWarehousePara() |
| | | { |
| | | //WorkOrder = task.jobID, |
| | | zoneID = inventorys.Key, |
| | | //processCode = task.agv_worktype.ToString(), |
| | | details = lists, |
| | | layerNo = 1, |
| | | stackID = "1", |
| | | warehouseName = "Agvåº", |
| | | Operator = UserContext.Current.UserName, |
| | | }; |
| | | |
| | | Idt_info_to_mesRepository mesRepository = new dt_info_to_mesRepository(context); |
| | | var postJson = JsonConvert.SerializeObject(outWarehousePara); |
| | | var mesData = Request.RequestData(postJson, MESAPIAddress.IPAddress_MES + "agvOutWarehouse"); |
| | | if (mesData.Contains("è¿æ¥å°è¯å¤±è´¥")) throw new Exception(mesData); |
| | | MES_Response requestMes = JsonConvert.DeserializeObject<MES_Response>(mesData); |
| | | if (requestMes.code == "200" && requestMes.Type == "success") |
| | | dt_info_to_mes info_To_Mes = new dt_info_to_mes() |
| | | { |
| | | //æ¥å¿è®°å½ä¸ä¼ æ°æ®æå |
| | | WriteWMSLog.LogAdd("", "æå", "MES", "PDA", postJson, mesData, "äººå·¥åæ¥MES车轮åºåº", "agvOutWarehouse", requestMes.message); |
| | | Info = postJson, |
| | | ActionName = "agvOutWarehouse", |
| | | Createtime = DateTime.Now, |
| | | Remark = "äººå·¥åæ¥MES车轮åºåº", |
| | | State = false |
| | | }; |
| | | mesRepository.Add(info_To_Mes, true); |
| | | |
| | | foreach (var inventory in inventorys) |
| | | { |
| | | var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault(); |
| | | station.quantity = station.quantity - 1; |
| | | if (station.quantity == 0) |
| | | if (station.quantity < 1) |
| | | { |
| | | station.quantity = 0; |
| | | station.stationType = string.Empty; |
| | | station.heatNumber = string.Empty; |
| | | station.Number = string.Empty; |
| | |
| | | inventoryRepository.Delete(inventory, true); |
| | | } |
| | | WriteDBLog.Write($"人工åºåºæå ", $"è´§ä½ç¼å·ï¼{inventorys.Key}ï¼SNå·ï¼{str}", LogState.Sucess, "PDA", user); |
| | | } |
| | | else |
| | | { |
| | | WriteWMSLog.LogAdd("", "失败", "MES", "PDA", postJson, mesData, "äººå·¥åæ¥MES车轮åºåº", "agvOutWarehouse", requestMes.message); |
| | | throw new Exception("人工åºåºåæ¥MES车轮åºåºå¤±è´¥ï¼" + requestMes.message); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | public void QueueTaskTiem() |
| | | { |
| | | QueueTask.ReplaceTrayTask(); |
| | | ToMes.InfoToMes(); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *æ¥å£ç¼åå¤... |
| | | *妿æ¥å£éè¦åActionçæééªè¯ï¼è¯·å¨Actionä¸ä½¿ç¨å±æ§ |
| | | *å¦: [ApiActionPermission("dt_info_to_mes",Enums.ActionPermissionOptions.Search)] |
| | | */ |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading.Tasks; |
| | | using Microsoft.Extensions.DependencyInjection; |
| | | using Microsoft.AspNetCore.Http; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WMS.IServices; |
| | | |
| | | namespace WIDESEA_WMS.Controllers |
| | | { |
| | | public partial class dt_info_to_mesController |
| | | { |
| | | private readonly Idt_info_to_mesService _service;//访é®ä¸å¡ä»£ç |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | |
| | | [ActivatorUtilitiesConstructor] |
| | | public dt_info_to_mesController( |
| | | Idt_info_to_mesService service, |
| | | IHttpContextAccessor httpContextAccessor |
| | | ) |
| | | : base(service) |
| | | { |
| | | _service = service; |
| | | _httpContextAccessor = httpContextAccessor; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | *代ç ç±æ¡æ¶çæ,任使´æ¹é½å¯è½å¯¼è´è¢«ä»£ç çæå¨è¦ç |
| | | *妿è¦å¢å æ¹æ³è¯·å¨å½åç®å½ä¸Partialæä»¶å¤¹dt_info_to_mesControllerç¼å |
| | | */ |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEA_Core.Controllers.Basic; |
| | | using WIDESEA_Entity.AttributeManager; |
| | | using WIDESEA_WMS.IServices; |
| | | namespace WIDESEA_WMS.Controllers |
| | | { |
| | | [Route("api/dt_info_to_mes")] |
| | | [PermissionTable(Name = "dt_info_to_mes")] |
| | | public partial class dt_info_to_mesController : ApiBaseController<Idt_info_to_mesService> |
| | | { |
| | | public dt_info_to_mesController(Idt_info_to_mesService service) |
| | | : base(service) |
| | | { |
| | | } |
| | | } |
| | | } |
| | | |