Exemplo n.º 1
0
        /// <summary>
        /// 保存重量
        /// </summary>
        /// <param name="transport"></param>
        /// <returns></returns>
        public bool SaveSaleFuelTransport(CmcsSaleFuelTransport transport)
        {
            if (transport == null)
            {
                return(false);
            }
            transport.IsSynch = "0";

            // 生成批次以及采制化三级编码数据
            CmcsInFactoryBatch inFactoryBatch = CarTransportDAO.GetInstance().GCQCInFactoryBatchBySaleFuelTransport(transport, null);

            if (transport.GrossWeight > 0)
            {
                if (transport.GrossTime.Year < 2000)
                {
                    transport.GrossTime = DateTime.Now; transport.InFactoryTime = DateTime.Now;
                }
                if (transport.TareWeight > 0)
                {
                    if (transport.TareTime.Year < 2000)
                    {
                        transport.TareTime = DateTime.Now;
                    }
                    if (transport.OutFactoryTime.Year < 2000)
                    {
                        transport.OutFactoryTime = DateTime.Now;
                    }

                    transport.SuttleWeight = transport.GrossWeight - transport.TareWeight;

                    // 回皮即完结
                    transport.IsFinish = 1;
                    if (SelfDber.Get <CmcsSaleFuelTransport>(transport.Id) == null)
                    {
                        if (SelfDber.Insert(transport) > 0)
                        {
                            carTransportDAO.DelUnFinishTransport(transport.Id);
                            commonDAO.InsertWaitForHandleEvent("汽车智能化_同步销售煤运输记录到批次", transport.Id);
                            commonDAO.InsertWaitForHandleEvent("汽车智能化_删除未完成运输记录", transport.Id);
                            return(true);
                        }
                    }
                    else
                    {
                        if (SelfDber.Update(transport) > 0)
                        {
                            carTransportDAO.DelUnFinishTransport(transport.Id);
                            commonDAO.InsertWaitForHandleEvent("汽车智能化_同步销售煤运输记录到批次", transport.Id);
                            commonDAO.InsertWaitForHandleEvent("汽车智能化_删除未完成运输记录", transport.Id);
                            return(true);
                        }
                    }
                }
            }
            if (transport.TareTime.Day != transport.InFactoryTime.Day)
            {
                carTransportDAO.GCQCInFactoryBatchBySaleFuelTransport(transport, null);
            }
            return(SelfDber.Update(transport) > 0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 手动保存入厂煤运输记录
        /// </summary>
        /// <param name="transportId"></param>
        /// <param name="weight">重量</param>
        /// <param name="deductweight">扣重</param>
        /// <param name="place"></param>
        /// <returns></returns>
        public bool SaveBuyFuelTransportHand(CmcsBuyFuelTransport transport, decimal weight, DateTime dt, string place)
        {
            if (transport == null)
            {
                return(false);
            }
            transport.IsSynch = "0";

            if (transport.GrossWeight == 0)
            {
                transport.StepName    = eTruckInFactoryStep.重车.ToString();
                transport.GrossWeight = weight;
                transport.GrossPlace  = place;
                transport.GrossTime   = dt;
                // 生成批次以及采制化三级编码数据
                CmcsInFactoryBatch inFactoryBatch = CarTransportDAO.GetInstance().GCQCInFactoryBatchByBuyFuelTransport(transport, null);
            }
            else if (transport.TareWeight == 0)
            {
                transport.StepName       = eTruckInFactoryStep.轻车.ToString();
                transport.TareWeight     = weight;
                transport.TarePlace      = place;
                transport.TareTime       = dt;
                transport.OutFactoryTime = dt;
                transport.SuttleWeight   = transport.GrossWeight - transport.TareWeight;
                ////验收量大于票重时多余的量算到扣吨
                if (transport.TicketWeight != 0)
                {
                    decimal deduct       = transport.SuttleWeight > transport.TicketWeight ? (transport.SuttleWeight - transport.TicketWeight) : 0;
                    decimal letterdeduct = 0;                    //抹去的小数位
                    //transport.SuttleWeight -= deduct;
                    transport.CheckWeight = OneDigit(transport.SuttleWeight - deduct - transport.KsWeight - transport.KgWeight, ref letterdeduct);
                    deduct += letterdeduct;
                    transport.AutoKsWeight = deduct;
                    transport.DeductWeight = transport.AutoKsWeight + transport.KsWeight + transport.KgWeight;
                }
                else
                {
                    transport.DeductWeight = transport.KsWeight + transport.KgWeight;
                    transport.CheckWeight  = transport.SuttleWeight - transport.DeductWeight;
                }
                transport.ProfitAndLossWeight = transport.CheckWeight - transport.TicketWeight;

                // 回皮即完结
                transport.IsFinish = 1;
                carTransportDAO.DelUnFinishTransport(transport.Id);
                commonDAO.InsertWaitForHandleEvent("汽车智能化_同步入厂煤运输记录到批次", transport.Id);
                commonDAO.InsertWaitForHandleEvent("汽车智能化_删除未完成运输记录", transport.Id);
            }
            else
            {
                return(false);
            }
            if (transport.GrossTime.Day != transport.InFactoryTime.Day)
            {
                carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport, null);
            }
            return(SelfDber.Update(transport) > 0);
        }