using JiepeiWMS.IServices; using JiepeiWMS.Model.Models; using JiepeiWMS.Services.BASE; using JiepeiWMS.IRepository.Base; using System.Threading.Tasks; using System.Linq.Expressions; using JiepeiWMS.Model; using System; using SqlSugar; using JiepeiWMS.Extends; namespace JiepeiWMS.Services { public class WMOrderMainServices : BaseServices, IWMOrderMainServices { private readonly IBaseRepository _dal; public WMOrderMainServices(IBaseRepository dal) { this._dal = dal; base.BaseDal = dal; } /// /// 获取订单分页 /// /// public async Task> GetWMOrderMainPage(int page, int intPageSize, string key = "") { Expression> whereExpression = OrderMain => OrderMain.Id > 0; if (!string.IsNullOrWhiteSpace(key)) { whereExpression = whereExpression.And(OrderMain => OrderMain.OrderNo == key || OrderMain.GroupNo == key); } var PageList = await base.QueryTabsPage( (OrderMain, OrderInfo) => new object[] { JoinType.Left,OrderMain.OrderNo==OrderInfo.OrderNo, }, (OrderMain, OrderInfo) => new WMOrderMain() { Id = OrderMain.Id, SourceType = OrderMain.SourceType, OrderNo = OrderMain.OrderNo, GroupNo = OrderMain.GroupNo, CreateTime = OrderMain.CreateTime, SureConfirmTime = OrderMain.SureConfirmTime, PayTime = OrderMain.PayTime, SendTime = OrderMain.SendTime, ProType = OrderMain.ProType, DataType = OrderMain.DataType, PCBATotalMoney = OrderMain.PCBATotalMoney, PCBACostMoney = OrderMain.PCBACostMoney, OutType = OrderMain.OutType, FinanceTarget = OrderMain.FinanceTarget, MbNo = OrderMain.MbNo, MainStatus = OrderMain.MainStatus }, whereExpression, page, intPageSize, " OrderMain.Id desc" ); foreach (var item in PageList.data) { } return PageList; } /// /// 验证订单信息非空字段 /// /// /// public async Task ValidateReconParams(WMOrderMain orderMainModel) { var msg = ""; //验证非空 if (orderMainModel == null) return msg = "订单信息不能为空"; if (orderMainModel.SourceType <= 0) return msg = "来源类型不能为空"; if (!string.IsNullOrWhiteSpace(orderMainModel.OrderNo)) return msg = "订单编号不能为空"; if (orderMainModel.Status <= 0) return msg = "状态不能为空"; if (string.IsNullOrWhiteSpace(orderMainModel.GroupNo)) return msg = "订单包编号不能为空"; if (orderMainModel.CreateTime == null) return msg = "下单时间不能为空"; if (orderMainModel.SureConfirmTime == null) return msg = "投产时间不能为空"; if (orderMainModel.PayTime == null) return msg = "付款时间不能为空"; if (orderMainModel.SendTime == null) return msg = "发货时间不能为空"; if (orderMainModel.ProType <= 0) return msg = "产品类型不能为空"; if (orderMainModel.DataType <= 0) return msg = "数据类型不能为空"; if (orderMainModel.TotalMoney <= 0) return msg = "产品费不能为0"; if (orderMainModel.ShipMoney <= 0) return msg = "运费不能为0"; if (orderMainModel.PreferentialMoney <= 0) return msg = "浮动金额不能为0"; if (orderMainModel.TaxMoney <= 0) return msg = "税费不能为0"; if (orderMainModel.PaypalPayMoney <= 0) return msg = "手续费(外贸)不能为0"; if (orderMainModel.PresentMoney <= 0) return msg = "赠送金额不能为0"; if (orderMainModel.PaidMoney <= 0) return msg = "实收金额不能为0"; if (orderMainModel.CostMoney <= 0) return msg = "成本金额不能为0"; if (orderMainModel.PCBATotalMoney <= 0) return msg = "PCBA总收入金额不能为0"; if (orderMainModel.PCBACostMoney <= 0) return msg = "PCBA成本金额不能为0"; if (orderMainModel.PCBACostMoney <= 0) return msg = "PCBA成本金额不能为0"; if (orderMainModel.OutType <= 0) return msg = "外发类型不能为空"; if (string.IsNullOrWhiteSpace(orderMainModel.JoinFactoryName)) return msg = "外发工厂名称不能为空"; if (orderMainModel.FinanceTarget <= 0) return msg = "财务对象类型不能为空"; if (orderMainModel.IsTJ <= 0) return msg = "是否特价不能为空"; if (orderMainModel.MainStatus <= 0) return msg = "订单包状态不能为空"; return msg; } } }