public virtual bool OperateStore(CInStoreMaterialDetail pInStoreMaterialDetail)
 {
     string[]    sParams        = { "InStockMaterialID", "BINID", "POID", "ItemCode", "WHID", "VendorID", "QuantityInBinSet", "PreserveQuantitySet", "MFG", "PartNo", "UnitPricePONatural", "UnitPricePOStandard", "Status", "Comment", "flag", "OperateHistory" };
     object[]    objParamValues = { pInStoreMaterialDetail.InStockMaterialID, pInStoreMaterialDetail.BINID, pInStoreMaterialDetail.POID, pInStoreMaterialDetail.ItemCode, pInStoreMaterialDetail.WHID, pInStoreMaterialDetail.VendorID, pInStoreMaterialDetail.QuantityInBinSet, pInStoreMaterialDetail.PreserveQuantitySet, pInStoreMaterialDetail.MFG, pInStoreMaterialDetail.PartNo, pInStoreMaterialDetail.UnitPricePONatural, pInStoreMaterialDetail.UnitPricePOStandard, pInStoreMaterialDetail.Status, pInStoreMaterialDetail.Comment, pInStoreMaterialDetail.StoreOperateType, pInStoreMaterialDetail.OperateHistory };
     SqlDbType[] paramTypes     = { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Real, SqlDbType.Real, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Money, SqlDbType.Money, SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.Bit };
     return(pDataAcess.ExecuteSP("spOperateInStoreMaterialDetail", sParams, objParamValues, paramTypes));
 }
Exemple #2
0
        public string UpdateWH_IssueState(string IssueID, ApproveState state)
        {
            int    iState     = Convert.ToInt32(state);
            string sErrorMsg  = string.Empty;
            string sUpdateSql = "UPDATE WH_Issue SET Status = " + iState.ToString() + "WHERE IssueID = '" + IssueID + "' ";

            sErrorMsg = this.BaseDataAccess.ExecuteDMLSQL(sUpdateSql);
            if (sErrorMsg.Length == 0)
            {
                if (state == ApproveState.State_Approved)
                {
                    string    sSql      = "SELECT a.* , b.* FROM WH_Issue a left join WH_IssueMaterial b on a.IssueID = b.IssueID WHERE a.IssueID = '" + IssueID + "'";
                    DataTable IssueEdit = this.BaseDataAccess.GetDataTable(sSql);

                    foreach (DataRow drIssueEdit in IssueEdit.Rows)
                    {
                        //出库
                        CInStoreMaterialDetailAccess pInStoreMaterialDetailAccess = new CInStoreMaterialDetailAccess();
                        CInStoreMaterialDetail       pOutStore = new CInStoreMaterialDetail();
                        pOutStore.StoreOperateType  = STOREOPERATETYPE.TYPE_OUT;
                        pOutStore.OperateHistory    = true;
                        pOutStore.InStockMaterialID = drIssueEdit["InStockMaterialID"].ToString();
                        pOutStore.QuantityInBinSet  = cen.ChangeToBaseUOM(drIssueEdit["ItemCode"].ToString(), drIssueEdit["MaterialUomID"].ToString(), decimal.Parse(drIssueEdit["FactIssuedQuantity"].ToString()));
                        decimal decPreserveQuantityInFact = Convert.ToDecimal(drIssueEdit["PreserveQuantityInFact"] == DBNull.Value ? 0 : drIssueEdit["PreserveQuantityInFact"]);
                        pOutStore.PreserveQuantitySet = cen.ChangeToBaseUOM(drIssueEdit["ItemCode"].ToString(), drIssueEdit["MaterialUomID"].ToString(), decPreserveQuantityInFact);

                        pInStoreMaterialDetailAccess.OperateStore(pOutStore);

                        //把数据写入财务接口
                        CInterfaceOfFinanceAccess  pInterfaceOfFinanceAccess = new CInterfaceOfFinanceAccess();
                        CInterfaceOfFinance pInterfaceOfFinance = new CInterfaceOfFinance();
                        //库房
                        pInterfaceOfFinance.Location = drIssueEdit["WHID"].ToString();
                        //物资编码
                        pInterfaceOfFinance.ItemCode = drIssueEdit["ItemCode"].ToString();
                        //库位
                        pInterfaceOfFinance.BinNo = drIssueEdit["BINID"].ToString();
                        //单据号
                        pInterfaceOfFinance.BillNo = drIssueEdit["IssueNo"].ToString();
                        //操作人
                        pInterfaceOfFinance.Operater = drIssueEdit["CreateBy"].ToString();
                        //是出库还是入库
                        pInterfaceOfFinance.OperationDirection = DIRECTIONTYPE.TYPE_OUT;
                        //单据类型
                        pInterfaceOfFinance.OperationType = pInterfaceOfFinanceAccess.GetBillType(BILLTYPE.TYPE_Issue);
                        //基本单位的数量
                        pInterfaceOfFinance.Quantity = decimal.Parse(drIssueEdit["FactIssuedQuantity"].ToString());
                        //核算单价
                        pInterfaceOfFinance.UnitPriceStandard = decimal.Parse(drIssueEdit["UnitPriceStandard"].ToString());

                        pInterfaceOfFinanceAccess.OperateInterface(pInterfaceOfFinance);
                    }
                }
            }
            return(sErrorMsg);
        }
Exemple #3
0
        public string UpdateAdjustOutState(string sAdjustOutID, ApproveState state)
        {
            int    iState     = Convert.ToInt32(state);
            string sErrorMsg  = string.Empty;
            string sUpdateSql = "UPDATE WH_AdjustOut SET Status = " + iState.ToString() + " WHERE AdjustOutID = '" + sAdjustOutID + "' ";

            sErrorMsg = this.BaseDataAccess.ExecuteDMLSQL(sUpdateSql);
            if (sErrorMsg.Length == 0)
            {
                if (state == ApproveState.State_Approved)
                {
                    string    sSql             = "SELECT a.* , b.WHID,b.AdjustOutNO,b.CreateBy FROM WH_AdjustOutMaterial a left join WH_AdjustOut b on a.AdjustOutID = b.AdjustOutID WHERE a.AdjustOutID = '" + sAdjustOutID + "'";
                    DataTable dtRejectMaterial = this.BaseDataAccess.GetDataTable(sSql);

                    foreach (DataRow drRejectMaterial in dtRejectMaterial.Rows)
                    {
                        CInStoreMaterialDetailAccess pInStoreMaterialDetailAccess = new CInStoreMaterialDetailAccess();
                        //出库
                        CInStoreMaterialDetail pInStore = new CInStoreMaterialDetail();
                        pInStore.StoreOperateType  = STOREOPERATETYPE.TYPE_OUT;
                        pInStore.OperateHistory    = true;
                        pInStore.InStockMaterialID = drRejectMaterial["InStockMaterialID"].ToString();
                        pInStore.QuantityInBinSet  = decimal.Parse(drRejectMaterial["QuantityReject"].ToString());
                        pInStoreMaterialDetailAccess.OperateStore(pInStore);

                        //把数据写入财务接口
                        CInterfaceOfFinanceAccess  pInterfaceOfFinanceAccess = new CInterfaceOfFinanceAccess();
                        CInterfaceOfFinance pInterfaceOfFinance = new CInterfaceOfFinance();
                        //库房
                        pInterfaceOfFinance.Location = drRejectMaterial["WHID"].ToString();
                        //物资编码
                        pInterfaceOfFinance.ItemCode = drRejectMaterial["ItemCode"].ToString();
                        //库位
                        pInterfaceOfFinance.BinNo = drRejectMaterial["BINID"].ToString();
                        //单据号
                        pInterfaceOfFinance.BillNo = drRejectMaterial["AdjustOutNO"].ToString();
                        //操作人
                        pInterfaceOfFinance.Operater = drRejectMaterial["CreateBy"].ToString();
                        //是出库还是入库
                        pInterfaceOfFinance.OperationDirection = DIRECTIONTYPE.TYPE_OUT;
                        //单据类型
                        pInterfaceOfFinance.OperationType = pInterfaceOfFinanceAccess.GetBillType(BILLTYPE.TYPE_AdjustOut);
                        //基本单位的数量
                        pInterfaceOfFinance.Quantity = decimal.Parse(drRejectMaterial["QuantityReject"].ToString());
                        //核算单价
                        pInterfaceOfFinance.UnitPriceStandard = decimal.Parse(drRejectMaterial["UnitPriceStandard"].ToString());

                        pInterfaceOfFinanceAccess.OperateInterface(pInterfaceOfFinance);
                    }
                }
            }
            return(sErrorMsg);
        }
        public string UpdateTransferBin2BinState(string sTransferBin2BinID, ApproveState state)
        {
            int    iState     = Convert.ToInt32(state);
            string sErrorMsg  = string.Empty;
            string sUpdateSql = "UPDATE WH_TransferBin2Bin SET Status = " + iState.ToString() + " WHERE TransferBin2BinID = '" + sTransferBin2BinID + "' ";

            sErrorMsg = this.BaseDataAccess.ExecuteDMLSQL(sUpdateSql);
            if (sErrorMsg.Length == 0)
            {
                if (state == ApproveState.State_Approved)
                {
                    string    sSql = "SELECT a.* , b.WHID,c.VendorID,c.MFG,c.PartNo,c.Comment FROM WH_TransferBin2BinMaterial a left join WH_TransferBin2Bin b on a.TransferBin2BinID = b.TransferBin2BinID join WH_InStoreMaterialDetail c on c.InStockMaterialID = a.InStockMaterialID WHERE a.TransferBin2BinID = '" + sTransferBin2BinID + "'";
                    DataTable dtTransferBin2BinMaterial = this.BaseDataAccess.GetDataTable(sSql);

                    foreach (DataRow drTransferBin2BinMaterial in dtTransferBin2BinMaterial.Rows)
                    {
                        //出库
                        CInStoreMaterialDetailAccess pInStoreMaterialDetailAccess = new CInStoreMaterialDetailAccess();
                        CInStoreMaterialDetail       pOutStore = new CInStoreMaterialDetail();
                        pOutStore.StoreOperateType  = STOREOPERATETYPE.TYPE_OUT;
                        pOutStore.OperateHistory    = false;
                        pOutStore.InStockMaterialID = drTransferBin2BinMaterial["InStockMaterialID"].ToString();
                        pOutStore.QuantityInBinSet  = Decimal.Parse(drTransferBin2BinMaterial["TransferQuantity"].ToString());
                        pInStoreMaterialDetailAccess.OperateStore(pOutStore);

                        //入库
                        CInStoreMaterialDetail pInStore = new CInStoreMaterialDetail();
                        pInStore.StoreOperateType    = STOREOPERATETYPE.TYPE_IN;
                        pInStore.OperateHistory      = false;
                        pInStore.BINID               = drTransferBin2BinMaterial["BINIDNew"].ToString();
                        pInStore.ItemCode            = drTransferBin2BinMaterial["ItemCode"].ToString();
                        pInStore.POID                = drTransferBin2BinMaterial["POID"].ToString();
                        pInStore.WHID                = drTransferBin2BinMaterial["WHID"].ToString();;
                        pInStore.UnitPricePOStandard = Decimal.Parse(drTransferBin2BinMaterial["UnitPriceStandard"].ToString());
                        pInStore.UnitPricePONatural  = Decimal.Parse(drTransferBin2BinMaterial["UnitPriceNatural"].ToString());
                        pInStore.VendorID            = drTransferBin2BinMaterial["VendorID"].ToString();
                        pInStore.MFG              = drTransferBin2BinMaterial["MFG"].ToString();
                        pInStore.PartNo           = drTransferBin2BinMaterial["PartNo"].ToString();
                        pInStore.Comment          = drTransferBin2BinMaterial["Comment"].ToString();
                        pInStore.QuantityInBinSet = Decimal.Parse(drTransferBin2BinMaterial["TransferQuantity"].ToString());
                        pInStoreMaterialDetailAccess.OperateStore(pInStore);
                    }
                }
            }
            return(sErrorMsg);
        }
Exemple #5
0
        public string UpdatePreserveState(string sPreserveID, ApproveState state)
        {
            int    iState     = Convert.ToInt32(state);
            string sErrorMsg  = string.Empty;
            string sUpdateSql = "UPDATE WH_Preserve SET Status = " + iState.ToString() + " WHERE PreserveID = '" + sPreserveID + "' ";

            sErrorMsg = this.BaseDataAccess.ExecuteDMLSQL(sUpdateSql);
            if (sErrorMsg.Length == 0)
            {
                if (state == ApproveState.State_Approved)
                {
                    string    sSql = "SELECT a.* , b.WHID,b.IsPreserve FROM WH_PreserveMaterial a left join WH_Preserve b on a.PreserveID = b.PreserveID WHERE a.PreserveID = '" + sPreserveID + "'";
                    DataTable dtPreserveMaterial = this.BaseDataAccess.GetDataTable(sSql);
                    bool      bIsPreserve        = Convert.ToBoolean(dtPreserveMaterial.Rows[0]["IsPreserve"]);
                    foreach (DataRow drPreserveMaterial in dtPreserveMaterial.Rows)
                    {
                        CInStoreMaterialDetailAccess pInStoreMaterialDetailAccess = new CInStoreMaterialDetailAccess();
                        //入库
                        CInStoreMaterialDetail pInStore = new CInStoreMaterialDetail();
                        if (bIsPreserve == true)
                        {
                            pInStore.StoreOperateType    = STOREOPERATETYPE.TYPE_IN;
                            pInStore.PreserveQuantitySet = Decimal.Parse(drPreserveMaterial["QuantityPreserve"].ToString());
                        }
                        else
                        {
                            pInStore.StoreOperateType    = STOREOPERATETYPE.TYPE_OUT;
                            pInStore.PreserveQuantitySet = Decimal.Parse(drPreserveMaterial["QuantityByCanceled"].ToString());
                        }
                        pInStore.OperateHistory    = false;
                        pInStore.InStockMaterialID = drPreserveMaterial["InStockMaterialID"].ToString();
                        pInStore.QuantityInBinSet  = 0;

                        pInStoreMaterialDetailAccess.OperateStore(pInStore);
                    }
                }
            }
            return(sErrorMsg);
        }
Exemple #6
0
        public string UpdateReturnState(string sReturnID, ApproveState state)
        {
            int    iState     = Convert.ToInt32(state);
            string sErrorMsg  = string.Empty;
            string sUpdateSql = "UPDATE WH_Return SET Status = " +
                                iState.ToString() + " WHERE ReturnID = '" + sReturnID + "' ";

            sErrorMsg = this.BaseDataAccess.ExecuteDMLSQL(sUpdateSql);

            if (sErrorMsg.Length == 0)
            {
                if (state == ApproveState.State_Approved)
                {
                    string sSql = @"
							SELECT
								WH_ReturnMaterial.ItemCode , 
								WH_ReturnMaterial.POID , 
								WH_ReturnMaterial.BINID , 
								WH_ReturnMaterial.UnitPriceNatural , 
								WH_ReturnMaterial.UnitPriceStandard , 
								WH_ReturnMaterial.FactReturnQuantity , 
								WH_ReturnMaterial.depreciationRate , 
								WH_InStoreMaterialDetail.VendorID,
								WH_Return.WHIDReceive ,WH_Return.CreateBy ,WH_Return.ReturnNo 
							FROM
								WH_Return inner join WH_ReturnMaterial
								on WH_Return.ReturnID = WH_ReturnMaterial.ReturnID	
								inner join WH_IssueMaterial on WH_ReturnMaterial.IssueMaterialID = WH_IssueMaterial.IssueMaterialID
								inner join WH_InStoreMaterialDetail on WH_IssueMaterial.InStockMaterialID = WH_InStoreMaterialDetail.InStockMaterialID
							WHERE
								WH_ReturnMaterial.ReturnID = '"                                 + sReturnID + "'";

                    DataTable dt = _da.GetDataTable(sSql);

                    foreach (DataRow dr in dt.Rows)
                    {
                        //入库
                        CInStoreMaterialDetailAccess pInStoreMaterialDetailAccess = new CInStoreMaterialDetailAccess();
                        CInStoreMaterialDetail       pInStore = new CInStoreMaterialDetail();
                        pInStore.StoreOperateType = STOREOPERATETYPE.TYPE_IN;
                        pInStore.OperateHistory   = true;
                        pInStore.BINID            = dr["BINID"].ToString();
                        pInStore.VendorID         = dr["VendorID"].ToString();
                        pInStore.ItemCode         = dr["ItemCode"].ToString();
                        pInStore.POID             = dr["POID"].ToString();
                        pInStore.WHID             = dr["WHIDReceive"].ToString();
                        decimal dUnitPriceNatural  = Decimal.Parse(dr["UnitPriceNatural"].ToString());
                        decimal dUnitPriceStandard = Decimal.Parse(dr["UnitPriceStandard"].ToString());
                        decimal dDepreciationRate  = Decimal.Parse(dr["depreciationRate"].ToString());
                        pInStore.UnitPricePONatural  = dUnitPriceNatural * dDepreciationRate;
                        pInStore.UnitPricePOStandard = dUnitPriceStandard * dDepreciationRate;
                        pInStore.QuantityInBinSet    = Decimal.Parse(dr["FactReturnQuantity"].ToString());
                        pInStoreMaterialDetailAccess.OperateStore(pInStore);

                        //把数据写入财务接口
                        CInterfaceOfFinanceAccess  pInterfaceOfFinanceAccess = new CInterfaceOfFinanceAccess();
                        CInterfaceOfFinance pInterfaceOfFinance = new CInterfaceOfFinance();
                        //库房
                        pInterfaceOfFinance.Location = dr["WHIDReceive"].ToString();
                        //物资编码
                        pInterfaceOfFinance.ItemCode = dr["ItemCode"].ToString();
                        //库位
                        pInterfaceOfFinance.BinNo = dr["BINID"].ToString();
                        //单据号
                        pInterfaceOfFinance.BillNo = dr["ReturnNo"].ToString();
                        //操作人
                        pInterfaceOfFinance.Operater = dr["CreateBy"].ToString();
                        //是出库还是入库
                        pInterfaceOfFinance.OperationDirection = DIRECTIONTYPE.TYPE_IN;
                        //单据类型
                        pInterfaceOfFinance.OperationType = pInterfaceOfFinanceAccess.GetBillType(BILLTYPE.TYPE_Return);
                        //基本单位的数量
                        pInterfaceOfFinance.Quantity = decimal.Parse(dr["FactReturnQuantity"].ToString());
                        //核算单价
                        pInterfaceOfFinance.UnitPriceStandard = decimal.Parse(dr["UnitPriceStandard"].ToString());

                        pInterfaceOfFinanceAccess.OperateInterface(pInterfaceOfFinance);
                    }
                }
            }

            return(sErrorMsg);
        }