/// <summary> /// 修改发货计划备注 /// </summary> /// <param name="nId"></param> /// <param name="strRemark"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateDeliverPlanRemark(long nId, string strRemark, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { //读取计划数据 DeliverPlan data = dao.LoadDeliverPlan(nId, nOpStaffId, strOpStaffName, out strErrText); if (data == null) { return(false); } //修改计划数据 data.Remark = strRemark; if (!dao.UpdateDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } transScope.Complete(); } return(true); } catch (Exception e) { strErrText = e.Message; return(false); } }
/// <summary> /// 退回修改发货计划数据 /// </summary> /// <param name="nId"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool ReturnDeliverPlan(long nId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { if (!dao.ReturnDeliverPlan(nId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } transScope.Complete(); } return(true); } catch (Exception e) { strErrText = e.Message; return(false); } }
/// <summary> /// 复制发货计划数据 /// </summary> /// <param name="nId"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public long CopyDeliverPlan(long nId, long nOpStaffId, string strOpStaffName, out string strErrText) { long nPlanId = 0; try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { nPlanId = dao.CopyDeliverPlan(nId, nOpStaffId, strOpStaffName, out strErrText); if (nPlanId <= 0) { return(0); } } transScope.Complete(); } return(nPlanId); } catch (Exception e) { strErrText = e.Message; return(0); } }
private void ArmarListaPlanes() { using (PlanDAO dao = new PlanDAO()) { this.planes = dao.getPlanes(); foreach (Plan plan in planes) { filtroPlan.Items.Add(plan.Nivel); } } }
public void setstatusTest() { int id = 3; int status = 3; PlanDAO pDAO = new PlanDAO(); Plan actual = pDAO.showPlanInfo(id); int temp = actual.status; actual.status = status; pDAO.setStatus(id, status); Plan expect = pDAO.showPlanInfo(id); Assert.AreEqual(actual.status, expect.status); pDAO.setStatus(id, temp); }
public IList <PlanStakeholder> getByPlanId(int id) { string connectionString = "Data Source=FORLOGIC357;Initial Catalog=PLANNER;" + "Integrated Security=True"; string sqlQuery = "SELECT * FROM plan_interested_user WHERE id_plan = @id"; PlanStakeholder psk = null; UserDAO userDAO = new UserDAO(); PlanDAO planDAO = new PlanDAO(); using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(sqlQuery, connection); command.Parameters.AddWithValue("@id", id); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { psk = new PlanStakeholder((int)reader[0], planDAO.getOnePlan((int)reader[1]), userDAO.getResponsible((int)reader[2])); planStakeList.Add(psk); } reader.Close(); return(this.planStakeList); } catch (Exception ex) { Console.WriteLine(ex.Message); return(this.planStakeList); } finally { connection.Close(); } } }
public IList <PlanHistory> getHistory() { string connectionString = "Data Source=FORLOGIC357;Initial Catalog=PLANNER;" + "Integrated Security=True"; string sqlQuery = "SELECT * FROM plan_history"; PlanStatusDAO psDAO = new PlanStatusDAO(); PlanDAO planDAO = new PlanDAO(); using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(sqlQuery, connection); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { Plan p = planDAO.getOnePlan((int)reader[1]); PlanStatus ps = psDAO.getOneStatus((int)reader[2]); PlanHistory ph = new PlanHistory((int)reader[0], p, ps, (DateTime)reader[3]); this.planHistoryList.Add(ph); } reader.Close(); return(this.planHistoryList); } catch (Exception ex) { Console.WriteLine(ex.Message); return(this.planHistoryList); } finally { connection.Close(); } } }
/// <summary> /// 修改发货计划 /// </summary> /// <param name="data"></param> /// <param name="listGoods"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateDeliverPlan(DeliverPlan data, List <DeliverPlanGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { //修改计划数据 if (!dao.UpdateDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } //修改货物数据 if (!dao.DeleteDeliverPlanAllGoods(data.Id, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } foreach (DeliverPlanGoods goods in listGoods) { goods.PlanId = data.Id; if (!dao.InsertDeliverPlanGoods(goods, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } } transScope.Complete(); } return(true); } catch (Exception e) { strErrText = e.Message; return(false); } }
/// <summary> /// 新增发货计划 /// </summary> /// <param name="data"></param> /// <param name="listGoods"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public long InsertDeliverPlan(DeliverPlan data, List <DeliverPlanGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText) { long nPlanId = 0; try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { //新增计划数据 nPlanId = dao.InsertDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText); if (nPlanId <= 0) { return(0); } //新增货物数据 foreach (DeliverPlanGoods goods in listGoods) { goods.PlanId = nPlanId; if (!dao.InsertDeliverPlanGoods(goods, nOpStaffId, strOpStaffName, out strErrText)) { return(0); } } } transScope.Complete(); } return(nPlanId); } catch (Exception e) { strErrText = e.Message; return(0); } }
/// <summary> /// 读取指定计划数据 /// </summary> /// <param name="nPlanId"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public DeliverPlan LoadDeliverPlan(long nPlanId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { DeliverPlan dataResult = null; strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { dataResult = dao.LoadDeliverPlan(nPlanId, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return(dataResult); } catch (Exception e) { strErrText = e.Message; return(null); } }
/// <summary> /// 读取指定客户编码和仓库的待调度计划 /// </summary> /// <param name="nCustomerId"></param> /// <param name="strWarehouse"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public List <DeliverPlan> LoadDispatchDeliverPlansByCustomerIdAndWarehouse(long nCustomerId, string strWarehouse, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List <DeliverPlan> dataResult = null; strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { dataResult = dao.LoadDispatchDeliverPlansByCustomerIdAndWarehouse(nCustomerId, strWarehouse, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return(dataResult); } catch (Exception e) { strErrText = e.Message; return(null); } }
/// <summary> /// 读取指定货物编码、客户编码、寄库交货单号、仓库和批次号的所有计划货物结存数据 /// </summary> /// <param name="strCustomerId"></param> /// <param name="strGoodsId"></param> /// <param name="strBatchNo"></param> /// <param name="strPacking"></param> /// <param name="strWarehouse"></param> /// <param name="strLocation"></param> /// <param name="strProductionDate"></param> /// <param name="strEnterWarehouseBillId"></param> /// <param name="strDeliveryNo"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public List <DeliverPlanGoods> LoadDeliverPlanGoodsBalancesByConditions(string strCustomerId, string strGoodsId, string strBatchNo, string strPacking, string strWarehouse, string strLocation, string strProductionDate, string strEnterWarehouseBillId, string strDeliveryNo, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List <DeliverPlanGoods> dataResult = null; strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { dataResult = dao.LoadDeliverPlanGoodsBalancesByConditions(strCustomerId, strGoodsId, strBatchNo, strPacking, strWarehouse, strLocation, strProductionDate, strEnterWarehouseBillId, strDeliveryNo, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return(dataResult); } catch (Exception e) { strErrText = e.Message; return(null); } }
/// <summary> /// 读取外地来货计划数据 /// </summary> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public List <DeliverPlan> LoadForeignDeliverPlans(int nPageIndex, int nRowCount, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List <DeliverPlan> dataResult = null; strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { dataResult = dao.LoadForeignDeliverPlans(nPageIndex, nRowCount, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return(dataResult); } catch (Exception e) { strErrText = e.Message; return(null); } }
/// <summary> /// 读取全部待调度发货计划数据 /// </summary> /// <param name="strOrganId"></param> /// <param name="strCustomerName"></param> /// <param name="strShipmentNo"></param> /// <param name="strDeliveryNo"></param> /// <param name="strReceiverName"></param> /// <param name="strDestCountry"></param> /// <param name="strDestProvince"></param> /// <param name="strDestCity"></param> /// <param name="strWarehouse"></param> /// <param name="strArrivalTime"></param> /// <param name="strCarNo"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public List <DeliverPlan> LoadDispatchDeliverPlans(string strOrganId, string strCustomerName, string strShipmentNo, string strDeliveryNo, string strReceiverName, string strDestCountry, string strDestProvince, string strDestCity, string strWarehouse, string strArrivalTime, string strCarNo, long nOpStaffId, string strOpStaffName, out string strErrText) { try { List <DeliverPlan> dataResult = null; strErrText = String.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { dataResult = dao.LoadDispatchDeliverPlans(strOrganId, strCustomerName, strShipmentNo, strDeliveryNo, strReceiverName, strDestCountry, strDestProvince, strDestCity, strWarehouse, strArrivalTime, strCarNo, nOpStaffId, strOpStaffName, out strErrText); } transScope.Complete(); } return(dataResult); } catch (Exception e) { strErrText = e.Message; return(null); } }
/// <summary> /// 提交发货计划数据 /// </summary> /// <param name="nId"></param> /// <param name="bIsAgreed"></param> /// <param name="strApproveComment"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strMessage"></param> /// <returns></returns> public bool SubmitDeliverPlan(long nId, bool bIsAgreed, string strApproveComment, long nOpStaffId, string strOpStaffName, out string strMessage) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (PlanDAO dao = new PlanDAO()) { if (!dao.SubmitDeliverPlan(nId, bIsAgreed, strApproveComment, nOpStaffId, strOpStaffName, out strMessage)) { return(false); } } transScope.Complete(); } return(true); } catch (Exception e) { strMessage = e.Message; return(false); } }
private void CargarDatosAfiliado(int codigoAfiliado) { Afiliado afiliado; // Limpio afiliadoActual = null; txtAfiliado.Text = ""; txtPlan.Text = ""; txtPrecio.Value = 0; using (PlanDAO dao = new PlanDAO()) { afiliado = dao.buscarPlanAfiliado(codigoAfiliado); // Existe? if (afiliado == null) { MessageBox.Show("Afiliado inexistente!"); return; } if (!afiliado.Habilitado) { MessageBox.Show("El afiliado debe estar habilitado!"); return; } // Es valido afiliadoActual = afiliado; // Completo datos txtAfiliado.Text = afiliado.detalle.Nombre + ' ' + afiliado.detalle.Apellido; txtPlan.Text = afiliado.plan.Nivel; txtPrecio.Value = afiliado.plan.PrecioConsulta; } }
/// <summary> /// 取消出仓单 /// </summary> /// <param name="nId"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool CancelShipmentBill(long nId, long nOpStaffId, string strOpStaffName, out string strErrText) { try { strErrText = string.Empty; long nDispatchBillId = 0; long nPlanId = 0; string strOutType = string.Empty; using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { //删除出仓单数据 using (DeliverDAO dao = new DeliverDAO()) { //读取出仓单数据 ShipmentBill bill = dao.LoadShipmentBill(nId, nOpStaffId, strOpStaffName, out strErrText); if (bill == null) { return(false); } nDispatchBillId = bill.DispatchBillId; nPlanId = bill.PlanId; strOutType = bill.OutType; //删除出仓单数据 if (!dao.DeleteShipmentBill(nId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } //删除出仓单货物数据 if (!dao.DeleteShipmentBillAllGoods(nId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } //删除出库单数据 using (StockDAO dao = new StockDAO()) { //读取出库单数据 OutWarehouseBill bill = dao.LoadOutWarehouseBillByShipmentBillId(nId, nOpStaffId, strOpStaffName, out strErrText); if (bill == null) { return(false); } //删除出库单数据 if (!dao.DeleteOutWarehouseBill(bill.Id, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } //删除出库单货物数据 if (!dao.DeleteOutWarehouseBillAllGoods(bill.Id, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } //如果是划拨出库,则删除入库单数据 if (strOutType == InnoSoft.LS.Resources.Options.AllocateGoods) { using (StockDAO dao = new StockDAO()) { //读取入库单编码 EnterWarehouseBill bill = dao.LoadEnterWarehouseBillByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText); if (bill == null) { return(false); } //删除入库单货物数据 if (!dao.DeleteEnterWarehouseBillAllGoods(bill.Id, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } //删除入库单数据 if (!dao.DeleteEnterWarehouseBill(bill.Id, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } } //如果是发货出库,则修改调度记录数据 if (strOutType == InnoSoft.LS.Resources.Options.DeliverGoods) { using (DispatchDAO dao = new DispatchDAO()) { //读取调度单计划数据 DispatchBillDeliverPlan plan = dao.LoadDispatchBillDeliverPlan(nDispatchBillId, nPlanId, nOpStaffId, strOpStaffName, out strErrText); if (plan == null) { return(false); } //读取调度单数据 DispatchBill bill = dao.LoadDispatchBill(nDispatchBillId, nOpStaffId, strOpStaffName, out strErrText); if (bill == null) { return(false); } //修改或删除调度单数据 bill.TotalPackages = bill.TotalPackages - plan.Packages; bill.TotalTunnages = bill.TotalTunnages - plan.Tunnages; bill.TotalPiles = bill.TotalPiles - plan.Piles; bill.TotalTenThousands = bill.TotalTenThousands - plan.TenThousands; bill.TotalTransportCharges = bill.TotalTransportCharges - plan.TransportCharges; if (bill.TotalPackages == 0 && bill.TotalTunnages == 0 && bill.TotalPiles == 0 && bill.TotalTenThousands == 0) { if (!dao.DeleteDispatchBill(nDispatchBillId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } else { if (!dao.UpdateDispatchBill(bill, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } //删除调度单计划数据 if (!dao.DeleteDispatchBillDeliverPlan(nDispatchBillId, nPlanId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } //删除调度计划货物数据 if (!dao.DeleteDispatchBillDeliverPlanAllGoods(nDispatchBillId, nPlanId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } //校验调度单数据 if (bill.TotalPackages != 0 || bill.TotalTunnages != 0 || bill.TotalPiles != 0 || bill.TotalTenThousands != 0) { if (!dao.CheckDispatchBill(nDispatchBillId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } } } //如果是划拨出库,则直接取消发货计划 if (strOutType == InnoSoft.LS.Resources.Options.AllocateGoods) { using (PlanDAO dao = new PlanDAO()) { if (!dao.CancelDeliverPlan(nPlanId, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } } transScope.Complete(); } return(true); } catch (Exception e) { strErrText = e.Message; return(false); } }
/// <summary> /// 修改综合查询数据 /// </summary> /// <param name="nPlanId"></param> /// <param name="strShipmentNo"></param> /// <param name="strDeliveryNo"></param> /// <param name="nPayerId"></param> /// <param name="strPayerName"></param> /// <param name="nContractId"></param> /// <param name="strOriginalContractNo"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool SyntheticalSearchModifyData(long nPlanId, string strShipmentNo, string strDeliveryNo, long nPayerId, string strPayerName, long nContractId, string strOriginalContractNo, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { //修改发货计划 using (PlanDAO dao = new PlanDAO()) { DeliverPlan data = dao.LoadDeliverPlan(nPlanId, nOpStaffId, strOpStaffName, out strErrText); if (data == null) { return(false); } data.ShipmentNo = strShipmentNo; data.DeliveryNo = strDeliveryNo; data.PayerId = nPayerId; data.PayerName = strPayerName; if (!dao.UpdateDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } //修改出仓单和送货单数据 using (DeliverDAO dao = new DeliverDAO()) { List <ShipmentBill> listShipmentBill = dao.LoadShipmentBillsByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText); foreach (ShipmentBill data in listShipmentBill) { if (!dao.UpdateShipmentBillDeliveryNo(data.Id, strDeliveryNo, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } List <DeliverBill> listDeliverBill = dao.LoadDeliverBillsByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText); foreach (DeliverBill data in listDeliverBill) { if (!dao.UpdateDeliverBillDeliveryNo(data.Id, strDeliveryNo, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } } //修改出库单、入库单和库存数据 using (StockDAO dao = new StockDAO()) { List <OutWarehouseBill> listOutWarehouseBill = dao.LoadOutWarehouseBillsByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText); foreach (OutWarehouseBill data in listOutWarehouseBill) { data.DeliveryNo = strDeliveryNo; data.PayerId = nPayerId; data.PayerName = strPayerName; if (!dao.UpdateOutWarehouseBill(data, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } } //修改合同数据 using (ContractDAO dao = new ContractDAO()) { if (nContractId > 0) { Contract data = dao.LoadContract(nContractId, nOpStaffId, strOpStaffName, out strErrText); if (data == null) { return(false); } data.OriginalContractNo = strOriginalContractNo; if (!dao.UpdateContract(data, nOpStaffId, strOpStaffName, out strErrText)) { return(false); } } } transScope.Complete(); } return(true); } catch (Exception e) { strErrText = e.Message; return(false); } }