1
dengjunjie
4 天以前 1f1b9ac010b7ef6a055bdf22c022868c9033712f
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs
@@ -44,14 +44,21 @@
                    {
                        foreach (var items in inventoryInfos.GroupBy(x => x.WarehouseCode))
                        {
                            Dt_DeliveryOrder deliveryOrder = new Dt_DeliveryOrder()
                            Dt_DeliveryOrder? deliveryOrder = deliveryOrders.Where(x => x.Warehouse_no == items.Key).FirstOrDefault();
                            bool isNull = false;
                            if (deliveryOrder == null)
                            {
                                Out_no = item.MaterielCode + "_" + item.BatchNo,
                                Out_type = "20",
                                OutStatus = "新建",
                                Warehouse_no = items.Key,
                                Details = new List<Dt_DeliveryOrderDetail>()
                            };
                                isNull = true;
                                deliveryOrder = new Dt_DeliveryOrder()
                                {
                                    //Out_no = item.MaterielCode + "_" + item.BatchNo,
                                    Out_no = $"PD{items.Key}{DateTime.Now.ToString("yyMMddHHmmss")}",
                                    Out_type = "20",
                                    OutStatus = "新建",
                                    Warehouse_no = items.Key,
                                    Details = new List<Dt_DeliveryOrderDetail>()
                                };
                            }
                            var Status = items.Key == "001" ? 0 : 2;//判断是否为立库区域
                            Dt_DeliveryOrderDetail deliveryOrderDetail = new Dt_DeliveryOrderDetail()
                            {
@@ -66,7 +73,7 @@
                                Reservoirarea = items.Key
                            };
                            deliveryOrder.Details.Add(deliveryOrderDetail);
                            deliveryOrders.Add(deliveryOrder);
                            if (isNull) deliveryOrders.Add(deliveryOrder);
                            #region åˆ›å»ºç›˜ç‚¹ä»»åŠ¡
                            foreach (var inventory in items)
                            {
@@ -250,7 +257,7 @@
                {
                    inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode);
                }
                inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity;
                inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity;
                #endregion
                #region åˆ¤æ–­å½“前物料批次的盘点任务是否全部完成
@@ -262,27 +269,27 @@
                {
                    #region æŸ¥æ‰¾åº“å­˜
                    inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.Id != inventoryInfo.Id);
                    var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + supplyTask.SupplyQuantity;
                    var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + inventoryInfo.SupplyQuantity;//计算盘点总数
                    #endregion
                    #region åº“存批次
                    inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no);
                    //如果盘点数和批次总数对上了,盘点数赋值为0,赋值就添加盘点数
                    if (SupplyQuantitys == inventory_Batch.StockQuantity)
                    if (SupplyQuantitys == 0)
                    {
                        foreach (var item in inventoryInfos)
                        {
                            item.StockQuantity = item.SupplyQuantity;
                            item.StockQuantity += item.SupplyQuantity;
                            item.SupplyQuantity = 0;
                            item.StockStatus = StockStatusEmun.入库完成.ObjToInt();
                        }
                        inventoryInfo.StockQuantity = supplyTask.SupplyQuantity;
                        inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                        inventoryInfo.SupplyQuantity = 0;
                        inventoryInfo.StockStatus = StockStatusEmun.入库完成.ObjToInt();
                    }
                    else
                    {
                        inventory_Batch.SupplyQuantity = SupplyQuantitys;
                        inventory_Batch.SupplyQuantity += SupplyQuantitys;
                    }
                    #endregion
                }
@@ -310,11 +317,8 @@
                #endregion
                _inventoryInfoService.UpdateData(inventoryInfo);
                _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.自动完成);
                if (inventoryInfos.Count >= 1)
                {
                    _inventoryInfoService.UpdateData(inventoryInfos);
                    _inventory_BatchServices.UpdateData(inventory_Batch);
                }
                _inventoryInfoService.UpdateData(inventoryInfos);
                _inventory_BatchServices.UpdateData(inventory_Batch);
                _unitOfWorkManage.CommitTran();
                #endregion
                content.OK();