public DataSet GetReturnGoodsDetail(int pintReturnedGoodsID) { SO_ReturnedGoodsDetailDS objSO_ReturnedGoodsDetailDS = new SO_ReturnedGoodsDetailDS(); DataSet dsData = objSO_ReturnedGoodsDetailDS.ListReturnedGoodsDetail(pintReturnedGoodsID); return(dsData); }
public void UpdateReturnedGoods(object objReturnedGoodsMaster, DataSet dsReturnedGoodsDetail) { SO_ReturnedGoodsMasterDS objSO_ReturnedGoodsMasterDS = new SO_ReturnedGoodsMasterDS(); SO_ReturnedGoodsDetailDS objSO_ReturnedGoodsDetailDS = new SO_ReturnedGoodsDetailDS(); //first update the master objSO_ReturnedGoodsMasterDS.UpdateReturnedGoods(objReturnedGoodsMaster); //second update the detail objSO_ReturnedGoodsDetailDS.UpdateDataSetReturnedGoodsDetail(dsReturnedGoodsDetail, ((SO_ReturnedGoodsMasterVO)objReturnedGoodsMaster).ReturnedGoodsMasterID); }
public void DeleteReturnedGoods(int pintReturnedGoodsMasterID) { //1. Variable int enm_InspStatus = 8; int constOldTranTypeID = (new MST_TranTypeDS()).GetTranTypeID(TransactionType.RETURN_GOODS_RECEIVE); SO_ReturnedGoodsDetailDS objSO_ReturnedGoodsDetailDS = new SO_ReturnedGoodsDetailDS(); SO_ReturnedGoodsMasterDS objSO_ReturnedGoodsMasterDS = new SO_ReturnedGoodsMasterDS(); //2. Get ReturnedGoodsMaster SO_ReturnedGoodsMasterVO voRuturnGoodsMaster = new SO_ReturnedGoodsMasterVO(); voRuturnGoodsMaster = (SO_ReturnedGoodsMasterVO)objSO_ReturnedGoodsMasterDS.GetObjectVO(pintReturnedGoodsMasterID); //Get List ReturnGoodsDetail by ReturnGoodsMasterID DataSet dsRGD = objSO_ReturnedGoodsDetailDS.ListReturnedGoodsDetail(pintReturnedGoodsMasterID); foreach (DataRow row in dsRGD.Tables[0].Rows) { //Update Inventory int MaslocID = (int)row[SO_ReturnedGoodsDetailTable.MASTERLOCATIONID_FLD]; int locID = (int)row[SO_ReturnedGoodsDetailTable.LOCATIONID_FLD]; int BinID = (int)row[SO_ReturnedGoodsDetailTable.BINID_FLD]; int ProductID = (int)row[SO_ReturnedGoodsDetailTable.PRODUCTID_FLD]; decimal decQuantityReceipt = (decimal)row[SO_ReturnedGoodsDetailTable.RECEIVEQUANTITY_FLD]; new InventoryUtilsBO().UpdateSubtractOHQuantity(voRuturnGoodsMaster.CCNID, MaslocID, locID, BinID, ProductID, decQuantityReceipt, string.Empty, string.Empty); } // Update TransactionHistory new MST_TransactionHistoryDS().UpdateTranType(voRuturnGoodsMaster.ReturnedGoodsMasterID, constOldTranTypeID, (int)TransactionTypeEnum.DeleteTransaction, enm_InspStatus); //delete the detail first objSO_ReturnedGoodsDetailDS.DeleteAllReturnedGoodsDetail(pintReturnedGoodsMasterID); //delete the master later objSO_ReturnedGoodsMasterDS.Delete(pintReturnedGoodsMasterID); }
public decimal GetTotalReceivedQuantity(int pintSaleOrderMasterID, int pintProductID, string pstrLot, string pstrSerial) { SO_ReturnedGoodsDetailDS objSO_ReturnedGoodsDetailDS = new SO_ReturnedGoodsDetailDS(); return(objSO_ReturnedGoodsDetailDS.GetTotalReceivedQuantity(pintSaleOrderMasterID, pintProductID, pstrLot, pstrSerial)); }
public int AddNewReturnedGoods(object objReturnedGoodsMaster, DataSet dsReturnedGoodsDetail) { const string BALANCE_QUANTITY = "BalanceQty"; const string METHOD_NAME = THIS + ".AddNewReturnedGoods()"; SO_ReturnedGoodsMasterDS objSO_ReturnedGoodsMasterDS = new SO_ReturnedGoodsMasterDS(); SO_ReturnedGoodsDetailDS objSO_ReturnedGoodsDetailDS = new SO_ReturnedGoodsDetailDS(); //First add the master record int intReturnedGoodMasterID = objSO_ReturnedGoodsMasterDS.AddReturnedGoodsAndReturnID(objReturnedGoodsMaster); UtilsBO boUtils = new UtilsBO(); if (((SO_ReturnedGoodsMasterVO)objReturnedGoodsMaster).SaleOrderMasterID > 0) { DataTable dstCheckBalanceOfAllItems = GetSaleOrderTotalCommit(((SO_ReturnedGoodsMasterVO)objReturnedGoodsMaster).SaleOrderMasterID); //update the dataset all of this id for (int i = 0; i < dsReturnedGoodsDetail.Tables[0].Rows.Count; i++) { if (dsReturnedGoodsDetail.Tables[0].Rows[i].RowState != DataRowState.Deleted) { dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.RETURNEDGOODSMASTERID_FLD] = intReturnedGoodMasterID; DataRow[] drowsData = dstCheckBalanceOfAllItems.Select(ITM_ProductTable.PRODUCTID_FLD + "=" + dsReturnedGoodsDetail.Tables[0].Rows[i][ITM_ProductTable.PRODUCTID_FLD].ToString()); if (drowsData.Length > 0) { decimal decRate = boUtils.GetUMRate(int.Parse(drowsData[0][SO_SaleOrderDetailTable.SELLINGUMID_FLD].ToString()), int.Parse(dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.UNITID_FLD].ToString())); if (decRate == 0) { Exception ex = new Exception(); Hashtable htbUMCode = new Hashtable(); htbUMCode.Add(MST_UnitOfMeasureTable.UNITOFMEASUREID_FLD, ((MST_UnitOfMeasureVO)boUtils.GetUMInfor(int.Parse(dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.UNITID_FLD].ToString()))).Code); htbUMCode.Add(ITM_ProductTable.STOCKUMID_FLD, ((MST_UnitOfMeasureVO)boUtils.GetUMInfor(int.Parse(dsReturnedGoodsDetail.Tables[0].Rows[i][ITM_ProductTable.STOCKUMID_FLD].ToString()))).Code); throw new PCSBOException(ErrorCode.MESSAGE_UMRATE_IS_NOT_CONFIGURATED, METHOD_NAME, ex, htbUMCode); } if ((decimal)drowsData[0][BALANCE_QUANTITY] * decRate < (decimal)dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.RECEIVEQUANTITY_FLD]) { throw new PCSException(ErrorCode.MESSAGE_RGA_RECEIVEQTYTOCOMMIT, dsReturnedGoodsDetail.Tables[0].Rows[i][ITM_ProductTable.PRODUCTID_FLD].ToString(), new Exception()); } dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.QUANTITYOFSELLING_FLD] = (decimal)dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.RECEIVEQUANTITY_FLD] / decRate; } } } } else { for (int i = 0; i < dsReturnedGoodsDetail.Tables[0].Rows.Count; i++) { if (dsReturnedGoodsDetail.Tables[0].Rows[i].RowState != DataRowState.Deleted) { dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.RETURNEDGOODSMASTERID_FLD] = intReturnedGoodMasterID; decimal decRate = boUtils.GetUMRate(int.Parse(dsReturnedGoodsDetail.Tables[0].Rows[i][ITM_ProductTable.STOCKUMID_FLD].ToString()), int.Parse(dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.UNITID_FLD].ToString())); if (decRate == 0) { Exception ex = new Exception(); Hashtable htbUMCode = new Hashtable(); htbUMCode.Add(MST_UnitOfMeasureTable.UNITOFMEASUREID_FLD, ((MST_UnitOfMeasureVO)boUtils.GetUMInfor(int.Parse(dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.UNITID_FLD].ToString()))).Code); htbUMCode.Add(ITM_ProductTable.STOCKUMID_FLD, ((MST_UnitOfMeasureVO)boUtils.GetUMInfor(int.Parse(dsReturnedGoodsDetail.Tables[0].Rows[i][ITM_ProductTable.STOCKUMID_FLD].ToString()))).Code); throw new PCSBOException(ErrorCode.MESSAGE_UMRATE_IS_NOT_CONFIGURATED, METHOD_NAME, ex, htbUMCode); } dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.QUANTITYOFSELLING_FLD] = (decimal)dsReturnedGoodsDetail.Tables[0].Rows[i][SO_ReturnedGoodsDetailTable.RECEIVEQUANTITY_FLD] / decRate; } } } //second add the detail objSO_ReturnedGoodsDetailDS.UpdateDataSetReturnedGoodsDetail(dsReturnedGoodsDetail, intReturnedGoodMasterID); //update history data SO_ReturnedGoodsMasterVO objSO_ReturnedGoodsMasterVO = (SO_ReturnedGoodsMasterVO)objReturnedGoodsMaster; objSO_ReturnedGoodsMasterVO.ReturnedGoodsMasterID = intReturnedGoodMasterID; UpdateInventoryInfor(dsReturnedGoodsDetail, true, objSO_ReturnedGoodsMasterVO); return(intReturnedGoodMasterID); }