|  |  |  | 
|---|
|  |  |  | VOLContext context = new VOLContext(); | 
|---|
|  |  |  | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); | 
|---|
|  |  |  | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); | 
|---|
|  |  |  | string json = string.Empty; | 
|---|
|  |  |  | foreach (var Key in saveModel.DelKeys) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var station = repository.Find(x => x.id.ToString() == Key.ToString()).FirstOrDefault(); | 
|---|
|  |  |  | json = json + station.stationCode + ","; | 
|---|
|  |  |  | if (!station.stationCode.Contains("X") && !station.stationCode.Contains("W01001004") && !station.stationCode.Contains("W01001005")) throw new Exception($"æ {station.stationCode}ä½¿ç¨æéï¼"); | 
|---|
|  |  |  | if (!station.enable) throw new Exception($"{station.stationCode}æªå¯ç¨ï¼"); | 
|---|
|  |  |  | if (station.location_state == LocationStateEnum.Abnormal.ToString()) throw new Exception($"{station.stationCode}ç¶æå¼å¸¸ï¼"); | 
|---|
|  |  |  | 
|---|
|  |  |  | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); | 
|---|
|  |  |  | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); | 
|---|
|  |  |  | string completor = UserContext.Current.UserName; | 
|---|
|  |  |  | object json = null; | 
|---|
|  |  |  | //List<object> jsons = null; | 
|---|
|  |  |  | foreach (var Key in saveModel.DelKeys) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | 
|---|
|  |  |  | jobID = station.Number, | 
|---|
|  |  |  | agv_TrayStatus = station.tray_status | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | json = agvtask; | 
|---|
|  |  |  | //jsons.Add(agvtask); | 
|---|
|  |  |  | agvtaskRepository.Add(agvtask, true); | 
|---|
|  |  |  | station.location_state = LocationStateEnum.InBusy.ToString(); | 
|---|
|  |  |  | repository.Update(station, x => new { x.location_state }, true); | 
|---|
|  |  |  | 
|---|
|  |  |  | webResponse.Error(webResponse.Message += ex.Message); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | WriteDBLog.Write($"æå¨ä¸æä»»å¡ ", new { ä¿¡æ¯ = webResponse.Message, æ°æ® = json }, LogState.Sucess, "WMS", completor); | 
|---|
|  |  |  | WriteDBLog.Write($"æå¨ä¸æä»»å¡ ", new { ä¿¡æ¯ = webResponse.Message }, LogState.Sucess, "WMS", completor); | 
|---|
|  |  |  | return webResponse; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|