| | |
| | | using iWareModel; |
| | | using iWareSql.DataAccess; |
| | | using iWareSql.WmsDBModel; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | |
| | | { |
| | | if (SystemValue.isStartedModel) |
| | | { |
| | | |
| | | var rgvLocation = StationLocationEnum.BZ21.ToString(); |
| | | /* |
| | | * 1ã仿°æ®åºä¸å¤ææ¯å¦é½å¥ |
| | |
| | | SystemWarningMsg._lbl_alert_DataProcess_BZ21 = $"{rgvLocation.ToString()},æ ¹æ®UPI:{upiCode}æ²¡ææ¾å°å¯¹è±¡ "; |
| | | continue; |
| | | } |
| | | string upi = "LS070700101B0001GS"; |
| | | var res =new HTTPService("http://172.17.1.22:44374/api/LuLi/").getContent<Respone>("cartons-machine?PackageCode="+upi, Guid.NewGuid(),10000); |
| | | if (res.iState == 0) |
| | | { |
| | | var papercut = ClassHelper.RotationMapping<mes_push_papercut, mes_batchOrderUPI_new>(upiObj); |
| | | papercut.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | papercut.ApiMessage = res.message; |
| | | papercut.PushStatus = (int)PushStatusEnum.PushSuccess; |
| | | wmsDB.mes_push_papercut.Add(papercut); |
| | | } |
| | | else |
| | | { |
| | | |
| | | continue; |
| | | } |
| | | //æ´æ°è¡¨ |
| | | var mesgather = wmsDB.mes_package_gather.Where(x => x.PackageCode == upiObj.PackageCode).FirstOrDefault(); |
| | | if (mesgather != null) |
| | | { |
| | |
| | | var _id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | var putpakegecodeid = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | var plcTaskNo = BusinessHelper.CreatePlcTaskIdForSrmTask(); |
| | | //æ°å¢è¡¨ |
| | | var mesinequeue = ClassHelper.RotationMapping<mes_package_linequeue, mes_batchOrderUPI_new>(upiObj); |
| | | mesinequeue.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | //æ°å¢mesæ¨é表 |
| | | var putpakegecode = new mes_push_packagecode() |
| | | { |
| | | Id = putpakegecodeid, |
| | | PackageCode = upiObj.PackageCode, |
| | | PushStatus = 0, |
| | | PushNum = 0, |
| | | ApiMessage = "11", |
| | | ApiMessage = "å¾
æ¨é", |
| | | CreateTime = DateTime.Now, |
| | | CreateUserName = "CC", |
| | | UpdateTime = DateTime.Now, |
| | | UpdateUserName = "CC", |
| | | CreateOrgName = "11" |
| | | }; |
| | | //æ°å¢ä»»å¡è¡¨ |
| | | var task = new wms_rbline_task() |
| | | { |
| | | Id = _id, |
| | |
| | | UpdateUserName = "CC", |
| | | PlaceCode = place |
| | | }; |
| | | //æ°å¢æå°è¡¨ |
| | | var printid= Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | var print = ClassHelper.RotationMapping<wms_record_print, mes_batchOrderUPI_new>(upiObj); |
| | | print.Id = printid; |
| | | print.PrintType = (int)PrintTypeEnum.å
è£
æ¡ç ; |
| | | print.PrintSource = (int)PrintSourceEnum.å
è£
æ¡ç æå°; |
| | | print.PrintSheetNum = 1; |
| | | print.PrintNum= 0; |
| | | print.PrintStatus = (int)PrintStatuEnum.æªæå°; |
| | | print.IsAllowPrint= true; |
| | | wmsDB.wms_record_print.Add(print); |
| | | wms_record_print printtwo = print; |
| | | printtwo.Id= Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | wmsDB.wms_record_print.Add(printtwo); |
| | | |
| | | wmsDB.mes_package_linequeue.Add(mesinequeue); |
| | | wmsDB.wms_rbline_task.Add(task); |
| | | wmsDB.mes_push_packagecode.Add(putpakegecode); |
| | | using (StationServiceClient client = new StationServiceClient()) |
| | | { |
| | | |
| | | var res = client.WriteSurroundTaskInfo((int)EDevice.Station, rgvLocation, short.Parse(task.TaskNo), |
| | | var plcres = client.WriteSurroundTaskInfo((int)EDevice.Station, rgvLocation, short.Parse(task.TaskNo), |
| | | (short)upiObj.Length, (short)upiObj.Width, cartonhigh, cartonwidth, 0, 0); |
| | | if (!res.result) |
| | | if (!plcres.result) |
| | | { |
| | | SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()}-ä¸åå
¥åºä»»å¡ 失败,WriteInStoreTaskInfoAsync è¿å:{res.resMsg}"; |
| | | SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()}-ä¸åå
¥åºä»»å¡ 失败,WriteInStoreTaskInfoAsync è¿å:{plcres.resMsg}"; |
| | | continue; |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// åmesæ¨éå
è£
宿 |
| | | /// </summary> |
| | | public static void PushPackageCode() |
| | | { |
| | | while (true) |
| | |
| | | PushPackageCodeInput input = new PushPackageCodeInput(); |
| | | input.PackageCode = value.PackageCode; |
| | | var res = HttpHelper.GetHttpResponse<PushPackageCodeInput, Respone>(" ", input, 10000); |
| | | |
| | | if (res.iState == 0) |
| | | { |
| | | value.PushStatus = (int)PushStatusEnum.PushSuccess; |
| | | value.ApiMessage = res.message; |
| | | } |
| | | else |
| | | { |
| | | value.PushStatus = (int)PushStatusEnum.Pushing; |
| | | value.PushNum++; |
| | | value.ApiMessage+= res.message; |
| | | if (value.PushNum == 3) |
| | | { |
| | | value.PushStatus = (int)PushStatusEnum.PushFail; |
| | | } |
| | | } |
| | | edm.SaveChanges(); |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// è¿åç |
| | | /// </summary> |
| | | public string code { get; set; } |
| | | public int iState { get; set; } |
| | | |
| | | /// <summary> |
| | | /// è¿åæ¶æ¯ |
| | |
| | | public string message { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 请æ±ç¼å· |
| | | /// </summary> |
| | | public string reqCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èªå®ä¹è¿åï¼è¿åä»»å¡åå·ï¼ |
| | | /// èªå®ä¹è¿å |
| | | /// </summary> |
| | | public string data { get; set; } |
| | | } |
| | | /// <summary> |
| | | /// æ¨éç¶æ |
| | | /// </summary> |
| | | public enum PushStatusEnum |
| | | { |
| | | /// <summary> |
| | | /// æªæ¨é |
| | | /// </summary> |
| | | [Description("æªæ¨é")] |
| | | NotPush = 0, |
| | | |
| | | /// <summary> |
| | | /// æ¨éä¸ |
| | | /// </summary> |
| | | [Description("æ¨éä¸")] |
| | | Pushing = 1, |
| | | |
| | | /// <summary> |
| | | /// æ¨éæå |
| | | /// </summary> |
| | | [Description("æ¨éæå")] |
| | | PushSuccess = 2, |
| | | |
| | | /// <summary> |
| | | /// æ¨é失败 |
| | | /// </summary> |
| | | [Description("æ¨é失败")] |
| | | PushFail = 3, |
| | | } |
| | | } |
| | | } |