| | |
| | | inboundOrderDetail.BarcodeUnit = item.BarcodeUnit; |
| | | inboundOrderDetail.BarcodeQty = item.BarcodeQty; |
| | | inboundOrderDetail.OrderQuantity = item.OrderQuantity; |
| | | |
| | | var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync(item.MaterielCode, item.BarcodeQty); |
| | | inboundOrderDetail.Unit = purchaseToStockResult.Unit; |
| | | inboundOrderDetail.OrderQuantity = purchaseToStockResult.Quantity; |
| | | |
| | | updateInboundOrderDetails.Add(inboundOrderDetail); |
| | | detailIds.Add(inboundOrderDetail.Id); |
| | |
| | | _unitOfWorkManage.BeginTran(); |
| | | foreach (var item in deletePurchaseOrderDetails) |
| | | { |
| | | _inboundOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.èªå¨å é¤); |
| | | _inboundOrderDetailRepository.DeleteData(item); |
| | | //_inboundOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.èªå¨å é¤); |
| | | } |
| | | |
| | | _inboundOrderDetailRepository.UpdateData(updateInboundOrderDetails); |
| | |
| | | } |
| | | //Db.DeleteNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(inboundOrder, OperateTypeEnum.èªå¨å é¤); |
| | | //BaseDal.DeleteAndMoveIntoHty(inboundOrder, OperateTypeEnum.èªå¨å é¤); |
| | | foreach (var item in inboundOrder.Details) |
| | | { |
| | | _inboundOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.èªå¨å é¤); |
| | | _inboundOrderDetailRepository.DeleteData(item); |
| | | //_inboundOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.èªå¨å é¤); |
| | | } |
| | | BaseDal.DeleteData(inboundOrder); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | { |
| | | (bool, string, object?) result2 = ModelValidate.ValidateModelData(materielGroupDTO); |
| | | if (!result2.Item1) return content = WebResponseContent.Instance.Error(result2.Item2); |
| | | |
| | | var code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Code == materielGroupDTO.WarehouseCode).Select(x => x.Code).First(); |
| | | if (string.IsNullOrEmpty(code)) |
| | | bool code = _warehouseAreaRepository.Db.Queryable<Dt_WarehouseArea>().Where(x => x.Id == materielGroupDTO.WarehouseCode).Any(); |
| | | if (!code) |
| | | { |
| | | return content = WebResponseContent.Instance.Error($"ä»åºä¸æ²¡æè¯¥{materielGroupDTO.WarehouseCode}ç¼å·ã"); |
| | | } |
| | |
| | | { |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() { PalletType = PalletTypeEnum.Empty.ObjToInt(), StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), PalletCode = materielGroupDTO.PalletCode,LocationType=1 }; |
| | | stockInfo = new Dt_StockInfo() { PalletType = PalletTypeEnum.Empty.ObjToInt(), StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), PalletCode = materielGroupDTO.PalletCode,LocationType= materielGroupDTO.WarehouseCode.ObjToInt() }; |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.PalletType = PalletTypeEnum.Empty.ObjToInt(); |
| | | stockInfo.StockStatus = StockStatusEmun.ç»çæå.ObjToInt(); |
| | | stockInfo.LocationType = materielGroupDTO.WarehouseCode.ObjToInt(); |
| | | } |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent UndoPalletGroup(string palletCode) |
| | | { |
| | | if (string.IsNullOrWhiteSpace(palletCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error("æçå·ä¸è½ä¸ºç©º"); |
| | | } |
| | | var stock= _stockRepository.Db.Queryable<Dt_StockInfo>().Includes(o=>o.Details).First(x => x.PalletCode == palletCode && x.StockStatus==3); |
| | | if (stock == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°æçå·{palletCode}对åºçåºåè®°å½"); |
| | | } |
| | | // è·ååºå详æ
å
³èçææå
¥åºåå· |
| | | var relatedOrderNos = stock.Details.Select(d => d.OrderNo).First(); |
| | | // æ¥è¯¢ææå
³èçå
¥åºåï¼å«è¯¦æ
ï¼ |
| | | var inboundOrders = _inboundOrderRepository.Db.Queryable<Dt_InboundOrder>() |
| | | .Includes(x => x.Details) |
| | | .Where(x => relatedOrderNos==x.InboundOrderNo) |
| | | .First(); |
| | | |
| | | var barcodes = stock.Details.Select(d => d.Barcode).ToList(); |
| | | |
| | | |
| | | // å¹é
åºåæ¡ç 对åºçå
¥åºåæç» |
| | | var matchedInboundDetails = inboundOrders.Details |
| | | ?.Where(d => barcodes.Contains(d.Barcode)) |
| | | .ToList(); |
| | | foreach (var detail in matchedInboundDetails) |
| | | { |
| | | detail.ReceiptQuantity = 0; |
| | | detail.OrderDetailStatus = 0; |
| | | _inboundOrderDetailRepository.UpdateData(detail); |
| | | } |
| | | _stockDetailRepository.DeleteData(stock.Details); |
| | | _stockRepository.DeleteData(stock); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | } |