Ejemplo n.º 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);
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            labCode.Text             = model.Code;
            labFactDispatchTime.Text = model.FactDispatchTime.Value.ToString("yyyy-MM-dd");
            labMotorcadeName.Text    = model.MotorcadeName;
            labCarNumber.Text        = model.CarNumber;
            labDriver.Text           = model.Driver;
            labPayee.Text            = model.Payee;
            labAdvance.Text          = model.Advance.ToString();

            BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem();
            DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">";
                transportOrderItems += "<td></td>";
                transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>";
                transportOrderItems += "<td width=\"9%\" align=\"center\">" + dr["Unit"].ToString() + "</td>";
                transportOrderItems += "<td width=\"6%\">" + dr["DispatchCount"].ToString() + "</td>";
                transportOrderItems += "<td width=\"5%\">" + dr["FactDispatchCount"].ToString() + "</td>";
                transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["UnitPrice"].ToString()) + "</td>";
                transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["TotalPrice"].ToString()) + "</td>";
                transportOrderItems += "</tr>";
            }
        }
Ejemplo n.º 4
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            labMotorcade.Text = model.MotorcadeName;
            labCarNumber.Text = model.CarNumber;
            labDriver.Text    = model.Driver;
            labPayee.Text     = model.Driver;

            BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem();
            DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                string dispatchCount = dr["DispatchCount"].ToString().Equals("0.00") ? "包车" : dr["DispatchCount"].ToString();
                transportOrderItems += "<tr data-value=\"" + dr["OrderId"].ToString() + "\">";
                transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"transportOrderItemId\" value=\"" + dr["Id"].ToString() + "\"/></td>";
                transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>";
                transportOrderItems += "<td width=\"9%\" align=\"center\">" + dr["Unit"].ToString() + "</td>";
                transportOrderItems += "<td width=\"6%\">" + dispatchCount + "</td>";
                transportOrderItems += "<td width=\"5%\">" + dr["FactDispatchCount"].ToString() + "</td>";
                transportOrderItems += "<td width=\"5%\">¥" + dr["UnitPrice"].ToString() + "</td>";
                transportOrderItems += "<td width=\"5%\">¥" + dr["TotalPrice"].ToString() + "</td>";
                transportOrderItems += "</tr>";
            }
        }
Ejemplo n.º 5
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            txtDispatchTime.Text       = model.DispatchTime.ToString("yyyy-MM-dd");
            txtBackTime.Text           = model.BackTime.ToString("yyyy-MM-dd");
            ddlMotorcade.SelectedValue = model.MotorcadeName;
            ddlCarNumber.SelectedValue = model.CarNumber;
            txtDriver.Text             = model.Driver;
            txtRemarks.Text            = model.Remarks;

            BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem();
            DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                string dispatchCount = dr["DispatchCount"].ToString().Equals("0.00") ? "包车" : dr["DispatchCount"].ToString();
                transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\" data-order-id=\"" + dr["OrderId"].ToString() + "\">";
                transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"orderId\" value=\"" + dr["OrderId"].ToString() + "\"/></td>";
                transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>";
                transportOrderItems += "<td width=\"9%\">" + dr["Unit"].ToString() + "</td>";
                transportOrderItems += "<td width=\"6%\">" + dispatchCount + "</td>";
                transportOrderItems += "<td width=\"5%\"><input type=\"text\" name=\"factDispatchCount\" value=\"" + dr["FactDispatchCount"].ToString() + "\" class=\"input small\"/></td>";
                transportOrderItems += "<td width=\"5%\">" + dr["UnitPrice"].ToString() + "</td>";
                transportOrderItems += "<td width=\"5%\">" + dr["TotalPrice"].ToString() + "</td>";
                transportOrderItems += "</tr>";
            }
        }
Ejemplo n.º 6
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            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();

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改运输单信息:" + model.Id); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 7
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            txtReceiptTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            txtRemarks.Text     = model.Remarks;
        }
Ejemplo n.º 8
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            ddlDriver.SelectedValue   = model.DriverId.ToString();
            txtFactDispatchTime.Text  = model.DispatchTime.ToString("yyyy-MM-dd");
            txtFactDispatchCount.Text = model.DispatchCount.ToString();
            txtFactWeight.Text        = model.Weight.ToString();
            txtLoadingDate.Text       = DateTime.Now.ToString("yyyy-MM-dd");
            txtPayee.Text             = GetDriverName(model.DriverId);
        }
Ejemplo n.º 9
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            labFactDispatchTime.Text = model.FactDispatchTime.Value.ToString("yyyy-MM-dd");
            txtFactBackTime.Text     = DateTime.Now.ToString("yyyy-MM-dd");
            labMotorcade.Text        = model.MotorcadeName;
            labCarNumber.Text        = model.CarNumber;
            labDriver.Text           = model.Driver;
            labAdvance.Text          = model.Advance.ToString();
            labPayee.Text            = model.Driver;
            txtRepayment.Text        = model.Advance.ToString();
            txtFactRepayment.Text    = "0.00";

            BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem();
            DataTable dt = itemBll.GetList(" TransportOrderId = " + model.Id + "").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">";
                transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"transportOrderItemId\" value=\"" + dr["Id"].ToString() + "\"/></td>";
                transportOrderItems += "<td align=\"left\">" + dr["OrderCode"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\"><select name='roundStatus'>";
                transportOrderItems += "<option value='往'>往</option>";
                transportOrderItems += "<option value='返'>返</option>";
                transportOrderItems += "<option value='往返'>往返</option>";
                transportOrderItems += "</select></td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Goods"].ToString() + "</td>";
                transportOrderItems += "<td width=\"9%\">" + dr["Unit"].ToString() + "</td>";
                transportOrderItems += "<td width=\"6%\"><input type=\"text\" name=\"factDispatchCount\" class=\"input small\" value=\"" + dr["FactDispatchCount"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "<td width=\"5%\"><input type=\"text\" name=\"factReceivedCount\" class=\"input small\" value=\"" + dr["FactReceivedCount"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["UnitPrice"].ToString()) + "</td>";
                transportOrderItems += "<td width=\"5%\">¥<input type=\"text\" name=\"totalPrice\" value=\"" + dr["TotalPrice"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "</tr>";
            }

            BLL.CostItem costItemBll = new BLL.CostItem();
            DataTable    costItemDT  = costItemBll.GetAllList().Tables[0];

            foreach (DataRow dr in costItemDT.Rows)
            {
                consumptions += "<tr data-value=\"" + dr["Id"].ToString() + "\">";
                consumptions += "<td width=\"5%\"><input type=\"hidden\" name=\"costItemName\" value=\"" + dr["Name"].ToString() + "\"/></td>";
                consumptions += "<td width=\"5%\">" + dr["Name"].ToString() + "</td>";
                consumptions += "<td width=\"50%\">¥<input type=\"text\" name=\"money\" class=\"input small\" value=\"0.00\"/></td>";
                consumptions += "</tr>";
            }
        }
Ejemplo n.º 10
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            txtFactArriveDate.Text    = model.FactArriveDate.Value.ToString("yyyy-MM-dd");
            txtFactBackTime.Text      = model.BackTime.Value.ToString("yyyy-MM-dd");
            txtFactDispatchCount.Text = model.FactDispatchCount.ToString();
            txtFactWeight.Text        = model.FactWeight.ToString();
            txtReceivedWeight.Text    = model.FactWeight.ToString();
            txtUnloadingWeight.Text   = model.FactWeight.ToString();
            txtFactCarriage.Text      = model.FactCarriage.ToString();
            txtRepayment.Text         = model.Advance.ToString();
            txtFactRepayment.Text     = "0.00";

            BLL.Order itemBll = new BLL.Order();
            DataTable dt      = itemBll.GetPrintList(0, " and A.TransportOrderId = " + model.Id + "", " order by A.Id desc").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">";
                transportOrderItems += "<td width=\"5%\"><input type=\"hidden\" name=\"OrderId\" value=\"" + dr["Id"].ToString() + "\"/></td>";
                transportOrderItems += "<td align=\"left\">" + dr["BillNumber"].ToString() + "</td>";
                transportOrderItems += "<td width=\"13%\">" + dr["Shipper"].ToString() + "</td>";
                transportOrderItems += "<td width=\"13%\">" + dr["Receiver"].ToString() + "</td>";
                transportOrderItems += "<td width=\"12%\">" + dr["GoodsName"].ToString() + "</td>";
                transportOrderItems += "<td width=\"8%\">¥<input type=\"text\" name=\"UnitPrice\" class=\"input small\" value=\"" + dr["UnitPrice"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "<td width=\"8%\"><input type=\"text\" name=\"Weight\" class=\"input small\" value=\"" + dr["Weight"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "<td width=\"8%\">¥<input type=\"text\" name=\"Freight\" value=\"" + dr["Freight"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "<td width=\"8%\">¥<input type=\"text\" name=\"PaidFreight\" value=\"" + dr["PaidFreight"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "<td width=\"8%\">¥<input type=\"text\" name=\"UnpaidFreight\" value=\"" + dr["UnpaidFreight"].ToString() + "\" style='width:50px'/></td>";
                transportOrderItems += "</tr>";
            }

            BLL.CostItem costItemBll = new BLL.CostItem();
            DataTable    costItemDT  = costItemBll.GetAllList().Tables[0];

            foreach (DataRow dr in costItemDT.Rows)
            {
                consumptions += "<tr data-value=\"" + dr["Id"].ToString() + "\">";
                consumptions += "<td width=\"5%\"><input type=\"hidden\" name=\"costItemName\" value=\"" + dr["Name"].ToString() + "\"/></td>";
                consumptions += "<td width=\"5%\">" + dr["Name"].ToString() + "</td>";
                consumptions += "<td width=\"50%\">¥<input type=\"text\" name=\"money\" class=\"input small\" value=\"0.00\"/></td>";
                consumptions += "</tr>";
            }
        }
Ejemplo n.º 11
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            txtDispatchTime.Text             = model.DispatchTime.ToString("yyyy-MM-dd");
            ddlDriver.SelectedValue          = model.DriverId.ToString();
            txtCustomerRemarks.Text          = model.CustomerRemarks;
            txtHaulwayRemarks.Text           = model.HaulwayRemarks;
            txtDispatchCount.Text            = model.DispatchCount.ToString();
            txtWeight.Text                   = model.Weight.ToString();
            txtCarriageUnitPrice.Text        = model.CarriageUnitPrice.ToString();
            txtCarriage.Text                 = model.Carriage.ToString();
            txtLoadingCapacityRunning.Text   = model.LoadingCapacityRunning.ToString();
            txtNoLoadingCapacityRunning.Text = model.NoLoadingCapacityRunning.ToString();
            txtRemarks.Text                  = model.Remarks;
        }
Ejemplo n.º 12
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            model.Remarks     = txtRemarks.Text.Trim();
            model.ReceiptTime = Utils.StrToDateTime(txtReceiptTime.Text.Trim(), DateTime.Now);
            model.Status      = 3;

            if (bll.UpdateReceipt(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "回单登记信息:" + model.Code); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 13
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            model.FactDispatchTime = Utils.StrToDateTime(txtFactDispatchTime.Text.Trim(), DateTime.Now);
            model.Advance          = Utils.StrToDecimal(txtAdvance.Text.Trim(), 0.00M);
            model.AddTime          = DateTime.Now;
            model.Payee            = labPayee.Text;
            model.Status           = 1;

            //string[] itemIds = Request.Params.GetValues("transportOrderItemId");
            //string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");


            List <Model.TransportOrderItem> item_list = new List <Model.TransportOrderItem>();

            //BLL.TransportOrderItem itemBll = new BLL.TransportOrderItem();

            //Model.TransportOrderItem item;
            //for (int i = 0; i < itemIds.Length; i++)
            //{
            //    item = itemBll.GetModel(Utils.StrToInt(itemIds[i], 0));
            //    if (item != null)
            //    {
            //        item.FactDispatchCount = Utils.StrToDecimal(factDispatchCounts[i], item.FactDispatchCount);
            //        item_list.Add(item);
            //    }
            //}

            if (bll.Update(model, item_list))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "登记出车信息:" + model.Code); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 14
0
        private void ShowInfo(int _id)
        {
            BLL.TransportOrder   bll   = new BLL.TransportOrder();
            Model.TransportOrder model = bll.GetModel(_id);

            labCode.Text             = model.Code;
            labFactDispatchTime.Text = model.FactDispatchTime.ToString("yyyy-MM-dd");
            Model.Driver driver = new BLL.Driver().GetModel(model.DriverId);
            if (driver != null)
            {
                labDriver.Text    = driver.RealName;
                labLinkTel.Text   = driver.LinkTel;
                labCarNumber.Text = driver.CarNumber;
            }
            labPayee.Text   = model.Payee;
            labAdvance.Text = model.Advance.ToString();

            BLL.Order itemBll = new BLL.Order();
            DataTable dt      = itemBll.GetPrintList(0, " and A.TransportOrderId = " + model.Id + "", " order by A.Id desc").Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                transportOrderItems += "<tr data-value=\"" + dr["Id"].ToString() + "\">";
                transportOrderItems += "<td></td>";
                transportOrderItems += "<td align=\"left\">" + dr["Code"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["BillNumber"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["WeighbridgeNumber"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Shipper"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["Receiver"].ToString() + "</td>";
                transportOrderItems += "<td width=\"10%\">" + dr["GoodsName"].ToString() + "</td>";
                transportOrderItems += "<td width=\"6%\">" + dr["Quantity"].ToString() + "</td>";
                transportOrderItems += "<td width=\"5%\">" + dr["Weight"].ToString() + "</td>";
                transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["UnitPrice"].ToString()) + "</td>";
                transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["Freight"].ToString()) + "</td>";
                transportOrderItems += "<td width=\"5%\">¥" + string.Format("{0:N2}", dr["HandlingCharge"].ToString()) + "</td>";
                transportOrderItems += "</tr>";
            }
        }
Ejemplo n.º 15
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            model.FactDispatchTime  = Utils.StrToDateTime(txtFactDispatchTime.Text.Trim(), DateTime.Now);
            model.FactDispatchCount = Utils.StrToDecimal(txtFactDispatchCount.Text.Trim(), 0.00M);
            model.FactWeight        = Utils.StrToDecimal(txtFactWeight.Text.Trim(), 0.00M);
            model.LoadingDate       = Utils.StrToDateTime(txtLoadingDate.Text.Trim(), DateTime.Now);
            model.Advance           = Utils.StrToDecimal(txtAdvance.Text.Trim(), 0.00M);
            model.Payee             = txtPayee.Text.Trim();
            model.ArriveDate        = Utils.StrToDateTime(txtArriveDate.Text.Trim(), DateTime.Now);
            model.FactArriveDate    = model.ArriveDate;
            model.Status            = 1;

            if (bll.Update(model))
            {
                result = true;
            }
            return(result);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.TransportOrder GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select Id, Code, DispatchTime, FactDispatchTime, TimeLimit, BackTime, FactBackTime, MotorcadeName, CarNumber, Trailer, Driver, Advance, Payee, Repayment, FactRepayment, Percentage, Carriage, FactCarriage, CostTotal, Profit, AddTime, Status,WarningTime, Remarks  ");
            strSql.Append("  from mtms_TransportOrder ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
                    new SqlParameter("@Id", SqlDbType.Int,4)
            };
            parameters[0].Value = Id;

            Model.TransportOrder model = new Model.TransportOrder();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                model.Code = ds.Tables[0].Rows[0]["Code"].ToString();
                if (ds.Tables[0].Rows[0]["DispatchTime"].ToString() != "")
                {
                    model.DispatchTime = DateTime.Parse(ds.Tables[0].Rows[0]["DispatchTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FactDispatchTime"].ToString() != "")
                {
                    model.FactDispatchTime = DateTime.Parse(ds.Tables[0].Rows[0]["FactDispatchTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TimeLimit"].ToString() != "")
                {
                    model.TimeLimit = int.Parse(ds.Tables[0].Rows[0]["TimeLimit"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BackTime"].ToString() != "")
                {
                    model.BackTime = DateTime.Parse(ds.Tables[0].Rows[0]["BackTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FactBackTime"].ToString() != "")
                {
                    model.FactBackTime = DateTime.Parse(ds.Tables[0].Rows[0]["FactBackTime"].ToString());
                }
                model.MotorcadeName = ds.Tables[0].Rows[0]["MotorcadeName"].ToString();
                model.CarNumber = ds.Tables[0].Rows[0]["CarNumber"].ToString();
                model.Trailer = ds.Tables[0].Rows[0]["Trailer"].ToString();
                model.Driver = ds.Tables[0].Rows[0]["Driver"].ToString();
                if (ds.Tables[0].Rows[0]["Advance"].ToString() != "")
                {
                    model.Advance = decimal.Parse(ds.Tables[0].Rows[0]["Advance"].ToString());
                }
                model.Payee = ds.Tables[0].Rows[0]["Payee"].ToString();
                if (ds.Tables[0].Rows[0]["Repayment"].ToString() != "")
                {
                    model.Repayment = decimal.Parse(ds.Tables[0].Rows[0]["Repayment"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FactRepayment"].ToString() != "")
                {
                    model.FactRepayment = decimal.Parse(ds.Tables[0].Rows[0]["FactRepayment"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Percentage"].ToString() != "")
                {
                    model.Percentage = decimal.Parse(ds.Tables[0].Rows[0]["Percentage"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Carriage"].ToString() != "")
                {
                    model.Carriage = decimal.Parse(ds.Tables[0].Rows[0]["Carriage"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FactCarriage"].ToString() != "")
                {
                    model.FactCarriage = decimal.Parse(ds.Tables[0].Rows[0]["FactCarriage"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CostTotal"].ToString() != "")
                {
                    model.CostTotal = decimal.Parse(ds.Tables[0].Rows[0]["CostTotal"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Profit"].ToString() != "")
                {
                    model.Profit = decimal.Parse(ds.Tables[0].Rows[0]["Profit"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AddTime"].ToString() != "")
                {
                    model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Status"].ToString() != "")
                {
                    model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["WarningTime"].ToString() != "")
                {
                    model.WarningTime = DateTime.Parse(ds.Tables[0].Rows[0]["WarningTime"].ToString());
                }
                model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString();

                return model;
            }
            else
            {
                return null;
            }
        }
Ejemplo n.º 17
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            model.FactArriveDate    = Utils.StrToDateTime(txtFactArriveDate.Text.Trim(), DateTime.Now);
            model.FactBackTime      = Utils.StrToDateTime(txtFactBackTime.Text.Trim(), DateTime.Now);
            model.Repayment         = Utils.StrToDecimal(txtRepayment.Text.Trim(), 0.00M);
            model.FactRepayment     = Utils.StrToDecimal(txtFactRepayment.Text.Trim(), 0.00M);
            model.FactDispatchCount = Utils.StrToDecimal(txtFactDispatchCount.Text.Trim(), 0.00M);
            model.FactWeight        = Utils.StrToDecimal(txtFactWeight.Text.Trim(), 0.00M);
            model.ReceivedWeight    = Utils.StrToDecimal(txtReceivedWeight.Text.Trim(), 0.00M);
            model.UnloadingWeight   = Utils.StrToDecimal(txtUnloadingWeight.Text.Trim(), 0.00M);
            model.FactCarriage      = Utils.StrToDecimal(txtFactCarriage.Text.Trim(), 0.00M);
            model.Status            = 3;

            string[] ids            = Request.Params.GetValues("OrderId");
            string[] unitPrices     = Request.Params.GetValues("UnitPrice");
            string[] weights        = Request.Params.GetValues("Weight");
            string[] freights       = Request.Params.GetValues("Freight");
            string[] paidFreights   = Request.Params.GetValues("PaidFreight");
            string[] unpaidFreights = Request.Params.GetValues("UnpaidFreight");

            string[] costItemNames = Request.Params.GetValues("costItemName");
            string[] monies        = Request.Params.GetValues("money");


            List <Model.Order> item_list = new List <Model.Order>();

            BLL.Order   orderBLL = new BLL.Order();
            Model.Order item;

            if (ids != null && unitPrices != null && weights != null && freights != null && paidFreights != null && unpaidFreights != null &&
                ids.Length == unitPrices.Length && ids.Length == weights.Length && ids.Length == freights.Length && ids.Length == paidFreights.Length && ids.Length == unpaidFreights.Length &&
                ids.Length > 0)
            {
                for (int i = 0; i < ids.Length; i++)
                {
                    item = orderBLL.GetModel(Utils.StrToInt(ids[i], 0));
                    if (item != null)
                    {
                        item.UnitPrice     = Utils.StrToDecimal(unitPrices[i], 0.00M);
                        item.Weight        = Utils.StrToDecimal(weights[i], 0.00M);
                        item.Freight       = Utils.StrToDecimal(freights[i], 0.00M);
                        item.PaidFreight   = Utils.StrToDecimal(paidFreights[i], 0.00M);
                        item.UnpaidFreight = Utils.StrToDecimal(unpaidFreights[i], 0.00M);
                        item_list.Add(item);
                    }
                }
            }

            List <Model.Consumption> consumption_list = new List <Model.Consumption>();

            if (costItemNames != null && monies != null &&
                costItemNames.Length == monies.Length &&
                costItemNames.Length > 0)
            {
                for (int i = 0; i < costItemNames.Length; i++)
                {
                    Model.Consumption consumption = new Model.Consumption();
                    consumption.Name             = costItemNames[i];
                    consumption.Money            = Utils.StrToDecimal(monies[i], 0.00M);
                    consumption.TransportOrderId = _id;
                    consumption_list.Add(consumption);
                }
            }


            if (bll.Update(model, item_list, consumption_list))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "回车报账信息:" + model.Code); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 18
0
 public bool UpdateReceipt(Model.TransportOrder model)
 {
     return(dal.UpdateReceipt(model));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.TransportOrder model, List <Model.TransportOrderItem> item_list, List <Model.Order> order_list)
 {
     return(dal.Update(model, item_list, order_list));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.TransportOrder model, List <Model.TransportOrderItem> item_list, List <Model.Consumption> consumption_list, List <Model.Order> orders)
 {
     return(dal.Update(model, item_list, consumption_list, orders));
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.TransportOrder model, List <Model.TransportOrderItem> item_list, List <Model.Order> order_list)
 {
     return(dal.Add(model, item_list, order_list));
 }
Ejemplo n.º 22
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            string[] orderIds           = Request.Params.GetValues("orderId");
            string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");

            if (orderIds == null)
            {
                JscriptMsg("请填写运输项信息!", "", "Error");
                return(false);
            }
            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();
            model.AddTime          = DateTime.Now;
            model.Status           = 0;

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

            BLL.Order orderBll = new BLL.Order();

            //new BLL.TransportOrderItem().DeleteBy(model.Id);//删除该运输单下 所有 运输子项

            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 = item.FactDispatchCount;
                    //order_list.Add(order);
                }
            }
            if (bll.Update(model, item_list, order_list))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改运输单信息:" + model.Code); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 23
0
        private bool DoEdit(int _id)
        {
            bool result = false;

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

            model.FactBackTime  = Utils.StrToDateTime(txtFactBackTime.Text.Trim(), DateTime.Now);
            model.Repayment     = Utils.StrToDecimal(txtRepayment.Text.Trim(), 0.00M);
            model.FactRepayment = Utils.StrToDecimal(txtFactRepayment.Text.Trim(), 0.00M);
            model.Carriage      = Utils.StrToDecimal(txtCarriage.Text.Trim(), 0.00M);
            model.Status        = 2;

            string[] itemIds            = Request.Params.GetValues("transportOrderItemId");
            string[] factDispatchCounts = Request.Params.GetValues("factDispatchCount");
            string[] factReceivedCounts = Request.Params.GetValues("factReceivedCount");
            string[] totalPrices        = Request.Params.GetValues("totalPrice");
            string[] roundStatus        = Request.Params.GetValues("roundStatus");

            string[] costItemNames = Request.Params.GetValues("costItemName");
            string[] monies        = Request.Params.GetValues("money");


            List <Model.TransportOrderItem> item_list = new List <Model.TransportOrderItem>();

            BLL.TransportOrderItem   itemBll = new BLL.TransportOrderItem();
            Model.TransportOrderItem item;

            List <Model.Order> orders = new List <Model.Order>();

            BLL.Order   orderBll = new BLL.Order();
            Model.Order order;
            for (int i = 0; i < itemIds.Length; i++)
            {
                item = itemBll.GetModel(Utils.StrToInt(itemIds[i], 0));
                if (item != null)
                {
                    decimal oldFactDispatchCount = item.FactDispatchCount;
                    decimal newFactDispatchCount = Utils.StrToDecimal(factDispatchCounts[i], 0.00M);
                    order = orderBll.GetModel(item.OrderId);
                    order.DispatchedCount += newFactDispatchCount - oldFactDispatchCount;
                    orders.Add(order);

                    item.FactDispatchCount = newFactDispatchCount;
                    item.FactReceivedCount = Utils.StrToDecimal(factReceivedCounts[i], 0.00M);
                    item.TotalPrice        = Utils.StrToDecimal(totalPrices[i], 0.00M);
                    item.RoundStatus       = roundStatus[i];
                    item_list.Add(item);
                }
            }
            List <Model.Consumption> consumption_list = new List <Model.Consumption>();

            for (int i = 0; i < costItemNames.Length; i++)
            {
                Model.Consumption consumption = new Model.Consumption();
                consumption.Name             = costItemNames[i];
                consumption.Money            = Utils.StrToDecimal(monies[i], 0.00M);
                consumption.TransportOrderId = _id;
                consumption_list.Add(consumption);
            }

            if (bll.Update(model, item_list, consumption_list, orders))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "回车报账信息:" + model.Code); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.TransportOrder> DataTableToList(DataTable dt)
        {
            List<Model.TransportOrder> modelList = new List<Model.TransportOrder>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Model.TransportOrder model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.TransportOrder();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    model.Code = dt.Rows[n]["Code"].ToString();
                    if (dt.Rows[n]["DispatchTime"].ToString() != "")
                    {
                        model.DispatchTime = DateTime.Parse(dt.Rows[n]["DispatchTime"].ToString());
                    }
                    if (dt.Rows[n]["FactDispatchTime"].ToString() != "")
                    {
                        model.FactDispatchTime = DateTime.Parse(dt.Rows[n]["FactDispatchTime"].ToString());
                    }
                    if (dt.Rows[n]["TimeLimit"].ToString() != "")
                    {
                        model.TimeLimit = int.Parse(dt.Rows[n]["TimeLimit"].ToString());
                    }
                    if (dt.Rows[n]["BackTime"].ToString() != "")
                    {
                        model.BackTime = DateTime.Parse(dt.Rows[n]["BackTime"].ToString());
                    }
                    if (dt.Rows[n]["FactBackTime"].ToString() != "")
                    {
                        model.FactBackTime = DateTime.Parse(dt.Rows[n]["FactBackTime"].ToString());
                    }
                    model.MotorcadeName = dt.Rows[n]["MotorcadeName"].ToString();
                    model.CarNumber = dt.Rows[n]["CarNumber"].ToString();
                    model.Trailer = dt.Rows[n]["Trailer"].ToString();
                    model.Driver = dt.Rows[n]["Driver"].ToString();
                    if (dt.Rows[n]["DispatchCount"].ToString() != "")
                    {
                        model.DispatchCount = decimal.Parse(dt.Rows[n]["DispatchCount"].ToString());
                    }
                    if (dt.Rows[n]["FactDispatchCount"].ToString() != "")
                    {
                        model.FactDispatchCount = decimal.Parse(dt.Rows[n]["FactDispatchCount"].ToString());
                    }
                    if (dt.Rows[n]["FactReceivedCount"].ToString() != "")
                    {
                        model.FactReceivedCount = decimal.Parse(dt.Rows[n]["FactReceivedCount"].ToString());
                    }
                    if (dt.Rows[n]["Advance"].ToString() != "")
                    {
                        model.Advance = decimal.Parse(dt.Rows[n]["Advance"].ToString());
                    }
                    model.Payee = dt.Rows[n]["Payee"].ToString();
                    if (dt.Rows[n]["Repayment"].ToString() != "")
                    {
                        model.Repayment = decimal.Parse(dt.Rows[n]["Repayment"].ToString());
                    }
                    if (dt.Rows[n]["FactRepayment"].ToString() != "")
                    {
                        model.FactRepayment = decimal.Parse(dt.Rows[n]["FactRepayment"].ToString());
                    }
                    if (dt.Rows[n]["Percentage"].ToString() != "")
                    {
                        model.Percentage = decimal.Parse(dt.Rows[n]["Percentage"].ToString());
                    }
                    if (dt.Rows[n]["Carriage"].ToString() != "")
                    {
                        model.Carriage = decimal.Parse(dt.Rows[n]["Carriage"].ToString());
                    }
                    if (dt.Rows[n]["FactCarriage"].ToString() != "")
                    {
                        model.FactCarriage = decimal.Parse(dt.Rows[n]["FactCarriage"].ToString());
                    }
                    if (dt.Rows[n]["CostTotal"].ToString() != "")
                    {
                        model.CostTotal = decimal.Parse(dt.Rows[n]["CostTotal"].ToString());
                    }
                    if (dt.Rows[n]["Profit"].ToString() != "")
                    {
                        model.Profit = decimal.Parse(dt.Rows[n]["Profit"].ToString());
                    }
                    if (dt.Rows[n]["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
                    }
                    if (dt.Rows[n]["Status"].ToString() != "")
                    {
                        model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
                    }
                    model.Remarks = dt.Rows[n]["Remarks"].ToString();

                    modelList.Add(model);
                }
            }
            return modelList;
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Model.TransportOrder> DataTableToList(DataTable dt)
        {
            List <Model.TransportOrder> modelList = new List <Model.TransportOrder>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Model.TransportOrder model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.TransportOrder();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    model.Code = dt.Rows[n]["Code"].ToString();
                    if (dt.Rows[n]["DispatchTime"].ToString() != "")
                    {
                        model.DispatchTime = DateTime.Parse(dt.Rows[n]["DispatchTime"].ToString());
                    }
                    if (dt.Rows[n]["FactDispatchTime"].ToString() != "")
                    {
                        model.FactDispatchTime = DateTime.Parse(dt.Rows[n]["FactDispatchTime"].ToString());
                    }
                    if (dt.Rows[n]["TimeLimit"].ToString() != "")
                    {
                        model.TimeLimit = int.Parse(dt.Rows[n]["TimeLimit"].ToString());
                    }
                    if (dt.Rows[n]["BackTime"].ToString() != "")
                    {
                        model.BackTime = DateTime.Parse(dt.Rows[n]["BackTime"].ToString());
                    }
                    if (dt.Rows[n]["FactBackTime"].ToString() != "")
                    {
                        model.FactBackTime = DateTime.Parse(dt.Rows[n]["FactBackTime"].ToString());
                    }
                    model.MotorcadeName = dt.Rows[n]["MotorcadeName"].ToString();
                    model.CarNumber     = dt.Rows[n]["CarNumber"].ToString();
                    model.Trailer       = dt.Rows[n]["Trailer"].ToString();
                    model.Driver        = dt.Rows[n]["Driver"].ToString();
                    if (dt.Rows[n]["DispatchCount"].ToString() != "")
                    {
                        model.DispatchCount = decimal.Parse(dt.Rows[n]["DispatchCount"].ToString());
                    }
                    if (dt.Rows[n]["FactDispatchCount"].ToString() != "")
                    {
                        model.FactDispatchCount = decimal.Parse(dt.Rows[n]["FactDispatchCount"].ToString());
                    }
                    if (dt.Rows[n]["FactReceivedCount"].ToString() != "")
                    {
                        model.FactReceivedCount = decimal.Parse(dt.Rows[n]["FactReceivedCount"].ToString());
                    }
                    if (dt.Rows[n]["Advance"].ToString() != "")
                    {
                        model.Advance = decimal.Parse(dt.Rows[n]["Advance"].ToString());
                    }
                    model.Payee = dt.Rows[n]["Payee"].ToString();
                    if (dt.Rows[n]["Repayment"].ToString() != "")
                    {
                        model.Repayment = decimal.Parse(dt.Rows[n]["Repayment"].ToString());
                    }
                    if (dt.Rows[n]["FactRepayment"].ToString() != "")
                    {
                        model.FactRepayment = decimal.Parse(dt.Rows[n]["FactRepayment"].ToString());
                    }
                    if (dt.Rows[n]["Percentage"].ToString() != "")
                    {
                        model.Percentage = decimal.Parse(dt.Rows[n]["Percentage"].ToString());
                    }
                    if (dt.Rows[n]["Carriage"].ToString() != "")
                    {
                        model.Carriage = decimal.Parse(dt.Rows[n]["Carriage"].ToString());
                    }
                    if (dt.Rows[n]["FactCarriage"].ToString() != "")
                    {
                        model.FactCarriage = decimal.Parse(dt.Rows[n]["FactCarriage"].ToString());
                    }
                    if (dt.Rows[n]["CostTotal"].ToString() != "")
                    {
                        model.CostTotal = decimal.Parse(dt.Rows[n]["CostTotal"].ToString());
                    }
                    if (dt.Rows[n]["Profit"].ToString() != "")
                    {
                        model.Profit = decimal.Parse(dt.Rows[n]["Profit"].ToString());
                    }
                    if (dt.Rows[n]["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
                    }
                    if (dt.Rows[n]["Status"].ToString() != "")
                    {
                        model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
                    }
                    model.Remarks = dt.Rows[n]["Remarks"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 26
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;
        }