using AngleSharp.Dom; using Mapster; using Masuit.Tools; using SqlSugar; using System.Collections.Generic; using System.Drawing.Printing; using System.Linq.Expressions; using WIDESEA_Common; using WIDESEA_Core; using WIDESEA_StorageBasicRepository; using WIDESEAWCS_BasicInfoRepository; namespace WIDESEA_StorageBasicService; public class Dt_WheelsStock_OldService : ServiceBase, IDt_WheelsStock_OldService { private readonly string oldLocationAddress = "http://172.21.5.167:8028/wms5/api/gzdcd/Check_St"; //旧库获取库存数据地址 public Dt_WheelsStock_OldService(IDt_WheelsStock_OldRepository BaseDal) : base(BaseDal) { } public WebResponseContent GetOldLocationWheels() { WebResponseContent content = new WebResponseContent(); try { var currentList = BaseDal.QueryData(); string respon = HttpsClient.Post(oldLocationAddress); List oldWheels = JsonConvert.DeserializeObject>(respon.ToString()); if (oldWheels == null || oldWheels.Count == 0) throw new Exception("获取失败:接口数据为空"); oldWheels = oldWheels.Where(x => !string.IsNullOrEmpty(x.wheel_code)).ToList(); var deleteList = currentList.Except(oldWheels).ToList(); //currentList.Where(x=>x.wheel_code) if (BaseDal.AddData(oldWheels) > 1) { return content.OK("旧库数据获取成功"); } else { return content.Error(); } } catch (Exception ex) { if (ex.Message.Contains("404")) { return content.Error("旧库程序未启动,无法访问接口"); } else { return content.Error(ex.Message); } } } }