|  |  | 
 |  |  | using MailKit; | 
 |  |  | using Masuit.Tools; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | 
 |  |  |                 if (locationinfo != null) | 
 |  |  |                 { | 
 |  |  |                     //检测柜提供的货位状态,只有wms未锁定且提供的状态为允许才允许放货 | 
 |  |  |                     if (locationinfo.Remark != LocationStatusByCode(result.StateCode)) | 
 |  |  |                     if (locationinfo.Remark != result.StateCode.ToString()) | 
 |  |  |                     { | 
 |  |  |                         locationinfo.Remark = LocationStatusByCode(result.StateCode); | 
 |  |  |                         locationinfo.Remark = result.StateCode.ToString(); | 
 |  |  |                         _locationRepository.UpdateData(locationinfo); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                     throw new Exception("货位不存在"); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 LogFactory.GetLog("分容库位同步").Info(true, $"\r\r--------------------------------------"); | 
 |  |  |                 LogFactory.GetLog("分容库位同步").Info(true, result.ToJsonString()); | 
 |  |  |                 return content.OK(); | 
 |  |  |             } | 
 |  |  |             catch (Exception ex) | 
 |  |  | 
 |  |  |                 return content.Error(ex.Message); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         private static string LocationStatusByCode(int code) | 
 |  |  |         { | 
 |  |  |             string str = null; | 
 |  |  |             switch (code) | 
 |  |  |             { | 
 |  |  |                 case 1: str = "LocationState_Allows"; break; | 
 |  |  |                 case 2: str = "LocationState_NotAllows"; break; | 
 |  |  |                 //case 2: str = LocationState.LocationLock.ToString(); break; | 
 |  |  |                 default: | 
 |  |  |                     str = "LocationState_NotAllows"; break; | 
 |  |  |             } | 
 |  |  |             return str; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         //private static string LocationStatusByCode(int code) | 
 |  |  |         //{ | 
 |  |  |         //    string str = null; | 
 |  |  |         //    switch (code) | 
 |  |  |         //    { | 
 |  |  |         //        case 1: str = "LocationState_Allows"; break; | 
 |  |  |         //        case 2: str = "LocationState_NotAllows"; break; | 
 |  |  |         //        //case 2: str = LocationState.LocationLock.ToString(); break; | 
 |  |  |         //        default: | 
 |  |  |         //            str = "LocationState_NotAllows"; break; | 
 |  |  |         //    } | 
 |  |  |         //    return str; | 
 |  |  |         //} | 
 |  |  |     } | 
 |  |  | } |