1
wankeda
3 天以前 a3014a01e07619105d597d0c51cf195217b0806f
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
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar.Extensions;
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
 
namespace WIDESEA_BasicService
{
    public partial class MaterielInfoService : ServiceBase<Dt_MaterielInfo, IMaterielInfoRepository>, IMaterielInfoService
    {
 
        public bool ExsitMateriel(string materielCode)
        {
            return BaseDal.QueryFirst(x => x.MaterielCode == materielCode) != null;
        }
 
        public bool ExsitMateriels(List<string> materielCodes)
        {
            return BaseDal.QueryFirst(x => materielCodes.Contains(x.MaterielCode)) != null;
        }
 
        public Dt_MaterielInfo GetMaterielInfo(string materielCode)
        {
            return BaseDal.QueryFirst(x => x.MaterielCode == materielCode);
        }
 
        /// <summary>
        /// 查询物料信息
        /// </summary>
        /// <param name="materielCodes"></param>
        /// <returns></returns>
        public List<Dt_MaterielInfo> GetMaterielInfos(List<string> materielCodes)
        {
            return BaseDal.QueryData(x => materielCodes.Contains(x.MaterielCode));
        }
 
 
 
        public WebResponseContent GetMaterielInfos(List<HouseMaterielinfo> materielinfo)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                List<Dt_MaterielInfo> materielInfos = new List<Dt_MaterielInfo>();
                foreach (var item in materielinfo)
                {
                    Dt_MaterielInfo materiel = new()
                    {
                        MaterielCode = item.ItemCode,
                        MaterielId = (int)item.ItemId,
                        MaterielName = item.ItemName,
                        MaterielSpec = item.SpecificationModel,
                        MaterielType = item.ItemType,
                        MaterielSourceType = item.ProductGroup,
                        MaterielUnit = item.RepertoryUnit,
                        MaterielSize = (float?)item.Volume,
                        MaterielState = EnableEnum.Enable,
                        MaterielLength = (float?)item.Length,
                        MaterielThickness = (float?)item.Height,
                        MaterielWide = (float?)item.Width,
                        MaterielModel = item.ManufacturerModel,
                        MaterielQa = (float?)item.Qa,
                        SupplierId = item.SupplierId,
                        SupplierCode = item.SupplierCode,
                        SupplierName = item.SupplierName,
                        CreateDate = DateTime.Now,
                        Creater = "上游WMS"
                    };
                    materielInfos.Add(materiel);
                }
                BaseDal.AddData(materielInfos);
            }
            catch (Exception)
            {
 
                //throw;
            }
            return WebResponseContent.Instance.OK();
        }
    }
}