1
wangxinhui
昨天 cb3907de90eef531df10a078149b29c55ff86401
1
已修改5个文件
114 ■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/RworkTaskModel.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_MesRworkOutboundOrder.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/RworkTaskModel.cs
@@ -39,14 +39,26 @@
        [PropertyValidate("周期", NotNullAndEmpty = true)]
        public string DateCode { get; set; }
        /// <summary>
        /// éœ€æ±‚数量
        /// éœ€æ±‚PCS数量
        /// </summary>
        [PropertyValidate("需求数量", NotNullAndEmpty = true)]
        public float RequiredQuantity { get; set; }
        /// <summary>
        /// éœ€æ±‚SET数量
        /// </summary>
        public float RequiredSetCount { get; set; }
        /// <summary>
        /// ä»“库
        /// </summary>
        public string WarehouseCode { get; set; }
        /// <summary>
        /// å·¥åŽ‚
        /// </summary>
        public string FactoryCode { get; set; }
        public string FactoryCode { get; set; } = "HA02";
        /// <summary>
        /// æŽ¥æ”¶
        /// </summary>
        public int ReceiveDown { get; set; }
        /// <summary>
        /// é”€å”®è®¢å•
        /// </summary>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_MesRworkOutboundOrder.cs
@@ -93,11 +93,16 @@
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "周期")]
        public string DateCode { get; set; }
        /// <summary>
        /// éœ€æ±‚数量
        /// éœ€æ±‚PCS数量
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "需求数量", DefaultValue = "0")]
        public float RequiredQuantity { get; set; }
        /// <summary>
        /// éœ€æ±‚SET数量
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "需求数量", DefaultValue = "0")]
        public float RequiredSetCount { get; set; }
        /// <summary>
        /// å·¥åŽ‚
        /// </summary>
        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "工厂")]
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockRepository/ProStockInfoRepository.cs
@@ -77,8 +77,7 @@
            proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode))
                .Includes(x => x.proStockInfoDetails)
                .Where(x => x.proStockInfoDetails
                .Any(v => v.SaleOrder == mesRworkOutboundOrder.SaleOrder
                && v.ProductCode == mesRworkOutboundOrder.ProductCode
                .Any(v => v.ProductCode == mesRworkOutboundOrder.ProductCode
                && v.ProductVersion == mesRworkOutboundOrder.ProductVersion
                && (isCanDate ? isCanDate : v.DateCode == mesRworkOutboundOrder.DateCode)
                ))
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_StockService/ProStockInfoService.cs
@@ -109,7 +109,7 @@
        public List<Dt_ProStockInfo> GetUseableStocks(Dt_MesRworkOutboundOrder mesRworkOutboundOrder)
        {
            //转换成 æˆå“ä»“仓库信息获取尾数属性的货位
            Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==WarehouseEnum.HA71.ToString());
            Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseId== mesRworkOutboundOrder.WarehouseId);
            List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehouse.WarehouseId);
            return BaseDal.GetProStocks(mesRworkOutboundOrder, locationCodes);
        }
@@ -125,10 +125,14 @@
        public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ProOutOrderDetail outOrderDetail, float needQuantity, out float residueQuantity)
        {
            List<Dt_ProStockInfo> assignOutStocks =new List<Dt_ProStockInfo>();
            float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x);
            //stockInfos = stockInfos.OrderBy(x => x.Id).ToList();
            bool isCanLot = string.IsNullOrEmpty(outOrderDetail.PLot);
            bool isCanDate = string.IsNullOrEmpty(outOrderDetail.DateCode);
            float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == outOrderDetail.PCode && x.ProductVersion.StartsWith(outOrderDetail.PVer.Substring(0, 1))
                            && (isCanLot ? isCanLot : x.BagNo == outOrderDetail.PLot)
                            && (isCanDate ? isCanDate : x.DateCode == outOrderDetail.DateCode))
                        .Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x);
            //stockInfos = stockInfos.OrderBy(x => x.Id).ToList();
            if (stockTotalQuantity >= needQuantity)//库存够
            {
                int index = 0;
@@ -233,7 +237,10 @@
        public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ErpProScrapSheetDetail outOrderDetail, float needQuantity, out float residueQuantity)
        {
            List<Dt_ProStockInfo> assignOutStocks = new List<Dt_ProStockInfo>();
            float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x);
            float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x =>
                            x.ProductCode == outOrderDetail.ScrapProCode
                            && x.ProductVersion == outOrderDetail.ScrapProVersion
                            && x.LotNumber == outOrderDetail.ScrapProLotNo).Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x);
            //stockInfos = stockInfos.OrderBy(x => x.Id).ToList();
            if (stockTotalQuantity >= needQuantity)//库存够
            {
@@ -293,9 +300,12 @@
        public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_MesRworkOutboundOrder mesRworkOutboundOrder, float needQuantity, out float residueQuantity)
        {
            List<Dt_ProStockInfo> assignOutStocks = new List<Dt_ProStockInfo>();
            float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x);
            //stockInfos = stockInfos.OrderBy(x => x.Id).ToList();
            bool isCanDate = string.IsNullOrEmpty(mesRworkOutboundOrder.DateCode);
            float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Where(x => x.ProductCode == mesRworkOutboundOrder.ProductCode
                            && x.ProductVersion == mesRworkOutboundOrder.ProductVersion
                            && (isCanDate ? isCanDate : x.DateCode == mesRworkOutboundOrder.DateCode))
                        .Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x);
            //stockInfos = stockInfos.OrderBy(x => x.Id).ToList();
            if (stockTotalQuantity >= needQuantity)//库存够
            {
                int index = 0;
@@ -303,8 +313,7 @@
                {
                    Dt_ProStockInfo stockInfo = stockInfos[index];
                    float useableStockQuantity = stockInfo.proStockInfoDetails
                        .Where(x => x.SaleOrder == mesRworkOutboundOrder.SaleOrder
                            && x.ProductCode == mesRworkOutboundOrder.ProductCode
                        .Where(x => x.ProductCode == mesRworkOutboundOrder.ProductCode
                            && x.ProductVersion == mesRworkOutboundOrder.ProductVersion
                            && (isCanDate? isCanDate: x.DateCode == mesRworkOutboundOrder.DateCode))
                        .Sum(x => x.StockPcsQty - x.OutboundQuantity);
@@ -317,7 +326,7 @@
                    {
                        stockInfo.proStockInfoDetails.ForEach(x =>
                        {
                            if ((x.StockPcsQty > x.OutboundQuantity) && x.SaleOrder == mesRworkOutboundOrder.SaleOrder
                            if ((x.StockPcsQty > x.OutboundQuantity)
                                && x.ProductCode == mesRworkOutboundOrder.ProductCode 
                                && x.ProductVersion == mesRworkOutboundOrder.ProductVersion
                                && (isCanDate ? isCanDate : x.DateCode == mesRworkOutboundOrder.DateCode))
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesProductService.cs
@@ -531,7 +531,7 @@
            MesResponseContent content = new MesResponseContent();
            try
            {
                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString());
                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == model.WarehouseCode);
                if (warehouse == null)
                {
                    return content.Error($"尾数仓信息未配置");
@@ -546,17 +546,58 @@
                {
                    WarehouseId = warehouse.WarehouseId,
                    TaskNo = model.TaskNo,
                    OrderStatus = OutOrderStatusEnum.未开始.ObjToInt(),
                    OrderStatus = OutOrderStatusEnum.出库中.ObjToInt(),
                    CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(),
                    ProductCode = model.ProductCode,
                    ProductName = model.ProductName,
                    ProductName = model.ProductCode,
                    ProductVersion = model.ProductVersion,
                    DateCode = model.DateCode,
                    RequiredQuantity = model.RequiredQuantity,
                    RequiredSetCount=model.RequiredSetCount,
                    FactoryCode = model.FactoryCode,
                    SaleOrder = model.SaleOrder,
                    SaleOrder = model.SaleOrder ?? "",
                    OrderType = model.InventoryType
                };
                if (model.DateCode.IndexOf("平库")>0 || warehouse.WarehouseCode==WarehouseEnum.HA101.ToString())
                {
                    Dt_Warehouse warehousePing = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString());
                    mesRworkOutboundOrder.WarehouseId = warehousePing.WarehouseId;
                    mesRworkOutboundOrder.OrderStatus = OutOrderStatusEnum.出库完成.ObjToInt();
                    _unitOfWorkManage.BeginTran();
                    _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder);
                    MesInventoryInfo mesInventoryInfo = new MesInventoryInfo()
                    {
                        Warhouseno = warehousePing.WarehouseCode,
                        InternalPackageNumber = model.ProductCode,
                        SetCount = (int)model.RequiredSetCount,
                        EligiblePcsCount = (int)model.RequiredQuantity
                    };
                    MesProductOutBound mesProductOutBound = new MesProductOutBound()
                    {
                        TaskNo = mesRworkOutboundOrder.TaskNo,
                        ProductCode = mesRworkOutboundOrder.ProductCode,
                        ProductVersion = mesRworkOutboundOrder.ProductVersion,
                        DateCode = mesRworkOutboundOrder.DateCode,
                        SaleOrder = mesRworkOutboundOrder.SaleOrder,
                        InventoryInfo = new List<MesInventoryInfo> { mesInventoryInfo  }
                    };
                    if (model.ReceiveDown==EnableEnum.Enable.ObjToInt())
                    {
                        _unitOfWorkManage.RollbackTran();
                    }
                    else
                    {
                        //MES成品库存板出库同步
                        WebResponseContent responseContentPing = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(mesProductOutBound);
                        if (!responseContentPing.Status)
                        {
                            throw new Exception("同步MES库存板出库失败,错误:" + responseContentPing.Message);
                        }
                        _unitOfWorkManage.CommitTran();
                    }
                    return content.OK($"提供返库单接收成功,ReceiveDown:{model.ReceiveDown}");
                }
                List<Dt_Task> tasks = new List<Dt_Task>();
                List<Dt_ProStockInfo>? proStockInfos = null;
                List<Dt_OutProStockInfo>? outProStockInfos = null;
@@ -605,11 +646,16 @@
                    if (!updateContent.Status)
                    {
                        _unitOfWorkManage.RollbackTran();
                        return content.Error(updateContent.Message);
                        throw new Exception(updateContent.Message);
                    }
                }
                _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder);
                if (model.ReceiveDown == EnableEnum.Enable.ObjToInt())
                {
                    _unitOfWorkManage.RollbackTran();
                }
                else
                {
                //MES成品库存板出库同步
                WebResponseContent responseContent = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(_outboundService.RworkOutboundOrderService.MesProOutBound(mesRworkOutboundOrder, proStockInfoDetails));
                if (!responseContent.Status)
@@ -617,7 +663,8 @@
                    throw new Exception("同步MES库存板出库失败,错误:" + responseContent.Message);
                }
                _unitOfWorkManage.CommitTran();
                return content.OK("提供返库单接收成功");
                }
                return content.OK($"提供返库单接收成功,ReceiveDown:{model.ReceiveDown}");
            }
            catch (Exception ex)
            {