| | |
| | | } |
| | | } |
| | | |
| | | public async Task<WebResponseContent> NoStockOutSubmit(NoStockOutSubmit noStockOutSubmit) |
| | | public async Task<WebResponseContent> NoStockOutSubmit(NoStockOutSubmit noStockOutSubmit) |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | // Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo); |
| | | // Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo); |
| | | |
| | | var dbinboundOrderDetails = Db.Queryable<Dt_PickingRecord>().Where(x=>x.OrderNo== materielGroupDTO.OrderNo && !x.IsCancelled && x.Barcode==materielGroupDTO.Barcodes).ToList(); |
| | | var dbinboundOrderDetails = Db.Queryable<Dt_PickingRecord>().Where(x => x.OrderNo == materielGroupDTO.OrderNo && !x.IsCancelled && x.Barcode == materielGroupDTO.Barcodes).ToList(); |
| | | |
| | | if (dbinboundOrderDetails != null && !dbinboundOrderDetails.Any()) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | (bool, string, object?) result = CheckMaterielGroupParam(materielGroupDTO, materielCodes, stockInfo); |
| | | (bool, string, object?) result = CheckMaterielGroupParam(materielGroupDTO, materielCodes, stockInfo); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = materielGroupDTO.locationType.ObjToInt() }; |
| | | stockInfo.Details = new List<Dt_StockInfoDetail>(); |
| | | } |
| | | var inboindId = 0; Dt_InboundOrder dt_InboundOrder = null; |
| | | var dbinbound = _inboundOrderRepository.QueryData(x => x.InboundOrderNo == dbinboundOrderDetails.First().OrderNo).First(); |
| | | if (dbinbound == null) |
| | | { |
| | | dt_InboundOrder = new Dt_InboundOrder |
| | | { |
| | | WarehouseId = 0, |
| | | InboundOrderNo = dbinboundOrderDetails.First()?.OrderNo, |
| | | UpperOrderNo = dbinboundOrderDetails.First()?.OrderNo, |
| | | SupplierId = dbinboundOrderDetails.First()?.SupplyCode, |
| | | OrderType = InOrderTypeEnum.InternalAllocat.ObjToInt(), |
| | | |
| | | BusinessType = InOrderTypeEnum.InternalAllocat.ObjToInt().ToString(), |
| | | |
| | | FactoryArea = dbinboundOrderDetails.First()?.FactoryArea, |
| | | Remark = "", |
| | | Details = new List<Dt_InboundOrderDetail>() |
| | | }; |
| | | inboindId = _inboundOrderRepository.AddData(dt_InboundOrder); |
| | | } |
| | | else |
| | | { |
| | | dt_InboundOrder = new Dt_InboundOrder { Details = new List<Dt_InboundOrderDetail>() }; |
| | | inboindId = dbinbound.Id; |
| | | } |
| | | |
| | | foreach (var item in dbinboundOrderDetails) |
| | |
| | | BarcodeUnit = item.BarcodeUnit, |
| | | FactoryArea = item.FactoryArea, |
| | | Status = 0, |
| | | OrderNo = item.OrderNo, |
| | | OrderNo = item.OrderNo, |
| | | BusinessType = InOrderTypeEnum.InternalAllocat.ObjToInt().ToString() |
| | | |
| | | }); |
| | | }); |
| | | item.WarehouseCode = item.WarehouseCode; |
| | | |
| | | dt_InboundOrder.Details.Add(new Dt_InboundOrderDetail |
| | | { |
| | | OrderId = inboindId, |
| | | MaterielCode = item.MaterielCode, |
| | | MaterielName = "", |
| | | BatchNo = item.BatchNo, |
| | | OrderQuantity = item.PickQuantity, |
| | | ReceiptQuantity = 0, |
| | | OverInQuantity = 0, |
| | | Unit = item.BarcodeUnit, |
| | | RowNo = 0, |
| | | lineNo = item.lineNo, |
| | | SupplyCode = item.SupplyCode, |
| | | WarehouseCode = item.WarehouseCode, |
| | | Barcode = item.Barcode, |
| | | OutBoxbarcodes = "", |
| | | BarcodeQty = (decimal)item.BarcodeQty, |
| | | BarcodeUnit = item.BarcodeUnit |
| | | }); |
| | | } |
| | | |
| | | _inboundOrderDetailService.Db.Insertable<Dt_InboundOrderDetail>(dt_InboundOrder.Details); |
| | | if (stockInfo.Id == 0) |
| | | { |
| | | stockInfo.PalletCode = materielGroupDTO.PalletCode; |
| | |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | |
| | | _stockService.StockInfoService.AddMaterielGroup(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return content; |
| | | |
| | | } |
| | | |
| | | |
| | | public (bool, string, object?) CheckMaterielGroupParam(BarcodeMaterielGroupDTO materielGroupDTO, List<string> barcodeCodes, Dt_StockInfo stockInfo) |
| | | |
| | | public (bool, string, object?) CheckMaterielGroupParam(BarcodeMaterielGroupDTO materielGroupDTO, List<string> barcodeCodes, Dt_StockInfo stockInfo) |
| | | { |
| | | (bool, string, object?) result = ModelValidate.ValidateModelData(materielGroupDTO); |
| | | if (!result.Item1) return result; |
| | |
| | | { |
| | | return (false, $"{barcodeCodes[0]} æ¡ç å¨åºåä¸å·²åå¨", materielGroupDTO); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | return (true, "æå", materielGroupDTO); |
| | | } |