public int UpdateConsumption(List <InventoryTransactionDTO> dtoInvTrnsList) { try { InventoryTransactionDAO InventoryTransaction = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); for (int i = 0; i < dtoInvTrnsList.Count; i++) { #region Validate Mandatory IssueEntryValidator valIssue = new IssueEntryValidator(); ErrorItem errorItem = null; errorItem = valIssue.CheckIssueDate(dtoInvTrnsList[i].TRANS_DATE); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } #endregion InventoryTransaction.UpdateWithoutPK(null, dtoInvTrnsList[i]); } } catch (Exception) { //CommonLib.Common.CurrentDatabase.Rollback(); throw; } return(1); }
public InventoryTransactionDTO LoadReserveResult(NZString workResultNo) { InventoryBIZ bizInventory = new InventoryBIZ(); InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); InventoryTransactionDTO dto = dao.LoadReserveResult(null, workResultNo); return(dto); }
/// <summary> /// Load All Transaction /// </summary> /// <returns></returns> public System.Data.DataTable LoadAllIssueTransByPeriod(NZDateTime PERIOD_BEGIN_DATE, NZDateTime PERIOD_END_DATE, string ScreenType) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); //if (HasSlipNo) //{ // return dao.LoadAllIssueTransByPeriodWithSlipNoNotNull(null, PERIOD_BEGIN_DATE, PERIOD_END_DATE); //} return(dao.LoadAllIssueTransByPeriod(null, PERIOD_BEGIN_DATE, PERIOD_END_DATE, ScreenType)); }
public ErrorItem CheckExistsTransactionByItem(NZString ItemCD) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); if (dao.ExistsByItem(null, ItemCD)) { return(new ErrorItem(null, TKPMessages.eValidate.VLM0073.ToString())); } return(null); }
/// <summary> /// Load adjustment for list in specifiy period date. /// </summary> /// <param name="PERIOD_BEGIN_DATE"></param> /// <param name="PERIOD_END_DATE"></param> /// <returns></returns> public List <InventoryTransactionViewDTO> LoadAdjustmentList(NZDateTime PERIOD_BEGIN_DATE, NZDateTime PERIOD_END_DATE, bool IncludeOldData) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadAdjustList(PERIOD_BEGIN_DATE, PERIOD_END_DATE, IncludeOldData)); //return dao.LoadTransactionViewByTypeInPeriod(null, PERIOD_BEGIN_DATE, PERIOD_END_DATE, // new NZString[] // { // (NZString) DataDefine.Convert2ClassCode(DataDefine.eTRANS_TYPE.Adjustment) // }); }
//public int AddNew(ItemDTO dtoItem, ItemProcessDTO dtoItemProcess) //{ // ItemValidator validator = new ItemValidator(); // validator.ValidateBeforeSaveNew(dtoItem, dtoItemProcess); // Database db = CommonLib.Common.CurrentDatabase; // db.KeepConnection = true; // db.BeginTransaction(); // try // { // ItemDAO daoItem = new ItemDAO(CommonLib.Common.CurrentDatabase); // daoItem.AddNew(null, dtoItem); // //ItemProcessDAO daoItemProcess = new ItemProcessDAO(CommonLib.Common.CurrentDatabase); // //daoItemProcess.AddNew(null, dtoItemProcess); // db.Commit(); // return 1; // } // catch (Exception err) // { // db.Rollback(); // throw err; // } // finally // { // if (db.DBConnectionState == ConnectionState.Open) // db.Close(); // } //} public int DeleteItem(NZString ItemCD) { Database db = CommonLib.Common.CurrentDatabase; db.KeepConnection = true; db.BeginTransaction(); try { ItemDAO dao = new ItemDAO(CommonLib.Common.CurrentDatabase); dao.Delete(null, ItemCD); ItemProcessDAO daoProc = new ItemProcessDAO(CommonLib.Common.CurrentDatabase); daoProc.DeleteByItem(null, ItemCD); InventoryTransactionDAO daoInvTrans = new InventoryTransactionDAO(db); daoInvTrans.DeleteByItem(null, ItemCD); InventoryOnhandDAO daoInv = new InventoryOnhandDAO(CommonLib.Common.CurrentDatabase); daoInv.DeleteByItem(null, ItemCD); //ItemImageBIZ bizImage = new ItemImageBIZ(); //bizImage.DeleteImage(ItemCD); db.Commit(); return(1); } catch (Exception err) { db.Rollback(); throw err; } finally { if (db.DBConnectionState == ConnectionState.Open) { db.Close(); } } }
public DataTable LoadPackingLotByPackingNo(NZString PackingNo) { InventoryTransactionDAO dao = new InventoryTransactionDAO(Common.CurrentDatabase); return(dao.LoadPackingLotByPackingNo(PackingNo)); }
public DataTable LoadPackingList(NZString MasterNo, NZString LocCD, NZString LotNo) { InventoryTransactionDAO dao = new InventoryTransactionDAO(Common.CurrentDatabase); return(dao.LoadPackingList(MasterNo, LocCD, LotNo)); }
public DataTable LoadPackingList(NZDateTime DateBegin, NZDateTime DateEnd, bool IncludeOldData) { InventoryTransactionDAO dao = new InventoryTransactionDAO(Common.CurrentDatabase); return(dao.LoadPackingList(DateBegin, DateEnd, IncludeOldData)); }
public PackingEntryDTO LoadPackingByPackingNo(NZString PackingNo) { InventoryTransactionDAO dao = new InventoryTransactionDAO(Common.CurrentDatabase); return(dao.LoadPackingByPackingNo(PackingNo)); }
public int AddIssueConsumption(List <InventoryTransactionDTO> dtoInvTrnsList) { try { #region Validate Mandatory IssueEntryValidator valIssue = new IssueEntryValidator(); InventoryOnhandValidator valINV = new InventoryOnhandValidator(); ErrorItem errorItem = null; if (dtoInvTrnsList.Count > 0) { errorItem = valIssue.CheckIssueDate(dtoInvTrnsList[0].TRANS_DATE); if (null != errorItem) { ValidateException.ThrowErrorItem(errorItem); } } // CHECK EXIST INVENTORY ONHAND //for (int i = 0; i < dtoInvTrnsList.Count; i++) //{ // if (dtoInvTrnsList[i].IN_OUT_CLS.StrongValue == DataDefine.Convert2ClassCode(DataDefine.eIN_OUT_CLASS.Out)) // { // // NZString YearMonth = new NZString(null, dtoInvTrnsList[i].TRANS_DATE.StrongValue.ToString("yyyyMM")); // errorItem = valINV.CheckOnhandQty(dtoInvTrnsList[i].IN_OUT_CLS.StrongValue, dtoInvTrnsList[i].QTY, dtoInvTrnsList[i].ITEM_CD, // dtoInvTrnsList[i].LOC_CD, dtoInvTrnsList[i].LOT_NO); // if (null != errorItem) ValidateException.ThrowErrorItem(errorItem); // } //} #endregion // lock transaction TransactionLockDAO daoTrans = new TransactionLockDAO(CommonLib.Common.CurrentDatabase); TransactionLockDTO dtoTrans = new TransactionLockDTO(); NZString key1 = new NZString(null, "ISSUE_TRANS_ID"); NZString key2 = new NZString(null, "INV_TRANS_TR"); if (!daoTrans.Exist(null, key1, key2)) { dtoTrans.KEY1 = key1; dtoTrans.KEY2 = key2; dtoTrans.CRT_BY = CommonLib.Common.CurrentUserInfomation.UserCD; dtoTrans.CRT_DATE.Value = DateTime.Now; dtoTrans.CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; daoTrans.AddNew(null, dtoTrans); } // end of lock transaction InventoryTransactionDAO InventoryTransaction = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); RunningNumberBIZ bizRunning = new RunningNumberBIZ(); NZString TransID = bizRunning.GetCompleteRunningNo(new NZString(null, "TRAN_ID"), new NZString(null, "TB_INV_TRANS_TR")); NZString RefID = bizRunning.GetCompleteRunningNo(new NZString(null, "TRAN_ID"), new NZString(null, "TB_INV_TRANS_TR")); NZString ConsumptionID = bizRunning.GetCompleteRunningNo(new NZString(null, "TRAN_ID"), new NZString(null, "TB_INV_TRANS_TR")); // if load success then lock transaction daoTrans.SelectWithKeys(null, key1, key2); // end of lock transaction dtoInvTrnsList[0].TRANS_ID = TransID; dtoInvTrnsList[0].REF_NO = RefID; dtoInvTrnsList[1].TRANS_ID = RefID; dtoInvTrnsList[1].REF_NO = TransID; dtoInvTrnsList[2].TRANS_ID = ConsumptionID; dtoInvTrnsList[2].REF_NO = RefID; for (int i = 0; i < dtoInvTrnsList.Count; i++) { InventoryTransaction.AddNew(null, dtoInvTrnsList[i]); } daoTrans.DeleteWithKeys(null, key1, key2); CommonLib.Common.CurrentDatabase.Commit(); } catch (ValidateException) { CommonLib.Common.CurrentDatabase.Rollback(); throw; } catch (BusinessException) { CommonLib.Common.CurrentDatabase.Rollback(); throw; } catch (Exception) { CommonLib.Common.CurrentDatabase.Rollback(); throw; } finally { if (CommonLib.Common.CurrentDatabase.DBConnectionState == ConnectionState.Open) { CommonLib.Common.CurrentDatabase.Close(); } } return(1); }
public InventoryTransactionDTO LoadConsumptionTransaction(NZString TransClass, NZString RefNo, NZString ItemCD) { InventoryTransactionDAO dao = new InventoryTransactionDAO(Common.CurrentDatabase); return(dao.LoadConsumptionTransaction(null, TransClass, RefNo, ItemCD)); }
public List <InventoryTransactionDTO> LoadConsumptionItemByRefNo(NZString RefNo) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadConsumptionItemByRefNo(null, RefNo)); }
public System.Data.DataTable LoadIssueListForEdit(NZString SLIP_NO) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadIssueListForEdit(null, SLIP_NO)); }
public List <InventoryTransactionDTO> LockRefSlipNumber(NZString RefSlipNumber) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LockRefSlipNumber(CommonLib.Common.CurrentDatabase, RefSlipNumber)); }
public InventoryTransactionDTO LoadShip(NZString TranId) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.loadShip(CommonLib.Common.CurrentDatabase, TranId)); }
public System.Data.DataTable LoadInjectionMaterialReportTable(NZDateTime BeginDate, NZDateTime EndDate, NZString ItemA, NZString ItemB) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadInjectionMaterialReportTable(CommonLib.Common.CurrentDatabase, BeginDate, EndDate, ItemA, ItemB)); }
public System.Data.DataTable LoadCostView(List <string> ItemCodes) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadCostView(CommonLib.Common.CurrentDatabase, ItemCodes)); }
public InventoryTransactionDTO LoadReceiveItemByLot(NZString itemCode, NZString lotNo, NZString locCode) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadReceiveItemByLot(CommonLib.Common.CurrentDatabase, itemCode, lotNo, locCode)); }
public InventoryTransactionDTO LoadByTransactionID(NZString transactionID) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadByPK(null, transactionID)); }
public List <InventoryTransactionDTO> LoadGroupTransaction(NZString groupTrans, NZString transType) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadGroupTransaction(null, groupTrans, transType)); }
public InventoryTransactionDTO LoadByRefNoAndTransType(NZString transactionID, NZString transType) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadByRefNoAndTransType(null, transactionID, transType)); }
public System.Data.DataTable LoadAllShipTransByPeriod(NZDateTime PERIOD_BEGIN_DATE, NZDateTime PERIOD_END_DATE) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadAllShipTransByPeriod(null, PERIOD_BEGIN_DATE, PERIOD_END_DATE)); }
public List <InventoryTransactionDTO> LoadBySlipNo(NZString SlipNo) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadTransactionsBySlipNo(null, SlipNo)); }
public ProductionReportEntryDTO LoadProductionReport(NZString TransID) { InventoryTransactionDAO dao = new InventoryTransactionDAO(Common.CurrentDatabase); return(dao.LoadProductionReport(TransID)); }
//public void AddShipmentEntry(List<Rubik.DTO.InventoryTransactionDTO> dtoInvTrnsList) //{ // CommonLib.Common.CurrentDatabase.KeepConnection = true; // CommonLib.Common.CurrentDatabase.BeginTransaction(IsolationLevel.Serializable); // try // { // InventoryBIZ bizInv = new InventoryBIZ(); // RunningNumberBIZ bizRunning = new RunningNumberBIZ(); // // Validate Before Add // for (int i = 0; i < dtoInvTrnsList.Count; i++) // { // NZDateTime transDate = dtoInvTrnsList[i].TRANS_DATE; // NZString itemCode = dtoInvTrnsList[i].ITEM_CD; // NZString storedLocationCode = dtoInvTrnsList[i].LOC_CD; // NZString lotNo = dtoInvTrnsList[i].LOT_NO; // NZString inOutType = dtoInvTrnsList[i].IN_OUT_CLS; // NZDecimal Qty = dtoInvTrnsList[i].QTY; // // Check mandatory // if (itemCode.IsNull) // { // ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0005.ToString())); // } // if (storedLocationCode.IsNull) // { // ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0001.ToString())); // } // if (transDate.IsNull) // { // ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0037.ToString())); // } // if (Qty.IsNull || Qty.StrongValue == 0) // { // ValidateException.ThrowErrorItem(new ErrorItem(null, TKPMessages.eValidate.VLM0039.ToString())); // } // // Check transDate is in current period. // InventoryPeriodDAO inventoryPeriodDAO = new InventoryPeriodDAO(); // InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodDAO.LoadCurrentYearMonth(CommonLib.Common.CurrentDatabase); // if (inventoryPeriodDTO == null) // { // ValidateException.ThrowErrorItem(new ErrorItem(transDate.Owner, // TKPMessages.eValidate.VLM0037.ToString())); // return; // } // if (transDate.StrongValue.Date.CompareTo(inventoryPeriodDTO.PERIOD_BEGIN_DATE.StrongValue.Date) < 0 // || transDate.StrongValue.Date.CompareTo(inventoryPeriodDTO.PERIOD_END_DATE.StrongValue.Date) > 0) // { // ValidateException.ThrowErrorItem(new ErrorItem(transDate.Owner, // TKPMessages.eValidate.VLM0038.ToString())); // return; // } // } // NZString SlipNo = bizRunning.GetCompleteRunningNo(new NZString(null, "SHIP_SLIP_NO"), // new NZString(null, // "TB_INV_TRANS_TR")); // for (int i = 0; i < dtoInvTrnsList.Count; i++) // { // //dtoInvTrnsList[i].TRANS_ID = bizRunning.GetCompleteRunningNo(new NZString(null, "TRAN_ID"), // // new NZString(null, // // "TB_INV_TRANS_TR")); // dtoInvTrnsList[i].SLIP_NO = SlipNo; // bizInv.AddInventoryTransactions(CommonLib.Common.CurrentDatabase, dtoInvTrnsList,true); // } // CommonLib.Common.CurrentDatabase.Commit(); // } // catch (Exception) // { // CommonLib.Common.CurrentDatabase.Rollback(); // throw; // } //} public DataTable LoadShipList(NZString SlipNo) { InventoryTransactionDAO dao = new InventoryTransactionDAO(CommonLib.Common.CurrentDatabase); return(dao.LoadShipList(null, SlipNo)); }
public DataTable LoadNGTransaction(NZString TransID) { InventoryTransactionDAO dao = new InventoryTransactionDAO(Common.CurrentDatabase); return(dao.LoadNGTransaction(TransID)); }