| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.DB; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Seed; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.ERP; |
| | |
| | | List<Dt_OutboundOrder> dt_ReceiveOrders = new List<Dt_OutboundOrder>(); |
| | | if (string.IsNullOrEmpty(orderNo)) |
| | | { |
| | | dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); |
| | | dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); |
| | | } |
| | | else |
| | | { |
| | | dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5); |
| | | dt_ReceiveOrders = Db.Queryable<Dt_OutboundOrder>().Where(x => (x.OrderNo.Contains(orderNo)) && x.OrderStatus < OutLockStockStatusEnum.åºåºå®æ.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5); |
| | | } |
| | | |
| | | content.OK(data: dt_ReceiveOrders); |
| | |
| | | ERPIssueModel issueModel = new ERPIssueModel() |
| | | { |
| | | UniqueTag = outboundOrderDetail.OrderId.ToString(), |
| | | Code = outboundOrder.OrderNo, |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)), |
| | | WarehouseCode = warehouse.WarehouseCode, |
| | | Docremark = "", |
| | | Deptno = outboundOrder.DepartmentCode, |
| | |
| | | WarehouseId = warehouse.WarehouseId, |
| | | DepartmentCode = model.DepartmentCode, |
| | | DepartmentName = model.DepartmentName, |
| | | Details = new List<Dt_OutboundOrderDetail> { outboundOrderDetail } |
| | | Details = new List<Dt_OutboundOrderDetail> { outboundOrderDetail }, |
| | | Remark= model.Node |
| | | |
| | | }; |
| | | Db.InsertNav(outboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | } |
| | |
| | | MaterielName = materielInfo.MaterielName, |
| | | OrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(), |
| | | OrderQuantity = model.Qty, |
| | | Unit=model.Unit, |
| | | }; |
| | | |
| | | _outboundOrderDetailRepository.UpdateData(outboundOrderDetail); |
| | |
| | | issueModel = new ERPIssueModel() |
| | | { |
| | | UniqueTag = id.ToString(), |
| | | Code = outboundOrder.OrderNo,//æµè¯ |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)),//æµè¯ |
| | | WarehouseCode = warehouse.WarehouseCode, |
| | | Docremark = "", |
| | | Deptno = outboundOrder.DepartmentCode, |
| | |
| | | issueModel = new ERPIssueModel() |
| | | { |
| | | UniqueTag = id.ToString(), |
| | | Code = outboundOrder.OrderNo, |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)), |
| | | WarehouseCode = warehouse.WarehouseCode, |
| | | Docremark = "", |
| | | Deptno = outboundOrder.DepartmentCode, |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | static object lock_code = new object(); |
| | | public string CreateCodeByRule(string ruleCode) |
| | | { |
| | | lock (lock_code) |
| | | { |
| | | |
| | | string code = string.Empty; |
| | | DateTime dateTime = DateTime.Now; |
| | | DateTime now = DateTime.Now; |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(ruleCode)) |
| | | throw new ArgumentNullException(nameof(ruleCode)); |
| | | SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig |
| | | { |
| | | IsAutoCloseConnection = false, |
| | | DbType = DbType.SqlServer, |
| | | ConnectionString = DBContext.ConnectionString |
| | | }); |
| | | Dt_CodeRuleConfig codeRuleConfig = sugarClient.Queryable<Dt_CodeRuleConfig>().Where(x => x.RuleCode == ruleCode).First(); |
| | | if (codeRuleConfig == null) |
| | | throw new ArgumentNullException(nameof(codeRuleConfig)); |
| | | if (codeRuleConfig.ModifyDate != null) |
| | | { |
| | | dateTime = Convert.ToDateTime(codeRuleConfig.ModifyDate); |
| | | } |
| | | else |
| | | { |
| | | dateTime = Convert.ToDateTime(codeRuleConfig.CreateDate); |
| | | } |
| | | |
| | | if (now.Year == dateTime.Year && now.Month == dateTime.Month && now.Day == dateTime.Day) |
| | | { |
| | | now = dateTime; |
| | | codeRuleConfig.CurrentVal = Convert.ToInt32(codeRuleConfig.CurrentVal) + 1; |
| | | } |
| | | else |
| | | { |
| | | codeRuleConfig.CurrentVal = 1; |
| | | } |
| | | codeRuleConfig.ModifyDate = DateTime.Now; |
| | | code = codeRuleConfig.Format; |
| | | code = code.Replace($"[{CodeFormatTypeEnum.YYYY}]", now.Year.ToString().PadLeft(4, '0')); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.MM}]", now.Month.ToString().PadLeft(2, '0')); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.DD}]", now.Day.ToString().PadLeft(2, '0')); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.ST}]", codeRuleConfig.StartStr?.ToString() ?? ""); |
| | | code = code.Replace($"[{CodeFormatTypeEnum.NUM}]", codeRuleConfig.CurrentVal.ToString().PadLeft(codeRuleConfig.Length, '0')); |
| | | Dictionary<string, object> keyValuePairs = new Dictionary<string, object>() { { nameof(codeRuleConfig.CurrentVal), codeRuleConfig.CurrentVal }, { nameof(codeRuleConfig.Id), codeRuleConfig.Id }, { nameof(codeRuleConfig.ModifyDate), DateTime.Now } }; |
| | | sugarClient.Updateable(keyValuePairs).AS(MainDb.CodeRuleConfig).WhereColumns(nameof(codeRuleConfig.Id)).ExecuteCommand(); |
| | | sugarClient.Updateable(codeRuleConfig); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return code; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æ´æ¹åºåºååºåç¶æ |
| | | /// </summary> |