// Use this for initialization protected override void Start() { if (instance == null) { instance = this; } else { Destroy(this); } base.Start(); trustDrainRate = 0.1f; departmentName = "Logistics"; GameManager.RegisterDepartment(Departments.Logistics, this); Capacity = startingCapacity; currentStocks = startingStocks; while (GetTotalStocks() > Capacity) { ExpendGame(0); ExpendGame(1); ExpendGame(2); ExpendGame(3); ExpendGame(4); } }
void RetrieveLogisticsData(ISession session) { if (this.LogisticsId > 0) { Logistics logistics = Magic.Basis.Logistics.Retrieve(session, this.LogisticsId); this.txtAddress.Text = logistics.Address; this.txtBankAccount.Text = logistics.BankAccount; this.txtContact.Text = logistics.Contact; this.txtFax.Text = logistics.Fax; this.txtFullName.Text = logistics.FullName; this.txtLogisticsScope.Text = logistics.LogisticsScope; this.txtPhone.Text = logistics.Phone; this.txtPledgeAmount.Text = logistics.PledgeAmount.ToString(); this.txtSettlementPeriod.Text = logistics.SettlementPeriod.ToString(); this.txtShortName.Text = logistics.ShortName; this.txtZipCode.Text = logistics.ZipCode; this.txtLogisticID.Value = logistics.LogisticCompID.ToString(); if (logistics.HasPledge) { this.drpHasPledge.SelectedValue = "是"; } else { this.drpHasPledge.SelectedValue = "否"; } this.chkCanReturn.Checked = logistics.CanReturn; this.drpStatus.SelectedValue = Cast.String(((int)logistics.Status)); } }
private void Inval() { foreach (Control c in Controls) { if (c.GetType() == typeof(Label)) { Label l = (Label)c; if ((Start != null && l.Text == Start.Name) || (Target != null && l.Text == Target.Name)) { l.BackColor = Color.Lime; } else { l.BackColor = Color.WhiteSmoke; } } } if (Start != null && Target != null) { Path = Logistics.CalculatePath(Start, Target); } else { Path = new List <City>(); } pictureBox1.Invalidate(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.txtDateFrom.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); this.txtDateTo.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.chkNew.Checked = true; this.chkRelease.Checked = true; this.chkOpen.Checked = true; using (ISession session = new Session()) { OrderStatusDef statusDef = OrderStatusDef.Retrieve(session, ReturnHead.ORDER_TYPE_MBR_RTN, (int)ReturnStatus.New); this.chkNew.Text = statusDef.StatusText; statusDef = OrderStatusDef.Retrieve(session, ReturnHead.ORDER_TYPE_MBR_RTN, (int)ReturnStatus.Release); this.chkRelease.Text = statusDef.StatusText; statusDef = OrderStatusDef.Retrieve(session, ReturnHead.ORDER_TYPE_MBR_RTN, (int)ReturnStatus.Open); this.chkOpen.Text = statusDef.StatusText; statusDef = OrderStatusDef.Retrieve(session, ReturnHead.ORDER_TYPE_MBR_RTN, (int)ReturnStatus.Close); this.chkClose.Text = statusDef.StatusText; this.drpLogis.Items.Clear(); this.drpLogis.Items.Add(new ListItem("", "0")); IList <Logistics> logistics = Logistics.GetEffectiveLogistics(session); foreach (Logistics logis in logistics) { this.drpLogis.Items.Add(new ListItem(logis.ShortName, logis.LogisticCompID.ToString())); } this.RestoreLastQuery(session); } } }
/// <summary> /// 计算物流运费 /// </summary> /// <param name="Logistics">物流方式</param> /// <param name="Weight">运输重量</param> /// <returns></returns> public static Decimal Calculate(Logistics Logistics, Decimal Weight) { if (Weight == 0) { return 0M; } switch (Logistics) { case Logistics.InternationalEMS: { return InternationalEMS(Weight); } case Logistics.EconomicAirTransport: { return EconomicAirTransport(Weight); } case Logistics.OceanShipping: { return OceanShipping(Weight); } case Logistics.Fedex: { return Fedex(Weight); } default: { throw new ArgumentException("暂不支持的物流运输!", "Logistics"); } } }
public OperateLogisticsSuccessEvent(Logistics logistics, string name) { LogisticsId = logistics.Id; OrderId = logistics.OrderId; UserId = logistics.LogisticsState == LogisticsState.DeliverGoods ? logistics.DeliverUserId : logistics.ReceiverUserId; UserName = name; }
public static float CommitTransaction(Customer cust, GameType game) { if (!instance.mainMenuMode) { if (Logistics.GetStock(game) > 0) { //Success cust.CommitTransaction(true); float revenue = MarketManager.GetSalePrice(game); AdjustCash(revenue); EndDayManager.AddRevenue(game, revenue); Logistics.ExpendGame(game); return(revenue); } else { //Failure cust.CommitTransaction(false); return(0); } } else { cust.CommitTransaction(true); return(0); } }
public void Init() { var list = new List <IOffer>(); var offerList = new Logistics(list); var transport1 = new Transport("Transport1", 2); transport1.Id = new Guid("00000000-0000-0000-0000-100000000001"); var transport2 = new Transport("Transport2", 3); transport2.Id = new Guid("00000000-0000-0000-0000-100000000002"); var transport3 = new Transport("Transport3", 4); transport3.Id = new Guid("00000000-0000-0000-0000-100000000003"); var product1 = new Product("Product1", 22.5, 5); product1.Id = new Guid("00000000-0000-0000-0000-200000000001"); var product2 = new Product("Product2", 12.5, 10); product2.Id = new Guid("00000000-0000-0000-0000-200000000002"); var product3 = new Product("Product3", 122.5, 23); product3.Id = new Guid("00000000-0000-0000-0000-200000000003"); var offer1 = new Offer(new List <IProduct>() { product1, product2, product3 }, DateTime.Now, DateTime.Now, new List <ITransport>() { transport1, transport2 }); offer1.Id = new Guid("00000000-0000-0000-0000-300000000001"); offer1.OfferPrice = 50; var offer2 = new Offer(new List <IProduct>() { product2, product3 }, DateTime.Now, DateTime.Now, new List <ITransport>() { transport2 }); offer2.OfferPrice = 30; offer2.Id = new Guid("00000000-0000-0000-0000-300000000002"); var offer3 = new Offer(new List <IProduct>() { product3 }, DateTime.Now, DateTime.Now, new List <ITransport>() { transport3 }); offer3.OfferPrice = 10; offer3.Id = new Guid("00000000-0000-0000-0000-300000000003"); offerList.Offers.Add(offer1); offerList.Offers.Add(offer2); offerList.Offers.Add(offer3); manager = new SalesManager(offerList); }
IEnumerator GoShopping() { actionId = 0; step = 0; //Move to interact point of the Showcase. TODO: Choose interact point agent.SetDestination(GameManager.GetInteractable(Departments.Showcase).position); yield return(new WaitUntil(() => { return CheckDistance(agent.destination); })); //Look at the parent object yield return(new WaitUntil(() => { return RotateTowards(GameManager.GetDeptObject(Departments.Showcase).transform.position) < lookAngleBuffer; })); SetObstruction(true); isInActivity = true; //Wait to visualize look. Animate yield return(new WaitForSeconds(lookTime)); isInActivity = false; SetObstruction(false); //Check for availability if (Logistics.GetStock(GameDemand) <= 0) { CommitTransaction(false); StartCoroutine(LeaveBusiness()); yield break; } step++; //Move character. TODO: Choose interact point Cashier cashier = GameManager.GetDeptScript(Departments.Cashier) as Cashier; agent.SetDestination(GameManager.GetInteractable(Departments.Cashier).position); yield return(new WaitUntil(() => { return CheckDistance(agent.destination); })); //Look at the parent object yield return(new WaitUntil(() => { return RotateTowards(GameManager.GetDeptObject(Departments.Cashier).transform.position) < lookAngleBuffer; })); SetObstruction(true); isInActivity = true; //Wait to visualize look. Animate yield return(new WaitForSeconds(cashier.ServeSpeed)); //Do transaction, then wait as visualization TotalSpendings += GameManager.CommitTransaction(this, GameDemand); yield return(new WaitForSeconds(1.5f)); isInActivity = false; SetObstruction(false); //Move out from the shop. StartCoroutine(LeaveBusiness()); }
public JsonResult <Logistics> GetLogisticsInfo(string type, string postid) //JsonResult<dynamic> { string Url = string.Format(@"http://www.kuaidi100.com/query?type={0}&postid={1}", type, postid); string Result = WebServiceHelper.Get(Url); Logistics logistics = JsonConvert.DeserializeObject <Logistics>(Result); return(Json <Logistics>(logistics)); }
public Army(Leader leader, Scouts scouts, Spies spies, Logistics logistics, IEnumerable <Squad> squadrons) { Leader = leader; Scouts = scouts; Spies = spies; Logistics = logistics; Squadrons = squadrons; }
public async Task <ActionResult> DeleteConfirmed(int id) { Logistics logistics = await db.Logistics.FindAsync(id); db.Logistics.Remove(logistics); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.txtDateFrom.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); this.txtDateTo.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.chkDistributing.Checked = true; this.chkChecked.Checked = true; this.chkPackaged.Checked = true; using (ISession session = new Session()) { SNStatus status = SNStatus.Retrieve(session, (int)CRMSNStatus.Distributing); if (status != null) { this.chkDistributing.Text = status.Name; } status = SNStatus.Retrieve(session, (int)CRMSNStatus.Checked); if (status != null) { this.chkChecked.Text = status.Name; } status = SNStatus.Retrieve(session, (int)CRMSNStatus.Packaged); if (status != null) { this.chkPackaged.Text = status.Name; } status = SNStatus.Retrieve(session, (int)CRMSNStatus.Interchanged); if (status != null) { this.chkInterchanged.Text = status.Name; } status = SNStatus.Retrieve(session, (int)CRMSNStatus.Return); if (status != null) { this.chkReturn.Text = status.Name; } status = SNStatus.Retrieve(session, (int)CRMSNStatus.PartExchange); if (status != null) { this.chkPartReturn.Text = status.Name; } this.drpLogis.Items.Clear(); this.drpLogis.Items.Add(new ListItem("¡¡", "0")); IList <Logistics> logis = Logistics.GetEffectiveLogistics(session); foreach (Logistics l in logis) { this.drpLogis.Items.Add(new ListItem(l.ShortName, l.LogisticCompID.ToString())); } WebUtil.SetMagicPager(magicPagerMain, this.magicPagerMain.PageSize, 1); WebUtil.SetMagicPager(magicPagerSub, this.magicPagerMain.PageSize, 1); this.RestoreLastQuery(session); } } }
public Production(IMyProductionBlock block, Logistics logistics) { this.block = block; this.name = block.CustomName; this.logistics = logistics; input = new Container(block.InputInventory, block.CustomName, logistics); output = new Container(block.OutputInventory, block.CustomName, logistics); input.canFilter = false; }
public void Calculate() { List <Alcohol> alcohols = Logistics.GetAlcoholsList(); Alcohol alcoholWithMinPercentage = GetAlcoholFromListWithMinPercentage(alcohols); while (totalAlcoholVolume > CalculateSingleAlchol(alcoholWithMinPercentage)) { AddMatchedAlcohols(alcohols); } matchedAlcohol = matchedAlcohol.OrderBy(a => a.AlcoholPercent).ToList(); }
public async Task <ActionResult> Edit([Bind(Include = "ID,CustomerID,DriverID,DeparturePoint,ArrivalPoint,Distance,DepartureDate,ArrivalDate")] Logistics logistics) { if (ModelState.IsValid) { db.Entry(logistics).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Name", logistics.CustomerID); ViewBag.DriverID = new SelectList(db.Drivers, "ID", "FullName", logistics.DriverID); return(View(logistics)); }
public SupplierLogistics() { Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; MyBLL = SupplierLogisticsFactory.CreateSupplierLogistics(); tools = ToolsFactory.CreateTools(); Addr = new Addr(); MyLogisticsTender = LogisticsTenderFactory.CreateLogisticsTender(); MyLogistics = new Logistics(); }
public Logistics QueryLogisticsInfo(string orderCode, string shipperCode, string logisticCode) { Logistics l = null; try { KdApi kd = new KdApi(); l = JsonConvert.DeserializeObject <Logistics>(kd.getOrderTracesByJson()); } catch (Exception ex) { } return(l); }
static void Main(string[] args) { Logistics myLogistics = new Logistics("terestrial"); Logistics mySeaLogistics = new Logistics("maritim"); int[] payload1 = { 1 }; int[] payload2 = { 2 }; myLogistics.CreateTransport("start1", "dest1", payload1); myLogistics.CreateTransport("start2", "dest2", payload2); mySeaLogistics.CreateTransport("start3", "dest3", payload2); myLogistics.DisplayTransports(); mySeaLogistics.DisplayTransports(); }
// GET: Logistics/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Logistics logistics = await db.Logistics.FindAsync(id); if (logistics == null) { return(HttpNotFound()); } return(View(logistics)); }
// GET: Logistics/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Logistics logistics = await db.Logistics.FindAsync(id); if (logistics == null) { return(HttpNotFound()); } ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Name", logistics.CustomerID); ViewBag.DriverID = new SelectList(db.Drivers, "ID", "FullName", logistics.DriverID); return(View(logistics)); }
void SaveLogistics() { using (ISession session = new Session()) { try { Logistics logistics = new Logistics(); logistics.Status = Cast.Enum <LogisticsStatus>(this.drpStatus.Text); logistics.ShortName = this.txtShortName.Text; logistics.FullName = this.txtFullName.Text; logistics.Address = this.txtAddress.Text; logistics.ZipCode = this.txtZipCode.Text; logistics.Contact = this.txtContact.Text; logistics.Phone = this.txtPhone.Text; logistics.Fax = this.txtFax.Text; logistics.SettlementPeriod = Cast.Int(this.txtSettlementPeriod.Text, -1); if (this.drpHasPledge.SelectedValue == "是") { logistics.HasPledge = true; } else { logistics.HasPledge = false; } logistics.PledgeAmount = Cast.Int(this.txtPledgeAmount.Text, -1); logistics.LogisticsScope = this.txtLogisticsScope.Text; logistics.BankAccount = this.txtBankAccount.Text; logistics.CanReturn = this.chkCanReturn.Checked; if (this.IsAddNew()) { logistics.Create(session); this.txtLogisticID.Value = logistics.LogisticCompID.ToString(); } else { logistics.LogisticCompID = Cast.Int(this.txtLogisticID.Value, -1); logistics.Update(session, "Status", "ShortName", "FullName", "Address", "ZipCode", "Contact", "Phone", "Fax", "SettlementPeriod", "HasPledge", "PledgeAmount", "LogisticsScope", "BankAccount", "CanReturn"); } this.Response.Redirect(WebUtil.Param("return")); } catch (Exception ex) { logger.Info("保存Logistics", ex); WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员"); } } }
protected override void OnCreate(Bundle savedInstanceState) { Logistics.Clear(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.MenuAlcohole); lstData = FindViewById <ListView>(Resource.Id.listView); var adapter = new ListViewAdapter(this, DataContainer.alcohols); lstData.Adapter = adapter; lstData.ItemClick += lstData_ItemClick; FindViewById <Button>(Resource.Id.btnNext).Click += (o, e) => { StartActivity(typeof(LastWindowActivity)); }; }
void PopulateInitialRestock() { for (int i = 0; i < restockRows.Length; i++) { if (MarketManager.IsGameAvailable(i)) { restockRows[i].gameName.transform.parent.gameObject.SetActive(true); restockRows[i].gameName.text = string.Format("{0}", MarketManager.GetGameNames((GameType)i)); restockRows[i].stockText.text = string.Format("{0:N0}", Logistics.GetStock(i)); restockRows[i].priceText.text = "$0"; restockRows[i].stockSlider.value = 0; restockRows[i].stockSlider.maxValue = Logistics.GetCapacity() - Logistics.GetStock(i); } else { restockRows[i].gameName.transform.parent.gameObject.SetActive(false); } } }
void UpdateRestockUI(int id) { float totalPrice = 0; int totalStock = 0; if (addedStocks[id] != 0) { restockRows[id].stockText.text = string.Format("{0:N0} ({1:+#;-#;0})", Logistics.GetStock((GameType)id), addedStocks[id]); } else { restockRows[id].stockText.text = string.Format("{0:N0}", Logistics.GetStock((GameType)id)); } restockRows[id].priceText.text = string.Format("${0:N0}", MarketManager.GetBuyPrice(id) * addedStocks[id]); for (int i = 0; i < addedStocks.Length; i++) { if (MarketManager.IsGameAvailable(i)) { totalPrice += MarketManager.GetBuyPrice(i) * addedStocks[i]; totalStock += addedStocks[i]; } } instance.moneyText.text = GameManager.Cash > 0 ? string.Format("${0:N0}", GameManager.Cash - totalPrice) : string.Format("<color=red>-${0:N0}</color>", Mathf.Abs(GameManager.Cash - totalPrice));; if (Logistics.GetTotalStocks() + totalStock > Logistics.GetCapacity()) { restockTitle.text = string.Format("Restock <color=red>({0}/{1})</color>", Logistics.GetTotalStocks() + totalStock, Logistics.GetCapacity()); } else { restockTitle.text = string.Format("Restock ({0}/{1})", Logistics.GetTotalStocks() + totalStock, Logistics.GetCapacity()); } if (Logistics.GetTotalStocks() + totalStock > Logistics.GetCapacity() || GameManager.Cash - totalPrice < 0) { instance.commitButton.interactable = false; } else { instance.commitButton.interactable = true; } }
public static void PackageSave(ISession session, string orderNumber, decimal packageWeight, string shippingNumber, int logisticId, string invoiceNumber, int packageCount) { CRMSN head = CRMSN.Retrieve(session, orderNumber); if (head == null) { throw new Exception("发货单" + orderNumber + "不存在"); } if (head.Status != CRMSNStatus.Checked) { throw new Exception("发货单" + orderNumber + "没有核货或者已经包装完毕,无法执行包装作业"); } IList <RestrictLogis2Member> restricts = session.CreateEntityQuery <RestrictLogis2Member>() .Where(Exp.Eq("MemberId", head.MemberID)) .List <RestrictLogis2Member>(); bool isInRestrict = false; string logisNames = ""; foreach (RestrictLogis2Member r in restricts) { Logistics logis = Logistics.Retrieve(session, r.LogisId); if (logis != null) { logisNames = logisNames + logis.ShortName + ", "; } if (r.LogisId == logisticId) { isInRestrict = true; } } if (restricts != null && restricts.Count > 0 && !isInRestrict) { throw new Exception("系统设置该会员只能通过\"" + logisNames.Substring(0, logisNames.Length - 2) + "\"发货"); } head.PackageWeight = packageWeight; head.ShippingNumber = shippingNumber; head.LogisticsID = logisticId; head.InvoiceNumber = invoiceNumber; head.PackageCount = packageCount; head.Update(session, "PackageWeight", "ShippingNumber", "LogisticsID", "InvoiceNumber", "PackageCount"); }
protected override void OnAppearing() { if (!string.IsNullOrWhiteSpace(stockUpBillModel.FBillNo)) { scanstacklayout.IsVisible = false; resultstacklayout.IsVisible = true; Logistics.SetBinding(Label.TextProperty, new Binding("Value") { Source = stockUpBillModel.F_XAY_Logistics.SimpleName[0] }); //if (stepstate) { QRStacklayout.IsVisible = false; listview.ItemsSource = stockUpBillModel.XAY_StockUpOrderEntry; UpdateUI(); QrResultstacklayout.IsVisible = true; //} stepstate = stepstate? stepstate:!stepstate; } base.OnAppearing(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["return"] != null) { this.toolbarTop["Return"].NavigateUrl = this.toolbarBottom["Return"].NavigateUrl = Request["return"]; } using (ISession session = new Session()) { this.drpLogis.Items.Clear(); this.drpLogis.Items.Add(new ListItem("", "")); IList <Logistics> logis = Logistics.GetEffectiveLogistics(session); foreach (Logistics l in logis) { this.drpLogis.Items.Add(new ListItem(l.ShortName, l.LogisticCompID.ToString())); } } } }
public void OnCommit() { restocksOrig = new int[5]; float totalCash = 0; for (int i = 0; i < restockRows.Length; i++) { if (MarketManager.IsGameAvailable(i) && addedStocks[i] > 0) { totalCash += addedStocks[i] * MarketManager.GetBuyPrice(i); restocksOrig[i] += addedStocks[i]; Logistics.RestockGame((GameType)i, addedStocks[i]); } } GameManager.AdjustCash(totalCash); addedStocks = new int[5]; PopulateInitialRestock(); }
void Awake() { instance = this; dropoffs = FindObjectsOfType <Dropoff>(); droppers = FindObjectsOfType <Dropper>(); Random.InitState(42); boxPrefabs = new List <GameObject>(); for (int i = 0; i < 100; ++i) { string path = string.Format("Boxes/Box{0,2:D2}", i); GameObject prefab = Resources.Load <GameObject>(path); if (prefab != null) { //Debug.LogFormat("Loaded {0}", path); boxPrefabs.Add(prefab); } } }
public void TestSkillFacotry(SkillName s) { Skill expected = null; switch (s) { case SkillName.Learning: expected = new Learning(); break; case SkillName.Logistics: expected = new Logistics(); break; case SkillName.Offense: expected = new Offense(); break; } Skill actual = SkillFactory.GetSkill(s); Assert.Equal(expected.Name, actual.Name); }
void SaveLogistics() { using (ISession session = new Session()) { try { Logistics logistics = new Logistics(); logistics.Status = Cast.Enum<LogisticsStatus>(this.drpStatus.Text); logistics.ShortName = this.txtShortName.Text; logistics.FullName = this.txtFullName.Text; logistics.Address = this.txtAddress.Text; logistics.ZipCode = this.txtZipCode.Text; logistics.Contact = this.txtContact.Text; logistics.Phone = this.txtPhone.Text; logistics.Fax = this.txtFax.Text; logistics.SettlementPeriod = Cast.Int(this.txtSettlementPeriod.Text, -1); if (this.drpHasPledge.SelectedValue == "是") logistics.HasPledge = true; else logistics.HasPledge = false; logistics.PledgeAmount = Cast.Int(this.txtPledgeAmount.Text, -1); logistics.LogisticsScope = this.txtLogisticsScope.Text; logistics.BankAccount = this.txtBankAccount.Text; logistics.CanReturn = this.chkCanReturn.Checked; if (this.IsAddNew()) { logistics.Create(session); this.txtLogisticID.Value = logistics.LogisticCompID.ToString(); } else { logistics.LogisticCompID = Cast.Int(this.txtLogisticID.Value, -1); logistics.Update(session, "Status", "ShortName", "FullName", "Address", "ZipCode", "Contact", "Phone", "Fax", "SettlementPeriod", "HasPledge", "PledgeAmount", "LogisticsScope", "BankAccount", "CanReturn"); } this.Response.Redirect(WebUtil.Param("return")); } catch (Exception ex) { logger.Info("保存Logistics", ex); WebUtil.ShowMsg(this, "发生未处理的异常,请刷新页面重新操作,或者联系系统管理员"); } } }