Example #1
0
        /// <summary>
        /// 修改发货计划
        /// </summary>
        /// <param name="data"></param>
        /// <param name="listGoods"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool UpdateDeliverPlan(DeliverPlan data, List<DeliverPlanGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (PlanDAO dao = new PlanDAO())
                    {
                        //修改计划数据
                        if (!dao.UpdateDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText))
                            return false;

                        //修改货物数据
                        if (!dao.DeleteDeliverPlanAllGoods(data.Id, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                        foreach (DeliverPlanGoods goods in listGoods)
                        {
                            goods.PlanId = data.Id;
                            if (!dao.InsertDeliverPlanGoods(goods, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }
                        }
                    }
                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }
Example #2
0
        /// <summary>
        /// 新增发货计划
        /// </summary>
        /// <param name="data"></param>
        /// <param name="listGoods"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long InsertDeliverPlan(DeliverPlan data, List<DeliverPlanGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            long nPlanId = 0;

            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (PlanDAO dao = new PlanDAO())
                    {
                        //新增计划数据
                        nPlanId = dao.InsertDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText);
                        if (nPlanId <= 0)
                            return 0;

                        //新增货物数据
                        foreach (DeliverPlanGoods goods in listGoods)
                        {
                            goods.PlanId = nPlanId;

                            if (!dao.InsertDeliverPlanGoods(goods, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return 0;
                            }
                        }
                    }
                    transScope.Complete();
                }
                return nPlanId;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return 0;
            }
        }
Example #3
0
        /// <summary>
        /// 修改计划
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns>成功返回True,否则返回False</returns>
        public bool UpdateDeliverPlan(DeliverPlan data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.Id),
                    MakeParam(PLANTYPE_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.PlanType),
                    MakeParam(CUSTOMERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.CustomerId),
                    MakeParam(SHIPMENTNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.ShipmentNo??System.DBNull.Value),
                    MakeParam(DELIVERYNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DeliveryNo??System.DBNull.Value),
                    MakeParam(DELIVERTYPE_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.DeliverType),
                    MakeParam(RECEIVERNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.ReceiverName),
                    MakeParam(RECEIVERCOUNTRY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.ReceiverCountry),
                    MakeParam(RECEIVERPROVINCE_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.ReceiverProvince),
                    MakeParam(RECEIVERCITY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.ReceiverCity),
                    MakeParam(RECEIVERADDRESS_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.ReceiverAddress),
                    MakeParam(RECEIVERCONTACT_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.ReceiverContact??System.DBNull.Value),
                    MakeParam(RECEIVERCONTACTTEL_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.ReceiverContactTel??System.DBNull.Value),
                    MakeParam(ORDERNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.OrderNo??System.DBNull.Value),
                    MakeParam(RECEIVETYPE_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.ReceiveType),
                    MakeParam(CARNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.CarNo??System.DBNull.Value),
                    MakeParam(TRAILERNO_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.TrailerNo??System.DBNull.Value),
                    MakeParam(DRIVERNAME_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DriverName??System.DBNull.Value),
                    MakeParam(DRIVERLICENSENO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DriverLicenseNo??System.DBNull.Value),
                    MakeParam(DRIVERMOBILETEL_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DriverMobileTel??System.DBNull.Value),
                    MakeParam(DRIVERHOMETEL_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.DriverHomeTel??System.DBNull.Value),
                    MakeParam(WAREHOUSE_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.Warehouse??string.Empty),
                    MakeParam(ARRIVALTIME_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.ArrivalTime??System.DBNull.Value),
                    MakeParam(PAYERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.PayerId),
                    MakeParam(PAYERNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)data.PayerName),
                    MakeParam(ISCONSIGNING_PARAM, SqlDbType.Bit, 1, ParameterDirection.Input, (object)data.IsConsigning??System.DBNull.Value),
                    MakeParam(CONSIGNEDDELIVERYNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.ConsignedDeliveryNo??System.DBNull.Value),
                    MakeParam(ISINSTALMENT_PARAM, SqlDbType.Bit, 1, ParameterDirection.Input, (object)data.IsInstalment??System.DBNull.Value),
                    MakeParam(STARTCOUNTRY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.StartCountry),
                    MakeParam(STARTPROVINCE_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.StartProvince),
                    MakeParam(STARTCITY_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.StartCity),
                    MakeParam(REMARK_PARAM, SqlDbType.NVarChar, 500, ParameterDirection.Input, (object)data.Remark??System.DBNull.Value),
                    MakeParam(CREATETIME_PARAM, SqlDbType.DateTime, 8, ParameterDirection.Input, (object)data.CreateTime),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName),
                };

            if (Execute("UpdateDeliverPlan", Params, out strErrText) >= 0)
                return true;
            else
                return false;
        }
Example #4
0
 /// <summary>
 /// 修改发货计划
 /// </summary>
 /// <param name="data"></param>
 /// <param name="listGoods"></param>
 /// <param name="nOpStaffId"></param>
 /// <param name="strOpStaffName"></param>
 /// <param name="strErrText"></param>
 /// <returns></returns>
 public bool UpdateDeliverPlan(DeliverPlan data, List<DeliverPlanGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     PlanRule rule = new PlanRule();
     return rule.UpdateDeliverPlan(data, listGoods, nOpStaffId, strOpStaffName, out strErrText);
 }
Example #5
0
        public ActionResult NewPaperPlan(PaperPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //检查数据
                if (model.ReceiveType == InnoSoft.LS.Resources.Options.PickUpSelf)
                {
                    //自提必须输入车号
                    if (model.CarNo == null || model.CarNo == string.Empty)
                    {
                        return Json(InnoSoft.LS.Resources.Strings.NotEnterCarrierInfoWhenPickUpSelf);
                    }
                    if (model.DriverName != null && model.DriverName != string.Empty)
                    {
                        if (model.DriverLicenseNo == null || model.DriverLicenseNo == string.Empty)
                        {
                            return Json(InnoSoft.LS.Resources.Strings.NotEnterDriverLicenseNo);
                        }
                        if (model.DriverMobileTel == null || model.DriverMobileTel == string.Empty)
                        {
                            return Json(InnoSoft.LS.Resources.Strings.NotEnterDriverMobileTel);
                        }
                    }
                }
                else
                {
                    if (model.DeliveryNo == null || model.DeliveryNo == string.Empty)
                    {
                        return Json(InnoSoft.LS.Resources.Strings.NotEnterDeliveryNo);
                    }
                }
                if (model.Goods == null || model.Goods.Count == 0)
                {
                    return Json(InnoSoft.LS.Resources.Strings.NotEnterGoods);
                }

                //创建数据
                DeliverPlan data = new DeliverPlan();
                data.PlanType = InnoSoft.LS.Resources.Options.PaperPlan;
                data.CustomerId = model.CustomerId;
                data.CustomerName = model.CustomerName;
                data.ShipmentNo = model.ShipmentNo;
                data.DeliveryNo = model.DeliveryNo;
                data.DeliverType = model.DeliverType;
                data.ReceiverName = model.ReceiverName;
                data.ReceiverCountry = model.ReceiverCountry;
                data.ReceiverProvince = model.ReceiverProvince;
                data.ReceiverCity = model.ReceiverCity;
                data.ReceiverAddress = model.ReceiverAddress;
                data.ReceiverContact = model.ReceiverContact;
                data.ReceiverContactTel = model.ReceiverContactTel;
                data.OrderNo = model.OrderNo;
                data.ReceiveType = model.ReceiveType;
                data.CarNo = model.CarNo;
                data.TrailerNo = model.TrailerNo;
                data.DriverName = model.DriverName;
                data.DriverLicenseNo = model.DriverLicenseNo;
                data.DriverMobileTel = model.DriverMobileTel;
                data.DriverHomeTel = model.DriverHomeTel;
                data.Warehouse = model.Warehouse;
                data.ArrivalTime = model.ArrivalTime;
                data.PayerId = model.PayerId;
                data.PayerName = model.PayerName;
                data.IsConsigning = model.IsConsigning;
                data.ConsignedDeliveryNo = model.ConsignedDeliveryNo;
                data.IsInstalment = model.IsInstalment;
                data.StartCountry = model.StartCountry;
                data.StartProvince = model.StartProvince;
                data.StartCity = model.StartCity;
                data.Remark = model.Remark;
                data.CreateTime = DateTime.Parse(model.CreateTime);

                List<DeliverPlanGoods> listGoods = new List<DeliverPlanGoods>();
                if (model.Goods != null)
                {
                    foreach (PaperPlanGoodsViewModel m in model.Goods)
                    {
                        DeliverPlanGoods g = new DeliverPlanGoods();
                        g.GoodsId = m.GoodsId;
                        g.BatchNo = m.BatchNo;
                        g.Packing = m.Packing;
                        g.Location = m.Location;
                        g.Packages = m.Packages;
                        g.PieceWeight = m.PieceWeight;
                        g.Tunnages = m.Tunnages;
                        g.Piles = 0;
                        g.TenThousands = 0;
                        g.ProductionDate = m.ProductionDate;
                        g.EnterWarehouseBillId = m.EnterWarehouseBillId;
                        listGoods.Add(g);
                    }
                }

                //保存数据
                string strErrText;
                PlanSystem plan = new PlanSystem();
                if (plan.InsertDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Example #6
0
        public ActionResult NewOtherPlan(OtherPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //检查数据
                if (model.Goods == null || model.Goods.Count == 0)
                {
                    return Json(InnoSoft.LS.Resources.Strings.NotEnterGoods);
                }

                //创建数据
                DeliverPlan data = new DeliverPlan();
                data.PlanType = InnoSoft.LS.Resources.Options.OtherPlan;
                data.CustomerId = model.CustomerId;
                data.CustomerName = model.CustomerName;
                data.DeliveryNo = model.DeliveryNo;
                data.DeliverType = InnoSoft.LS.Resources.Options.DeliverGoods;
                data.ReceiverName = model.ReceiverName;
                data.ReceiverCountry = model.ReceiverCountry;
                data.ReceiverProvince = model.ReceiverProvince;
                data.ReceiverCity = model.ReceiverCity;
                data.ReceiverAddress = model.ReceiverAddress;
                data.ReceiverContact = model.ReceiverContact;
                data.ReceiverContactTel = model.ReceiverContactTel;
                data.ReceiveType = InnoSoft.LS.Resources.Options.PickUpDelivery;
                data.Warehouse = model.Warehouse;
                data.ArrivalTime = model.ArrivalTime;
                data.PayerId = model.CustomerId;
                data.PayerName = model.CustomerName;
                data.StartCountry = model.StartCountry;
                data.StartProvince = model.StartProvince;
                data.StartCity = model.StartCity;
                data.Remark = model.Remark;
                data.CreateTime = DateTime.Parse(model.CreateTime);

                List<DeliverPlanGoods> listGoods = new List<DeliverPlanGoods>();
                if (model.Goods != null)
                {
                    foreach (OtherPlanGoodsViewModel m in model.Goods)
                    {
                        DeliverPlanGoods g = new DeliverPlanGoods();
                        g.GoodsId = m.GoodsId;
                        g.Packages = m.Packages;
                        g.Tunnages = m.Tunnages;
                        g.Piles = 0;
                        listGoods.Add(g);
                    }
                }

                //保存数据
                string strErrText;
                PlanSystem plan = new PlanSystem();
                if (plan.InsertDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
Example #7
0
        public ActionResult NewNotDeliverCanPlan(CanPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //检查数据
                if (model.Goods == null || model.Goods.Count == 0)
                {
                    return Json(InnoSoft.LS.Resources.Strings.NotEnterGoods);
                }

                //创建数据
                DeliverPlan data = new DeliverPlan();
                data.PlanType = InnoSoft.LS.Resources.Options.NotDeliverCanPlan;
                data.CustomerId = model.CustomerId;
                data.CustomerName = model.CustomerName;
                data.DeliveryNo = model.DeliveryNo;
                data.DeliverType = InnoSoft.LS.Resources.Options.DeliverGoods;
                data.ReceiverName = model.ReceiverName;
                data.ReceiverCountry = model.ReceiverCountry;
                data.ReceiverProvince = model.ReceiverProvince;
                data.ReceiverCity = model.ReceiverCity;
                data.ReceiverAddress = model.ReceiverAddress;
                data.ReceiverContact = model.ReceiverContact;
                data.ReceiverContactTel = model.ReceiverContactTel;
                data.ReceiveType = model.ReceiveType;
                data.CarNo = model.CarNo;
                data.TrailerNo = model.TrailerNo;
                data.DriverName = model.DriverName;
                data.DriverLicenseNo = model.DriverLicenseNo;
                data.DriverMobileTel = model.DriverMobileTel;
                data.DriverHomeTel = model.DriverHomeTel;
                data.Warehouse = model.Warehouse;
                data.ArrivalTime = model.ArrivalTime;
                data.PayerId = model.PayerId;
                data.PayerName = model.PayerName;
                data.StartCountry = model.StartCountry;
                data.StartProvince = model.StartProvince;
                data.StartCity = model.StartCity;
                data.Remark = model.Remark;
                data.CreateTime = DateTime.Parse(model.CreateTime);

                List<DeliverPlanGoods> listGoods = new List<DeliverPlanGoods>();
                if (model.Goods != null)
                {
                    foreach (CanPlanGoodsViewModel m in model.Goods)
                    {
                        DeliverPlanGoods g = new DeliverPlanGoods();
                        g.GoodsId = m.GoodsId;
                        g.GoodsNo = m.GoodsNo;
                        g.GoodsName = m.GoodsName;
                        g.SpecModel = m.SpecModel;
                        g.BatchNo = m.BatchNo;
                        g.Warehouse = m.Warehouse;
                        g.Location = m.Location;
                        g.Piles = m.Piles;
                        g.TenThousands = m.TenThousands;
                        g.ProductionDate = m.ProductionDate;
                        g.EnterWarehouseBillId = m.EnterWarehouseBillId;
                        g.EnterWarehouseBillNo = m.EnterWarehouseBillNo;
                        listGoods.Add(g);
                    }
                }

                //保存数据
                string strErrText;
                PlanSystem plan = new PlanSystem();
                if (plan.InsertDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }