| | |
| | | using HslCommunication; |
| | | using MailKit.Search; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Data.SqlClient; |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | private readonly IInventory_BatchServices _inventory_BatchServices; |
| | | private readonly IInventoryInfoService _inventoryInfoService; |
| | | private readonly ICabinOrderDetailServices _cabinOrderDetailServices; |
| | | private readonly IDeliveryOrderServices _eliveryOrderServices; |
| | | private readonly ISupplyTaskService _supplyTaskService; |
| | | private readonly ISupplyTaskHtyService _supplyTaskHtyService; |
| | | public IRepository<Dt_CabinOrder> Repository => BaseDal; |
| | | |
| | | public CabinOrderServices(IRepository<Dt_CabinOrder> BaseDal, IBasicService basicService, IMedicineGoodsServices medicineGoodsServices, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, ICabinOrderDetailServices cabinOrderDetailServices, ICabinOrderHtyServices cabinOrderHtyServices, ICabinOrderDetailHtyServices cabinOrderDetailHtyServices, ISupplyTaskService supplyTaskService, ISupplyTaskHtyService supplyTaskHtyService) : base(BaseDal) |
| | | public CabinOrderServices(IRepository<Dt_CabinOrder> BaseDal, IBasicService basicService, IMedicineGoodsServices medicineGoodsServices, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, ICabinOrderDetailServices cabinOrderDetailServices, ICabinOrderHtyServices cabinOrderHtyServices, ICabinOrderDetailHtyServices cabinOrderDetailHtyServices, ISupplyTaskService supplyTaskService, ISupplyTaskHtyService supplyTaskHtyService, IDeliveryOrderServices eliveryOrderServices) : base(BaseDal) |
| | | { |
| | | _basicService = basicService; |
| | | _medicineGoodsServices = medicineGoodsServices; |
| | |
| | | _cabinOrderDetailServices = cabinOrderDetailServices; |
| | | _supplyTaskService = supplyTaskService; |
| | | _supplyTaskHtyService = supplyTaskHtyService; |
| | | _eliveryOrderServices = eliveryOrderServices; |
| | | } |
| | | |
| | | |
| | |
| | | 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); |
| | |
| | | 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 |
| | |
| | | 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(); |
| | |
| | | { |
| | | inventoryInfo.StockQuantity += Inqty; |
| | | inventoryInfo.AvailableQuantity += Inqty; |
| | | inventoryInfo.InDate = DateTime.Now; |
| | | _inventoryInfoService.UpdateData(inventoryInfo); |
| | | } |
| | | else |
| | |
| | | List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>; |
| | | if (dt_CabinOrders != null) _CabinOrders.AddRange(dt_CabinOrders); |
| | | } |
| | | else |
| | | else if (order.order_type == "3")//å
¥åºéæ |
| | | { |
| | | //å建åºåºå |
| | | #region 转æ¢ä¸ºåºåºå |
| | | UpstramOutOrderInfo upstramOutOrderInfo = new UpstramOutOrderInfo() |
| | | { |
| | | order_no = order.order_no, |
| | | order_type = order.order_type, |
| | | warehouse_no = order.warehouse_no, |
| | | details = new List<UpstreamOutOrderDetail>() |
| | | }; |
| | | foreach (var item in order.details) |
| | | { |
| | | UpstreamOutOrderDetail detail = new UpstreamOutOrderDetail() |
| | | { |
| | | batch_num = item.batch_num, |
| | | goods_no = item.goods_no, |
| | | order_qty = item.order_qty, |
| | | exp_date = item.exp_date, |
| | | }; |
| | | upstramOutOrderInfo.details.Add(detail); |
| | | } |
| | | _eliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo); |
| | | #endregion |
| | | } |
| | | else if (order.order_type == "5")//æ¥æº¢å
¥åº |
| | | { |
| | | |
| | | } |
| | | }; |
| | |
| | | //æ¥åºå
å«å
¨é¨çå
¥åºåï¼å
å«å
¨é¨æç»+ä¸ä¸ªæç»å¯¹åºä¸ä¸ªåå |
| | | 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ï¼ |
| | |
| | | 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); |