1
huangxiaoqiang
4 天以前 85d9ca4ec972ce4d020db046d930e8991709ae2d
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
using Masuit.Tools;
using SharpCompress.Compressors.ADC;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common;
using WIDESEA_Core.Const;
using WIDESEA_IServices;
using WIDESEA_IStorageBasicServices.Stock;
using WIDESEA_Model.Models.ERP;
using WIDESEA_Model.Models.Order;
 
namespace WIDESEA_StorageBasicServices
{
    public partial class ERPInboundOrderService : IERPInboundOrderService
    {
        private readonly IUnitOfWorkManage _unitOfWorkManage; 
        private readonly ISys_ConfigService _configService;
        public ERPInboundOrderService(IUnitOfWorkManage unitOfWorkManage, ISys_ConfigService configService)
        {
            _unitOfWorkManage = unitOfWorkManage;
            _configService = configService;
        }
        public virtual PageGridData<WMS_采购及成品入库清单_ST> GetPageData(PageDataOptions options)
        {
            string wheres = options.ValidatePageOptions(typeof(WMS_采购及成品入库清单_ST).GetProperties());
            //获取排序字段
            int totalCount = 0;
            var data = SqlSugarHelper.DBERP.Queryable<WMS_采购及成品入库清单_ST>()
                .WhereIF(!wheres.IsNullOrEmpty(), wheres)
                .ToPageList(options.Page, options.Rows, ref totalCount);
            new PageGridData<WMS_采购及成品入库清单_ST>(totalCount, data);
            return new PageGridData<WMS_采购及成品入库清单_ST>(totalCount, data);
        }
 
        public void PrintInbound(List<Dt_InboundOrder> orders)
        {
            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
            var Base = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintIPAddress)?.ConfigValue;
            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.PrintInboundOrder)?.ConfigValue;
            if (Base == null || ipAddress == null)
            {
                throw new InvalidOperationException("WMS IP 未配置");
            }
            var IpAddress = Base + ipAddress;
            var result = HttpsClient.PostAsync(IpAddress, orders.ToJsonString()).Result;
        }
 
        public string GetOrderPintCode(string printCode)
        {
            string PrintCode = "";
            var PrintSetting = SqlSugarHelper.DbWMS.Queryable<Dt_PrintSetting>().Where(x => x.PrintCode == printCode).ToList().FirstOrDefault();
 
            if (PrintSetting.Spare1 == DateTime.Now.ToString("yyyyMMdd"))
            {
                PrintCode = PrintSetting.Spare1 + PrintSetting.PrintNo.ToString().PadLeft(PrintSetting.Spare2, '0');
                PrintSetting.PrintNo = PrintSetting.PrintNo + 1;
            }
            else
            {
                PrintSetting.Spare1 = DateTime.Now.ToString("yyyyMMdd");
                PrintSetting.PrintNo = 2;
                PrintCode = PrintSetting.Spare1 + 1.ToString().PadLeft(PrintSetting.Spare2, '0');
            }
            SqlSugarHelper.DbWMS.Updateable(PrintSetting).ExecuteCommand();
            return PrintCode;
        }
    }
}