/* * 填充报表头 */ private void FillHead(TransportationOrder transportationOrder) { string shpCode = Utility.BarcodeHelper.GetBarcodeStr(transportationOrder.OrderNo, this.barCodeFontName); //SHP号: this.SetRowCell(2, 8, shpCode); //this.AddPicture //SHP No.: this.SetRowCell(3, 8, transportationOrder.OrderNo); //发出时间 Start Date: this.SetRowCell(4, 9, ((DateTime)transportationOrder.StartDate).ToString("yyyy-MM-dd HH:mm")); //发货地址 Shipping address: this.SetRowCell(6, 3, transportationOrder.TransportationRoute == null || transportationOrder.TransportationRoute.ShipFrom == null ? string.Empty : transportationOrder.TransportationRoute.ShipFrom.FullAddress); //车牌 Vehicle Code: this.SetRowCell(7, 3, transportationOrder.Vehicle == null ? string.Empty : transportationOrder.Vehicle); //车辆类型 Vehicle Type: this.SetRowCell(8, 3, transportationOrder.VehicleType); //司机 Driver: this.SetRowCell(9, 3, string.Empty); //托盘数 Pallent Count: this.SetRowCell(10, 3, transportationOrder.PallentCount.ToString()); //收货地址 Delivery Address: this.SetRowCell(6, 8, transportationOrder.TransportationRoute == null || transportationOrder.TransportationRoute.ShipTo == null ? string.Empty : transportationOrder.TransportationRoute.ShipTo.FullAddress); //承运商 Carrier Name: this.SetRowCell(7, 8, transportationOrder.Carrier == null ? string.Empty : transportationOrder.Carrier.Name); //承运商电话 Carrier Tel: //this.SetRowCell(8, 8, inProcessLocation.ShipTo == null ? string.Empty : inProcessLocation.ShipTo.Address); //承运商联系人 Carrier Contact: //this.SetRowCell(9, 8, inProcessLocation.DockDescription); }
public TransportationOrder CreateTransportationOrder(Expense expense, User user) { #region 初始化订单头 TransportationOrder orderHead = new TransportationOrder(); orderHead.OrderNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_TRANSPORTATION_ORDER); orderHead.Carrier = expense.Carrier; orderHead.Expense = expense; orderHead.Remark = expense.Remark; orderHead.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE; orderHead.CreateDate = DateTime.Now; orderHead.CreateUser = user; orderHead.StartDate = DateTime.Now; orderHead.StartUser = user; orderHead.CompleteDate = DateTime.Now; orderHead.CompleteUser = user; orderHead.LastModifyUser = user; orderHead.LastModifyDate = DateTime.Now; orderHead.IsValuated = false; orderHead.CarrierBillAddress = billAddressMgr.GetDefaultBillAddress(expense.Carrier.Code); if (orderHead.CarrierBillAddress == null) { throw new BusinessErrorException("Transportation.Error.CarrierPrimaryBillAddressEmpty"); } #endregion #region 创建订单 CreateTransportationOrder(orderHead); #endregion #region 计费 ValuateTransportationOrder(orderHead, user); #endregion return(orderHead); }
protected void btnStart_Click(object sender, EventArgs e) { try { RequiredFieldValidator rfvCarrier = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrier")); RequiredFieldValidator rfvCarrierBillAddress = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrierBillAddress")); if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid) { return; } TransportationOrder order = PrepareOrder(); order.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(order); TheTransportationOrderMgr.StartTransportationOrder(this.OrderNo, this.CurrentUser); ShowSuccessMessage("Transportation.TransportationOrder.StartTransportationOrder.Successfully", this.OrderNo); UpdateView(); this.FV_Order.DataBind(); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void btnCheck_Click(object sender, EventArgs e) { try { RequiredFieldValidator rfvCarrier = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrier")); RequiredFieldValidator rfvCarrierBillAddress = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrierBillAddress")); RequiredFieldValidator rfvType = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvType")); RequiredFieldValidator rfvTransportMethod = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvTransportMethod")); //add by ljz //modify by ljz start //if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid || !rfvType.IsValid) if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid || !rfvType.IsValid || !rfvTransportMethod.IsValid) //modify by ljz end { return; } btnSave_Click(sender, e); ShowSuccessMessage("Transportation.TransportationOrder.Checked.Successfully", this.OrderNo); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); order.Status = "Checked"; order.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(order); UpdateView(); this.FV_Order.DataBind(); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
public void TryCompleteTransportationOrder(InProcessLocation ip, User user) { DetachedCriteria criteria = DetachedCriteria.For(typeof(TransportationOrderDetail)); criteria.Add(Expression.Eq("InProcessLocation.IpNo", ip.IpNo)); IList <TransportationOrderDetail> orderDetailList = criteriaMgr.FindAll <TransportationOrderDetail>(criteria); if (orderDetailList != null && orderDetailList.Count > 0) { bool canComplete = true; TransportationOrder order = this.LoadTransportationOrder(orderDetailList[0].TransportationOrder.OrderNo); foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { if (orderDetail.InProcessLocation.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { canComplete = false; break; } } if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS && canComplete) { CompleteTransportationOrder(order, user); } } }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TransportationBillDetail transportationBillDetail = (TransportationBillDetail)e.Row.DataItem; TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(transportationBillDetail.ActBill.OrderNo); if (to != null) { Label lb_createDate = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_createDate");//运输日期 lb_createDate.Text = to.CreateDate.ToString("yyyy-MM-dd") != null?to.CreateDate.ToString("yyyy-MM-dd") : ""; Label lb_route = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_route"); //运输路线 lb_route.Text = to.TransportationRoute != null ? to.TransportationRoute.Description : ""; Label lb_pricingMethod = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_pricingMethod"); //运输方式 lb_pricingMethod.Text = to.PricingMethod != null ? to.PricingMethod : ""; Label lb_OrderNo = (System.Web.UI.WebControls.Label)e.Row.FindControl("lb_OrderNo"); //运单号码 lb_OrderNo.Text = to.OrderNo != null ? to.OrderNo : ""; } TextBox tbAmount = (TextBox)e.Row.FindControl("tbAmount"); tbAmount.Attributes["oldValue"] = tbAmount.Text; TextBox tbQty = (TextBox)e.Row.FindControl("tbQty"); TextBox tbDiscountRate = (TextBox)e.Row.FindControl("tbDiscountRate"); TextBox tbDiscount = (TextBox)e.Row.FindControl("tbDiscount"); if (transportationBillDetail.Bill.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { tbQty.ReadOnly = true; tbAmount.ReadOnly = true; tbDiscountRate.ReadOnly = true; tbDiscount.ReadOnly = true; } /* * * 1.TransType=Transportation 价格单明细(承运商) 或 短拨费(区域)时 * a.PricingMethod=M3或KG 按数量 * b.SHIPT 按金额 * 2.TransType=WarehouseLease(固定费用) 按金额 * 3.TransType=Operation(操作费) 按数量 */ if (transportationBillDetail.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION || (transportationBillDetail.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION && (transportationBillDetail.ActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3 || transportationBillDetail.ActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_KG) ) ) { tbQty.Attributes["onchange"] = "qtyChanged(this);"; tbQty.Attributes["onmouseup"] = "if(!readOnly)select();"; tbAmount.Attributes["onfocus"] = "this.blur();"; } else { tbQty.Attributes["onfocus"] = "this.blur();"; tbAmount.Attributes["onmouseup"] = "if(!readOnly)select();"; } } }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { TransportationOrder order = (TransportationOrder)e.Row.DataItem; ((Label)(e.Row.FindControl("lblShipFrom"))).Text = order.TransportationRoute != null ? order.TransportationRoute.ShipFrom.FullAddress : string.Empty; ((Label)(e.Row.FindControl("lblShipTo"))).Text = order.TransportationRoute != null ? order.TransportationRoute.ShipTo.FullAddress : string.Empty; } }
public override IList <object> GetDataList(string code) { IList <object> list = new List <object>(); TransportationOrder transportationOrder = transportationOrderMgr.LoadTransportationOrder(code, true); if (transportationOrder != null) { list.Add(transportationOrder); list.Add(transportationOrder.OrderDetails); } return(list); }
public TransportationOrder LoadTransportationOrder(String orderNo, bool includeDetail) { TransportationOrder orderHead = this.LoadTransportationOrder(orderNo); if (includeDetail && orderHead != null && orderHead.OrderDetails != null && orderHead.OrderDetails.Count > 0) { foreach (TransportationOrderDetail orderDetail in orderHead.OrderDetails) { } } return(orderHead); }
public void StartTransportationOrder(TransportationOrder order, User user) { if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenStart", order.Status, order.OrderNo); } order.StartDate = DateTime.Now; order.StartUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS; this.UpdateTransportationOrder(order); }
public void CancelTransportationOrder(TransportationOrder order, User user) { if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE || order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenCancel", order.Status, order.OrderNo); } #region 检查开过票的不能取消 IList <TransportationActBill> actBillList = transportationActBillMgr.GetTransportationActBill(order); var i = (from c in actBillList where c.BilledAmount > 0 select c).Count(); #endregion if (i > 0) { throw new BusinessErrorException("TransportationOrder.Error.BillAmountErrorWhenCancel", order.OrderNo); } #region 关闭actbill if (actBillList != null && actBillList.Count > 0) { foreach (TransportationActBill actBill in actBillList) { actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE; actBill.LastModifyDate = DateTime.Now; actBill.LastModifyUser = user; transportationActBillMgr.UpdateTransportationActBill(actBill); } } #endregion #region 除与asn的关联 foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { InProcessLocation ip = orderDetail.InProcessLocation; ip.IsReferenced = false; inProcessLocationMgr.UpdateInProcessLocation(ip); } #endregion #region 更新运单头 order.CancelDate = DateTime.Now; order.CancelUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL; this.UpdateTransportationOrder(order); #endregion }
public void CancelTransportationOrder(TransportationOrder order, User user) { if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE || order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenCancel", order.Status, order.OrderNo); } #region ��鿪��Ʊ�IJ���ȡ�� IList<TransportationActBill> actBillList = transportationActBillMgr.GetTransportationActBill(order); var i = (from c in actBillList where c.BilledAmount > 0 select c).Count(); #endregion if (i > 0) { throw new BusinessErrorException("TransportationOrder.Error.BillAmountErrorWhenCancel", order.OrderNo); } #region �ر�actbill if (actBillList != null && actBillList.Count > 0) { foreach (TransportationActBill actBill in actBillList) { actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE; actBill.LastModifyDate = DateTime.Now; actBill.LastModifyUser = user; transportationActBillMgr.UpdateTransportationActBill(actBill); } } #endregion #region ɾ����asn�Ĺ��� foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { InProcessLocation ip = orderDetail.InProcessLocation; ip.IsReferenced = false; inProcessLocationMgr.UpdateInProcessLocation(ip); } #endregion #region �����˵�ͷ order.CancelDate = DateTime.Now; order.CancelUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL; this.UpdateTransportationOrder(order); #endregion }
protected void btnRestore_Click(object sender, EventArgs e) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo, true); if (to.IsValuated == true) { try { string connstring = getCONN(); string sql = "select * from tactbill where orderno ='" + to.OrderNo + "' and status='Create'"; DataSet ds = SqlHelper.ExecuteDataset(connstring, CommandType.Text, sql); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 0) { ShowErrorMessage("该运单已经开票,无法还原状态!"); } else { string updSql = "update tactbill set status='Close' where id='" + dt.Rows[0]["id"].ToString() + "'"; SqlHelper.ExecuteNonQuery(connstring, CommandType.Text, updSql); to.IsValuated = false; to.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(to); UpdateView(); UpdateViewButton(); ShowSuccessMessage("运单状态还原成功!"); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } catch (Exception ex) { ShowErrorMessage(ex.Message); } } else { ShowSuccessMessage("运单状态还原成功!"); to.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(to); UpdateView(); UpdateViewButton(); } }
protected void btnCancel_Click(object sender, EventArgs e) { try { TheTransportationOrderMgr.CancelTransportationOrder(this.OrderNo, this.CurrentUser); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); order.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(order); ShowSuccessMessage("Transportation.TransportationOrder.CancelTransportationOrder.Successfully", this.OrderNo); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
public void InitPageParameter(string orderNo, bool isEdit) { if (isEdit) { IList <InProcessLocation> ipList = new List <InProcessLocation>(); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(orderNo, true); if (order.OrderDetails != null && order.OrderDetails.Count > 0) { foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { ipList.Add(orderDetail.InProcessLocation); } } this.GV_List.Columns[0].Visible = false; this.GV_List.DataSource = ipList; this.GV_List.DataBind(); } }
public void CloseTransportationOrder(TransportationOrder order, User user) { if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenClose", order.Status, order.OrderNo); } if (!order.IsValuated) { throw new BusinessErrorException("TransportationOrder.Error.IsNotValuatedErrorWhenClose", order.OrderNo); } order.CloseDate = DateTime.Now; order.CloseUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE; this.UpdateTransportationOrder(order); }
private void UpdateView() { TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); bool showInputTxt = false; User currentUser = this.Page.Session["Current_User"] as User; if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { showInputTxt = true; } if (currentUser.HasPermission("btnIPSave")) { showInputTxt = true; } else { showInputTxt = false; } if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { showInputTxt = false; } ((Controls_TextBox)(this.FV_Order.FindControl("tbVehicle"))).Visible = showInputTxt; ((com.Sconit.Control.ReadonlyTextBox)(this.FV_Order.FindControl("tbVehicle1"))).Visible = !showInputTxt; ((Controls_TextBox)(this.FV_Order.FindControl("tbExpense"))).Visible = showInputTxt; ((com.Sconit.Control.ReadonlyTextBox)(this.FV_Order.FindControl("tbExpense1"))).Visible = !showInputTxt; ((Controls_TextBox)(this.FV_Order.FindControl("tbCarrier"))).Visible = showInputTxt && order.Expense == null; ((TextBox)(this.FV_Order.FindControl("tbCarrier1"))).Visible = !showInputTxt || order.Expense != null; ((Controls_TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress"))).Visible = showInputTxt; ((TextBox)(this.FV_Order.FindControl("tbCarrierBillAddress1"))).Visible = !showInputTxt; ((com.Sconit.Control.CodeMstrDropDownList)(this.FV_Order.FindControl("ddlPricingMethod"))).Enabled = showInputTxt; ((DropDownList)(this.FV_Order.FindControl("ddlType"))).Enabled = showInputTxt; ((TextBox)(this.FV_Order.FindControl("tbDriver"))).ReadOnly = !showInputTxt; ((TextBox)(this.FV_Order.FindControl("tbPallentCount"))).ReadOnly = !showInputTxt; ((CheckBox)(this.FV_Order.FindControl("IsExcess"))).Checked = order.ReferencePallentCount == 1?true:false; if (order.Status == "Cancel" || order.Status == "Complete") { ((TextBox)(this.FV_Order.FindControl("tbRemark"))).ReadOnly = true; ((CheckBox)(this.FV_Order.FindControl("IsExcess"))).Enabled = false; } }
protected void btnConfirm_Click(object sender, EventArgs e) { try { IList <InProcessLocation> ipList = this.ucList.PopulateInProcessLocationList(); if (ipList.Count == 0) { ShowErrorMessage("TransportationOrder.Error.DetailEmpty"); return; } TransportationOrder order = TheTransportationOrderMgr.CreateTransportationOrder(this.tbRoute.Text.Trim(), ipList, this.CurrentUser); if (CreateEvent != null) { CreateEvent(order.OrderNo, e); } } catch (BusinessErrorException ex) { this.ShowErrorMessage(ex); } }
public TransportationOrder CreateTransportationOrder(string route, IList <InProcessLocation> ipList, User user) { if (ipList == null || ipList.Count == 0) { throw new BusinessErrorException("TransportationOrder.Error.DetailEmpty"); } #region 初始化订单头 TransportationOrder orderHead = new TransportationOrder(); orderHead.OrderNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_TRANSPORTATION_ORDER); orderHead.TransportationRoute = transportationRouteMgr.LoadTransportationRoute(route); orderHead.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; orderHead.CreateDate = DateTime.Now; orderHead.CreateUser = user; orderHead.LastModifyUser = user; orderHead.LastModifyDate = DateTime.Now; #endregion #region 创建订单 CreateTransportationOrder(orderHead); #endregion #region 创建OrderDetail foreach (InProcessLocation ip in ipList) { TransportationOrderDetail orderDetail = new TransportationOrderDetail(); orderDetail.InProcessLocation = ip; orderDetail.TransportationOrder = orderHead; transportationOrderDetailMgr.CreateTransportationOrderDetail(orderDetail); //更新ip ip.IsReferenced = true; inProcessLocationMgr.UpdateInProcessLocation(ip); } #endregion return(orderHead); }
protected void lbtnCreate_Click(object sender, EventArgs e) { string code = ((LinkButton)sender).CommandArgument; try { Expense ex = TheExpenseMgr.LoadExpense(code); string s_remark = ex.Remark; string[] remarks = ex.Remark.Split(new char[] { ';' }); ex.Remark = ""; ex.LastModifyUser = this.CurrentUser; ex.LastModifyDate = DateTime.Now; TheExpenseMgr.UpdateExpense(ex); TransportationOrder transportationOrder = TheTransportationOrderMgr.CreateTransportationOrder(code, this.CurrentUser); foreach (string s in remarks) { if (s.Split(new char[] { ':' })[0] == "PriceMethod") { transportationOrder.PricingMethod = s.Split(new char[] { ':' })[1]; } if (s.Split(new char[] { ':' })[0] == "VehicleType") { transportationOrder.VehicleType = s.Split(new char[] { ':' })[1]; } } ex.Remark = ex.Code; ex.Remark += s_remark; TheExpenseMgr.UpdateExpense(ex); transportationOrder.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE; TheTransportationOrderMgr.UpdateTransportationOrder(transportationOrder); ShowSuccessMessage("Transportation.TransportationOrder.AddTransportationOrder.Successfully", transportationOrder.OrderNo); UpdateView(); } catch { ShowErrorMessage("Transportation.TransportationOrder.AddTransportationOrder.Fail"); } }
protected void btnComplete_Click(object sender, EventArgs e) { try { ds = needCaluate(); if (onlyWSNFlag == false) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo); to.Status = "In-Process"; to.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(to); TheTransportationOrderMgr.CompleteTransportationOrder(this.OrderNo, this.CurrentUser); } else { createTBill(); TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo); to.Status = "Complete"; to.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(to); } if (ds != null)//djin { Caluate(); } ShowSuccessMessage("Transportation.TransportationOrder.CompleteTransportationOrder.Successfully", this.OrderNo); if (ds != null) { Restore(ds); } UpdateViewButton(); } catch (BusinessErrorException ex) { Restore(ds); ShowErrorMessage(ex); } }
public IList<TransportationOrder> PopulateSelectedData() { if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0) { IList<TransportationOrder> transportationOrderList = new List<TransportationOrder>(); foreach (GridViewRow row in this.GV_List.Rows) { CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox; if (checkBoxGroup.Checked) { HiddenField hfOrderNo = row.FindControl("hfOrderNo") as HiddenField; TransportationOrder transportationOrder = new TransportationOrder(); transportationOrder.OrderNo = hfOrderNo.Value; transportationOrderList.Add(transportationOrder); } } return transportationOrderList; } return null; }
public IList <TransportationOrder> PopulateSelectedData() { if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0) { IList <TransportationOrder> transportationOrderList = new List <TransportationOrder>(); foreach (GridViewRow row in this.GV_List.Rows) { CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox; if (checkBoxGroup.Checked) { HiddenField hfOrderNo = row.FindControl("hfOrderNo") as HiddenField; TransportationOrder transportationOrder = new TransportationOrder(); transportationOrder.OrderNo = hfOrderNo.Value; transportationOrderList.Add(transportationOrder); } } return(transportationOrderList); } return(null); }
public void CompleteTransportationOrder(TransportationOrder order, User user) { if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenComplete", order.Status, order.OrderNo); } order.CompleteDate = DateTime.Now; order.CompleteUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE; this.UpdateTransportationOrder(order); #region 完成时自动计价 bool isAutoValuate = bool.Parse(entityPreferenceMgr.LoadEntityPreference( BusinessConstants.ENTITY_PREFERENCE_CODE_VALUATE_WHEN_COMPLETE).Value); if (isAutoValuate && !order.IsValuated) { ValuateTransportationOrder(order, user); } #endregion }
public void ValuateTransportationOrder(TransportationOrder order, User user) { order = this.LoadTransportationOrder(order.OrderNo, true); if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenValuate", order.Status, order.OrderNo); } if (order.IsValuated) { return; } #region 计费 transportationActBillMgr.CreateTransportationActBill(order, user); #endregion #region 更新费用单 if (order.Expense != null) { Expense expense = order.Expense; expense.IsReferenced = true; expense.LastModifyDate = DateTime.Now; expense.LastModifyUser = user; expenseMgr.UpdateExpense(expense); } #endregion #region 更新运单 order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.IsValuated = true; this.UpdateTransportationOrder(order); #endregion }
public virtual void DeleteTransportationOrder(TransportationOrder entity) { Delete(entity); }
/* * 填充报表头 */ private void FillHead(TransportationOrder transportationOrder) { string shpCode = Utility.BarcodeHelper.GetBarcodeStr(transportationOrder.OrderNo, this.barCodeFontName); //SHP号: this.SetRowCell(2, 8, shpCode); //this.AddPicture //SHP No.: this.SetRowCell(3, 8, transportationOrder.OrderNo); //发出时间 Start Date: this.SetRowCell(4, 9, ((DateTime)transportationOrder.StartDate).ToString("yyyy-MM-dd HH:mm")); //发货地址 Shipping address: this.SetRowCell(6, 3, transportationOrder.TransportationRoute == null || transportationOrder.TransportationRoute.ShipFrom == null ? string.Empty : transportationOrder.TransportationRoute.ShipFrom.FullAddress); //车牌 Vehicle Code: this.SetRowCell(7, 3, transportationOrder.Vehicle == null ? string.Empty : transportationOrder.Vehicle); //车辆类型 Vehicle Type: this.SetRowCell(8, 3, transportationOrder.VehicleType); //司机 Driver: this.SetRowCell(9, 3, string.Empty ); //托盘数 Pallent Count: this.SetRowCell(10, 3, transportationOrder.PallentCount.ToString()); //收货地址 Delivery Address: this.SetRowCell(6, 8, transportationOrder.TransportationRoute == null || transportationOrder.TransportationRoute.ShipTo == null ? string.Empty : transportationOrder.TransportationRoute.ShipTo.FullAddress); //承运商 Carrier Name: this.SetRowCell(7, 8, transportationOrder.Carrier == null ? string.Empty : transportationOrder.Carrier.Name); //承运商电话 Carrier Tel: //this.SetRowCell(8, 8, inProcessLocation.ShipTo == null ? string.Empty : inProcessLocation.ShipTo.Address); //承运商联系人 Carrier Contact: //this.SetRowCell(9, 8, inProcessLocation.DockDescription); }
public void CancelTransportationOrder(TransportationOrder order, string userCode) { CancelTransportationOrder(order, userMgr.CheckAndLoadUser(userCode)); }
public void ValuateTransportationOrder(TransportationOrder order, User user) { order = this.LoadTransportationOrder(order.OrderNo, true); if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenValuate", order.Status, order.OrderNo); } if (order.IsValuated) { return; } #region �Ʒ� transportationActBillMgr.CreateTransportationActBill(order, user); #endregion #region ���·��õ� if (order.Expense != null) { Expense expense = order.Expense; expense.IsReferenced = true; expense.LastModifyDate = DateTime.Now; expense.LastModifyUser = user; expenseMgr.UpdateExpense(expense); } #endregion #region �����˵� order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.IsValuated = true; this.UpdateTransportationOrder(order); #endregion }
public void ValuateTransportationOrder(TransportationOrder order, string userCode) { ValuateTransportationOrder(order, userMgr.CheckAndLoadUser(userCode)); }
public void StartTransportationOrder(TransportationOrder order, User user) { if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenStart", order.Status, order.OrderNo); } order.StartDate = DateTime.Now; order.StartUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS; this.UpdateTransportationOrder(order); }
public void CancelTransportationOrder(TransportationOrder order, string userCode) { CancelTransportationOrder(order, userMgr.CheckAndLoadUser(userCode)); }
protected void CostCenterCal() { CostString = string.Empty; ErrorString = string.Empty; // string billno = ((com.Sconit.Control.ReadonlyTextBox)(FV_TransportationBill.FindControl("tbBillNo"))).Text; string billno = this.BillNo; if (billno != string.Empty) { #region Sql语句 StringBuilder cc = new StringBuilder(); cc.Append("select c.orderno,sum(vol) as V,plant,tactbill.billedqty*tactbill.unitprice as cost1,min(tbilldet.amount) as cost from " + "(select a.orderno,orderdet.packvol,qty,orderdet.packvol*qty as vol,item.plant from (" + "select orderloctransid,ipdet.ipno,sum(abs(qty)) as QTY ,orderno " + "from torderdet join ipdet on torderdet.ipno=ipdet.ipno " + "where orderno in(" + "select tordermstr.orderno from tactbill " + "left join tordermstr on tactbill.orderno=tordermstr.orderno " + "where id in(" + "select distinct transid from tbillmstr join tbilldet on tbillmstr.billno=tbilldet.billno "); cc.Append( "where tbillmstr.billno='" + billno + "'))" + "group by orderloctransid,ipdet.ipno,orderno ) a " + "left join orderloctrans on a.orderloctransid=id " + "left join orderdet on orderdet.id=orderloctrans.orderdetid " + "left join item on item.code=orderdet.item " + ") c left join tactbill on c.orderno=tactbill.orderno left join tbilldet on transid=tactbill.id and tbilldet.billno='" + billno + "' " + "group by c.orderno,plant,tactbill.billedqty,tactbill.unitprice,tactbill.id " + " having min(tbilldet.amount) is not null " + "order by c.orderno"); #endregion string sql = cc.ToString(); XmlTextReader reader = new XmlTextReader(Server.MapPath("Config/properties.config")); XmlDocument doc = new XmlDocument(); doc.Load(reader); // reader.Close(); // string ConnString = doc.SelectSingleNode("/configuration/properties/connectionString").InnerText.Trim(); DataSet result = SqlHelper.ExecuteDataset(ConnString, CommandType.Text, sql); Dictionary <string, decimal> orderTotal = new Dictionary <string, decimal>(); Dictionary <string, decimal> plantcost = new Dictionary <string, decimal>(); Dictionary <string, string> error = new Dictionary <string, string>(); Dictionary <string, string> noplant = new Dictionary <string, string>(); // Dictionary<string, decimal> lxcost = new Dictionary<string, decimal>(); Dictionary <string, string> filter = new Dictionary <string, string>(); #region 处理常规的 foreach (DataRow i in result.Tables[0].Rows) { if (error.ContainsKey(i["orderno"].ToString()) || noplant.ContainsKey(i["orderno"].ToString())) { continue; } if (i["V"].ToString() == "") { error.Add(i["orderno"].ToString(), ""); continue; } if (i["plant"].ToString() == "") { noplant.Add(i["orderno"].ToString(), ""); continue; } if (orderTotal.ContainsKey(i["orderno"].ToString()) == false) { orderTotal.Add(i["orderno"].ToString(), decimal.Parse(i["V"].ToString())); } else { orderTotal[i["orderno"].ToString()] = orderTotal[i["orderno"].ToString()] + decimal.Parse(i["V"].ToString()); } } foreach (DataRow i in result.Tables[0].Rows) { if (error.ContainsKey(i["orderno"].ToString()) || noplant.ContainsKey(i["orderno"].ToString())) { continue; } decimal cost = decimal.Parse(i["V"].ToString()) / orderTotal[i["orderno"].ToString()] * decimal.Parse(i["cost"].ToString()); cost = Math.Round(cost, 2); if (plantcost.ContainsKey(mappingCC(i["plant"].ToString())) == false) { plantcost.Add(mappingCC(i["plant"].ToString()), cost); } else { plantcost[mappingCC(i["plant"].ToString())] = plantcost[mappingCC(i["plant"].ToString())] + cost; } } #endregion #region 零星运单 StringBuilder lxsb = new StringBuilder(); lxsb.Append("select tordermstr.orderno,torderdet.ipno,expense from tordermstr left join torderdet on tordermstr.orderno=torderdet.orderno " + "where tordermstr.orderno in (" + "select distinct tordermstr.orderno from tactbill " + "left join tordermstr on tactbill.orderno=tordermstr.orderno " + "where id in( " + "select distinct transid from tbillmstr join tbilldet on tbillmstr.billno=tbilldet.billno " + "where tbillmstr.billno='" + billno + "')) " + "and (left(ipno,1)='W' or expense is not null)"); string lxsql = lxsb.ToString(); DataSet lxdt = SqlHelper.ExecuteDataset(ConnString, CommandType.Text, lxsql); foreach (DataRow r in lxdt.Tables[0].Rows) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(r["orderno"].ToString(), true); IList <TransportationOrderDetail> tods = to.OrderDetails; if (tods.Count == 0) { string wfcon = @"Data Source=192.168.210.190\SQL2005;Initial Catalog=EPROCESS;Persist Security Info=true;User ID=sa;PWD=temp100;Packet Size=4096;"; string sqltext = "select esportran_costsrc+'_'+cast(esportran_totalcost as nvarchar(50)) from dbo.eSporadicTran_mstr where esportran_nbr='" + r["expense"].ToString() + "'"; SqlConnection con = new SqlConnection(wfcon); SqlCommand cmd = new SqlCommand(sqltext, con); object obj = null; try { con.Open(); obj = cmd.ExecuteScalar(); con.Close(); } catch { con.Close(); } if (obj != null) { string _obj = obj.ToString(); if (_obj.StartsWith("AR")) { string obj_cc = _obj.Split(new char[] { '_' })[0].Substring(3); decimal cost = decimal.Parse(_obj.Split(new char[] { '_' })[1]); if (plantcost.ContainsKey(obj_cc)) { plantcost[obj_cc] = plantcost[obj_cc] + Math.Round(cost, 2); } else { plantcost.Add(obj_cc, Math.Round(cost, 2)); } } if (_obj.StartsWith("CC")) { string obj_cc = mappingCC(_obj.Substring(3, 4)).Trim(); decimal cost = decimal.Parse(_obj.Split(new char[] { '_' })[1]); if (plantcost.ContainsKey(obj_cc)) { plantcost[obj_cc] = plantcost[obj_cc] + Math.Round(cost, 2); } else { plantcost.Add(obj_cc, Math.Round(cost, 2)); } } } continue; } #endregion if (tods != null) { var l = (from i in tods where i.InProcessLocation.IpNo.Substring(0, 1) == "W" select i).ToList(); if (l != null && l.Count == tods.Count) { if (filter.ContainsKey(r["orderno"].ToString()) == true) { continue; } filter.Add(r["orderno"].ToString(), r["ipno"].ToString()); InProcessLocation ip = TheInProcessLocationMgr.LoadInProcessLocation(r["ipno"].ToString()); string orderAmountsql = "select top 1 BilledAmount from tactbill where orderno='" + r["orderno"].ToString() + "' order by lastmodifydate desc ";//and status='Close' SqlConnection ordercon = new SqlConnection(ConnString); SqlCommand ordercmd = new SqlCommand(orderAmountsql, ordercon); object amount = null; try { ordercon.Open(); amount = ordercmd.ExecuteScalar(); ordercon.Close(); } catch { ordercon.Close(); } string ip_cc = mappingCC(ip.HuTemplate); if (amount != null) { if (plantcost.ContainsKey(ip_cc)) { plantcost[ip_cc] = plantcost[ip_cc] + Math.Round(decimal.Parse(amount.ToString()), 2); } else { plantcost.Add(ip_cc, Math.Round(decimal.Parse(amount.ToString()), 2)); } } } } } var disacct = TheCarrierMgr.LoadCarrier(TheTransportationBillMgr.LoadTransportationBill(BillNo).BillAddress.Party.Code).TradeTerm; int di = 0; if (string.IsNullOrEmpty(disacct)) { disacct = "0"; } foreach (KeyValuePair <string, decimal> key in plantcost) { decimal tax = 0; if (disacct.StartsWith("$")) { tax = Math.Round(key.Value / (1 + decimal.Parse(disacct.Substring(1)) * (decimal)0.01) * decimal.Parse(disacct.Substring(1)) * (decimal)0.01, 2); } else { tax = Math.Round(key.Value * (decimal.Parse(disacct) * (decimal)0.01), 2); } decimal outTax = key.Value - tax; TaxTotal += tax; OutTaxTotal += outTax; if (di % 2 == 0) { CostString += "<tr style='background-color:white;text-align:center'><td>" + key.Key + "</td><td>" + mappingAcc(key.Key) + "</td><td>" + outTax + "</td><td>" + tax + "</td></tr>"; } if (di % 2 == 1) { CostString += "<tr style='background-color:#DAD6C5;text-align:center'><td>" + key.Key + "</td><td>" + mappingAcc(key.Key) + "</td><td>" + outTax + "</td><td>" + tax + "</td></tr>"; } // CostString += key.Key + ":" + key.Value + "<br/>"; di++; } if (error.Count > 0) { ErrorString = "以下运单货物存在未设置体积不予计算:<br/>"; } foreach (KeyValuePair <string, string> key in error) { ErrorString += key.Key + "<br/>"; } if (noplant.Count > 0) { ErrorString += "以下运单中含有为设置工厂的零件不予计算:<br/>"; } foreach (KeyValuePair <string, string> key in noplant) { ErrorString += key.Key + "<br/>"; } } }
public virtual void UpdateTransportationOrder(TransportationOrder entity) { entityDao.UpdateTransportationOrder(entity); }
public virtual void CreateTransportationOrder(TransportationOrder entity) { Create(entity); }
public IList<TransportationActBill> GetTransportationActBill(TransportationOrder order) { return GetTransportationActBill(order.OrderNo); }
public void ValuateTransportationOrder(TransportationOrder order, string userCode) { ValuateTransportationOrder(order, userMgr.CheckAndLoadUser(userCode)); }
public TransportationActBill CreateTransportationActBill(TransportationOrder order, User user) { TransportationActBill actBill = new TransportationActBill(); if (order.Expense != null) { actBill.BillAmount = order.Expense.Amount; actBill.UnitPrice = order.Expense.Amount; actBill.BillQty = 1; actBill.Currency = order.Expense.Currency; actBill.IsIncludeTax = order.Expense.IsIncludeTax; actBill.Currency.Code = order.Expense.Currency.Code; actBill.IsProvisionalEstimate = false; } else { string currency = null; foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { #region currency if (orderDetail.InProcessLocation.Flow.Currency == null) { throw new BusinessErrorException("Transportation.Flow.CurrencyEmpty", orderDetail.InProcessLocation.Flow.Code); } if (currency == null) { currency = orderDetail.InProcessLocation.Flow.Currency.Code; } else if (currency != orderDetail.InProcessLocation.Flow.Currency.Code) { throw new BusinessErrorException("Transportation.OrderDetail.CurrencyNotEqual"); } #endregion } IList<TransportPriceList> transportPriceList = transportPriceListMgr.GetTransportPriceList(order.Carrier.Code); if (transportPriceList == null || transportPriceList.Count == 0) { throw new BusinessErrorException("Transportation.PriceList.Empty", order.Carrier.Code); } if (transportPriceList.Count > 1) { throw new BusinessErrorException("Transportation.PriceList.MoreThanOne", order.Carrier.Code); } TransportPriceListDetail priceListDetail = null; if (order.PricingMethod != BusinessConstants.TRANSPORTATION_PRICING_METHOD_LADDERSTERE) { priceListDetail = this.transportPriceListDetailMgr.GetLastestTransportPriceListDetail(transportPriceList[0] , order.CreateDate, currencyMgr.LoadCurrency(currency), order.PricingMethod, order.TransportationRoute.ShipFrom, order.TransportationRoute.ShipTo, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION, order.VehicleType,order.TransportMethod); } #region ���� if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_SHIPT) { actBill.BillQty = 1; if (priceListDetail != null && actBill.UnitPrice == 0) { actBill.UnitPrice = priceListDetail.UnitPrice; actBill.BillAmount = actBill.UnitPrice * actBill.BillQty; } } #endregion #region ����ͽ��� else if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3 || order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_LADDERSTERE) { decimal totalVolume = 0; foreach (TransportationOrderDetail orderDetail in order.OrderDetails) { foreach (InProcessLocationDetail ipDet in orderDetail.InProcessLocation.InProcessLocationDetails) { if (!ipDet.OrderLocationTransaction.OrderDetail.PackageVolumn.HasValue || ipDet.OrderLocationTransaction.OrderDetail.PackageVolumn.Value == 0) { throw new BusinessErrorException("Transportation.PackageVolumn.Empty", ipDet.InProcessLocation.IpNo, ipDet.OrderLocationTransaction.Item.Code); } else { if (ipDet.OrderLocationTransaction.OrderDetail.HuLotSize == null || ipDet.OrderLocationTransaction.OrderDetail.HuLotSize.Value == 0) { throw new BusinessErrorException("Transportation.HuLotSize.Empty", ipDet.InProcessLocation.IpNo, ipDet.OrderLocationTransaction.Item.Code); } int box = Convert.ToInt32(Math.Ceiling(ipDet.Qty / (decimal)(ipDet.OrderLocationTransaction.OrderDetail.HuLotSize.Value))); totalVolume += ipDet.OrderLocationTransaction.OrderDetail.PackageVolumn.Value * box; } } } #region ������ if (order.PallentCount != 0) { decimal pallentVolume = decimal.Parse(entityPreferenceMgr.LoadEntityPreference( BusinessConstants.ENTITY_PREFERENCE_CODE_PALLENTVOLUME).Value); totalVolume += pallentVolume * order.PallentCount; } #endregion if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3) { #region ��С������ if (totalVolume < priceListDetail.MinVolume) { totalVolume = priceListDetail.MinVolume; } #endregion actBill.BillQty = totalVolume; if (priceListDetail != null && actBill.UnitPrice == 0) { actBill.UnitPrice = priceListDetail.UnitPrice; } actBill.BillAmount = actBill.UnitPrice * actBill.BillQty; } #region ���� else if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_LADDERSTERE) { priceListDetail = this.transportPriceListDetailMgr.GetLastestLadderStereTransportPriceListDetail(transportPriceList[0], null, order.CreateDate, currencyMgr.LoadCurrency(currency), null, order.PricingMethod, order.TransportationRoute.ShipFrom, order.TransportationRoute.ShipTo, BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION, null, order.VehicleType, totalVolume); if (priceListDetail == null) { throw new BusinessErrorException("Transportation.PriceListDetail.Empty", order.PricingMethod); } #region ��С������ if (totalVolume < priceListDetail.MinVolume) { totalVolume = priceListDetail.MinVolume; } #endregion actBill.UnitPrice = priceListDetail.UnitPrice; actBill.BillQty = totalVolume; decimal minPrice = priceListDetail.MinPrice.HasValue ? priceListDetail.MinPrice.Value : 0; actBill.BillAmount = minPrice + actBill.UnitPrice * actBill.BillQty; } #endregion } #endregion #region ���� else if (order.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_KG) { } #endregion else { throw new BusinessErrorException("Transportation.PricingMethod.Empty"); } actBill.UnitPrice = priceListDetail.UnitPrice; // actBill.BillAmount = actBill.UnitPrice * actBill.BillQty; actBill.Currency = priceListDetail.Currency; actBill.IsIncludeTax = priceListDetail.IsIncludeTax; actBill.Currency = priceListDetail.Currency; actBill.IsProvisionalEstimate = priceListDetail.IsProvisionalEstimate; actBill.PricingMethod = order.PricingMethod; actBill.PriceList = priceListDetail.TransportPriceList; actBill.PriceListDetail = priceListDetail; actBill.VehicleType = priceListDetail.VehicleType; if (order.TransportationRoute != null) { actBill.ShipFrom = order.TransportationRoute.ShipFrom; actBill.ShipTo = order.TransportationRoute.ShipTo; } } actBill.OrderNo = order.OrderNo; actBill.BillAddress = order.CarrierBillAddress; actBill.EffectiveDate = DateTime.Parse(order.CreateDate.ToString("yyyy-MM-dd")); actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; actBill.TransType = BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION; actBill.CreateDate = DateTime.Now; actBill.CreateUser = user; actBill.LastModifyDate = DateTime.Now; actBill.LastModifyUser = user; actBill.TransportMethod = order.TransportMethod; this.CreateTransportationActBill(actBill); return actBill; }
public virtual void UpdateTransportationOrder(TransportationOrder entity) { Update(entity); }
public void CloseTransportationOrder(TransportationOrder order, User user) { if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenClose", order.Status, order.OrderNo); } if (!order.IsValuated) { throw new BusinessErrorException("TransportationOrder.Error.IsNotValuatedErrorWhenClose", order.OrderNo); } order.CloseDate = DateTime.Now; order.CloseUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE; this.UpdateTransportationOrder(order); }
public virtual void DeleteTransportationOrder(TransportationOrder entity) { entityDao.DeleteTransportationOrder(entity); }
public void CompleteTransportationOrder(TransportationOrder order, User user) { if (order.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS) { throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenComplete", order.Status, order.OrderNo); } order.CompleteDate = DateTime.Now; order.CompleteUser = user; order.LastModifyDate = DateTime.Now; order.LastModifyUser = user; order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE; this.UpdateTransportationOrder(order); #region ���ʱ�Զ��Ƽ� bool isAutoValuate = bool.Parse(entityPreferenceMgr.LoadEntityPreference( BusinessConstants.ENTITY_PREFERENCE_CODE_VALUATE_WHEN_COMPLETE).Value); if (isAutoValuate && !order.IsValuated) { ValuateTransportationOrder(order, user); } #endregion }
public TransportationOrder CreateTransportationOrder(string route, IList<InProcessLocation> ipList, User user) { if (ipList == null || ipList.Count == 0) { throw new BusinessErrorException("TransportationOrder.Error.DetailEmpty"); } #region ��ʼ������ͷ TransportationOrder orderHead = new TransportationOrder(); orderHead.OrderNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_TRANSPORTATION_ORDER); orderHead.TransportationRoute = transportationRouteMgr.LoadTransportationRoute(route); orderHead.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; orderHead.CreateDate = DateTime.Now; orderHead.CreateUser = user; orderHead.LastModifyUser = user; orderHead.LastModifyDate = DateTime.Now; #endregion #region �������� CreateTransportationOrder(orderHead); #endregion #region ����OrderDetail foreach (InProcessLocation ip in ipList) { TransportationOrderDetail orderDetail = new TransportationOrderDetail(); orderDetail.InProcessLocation = ip; orderDetail.TransportationOrder = orderHead; transportationOrderDetailMgr.CreateTransportationOrderDetail(orderDetail); //����ip ip.IsReferenced = true; inProcessLocationMgr.UpdateInProcessLocation(ip); } #endregion return orderHead; }
public TransportationOrder CreateTransportationOrder(Expense expense, User user) { #region ��ʼ������ͷ TransportationOrder orderHead = new TransportationOrder(); orderHead.OrderNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_TRANSPORTATION_ORDER); orderHead.Carrier = expense.Carrier; orderHead.Expense = expense; orderHead.Remark = expense.Remark; orderHead.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE; orderHead.CreateDate = DateTime.Now; orderHead.CreateUser = user; orderHead.StartDate = DateTime.Now; orderHead.StartUser = user; orderHead.CompleteDate = DateTime.Now; orderHead.CompleteUser = user; orderHead.LastModifyUser = user; orderHead.LastModifyDate = DateTime.Now; orderHead.IsValuated = false; orderHead.CarrierBillAddress = billAddressMgr.GetDefaultBillAddress(expense.Carrier.Code); if (orderHead.CarrierBillAddress == null) { throw new BusinessErrorException("Transportation.Error.CarrierPrimaryBillAddressEmpty"); } #endregion #region �������� CreateTransportationOrder(orderHead); #endregion #region �Ʒ� ValuateTransportationOrder(orderHead, user); #endregion return orderHead; }
/// <summary> /// 金董春:添加打印功能,添加了TransportationBill.xls模板打印功能 2012-5-28 /// </summary> /// <param name="list"></param> /// <returns></returns> public string WriteToFile(IList <object> list) { string path = Server.MapPath(".") + @"\Reports\Templates\YFKExcelTemplates\TransportationBill.xls"; if (File.Exists(path)) { TransportationBill tb = (TransportationBill)list[0]; string filename = @"/Reports/Templates/TempFiles/temp_" + DateTime.Now.ToString("yyyyMMddhhmmss") + tb.BillNo + ".xls"; string _wpath = Server.MapPath(".") + filename; File.Copy(path, _wpath); FileStream file = new FileStream(_wpath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read); HSSFWorkbook hssfworkbook = new HSSFWorkbook(file); Sheet sheet = hssfworkbook.GetSheet("sheet1"); NPOI.SS.UserModel.CellStyle normalStyle = setCellstyle(hssfworkbook, new string[] { "Border", "Center" }); NPOI.SS.UserModel.CellStyle dateStyle = setCellstyle(hssfworkbook, new string[] { "Border", "Center", "DateTime" }); Cell cell = sheet.GetRow(2).GetCell(1); cell.SetCellValue(tb.BillNo); cell = sheet.GetRow(2).GetCell(6); cell.SetCellValue(tb.ReferenceBillNo); cell = sheet.GetRow(3).GetCell(1); cell.SetCellValue(tb.Status); int i = 10; decimal cnt = 0; foreach (TransportationBillDetail tbd in tb.TransportationBillDetails) { Row row = sheet.CreateRow(i); TransportationOrder tord = TheTransportationOrderMgr.LoadTransportationOrder(tbd.ActBill.OrderNo); row.CreateCell(0).SetCellValue(tord.CreateDate); //运输日期 row.CreateCell(1).SetCellValue(tord.TransportationRoute != null ? tord.TransportationRoute.Description : ""); //运输路线 row.CreateCell(2).SetCellValue(tbd.ActBill.PricingMethod != null ? tbd.ActBill.PricingMethod : ""); //运输形式 row.CreateCell(3).SetCellValue(tord.OrderNo); //运单号码 row.CreateCell(4).SetCellValue(tbd.ActBill.EffectiveDate); //生效日期 row.CreateCell(5).SetCellValue(tbd.ActBill.UnitPrice.ToString("F2")); //单价 row.CreateCell(6).SetCellValue(tbd.ActBill.Currency.Name); //币种 row.CreateCell(7).SetCellValue(tbd.ActBill.BillQty.ToString("F0")); //开票数 row.CreateCell(8).SetCellValue(tbd.ActBill.BillAmount.ToString("F2")); //金额 cnt = Convert.ToInt32(tbd.ActBill.BillAmount) + cnt; for (int y = 0; y < 9; y++) { row.GetCell(y).CellStyle = normalStyle; } row.GetCell(0).CellStyle = dateStyle; row.GetCell(4).CellStyle = dateStyle; i++; } if (i <= 20) { for (int j = i; j < 21; j++) { Row row = sheet.CreateRow(j); for (int y = 0; y < 9; y++) { row.CreateCell(y).CellStyle = normalStyle; } } i = 20; } Row _row = sheet.CreateRow(i + 1); sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(i + 1, i + 1, 6, 7)); _row.CreateCell(6).SetCellValue("合计发票金额:"); _row.GetCell(6).CellStyle.Alignment = HorizontalAlignment.RIGHT; _row.CreateCell(8).SetCellValue(cnt.ToString("F2")); MemoryStream ms = new MemoryStream(); hssfworkbook.Write(ms); // Response.AddHeader("Content-Disposition", string.Format("attachment;filename=TempWorkBook.xls")); // Response.BinaryWrite(ms.ToArray());Reports/Templates/TempFiles FileStream f = new FileStream(_wpath, FileMode.Open, FileAccess.Write); byte[] data = ms.ToArray(); f.Write(data, 0, data.Length); f.Close(); f.Dispose(); hssfworkbook = null; ms.Close(); ms.Dispose(); return("http://" + Request.Url.Authority + filename); } return(""); }
public virtual void CreateTransportationOrder(TransportationOrder entity) { Create(entity); }