wangxinhui
2025-12-31 6f8b21411a2a56f6a33fe0112c2ed0eeca407e9c
优化
已修改3个文件
26 ■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockViewDTO.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Stock/StockViewDTO.cs
@@ -21,6 +21,11 @@
        [ExporterHeader(DisplayName = "仓库ID")]
        public int WarehouseId {  get; set; }
        /// <summary>
        /// åº“存备注
        /// </summary>
        [ExporterHeader(DisplayName = "仓库名称")]
        public string WarehouseName { get; set; }
        /// <summary>
        /// è´§ä½ç¼–号
        /// </summary>
        [ExporterHeader(DisplayName = "货位编号")]
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs
@@ -195,7 +195,7 @@
                        //float stockMaxQty = stockInfo.Details.Max(x => x.StockQuantity);
                        //float stockMinQty = stockInfo.Details.Min(x => x.StockQuantity);
                        Dt_StockInfoDetail addstockInfoDetail = stockInfo.Details.OrderByDescending(x=>x.Id).FirstOrDefault();
                        addstockInfoDetail.StockQuantity = takeStockOrderDetail.Qty;
                        addstockInfoDetail.StockQuantity = takeStockOrderDetail.Qty - takeStockOrderDetail.SysQty;
                        updateStockDetails.Add(addstockInfoDetail);
                    }
                    else if (takeStockOrderDetail.Qty==0) //盘亏
@@ -302,11 +302,14 @@
                            };
                            eRPTakeStock.Details.Add(takeDetailsItem);
                        }
                        string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock);
                        ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>();
                        if (erpRequestContent.res != 1)
                        if (eRPTakeStock.Details.Count>0)
                        {
                            throw new Exception("同步ERP失败,错误信息:" + erpRequestContent.Data);
                            string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock);
                            ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>();
                            if (erpRequestContent.res != 1)
                            {
                                throw new Exception("同步ERP失败,错误信息:" + erpRequestContent.Data);
                            }
                        }
                    }
                    _unitOfWorkManage.CommitTran();
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs
@@ -371,7 +371,7 @@
                ISugarQueryable<Dt_LocationInfo> sugarQueryable = _dbBase.Queryable<Dt_LocationInfo>().Where(whereLo);
                EntityProperties.ValidatePageOptions(options, ref sugarQueryable);
                List<Dt_Warehouse> warehouses = _dbBase.Queryable<Dt_Warehouse>().ToList();
                ISugarQueryable<StockViewDTO> list = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => a.LocationCode == b.LocationCode).Select((b, a)
                    => new StockViewDTO
                    {
@@ -426,6 +426,12 @@
                stockViewDTOs.AddRange(pklist.ToList());
                stockViewDTOs.ForEach(x =>
                {
                    Dt_Warehouse? warehouse = warehouses.FirstOrDefault(t => t.WarehouseId == x.WarehouseId);
                    if (warehouse!=null)
                    {
                        x.WarehouseName= warehouse.WarehouseName;
                    }
                    x.MaterielCode = (string.Join(",", x.Details.Select(x => x.MaterielCode).Distinct())) ?? "空箱";
                    x.BatchNo = (string.Join(",", x.Details.Select(x => x.BatchNo).Distinct())) ?? "无";
                    x.StockCounts = Math.Round(x.Details.Sum(x => x.StockQuantity),3).ToString() + x.Details.FirstOrDefault()?.Unit;