private void ShowInfo(int _id) { BLL.StoreInOrder bll = new BLL.StoreInOrder(); Model.StoreInOrder model = bll.GetModel(_id); ddlCustomer.SelectedValue = model.CustomerId.ToString(); txtAccountNumber.Text = model.AccountNumber; txtInspectionNumber.Text = model.InspectionNumber; txtBeginChargingTime.Text = model.BeginChargingTime.ToString("yyyy-MM-dd"); txtChargingCount.Text = model.ChargingCount.ToString(); txtSuttleWeight.Text = model.SuttleWeight.ToString("0.00"); txtAdmin.Text = model.Admin; txtRemark.Text = model.Remark; BLL.StoreInUnitPrice unitpriceBLL = new BLL.StoreInUnitPrice(); DataTable unitpriceDT = unitpriceBLL.GetList(" StoreInOrderId = " + _id + "").Tables[0]; this.rptUnitPriceList.DataSource = unitpriceDT; this.rptUnitPriceList.DataBind(); BLL.StoreInCost costBLL = new BLL.StoreInCost(); DataTable costDT = costBLL.GetList(" StoreInOrderId = " + _id + "").Tables[0]; this.rptCostList.DataSource = costDT; this.rptCostList.DataBind(); BLL.StoreInGoods goodsBLL = new BLL.StoreInGoods(); DataTable goodsDT = goodsBLL.GetList(" and A.StoreInOrderId = " + _id + " ").Tables[0]; this.rptGoodsList.DataSource = goodsDT; this.rptGoodsList.DataBind(); }
private bool DoAdd() { bool result = false; if (string.IsNullOrWhiteSpace(txtBeginChargingTime.Text)) { JscriptMsg("实际入库时间不能为空!", ""); return false; } Model.StoreInOrder model = new Model.StoreInOrder(); BLL.StoreInOrder bll = new BLL.StoreInOrder(); model.CustomerId = int.Parse(ddlCustomer.SelectedValue); model.BeginChargingTime = DateTime.Parse(txtBeginChargingTime.Text); model.ChargingTime = new DateTime(model.BeginChargingTime.Year, model.BeginChargingTime.Month, model.BeginChargingTime.Day + 1); model.AccountNumber = txtAccountNumber.Text; model.InspectionNumber = txtInspectionNumber.Text; model.ChargingCount = decimal.Parse(txtChargingCount.Text); model.SuttleWeight = decimal.Parse(txtSuttleWeight.Text); model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; model.Status = 1; model.CreateTime = DateTime.Now; #region 单价 string[] unitpriceBeginTime = Request.Form.GetValues("UnitpriceBeginTime"); string[] unitpriceEndTime = Request.Form.GetValues("UnitpriceEndTime"); string[] unitprice = Request.Form.GetValues("Unitprice"); string[] unitpriceRemark = Request.Form.GetValues("UnitpriceRemark"); if (unitpriceBeginTime != null && unitpriceEndTime != null && unitprice != null && unitpriceRemark != null && unitpriceBeginTime.Length > 0 && unitpriceEndTime.Length > 0 && unitprice.Length > 0 && unitpriceRemark.Length > 0) { for (int i = 0; i < unitpriceBeginTime.Length; i++) { if (string.IsNullOrWhiteSpace(unitpriceBeginTime[i])) { unitpriceBeginTime[i] = DTDateTime.MinDateTime.ToString(); } if (string.IsNullOrWhiteSpace(unitpriceEndTime[i])) { unitpriceEndTime[i] = DTDateTime.MaxDateTime.ToString(); } decimal price; DateTime begintime, endtime; if (DateTime.TryParse(unitpriceBeginTime[i], out begintime) && DateTime.TryParse(unitpriceEndTime[i], out endtime) && decimal.TryParse(unitprice[i], out price)) { model.AddUnitPrice(new StoreInUnitPrice(begintime, endtime, price, unitpriceRemark[i])); } } } #endregion #region 费用 string[] costName = Request.Form.GetValues("CostName"); string[] costCount = Request.Form.GetValues("CostCount"); string[] costType = Request.Form.GetValues("CostType"); string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice"); string[] costCustomer = Request.Form.GetValues("CostCustomer"); string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice"); if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null && costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0) { for (int i = 0; i < costName.Length; i++) { decimal count, totalPrice, unitPrice; if (decimal.TryParse(costCount[i], out count) && decimal.TryParse(costTotalPrice[i], out totalPrice) && decimal.TryParse(costUnitPrices[i], out unitPrice)) { if (costType[i].ToString().Equals("-")) { totalPrice *= -1; } model.AddStoreInCost(new StoreInCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], "")); } } } #endregion #region 入库货物 string[] storeWaitingGoodsIds = Request.Form.GetValues("StoreWaitingGoodsId"); string[] customerIds = Request.Form.GetValues("CustomerId"); string[] goodsIds = Request.Form.GetValues("GoodsId"); string[] storeIds = Request.Form.GetValues("StoreId"); string[] storeInCounts = Request.Form.GetValues("Count"); string[] storeInGoodsRemark = Request.Form.GetValues("StoreInGoodsRemark"); if (storeWaitingGoodsIds != null && customerIds != null && storeIds != null && storeInCounts != null && storeInGoodsRemark != null && storeWaitingGoodsIds.Length > 0 && customerIds.Length > 0 && storeIds.Length > 0 && storeInCounts.Length > 0 && storeInGoodsRemark.Length > 0) { for (int i = 0; i < storeWaitingGoodsIds.Length; i++) { int storeWaitingGoodsId, customerId, storeId, goodsId; decimal storeInCount; if (int.TryParse(storeWaitingGoodsIds[i], out storeWaitingGoodsId) && int.TryParse(customerIds[i], out customerId) && int.TryParse(storeIds[i], out storeId) && decimal.TryParse(storeInCounts[i], out storeInCount) && int.TryParse(goodsIds[i], out goodsId)) { model.AddStoreInGoods(new StoreInGoods(storeId, storeWaitingGoodsId, customerId, goodsId, storeInCount, storeInGoodsRemark[i])); } } } #endregion if (bll.Add(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加入库单:" + model.AccountNumber); //记录日志 result = true; } return result; }
private bool DoEdit(int _id) { bool result = false; BLL.StoreInOrder bll = new BLL.StoreInOrder(); Model.StoreInOrder model = bll.GetModel(_id); model.CustomerId = int.Parse(ddlCustomer.SelectedValue); model.BeginChargingTime = DateTime.Parse(txtBeginChargingTime.Text); model.ChargingTime = new DateTime(model.BeginChargingTime.Year, model.BeginChargingTime.Month, model.BeginChargingTime.Day + 1); model.AccountNumber = txtAccountNumber.Text; model.InspectionNumber = txtInspectionNumber.Text; model.ChargingCount = decimal.Parse(txtChargingCount.Text); model.SuttleWeight = decimal.Parse(txtSuttleWeight.Text); model.Admin = txtAdmin.Text; model.Remark = txtRemark.Text; model.Status = 0; model.CreateTime = DateTime.Now; #region 单价 string[] unitpriceBeginTime = Request.Form.GetValues("UnitpriceBeginTime"); string[] unitpriceEndTime = Request.Form.GetValues("UnitpriceEndTime"); string[] unitprice = Request.Form.GetValues("Unitprice"); string[] unitpriceRemark = Request.Form.GetValues("UnitpriceRemark"); if (unitpriceBeginTime != null && unitpriceEndTime != null && unitprice != null && unitpriceRemark != null && unitpriceBeginTime.Length > 0 && unitpriceEndTime.Length > 0 && unitprice.Length > 0 && unitpriceRemark.Length > 0) { for (int i = 0; i < unitpriceBeginTime.Length; i++) { decimal price; DateTime begintime, endtime; if (string.IsNullOrWhiteSpace(unitpriceBeginTime[i])) { unitpriceBeginTime[i] = DTDateTime.MinDateTime.ToString(); } if (string.IsNullOrWhiteSpace(unitpriceEndTime[i])) { unitpriceEndTime[i] = DTDateTime.MaxDateTime.ToString(); } if (DateTime.TryParse(unitpriceBeginTime[i], out begintime) && DateTime.TryParse(unitpriceEndTime[i], out endtime) && decimal.TryParse(unitprice[i], out price)) { model.AddUnitPrice(new StoreInUnitPrice(begintime, endtime, price, unitpriceRemark[i])); } } } #endregion #region 费用 string[] costName = Request.Form.GetValues("CostName"); string[] costCount = Request.Form.GetValues("CostCount"); string[] costType = Request.Form.GetValues("CostType"); string[] costTotalPrice = Request.Form.GetValues("CostTotalPrice"); string[] costCustomer = Request.Form.GetValues("CostCustomer"); string[] costUnitPrices = Request.Form.GetValues("CostUnitPrice"); if (costName != null && costCount != null && costType != null && costTotalPrice != null && costCustomer != null && costUnitPrices != null && costName.Length > 0 && costCount.Length > 0 && costType.Length > 0 && costTotalPrice.Length > 0 && costCustomer.Length > 0 && costUnitPrices.Length > 0) { for (int i = 0; i < costName.Length; i++) { decimal count, totalPrice, unitPrice; if (decimal.TryParse(costCount[i], out count) && decimal.TryParse(costTotalPrice[i], out totalPrice) && decimal.TryParse(costUnitPrices[i], out unitPrice)) { if (costType[i].ToString().Equals("-")) { totalPrice *= -1; } model.AddStoreInCost(new StoreInCost(costName[i], unitPrice, count, totalPrice, costCustomer[i], "")); } } } #endregion #region 入库货物 string[] storeWaitingGoodsIds = Request.Form.GetValues("StoreWaitingGoodsId"); string[] customerIds = Request.Form.GetValues("CustomerId"); string[] goodsIds = Request.Form.GetValues("GoodsId"); string[] storeIds = Request.Form.GetValues("StoreId"); string[] storeInCounts = Request.Form.GetValues("Count"); string[] storeInGoodsRemark = Request.Form.GetValues("StoreInGoodsRemark"); if (storeWaitingGoodsIds != null && customerIds != null && storeIds != null && storeInCounts != null && storeInGoodsRemark != null && storeWaitingGoodsIds.Length > 0 && customerIds.Length > 0 && storeIds.Length > 0 && storeInCounts.Length > 0 && storeInGoodsRemark.Length > 0) { for (int i = 0; i < storeWaitingGoodsIds.Length; i++) { int storeWaitingGoodsId, customerId, storeId, goodsId; decimal storeInCount; if (int.TryParse(storeWaitingGoodsIds[i], out storeWaitingGoodsId) && int.TryParse(customerIds[i], out customerId) && int.TryParse(storeIds[i], out storeId) && decimal.TryParse(storeInCounts[i], out storeInCount) && int.TryParse(goodsIds[i], out goodsId)) { model.AddStoreInGoods(new StoreInGoods(storeId, storeWaitingGoodsId, customerId, goodsId, storeInCount, storeInGoodsRemark[i])); } } } #endregion if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改入库单信息:" + model.AccountNumber); //记录日志 result = true; } return(result); }