dengjunjie
2025-10-23 4cca607ddce9577864b8a5c9c8edf7c83915b787
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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<Dt_MaterielInfo, IRepository<Dt_MaterielInfo>>, IMaterielInfoService
    {
        public MaterielInfoService(IRepository<Dt_MaterielInfo> BaseDal) : base(BaseDal)
        {
        }
        public IRepository<Dt_MaterielInfo> 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<TowcsResponse<object>>(result);
                if (resp != null && resp.code == "0") return base.DeleteData(keys);
 
                return WebResponseContent.Instance.Error("删除失败请重试");
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
    }
}