예제 #1
0
        public bool JoinQueueSaleFuelTransport(CmcsAutotruck autotruck, CmcsTransportSales transportsales, DateTime inFactoryTime, string remark, string place, string loadarea)
        {
            CmcsSaleFuelTransport transport = new CmcsSaleFuelTransport
            {
                SerialNumber         = carTransportDAO.CreateNewTransportSerialNumber(eCarType.销售煤, inFactoryTime),
                AutotruckId          = autotruck.Id,
                CarNumber            = autotruck.CarNumber,
                TransportSalesNum    = transportsales.YbNum,
                TransportSalesId     = transportsales.Id,
                TransportCompanyName = transportsales.TransportCompayName,
                TransportCompanyId   = transportsales.TransportCompayId,
                TransportNo          = transportsales.TransportNo,
                SupplierName         = transportsales.Consignee,
                SupplierId           = transportsales.SaleSorderId,
                InFactoryTime        = inFactoryTime,
                IsFinish             = 0,
                IsUse    = 1,
                StepName = eTruckInFactoryStep.入厂.ToString(),
                LoadArea = loadarea,
                Remark   = remark
            };

            if (SelfDber.Insert(transport) > 0)
            {
                // 插入未完成运输记录
                return(SelfDber.Insert(new CmcsUnFinishTransport
                {
                    TransportId = transport.Id,
                    CarType = eCarType.销售煤.ToString(),
                    AutotruckId = autotruck.Id,
                    PrevPlace = place,
                }) > 0);
            }
            return(false);
        }
예제 #2
0
        /// <summary>
        /// 生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码
        /// </summary>
        /// <param name="autotruck">车</param>
        /// <param name="supplier">供煤单位</param>
        /// <param name="mine">矿点</param>
        /// <param name="transportCompany">运输单位</param>
        /// <param name="fuelKind">煤种</param>
        /// <param name="ticketWeight">矿发量</param>
        /// <param name="inFactoryTime">入厂时间</param>
        /// <param name="remark">备注</param>
        /// <param name="place">地点</param>
        /// <param name="samplingType">采样方式</param>
        /// <returns></returns>
        public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, CmcsInNetTransport inNetTransport, decimal ticketWeight, string samplerCode, string weighterCode, DateTime inFactoryTime, string remark, string place, CmcsSupplier supplier = null)
        {
            CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport
            {
                SerialNumber         = carTransportDAO.CreateNewTransportSerialNumber(eCarType.入厂煤, inFactoryTime),
                AutotruckId          = autotruck.Id,
                CarNumber            = autotruck.CarNumber,
                MineId               = mine.Id,
                MineName             = mine.Name,
                TransportCompanyId   = transportCompany.Id,
                TransportCompanyName = transportCompany.Name,
                FuelKindId           = fuelKind.Id,
                FuelKindName         = fuelKind.Name,
                TicketWeight         = ticketWeight,
                InFactoryTime        = inFactoryTime,
                IsFinish             = 0,
                IsUse             = 1,
                StepName          = eTruckInFactoryStep.入厂.ToString(),
                OutNetTransportId = inNetTransport == null ? "" : inNetTransport.Id,
                SamplePlace       = samplerCode,
                GrossPlace        = weighterCode,
                Remark            = remark,
                SamplingType      = eSamplingType.机械采样.ToString()
            };

            if (supplier != null)
            {
                transport.SupplierId   = supplier.Id;
                transport.SupplierName = supplier.Name;
            }
            // 生成批次以及采制化三级编码数据
            CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport);

            if (inFactoryBatch != null)
            {
                if (SelfDber.Insert(transport) > 0)
                {
                    if (inNetTransport != null)
                    {
                        //更新内网矿发运输记录节点状态
                        inNetTransport.StepName      = eTruckInFactoryStep.入厂.ToString();
                        inNetTransport.Infactorytime = inFactoryTime;
                        SelfDber.Update(inNetTransport);
                    }

                    // 插入未完成运输记录
                    return(SelfDber.Insert(new CmcsUnFinishTransport
                    {
                        TransportId = transport.Id,
                        CarType = eCarType.入厂煤.ToString(),
                        AutotruckId = autotruck.Id,
                        PrevPlace = place,
                    }) > 0);
                }
            }

            return(false);
        }
예제 #3
0
        /// <summary>
        /// 生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码
        /// </summary>
        /// <param name="autotruck">车</param>
        /// <param name="supplier">供煤单位</param>
        /// <param name="mine">矿点</param>
        /// <param name="transportCompany">运输单位</param>
        /// <param name="fuelKind">煤种</param>
        /// <param name="ticketWeight">矿发量</param>
        /// <param name="inFactoryTime">入厂时间</param>
        /// <param name="remark">备注</param>
        /// <param name="place">地点</param>
        /// <param name="samplingType">采样方式</param>
        /// <param name="heavyweight">重车磅</param>
        /// <param name="samplingType">船号</param>
        /// <returns></returns>
        public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsSupplier supplier, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, decimal ticketWeight, DateTime inFactoryTime, string remark, string place, string heavyweight, string shipnumber)
        {
            CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport
            {
                SerialNumber         = carTransportDAO.CreateNewTransportSerialNumber(eCarType.入厂煤, inFactoryTime),
                AutotruckId          = autotruck.Id,
                CarNumber            = autotruck.CarNumber,
                SupplierId           = supplier.Id,
                SupplierName         = supplier.Name,
                MineId               = mine != null ? mine.Id:"",
                MineName             = mine != null ? mine.Name:"",
                TransportCompanyId   = transportCompany != null?transportCompany.Id:"",
                TransportCompanyName = transportCompany != null ? transportCompany.Name:"",
                FuelKindId           = fuelKind != null?fuelKind.Id:"",
                FuelKindName         = fuelKind != null ? fuelKind.Name:"",
                TicketWeight         = ticketWeight,
                InFactoryTime        = inFactoryTime,
                IsFinish             = 0,
                IsUse       = 1,
                StepName    = eTruckInFactoryStep.入厂.ToString(),
                Remark      = remark,
                HeavyWeight = heavyweight,
                ShipName    = shipnumber,
                Recorder    = GlobalVars.LoginUser.Name
            };

            // 生成批次以及采制化三级编码数据
            CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport);

            if (inFactoryBatch != null)
            {
                if (SelfDber.Insert(transport) > 0)
                {
                    // 插入未完成运输记录
                    return(SelfDber.Insert(new CmcsUnFinishTransport
                    {
                        TransportId = transport.Id,
                        CarType = eCarType.入厂煤.ToString(),
                        AutotruckId = autotruck.Id,
                        PrevPlace = place,
                    }) > 0);
                }
            }

            return(false);
        }
예제 #4
0
        /// <summary>
        /// 生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码
        /// </summary>
        /// <param name="autotruck">车</param>
        /// <param name="supplier">供煤单位</param>
        /// <param name="mine">矿点</param>
        /// <param name="transportCompany">运输单位</param>
        /// <param name="fuelKind">煤种</param>
        /// <param name="ticketWeight">矿发量</param>
        /// <param name="inFactoryTime">入厂时间</param>
        /// <param name="Mpph">全过程煤批编号</param>
        /// <param name="sampler">指定采样机编号</param>
        /// <param name="remark">备注</param>
        /// <param name="place">地点</param>
        /// <returns></returns>
        public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsSupplier supplier, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, decimal ticketWeight, DateTime inFactoryTime, string Mpph, string sampler, string remark, string place)
        {
            CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport
            {
                SerialNumber         = carTransportDAO.CreateNewTransportSerialNumber(eCarType.入厂煤, inFactoryTime),
                AutotruckId          = autotruck.Id,
                CarNumber            = autotruck.CarNumber,
                SupplierId           = supplier.Id,
                SupplierName         = supplier.Name,
                MineId               = mine.Id,
                MineName             = mine.Name,
                TransportCompanyId   = transportCompany.Id,
                TransportCompanyName = transportCompany.Name,
                FuelKindId           = fuelKind.Id,
                FuelKindName         = fuelKind.Name,
                TicketWeight         = ticketWeight,
                InFactoryTime        = inFactoryTime,
                IsFinish             = 0,
                IsUse          = 1,
                Mpph           = Mpph,
                SamplePlace    = sampler,
                StepName       = eTruckInFactoryStep.入厂.ToString(),
                HistoryTareAvg = GetHistoryTareAvg(autotruck.CarNumber),
                Remark         = remark
            };

            // 生成批次以及采制化三级编码数据
            //CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport);
            //if (inFactoryBatch != null)
            //{
            if (SelfDber.Insert(transport) > 0)
            {
                // 插入未完成运输记录
                return(SelfDber.Insert(new CmcsUnFinishTransport
                {
                    TransportId = transport.Id,
                    CarType = eCarType.入厂煤.ToString(),
                    AutotruckId = autotruck.Id,
                    PrevPlace = place,
                }) > 0);
            }
            //}

            return(false);
        }
예제 #5
0
        /// <summary>
        ///  生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码
        /// </summary>
        /// <param name="autotruck"></param>
        /// <param name="supplier"></param>
        /// <param name="mine"></param>
        /// <param name="transportCompany"></param>
        /// <param name="fuelKind"></param>
        /// <param name="ticketWeight"></param>
        /// <param name="inFactoryTime"></param>
        /// <param name="remark"></param>
        /// <param name="samplingType"></param>
        /// <param name="lmyb"></param>
        /// <param name="inFactoryType"></param>
        /// <returns></returns>
        public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsSupplier supplier, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, decimal ticketWeight, DateTime inFactoryTime, string remark, string samplingType, CmcsLMYB lmyb, string inFactoryType)
        {
            eTransportType TransportType;

            Enum.TryParse(inFactoryType, out TransportType);
            CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport
            {
                SerialNumber       = carTransportDAO.CreateNewTransportSerialNumber(TransportType, inFactoryTime),
                AutotruckId        = autotruck.Id,
                CarNumber          = autotruck.CarNumber,
                SupplierId         = supplier.Id,
                SupplierName       = supplier.Name,
                InFactoryPlace     = CommonAppConfig.GetInstance().AppIdentifier,
                MineId             = mine.Id,
                MineName           = mine.Name,
                TransportCompanyId = (transportCompany == null ? null : transportCompany.Id),
                FuelKindId         = fuelKind.Id,
                FuelKindName       = fuelKind.FuelName,
                TicketWeight       = ticketWeight,
                InFactoryTime      = inFactoryTime,
                IsFinish           = 0,
                IsUse         = 1,
                SamplingType  = samplingType,
                InFactoryType = inFactoryType.ToString(),
                StepName      = eTruckInFactoryStep.入厂.ToString(),
                Remark        = remark,
                LMYBId        = lmyb != null ? lmyb.Id : "",
                YbNum         = lmyb != null ? lmyb.YbNum : ""
            };

            // 生成批次以及采制化三级编码数据
            CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport, lmyb);

            if (inFactoryBatch != null)
            {
                if (SelfDber.Insert(transport) > 0)
                {
                    // 插入未完成运输记录
                    return(SelfDber.Insert(new CmcsUnFinishTransport
                    {
                        TransportId = transport.Id,
                        CarType = inFactoryType.ToString(),
                        AutotruckId = autotruck.Id,
                        PrevPlace = CommonAppConfig.GetInstance().AppIdentifier,
                    }) > 0);
                }
            }

            return(false);
        }
예제 #6
0
        /// <summary>
        /// 保存入厂煤运输记录
        /// </summary>
        /// <param name="transportId"></param>
        /// <param name="weight">重量</param>
        /// <param name="place"></param>
        /// <returns></returns>
        public bool SaveBuyFuelTransport(string transportId, decimal weight, DateTime dt, string place)
        {
            CmcsBuyFuelTransport transport = SelfDber.Get <CmcsBuyFuelTransport>(transportId);

            if (transport == null)
            {
                return(false);
            }
            if (weight <= 0)
            {
                Log4Neter.Error("称重失败", new Exception("称重时重量为0"));
                return(false);
            }
            //根据当前流程节点名称判断
            if (transport.GrossWeight == 0)
            {
                transport.StepName     = eTruckInFactoryStep.重车.ToString();
                transport.GrossWeight  = weight;
                transport.GrossPlace   = place;
                transport.GrossTime    = dt;
                transport.SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eCarType.入厂煤, dt);
                if (transport.InFactoryTime.Date < dt.Date)
                {
                    transport.InFactoryTime = dt;
                    carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport);
                }
            }
            else if (transport.TareWeight == 0)
            {
                transport.StepName     = eTruckInFactoryStep.轻车.ToString();
                transport.TareWeight   = weight;
                transport.TarePlace    = place;
                transport.TareTime     = 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;
                transport.IsSyncBatch = 0;

                //流程结束时删除临时运输记录
                CmcsUnFinishTransport unFinishTransport = SelfDber.Entity <CmcsUnFinishTransport>("where TransportId=:TransportId", new { TransportId = transportId });
                if (unFinishTransport != null)
                {
                    SelfDber.Delete <CmcsUnFinishTransport>(unFinishTransport.Id);
                }
            }
            else
            {
                return(false);
            }

            transport.IsSynch = 0;

            return(SelfDber.Update(transport) > 0);
        }