예제 #1
0
        private bool DoAdd()
        {
            bool result = false;

            Model.TransportOrder model = new Model.TransportOrder();
            BLL.TransportOrder   bll   = new BLL.TransportOrder();

            model.Code                     = "No" + DateTime.Now.ToString("yyyyMMddhhmmss");
            model.DispatchTime             = Convert.ToDateTime(txtDispatchTime.Text.Trim());
            model.FactDispatchTime         = model.DispatchTime;
            model.DriverId                 = Convert.ToInt32(ddlDriver.SelectedValue);
            model.CustomerRemarks          = txtCustomerRemarks.Text;
            model.HaulwayRemarks           = txtHaulwayRemarks.Text;
            model.DispatchCount            = Convert.ToDecimal(txtDispatchCount.Text);
            model.FactDispatchCount        = model.DispatchCount;
            model.Weight                   = Convert.ToDecimal(txtWeight.Text);
            model.FactWeight               = model.Weight;
            model.FactTotalPrice           = model.TotalPrice;
            model.CarriageUnitPrice        = Convert.ToDecimal(txtCarriageUnitPrice.Text);
            model.Carriage                 = Convert.ToDecimal(txtCarriage.Text);
            model.FactCarriage             = model.Carriage;
            model.LoadingCapacityRunning   = Convert.ToDecimal(txtLoadingCapacityRunning.Text);
            model.NoLoadingCapacityRunning = Convert.ToDecimal(txtNoLoadingCapacityRunning.Text);
            model.Remarks                  = txtRemarks.Text.Trim();
            model.AddTime                  = DateTime.Now;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加运输单:" + model.Id); //记录日志
                result = true;
            }
            return(result);
        }
예제 #2
0
        private bool DoAdd()
        {
            bool result = false;
            Model.TransportOrder model = new Model.TransportOrder();
            BLL.TransportOrder bll = new BLL.TransportOrder();

            string[] orderIds = Request.Params.GetValues("orderId");
            string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");
            if (orderIds == null)
            {
                JscriptMsg("请填写运输项信息!", "", "Error");
                return false;
            }

            model.Code = "No" + DateTime.Now.ToString("yyyyMMddhhmmss");
            model.DispatchTime = Convert.ToDateTime(txtDispatchTime.Text.Trim());
            model.FactDispatchTime = DateTime.Now;
            model.BackTime = Convert.ToDateTime(txtBackTime.Text.Trim());
            model.FactBackTime = DateTime.Now;
            model.MotorcadeName = ddlMotorcade.SelectedValue;
            model.CarNumber = ddlCarNumber.SelectedValue;
            model.Driver = txtDriver.Text.Trim();
            model.Remarks = txtRemarks.Text.Trim();

            List<Model.TransportOrderItem> item_list = new List<Model.TransportOrderItem>();//运输子项
            List<Model.Order> order_list = new List<Model.Order>();//订单
            BLL.Order orderBll = new BLL.Order();
            for (int i = 0; i < orderIds.Length; i++)
            {
                Model.Order order = orderBll.GetModel(Convert.ToInt32(orderIds[i]));
                if (order != null)
                {
                    Model.TransportOrderItem item = new Model.TransportOrderItem();
                    item.OrderId = order.Id;
                    item.OrderCode = order.Code;
                    item.ContractNumber = order.ContractNumber;
                    item.BillNumber = order.BillNumber;
                    item.Shipper = order.Shipper;
                    item.Receiver = order.Receiver;
                    item.LoadingAddress = order.LoadingAddress;
                    item.UnloadingAddress = order.UnloadingAddress;
                    item.Goods = order.Goods;
                    item.Unit = order.Unit;
                    item.DispatchCount = order.Quantity;
                    item.FactDispatchCount = Convert.ToDecimal(factDispatchCounts[i]);
                    item.FactReceivedCount = item.FactDispatchCount;
                    item.CompensationCosts = 0.00M;
                    item.MyCosts = 0.00m;
                    item.Haulway = order.Haulway;
                    item.LoadingCapacityRunning = order.LoadingCapacityRunning;
                    item.NoLoadingCapacityRunning = order.NoLoadingCapacityRunning;
                    item.Formula = order.Formula;
                    item.UnitPrice = order.UnitPrice;
                    item.TotalPrice = order.TotalPrice;
                    item.CompanyPrice = item.TotalPrice;
                    item_list.Add(item);

                   // int status = (order.IsCharteredCar == 1 || ((order.DispatchedCount + item.FactDispatchCount) == order.Quantity)) ? 1 : 0;
                    //order.Status = status;
                    order.DispatchedCount = order.DispatchedCount + item.FactDispatchCount;
                    order_list.Add(order);
                }
            }
            if (bll.Add(model,item_list,order_list) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加运输单:" + model.Code); //记录日志
                result = true;
            }
            return result;
        }
예제 #3
0
        private bool DoAdd()
        {
            bool result = false;

            Model.TransportOrder model = new Model.TransportOrder();
            BLL.TransportOrder   bll   = new BLL.TransportOrder();

            string[] orderIds           = Request.Params.GetValues("orderId");
            string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");
            if (orderIds == null)
            {
                JscriptMsg("请填写运输项信息!", "", "Error");
                return(false);
            }

            model.Code             = "No" + DateTime.Now.ToString("yyyyMMddhhmmss");
            model.DispatchTime     = Convert.ToDateTime(txtDispatchTime.Text.Trim());
            model.FactDispatchTime = DateTime.Now;
            model.BackTime         = Convert.ToDateTime(txtBackTime.Text.Trim());
            model.FactBackTime     = DateTime.Now;
            model.MotorcadeName    = ddlMotorcade.SelectedValue;
            model.CarNumber        = ddlCarNumber.SelectedValue;
            model.Driver           = txtDriver.Text.Trim();
            model.Remarks          = txtRemarks.Text.Trim();

            List <Model.TransportOrderItem> item_list = new List <Model.TransportOrderItem>(); //运输子项
            List <Model.Order> order_list             = new List <Model.Order>();              //订单

            BLL.Order orderBll = new BLL.Order();
            for (int i = 0; i < orderIds.Length; i++)
            {
                Model.Order order = orderBll.GetModel(Convert.ToInt32(orderIds[i]));
                if (order != null)
                {
                    Model.TransportOrderItem item = new Model.TransportOrderItem();
                    item.OrderId                  = order.Id;
                    item.OrderCode                = order.Code;
                    item.ContractNumber           = order.ContractNumber;
                    item.BillNumber               = order.BillNumber;
                    item.Shipper                  = order.Shipper;
                    item.Receiver                 = order.Receiver;
                    item.LoadingAddress           = order.LoadingAddress;
                    item.UnloadingAddress         = order.UnloadingAddress;
                    item.Goods                    = order.Goods;
                    item.Unit                     = order.Unit;
                    item.DispatchCount            = order.Quantity;
                    item.FactDispatchCount        = Convert.ToDecimal(factDispatchCounts[i]);
                    item.FactReceivedCount        = item.FactDispatchCount;
                    item.CompensationCosts        = 0.00M;
                    item.MyCosts                  = 0.00m;
                    item.Haulway                  = order.Haulway;
                    item.LoadingCapacityRunning   = order.LoadingCapacityRunning;
                    item.NoLoadingCapacityRunning = order.NoLoadingCapacityRunning;
                    item.Formula                  = order.Formula;
                    item.UnitPrice                = order.UnitPrice;
                    item.TotalPrice               = order.TotalPrice;
                    item.CompanyPrice             = item.TotalPrice;
                    item_list.Add(item);

                    // int status = (order.IsCharteredCar == 1 || ((order.DispatchedCount + item.FactDispatchCount) == order.Quantity)) ? 1 : 0;
                    //order.Status = status;
                    order.DispatchedCount = order.DispatchedCount + item.FactDispatchCount;
                    order_list.Add(order);
                }
            }
            if (bll.Add(model, item_list, order_list) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加运输单:" + model.Code); //记录日志
                result = true;
            }
            return(result);
        }
예제 #4
0
        private bool DoAdd()
        {
            bool result = false;
            Model.TransportOrder model = new Model.TransportOrder();
            BLL.TransportOrder bll = new BLL.TransportOrder();

            model.Code = "No" + DateTime.Now.ToString("yyyyMMddhhmmss");
            model.DispatchTime = Convert.ToDateTime(txtDispatchTime.Text.Trim());
            model.FactDispatchTime = model.DispatchTime;
            model.DriverId = Convert.ToInt32(ddlDriver.SelectedValue);
            model.CustomerRemarks = txtCustomerRemarks.Text;
            model.HaulwayRemarks = txtHaulwayRemarks.Text;
            model.DispatchCount = Convert.ToDecimal(txtDispatchCount.Text);
            model.FactDispatchCount = model.DispatchCount;
            model.Weight = Convert.ToDecimal(txtWeight.Text);
            model.FactWeight = model.Weight;
            model.FactTotalPrice = model.TotalPrice;
            model.CarriageUnitPrice = Convert.ToDecimal(txtCarriageUnitPrice.Text);
            model.Carriage = Convert.ToDecimal(txtCarriage.Text);
            model.FactCarriage = model.Carriage;
            model.LoadingCapacityRunning = Convert.ToDecimal(txtLoadingCapacityRunning.Text);
            model.NoLoadingCapacityRunning = Convert.ToDecimal(txtNoLoadingCapacityRunning.Text);
            model.Remarks = txtRemarks.Text.Trim();
            model.AddTime = DateTime.Now;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加运输单:" + model.Id); //记录日志
                result = true;
            }
            return result;
        }