public MedicineDeliveryAllocationEntity(int subNo, VWareHouseDetail vWareHouseDetail) { this.SubNo = subNo; this.VWareHouseDetail = vWareHouseDetail; this.LotNo = this.VWareHouseDetail == null ? null : this.VWareHouseDetail.LotNo; this.ExpiredDate = this.VWareHouseDetail == null ? (DateTime?)null : this.VWareHouseDetail.ExpiredDate; this.InStockQty = VWareHouseDetail.Qty; this.AllocatedQty = vWareHouseDetail.AllocatedQty; }
private void DataGridViewX1CellDoubleClick(object sender, DataGridViewCellEventArgs e) { this.selectedWareHouseDetail = (VWareHouseDetail)this.bdsVWarehouseDetail.Current; this.DialogResult = DialogResult.Yes; this.Close(); }
private void BtnSaveClick(object sender, EventArgs e) { this.selectedWareHouseDetail = (VWareHouseDetail)this.bdsVWarehouseDetail.Current; this.DialogResult = DialogResult.Yes; this.Close(); }
/// <summary> /// Autoes the allocate. /// </summary> /// <param name="medicineDeliveryDetails">The medicine delivery details.</param> /// <param name="wareHouseDetails">The ware house details.</param> /// <returns></returns> private void AutoAllocate(List<MedicineDeliveryDetail> medicineDeliveryDetails, List<VWareHouseDetail> wareHouseDetails) { foreach (var deliveryDetailItem in medicineDeliveryDetails) { deliveryDetailItem.AllocatedWareHouseDetail = new List<VWareHouseDetail>(); var warehouseDetailList = wareHouseDetails.Where(x => x.MedicineId == deliveryDetailItem.MedicineId).OrderBy(x => x.ExpiredDate).OrderBy(x => x.Id).ToList(); foreach (var t in warehouseDetailList) { if (deliveryDetailItem.NotAllocatedQty <= 0) break; if (deliveryDetailItem.NotAllocatedQty <= t.Qty) { var allocated = new VWareHouseDetail { MedicineId = t.MedicineId, ClinicId = t.ClinicId, LotNo = t.LotNo, ExpiredDate = t.ExpiredDate, Qty = t.Qty, AllocatedQty = deliveryDetailItem.NotAllocatedQty, InStockQty = t.InStockQty }; deliveryDetailItem.NotAllocatedQty = 0; deliveryDetailItem.AllocatedWareHouseDetail.Add(allocated); deliveryDetailItem.NotAllocatedQty = 0; } else { var allocated = new VWareHouseDetail { MedicineId = t.MedicineId, ClinicId = t.ClinicId, LotNo = t.LotNo, ExpiredDate = t.ExpiredDate, Qty = t.Qty, AllocatedQty = t.Qty, InStockQty = t.InStockQty }; deliveryDetailItem.NotAllocatedQty -= allocated.AllocatedQty; deliveryDetailItem.AllocatedWareHouseDetail.Add(allocated); } if (deliveryDetailItem.NotAllocatedQty == 0) break; } } }