public virtual bool OperateInterface(CInterfaceOfFinance pInterfaceOfFinance) { string[] sParams = { "Location", "ItemCode", "BinNo", "BillNo", "OperationType", "Quantity", "OperationDirection", "UnitPriceStandard", "Operater" }; object[] objParamValues = { pInterfaceOfFinance.Location, pInterfaceOfFinance.ItemCode, pInterfaceOfFinance.BinNo, pInterfaceOfFinance.BillNo, pInterfaceOfFinance.OperationType, pInterfaceOfFinance.Quantity, pInterfaceOfFinance.OperationDirection, pInterfaceOfFinance.UnitPriceStandard, pInterfaceOfFinance.Operater }; SqlDbType[] paramTypes = { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Real, SqlDbType.Int, SqlDbType.Money, SqlDbType.NVarChar }; return(pDataAcess.ExecuteSP("spInsertInterfaceOfFinance", sParams, objParamValues, paramTypes)); }
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); }
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 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); }
/// <summary> /// 更新库间转料状态 /// </summary> /// <param name="PkValue"></param> /// <param name="state"></param> /// <returns></returns> public string UpdateWH_TransferWH2WHState(string PkValue, ApproveState state) { int iState = Convert.ToInt32(state); string sErrorMsg = string.Empty; string sUpdateSql = "UPDATE WH_TransferWH2WH SET Status = " + iState.ToString() + " WHERE TransferWH2WHID = '" + PkValue + "' "; sErrorMsg = this.BaseDataAccess.ExecuteDMLSQL(sUpdateSql); if (sErrorMsg.Length == 0) { switch (state) { case ApproveState.State_Approved: { string sql = @"SELECT a.* , b.* ,c.VendorID,d.PartNo,d.MFG FROM WH_TransferWH2WHMaterial a left join WH_TransferWH2WH b on a.TransferWH2WHID = b.TransferWH2WHID left join PurchaseOrder c on a.POID = c.POID left join Material as d on d.ItemCode = a.ItemCode WHERE a.TransferWH2WHID = '" + PkValue + "'"; DataTable dt = this.BaseDataAccess.GetDataTable(sql); #region for (int i = 0; i < dt.Rows.Count; i++) { //出库 // 构造库存操作实体 DataEntity.CInStoreMaterialDetail Out_entity = new DataEntity.CInStoreMaterialDetail(); // 调用库存操作连接类 DataEntity.CInStoreMaterialDetailAccess storeAccess = new CInStoreMaterialDetailAccess(); Out_entity.StoreOperateType = DataEntity.STOREOPERATETYPE.TYPE_OUT; Out_entity.BINID = dt.Rows[i]["BINIDOld"].ToString(); Out_entity.InStockMaterialID = dt.Rows[i]["InStockMaterialID"].ToString();; Out_entity.ItemCode = dt.Rows[i]["ItemCode"].ToString(); Out_entity.POID = dt.Rows[i]["POID"].ToString(); Out_entity.QuantityInBinSet = Decimal.Parse(dt.Rows[i]["TransferQuantity"].ToString()); //库位数量 = 原库位数量 - 转料数量 Out_entity.UnitPricePONatural = Decimal.Parse(dt.Rows[i]["UnitPriceNatural"].ToString()); Out_entity.UnitPricePOStandard = Decimal.Parse(dt.Rows[i]["UnitPriceStandard"].ToString()); Out_entity.WHID = dt.Rows[i]["WHIDOld"].ToString(); Out_entity.VendorID = dt.Rows[i]["VendorID"].ToString(); //供应商ID Out_entity.PartNo = dt.Rows[i]["PartNo"].ToString(); //制造编号 Out_entity.MFG = dt.Rows[i]["MFG"].ToString(); //制造商 //Out_entity.PreserveQuantitySet = 0; //预留数量 Out_entity.OperateHistory = true; //把数据写入财务接口 CInterfaceOfFinanceAccess pInterfaceOfFinanceAccess = new CInterfaceOfFinanceAccess(); CInterfaceOfFinance pInterfaceOfFinance = new CInterfaceOfFinance(); //库房 pInterfaceOfFinance.Location = dt.Rows[i]["WHIDOld"].ToString(); //物资编码 pInterfaceOfFinance.ItemCode = dt.Rows[i]["ItemCode"].ToString(); //库位 pInterfaceOfFinance.BinNo = dt.Rows[i]["BINIDOld"].ToString(); //单据号 pInterfaceOfFinance.BillNo = dt.Rows[i]["TransferWH2WHNO"].ToString(); //操作人 pInterfaceOfFinance.Operater = dt.Rows[i]["CreateBy"].ToString(); //是出库还是入库 pInterfaceOfFinance.OperationDirection = DIRECTIONTYPE.TYPE_OUT; //单据类型 pInterfaceOfFinance.OperationType = pInterfaceOfFinanceAccess.GetBillType(BILLTYPE.TYPE_TransferWH2WH); //基本单位的数量 pInterfaceOfFinance.Quantity = decimal.Parse(dt.Rows[i]["TransferQuantity"].ToString()); //核算单价 pInterfaceOfFinance.UnitPriceStandard = decimal.Parse(dt.Rows[i]["UnitPriceStandard"].ToString()); pInterfaceOfFinanceAccess.OperateInterface(pInterfaceOfFinance); bool IsOK = storeAccess.OperateStore(Out_entity); //入库 DataEntity.CInStoreMaterialDetail In_entity = new DataEntity.CInStoreMaterialDetail(); In_entity.StoreOperateType = DataEntity.STOREOPERATETYPE.TYPE_IN; In_entity.BINID = dt.Rows[i]["BINIDNew"].ToString(); In_entity.ItemCode = dt.Rows[i]["ItemCode"].ToString(); In_entity.POID = dt.Rows[i]["POID"].ToString(); In_entity.QuantityInBinSet = Decimal.Parse(dt.Rows[i]["TransferQuantity"].ToString()); //库位数量 = 原库位数量 - 转料数量 In_entity.UnitPricePONatural = Decimal.Parse(dt.Rows[i]["UnitPriceNatural"].ToString()); In_entity.UnitPricePOStandard = Decimal.Parse(dt.Rows[i]["UnitPriceStandard"].ToString()); In_entity.WHID = dt.Rows[i]["WHIDNew"].ToString(); In_entity.VendorID = dt.Rows[i]["VendorID"].ToString(); //供应商ID In_entity.PartNo = dt.Rows[i]["PartNo"].ToString(); //制造编号 In_entity.MFG = dt.Rows[i]["MFG"].ToString(); //制造商 In_entity.OperateHistory = true; //把数据写入财务接口 //库房 pInterfaceOfFinance.Location = dt.Rows[i]["WHIDNew"].ToString(); //物资编码 pInterfaceOfFinance.ItemCode = dt.Rows[i]["ItemCode"].ToString(); //库位 pInterfaceOfFinance.BinNo = dt.Rows[i]["BINIDNew"].ToString(); //单据号 pInterfaceOfFinance.BillNo = dt.Rows[i]["TransferWH2WHNO"].ToString(); //操作人 pInterfaceOfFinance.Operater = dt.Rows[i]["CreateBy"].ToString(); //是出库还是入库 pInterfaceOfFinance.OperationDirection = DIRECTIONTYPE.TYPE_IN; //单据类型 pInterfaceOfFinance.OperationType = pInterfaceOfFinanceAccess.GetBillType(BILLTYPE.TYPE_TransferWH2WH); //基本单位的数量 pInterfaceOfFinance.Quantity = decimal.Parse(dt.Rows[i]["TransferQuantity"].ToString()); //核算单价 pInterfaceOfFinance.UnitPriceStandard = decimal.Parse(dt.Rows[i]["UnitPriceStandard"].ToString()); pInterfaceOfFinanceAccess.OperateInterface(pInterfaceOfFinance); IsOK = storeAccess.OperateStore(In_entity); } #endregion break; } } } return(sErrorMsg); }