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;
|
}
|
}
|
}
|