dengjunjie
2025-10-24 8b00a760cb23067c3ea46a2fd905ae9ff1a713a2
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs
@@ -120,12 +120,13 @@
                var LocationCode = saveModel.MainData["LocationCode"].ToString();
                var orderNo = saveModel.MainData["orderNo"].ToString();
                var batchNo = saveModel.MainData["batchNo"].ToString();
                var materielCode = saveModel.MainData["materielCode"].ToString();
                var Inqty = saveModel.MainData["Inqty"].ObjToInt();
                var warehouseCode = saveModel.MainData["warehouseCode"].ToString();
                Dt_CabinOrder cabinOrder = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == orderNo && x.Warehouse_no == warehouseCode).Includes(x => x.Details).First();
                if (cabinOrder == null || cabinOrder.OdrderStatus == "已完成")
                    return WebResponseContent.Instance.Error($"入库单已完成");
                Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Batch_num == batchNo && x.Status == 2).First();
                Dt_CabinOrderDetail cabinOrderDetail = cabinOrder.Details.Where(x => x.Goods_no == materielCode && x.Batch_num == batchNo && x.Status == 2).First();
                if (cabinOrderDetail == null || cabinOrderDetail.OrderDetailStatus == "已完成")
                    return WebResponseContent.Instance.Error($"入库单明细已完成");
                Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
@@ -143,28 +144,9 @@
                if (cabinOrderDetail.Order_Inqty == cabinOrderDetail.Order_qty)
                {
                    cabinOrderDetail.OrderDetailStatus = "已完成";
                    //_cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetail, OperateTypeEnum.自动完成);
                    //Dt_CabinOrderDetail_Hty hty = new Dt_CabinOrderDetail_Hty
                    //{
                    //    Id = cabinOrderDetail.OrderId,
                    //    Reservoirarea = cabinOrderDetail.Reservoirarea,
                    //    Goods_no = cabinOrderDetail.Goods_no,
                    //    Order_qty = cabinOrderDetail.Order_qty,
                    //    Order_Inqty = cabinOrderDetail.Order_Inqty,
                    //    Batch_num = cabinOrderDetail.Batch_num,
                    //    Exp_date = cabinOrderDetail.Exp_date,
                    //    OrderDetailStatus = cabinOrderDetail.OrderDetailStatus,
                    //    Status = cabinOrderDetail.Status,
                    //    Creater = cabinOrderDetail.Creater,
                    //    CreateDate = cabinOrderDetail.CreateDate,
                    //    Modifier = App.User.UserName,
                    //    ModifyDate = DateTime.Now
                    //};
                    //var i = BaseDal.Db.Insertable(hty).ExecuteCommand();
                }
                _cabinOrderDetailServices.Repository.UpdateData(cabinOrderDetail);
                var cabinOrder1 = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no).Includes(x => x.Details).First();
                var cabinOrder1 = BaseDal.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no && x.Warehouse_no == warehouseCode).Includes(x => x.Details).First();
                if (!cabinOrder1.Details.Where(x => x.OrderDetailStatus != "已完成").Any()) cabinOrder.OdrderStatus = "已完成";
                Repository.UpdateData(cabinOrder);
                #endregion
@@ -174,6 +156,8 @@
                if (location == null) return WebResponseContent.Instance.Error($"请维护货位编号【{LocationCode}】的货位信息");
                if (location.EnableStatus == EnableStatusEnum.Disable.ObjToInt())
                    return WebResponseContent.Instance.Error($"货位编号【{LocationCode}】已禁用,请恢复正常再使用");
                if (location.WarehouseCode != cabinOrderDetail.Reservoirarea)
                    return WebResponseContent.Instance.Error($"货位编号【{LocationCode}】所属库房与当前入库单所属库房不匹配");
                if (location.LocationStatus == LocationStatusEnum.Free.ObjToInt())
                {
                    location.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
@@ -187,6 +171,7 @@
                {
                    inventoryInfo.StockQuantity += Inqty;
                    inventoryInfo.AvailableQuantity += Inqty;
                    inventoryInfo.InDate = DateTime.Now;
                    _inventoryInfoService.UpdateData(inventoryInfo);
                }
                else
@@ -586,7 +571,7 @@
                //查出包含全部的入库单,包含全部明细+一个明细对应一个商品
                var orders = BaseDal.Db.CopyNew()
                .Queryable<Dt_CabinOrder>()
                .Where(o => o.OdrderStatus == "新建")
                .Where(o => o.OdrderStatus == "新建" && o.Warehouse_no == WarehouseEnum.立库.ObjToInt().ToString("000"))
                .Includes(o => o.Details, d => d.MedicineGoods)
                .ToList();
                // 3. å†è¿‡æ»¤æŽ‰ä¸ç¬¦åˆæ¡ä»¶çš„æ˜Žç»†ï¼ˆåªä¿ç•™ Status=0)
@@ -698,7 +683,7 @@
            try
            {
                #region æŸ¥æ‰¾æ‰€æœ‰å·²å®Œæˆå…¥åº“单
                var inorders = BaseDal.QueryData(x => x.OdrderStatus == "已完成").Select(x => x.Order_no).ToList();
                var inorders = BaseDal.QueryData(x => x.OdrderStatus == "已完成").Select(x => x.Order_no).Distinct().ToList();
                foreach (var inorder in inorders)
                {
                    //var Orders = BaseDal.QueryData(x => x.Order_no == inorder);