| | |
| | | using AutoMapper; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using SqlSugar; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Const; |
| | | using WIDESEAWCS_Core.DB; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IShuttleCar; |
| | | using WIDESEAWCS_IShuttleCarInfoRepository; |
| | | using WIDESEAWCS_Model.Models; |
| | |
| | | /// <returns></returns> |
| | | public Dt_ShuttleCar QueryShuttleCar(string Address) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.ShuttleCarPosition == Address); |
| | | return BaseDal.QueryFirst(x => x.ShuttleCarPosition == Address || x.ShuttleCarPosition1 == Address); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®IDæ¥è¯¢ç©¿æ¢è½¦ä¿¡æ¯ |
| | | /// æ ¹æ®ç©¿æ¢è½¦ç¼å·æ¥è¯¢ç©¿æ¢è½¦ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="ShuttleCarId"></param> |
| | | /// <returns></returns> |
| | |
| | | { |
| | | return BaseDal.QueryFirst(x => x.ShuttleCarCode == ShuttleCarCode); |
| | | } |
| | | /// <summary> |
| | | /// æ ¹æ®ç©¿æ¢è½¦ç¼å·æ¥è¯¢å
¶ä»ç©¿æ¢è½¦ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="ShuttleCarCode"></param> |
| | | /// <returns></returns> |
| | | public Dt_ShuttleCar QueryNoCode(string ShuttleCarCode) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.ShuttleCarCode != ShuttleCarCode); |
| | | } |
| | | public override WebResponseContent UpdateData(SaveModel saveModel) |
| | | { |
| | | WebResponseContent responseContent = new WebResponseContent().OK(); |
| | | try |
| | | { |
| | | Dt_ShuttleCar shuttleCar = BaseDal.QueryFirst(x => x.ShuttleCarId == saveModel.MainData["shuttleCarId"].ObjToInt()); |
| | | var Position = saveModel.MainData["shuttleCarPosition"].ToString(); |
| | | if (BaseDal.QueryData(x => x.ShuttleCarPosition == Position && x.ShuttleCarId != shuttleCar.ShuttleCarId).Any()) |
| | | throw new Exception($"ä½ç½®ã{Position}ãå·²åå¨ç©¿æ¢è½¦"); |
| | | SqlSugarClient WMSsugarClient = new SqlSugarClient(new ConnectionConfig |
| | | { |
| | | ConfigId = MainDb.CurrentDbConnId, |
| | | ConnectionString = AppSettings.Get("WMSConnectionString").DecryptDES(AppSecret.DB), |
| | | IsAutoCloseConnection = true, |
| | | DbType = DbType.SqlServer, |
| | | }); |
| | | |
| | | var getLocation = WMSsugarClient.Queryable("Dt_LocationInfo", "x").Where("LocationCode", "=", Position).Any(); |
| | | if (!getLocation) throw new Exception($"æªæ¾å°ä½ç½®ã{Position}ã"); |
| | | shuttleCar.ShuttleCarPosition = Position; |
| | | shuttleCar.ShuttleCarPosition1 = Position; |
| | | BaseDal.UpdateData(shuttleCar); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | responseContent.Error(ex.Message); |
| | | } |
| | | return responseContent; |
| | | } |
| | | } |
| | | } |