Beispiel #1
0
        /// <summary>
        /// 修改发货计划备注
        /// </summary>
        /// <param name="nId"></param>
        /// <param name="strRemark"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool UpdateDeliverPlanRemark(long nId, string strRemark, 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())
                    {
                        //读取计划数据
                        DeliverPlan data = dao.LoadDeliverPlan(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (data == null)
                        {
                            return(false);
                        }

                        //修改计划数据
                        data.Remark = strRemark;
                        if (!dao.UpdateDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return(false);
                        }
                    }
                    transScope.Complete();
                }
                return(true);
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 新增计划
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId">操作员工编码</param>
        /// <param name="strOpStaffName">操作员工姓名</param>
        /// <param name="strErrText">出错信息</param>
        /// <returns>成功返回True,否则返回False</returns>
        public long InsertDeliverPlan(DeliverPlan data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
            {
                MakeParam(ID_PARAM,                  SqlDbType.BigInt,     8, ParameterDirection.Output, (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),
            };

            SqlParameterCollection outParams;

            if (Execute("InsertDeliverPlan", Params, out outParams, out strErrText) < 0)
            {
                return(0);
            }
            else
            {
                return((long)outParams[ID_PARAM].Value);
            }
        }
Beispiel #3
0
        public JsonResult LoadDeliverPlan(long nPlanId)
        {
            string      strErrText;
            PlanSystem  plan = new PlanSystem();
            DeliverPlan data = plan.LoadDeliverPlan(nPlanId, LoginAccountId, LoginStaffName, out strErrText);

            if (data == null)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var ret = new
                {
                    ShipmentNo      = data.ShipmentNo,
                    DeliveryNo      = data.DeliveryNo,
                    CustomerId      = data.CustomerId,
                    CustomerName    = data.CustomerName,
                    PayerId         = data.PayerId,
                    PayerName       = data.PayerName,
                    ReceiverName    = data.ReceiverName,
                    StartCountry    = data.StartCountry,
                    StartProvince   = data.StartProvince,
                    StartCity       = data.StartCity,
                    DestCountry     = data.ReceiverCountry,
                    DestProvince    = data.ReceiverProvince,
                    DestCity        = data.ReceiverCity,
                    PlanType        = data.PlanType,
                    ReceiveType     = data.ReceiveType,
                    CarNo           = data.CarNo,
                    TrailerNo       = data.TrailerNo,
                    DriverName      = data.DriverName,
                    DriverLicenseNo = data.DriverLicenseNo,
                    DriverMobileTel = data.DriverMobileTel,
                    DriverHomeTel   = data.DriverHomeTel,
                    CarrierId       = data.CarrierId,
                    CarrierName     = data.CarrierName,
                    CreateTime      = data.CreateTime.ToString("yyyy-MM-dd"),
                    Remark          = data.Remark
                };

                return(Json(ret, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #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)
        {
            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);
            }
        }
Beispiel #5
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);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 读取指定计划数据
        /// </summary>
        /// <param name="nPlanId"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public DeliverPlan LoadDeliverPlan(long nPlanId, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                DeliverPlan dataResult = null;
                strErrText = String.Empty;

                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (PlanDAO dao = new PlanDAO())
                    {
                        dataResult = dao.LoadDeliverPlan(nPlanId, nOpStaffId, strOpStaffName, out strErrText);
                    }
                    transScope.Complete();
                }
                return(dataResult);
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return(null);
            }
        }
Beispiel #7
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));
        }
Beispiel #8
0
        /// <summary>
        /// 修改综合查询数据
        /// </summary>
        /// <param name="nPlanId"></param>
        /// <param name="strShipmentNo"></param>
        /// <param name="strDeliveryNo"></param>
        /// <param name="nPayerId"></param>
        /// <param name="strPayerName"></param>
        /// <param name="nContractId"></param>
        /// <param name="strOriginalContractNo"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool SyntheticalSearchModifyData(long nPlanId, string strShipmentNo, string strDeliveryNo, long nPayerId, string strPayerName, long nContractId, string strOriginalContractNo, 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())
                    {
                        DeliverPlan data = dao.LoadDeliverPlan(nPlanId, nOpStaffId, strOpStaffName, out strErrText);
                        if (data == null)
                        {
                            return(false);
                        }
                        data.ShipmentNo = strShipmentNo;
                        data.DeliveryNo = strDeliveryNo;
                        data.PayerId    = nPayerId;
                        data.PayerName  = strPayerName;
                        if (!dao.UpdateDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return(false);
                        }
                    }

                    //修改出仓单和送货单数据
                    using (DeliverDAO dao = new DeliverDAO())
                    {
                        List <ShipmentBill> listShipmentBill = dao.LoadShipmentBillsByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText);
                        foreach (ShipmentBill data in listShipmentBill)
                        {
                            if (!dao.UpdateShipmentBillDeliveryNo(data.Id, strDeliveryNo, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return(false);
                            }
                        }

                        List <DeliverBill> listDeliverBill = dao.LoadDeliverBillsByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText);
                        foreach (DeliverBill data in listDeliverBill)
                        {
                            if (!dao.UpdateDeliverBillDeliveryNo(data.Id, strDeliveryNo, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return(false);
                            }
                        }
                    }

                    //修改出库单、入库单和库存数据
                    using (StockDAO dao = new StockDAO())
                    {
                        List <OutWarehouseBill> listOutWarehouseBill = dao.LoadOutWarehouseBillsByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText);
                        foreach (OutWarehouseBill data in listOutWarehouseBill)
                        {
                            data.DeliveryNo = strDeliveryNo;
                            data.PayerId    = nPayerId;
                            data.PayerName  = strPayerName;
                            if (!dao.UpdateOutWarehouseBill(data, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return(false);
                            }
                        }
                    }

                    //修改合同数据
                    using (ContractDAO dao = new ContractDAO())
                    {
                        if (nContractId > 0)
                        {
                            Contract data = dao.LoadContract(nContractId, nOpStaffId, strOpStaffName, out strErrText);
                            if (data == null)
                            {
                                return(false);
                            }
                            data.OriginalContractNo = strOriginalContractNo;
                            if (!dao.UpdateContract(data, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return(false);
                            }
                        }
                    }
                    transScope.Complete();
                }
                return(true);
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return(false);
            }
        }