/// <summary> /// 构造函数 /// </summary> /// <param name="connection">数据连接</param> public TSPickOutPlanBC(SqlConnection connection) { this.connection = connection; this.sPickOutPlanBB = new TSPickOutPlanBB(this.connection); this.errorDiaryBB = new SErrorDiaryBB(this.connection); this.operatDiaryBB = new SOperatDiaryBB(this.connection); }
/// <summary> /// 构造函数 /// </summary> public TSPickOutPlanBC() { this.selfConn = true; this.connection = new SqlConnection(HS.Config.SqlDataObject.GetSqlConnectionString); this.connection.Open(); this.sPickOutPlanBB = new TSPickOutPlanBB(this.connection); this.errorDiaryBB = new SErrorDiaryBB(this.connection); this.operatDiaryBB = new SOperatDiaryBB(this.connection); }
/// <summary> /// 2015-09-16 增加保存 /// </summary> /// <param name="dtPlan"></param> /// <param name="strStockUpBillNo"></param> /// <param name="issubmit"></param> /// <returns></returns> public bool SaveTSPickOutPlanBill(DataTable dtPlan, string strStockUpBillNo,string tsOutBillNo, bool issubmit) { bool ret = false; UStockBB stockBB = new UStockBB(this.connection); SCommBB commBB = new SCommBB(this.connection); SqlTransaction trans = null; try { if (this.transaction == null) { trans = this.connection.BeginTransaction("TranSave"); this.sPickOutPlanBB.Transaction = trans; stockBB.Transaction = trans; commBB.Transaction = trans; } else { this.sPickOutPlanBB.Transaction = this.transaction; stockBB.Transaction = this.transaction; commBB.Transaction = this.transaction; } TSPickOutPlanData pickOutPlanModel = new TSPickOutPlanData(); TSPickOutPlanBB stockUpBillNo = new TSPickOutPlanBB(); string stockUpBillNOValue = stockUpBillNo.GetCurrentInBillNoByStockUpBillNoByQT(); #region 逐条保存拣货计划 //逐条保存拣货计划 foreach (DataRow dr in dtPlan.Rows) { string strWareLocatorNo = "", strMaterialNo = "", strWhere = "", strSql = ""; float num = 0; DataTable dtStock = new DataTable(); // stockUpBillNo.DeleteRecord(int.Parse(dr["id"].ToString())); strWareLocatorNo = dr["wareLocatorNo"].ToString();//库位 strMaterialNo = dr["materialNo"].ToString();//物料编号 num = Convert.ToSingle(dr["num"]);//数量 pickOutPlanModel = new TSPickOutPlanData(); pickOutPlanModel.stockUpBillNO = stockUpBillNOValue;//获取其他备货单号 pickOutPlanModel.wareNo = dr["wareNo"].ToString(); pickOutPlanModel.wareLocatorNo = dr["wareLocatorNo"].ToString(); pickOutPlanModel.palletNo = dr["palletNo"].ToString(); pickOutPlanModel.stockUpMaterialNo = dr["stockUpMaterialNo"].ToString();//备货物料 pickOutPlanModel.materialNo = dr["materialNo"].ToString();//实际拣货物料 pickOutPlanModel.num = Convert.ToInt32(dr["num"]); pickOutPlanModel.financeBillNo = dr["financeBillNo"].ToString();//采购合同号 pickOutPlanModel.tsOutBillNo = tsOutBillNo; //pickOutPlanModel.financeBillSort = dr["financeBillSort"].ToString();//采购合同类型 pickOutPlanModel.isrtDt = System.DateTime.Now.ToString(); pickOutPlanModel.isrtEmpId = this.empId; if (issubmit) { pickOutPlanModel.instantState = "02"; } else { pickOutPlanModel.instantState = "01"; } this.sPickOutPlanBB.AddRecord(pickOutPlanModel); ret = true; } string command = "Update TSoutBIll set StockUpbillNo = '" + stockUpBillNOValue + "',InstantState = '02' where TSoutBill = '" + tsOutBillNo + "'"; SQLHelperDM.ExecuteNonQuery(HS.Config.SqlDataObject.GetJoeyConnectionString, command); stockUpBillNo.Dispose(); #endregion 保存拣货计划 } catch { } try { if (this.transaction == null) trans.Commit(); } catch { ret = false; } finally { stockBB.Dispose(); commBB.Dispose(); sPickOutPlanBB.Dispose(); } return ret; }