//编辑仓库 private void hyperlinkWarehouseID_Click(object sender, RoutedEventArgs e) { WarehouseInfoVM warehouse = (sender as HyperlinkButton).DataContext as WarehouseInfoVM; if (warehouse != null) { Maintain(warehouse.SysNo); } }
public void GetWarehouseInfo(int warehouseSysNo, Action <WarehouseInfoVM> action) { restClient.Query <WarehouseInfo>(String.Format("/InventoryService/Stock/WH/Get/{0}", warehouseSysNo), (obj, args) => { if (!args.FaultsHandle() && action != null) { WarehouseInfoVM vm = ConvertWarehouseInfoToVM(args.Result); action(vm); } }); }
private WarehouseInfoVM ConvertWarehouseInfoToVM(WarehouseInfo info) { WarehouseInfoVM vm = info.Convert <WarehouseInfo, WarehouseInfoVM>((i, v) => { v.CreateUserSysNo = i.CreateUser == null ? null : i.CreateUser.SysNo; v.EditUserSysNo = i.EditUser == null ? null : i.EditUser.SysNo; //v.OwnerSysNo = i.OwnerInfo == null ? null : i.OwnerInfo.SysNo.ToString();//(中蛋定制化 不需要此信息) v.TransferRate = decimal.Round(i.TransferRate, 2); }); return(vm); }
void WarehouseMaintain_Loaded(object sender, RoutedEventArgs e) { WarehouseFacade = new WarehouseFacade(Page); //(中蛋定制化 不需要此信息) //new WarehouseOwnerQueryFacade().GetWarehouseOwnerByCompanyCode(CPApplication.Current.CompanyCode, (ownerList) => // { // ownerList.Insert(0, new WarehouseOwnerInfoVM // { // SysNo = null, // OwnerName = ResCommonEnum.Enum_Select // }); // WarehouseVM = WarehouseVM ?? new WarehouseInfoVM(); // WarehouseVM.OwnerList = ownerList; // }); WarehouseFacade.GetProductCountryList((obj, arg) => { if (arg.FaultsHandle()) { return; } cmbOrgin.ItemsSource = arg.Result; cmbOrgin.SelectedIndex = 0; if (WarehouseSysNo.HasValue) { WarehouseFacade.GetWarehouseInfo(WarehouseSysNo.Value, (vm) => { if (vm == null || vm.CompanyCode == null || vm.CompanyCode.Trim() != CPApplication.Current.CompanyCode) { vm = null; Page.Context.Window.Alert("没有找到相应的仓库信息,此仓库信息可能已经被删除。"); } //else//(中蛋定制化 不需要此信息) //{ // if (WarehouseVM != null) // { // vm.OwnerList = WarehouseVM.OwnerList; // } //} WarehouseVM = vm ?? new WarehouseInfoVM(); IniPageData(); }); } else { IniPageData(); } }); Loaded -= new RoutedEventHandler(WarehouseMaintain_Loaded); }
public void UpdateWarehouseInfo(WarehouseInfoVM vm, Action callback) { WarehouseInfo info = ConvertWarehouseVMToInfo(vm); restClient.Query <WarehouseInfo>("/InventoryService/Stock/WH/Update", info, (obj, args) => { if (!args.FaultsHandle()) { Page.Context.Window.Alert("仓库信息修改成功", MessageType.Information); } if (callback != null) { callback(); } }); }
private WarehouseInfo ConvertWarehouseVMToInfo(WarehouseInfoVM vm) { WarehouseInfo info = vm.ConvertVM <WarehouseInfoVM, WarehouseInfo>((v, i) => { i.CreateUser = new UserInfo { SysNo = v.CreateUserSysNo }; i.EditUser = new UserInfo { SysNo = v.EditUserSysNo }; //i.OwnerInfo = new WarehouseOwnerInfo { SysNo = int.Parse(v.OwnerSysNo) };//(中蛋定制化 不需要此信息) i.TransferRate = decimal.Round(vm.TransferRate, 2); }); return(info); }
public void LoadWarehouseList() { WarehouseQueryFacade whFacade = new WarehouseQueryFacade(); whFacade.GetWarehouseListByCompanyCode(CPApplication.Current.CompanyCode, (vmList) => { WarehouseInfoVM blankInfo = new WarehouseInfoVM() { SysNo = null, WarehouseID = null, WarehouseName = ResCommonEnum.Enum_All }; vmList.Insert(0, blankInfo); PageView.QueryInfo.WarehouseList = vmList; }); }
public void CreateWarehouseInfo(WarehouseInfoVM vm, Action callback) { WarehouseInfo info = ConvertWarehouseVMToInfo(vm); restClient.Query <WarehouseInfo>("/InventoryService/Stock/WH/Create", info, (obj, args) => { if (!args.FaultsHandle() && args.Result != null) { vm.SysNo = args.Result.SysNo; this.Page.Context.Window.Alert("仓库信息创建成功", MessageType.Information); } if (callback != null) { callback(); } }); }
private void IniPageData() { WarehouseVM = WarehouseVM ?? new WarehouseInfoVM(); this.DataContext = WarehouseVM; }