private void InitializeDefaultValue() { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO default_StoreLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN020.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN020.SYS_KEY.STORE_LOC.ToString()); m_strDefaultLocation = default_StoreLoc.CHAR_DATA.NVL("MAT'"); }
private void InitialScreen() { InitialSpread(); InitialComboBox(); InitialFormat(); dmcShip.AddControl(chkCancelInvoice); dmcShip.AddControl(lblTransactionNo); dmcShip.AddControl(txtDeliveryNo); dmcShip.AddControl(cboCustomerCode); dmcShip.AddControl(txtFullAddress); dmcShip.AddControl(txtInvoiceNo); dmcShip.AddControl(dtInvoiceDate); dmcShip.AddControl(cboTermOfPayment); dmcShip.AddControl(dtPaymentDueDate); dmcShip.AddControl(txtReferTemNo); dmcShip.AddControl(txtRemark); dmcShip.AddControl(txtSubTotal); dmcShip.AddControl(txtVat); dmcShip.AddControl(txtVatTotal); dmcShip.AddControl(txtTotal); CtrlUtil.EnabledControl(false, lblTransactionNo, txtTotal, txtSubTotal); txtDeliveryNo.KeyPress += CtrlUtil.SetNextControl; cboCustomerCode.KeyPress += CtrlUtil.SetNextControl; txtInvoiceNo.KeyPress += CtrlUtil.SetNextControl; dtInvoiceDate.KeyPress += CtrlUtil.SetNextControl; cboTermOfPayment.KeyPress += CtrlUtil.SetNextControl; dtPaymentDueDate.KeyPress += CtrlUtil.SetNextControl; txtReferTemNo.KeyPress += CtrlUtil.SetNextControl; txtRemark.KeyPress += CtrlUtil.SetNextControl; //ClearAllControl(); if (m_Mode == Common.eScreenMode.ADD) { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN350.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN350.SYS_KEY.DEFAULT_DATE.ToString(); dtInvoiceDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); } if (m_Mode != Common.eScreenMode.ADD) { dmcShip.LoadData(m_uidm); LoadShipList(); } CheckCurrentInvPeriod(); //m_keyboardSpread = new KeyboardSpread(fpCustomerOrder); //m_keyboardSpread.RowAdding += m_keyboardSpread_RowAdding; //m_keyboardSpread.RowAdded += m_keyboardSpread_RowAdded; //m_keyboardSpread.RowRemoved += m_keyboardSpread_RowRemoved; //if (m_Mode != Common.eScreenMode.VIEW) //{ // m_keyboardSpread.StartBind(); //} }
private void InitialData() { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.DEFAULT_DATE.ToString(); dtWorkResultDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); if (m_screenMode == eScreenMode.ADD) { SysConfigDTO defaultSourceLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.SOURCE_LOC.ToString()); SysConfigDTO defaultDescLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.DEST_LOC.ToString()); UnPackingEntryUIDM model = new UnPackingEntryUIDM(); shtView.DataSource = model.DATA_VIEW; shtView.OperationMode = OperationMode.Normal; } }
public ErrorItem CheckOnhandQty_AfterTR(Database db, EVOFramework.Windows.Forms.IControlIdentify owner, NZString ItemCD, NZString LocationCD, NZString LotNo) { // FIRST CHECK FOR LOCATION IF IT ALLOW NEGATIVE STOCK DealingBIZ bizLoc = new DealingBIZ(); DealingDTO dtoLoc = bizLoc.LoadLocation(LocationCD); if (!dtoLoc.ALLOW_NEGATIVE.IsNull && dtoLoc.ALLOW_NEGATIVE.StrongValue == DataDefine.Convert2ClassCode(DataDefine.eALLOW_NEGATIVE.Yes)) { // IF THE LOCATION IS ALLOW FOR NEGATIVE THEN NOT CHECK ONHAND return(null); } InventoryBIZ biz = new InventoryBIZ(); ActualOnhandViewDTO dto = biz.LoadActualInventoryOnHand(db, ItemCD, LocationCD, LotNo); SysConfigBIZ bizConfig = new SysConfigBIZ(); SysConfigDTO dtoMinusQty = bizConfig.LoadByPK(DataDefine.eSYSTEM_CONFIG.LOCATION.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.LOCATION.SYS_KEY.MINUS_QTY.ToString()); decimal decMinusQty = 0; decimal.TryParse(dtoMinusQty.CHAR_DATA.StrongValue, out decMinusQty); if (dto.ONHAND_QTY < decMinusQty) { return(new ErrorItem(owner, TKPMessages.eValidate.VLM0063.ToString(), new[] { ItemCD, LocationCD })); } return(null); }
private void ClearAllControlExceptDefault() { CtrlUtil.ClearControlData(txtDeliveryNo, cboCustomerCode, txtInvoiceNo, dtInvoiceDate, cboTermOfPayment, dtPaymentDueDate, txtSubTotal, txtVat, txtVatTotal, txtTotal); CtrlUtil.ClearControlData(txtRemark, cboCustomerCode); // Set Default Date SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN350.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN350.SYS_KEY.DEFAULT_DATE.ToString(); dtInvoiceDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN350.SYS_KEY.DEFAULT_VAT.ToString(); txtVat.Decimal = decimal.Parse(sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN350.SYS_GROUP_ID, "DEFAULT_VAT".ToNZString()).CHAR_DATA); shtCustomerOrder.Rows.Count = 0; if (shtCustomerOrder.DataSource != null) { DataTable dt = shtCustomerOrder.DataSource as DataTable; dt.Rows.Clear(); } //m_SelectedDataRow = new SelectedDataRow(); }
internal SystemConfigurationUIDM LoadSysConfig() { SystemConfigurationUIDM model = new SystemConfigurationUIDM(); SysConfigBIZ biz = new SysConfigBIZ(); List <SysConfigDTO> listConfig = biz.LoadData(); model.DATA_VIEW = DTOUtility.ConvertListToDataTable <SysConfigDTO>(listConfig); return(model); }
private void InitializeDefaultValue() { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO default_StoreLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN100.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN100.SYS_KEY.FROM_LOC.ToString()); InvoiceController ctrl = new InvoiceController(); InvoiceEntryUIDM uidm = ctrl.CreateUIDMForAddMode(); DataTable dt = uidm.DATA_VIEW; shtCustomerOrder.DataSource = dt; shtCustomerOrder.RowCount = 0; }
private void InitialDefaultValue() { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argDateFrom = new SysConfigDTO(); argDateFrom.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN102.SYS_GROUP_ID; argDateFrom.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN102.SYS_KEY.DEFAULT_DATE_FROM.ToString(); dtPeriodBegin.Value = sysBiz.GetDefaultDateForScreen_No_Fix(argDateFrom); SysConfigDTO argDateTo = new SysConfigDTO(); argDateTo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN102.SYS_GROUP_ID; argDateTo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN102.SYS_KEY.DEFAULT_DATE_TO.ToString(); dtPeriodEnd.Value = sysBiz.GetDefaultDateForScreen_No_Fix(argDateTo); }
/// <summary> /// Load new consumption list by input: item code, order location and qty. /// </summary> /// <param name="itemCode"></param> /// <param name="orderLoc"></param> /// <param name="qty"></param> private void LoadData() { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO defaultSourceLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.SOURCE_LOC.ToString()); DataTable model = m_controller.LoadPackingList(txtItemCode.Text.ToNZString(), defaultSourceLoc.CHAR_DATA, txtLotNo.Text.ToNZString()); shtView.DataSource = model; for (int i = 0; i < shtView.RowCount; i++) { shtView.Cells[i, (int)eColView.CHECKBOX].Value = false; } CalculateTotalQty(); }
private void SetScreenMode(eScreenMode mode) { switch (mode) { case eScreenMode.VIEW: CtrlUtil.EnabledControl(false, txtAdjustWeight, txtAdjustQty, txtItemDesc); CtrlUtil.EnabledControl(false, dtAdjustDate, rdoIncrease, rdoDecrease, txtMasterNo, txtItemDesc , btnItemCode, cboStoredLoc, txtLotNo, btnLotNo, txtPackNo, txtFGNo, txtCustomerLotNo , txtRemark, cboReasonCode); CtrlUtil.EnabledControl(false, txtCustomerName, txtOnhandQty); tsbSaveAndNew.Enabled = false; tsbSaveAndClose.Enabled = false; break; case eScreenMode.ADD: CtrlUtil.EnabledControl(true, dtAdjustDate, rdoIncrease, rdoDecrease, txtMasterNo, txtItemDesc , btnItemCode, cboStoredLoc, txtAdjustWeight, txtAdjustQty , txtRemark, cboReasonCode); CtrlUtil.EnabledControl(false, txtLotNo, btnLotNo, txtPackNo, txtItemDesc, txtFGNo, txtCustomerLotNo); CtrlUtil.EnabledControl(false, txtCustomerName, txtOnhandQty); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN120.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN120.SYS_KEY.DEFAULT_DATE.ToString(); dtAdjustDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); break; case eScreenMode.EDIT: CtrlUtil.EnabledControl(true, txtAdjustWeight, txtAdjustQty, txtRemark, cboReasonCode); CtrlUtil.EnabledControl(false, dtAdjustDate, rdoIncrease, rdoDecrease, txtMasterNo, txtItemDesc, btnItemCode, cboStoredLoc, txtItemDesc, txtOnhandQty); CtrlUtil.EnabledControl(false, txtPackNo, txtFGNo, txtLotNo, btnLotNo, txtCustomerLotNo); CtrlUtil.EnabledControl(false, txtCustomerName, txtOnhandQty); break; } m_screenMode = mode; }
private void InitializeScreenMode() { if (m_editTransactionID == null) { SetScreenMode(eScreenMode.ADD); AdjustmentEntryUIDM model = new AdjustmentEntryUIDM(); model.TransactionID.Value = ""; dmcAdjust.LoadData(model); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN120.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN120.SYS_KEY.DEFAULT_DATE.ToString(); dtAdjustDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); } else { bool bCanEdit = m_transactionValidator.TransactionCanEditOrDelete(m_editTransactionID); if (bCanEdit) { SetScreenMode(eScreenMode.EDIT); } else { SetScreenMode(eScreenMode.VIEW); } AdjustmentEntryUIDM model = m_controller.LoadData(m_editTransactionID); //if (model.AdjustType.StrongValue == DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out)) { // model.OnHandQty.Value = model.OnHandQty.StrongValue + model.AdjustQty.StrongValue; //} dmcAdjust.LoadData(model); LoadInventoryUM(model.ItemCode); UpdateOnhandQtyText(); } }
private void INV010_InventoryOnHandInquiry_Load(object sender, EventArgs e) { InitialScreen(); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO dtoWarningRecords = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.INV060.SYS_GROUP_ID , (NZString)DataDefine.eSYSTEM_CONFIG.INV060.SYS_KEY.WARNING_RECORDS.ToString()); SysConfigDTO dtoErrorRecords = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.INV060.SYS_GROUP_ID , (NZString)DataDefine.eSYSTEM_CONFIG.INV060.SYS_KEY.ERROR_RECORDS.ToString()); if (dtoWarningRecords != null && dtoWarningRecords.CHAR_DATA.NVL("") != "") { decimal iRecords = 0; if (decimal.TryParse(dtoWarningRecords.CHAR_DATA.NVL("10000"), out iRecords)) { m_iWarningRecords = (int)iRecords; } } if (dtoErrorRecords != null && dtoErrorRecords.CHAR_DATA.NVL("") != "") { decimal iRecords = 0; if (decimal.TryParse(dtoErrorRecords.CHAR_DATA.NVL("60000"), out iRecords)) { m_iErrorRecords = (int)iRecords; } } this.dtPeriodBegin.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); this.dtPeriodEnd.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddMonths(1).AddDays(-1); QueryData(); }
public void SaveNewPacking(PackingEntryUIDM data, int NumberOfBox) { try { #region Validate ItemValidator itemValidator = new ItemValidator(); ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(data.MASTER_NO)); BusinessException businessException = itemValidator.CheckItemNotExist(data.MASTER_NO); if (businessException != null) { ValidateException.ThrowErrorItem(businessException.Error); } #endregion InventoryBIZ biz = new InventoryBIZ(); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO defaultSourceLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN320.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN320.SYS_KEY.SOURCE_LOC.ToString()); SysConfigDTO defaultDestinationLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN320.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN320.SYS_KEY.DEST_LOC.ToString()); InventoryTransactionDTO Source = new InventoryTransactionDTO(); List <InventoryTransactionDTO> DestinationList = new List <InventoryTransactionDTO>(); #region Destination foreach (DataRow dr in data.DATA_VIEW.Rows) { InventoryTransactionDTO dto = new InventoryTransactionDTO(); dto.CRT_BY = Common.CurrentUserInfomation.UserCD; //dto.CRT_DATE dto.CRT_MACHINE = Common.CurrentUserInfomation.Machine; dto.UPD_BY = Common.CurrentUserInfomation.UserCD; //dto.UPD_DATE dto.UPD_MACHINE = Common.CurrentUserInfomation.Machine; //dto.TRANS_ID dto.ITEM_CD = data.MASTER_NO; dto.LOC_CD = defaultDestinationLoc.CHAR_DATA; dto.LOT_NO = new NZString(null, dr[(int)PackingEntryUIDM.eColView.LOT_NO]); dto.FG_NO = data.FG_NO; dto.PACK_NO = data.PACK_NO; dto.EXTERNAL_LOT_NO = new NZString(null, dr[(int)PackingEntryUIDM.eColView.EXTERNAL_LOT_NO]); dto.TRANS_DATE = data.PACKING_DATE; dto.TRANS_CLS = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Packing).ToNZString(); dto.IN_OUT_CLS = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.In).ToNZString(); dto.FG_NO = data.FG_NO; if (dr[(int)PackingEntryUIDM.eColView.QTY] == null || dr[(int)PackingEntryUIDM.eColView.QTY] == (object)DBNull.Value) { dto.QTY = new NZDecimal(null, 0); } else { dto.QTY = new NZDecimal(null, dr[(int)PackingEntryUIDM.eColView.QTY]); } //dto.WEIGHT //dto.OBJ_ITEM_CD //dto.OBJ_ORDER_QTY //dto.REF_NO //dto.REF_SLIP_NO //dto.REF_SLIP_CLS //dto.OTHER_DL_NO //dto.SLIP_NO dto.REMARK = data.REMARK; //dto.DEALING_NO //dto.PRICE //dto.AMOUNT //dto.FOR_CUSTOMER //dto.FOR_MACHINE dto.SHIFT_CLS = data.SHIFT_CLS; //dto.REF_SLIP_NO2 //dto.NG_QTY //dto.NG_WEIGHT //dto.TRAN_SUB_CLS = dto.SCREEN_TYPE = DataDefine.ScreenType.PackingEntry.ToNZString(); //dto.GROUP_TRANS_ID //dto.RESERVE_QTY //dto.RETURN_QTY //dto.NG_REASON dto.EFFECT_STOCK = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.In); //dto.LOT_REMARK dto.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE; //dto.CURRENCY //dto.REWORK_FLAG dto.OLD_DATA = new NZInt(null, 0); //dto.TIME_STAMP DestinationList.Add(dto); } #endregion #region Pack Source.CRT_BY = Common.CurrentUserInfomation.UserCD; //Source.CRT_DATE Source.CRT_MACHINE = Common.CurrentUserInfomation.Machine; Source.UPD_BY = Common.CurrentUserInfomation.UserCD; //Source.UPD_DATE Source.UPD_MACHINE = Common.CurrentUserInfomation.Machine; //Source.TRANS_ID Source.ITEM_CD = data.MASTER_NO; Source.LOC_CD = defaultSourceLoc.CHAR_DATA; //Source.LOT_NO Source.FG_NO = data.FG_NO; Source.PACK_NO = data.PACK_NO; //Source.EXTERNAL_LOT_NO Source.TRANS_DATE = data.PACKING_DATE; Source.TRANS_CLS = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Packing_Consumption).ToNZString(); Source.IN_OUT_CLS = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out).ToNZString(); Source.QTY = data.TOTAL_QTY; //Source.WEIGHT //Source.OBJ_ITEM_CD //Source.OBJ_ORDER_QTY //Source.REF_NO //Source.REF_SLIP_NO //Source.REF_SLIP_CLS //Source.OTHER_DL_NO //Source.SLIP_NO Source.REMARK = data.REMARK; //Source.DEALING_NO //Source.PRICE //Source.AMOUNT //Source.FOR_CUSTOMER //Source.FOR_MACHINE Source.SHIFT_CLS = data.SHIFT_CLS; //Source.REF_SLIP_NO2 //Source.NG_QTY //Source.NG_WEIGHT //Source.TRAN_SUB_CLS = Source.SCREEN_TYPE = DataDefine.ScreenType.PackingEntry.ToNZString(); //Source.GROUP_TRANS_ID //Source.RESERVE_QTY //Source.RETURN_QTY //Source.NG_REASON Source.EFFECT_STOCK = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.Out); //Source.LOT_REMARK Source.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE; //Source.CURRENCY //Source.REWORK_FLAG Source.OLD_DATA = new NZInt(null, 0); //Source.TIME_STAMP #endregion biz.AddPacking(DestinationList, Source, NumberOfBox); } catch (Exception) { throw; } }
public void SaveNewUnPacking(UnPackingEntryUIDM data) { try { #region Validate ItemValidator itemValidator = new ItemValidator(); ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(data.ITEM_CD)); BusinessException businessException = itemValidator.CheckItemNotExist(data.ITEM_CD); if (businessException != null) { ValidateException.ThrowErrorItem(businessException.Error); } #endregion InventoryBIZ biz = new InventoryBIZ(); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO defaultSourceLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.SOURCE_LOC.ToString()); SysConfigDTO defaultDestinationLoc = sysBiz.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN330.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN330.SYS_KEY.DEST_LOC.ToString()); List <InventoryTransactionDTO> SourceList = new List <InventoryTransactionDTO>(); InventoryTransactionDTO Destination = new InventoryTransactionDTO(); #region source data.TOTAL_QTY = new NZDecimal(null, 0); foreach (DataRow dr in data.DATA_VIEW.Rows) { InventoryTransactionDTO dto = new InventoryTransactionDTO(); dto.CRT_BY = Common.CurrentUserInfomation.UserCD; dto.CRT_MACHINE = Common.CurrentUserInfomation.Machine; dto.UPD_BY = Common.CurrentUserInfomation.UserCD; dto.UPD_MACHINE = Common.CurrentUserInfomation.Machine; dto.ITEM_CD = data.ITEM_CD; dto.LOC_CD = defaultSourceLoc.CHAR_DATA; dto.PACK_NO = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.PACK_NO]); dto.FG_NO = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.FG_NO]); dto.LOT_NO = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.LOT_NO]); dto.EXTERNAL_LOT_NO = new NZString(null, dr[(int)UnPackingEntryUIDM.eColView.EXTERNAL_LOT_NO]); dto.TRANS_DATE = data.UNPACKING_DATE; dto.TRANS_CLS = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Unpack_Consumption).ToNZString(); dto.IN_OUT_CLS = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out).ToNZString(); if (dr[(int)UnPackingEntryUIDM.eColView.ONHAND_QTY] == null || dr[(int)UnPackingEntryUIDM.eColView.ONHAND_QTY] == (object)DBNull.Value) { dto.QTY = new NZDecimal(null, 0); } else { dto.QTY = new NZDecimal(null, dr[(int)UnPackingEntryUIDM.eColView.ONHAND_QTY]); data.TOTAL_QTY += dto.QTY; } dto.REMARK = data.REMARK; dto.SHIFT_CLS = data.SHIFT_CLS; dto.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE; dto.SCREEN_TYPE = DataDefine.ScreenType.UnPackingEntry.ToNZString(); dto.EFFECT_STOCK = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.Out); dto.OLD_DATA = new NZInt(null, 0); //dto.TIME_STAMP SourceList.Add(dto); } #endregion #region Destination (Unpack) Destination.CRT_BY = Common.CurrentUserInfomation.UserCD; Destination.CRT_MACHINE = Common.CurrentUserInfomation.Machine; Destination.UPD_BY = Common.CurrentUserInfomation.UserCD; Destination.UPD_MACHINE = Common.CurrentUserInfomation.Machine; Destination.ITEM_CD = data.ITEM_CD; Destination.LOC_CD = defaultDestinationLoc.CHAR_DATA; Destination.TRANS_DATE = data.UNPACKING_DATE; Destination.TRANS_CLS = DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Unpack).ToNZString(); Destination.IN_OUT_CLS = DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.In).ToNZString(); Destination.QTY = data.TOTAL_QTY; Destination.REMARK = data.REMARK; Destination.SHIFT_CLS = data.SHIFT_CLS; Destination.SCREEN_TYPE = DataDefine.ScreenType.UnPackingEntry.ToNZString(); Destination.EFFECT_STOCK = new NZInt(null, (int)DataDefine.eEFFECT_STOCK.In); Destination.PERSON_IN_CHARGE = data.PERSON_IN_CHARGE; Destination.OLD_DATA = new NZInt(null, 0); #endregion biz.AddUnPacking(SourceList, Destination); } catch (Exception) { throw; } }
private void InitialScreen() { cboProcess.Format += Common.ComboBox_Format; rdoReportCheckingList.KeyPress += CtrlUtil.SetNextControl; rdoReportCountingResult.KeyPress += CtrlUtil.SetNextControl; //txtLocation.KeyPress += CtrlUtil.SetNextControl; cboProcess.KeyPress += CtrlUtil.SetNextControl; txtMasterNo.KeyPress += CtrlUtil.SetNextControl; cboItemType.KeyPress += CtrlUtil.SetNextControl; cboItemClassMinor04.KeyPress += CtrlUtil.SetNextControl; chkIncomplete.KeyPress += CtrlUtil.SetNextControl; chkDiff.KeyPress += CtrlUtil.SetNextControl; chkNoMaster.KeyPress += CtrlUtil.SetNextControl; LookupDataBIZ bizLookup = new LookupDataBIZ(); LookupData lookupItemType = bizLookup.LoadLookupClassType(new NZString(null, "ITEM_CLS")); cboItemType.LoadLookupData(lookupItemType); cboItemType.SelectedIndex = -1; //------------ Location --------------------// NZString[] locationtype = new NZString[1]; locationtype[0] = DataDefine.Convert2ClassCode(DataDefine.eLOCATION_CLS.Production).ToNZString(); LookupData dataProductionProcess = bizLookup.LoadLookupLocation(locationtype); cboProcess.LoadLookupData(dataProductionProcess); cboProcess.SelectedIndex = -1; //------------ Location --------------------// if (m_strPartSubType != null) { this.cboItemType.SelectedValue = m_strPartType; } if (m_strPartSubType != null) { this.cboItemClassMinor04.SelectedValue = m_strPartSubType; } dtStockTakingDate.Format = Common.CurrentUserInfomation.DateFormatString; CtrlUtil.EnabledControl(false, dtStockTakingDate, txtPreProcessBy, txtRemark); LoadCurrentStockTakingData(); if (btnPrintTag.Visible == false) { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.STK020.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.STK020.SYS_KEY.DEV_VERSION.ToString(); SysConfigDTO data = sysBiz.LoadByPK(argScreenInfo.SYS_GROUP_ID, argScreenInfo.SYS_KEY); if (data != null && "1".Equals(data.CHAR_DATA.NVL("").Trim())) { btnPrintTag.Visible = true; } } }
internal int UpdateConfig(SysConfigDTO data) { SysConfigBIZ biz = new SysConfigBIZ(); return(biz.UpdateData(data)); }
private void InitialScreen() { CheckCurrentInvPeriod(); InitialComboBox(); CommonLib.CtrlUtil.EnabledControl(false, txtTransactionID, txtOnHandQty, txtItemDesc, cboInventoryUM); dtIssueDate.Format = CommonLib.Common.CurrentUserInfomation.DateFormatString; //dtIssueDate.KeyPress += CommonLib.CtrlUtil.SetNextControl; cboFromLoc.KeyPress += CommonLib.CtrlUtil.SetNextControl; cboToLoc.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtLotNo.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtIssueQty.KeyPress += CommonLib.CtrlUtil.SetNextControl; //txtRemark.KeyPress += CommonLib.CtrlUtil.SetNextControl; cboSubType.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtRefDocNo.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtJobOrderNo.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtForMachine.KeyPress += CommonLib.CtrlUtil.SetNextControl; cboForCustomer.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtItemCode.KeyPress += CommonLib.CtrlUtil.SetNextControl; //txtLotNo.KeyDown += CommonLib.CtrlUtil.SetHelpButton; dmcIssueByItem.AddControl(txtTransactionID); //dmcIssueByItem.AddControl(txtRefTransID); dmcIssueByItem.AddControl(txtItemDesc); dmcIssueByItem.AddControl(txtItemCode); dmcIssueByItem.AddControl(cboToLoc); dmcIssueByItem.AddControl(txtLotNo); dmcIssueByItem.AddControl(cboFromLoc); dmcIssueByItem.AddControl(txtOnHandQty); dmcIssueByItem.AddControl(txtIssueQty); dmcIssueByItem.AddControl(txtRemark); // dmcIssueByItem.AddControl(rdoIssueType_Issue); // dmcIssueByItem.AddControl(rdoIssueType_IssueReturn); dmcIssueByItem.AddControl(dtIssueDate); dmcIssueByItem.AddControl(cboSubType); dmcIssueByItem.AddControl(txtRefDocNo); dmcIssueByItem.AddControl(txtJobOrderNo); dmcIssueByItem.AddControl(txtForMachine); dmcIssueByItem.AddControl(cboForCustomer); ClearAll(); // rdoIssueType_Issue.Checked = true; if (m_Mode == eSaveMode.ADD) { SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN040.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN040.SYS_KEY.DEFAULT_DATE.ToString(); dtIssueDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); } else if (m_Mode == eSaveMode.UPDATE) { LoadInventoryUM(m_uidm.ITEM_CD); dmcIssueByItem.LoadData(m_uidm); LoadLotNo(m_uidm.ITEM_CD, m_uidm.FROM_LOC_CD); //txtLotNo.SelectedValue = m_uidm.LOT_NO.StrongValue; txtOnHandQty.Text = CommonLib.CtrlUtil.GetCompleteNumberFormatValue(txtOnHandQty.MaxDecimalPlaces, (NZDecimal)(m_uidm.QTY.StrongValue + GetOnHandQty().NVL(0))); txtIssueQty.Tag = txtIssueQty.Double; CommonLib.CtrlUtil.EnabledControl(false, txtItemCode, btnItemCode, cboFromLoc, cboToLoc, txtLotNo //, rdoIssueType_IssueReturn, rdoIssueType_Issue , dtIssueDate, txtRemark, btnLotNo); m_REF_NO = m_uidm.REF_NO.StrongValue; txtIssueQty.Focus(); txtIssueQty.Select(); txtIssueQty.SelectAll(); } else if (m_Mode == eSaveMode.VIEW) { dmcIssueByItem.LoadData(m_uidm); LoadInventoryUM(m_uidm.ITEM_CD); LoadLotNo(m_uidm.ITEM_CD, m_uidm.FROM_LOC_CD); //txtLotNo.SelectedValue = m_uidm.LOT_NO.StrongValue; txtOnHandQty.Text = CommonLib.CtrlUtil.GetCompleteNumberFormatValue(txtOnHandQty.MaxDecimalPlaces, (NZDecimal)(m_uidm.QTY.StrongValue + GetOnHandQty().StrongValue)); txtIssueQty.Tag = txtIssueQty.Double; CommonLib.CtrlUtil.EnabledControl(false, txtItemCode, btnItemCode, cboFromLoc, cboToLoc, txtLotNo //, rdoIssueType_IssueReturn, rdoIssueType_Issue , dtIssueDate, txtRemark, txtIssueQty); CommonLib.CtrlUtil.EnabledControl(false, tsbSaveAndClose, tsbSaveAndNew); //m_REF_NO = m_uidm.REF_NO.StrongValue; //txtIssueQty.SelectAll(); } }
private void InitialScreen() { CheckCurrentInvPeriod(); InitialSpread(); InitialComboBox(); CtrlUtil.EnabledControl(false, txtIssueNo); dmcIssue.AddControl(txtIssueNo); dmcIssue.AddControl(dtIssueDate); dmcIssue.AddControl(cboToLoc); dmcIssue.AddControl(cboFromLoc); dmcIssue.AddControl(txtRemark); dmcIssue.AddControl(cboSubType); dmcIssue.AddControl(txtRefDocNo); dmcIssue.AddControl(txtJobOrderNo); dmcIssue.AddControl(cboForCustomer); dtIssueDate.Format = Common.CurrentUserInfomation.DateFormatString; cboFromLoc.KeyPress += CtrlUtil.SetNextControl; cboToLoc.KeyPress += CtrlUtil.SetNextControl; cboSubType.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtRefDocNo.KeyPress += CommonLib.CtrlUtil.SetNextControl; txtJobOrderNo.KeyPress += CommonLib.CtrlUtil.SetNextControl; //txtForMachine.KeyPress += CommonLib.CtrlUtil.SetNextControl; cboForCustomer.KeyPress += CommonLib.CtrlUtil.SetNextControl; dtIssueDate.KeyPress += CommonLib.CtrlUtil.SetNextControl; ClearAllControl(); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN080.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN080.SYS_KEY.DEFAULT_DATE.ToString(); dtIssueDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); if (m_Mode == eSaveMode.UPDATE) { if (m_uidm != null) { dmcIssue.LoadData(m_uidm); NZString TranId = (NZString)Convert.ToString(m_uidm.TRANS_ID.Value); GetShipNo(TranId); } CtrlUtil.EnabledControl(false , cboFromLoc, cboToLoc , dtIssueDate); } else if (m_Mode == eSaveMode.VIEW) { if (m_uidm != null) { dmcIssue.LoadData(m_uidm); LoadIssueListForEdit(m_uidm.SLIP_NO); } CtrlUtil.EnabledControl(true , cboFromLoc, cboToLoc, txtRemark , dtIssueDate); CtrlUtil.EnabledControl(false, tsbSaveAndClose, tsbSaveAndNew); } }
private void TRN020_Load(object sender, EventArgs e) { InitializeScreen(); if (m_editReceiveNo == null) { SetScreenMode(Common.eScreenMode.ADD); ClearAll(); m_model = new ReceivingEntryUIDM(); dmcReceive.LoadData(m_model); SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN020.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN020.SYS_KEY.DEFAULT_DATE.ToString(); dtReceiveDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); shtView.RowCount = 0; shtView.DataSource = m_model.DATA_VIEW; try { if (rdoReceive.Checked) { cboStoredLoc.SelectedValue = m_strDefaultLocation; } } catch { } } else { InventoryBIZ bizInventory = new InventoryBIZ(); ClearAll(); m_model = m_controller.LoadData(m_editReceiveNo); List <InventoryTransactionViewDTO> dtos = DTOUtility.ConvertDataTableToList <InventoryTransactionViewDTO>(m_model.DATA_VIEW); // bizInventory.LoadTransactionViewByReceiveNo(m_editReceiveNo); if (dtos.Count > 0) { bool bCanEdit = m_transactionValidator.DateIsInCurrentPeriod(dtos[0].TRANS_DATE.StrongValue) == null; if (bCanEdit) { SetScreenMode(Common.eScreenMode.EDIT); } else { SetScreenMode(Common.eScreenMode.VIEW); } } else { SetScreenMode(Common.eScreenMode.VIEW); } dmcReceive.LoadData(m_model); shtView.RowCount = 0; shtView.DataSource = m_model.DATA_VIEW; //int row = shtView.Rows.Count; //// set amount value //if (row > 0) //{ // for (int i = 0; i < row; i++) // { // shtView.Cells[i, (int)eColView.AMOUNT].Value = Convert.ToDouble(shtView.Cells[i, (int)eColView.ORDER_QTY].Value) // * Convert.ToDouble(shtView.Cells[i, (int)eColView.PRICE].Value); // } //} } CheckCurrentInvPeriod(); }
public override void OnSaveAndNew() { try { label7.Focus(); this.fpCustomerOrder.StopCellEditing(); //if (m_bRowHasModified) //{ // ถ้า Row กำลังแก้ไขอยู่ // if (!ValidateRowSpread(shtCustomerOrder.ActiveRowIndex, false)) // { // return; // } //} // ต้องเรียกก่อน Save เสมอ เพื่อ Commit ข้อมูลการแก้ไขล่าสุดบน Grid // ใช้ได้เฉพาะกับ Sheet ที่ผูก DataSource CtrlUtil.SpreadSheetRowEndEdit(shtCustomerOrder, shtCustomerOrder.ActiveRowIndex); RemoveRowUnused(shtCustomerOrder); if (!ValidateMandatory()) { return; } MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(SystemMaintenance.Messages.eConfirm.CFM9001.ToString()).MessageDescription); switch (dr) { case MessageDialogResult.Cancel: return; case MessageDialogResult.No: //Close(); return; case MessageDialogResult.Yes: break; } if (SaveData()) { MessageDialog.ShowInformation(this, "Information", new Message(SystemMaintenance.Messages.eInformation.INF9003.ToString()).MessageDescription); ClearAllControlExceptDefault(); m_Mode = Common.eScreenMode.ADD; lblTransactionNo.Text = ""; SysConfigBIZ sysBiz = new SysConfigBIZ(); SysConfigDTO argScreenInfo = new SysConfigDTO(); argScreenInfo.SYS_GROUP_ID = DataDefine.eSYSTEM_CONFIG.TRN100.SYS_GROUP_ID; argScreenInfo.SYS_KEY = (NZString)DataDefine.eSYSTEM_CONFIG.TRN100.SYS_KEY.DEFAULT_DATE.ToString(); dtInvoiceDate.Value = sysBiz.GetDefaultDateForScreen(argScreenInfo); CtrlUtil.EnabledControl(true, txtRemark, dtInvoiceDate, cboCustomerCode); dtInvoiceDate.Focus(); dtInvoiceDate.Select(); } } catch (ValidateException err) { for (int i = 0; i < err.ErrorResults.Count; i++) { MessageDialog.ShowBusiness(this, err.ErrorResults[i].Message); err.ErrorResults[i].FocusOnControl(); } } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
public bool SaveData(MultiWorkResultEntryUIDM model) { ItemBIZ bizItem = new ItemBIZ(); ClassListBIZ bizClassList = new ClassListBIZ(); InventoryBIZ biz = new InventoryBIZ(); IssueEntryValidator valLot = new IssueEntryValidator(); #region Validate data MultiWorkResultEntryValidator workResultEntryValidator = new MultiWorkResultEntryValidator(); ItemValidator itemValidator = new ItemValidator(); DealingValidator locationValidator = new DealingValidator(); CommonBizValidator commonVal = new CommonBizValidator(); ValidateException.ThrowErrorItem(workResultEntryValidator.CheckWorkResultDate(model.WorkResultDate)); ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(model.ItemCode)); ValidateException.ThrowErrorItem(itemValidator.CheckEmptyItemCode(model.ChildItemCode)); ValidateException.ThrowErrorItem(workResultEntryValidator.CheckEmptyShiftType(model.ShiftClass)); BusinessException itemFound = itemValidator.CheckItemNotExist(model.ItemCode); if (itemFound != null) { ValidateException.ThrowErrorItem(itemFound.Error); } ValidateException.ThrowErrorItem(locationValidator.CheckEmptyLocationCode(model.OrderLoc)); ValidateException.ThrowErrorItem(locationValidator.CheckNotExistsLocationCode(model.OrderLoc)); ValidateException.ThrowErrorItem(locationValidator.CheckEmptyLocationCode(model.StoredLoc)); ValidateException.ThrowErrorItem(locationValidator.CheckNotExistsLocationCode(model.StoredLoc)); #endregion DataTable dtData = null; if (model.DataView == null) { MultiWorkResultEntryViewDTO dto = new MultiWorkResultEntryViewDTO(); dto.CreateDataTableSchema(out dtData); } else { dtData = model.DataView; } DataTable dtAdd = dtData.GetChanges(DataRowState.Added); DataTable dtUpdate = dtData.GetChanges(DataRowState.Modified); DataTable dtDelete = dtData.GetChanges(DataRowState.Deleted); DataTable dtUnChanged = dtData.GetChanges(DataRowState.Unchanged); List <InventoryTransactionDTO> listAdd = new List <InventoryTransactionDTO>(); List <InventoryTransactionDTO> listUpdate = new List <InventoryTransactionDTO>(); List <InventoryTransactionDTO> listDelete = new List <InventoryTransactionDTO>(); List <MultiWorkResultEntryViewDTO> listViewAdd = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtAdd); List <MultiWorkResultEntryViewDTO> listViewUpdate = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtUpdate); List <MultiWorkResultEntryViewDTO> listViewDelete = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtDelete); List <MultiWorkResultEntryViewDTO> listUnchanged = DTOUtility.ConvertDataTableToList <MultiWorkResultEntryViewDTO>(dtUnChanged); Database db = null; try { db = Common.CurrentDatabase; db.KeepConnection = true; db.BeginTransaction(); NZString runningNo = new NZString(); NZString strWorkResultGroupNo = new NZString(); InventoryTransactionDTO dtoWorkResult = null; InventoryTransactionDTO dtoNGResult = null; InventoryTransactionDTO dtoReserveResult = null; InventoryTransactionDTO dtoConsumption = null; InventoryTransBIZ bizTran = new InventoryTransBIZ(); SysConfigBIZ bizSYS = new SysConfigBIZ(); SysConfigDTO dtoSYS = bizSYS.LoadByPK(DataDefine.eSYSTEM_CONFIG.TRN080.SYS_GROUP_ID, (NZString)DataDefine.eSYSTEM_CONFIG.TRN080.SYS_KEY.NG_LOC_CD.ToString()); //SysConfigDTO dtoSupplyLot = bizSYS.LoadByPK((NZString)"SUPPLY", (NZString)"SUPP_LOT"); NZString strNGLocation = null; if (dtoSYS == null || dtoSYS.CHAR_DATA.IsNull || dtoSYS.CHAR_DATA.StrongValue == "ORDER_LOC") { strNGLocation = model.OrderLoc; } else { strNGLocation = dtoSYS.CHAR_DATA; } RunningNumberBIZ runningNumberBIZ = new RunningNumberBIZ(); //set Work Result Group No ให้กับทุกตัว //ถ้าheader ยังไม่มีก็ genใหม่ //ถ้าheader มีแล้ว ก็ใช้ตัวนั้น if (model.WorkResultGroupNo.IsNull) { strWorkResultGroupNo = runningNumberBIZ.GetCompleteRunningNo((NZString)"WORK_RESULT_GROUP_NO", (NZString)"TB_INV_TRANS_TR"); model.WorkResultGroupNo = strWorkResultGroupNo; } foreach (MultiWorkResultEntryViewDTO dtoAdd in listViewAdd) { runningNo = runningNumberBIZ.GetCompleteRunningNo((NZString)"WORK_RESULT_SLIP_NO", (NZString)"TB_INV_TRANS_TR"); //ถ้าใส่จำนวนใดจำนวนหนึ่งมา ก็จะ save ได้ if (dtoAdd.GOOD_QTY.NVL(0) + dtoAdd.NG_QTY.NVL(0) + dtoAdd.RESERVE_QTY.NVL(0) > 0) { dtoWorkResult = CreateDTOForWorkResult(model, dtoAdd); dtoWorkResult.SLIP_NO = runningNo; listAdd.Add(dtoWorkResult); if (dtoAdd.NG_QTY.NVL(0) > 0) { dtoNGResult = CreateDTOForNGResult(model, dtoAdd, strNGLocation); dtoNGResult.SLIP_NO = runningNo; listAdd.Add(dtoNGResult); } //เฉพาะ work result ที่จะมี reserve ได้ if (DataDefine.eTRAN_SUB_CLS.WR.ToString().Equals(model.TRAN_SUB_CLS)) { if (dtoAdd.RESERVE_QTY.NVL(0) > 0) { dtoReserveResult = CreateDTOForReserveResult(model, dtoAdd); dtoReserveResult.SLIP_NO = runningNo; listAdd.Add(dtoReserveResult); } } dtoConsumption = CreateDTOForConsumption(model, dtoAdd); dtoConsumption.REF_NO = dtoWorkResult.SLIP_NO; listAdd.Add(dtoConsumption); } } foreach (MultiWorkResultEntryViewDTO dtoUnchanged in listUnchanged) { dtoWorkResult = CreateDTOForWorkResult(model, dtoUnchanged); listUpdate.Add(dtoWorkResult); } foreach (MultiWorkResultEntryViewDTO dtoUpdate in listViewUpdate) { dtoWorkResult = CreateDTOForWorkResult(model, dtoUpdate); listUpdate.Add(dtoWorkResult); if (dtoUpdate.NG_QTY.NVL(0) > 0) { dtoNGResult = CreateDTOForNGResult(model, dtoUpdate, strNGLocation); if (dtoNGResult.TRANS_ID.IsNull) { listAdd.Add(dtoNGResult); } else { listUpdate.Add(dtoNGResult); } } //เฉพาะ work result ที่จะมี reserve ได้ if (DataDefine.eTRAN_SUB_CLS.WR.ToString().Equals(model.TRAN_SUB_CLS)) { if (dtoUpdate.RESERVE_QTY.NVL(0) > 0) { dtoReserveResult = CreateDTOForReserveResult(model, dtoUpdate); if (dtoReserveResult.TRANS_ID.IsNull) { listAdd.Add(dtoReserveResult); } else { listUpdate.Add(dtoReserveResult); } } } dtoConsumption = CreateDTOForConsumption(model, dtoUpdate); dtoConsumption.REF_NO = dtoWorkResult.SLIP_NO; //consumption ใช้การ add เพราะ ใช้การ clear แล้ว insert ใหม่ เลยต้อง add consumption ใหม่ตลอด listAdd.Add(dtoConsumption); biz.ClearConsumption(Common.CurrentDatabase, dtoWorkResult); } foreach (MultiWorkResultEntryViewDTO dtoDelete in listViewDelete) { dtoWorkResult = CreateDTOForWorkResult(model, dtoDelete); listDelete.Add(dtoWorkResult); if (dtoDelete.NG_QTY.NVL(0) > 0) { dtoNGResult = CreateDTOForNGResult(model, dtoDelete, strNGLocation); listDelete.Add(dtoNGResult); } //เฉพาะ work result ที่จะมี reserve ได้ if (DataDefine.eTRAN_SUB_CLS.WR.ToString().Equals(model.TRAN_SUB_CLS)) { if (dtoDelete.RESERVE_QTY.NVL(0) > 0) { dtoReserveResult = CreateDTOForReserveResult(model, dtoDelete); listDelete.Add(dtoReserveResult); } } dtoConsumption = CreateDTOForConsumption(model, dtoDelete); listDelete.Add(dtoConsumption); } biz.WorkResultItems(Common.CurrentDatabase, listAdd, listUpdate, listDelete); db.Commit(); } catch (Exception ex) { db.Rollback(); throw ex; } finally { if (db.DBConnectionState == ConnectionState.Open) { db.Close(); } } return(true); }
/// <summary> /// Set Default for each control in screen. /// </summary> /// <param name="hDTO">DTO for set default.</param> private void SetDefault(PurchaseOrderHDTO hDTO) { if (hDTO != null) { // แสดง header PurchaseOrderHDTO hDTOSearch = m_BIZPurchaseOrder.LoadByPK(hDTO); this.lblPoNo.Text = hDTOSearch.PO_NO.ToString(); this.dtmPODate.Value = hDTOSearch.PO_DATE; this.cboSupplierCode.SelectedValue = hDTOSearch.SUPPLIER_CD; string strDeliveryTo = Convert.ToString((new SysConfigBIZ().LoadByPK((NZString)"DELIVERY_TO", (NZString)"PUR010")).CHAR_DATA.Value); if (hDTOSearch.DELIVERY_TO.Value.Equals(strDeliveryTo)) { chkOurFactory.Checked = true; chkOurFactory_CheckedChanged(this, null); } else { this.cboDelivery.SelectedValue = hDTOSearch.DELIVERY_TO; } this.cboTermOfPayment.SelectedValue = hDTOSearch.TERM_OF_PAYMENT; m_bIsActived = hDTO.IS_ACTIVE.StrongValue; lblPoStatus.Text = m_bIsActived ? "Active" : "Cancel"; this.txtVatRate.Text = hDTOSearch.VAT_RATE.ToString(); this.cboCurrency.SelectedValue = hDTOSearch.CURRENCY; this.txtRemark.Text = hDTOSearch.REMARK; m_HDTOPurchaseOrder = hDTOSearch; // แสดง detail shtView.RowCount = 0; List <PurchaseOrderDDTO> dDTOPurchaseOrderList = m_BIZPurchaseOrder.LoadDetailByPO(m_HDTOPurchaseOrder); shtView.DataSource = DTOUtility.ConvertListToDataTable <PurchaseOrderDDTO>(dDTOPurchaseOrderList); for (int iRow = 0; iRow < shtView.RowCount; iRow++) { LoadItem(iRow); SetComboBoxInSpreadSheet(iRow); } if (hDTOSearch.IS_ACTIVE.StrongValue) { SetScreenState(eScreenState.Edit); } else { SetScreenState(eScreenState.View); } } else { // set default into Controls. var bizSysConfig = new SysConfigBIZ(); string strVatRate = (bizSysConfig.LoadByPK((NZString)"VAT_RATE", (NZString)"PUR010")).CHAR_DATA;; this.txtVatRate.Text = strVatRate; string strCurrency = (bizSysConfig.LoadByPK((NZString)"CURRENCY", (NZString)"PUR010")).CHAR_DATA;; cboCurrency.SelectedValue = strCurrency; chkOurFactory.Checked = true; chkOurFactory_CheckedChanged(this, null); this.lblPoNo.Text = string.Empty; this.dtmPODate.Value = DateTime.Now; this.cboSupplierCode.SelectedIndex = -1; this.cboTermOfPayment.SelectedIndex = -1; lblPoStatus.Text = "Actived"; this.txtRemark.Text = string.Empty; shtView.Rows.Count = 0; SetScreenState(eScreenState.Add); } m_DDTOListForDelete = new List <PurchaseOrderDDTO>(); }