| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Runtime.InteropServices; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core.FreeDB; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_Entity.ToAGV; |
| | | using static FreeSql.Internal.GlobalFilter; |
| | | |
| | | namespace WIDESEA_WCS |
| | |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | FreeDB freeDB = new FreeDB(); |
| | | dt_mes_head mes_Head = null; |
| | | try |
| | | { |
| | | Mes_WorkInfo workInfo = JsonConvert.DeserializeObject<Mes_WorkInfo>(json.ToString()); |
| | | |
| | | if (workInfo == null) |
| | | { |
| | | return content.Error("å·¥åä¿¡æ¯æ°æ®ä¸ºç©º"); |
| | | //return content.Error("å·¥åä¿¡æ¯æ°æ®ä¸ºç©º"); |
| | | throw new Exception("å·¥åä¿¡æ¯æ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | var mesinfo = freeDB.Select<dt_mes_head>().Where(x => x.jobID == workInfo.jobID).First(); |
| | | if (mesinfo != null) |
| | | { |
| | | return content.Error($"å·¥åå·{mesinfo.jobID}å·²åå¨,è¯·æ ¸å®åéæ°åéï¼"); |
| | | //return content.Error($"å·¥åç¼å·{mesinfo.jobID}å·²åå¨,è¯·æ ¸å®åéæ°åéï¼"); |
| | | throw new Exception($"å·¥åç¼å·{mesinfo.jobID}å·²åå¨,è¯·æ ¸å®åéæ°åéï¼"); |
| | | } |
| | | |
| | | Guid head = Guid.NewGuid(); |
| | | dt_mes_head mes_Head = new dt_mes_head |
| | | mes_Head = new dt_mes_head |
| | | { |
| | | mes_id = head, |
| | | CreateTime = DateTime.Now, |
| | |
| | | quantity = workInfo.quantity, |
| | | reqID = workInfo.reqID, |
| | | reqIDLineNo = workInfo.reqIDLineNo, |
| | | stackNoRange = workInfo.stackNoRange, |
| | | //stackNoRange = workInfo.stackNoRange, |
| | | typeID = workInfo.typeID, |
| | | workOrder = workInfo.workOrder, |
| | | processCode = workInfo.processCode, |
| | | finishNum = 0 |
| | | finishNum = 0, |
| | | }; |
| | | freeDB.Add(mes_Head); |
| | | |
| | |
| | | dt_mes_detail mes_Detail = new dt_mes_detail |
| | | { |
| | | mes_detail_id = Guid.NewGuid(), |
| | | mes_headID = head, |
| | | mes_id = head, |
| | | jobID = item.jobID, |
| | | billetID = item.billetID, |
| | | heatBatchID = item.heatBatchID, |
| | |
| | | }; |
| | | freeDB.Add(mes_Detail); |
| | | } |
| | | return content.OK(); |
| | | |
| | | #region æ¥è¯¢å½åå·¥åçå¾å·ä¿¡æ¯æ¯å¦åå¨ |
| | | var dt_Geometry_Data = Pipeline.QueryMateriel(workInfo.drawingNo); |
| | | //var dt_Geometry_Data1 = Pipeline.QueryMateriel1(workInfo.drawingNo); |
| | | if (dt_Geometry_Data == null /*&& dt_Geometry_Data1 == null*/) |
| | | { |
| | | throw new Exception($"æªæ¾å°å¾å·ï¼{workInfo.drawingNo}ç车轮信æ¯ï¼å·¥åç¼å·ï¼{workInfo.jobID}"); |
| | | } |
| | | #endregion |
| | | //WriteWMSLog.LogAdd(requestTask.TASK_NO, "æå ", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | //return content.OK(); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | //return content.Error(ex.Message); |
| | | content.Error(ex.Message); |
| | | } |
| | | |
| | | WritePCSLog.LogAdd("", content.Status ? "æå " : "失败", "PCS", "MES", JsonConvert.SerializeObject(mes_Head), JsonConvert.SerializeObject(content), $"MESä¸åå·¥å", "AddMes_Info", content.Message); |
| | | return content; |
| | | } |
| | | } |
| | | } |