Esempio n. 1
0
        // GET: TransportOrders/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransportOrder transportOrder = db.TransportOrder.Find(id);

            if (transportOrder == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AgreementsId      = new SelectList(db.Agreement, "Id", "AgreementBox", transportOrder.AgreementsId);
            ViewBag.CompanyId         = new SelectList(db.Company, "Id", "Address", transportOrder.CompanyId);
            ViewBag.ItemId            = new SelectList(db.Item, "Id", "Name", transportOrder.ItemId);
            ViewBag.LocationId        = new SelectList(db.Location, "Id", "Name", transportOrder.LocationId);
            ViewBag.TransportId       = new SelectList(db.Transport, "Id", "Name", transportOrder.TransportId);
            ViewBag.UnitId            = new SelectList(db.Unit, "Id", "Name", transportOrder.UnitId);
            ViewBag.UserMasId         = new SelectList(db.UserMas, "Id", "Name", transportOrder.UserMasId);
            ViewBag.ProductCategoryId = new SelectList(db.ProductCategory, "Id", "Name", transportOrder.Item.ProductCategoryId);
            ViewBag.totalCarryingCost = transportOrder.OrderQuantity * transportOrder.CarryCost;
            ViewBag.status            = transportOrder.Status;

            return(View(transportOrder));
        }
Esempio n. 2
0
        public static TransportOrderViewModel BindTransportOrderViewModel(TransportOrder transportOrder, string datePref, List <WorkflowStatus> statuses)
        {
            TransportOrderViewModel transportOrderViewModel = null;

            if (transportOrder != null)
            {
                transportOrderViewModel = new TransportOrderViewModel();
                transportOrderViewModel.BidDocumentNo = transportOrder.BidDocumentNo;
                transportOrderViewModel.OrderDate     = transportOrder.OrderDate;
                transportOrderViewModel.OrderDateET   =
                    transportOrder.OrderDate.ToCTSPreferedDateFormat(datePref);
                transportOrderViewModel.ContractNumber           = transportOrder.ContractNumber;
                transportOrderViewModel.PerformanceBondReceiptNo = transportOrder.PerformanceBondReceiptNo;
                transportOrderViewModel.OrderExpiryDate          = transportOrder.OrderExpiryDate;
                transportOrderViewModel.OrderExpiryDateET        = transportOrder.OrderExpiryDate.ToCTSPreferedDateFormat(datePref);
                transportOrderViewModel.Transporter             = transportOrder.Transporter.Name;
                transportOrderViewModel.RequestedDispatchDate   = transportOrder.RequestedDispatchDate;
                transportOrderViewModel.RequestedDispatchDateET = transportOrder.RequestedDispatchDate.ToCTSPreferedDateFormat(datePref);
                transportOrderViewModel.TransporterID           = transportOrder.TransporterID;
                transportOrderViewModel.TransportOrderNo        = transportOrder.TransportOrderNo;
                transportOrderViewModel.TransportOrderID        = transportOrder.TransportOrderID;
                transportOrderViewModel.StatusID  = transportOrder.StatusID;
                transportOrderViewModel.StartDate = transportOrder.StartDate.ToCTSPreferedDateFormat(datePref);
                transportOrderViewModel.EndDate   = transportOrder.EndDate.ToCTSPreferedDateFormat(datePref);
                transportOrderViewModel.Status    = transportOrder.StatusID.HasValue?
                                                    statuses.Find(t => t.StatusID == transportOrder.StatusID.Value).Description:string.Empty;
            }
            return(transportOrderViewModel);
        }
Esempio n. 3
0
        private TransportContractReportViewModel GetTransportOrderReport(TransportOrder transportOrder)
        {
            var datePref             = UserAccountHelper.GetUser(User.Identity.Name).DatePreference;
            var transportOrderReport = new TransportContractReportViewModel()
            {
                TransportOrderID         = transportOrder.TransportOrderID,
                TransportOrderNo         = transportOrder.TransportOrderNo,
                TransporterID            = transportOrder.TransporterID,
                RequisitionNo            = transportOrder.TransportOrderDetails.First().ReliefRequisition.RequisitionNo,
                TransporterName          = transportOrder.Transporter.Name,
                BidDocumentNo            = transportOrder.BidDocumentNo,
                ConsignerName            = transportOrder.ConsignerName,
                ContractNumber           = transportOrder.ContractNumber,
                OrderDate                = transportOrder.OrderDate.ToCTSPreferedDateFormat(datePref),
                OrderExpiryDate          = transportOrder.OrderExpiryDate.ToCTSPreferedDateFormat(datePref),
                RequestedDispatchDate    = transportOrder.RequestedDispatchDate.ToCTSPreferedDateFormat(datePref),
                ConsignerDate            = transportOrder.ConsignerDate.ToCTSPreferedDateFormat(datePref),
                PerformanceBondReceiptNo = transportOrder.PerformanceBondReceiptNo,
                TransporterSignedDate    = transportOrder.TransporterSignedDate.ToCTSPreferedDateFormat(datePref),
                TransporterSignedName    = transportOrder.TransporterSignedName,
                ZoneName      = transportOrder.TransportOrderDetails.First().FDP.AdminUnit.AdminUnit2.Name,
                ZoneID        = transportOrder.TransportOrderDetails.First().FDP.AdminUnit.AdminUnit2.AdminUnitID,
                RegionName    = transportOrder.TransportOrderDetails.First().FDP.AdminUnit.AdminUnit2.AdminUnit2.Name,
                CommodityID   = transportOrder.TransportOrderDetails.First().CommodityID,
                CommodityName = transportOrder.TransportOrderDetails.First().Commodity.Name,
                RequisitionID = transportOrder.TransportOrderDetails.First().FDP.AdminUnit.AdminUnit2.AdminUnit2.AdminUnitID
            };

            return(transportOrderReport);
        }
        public IList <object> CallMethod(string methodIdString, string objectIdString, List <string[]> inputData)
        {
            IList <object> ret = new List <object>();

            if (methodIdString.Equals(opcDelNodId))
            {
                //torolni kell a changed tpo-t a rekeszből
                if (changed.Count > 0)
                {
                    changed.RemoveAt(0);
                    //++++++++ majd amikor jön a tpo id is paraméterben akkor a nagy queu-ból is törölni kell
                    if (inputData != null && (inputData.Count > 0))
                    {
                        int            tpoId = Convert.ToInt32(inputData[0]);
                        TransportOrder tpo   = null;
                        for (int c = 0; c < queue.Count && tpo == null; c++)
                        {
                            if (queue[c].TpId == tpoId)
                            {
                                tpo = queue[c];
                            }
                        }
                        if (tpo != null)
                        {
                            queue.Remove(tpo);
                        }
                    }
                }
            }
            return(ret);
        }
Esempio n. 5
0
        private IEnumerable <TransportOrderDetailViewModel> GetTransportContract(TransportOrder transportOrder)
        {
            var transportContractDetail = transportOrder.TransportOrderDetails;

            return(from detail in transportContractDetail
                   select new TransportOrderDetailViewModel()
            {
                TransportOrderID = detail.TransportOrderID,
                TransportOrderDetailID = detail.TransportOrderDetailID,
                CommodityID = detail.CommodityID,
                SourceWarehouseID = detail.SourceWarehouseID,
                QuantityQtl = detail.QuantityQtl.ToPreferedWeightUnit(),
                RequisitionID = detail.RequisitionID,
                TariffPerQtl = detail.TariffPerQtl,
                Commodity = detail.Commodity.Name,
                OriginWarehouse = detail.Hub.Name,
                HubID = detail.Hub.HubID,
                Woreda = detail.FDP.AdminUnit.Name,
                FDP = detail.FDP.Name,
                RequisitionNo = detail.ReliefRequisition.RequisitionNo,
                WinnerAssignedByLogistics = detail.WinnerAssignedByLogistics
                                            // Donor=detail.Donor.Name
            });

            // return transportContractDetail;
        }
        public IList <object> sendPLCTransaction(TransportOrder transportOrder)
        {
            List <string[]> inputData    = PLCTransaction.getTransactionData(transportOrder);
            IList <object>  outputValues = CallMethod(opcSetNodId, opcSetObjId, inputData);

            return(outputValues);
        }
        public List <string> ReadValues(List <string> inputParams)
        {
            List <String> ret = new List <string>();

            //plc q site
            if (compareParams(inputParams, opcQueryQSize))
            {
                ret = getOneValueList("" + queue.Count);
            }
            else
            //Transportorderid + status
            if (compareParams(inputParams, opcTransportStatusChanges))
            {
                //Transportorderid + status
                if (changed.Count > 0)
                {
                    TransportOrder tpo          = changed[0];
                    Int64          tpoStatusInt = (Int64)tpo.TpId;
                    tpoStatusInt = (tpoStatusInt << 32) & tpo.msgStatus;
                    ret          = getOneValueList(Convert.ToString(tpoStatusInt));
                }
                else
                {
                    ret = getOneValueList("0");
                }
            }
            return(ret);
        }
Esempio n. 8
0
        public string Create(Billing mo)
        {
            try
            {
                // 1. 主表部分
                // 1.1 创建人
                //if (Session["LoginUser"] != null)
                //{
                //    mo.Creator = (SysUser)Session["loginUser"];
                //}
                // 1.2 报销时间
                mo.CreateDate = DateTime.Now;

                // 2. 明细表
                mo.BillingItemList = new List <BillingItem>();
                var allBillingItemType = Container.Instance.Resolve <BillingItemTypeService>().GetAll();
                // 最大行数
                int detailRowCount = int.Parse(Request["detailRowCount"]);
                // 关于行循环
                for (int i = 1; i <= detailRowCount; i++)
                {
                    // 检查明细行是否存在
                    if (Request["BillingItemType" + i] == null)
                    {
                        continue;
                    }
                    // 处理明细行输入
                    BillingItem bi = new BillingItem();
                    if (Request["ID" + i] != null)
                    {
                        // 原有行
                        bi.ID = int.Parse(Request["ID" + i]);
                    }

                    bi.Fee    = decimal.Parse(Request["Fee" + i]);
                    bi.Remark = Request["Remark" + i];
                    int billingItemTypeId = int.Parse(Request["BillingItemType" + i]);
                    bi.BillingItemType = (from m in allBillingItemType
                                          where m.ID == billingItemTypeId
                                          select m).FirstOrDefault();
                    // 关联主表与从表
                    bi.Billing = mo;
                    mo.BillingItemList.Add(bi);
                }

                // 3. 提交主表(级联提交明细表)
                Container.Instance.Resolve <BillingService>().Create(mo);
                // 4. 更新托运单状态
                DeliveryForm   deliveryForm   = Container.Instance.Resolve <DeliveryFormService>().GetEntity(mo.DeliveryForm.ID);
                TransportOrder transportOrder = deliveryForm.TransportOrder;
                transportOrder.Status = 3; // 已报账
                Container.Instance.Resolve <TransportOrderService>().Edit(transportOrder);

                return("ok");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Esempio n. 9
0
 public void DeleteDependentRoute(TransportOrder to, HorseplayContext db)
 {
     if (to.Route != null)
     {
         //delete route data
         if (to.Route.Stops.Any())
         {
             Address    oldAddress;
             RouteStop  oldStop;
             List <int> stopIds = new List <int>();
             //we have to delete all the stops first
             foreach (var stop in to.Route.Stops)
             {
                 var ads = db.Addresses.Where(a => a.AddressId == stop.AddressId);
                 if (ads.Any())
                 {
                     oldAddress = stop.Address;
                     db.Addresses.Remove(oldAddress);
                     db.SaveChanges();
                 }
                 stopIds.Add(stop.RouteStopId);
             }
             foreach (int i in stopIds)
             {
                 oldStop = db.RouteStops.Where(rs => rs.RouteStopId == i).FirstOrDefault();
                 db.RouteStops.Remove(oldStop);
                 db.SaveChanges();
             }
         }
         Route oldRoute = db.Routes.Where(r => r.RouteId == to.Route.RouteId).FirstOrDefault();
         db.Routes.Remove(oldRoute);
         db.SaveChanges();
     }
 }
Esempio n. 10
0
        private IEnumerable <TransportOrderDetailViewModel> GetTransportContract(TransportOrder transportOrder)
        {
            var datePref = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference;
            var hubId    = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DefaultHub.HasValue ? _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DefaultHub.Value : 0;
            var transportContractDetail = transportOrder.TransportOrderDetails.Where(m => m.SourceWarehouseID == hubId);

            return(from detail in transportContractDetail
                   select new TransportOrderDetailViewModel()
            {
                TransportOrderID = detail.TransportOrderID,
                CommodityID = detail.CommodityID,
                SourceWarehouseID = detail.SourceWarehouseID,
                QuantityQtl = detail.QuantityQtl.ToPreferedWeightUnit(),
                RequisitionID = detail.RequisitionID,
                TariffPerQtl = detail.TariffPerQtl,
                Commodity = detail.Commodity.Name,
                OriginWarehouse = detail.Hub.Name,
                HubID = detail.Hub.HubID,
                Woreda = detail.FDP.AdminUnit.Name,
                FDP = detail.FDP.Name,
                RequisitionNo = detail.ReliefRequisition.RequisitionNo
            });

            // return transportContractDetail;
        }
Esempio n. 11
0
        public void CreateTransportOrder(int type, int ctrH, int ctrD, LoadCarrier lc, int IocpId, int weight, StorageLocation sourceLocation, StorageLocation targetLocation)
        {
            //Csinálunk egy sessiont
            Session workSession = new Session();

            //Megkeressük az erőforrásokat
            CommonTrHeader ctrHeader = workSession.FindObject <CommonTrHeader>(new BinaryOperator("Oid", ctrH));
            CommonTrDetail cdetail   = workSession.FindObject <CommonTrDetail>(new BinaryOperator("Oid", ctrD));
            Iocp           iocp      = workSession.FindObject <Iocp>(new BinaryOperator("Oid", IocpId));

            //Osztumk egy új sorszámot
            ushort UjTransportID = GetNewSorszam("TPO");

            //Létrehozzuk az új transzportot az adatbázisban
            TransportOrder transportOrder = new TransportOrder(workSession);

            transportOrder.Iocp = iocp;
            transportOrder.TpId = UjTransportID;
            transportOrder.LC   = lc;

            transportOrder.CommonTrHeader = ctrHeader;
            transportOrder.CommonDetail   = cdetail;
            transportOrder.Type           = type;
            transportOrder.TargetTag      = iocp.TargetTag;
            transportOrder.SourceLocation = sourceLocation;
            transportOrder.TargetLocation = targetLocation;
            transportOrder.Weight         = weight;
            transportOrder.Save();


            // Hozzáadjuk a megfelelő iocp zsák queue-hoz
            this.opcClient.addJob(transportOrder);
        }
Esempio n. 12
0
        public ActionResult AddDetail(string TransactionID, string Quantity, string FeeName,
                                      string FeeAmount, string CntrSize, string LocationID)
        {
            int               tid  = Int32.Parse(TransactionID);
            string            unit = Uri.UnescapeDataString(CntrSize);
            TransactionDetail td   = new TransactionDetail();
            Transaction       t    = db.Transactions.Where(x => x.ID == tid).FirstOrDefault();

            td.TransactionID = Int32.Parse(TransactionID);
            td.FeeName       = FeeName;
            td.FeeAmount     = Int32.Parse(FeeAmount);
            td.Quantity      = Int32.Parse(Quantity);
            td.Total         = td.FeeAmount * td.Quantity;
            t.Total         += td.Total;
            td.CntrSize      = unit;
            db.TransactionDetails.Add(td);
            db.SaveChanges();
            if (FeeName.Contains("VanChuyen"))
            {
                for (int i = 0; i < Int32.Parse(Quantity); i++)
                {
                    TransportOrder to = new TransportOrder();
                    to.TransactionID = td.ID;
                    to.LocationID    = Int32.Parse(LocationID);
                    to.CntrSize      = unit;
                    db.TransportOrders.Add(to);
                    db.SaveChanges();
                }
            }
            return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 13
0
        public int GetFont(TransportOrder to)
        {
            int maxCharacters = 0;
            int fontSize      = 0;

            if (to.Route != null)
            {
                foreach (var stop in to.Route.Stops)
                {
                    if (stop.Address.FullName.Trim().Length > maxCharacters)
                    {
                        maxCharacters = stop.Address.FullName.Trim().Length;
                    }
                }
            }
            if (maxCharacters > 76)
            {
                fontSize = 7;
            }
            else if (maxCharacters <= 76 && maxCharacters > 55)
            {
                fontSize = 8;
            }
            else if (maxCharacters <= 55 && maxCharacters > 40)
            {
                fontSize = 9;
            }
            else
            {
                fontSize = 10;
            }
            return(fontSize);
        }
Esempio n. 14
0
        private Boolean sendNextJobToPLC()
        {
            Boolean ret = false;

            //minden zsákba belenéz ha nincs az előző zsákban job.
            for (int ctr = 0; ctr < zsakok.Count && !ret; ctr++)
            {
                Dictionary <String, BlockingCollection <TransportOrder> > .KeyCollection keys = zsakok.Keys;
                String key = keys.ElementAt(qPointer);
                BlockingCollection <TransportOrder> queue = zsakok[key];
                TransportOrder job    = null;
                Boolean        hasJob = queue.TryTake(out job);
                if (hasJob && (job != null))
                {
                    //send job to plc
                    plcHandler.sendPLCTransaction(job);
                }
                else
                {
                    //ez nem kell, limitálatlan méretű q-k kellenek!!!
                    //ennek feltétele az, hogy az indulás után minden job a server oldalon kerüljön rögzítésre
                    //a db-ben és a memóriában is azonnal !!!
                    //meg kell probalni betolteni a db-bol N darab jobot az adott q-ba.
                }
                qPointer++;
                if (qPointer >= zsakok.Count)
                {
                    qPointer = 0;
                }
            }
            return(ret);
        }
Esempio n. 15
0
        /*
         * Minden beérkező jobot
         * 1. eltárol az adatbázisban a kommisiózó pult azonosítójával a jobot.
         * 2. beleteszi a saját blocking queue végére (minden pult in, out q)
         * A queue-t a komissiózó pult azonosítója azonosítja
         */
        public void addJob(TransportOrder tpo)
        {
            String key = tpo.Iocp.Oid + tpo.Type == 0 ? "_out" : "_in";
            BlockingCollection <TransportOrder> q = zsakok[key];

            q.Add(tpo);
        }
Esempio n. 16
0
        private TransportContractViewModel GetTransportOrder(TransportOrder transportOrder)
        {
            var datePref          = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference;
            var transportContract = new TransportContractViewModel()
            {
                TransportOrderID         = transportOrder.TransportOrderID,
                TransportOrderNo         = transportOrder.TransportOrderNo,
                TransporterID            = transportOrder.TransporterID,
                RequisitionNo            = transportOrder.TransportOrderDetails.First().ReliefRequisition.RequisitionNo,
                Transporter              = transportOrder.Transporter.Name,
                BidDocumentNo            = transportOrder.BidDocumentNo,
                ConsignerName            = transportOrder.ConsignerName,
                ContractNumber           = transportOrder.ContractNumber,
                OrderDate                = transportOrder.OrderDate.ToCTSPreferedDateFormat(datePref),
                OrderExpiryDate          = transportOrder.OrderExpiryDate.ToCTSPreferedDateFormat(datePref),
                RequestedDispatchDate    = transportOrder.RequestedDispatchDate.ToCTSPreferedDateFormat(datePref),
                ConsignerDate            = transportOrder.ConsignerDate.ToCTSPreferedDateFormat(datePref),
                PerformanceBondReceiptNo = transportOrder.PerformanceBondReceiptNo,
                TransporterSignedDate    = transportOrder.TransporterSignedDate.ToCTSPreferedDateFormat(datePref),
                TransporterSignedName    = transportOrder.TransporterSignedName,
                StatusID = transportOrder.StatusID,
                Zone     = transportOrder.TransportOrderDetails.First().FDP.AdminUnit.AdminUnit2.Name,
                Region   = transportOrder.TransportOrderDetails.First().FDP.AdminUnit.AdminUnit2.AdminUnit2.Name
            };

            return(transportContract);
        }
Esempio n. 17
0
    public void DeleteOrder(HexPath path)
    {
        TransportOrder order = supplyLines.First(x => x.requestor == path);

        supplyLines.Remove(order);
        allocateLabor();
    }
Esempio n. 18
0
    public static TPlist Check(Unit trolley, Hook src, Hook dst)
    {
        TPlist result = null;

        try
        {
            TransportOrder to = new TransportOrder()
            {
                TransportSource = TransportOrder.Destinations.Storage,
                TransportTarget = TransportOrder.Destinations.Storage,
                State           = TransportOrder.OrderStates.PreparedForTrolley
            };

            to.SourceHook = src.ToString();
            to.TargetHook = dst.ToString();
            result        = MovementSequencer.SplitTransportOrder(to, trolley);

            Console.WriteLine(result.ToString());
        }
        catch
        {
        }

        return(result);
    }
Esempio n. 19
0
        public static void TransportOrderFailed(TransportOrder ta, string exit_reason)
        {
            try
            {
                if (ta == null)
                {
                    return;
                }

                log.Error($"order failed : {ta}");
                ta.State       = TransportOrder.OrderStates.Error;
                ta.exit_reason = exit_reason;
                ta.exit_time   = DateTime.Now;
                ta.Update();

                // release hooks
                Main.Database.Execute("UPDATE Rack SET Order_ID=0 WHERE Order_ID=@0", ta.ID);
                // release trolleys and loading stations
                Main.Database.Execute("UPDATE Units SET Reserved=0 WHERE Reserved=@0", ta.ID);
                Main.Database.Execute("UPDATE AGVLocations SET start_wanted=0, confirmation_is_on=0, storage_order_id=0 " +
                                      "WHERE storage_order_id=@0", ta.ID);

                if (ta.LoadingStation != 0)
                {
                    Main.Database.Execute("UPDATE Units SET barcode='', barcode_bad=0, barcode_ok=0 "
                                          + " WHERE Unit_ID >= 11 AND Unit_ID <= 13 and Reserved=@0", ta.ID);
                }

                if (ta.IsAgvOrder && ta.MovingInside)
                {
                    int cnt = Main.Database.Execute("UPDATE StorageOrders SET Status='error', OrderState=@2 " +
                                                    " WHERE NOT Status IN ('done', 'error', 'timeout') AND AGV_location_machinename=@1 " +
                                                    " AND ID <> @0 AND rewind_code=@3 AND Target=1 AND Source<>1",
                                                    ta.ID, ta.AGV_location_machinename, TransportOrder.OrderStates.Error,
                                                    ta.rewind_code);

                    if (cnt > 0)
                    {
                        log.Warn($"{cnt} other orders canceled, because of failed order {ta.ID} from {ta.SimpleMachineName} to WIP");
                    }
                }

                var mvs = Main.Database.Fetch <MoveOrderEntry>("WHERE NOT Status IN ('done', 'error', 'timeout') AND Order_ID = @0", ta.ID);
                foreach (var move in mvs)
                {
                    move.MoveStatus = MoveOrderStatus.error;
                    move.Update();
                }

                var tw = Main.Database.FirstOrDefault <TransportOrder>("WHERE WaitForTransport_ID=@0", ta.ID);
                if (tw != null)
                {
                    TransportOrderFailed(tw, "dependent order canceled " + exit_reason);  // den auf uns wartenden auch abbrechen
                }
            }
            catch (Exception ex)
            {
                log.Error($"Error canceling order {ta}", ex);
            }
        }
Esempio n. 20
0
        public ActionResult Create()
        {
            // 1.准备实体
            TransportOrder mo = new TransportOrder();

            mo.TransportOrderItemList = mo.TransportOrderItemList ?? new List <TransportOrderItem>();
            // 2.返回视图前预处理
            // 2.1 省市
            int provinceId = mo.Province == null ? 0 : mo.Province.ID;

            ViewBag.ddlProvince = InitDDLForProvince(provinceId);
            // 2.2 运输方式 DeliverType
            int deliverTypeId = mo.DeliveryType == null ? 0 : mo.DeliveryType.ID;

            ViewBag.rblDeliverType = InitRBLForDeliverType(deliverTypeId);
            // 2.3 托运人
            int customerId = mo.Customer == null ? 0 : mo.Customer.ID;

            ViewBag.ddlCustomer = InitDDLForCustomer(customerId);
            // 2.4 收货人
            int receiverId = mo.Receiver == null ? 0 : mo.Receiver.ID;

            ViewBag.ddlReceiver = InitDDLForCustomer(receiverId);
            // 2.5 状态
            ViewBag.ddlStatus = InitDDLForStatus(mo.Status);
            // 2.6 全部客户信息
            ViewBag.allClientInfo = InitStrForClient();

            // 3.返回视图
            return(View(mo));
        }
Esempio n. 21
0
        public string Create(TransportOrder mo)
        {
            try
            {
                // 1.1 明细表
                // 提交前预处理
                mo.TransportOrderItemList = new List <TransportOrderItem>();
                // 明细行最大行数
                int detailRowCount = int.Parse(Request["detailRowCount"]);

                TransportOrderItem toi = new TransportOrderItem();
                for (int i = 1; i <= detailRowCount; i++)
                {
                    // 根据货物名称判断是否被删除
                    if (Request["CargoName" + i] == null)
                    {
                        continue;
                    }

                    if (Request["ID" + i] == null)
                    {
                        // 新增行
                    }
                    else
                    {
                        // 原有行
                        toi.ID = int.Parse(Request["ID" + i]);
                    }
                    toi.CargoName     = Request["CargoName" + i];
                    toi.CabinetSort   = Request["CabinetSort" + i];
                    toi.CabinetType   = Request["CabinetType" + i];
                    toi.Amount        = int.Parse(Request["Amount" + i]);
                    toi.CabinetNumber = Request["CabinetNumber" + i];
                    toi.SealedNumber  = Request["SealedNumber" + i];
                    toi.TransportFee  = double.Parse(Request["TransportFee" + i]);

                    // 添加到明细列表
                    toi.TransportOrder = mo;
                    mo.TransportOrderItemList.Add(toi);
                }
                // 1.2 创建人
                if (Session["loginUser"] != null)
                {
                    mo.Creator = (SysUser)Session["loginUser"];
                }
                // 1.3 创建时间
                mo.CreateDate = DateTime.Now;
                // 1.4 状态
                mo.Status = 0;
                // 提交主表, 级联提交明细表
                Container.Instance.Resolve <TransportOrderService>().Create(mo);

                return("ok");
            }
            catch (Exception exp)
            {
                return(exp.Message);
            }
        }
Esempio n. 22
0
        public ActionResult DeleteConfirmed(int id)
        {
            TransportOrder transportOrder = db.TransportOrder.Find(id);

            db.TransportOrder.Remove(transportOrder);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 23
0
    public void CreateOrder(HexPath path)
    {
        TransportOrder order = new TransportOrder();

        order.requestor = path;
        order.amount    = path.army.Manpower;
        supplyLines.Add(order);
        allocateLabor();
    }
Esempio n. 24
0
        public int DaysElapsed(TransportOrder transportOrder)
        {
            var days = -1;

            if ((int)(transportOrder.StartDate - DateTime.Now).TotalDays > 0)
            {
                days = (int)(DateTime.Now - transportOrder.StartDate).TotalDays;
            }
            return(days);
        }
Esempio n. 25
0
        public int DaysLeft(TransportOrder transportOrder)
        {
            var days = -1;

            if ((int)(transportOrder.StartDate - DateTime.Now).TotalDays > 0)
            {
                days = (int)(transportOrder.EndDate - DateTime.Now).TotalDays;
            }
            return(days);
        }
        private void DeleteTransports()
        {
            IList listTpo = View.ObjectSpace.GetObjects(typeof(TransportOrder));
            int   counter = listTpo.Count;

            for (int i = 0; i < counter; i++)
            {
                TransportOrder tpo = (TransportOrder)listTpo[0];
                tpo.Delete();
            }
            ObjectSpace.CommitChanges();
        }
        public void SetTransportOrderORIG(int tpoId)
        {
            Session         session        = new Session();
            TransportOrder  transportOrder = session.FindObject <TransportOrder>(CriteriaOperator.Parse("[TpId] = ?", tpoId));
            List <string[]> inputData      = new List <string[]>();

            //string msgID = transportOrder.TpId.ToString();
            //string msgCtrhidCurrdSumd = Convert.ToString(JoinTogetherTransaction(CommonTrHeader.Oid, CommonDetail.Oid, CommonTrHeader.CommonTrDetails.Count));
            //string msgTypeAccPrTime = Convert.ToString(JoinTogetherTypeAccPrTime(0, Type, LC.LeglassabbGyorsulasVissz(6), 1, 0));
            //string msgLoadCarrier = Convert.ToString(LC.Oid);
            //string msgSource;
            //string msgSourceLHU1;
            //string msgSourceLHU2;
            //string msgTarget;
            //string msgTargetLHU1;
            //string msgTargetLHU2;


            //if (transportOrder.SourceLocation != null)
            //{
            //    //msgSource = Convert.ToString(JoinTogetherSource(SourceLocation.Block, SourceLocation.Row, SourceLocation.Column));
            //    //msgSourceLHU1 = Convert.ToString(JoinTogetherLhu(SourceLocation.LHU1X, SourceLocation.LHU1Y));
            //    //msgSourceLHU2 = Convert.ToString(JoinTogetherLhu(SourceLocation.LHU2X, SourceLocation.LHU2Y));
            //}
            //else
            //{
            //    msgSource = "0";
            //    msgSourceLHU1 = "0";
            //    msgSourceLHU2 = "0";
            //}

            //if (transportOrder.TargetLocation != null)
            //{
            //    msgTarget = Convert.ToString(JoinTogetherTarget(0, TargetLocation.Block, TargetLocation.Row, TargetLocation.Column, 0, 0));
            //    msgTargetLHU1 = Convert.ToString(JoinTogetherLhu(0, 0));
            //    msgTargetLHU2 = Convert.ToString(JoinTogetherLhu(0, 0));
            //}
            //else
            //{
            //    msgTarget = Convert.ToString(JoinTogetherTarget(0, 0, 0, 0, 0, TargetTag));
            //    msgTargetLHU1 = "0";
            //    msgTargetLHU2 = "0";
            //}



            //TODO Súly kitöltése
            // msgWeight = "0";

            IList <object> outputValues = myClientHelperAPI.CallMethod(opcSetNodId, opcSetObjId, inputData);
            //transportOrder.DecomposeTransportMessage(outputValues);
        }
        private void DeleteTransport(int tpoOid)
        {
            Iocp iocp = (Iocp)View.CurrentObject;

            CriteriaOperator ctpo = CriteriaOperator.Parse("[Oid] = ?", tpoOid);
            TransportOrder   t    = (TransportOrder)View.ObjectSpace.FindObject(typeof(TransportOrder), ctpo);

            if (t != null)
            {
                t.Delete();
                View.ObjectSpace.CommitChanges();
            }
        }
Esempio n. 29
0
        private void btnTaIn_Click(object sender, EventArgs e)
        {
            //if (MessageBox.Show("database will be changed. random mid-size cylinder generated.\r\n Proceed ?",
            //    "Attention", MessageBoxButtons.YesNo) == DialogResult.No)
            //    return;

            CheckTrolleyCylinders();

            Button   btn = ((Button)sender);
            Cylinder cy  = null;

            int ls_nr = 10 + int.Parse(btn.Tag.ToString());

            if (ls_nr == 13 && btn.Text.ToLowerInvariant().Contains("big"))
            {
                cy = TestFunctions.PutBigNewRandomCylinderOnLoadingStation3a(998);
            }
            else
            {
                cy = TestFunctions.PutNewRandomCylinderOnLoadingStation(ls_nr);

                cy.Diameter = 777;

                if (btn.Text.ToLowerInvariant().Contains("small"))
                {
                    cy.Diameter = 241;
                }

                if (btn.Text.ToLowerInvariant().Contains("big"))
                {
                    cy.Diameter = 999;
                }

                cy.Update();
            }
            if (cy != null)
            {
                TransportOrder ta = new TransportOrder();
                ta.ID              = TransportOrder.GetNextNegativeID();
                ta.Cylinder_ID     = (int)cy.ID;
                ta.Diameter        = cy.Diameter;
                ta.JobNumber       = "restart inside";
                ta.Label           = cy.Number;
                ta.ItemNumber      = cy.ItemNumber;
                ta.TransportSource = TransportOrder.Destinations.Scanned;
                ta.TransportTarget = TransportOrder.Destinations.Storage;
                ta.LoadingStation  = ls_nr;
                ta.Insert();
            }
        }
Esempio n. 30
0
        // GET: TransportOrders/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TransportOrder transportOrder = db.TransportOrder.Find(id);

            if (transportOrder == null)
            {
                return(HttpNotFound());
            }
            return(View(transportOrder));
        }