Example #1
0
        /// <summary>
        /// 复制发货计划数据
        /// </summary>
        /// <param name="nId"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long CopyDeliverPlan(long nId, 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.CopyDeliverPlan(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (nPlanId <= 0)
                        {
                            return 0;
                        }
                    }
                    transScope.Complete();
                }
                return nPlanId;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return 0;
            }
        }
Example #2
0
        /// <summary>
        /// 取消发货计划数据
        /// </summary>
        /// <param name="nId"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool CancelDeliverPlan(long nId, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                strErrText = String.Empty;

                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (PlanDAO dao = new PlanDAO())
                    {
                        if (!dao.CancelDeliverPlan(nId, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                    }
                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }
Example #3
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 #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 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 #5
0
 /// <summary>
 /// 提交发货计划数据
 /// </summary>
 /// <param name="nId"></param>
 /// <param name="bIsAgreed"></param>
 /// <param name="strApproveComment"></param>
 /// <param name="nOpStaffId"></param>
 /// <param name="strOpStaffName"></param>
 /// <param name="strMessage"></param>
 /// <returns></returns>
 public bool SubmitDeliverPlan(long nId, bool bIsAgreed, string strApproveComment, long nOpStaffId, string strOpStaffName, out string strMessage)
 {
     try
     {
         using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
         {
             using (PlanDAO dao = new PlanDAO())
             {
                 if (!dao.SubmitDeliverPlan(nId, bIsAgreed, strApproveComment, nOpStaffId, strOpStaffName, out strMessage))
                 {
                     return false;
                 }
             }
             transScope.Complete();
         }
         return true;
     }
     catch (Exception e)
     {
         strMessage = e.Message;
         return false;
     }
 }
Example #6
0
        /// <summary>
        /// 读取待提交的计划数据
        /// </summary>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public List<DeliverPlan> LoadSubmitDeliverPlans(long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                List<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.LoadSubmitDeliverPlans(nOpStaffId, strOpStaffName, out strErrText);
                    }
                    transScope.Complete();
                }
                return dataResult;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return null;
            }
        }
Example #7
0
        /// <summary>
        /// 读取全部待调度发货计划数据
        /// </summary>
        /// <param name="strOrganId"></param>
        /// <param name="strCustomerName"></param>
        /// <param name="strShipmentNo"></param>
        /// <param name="strDeliveryNo"></param>
        /// <param name="strReceiverName"></param>
        /// <param name="strDestCountry"></param>
        /// <param name="strDestProvince"></param>
        /// <param name="strDestCity"></param>
        /// <param name="strWarehouse"></param>
        /// <param name="strArrivalTime"></param>
        /// <param name="strCarNo"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public List<DeliverPlan> LoadDispatchDeliverPlans(string strOrganId, string strCustomerName, string strShipmentNo, string strDeliveryNo, string strReceiverName, string strDestCountry, string strDestProvince, string strDestCity, string strWarehouse, string strArrivalTime, string strCarNo, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                List<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.LoadDispatchDeliverPlans(strOrganId, strCustomerName, strShipmentNo, strDeliveryNo, strReceiverName, strDestCountry, strDestProvince, strDestCity, strWarehouse, strArrivalTime, strCarNo, nOpStaffId, strOpStaffName, out strErrText);
                    }
                    transScope.Complete();
                }
                return dataResult;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return null;
            }
        }
Example #8
0
        /// <summary>
        /// 读取指定货物编码、客户编码、寄库交货单号、仓库和批次号的所有计划货物结存数据
        /// </summary>
        /// <param name="strCustomerId"></param>
        /// <param name="strGoodsId"></param>
        /// <param name="strBatchNo"></param>
        /// <param name="strPacking"></param>
        /// <param name="strWarehouse"></param>
        /// <param name="strLocation"></param>
        /// <param name="strProductionDate"></param>
        /// <param name="strEnterWarehouseBillId"></param>
        /// <param name="strDeliveryNo"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public List<DeliverPlanGoods> LoadDeliverPlanGoodsBalancesByConditions(string strCustomerId, string strGoodsId, string strBatchNo, string strPacking, string strWarehouse, string strLocation, string strProductionDate, string strEnterWarehouseBillId, string strDeliveryNo, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                List<DeliverPlanGoods> dataResult = null;
                strErrText = String.Empty;

                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (PlanDAO dao = new PlanDAO())
                    {
                        dataResult = dao.LoadDeliverPlanGoodsBalancesByConditions(strCustomerId, strGoodsId, strBatchNo, strPacking, strWarehouse, strLocation, strProductionDate, strEnterWarehouseBillId, strDeliveryNo, nOpStaffId, strOpStaffName, out strErrText);
                    }
                    transScope.Complete();
                }
                return dataResult;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return null;
            }
        }
Example #9
0
        /// <summary>
        /// 取消出仓单
        /// </summary>
        /// <param name="nId"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool CancelShipmentBill(long nId, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                strErrText = string.Empty;
                long nDispatchBillId = 0;
                long nPlanId = 0;
                string strOutType = string.Empty;

                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    //删除出仓单数据
                    using (DeliverDAO dao = new DeliverDAO())
                    {
                        //读取出仓单数据
                        ShipmentBill bill = dao.LoadShipmentBill(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (bill == null)
                        {
                            return false;
                        }
                        nDispatchBillId = bill.DispatchBillId;
                        nPlanId = bill.PlanId;
                        strOutType = bill.OutType;

                        //删除出仓单数据
                        if (!dao.DeleteShipmentBill(nId, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }

                        //删除出仓单货物数据
                        if (!dao.DeleteShipmentBillAllGoods(nId, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                    }

                    //删除出库单数据
                    using (StockDAO dao = new StockDAO())
                    {
                        //读取出库单数据
                        OutWarehouseBill bill = dao.LoadOutWarehouseBillByShipmentBillId(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (bill == null)
                        {
                            return false;
                        }

                        //删除出库单数据
                        if (!dao.DeleteOutWarehouseBill(bill.Id, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }

                        //删除出库单货物数据
                        if (!dao.DeleteOutWarehouseBillAllGoods(bill.Id, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                    }

                    //如果是划拨出库,则删除入库单数据
                    if (strOutType == InnoSoft.LS.Resources.Options.AllocateGoods)
                    {
                        using (StockDAO dao = new StockDAO())
                        {
                            //读取入库单编码
                            EnterWarehouseBill bill = dao.LoadEnterWarehouseBillByPlanId(nPlanId, nOpStaffId, strOpStaffName, out strErrText);
                            if (bill == null)
                            {
                                return false;
                            }

                            //删除入库单货物数据
                            if (!dao.DeleteEnterWarehouseBillAllGoods(bill.Id, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }

                            //删除入库单数据
                            if (!dao.DeleteEnterWarehouseBill(bill.Id, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }
                        }
                    }

                    //如果是发货出库,则修改调度记录数据
                    if (strOutType == InnoSoft.LS.Resources.Options.DeliverGoods)
                    {
                        using (DispatchDAO dao = new DispatchDAO())
                        {
                            //读取调度单计划数据
                            DispatchBillDeliverPlan plan = dao.LoadDispatchBillDeliverPlan(nDispatchBillId, nPlanId, nOpStaffId, strOpStaffName, out strErrText);
                            if (plan == null)
                            {
                                return false;
                            }

                            //读取调度单数据
                            DispatchBill bill = dao.LoadDispatchBill(nDispatchBillId, nOpStaffId, strOpStaffName, out strErrText);
                            if (bill == null)
                            {
                                return false;
                            }

                            //修改或删除调度单数据
                            bill.TotalPackages = bill.TotalPackages - plan.Packages;
                            bill.TotalTunnages = bill.TotalTunnages - plan.Tunnages;
                            bill.TotalPiles = bill.TotalPiles - plan.Piles;
                            bill.TotalTenThousands = bill.TotalTenThousands - plan.TenThousands;
                            bill.TotalTransportCharges = bill.TotalTransportCharges - plan.TransportCharges;

                            if (bill.TotalPackages == 0 && bill.TotalTunnages == 0 && bill.TotalPiles == 0 && bill.TotalTenThousands == 0)
                            {
                                if (!dao.DeleteDispatchBill(nDispatchBillId, nOpStaffId, strOpStaffName, out strErrText))
                                {
                                    return false;
                                }
                            }
                            else
                            {
                                if (!dao.UpdateDispatchBill(bill, nOpStaffId, strOpStaffName, out strErrText))
                                {
                                    return false;
                                }
                            }

                            //删除调度单计划数据
                            if (!dao.DeleteDispatchBillDeliverPlan(nDispatchBillId, nPlanId, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }

                            //删除调度计划货物数据
                            if (!dao.DeleteDispatchBillDeliverPlanAllGoods(nDispatchBillId, nPlanId, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }

                            //校验调度单数据
                            if (bill.TotalPackages != 0 || bill.TotalTunnages != 0 || bill.TotalPiles != 0 || bill.TotalTenThousands != 0)
                            {
                                if (!dao.CheckDispatchBill(nDispatchBillId, nOpStaffId, strOpStaffName, out strErrText))
                                {
                                    return false;
                                }
                            }
                        }
                    }

                    //如果是划拨出库,则直接取消发货计划
                    if (strOutType == InnoSoft.LS.Resources.Options.AllocateGoods)
                    {
                        using (PlanDAO dao = new PlanDAO())
                        {
                            if (!dao.CancelDeliverPlan(nPlanId, nOpStaffId, strOpStaffName, out strErrText))
                            {
                                return false;
                            }
                        }
                    }

                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }
Example #10
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;
            }
        }
Example #11
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;
            }
        }