public FormReceive(string orderId) { try { purParent = icommodity.POGetParentInfoByOrderId(orderId); } catch { purParent = null; } InitializeComponent(); }
public void addPurOrderParentTest1() { CommodityImpl_Accessor target = new CommodityImpl_Accessor(); // TODO: 初始化为适当的值 PurchaseParent purchaseParent = new PurchaseParent(); // TODO: 初始化为适当的值 purchaseParent.OrderId = "PO_ID_20101206_002"; purchaseParent.Supplier = "北京中关村明基代理"; purchaseParent.PurchaseEmpId = "EMP_ID_001"; purchaseParent.PurchaseDate = DateTime.Parse("2010-12-6"); purchaseParent.StatusKBN = 2; purchaseParent.ReceivingFLG = false; purchaseParent.PaymentFLG = false; purchaseParent.Remark = "分期付款"; string actual = target.addPurOrderParent(purchaseParent); }
public FormRecAdd(string orderId) { try { purParent = icommodity.POGetParentInfoByOrderId(orderId); } catch { purParent = null; } ReloadRecList(); InitializeComponent(); Initialize(); }
public int AddPurchaseParent(PurchaseParent purchaseParent, string currentUser) { string sqlStr = dbUtil.getSqlStatement("SQL_Comd_PurchaseParent_Insert"); SqlParameter[] sqlParms = { new SqlParameter("@PurchaseOrderID",SqlDbType.VarChar,20), new SqlParameter("@SupplierID",SqlDbType.VarChar,20), new SqlParameter("@PurchaseEmpID",SqlDbType.VarChar,20), new SqlParameter("@PurchaseDate",SqlDbType.VarChar,10), new SqlParameter("@StatusKBN",SqlDbType.Int), new SqlParameter("@ReceivingFLG",SqlDbType.Bit), new SqlParameter("@PaymentFLG",SqlDbType.Bit), new SqlParameter("@Remark",SqlDbType.NVarChar,800), new SqlParameter("@CreateUser",SqlDbType.VarChar,20), new SqlParameter("@UpdateUser",SqlDbType.VarChar,20) }; sqlParms[0].Value = purchaseParent.OrderId; sqlParms[1].Value = purchaseParent.Supplier; sqlParms[2].Value = purchaseParent.PurchaseEmpId; sqlParms[3].Value = purchaseParent.PurchaseDate.ToString("yyyy-MM-dd"); sqlParms[4].Value = purchaseParent.StatusKBN; sqlParms[5].Value = purchaseParent.ReceivingFLG; sqlParms[6].Value = purchaseParent.PaymentFLG; sqlParms[7].Value = purchaseParent.Remark; sqlParms[8].Value = currentUser; sqlParms[9].Value = currentUser; int resultCount = 0; try { resultCount = (int)DAO.DBAccess.ExecuteNonQuery(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); } catch (Exception ex) { throw new DAOException("E0001"); } return resultCount; }
public void addPurOrderTest() { CommodityImpl_Accessor target = new CommodityImpl_Accessor(); // TODO: Initialize to an appropriate value PurchaseParent purchaseParent = new PurchaseParent(); // TODO: 初始化为适当的值 purchaseParent.OrderId = ""; purchaseParent.Supplier = "北京中关村明基代理"; purchaseParent.PurchaseEmpId = "EMP_ID_001"; purchaseParent.PurchaseDate = DateTime.Parse("2010-12-6"); purchaseParent.StatusKBN = 2; purchaseParent.ReceivingFLG = false; purchaseParent.PaymentFLG = false; purchaseParent.Remark = "分期付款"; List<PurchaseChild> purchaseChildList = new List<PurchaseChild>(); // TODO: Initialize to an appropriate value PurchaseChild purchaseChild = new PurchaseChild(); // TODO: Initialize to an appropriate value purchaseChild.PurParentId = ""; purchaseChild.DetailId = 0; purchaseChild.PurKBN = 1; purchaseChild.CommId = "Comd_ID_00006"; purchaseChild.Amount = 10; purchaseChild.UnitPrice = 2.5f; purchaseChild.TotlePrice = 25f; purchaseChild.Remark = "备注"; purchaseChildList.Add(purchaseChild); purchaseChild = new PurchaseChild(); // TODO: Initialize to an appropriate value purchaseChild.PurParentId = ""; purchaseChild.DetailId = 0; purchaseChild.PurKBN = 1; purchaseChild.CommId = "Comd_ID_00006"; purchaseChild.Amount = 10; purchaseChild.UnitPrice = 2.5f; purchaseChild.TotlePrice = 25f; purchaseChild.Remark = "备注"; purchaseChildList.Add(purchaseChild); string actual = target.addOrUpdatePurOrder(purchaseParent, purchaseChildList); Assert.AreEqual("PO_ID_20101208_00001", actual); }
private void ReloadOrderData() { try { if (purParent != null) { purParent = icommodity.POGetParentInfoByOrderId(purParent.OrderId); } } catch { ShowErrorInfo("读取数据失败。"); purParent = null; return; } }
public object Clone() { PurchaseParent parent = new PurchaseParent(); parent.orderId = orderId; parent.supplier = supplier; parent.purchaseEmpId = purchaseEmpId; parent.purEmpName = purEmpName; parent.pruchaseDate = pruchaseDate; parent.freight = freight; parent.rebate = rebate; parent.otherPay = otherPay; parent.commPay = commPay; parent.duePay = duePay; parent.remark = remark; parent.statusKBN = statusKBN; // 未生效 parent.receivingFLG = receivingFLG; parent.paymentFLG = paymentFLG; return parent; }
public PurchaseParent SearchPurchaseParentByOrderID(string strPurchaseOrderID) { PurchaseParent purchaseParent = new PurchaseParent(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_PurchaseParent_SearchByOrderID"); SqlParameter[] sqlParms = { new SqlParameter("@PurchaseOrderID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strPurchaseOrderID; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(searchResult)) { purchaseParent.OrderId = searchResult.Tables[0].Rows[0]["PurchaseOrderID"].ToString(); purchaseParent.Supplier = searchResult.Tables[0].Rows[0]["SupplierID"].ToString(); purchaseParent.PurchaseEmpId = searchResult.Tables[0].Rows[0]["PurchaseEmpID"].ToString(); purchaseParent.PurEmpName = searchResult.Tables[0].Rows[0]["PurchaseEmpName"].ToString(); if (searchResult.Tables[0].Rows[0]["PurchaseDate"].ToString() == string.Empty) { purchaseParent.PurchaseDate = DateTime.MinValue; } else { purchaseParent.PurchaseDate = DateTime.Parse(searchResult.Tables[0].Rows[0]["PurchaseDate"].ToString()); } purchaseParent.StatusKBN = (int)searchResult.Tables[0].Rows[0]["StatusKBN"]; purchaseParent.ReceivingFLG = (bool)searchResult.Tables[0].Rows[0]["ReceivingFLG"]; purchaseParent.PaymentFLG = (bool)searchResult.Tables[0].Rows[0]["PaymentFLG"]; purchaseParent.Remark = searchResult.Tables[0].Rows[0]["Remark"].ToString(); } } catch (Exception ex) { throw new DAOException("E0001"); } return purchaseParent; }
public List<PurchaseParent> SearchPurchaseParentByMultiFilter(Hashtable hashTable) { List<PurchaseParent> purchaseParentList = new List<PurchaseParent>(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_PurchaseParent_SearchByMultiFilter"); ArrayList listParms = new ArrayList(); UtilService utilService = new UtilService(); if (hashTable.Contains("@EmpName")) { sqlStr = utilService.validSearchFilter(sqlStr, "@EmpName"); listParms.Add(new SqlParameter("@EmpName", SqlDbType.NVarChar, 40)); } if (hashTable.Contains("@SupplierID")) { sqlStr = utilService.validSearchFilter(sqlStr, "@SupplierID"); listParms.Add(new SqlParameter("@SupplierID", SqlDbType.VarChar, 20)); } if (hashTable.Contains("@PurchaseDateStart")) { sqlStr = utilService.validSearchFilter(sqlStr, "@PurchaseDateStart"); listParms.Add(new SqlParameter("@PurchaseDateStart", SqlDbType.VarChar, 10)); } if (hashTable.Contains("@PurchaseDateEnd")) { sqlStr = utilService.validSearchFilter(sqlStr, "@PurchaseDateEnd"); listParms.Add(new SqlParameter("@PurchaseDateEnd", SqlDbType.VarChar, 10)); } if (hashTable.Contains("@StatusKBN")) { sqlStr = utilService.validSearchFilter(sqlStr, "@StatusKBN"); listParms.Add(new SqlParameter("@StatusKBN", SqlDbType.Int)); } if (hashTable.Contains("@ReceivingFLG")) { sqlStr = utilService.validSearchFilter(sqlStr, "@ReceivingFLG"); listParms.Add(new SqlParameter("@ReceivingFLG", SqlDbType.Bit)); } if (hashTable.Contains("@PaymentFLG")) { sqlStr = utilService.validSearchFilter(sqlStr, "@PaymentFLG"); listParms.Add(new SqlParameter("@PaymentFLG", SqlDbType.Bit)); } if (hashTable.Contains("@ComdID")) { sqlStr = utilService.validSearchFilter(sqlStr, "@ComdID"); listParms.Add(new SqlParameter("@ComdID", SqlDbType.VarChar, 20)); } if (hashTable.Contains("@ComdName")) { sqlStr = utilService.validSearchFilter(sqlStr, "@ComdName"); listParms.Add(new SqlParameter("@ComdName", SqlDbType.NVarChar, 100)); } SqlParameter[] sqlParms = (SqlParameter[])listParms.ToArray(typeof(SqlParameter)); foreach (SqlParameter parm in sqlParms) { parm.Value = hashTable[parm.ParameterName]; } DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); foreach (DataTable dt in searchResult.Tables) { foreach (DataRow dr in dt.Rows) { PurchaseParent purchaseParent = new PurchaseParent(); purchaseParent.OrderId = dr["PurchaseOrderID"].ToString(); purchaseParent.Supplier = dr["SupplierID"].ToString(); purchaseParent.PurchaseEmpId = dr["PurchaseEmpID"].ToString(); purchaseParent.PurEmpName = dr["PurchaseEmpName"].ToString(); if (dr["PurchaseDate"].ToString() == string.Empty) { purchaseParent.PurchaseDate = DateTime.MinValue; } else { purchaseParent.PurchaseDate = DateTime.Parse(dr["PurchaseDate"].ToString()); } purchaseParent.StatusKBN = (int)dr["StatusKBN"]; purchaseParent.ReceivingFLG = (bool)dr["ReceivingFLG"]; purchaseParent.PaymentFLG = (bool)dr["PaymentFLG"]; purchaseParent.Remark = dr["Remark"].ToString(); purchaseParentList.Add(purchaseParent); } } } catch (Exception ex) { throw; } return purchaseParentList; }
private void ReloadPurParent() { if (purParent == null) { ShowErrorInfo("没有有效数据。"); return; } try { purParent = icommodity.POGetParentInfoByOrderId(purParent.OrderId); } catch { ShowErrorInfo("无法取得订单数据。"); return; } }
/// <summary> /// /// </summary> /// <param name="purchaseParent"></param> /// <param name="purchaseChildList"></param> /// <returns>parent OrderID</returns> private string addOrUpdatePurOrder(PurchaseParent purchaseParent, List<PurchaseChild> purchaseChildList) { string parentOrderId = ""; try { //add parent into db if (purchaseParent.Valid == false) { //purchaseParent.OrderId = this.GeneratePurOrderId(); purchaseParent.StatusKBN = 0; purchaseParent.ReceivingFLG = false; purchaseParent.PaymentFLG = false; parentOrderId = this.addPurOrderParent(purchaseParent); } else { purchaseParent.StatusKBN = 0; purchaseParent.ReceivingFLG = false; purchaseParent.PaymentFLG = false; this.UpdatePurOrderParent(purchaseParent); this.DeletePurOrderChild(purchaseParent.OrderId); parentOrderId = purchaseParent.OrderId; } //goods foreach (PurchaseChild purchaseChild in purchaseChildList) { purchaseChild.PurKBN = 1; } //discount PurchaseChild purchaseChildDiscount = new PurchaseChild(); purchaseChildDiscount.PurKBN = 2; purchaseChildDiscount.Amount = 1; purchaseChildDiscount.UnitPrice = purchaseParent.Rebate; purchaseChildDiscount.TotlePrice = purchaseParent.Rebate; //freight PurchaseChild purchaseChildFreight = new PurchaseChild(); purchaseChildFreight.PurKBN = 3; purchaseChildFreight.Amount = 1; purchaseChildFreight.UnitPrice = purchaseParent.Freight; purchaseChildFreight.TotlePrice = purchaseParent.Freight; //other pay PurchaseChild purchaseChildOtherPay = new PurchaseChild(); purchaseChildOtherPay.PurKBN = 4; purchaseChildOtherPay.Amount = 1; purchaseChildOtherPay.UnitPrice = purchaseParent.OtherPay; purchaseChildOtherPay.TotlePrice = purchaseParent.OtherPay; purchaseChildList.Add(purchaseChildDiscount); purchaseChildList.Add(purchaseChildFreight); purchaseChildList.Add(purchaseChildOtherPay); //add child into db foreach (PurchaseChild purchaseChild in purchaseChildList) { //purchaseChild.PurParentId = purchaseParent.OrderId; purchaseChild.PurParentId = parentOrderId; //purchaseChild.DetailId = this.GeneratePurOrderDetailId(purchaseChild.PurParentId); this.addPurOrderChild(purchaseChild); } } catch (Exception ex) { throw; } return parentOrderId; }
private void validCheckPurReceive(PurchaseParent purchaseParent) { if (purchaseParent == null || purchaseParent.Valid == false) { //指定的订单不存在。 throw new BIZException("W03003"); } else if (purchaseParent.StatusKBN != 1) { //处于未生效、已关闭或已完成状态的订单,不能执行收货、付款或标记完成操作。 throw new BIZException("W03009"); } else if (purchaseParent.ReceivingFLG == true) { //此订单已标记收货完成,不能执行收货操作。 throw new BIZException("W03007"); } }
private void validCheckPurPay(PurchaseParent purchaseParent) { if (purchaseParent == null || purchaseParent.Valid == false) { //指定的订单不存在。 throw new BIZException("W03003"); } else if (purchaseParent.StatusKBN != 1) { //处于未生效、已关闭或已完成状态的订单,不能执行收货、付款或标记完成操作。 throw new BIZException("W03009"); } else if (purchaseParent.PaymentFLG == true) { //此订单已标记付款完成,不能执行付款操作。 throw new BIZException("W03008"); } }
private void validCheckPurComplete(PurchaseParent purchaseParent) { if (purchaseParent == null || purchaseParent.Valid == false) { //指定的订单不存在。 throw new BIZException("W03003"); } else if (purchaseParent.StatusKBN != 1) { //处于未生效、已关闭或已完成状态的订单,不能执行收货、付款或标记完成操作。 throw new BIZException("W03009"); } }
private void UpdatePurOrderParent(PurchaseParent purchaseParent) { if (purchaseParent.Valid == false) { return; } int resutcount = 0; try { resutcount = comdDAO.UpdatePurchaseParent(purchaseParent, this.currentUser); if (resutcount != 1) { throw new BIZException("W03003"); } } catch (Exception ex) { throw; } }
/// <summary> /// /// </summary> /// <param name="purchaseParent"></param> /// <returns>parent OrderID</returns> private string addPurOrderParent(PurchaseParent purchaseParent) { if (purchaseParent.Valid == false) { purchaseParent.OrderId = this.GeneratePurOrderId(); } int resutcount = 0; try { resutcount = comdDAO.AddPurchaseParent(purchaseParent, this.currentUser); if (resutcount != 1) { throw new BIZException("W03001"); } } catch (Exception ex) { throw; } return purchaseParent.OrderId; }