using HslCommunication; using Newtonsoft.Json; using Quartz.Util; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Helper; using WIDESEA_IWMsInfoServices; using WIDESEA_Model.Models; using static WIDESEA_DTO.SquareCabin.TowcsDto; namespace WIDESEA_WMsInfoServices { public class MaterielInfoService : ServiceBase>, IMaterielInfoService { public MaterielInfoService(IRepository BaseDal) : base(BaseDal) { } public IRepository Repository => BaseDal; public override WebResponseContent DeleteData(object[] keys) { WebResponseContent content = new WebResponseContent(); try { if (keys.ToList().Count > 1) throw new Exception("一次只能选择一条数据"); Dt_MaterielInfo goods = BaseDal.QueryFirst(x => keys.Contains(x.Id)); var medicineDTO = new ProductInfo { //用户code customerCode = "905", //物料类型 materialCode = "YY", //产品编码 productCode = goods.MaterielCode, //产品名 productName = goods.MaterielName, //产品条码 productBarCode = goods.MaterielCode, //规格 productSpecifications = goods.MaterielSpec, //单位 unit = goods.MaterielUnit, //长 singleProductLongNum = goods.MaterielLength.ToString(), //宽 singleProductWideNum = goods.MaterielWide.ToString(), //高 singleProductHighNum = goods.MaterielHeight.ToString(), //重量 singleProductWeight = goods.MaterielWeight.ToString(), //体积 singleProductVolume = goods.MaterielVolume.ToString(), //是否取消 0是不删除,1删除 isDelete = "1" }; var url = "http://172.16.1.2:9357/file-admin/api/product/productSynchronous"; //var url = "http://172.16.1.245:9357/file-admin/api/product/productSynchronous"; var result = HttpHelper.Post(url, medicineDTO.ToJsonString()); var resp = JsonConvert.DeserializeObject>(result); if (resp != null && resp.code == "0") return base.DeleteData(keys); return WebResponseContent.Instance.Error("删除失败请重试"); } catch (Exception ex) { content.Error(ex.Message); } return content; } } }