/// <summary> /// 상단바 업데이트 /// </summary> /// <param name="itemData"></param> void ItemsGrid_UpdateCurrentItemStatus(PBItemData itemData) { // 상단바에 표시 currentItemInfo1.NmClass = itemData == null ? string.Empty : itemData.NmClass; currentItemInfo1.NmItem = itemData == null ? string.Empty : itemData.NmItem; currentItemInfo1.Qty = itemData == null ? 0 : TypeHelper.ToInt32(itemData.Qty); currentItemInfo1.Price = itemData == null ? 0 : TypeHelper.ToInt32(itemData.UtSprc); }
/// <summary> /// Next Row to be ready to input /// </summary> public void ItemsGrid_AddItemRow(PBItemData itemData, bool setSelected) { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate() { gpItems.AddRow(itemData, setSelected); }); } else { gpItems.AddRow(itemData, setSelected); } }
/// <summary> /// Update 수량, 할인, 단가..등 /// </summary> /// <param name="value"></param> public void ItemsGrid_UpdateItemRow(PBItemData value) { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate() { gpItems.UpdateCurrentRow(value); }); } else { gpItems.UpdateCurrentRow(value); } }
/// <summary> /// 현대행 업데이트 /// </summary> /// <param name="rowIndex"></param> /// <param name="value"></param> public void ItemsGrid_UpdateItemRow(int rowIndex, PBItemData value) { if (this.InvokeRequired) { this.Invoke((MethodInvoker) delegate() { gpItems.SelectedRowIndex = rowIndex; gpItems.UpdateRow(rowIndex, value); }); } else { gpItems.SelectedRowIndex = rowIndex; gpItems.UpdateRow(rowIndex, value); } }
/// <summary> /// SubFunc for UpdateItemRow /// to be called in thread or async /// </summary> /// <param name="value"></param> void ItemsGrid_UpdateItemRow(SaleGridRow row, PBItemData value) { if (row.Cells.Length == 0) { return; } PBItemData curItemData = row.ItemData as PBItemData; // update Amount - 금액다시 계산 if (curItemData == null) { curItemData = PBItemData.Empty; } bool setNull = false; if (value == null) { setNull = true; value = PBItemData.Empty; value.Properties = PBItemProperties.All; } // value.CompleteStep == Empty // 처음 Scan 된 상품이라 모든 셀의 값이 재설정한다 bool isFirstParse = (value.ScannedStep > PBItemParseStep.Empty && value.ScannedStep <= PBItemParseStep.CdItem) && value.CompletedStep == PBItemParseStep.Empty; if (isFirstParse || (value.Properties & PBItemProperties.CdClass) == PBItemProperties.CdClass) { currentItemInfo1.CdDp = value.CdDp; row.Cells[SLExtensions.CELL_INDEX_ITEM].Controls[0].Text = SLExtensions.CDDP_PB.Equals(value.CdDp) ? value.CdClass : string.Empty; row.Cells[SLExtensions.CELL_INDEX_QTY].Controls[0].Text = string.IsNullOrEmpty(value.CdClass) ? string.Empty : 1.ToString(); // Update row index row.Cells[SLExtensions.CELL_INDEX_NO].Controls[0].Text = string.IsNullOrEmpty(value.CdClass) ? string.Empty : string.Format("{0:d2}", row.RowIndex + 1); } if (isFirstParse || (value.Properties & PBItemProperties.NmClass) == PBItemProperties.NmClass) { row.Cells[SLExtensions.CELL_INDEX_ITEM].Controls[1].Text = SLExtensions.CDDP_PB.Equals(value.CdDp) ? value.NmClass : string.Empty; if (row.VisibleIndex == gpItems.SelectedVisibleIndex) { currentItemInfo1.NmClass = SLExtensions.CDDP_PB.Equals(value.CdDp) ? value.NmClass : string.Empty; } } if (isFirstParse || (value.Properties & PBItemProperties.CdItem) == PBItemProperties.CdItem) { row.Cells[SLExtensions.CELL_INDEX_ITEM].Controls[0].Text += SLExtensions.CDDP_PB.Equals(value.CdDp) ? value.CdItem : value.Barcode; } if (isFirstParse || (value.Properties & PBItemProperties.NmItem) == PBItemProperties.NmItem) { if (SLExtensions.CDDP_PB.Equals(value.CdDp)) { string name = row.Cells[SLExtensions.CELL_INDEX_ITEM].Controls[1].Text; row.Cells[SLExtensions.CELL_INDEX_ITEM].Controls[1].Text = string.Format("{0}{1}{2}", name, (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value.NmItem) ? "_" : string.Empty), value.NmItem); } else { row.Cells[SLExtensions.CELL_INDEX_ITEM].Controls[1].Text = value.NmItem; } if (row.VisibleIndex == gpItems.SelectedVisibleIndex) { currentItemInfo1.NmItem = value.NmItem; } } if (isFirstParse || (value.Properties & PBItemProperties.FgClass) == PBItemProperties.FgClass) { row.Cells[SLExtensions.CELL_INDEX_ITEM].Controls[0].Text += value.FgClass; } if (isFirstParse || (value.Properties & PBItemProperties.Qty) == PBItemProperties.Qty) { var qty = TypeHelper.ToInt64(value.Qty); if (qty == -1) { // 수량정정 qty = TypeHelper.ToInt64(curItemData.Qty); qty++; } /// update last value value.Qty = qty.ToString(); string qtyText = qty.MoneyToText(!string.IsNullOrEmpty(value.CdClass)); row.Cells[SLExtensions.CELL_INDEX_QTY].Controls[0].Text = string.Format("{0}{1}", StateRefund && !string.IsNullOrEmpty(qtyText) ? "-" : string.Empty, qtyText); row.Cells[SLExtensions.CELL_INDEX_QTY].Controls[0].ForeColor = Color.Empty; if (row.VisibleIndex == gpItems.SelectedVisibleIndex) { currentItemInfo1.Qty = qty; } } // 지정취소 if (isFirstParse || (value.Properties & PBItemProperties.FgCanc) == PBItemProperties.FgCanc) { if ("0".Equals(value.FgCanc)) { row.Cells[SLExtensions.CELL_INDEX_QTY].Controls[0].ForeColor = Color.Empty; } else { row.Cells[SLExtensions.CELL_INDEX_QTY].Controls[0].Text = "0"; row.Cells[SLExtensions.CELL_INDEX_QTY].Controls[0].ForeColor = Color.Red; if (row.VisibleIndex == gpItems.SelectedVisibleIndex) { currentItemInfo1.Qty = 0; } } } if (isFirstParse || (value.Properties & PBItemProperties.Price) == PBItemProperties.Price) { var nPrice = TypeHelper.ToInt64(value.UtSprc); var oPrice = TypeHelper.ToInt64(curItemData.UtSprc); if (nPrice != oPrice && oPrice > 0) { curItemData.FgUtSprcChanged = true; if (row.VisibleIndex == gpItems.SelectedVisibleIndex) { currentItemInfo1.NmClass = "&" + currentItemInfo1.NmClass; } } row.Cells[SLExtensions.CELL_INDEX_PRICE].Controls[0].Text = nPrice.MoneyToText(); if (row.VisibleIndex == gpItems.SelectedVisibleIndex) { currentItemInfo1.Price = nPrice; } } //curItemData.Merge(value); PBItemData copyItem = null; if (setNull) { copyItem = value; gpItems.SetRowData(row, value); } else { copyItem = curItemData.Copy(); copyItem.Merge(value); gpItems.SetRowData(row, copyItem); } string amtText = copyItem.AmItem.MoneyToText(); row.Cells[SLExtensions.CELL_INDEX_AMT].Controls[0].Text = string.Format("{0}{1}", StateRefund && !string.IsNullOrEmpty(amtText) ? "-" : string.Empty, amtText); }