|  |  |  | 
|---|
|  |  |  | using iWareSql.WmsDBModel; | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using System.Collections; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | using System.ComponentModel; | 
|---|
|  |  |  | using System.Diagnostics.Contracts; | 
|---|
|  |  |  | 
|---|
|  |  |  | papercut.CreateTime = papercut.UpdateTime = DateTime.Now; | 
|---|
|  |  |  | wmsDB.mes_push_papercut.Add(papercut); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | AreaCodeEnum setAreaCode = AreaCodeEnum.åå
è£ååº; | 
|---|
|  |  |  | UpiStatusEnum setUpiStatus = UpiStatusEnum.å·²åå
; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var ngFlag = false; | 
|---|
|  |  |  | var queryFlag = (int)UpiFlagEnum.NG; | 
|---|
|  |  |  | var upilist = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == upiObj.PackageCode).ToList(); | 
|---|
|  |  |  | var ngCount = upilist.Count(x => x.UpiFlag == queryFlag); | 
|---|
|  |  |  | if (ngCount > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ngFlag = true; | 
|---|
|  |  |  | setUpiStatus = UpiStatusEnum.å·²ä¸çº¿; | 
|---|
|  |  |  | setAreaCode = AreaCodeEnum.ä¸çº¿åºå; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | {//䏿¯NG | 
|---|
|  |  |  | //æ°å¢mesæ¨é表 | 
|---|
|  |  |  | var putpakegecodeid = Yitter.IdGenerator.YitIdHelper.NextId(); | 
|---|
|  |  |  | var putpakegecode = new mes_push_packagecode() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Id = putpakegecodeid, | 
|---|
|  |  |  | PackageCode = upiObj.PackageCode, | 
|---|
|  |  |  | PushStatus = 0, | 
|---|
|  |  |  | PushNum = 0, | 
|---|
|  |  |  | ApiMessage = "", | 
|---|
|  |  |  | CreateTime = DateTime.Now, | 
|---|
|  |  |  | CreateUserName = SysGloble.WCSSystem, | 
|---|
|  |  |  | UpdateTime = DateTime.Now, | 
|---|
|  |  |  | UpdateUserName = SysGloble.WCSSystem | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | wmsDB.mes_push_packagecode.Add(putpakegecode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //æ°å¢è¡¨ | 
|---|
|  |  |  | var mesinequeue = ClassHelper.RotationMapping<mes_package_linequeue, mes_batchOrderUPI_new>(upiObj); | 
|---|
|  |  |  | mesinequeue.Id = Yitter.IdGenerator.YitIdHelper.NextId(); | 
|---|
|  |  |  | mesinequeue.CreateTime = mesinequeue.UpdateTime = DateTime.Now; | 
|---|
|  |  |  | wmsDB.mes_package_linequeue.Add(mesinequeue); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //æ´æ°è¡¨ | 
|---|
|  |  |  | var mesgather = wmsDB.mes_package_gather.Where(x => x.PackageCode == upiObj.PackageCode).FirstOrDefault(); | 
|---|
|  |  |  | if (mesgather != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | mesgather.AreaCode = (int)AreaCodeEnum.åå
è£ååº; | 
|---|
|  |  |  | mesgather.UpiStatus = (int)UpiStatusEnum.å·²åå
; | 
|---|
|  |  |  | mesgather.AreaCode = (int)setAreaCode; | 
|---|
|  |  |  | mesgather.UpiStatus = (int)setUpiStatus; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //var upilist = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == upiObj.PackageCode).ToList(); | 
|---|
|  |  |  | //var upilength = upilist.Max(x => x.Length); | 
|---|
|  |  |  | //var upiwidth = upilist.Max(x => x.Width); | 
|---|
|  |  |  | //cartonhigh = (short)upiObj.Info3; | 
|---|
|  |  |  | //cartonwidth = (short)upiObj.Info2; | 
|---|
|  |  |  | upiObj.UpiStatus = (int)UpiStatusEnum.å·²åå
; | 
|---|
|  |  |  | upiObj.AreaCode = (int)AreaCodeEnum.åå
è£ååº; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | upiObj.UpiStatus = (int)setUpiStatus; | 
|---|
|  |  |  | upiObj.AreaCode = (int)setAreaCode; | 
|---|
|  |  |  | //è®°å½ä»»å¡ | 
|---|
|  |  |  | 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 = "", | 
|---|
|  |  |  | CreateTime = DateTime.Now, | 
|---|
|  |  |  | CreateUserName = SysGloble.WCSSystem, | 
|---|
|  |  |  | UpdateTime = DateTime.Now, | 
|---|
|  |  |  | UpdateUserName = SysGloble.WCSSystem | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | var plcTaskNo = BusinessHelper.CreatePlcTaskId(); | 
|---|
|  |  |  | plcTaskNo = MyExtendHelper.GetNewTaskNo(wmsDB, RbTaskTypeEnum.åå
ä»»å¡, plcTaskNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //æ°å¢ä»»å¡è¡¨ | 
|---|
|  |  |  | var task = new wms_rbline_task() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | TaskStatus = (int)TaskStatusEnum.æ°å»º, | 
|---|
|  |  |  | TaskMsg = "夹æ¿", | 
|---|
|  |  |  | CreateTime = DateTime.Now, | 
|---|
|  |  |  | CreateUserName = "CC", | 
|---|
|  |  |  | CreateUserName = SysGloble.WCSSystem, | 
|---|
|  |  |  | UpdateTime = DateTime.Now, | 
|---|
|  |  |  | UpdateUserName = "CC", | 
|---|
|  |  |  | UpdateUserName = SysGloble.WCSSystem, | 
|---|
|  |  |  | PlaceCode = place | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | //æ°å¢æå°è¡¨ | 
|---|
|  |  |  | 
|---|
|  |  |  | print.IsAllowPrint = true; | 
|---|
|  |  |  | print.CreateTime = print.UpdateTime = DateTime.Now; | 
|---|
|  |  |  | wmsDB.wms_record_print.Add(print); | 
|---|
|  |  |  | var printtwo = ClassHelper.RotationMapping<wms_record_print, mes_batchOrderUPI_new>(upiObj); | 
|---|
|  |  |  | printtwo.PrintType = (int)PrintTypeEnum.å
è£
æ¡ç ; | 
|---|
|  |  |  | printtwo.PrintSource = (int)PrintSourceEnum.å
è£
æ¡ç æå°; | 
|---|
|  |  |  | printtwo.PrintSheetNum = 1; | 
|---|
|  |  |  | printtwo.PrintNum = 0; | 
|---|
|  |  |  | printtwo.PrintStatus = (int)PrintStatuEnum.æªæå°; | 
|---|
|  |  |  | printtwo.IsAllowPrint = true; | 
|---|
|  |  |  | printtwo.CreateTime = print.UpdateTime = DateTime.Now; | 
|---|
|  |  |  | printtwo.Id = Yitter.IdGenerator.YitIdHelper.NextId(); | 
|---|
|  |  |  | wmsDB.wms_record_print.Add(printtwo); | 
|---|
|  |  |  | //var printtwo = ClassHelper.RotationMapping<wms_record_print, mes_batchOrderUPI_new>(upiObj); | 
|---|
|  |  |  | //printtwo.PrintType = (int)PrintTypeEnum.å
è£
æ¡ç ; | 
|---|
|  |  |  | //printtwo.PrintSource = (int)PrintSourceEnum.å
è£
æ¡ç æå°; | 
|---|
|  |  |  | //printtwo.PrintSheetNum = 1; | 
|---|
|  |  |  | //printtwo.PrintNum = 0; | 
|---|
|  |  |  | //printtwo.PrintStatus = (int)PrintStatuEnum.æªæå°; | 
|---|
|  |  |  | //printtwo.IsAllowPrint = true; | 
|---|
|  |  |  | //printtwo.CreateTime = print.UpdateTime = DateTime.Now; | 
|---|
|  |  |  | //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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //å¤ç表  mes_order_gather | 
|---|
|  |  |  | var errmsg = ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | using (StationServiceClient client = new StationServiceClient()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var plcres = client.WriteSurroundTaskInfo((int)EDevice.Station, rgvLocation, short.Parse(task.TaskNo), | 
|---|
|  |  |  | (short)upilength, (short)upiwidth, cartonhigh, cartonwidth, 0, 0); | 
|---|
|  |  |  | if (!plcres.result) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()}-ä¸åå
¥åºä»»å¡ å¤±è´¥,WriteInStoreTaskInfoAsync è¿å:{plcres.resMsg}"; | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-ä¸åå
¥åºä»»å¡ æå,WriteInStoreTaskInfoAsyncï¼åæ°: ç«ç¹{rgvLocation}"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //*/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, "BZ21", "åå
"); | 
|---|
|  |  |  | WmsRecordUpiProcessHandler.SaveWmsRecordPackageProcess(wmsDB, upiObj, "BZ21", "åå
"); | 
|---|
|  |  |  | 
|---|
|  |  |  | wmsDB.SaveChanges(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SystemWarningMsg._lbl_Alert_DataProcess_BZ21 = $"{rgvLocation.ToString()}-没æè¦å¤ççæ°æ®"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception ex) | 
|---|