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 void UpdateEnquiryMaterial(DataTable dtEnquiryMaterial) { //两种相同物资合并后不允许再拆分 foreach (DataRow drEnquiryMaterial in dtEnquiryMaterial.Rows) { if (drEnquiryMaterial.RowState != DataRowState.Deleted) { DataTable dtTempInfo = daeEnquiryPrice.GetEnquiryMaterial(drEnquiryMaterial["MRMaterialID"].ToString()); if (dtTempInfo.Rows.Count > 0) { drEnquiryMaterial["MRNO"] = dtTempInfo.Rows[0]["MRNO"]; drEnquiryMaterial["ItemCode"] = dtTempInfo.Rows[0]["ItemCode"]; drEnquiryMaterial["MaterialName"] = dtTempInfo.Rows[0]["MaterialName"]; drEnquiryMaterial["ProductStandard"] = dtTempInfo.Rows[0]["ProductStandard"]; drEnquiryMaterial["MFG"] = dtTempInfo.Rows[0]["MFG"]; drEnquiryMaterial["PartNO"] = dtTempInfo.Rows[0]["PartNO"]; //当前单位 drEnquiryMaterial["MaterialUomID"] = dtTempInfo.Rows[0]["MaterialUomID"]; //基本单位 drEnquiryMaterial["UOMID"] = dtTempInfo.Rows[0]["UOMID"]; //基本单位数量 drEnquiryMaterial["MRQuantity"] = cEntityUitlity.ChangeToBaseUOM(dtTempInfo.Rows[0]["ItemCode"].ToString(), dtTempInfo.Rows[0]["MaterialUomID"].ToString(), System.Convert.ToDecimal(dtTempInfo.Rows[0]["CanEnquiryQuantity"])); } } } }