public static bool IsStorageBinEqual(StorageBin storageBin1, StorageBin storageBin2) { if (storageBin1 == null && storageBin2 == null) { return(true); } if (storageBin1 == null && storageBin2 != null) { return(false); } if (storageBin1 != null && storageBin2 == null) { return(false); } if (storageBin1.Code == storageBin2.Code) { return(true); } else { return(false); } }
public void FillResolverByBin(Resolver resolver) { User user = userMgr.CheckAndLoadUser(resolver.UserCode); StorageBin storageBin = storageBinMgr.CheckAndLoadStorageBin(resolver.Input); #region 校验 if (!storageBin.IsActive) { throw new BusinessErrorException("Common.Business.Error.EntityInActive", storageBin.Code); } //if (!user.HasPermission(storageBin.Area.Location.Region.Code)) //{ // throw new BusinessErrorException("Common.Business.Error.NoPermission"); //} #endregion resolver.Description = storageBin.Description; resolver.BinCode = storageBin.Code; //库格一定为目的(操作) resolver.LocationCode = storageBin.Area.Location.Code; resolver.LocationToCode = storageBin.Area.Location.Code; resolver.Result = languageMgr.TranslateMessage("Warehouse.CurrentBinCode", resolver.UserCode, storageBin.Code); }
public frmStockTaking(StorageBin storageBin) { InitializeComponent(); Type = StockTakingType.ByStorageBin; StorageBin = storageBin; Init(); }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { StorageBin storageBin = (StorageBin)e.Row.DataItem; Label lblBinCode = (Label)(e.Row.FindControl("lblBinCode")); Controls_TextBox tbBinCodeFrom = (Controls_TextBox)(e.Row.FindControl("tbBinCodeFrom")); Label lbTo = (Label)(e.Row.FindControl("lbTo")); Controls_TextBox tbBinCodeTo = (Controls_TextBox)(e.Row.FindControl("tbBinCodeTo")); if (storageBin.IsBlank) { lblBinCode.Visible = false; tbBinCodeFrom.Visible = true; tbBinCodeFrom.ServiceParameter = "string:" + this.Location; tbBinCodeFrom.DataBind(); lbTo.Visible = true; tbBinCodeTo.Visible = true; tbBinCodeTo.ServiceParameter = "string:" + this.Location; tbBinCodeTo.DataBind(); } e.Row.FindControl("lbtnAdd").Visible = storageBin.IsBlank; e.Row.FindControl("lbtnDelete").Visible = !storageBin.IsBlank; } }
/// <summary> /// 新增按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddNew_Click(object sender, EventArgs e) { if (Page.IsValid == false) { return; } //lblAddMsg.Text = ""; ClearTipMsgLabel();//清除提示信息 try { StorageBin newModel = null; string msg = ""; if (GetNewModel(out newModel, out msg) == false) { lblAddMsg.Text = msg; return; } using (DAL.GoldEntities context = new DAL.GoldEntities()) { context.StorageBin.AddObject(newModel); context.SaveChanges(); lblAddMsg.Text = "保存成功"; gv_BinList.DataBind(); } } catch (Exception ex) { lblAddMsg.Text = "保存失败!详细信息:" + Utility.LogHelper.GetExceptionMsg(ex); } }
protected override void SetDetail(Resolver resolver) { Hu hu = huMgr.CheckAndLoadHu(resolver.Input); if (this.locationMgr.IsHuOcuppyByPickList(resolver.Input)) { throw new BusinessErrorException("Order.Error.PickUp.HuOcuppied", resolver.Input); } if (resolver.BinCode == string.Empty || resolver.BinCode == null) { throw new BusinessErrorException("Warehouse.PutAway.PlzScanBin"); } if (hu.StorageBin != null && hu.StorageBin.Trim() != string.Empty && hu.StorageBin == resolver.BinCode) { throw new BusinessErrorException("Warehouse.PutAway.AlreadyInThisBin"); } //校验Bin StorageBin bin = storageBinMgr.CheckAndLoadStorageBin(resolver.BinCode); LocationLotDetail locationLotDetail = locationLotDetailMgr.CheckLoadHuLocationLotDetail(resolver.Input, string.Empty, bin.Area.Location.Code); locationLotDetail.NewStorageBin = bin; TransformerDetail transformerDetail = TransformerHelper.ConvertLocationLotDetailToTransformerDetail(locationLotDetail, true); resolver.AddTransformerDetail(transformerDetail); }
public StorageBin CheckAndLoadStorageBin(string binCode) { StorageBin storageBin = this.LoadStorageBin(binCode); if (storageBin == null) { throw new BusinessErrorException("Warehouse.Error.BinNotExist", binCode); } return(storageBin); }
private void View(object sender, EventArgs e) { int id = Convert.ToInt32(dgItems.Rows[dgItems.CurrentCell.RowIndex].Cells[0].Value); var item = new StorageBin(); item = Keeper.Items.Where(u => u.StorageBinId == id).FirstOrDefault(); frmStorageBin ItemForm = new frmStorageBin(item, this); ItemForm.Show(); }
public frmStorageBin(Form parent) { InitializeComponent(); this.Owner = parent; this.Location = new Point(this.Owner.Location.X + 20, this.Owner.Location.Y + 20); mode = 1; lblCreated.Visible = false; cboxArchived.CheckState = CheckState.Indeterminate; this.Text = "Nowy regał magazynowy"; _this = new StorageBin(); }
private void BindData(bool includeBlank) { IList <StorageBin> binList = new List <StorageBin>(); IListHelper.AddRange <StorageBin>(binList, this.StorageBinList); if (includeBlank) { StorageBin newBin = new StorageBin(); newBin.IsBlank = true; binList.Add(newBin); } this.GV_List.DataSource = binList; this.GV_List.DataBind(); }
protected void GV_Bin_RowUpdating(object sender, GridViewUpdateEventArgs e) { StorageBin storageBin = new StorageBin(); if (this.AreaCode != null && this.AreaCode != string.Empty) { storageBin.Area = TheStorageAreaMgr.LoadStorageArea(this.AreaCode); } storageBin.Code = ((Literal)this.GV_Bin.Rows[e.RowIndex].FindControl("ltlCode")).Text.Trim(); storageBin.Description = ((TextBox)this.GV_Bin.Rows[e.RowIndex].FindControl("tbDescription")).Text.Trim(); storageBin.IsActive = ((CheckBox)this.GV_Bin.Rows[e.RowIndex].FindControl("cbActive")).Checked; storageBin.IsIsolation = ((CheckBox)this.GV_Bin.Rows[e.RowIndex].FindControl("cbIsIsolation")).Checked; TheStorageBinMgr.UpdateStorageBin(storageBin); this.GV_Bin.EditIndex = -1; this.DoSearch(); ShowSuccessMessage("MasterData.Location.UpdataBin.Successfully", storageBin.Code); }
//新增库格 protected void ODS_StorageBin_Inserting(object source, ObjectDataSourceMethodEventArgs e) { StorageBin storageBin = (StorageBin)e.InputParameters[0]; string binCode = ((TextBox)(this.FV_StorageBin.FindControl("tbBinCode"))).Text.Trim(); string binDescription = ((TextBox)(this.FV_StorageBin.FindControl("tbBinDescription"))).Text.Trim(); string areaCode = ((Controls_TextBox)(this.FV_StorageBin.FindControl("tbAreaCode"))).Text; if (binCode == null || binCode == string.Empty) { ShowErrorMessage("MasterData.Location.Bin.Required.Code"); e.Cancel = true; return; } storageBin.Code = binCode; storageBin.Description = binDescription; storageBin.Area = TheStorageAreaMgr.LoadStorageArea(areaCode); ShowSuccessMessage("MasterData.Location.Bin.AddBin.Successfully", binCode); }
public void InitPageParameter(CycleCount cycleCount) { this.Location = cycleCount.Location.Code; this.StorageBinList = new List <StorageBin>(); if (cycleCount.Bins != null && cycleCount.Bins != string.Empty) { string[] binArr = cycleCount.Bins.Split('|'); foreach (string bin in binArr) { StorageBin storageBin = TheStorageBinMgr.LoadStorageBin(bin); storageBin.IsBlank = false; this.StorageBinList.Add(storageBin); } } this.GV_List.Columns[3].Visible = cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; BindData(cycleCount.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE); }
public frmStorageBin(StorageBin Item, Form parent) { InitializeComponent(); this.Owner = parent; this.Location = new Point(this.Owner.Location.X + 20, this.Owner.Location.Y + 20); mode = 2; this.Text = "Szczegóły regału magazynowego"; _this = Item; txtNumber.Text = _this.Number; txtName.Text = _this.Name; cboxArchived.CheckState = _this.IsArchived.ToCheckboxState(); if (_this.CreatedOn != null && _this.CreatedBy != 0) { lblCreated.Text = "Utworzone w dniu " + _this.CreatedOn + " przez " + _this.CreatedByName; lblCreated.Visible = true; } if (_this.Token != null) { GenerateQrCode(_this.Token); } }
/// <summary> /// 获取新增界面中的数据 /// </summary> /// <param name="msg">异常消息</param> /// <returns></returns> private bool GetUpdateModel(ref StorageBin updateModel, GridViewRow editRow, out string msg) { msg = ""; try { if (null == editRow) { msg = "获取的编辑行为空!请重试!"; return(false); } DropDownList dropdownList_EditBinTagStatus = null; DropDownList dropdownList_EditBinType = null; DropDownList dropdownList_EditWareHouse = null; TextBox tbxRowBinName = null; TextBox tbxRowBinTagID = null; TextBox tbxRowComment = null; dropdownList_EditBinType = editRow.FindControl("dropdownList_binType") as DropDownList; dropdownList_EditWareHouse = editRow.FindControl("dropdownList_WareHouse") as DropDownList; dropdownList_EditBinTagStatus = editRow.FindControl("dropdownList_BinTagStatus") as DropDownList; tbxRowBinName = editRow.FindControl("tbxRowBinName") as TextBox; tbxRowBinTagID = editRow.FindControl("tbxRowBinTagID") as TextBox; tbxRowComment = editRow.FindControl("tbxRowComment") as TextBox; if (string.IsNullOrEmpty(dropdownList_EditBinType.SelectedItem.Value) || string.IsNullOrEmpty(dropdownList_EditBinTagStatus.SelectedItem.Value) || string.IsNullOrEmpty(dropdownList_EditWareHouse.SelectedItem.Value)) { msg = "层位类型、标签状态、所属仓库 均为必填项!请填写!"; return(false); } string binName = tbxRowBinName.Text.Trim(); string binCode = updateModel.BinCode; int binType = 1; int binTagStatus = 1; //updateModel.BinCode = binCode; updateModel.BinName = binName; int.TryParse(dropdownList_EditBinType.SelectedItem.Value.ToString(), out binType); int.TryParse(dropdownList_EditBinTagStatus.SelectedItem.Value.ToString(), out binTagStatus); updateModel.BinType = binType; updateModel.BinTagStatus = binTagStatus; updateModel.WareHouse = dropdownList_EditWareHouse.SelectedItem.Value.ToString(); updateModel.BinTagID = tbxRowBinTagID.Text.Trim(); updateModel.Comment = tbxRowComment.Text.Trim(); string whCode = updateModel.WareHouse; using (GoldEntities context = new GoldEntities()) { var sameName = (from r in context.StorageBin where (r.BinName == binName && r.BinCode != binCode && r.WareHouse == whCode) select r).ToList(); if (sameName != null && sameName.Count > 0) { msg += "系统内仓库[" + whCode + "]中已经存在名称为[" + binName + "]的层位信息,请重填名称!<br />"; } string newBinTagID = updateModel.BinTagID; StorageBin existTagIDBin = (from r in context.StorageBin where (r.BinTagID == newBinTagID && r.BinCode != binCode && r.WareHouse == whCode) select r).FirstOrDefault(); if (existTagIDBin != null) { msg += "电子标签[" + updateModel.BinTagID + "]已经在仓库[" + whCode + "]层位[" + existTagIDBin.BinCode + "]被注册过了!请重新填写未注册的标签编号!<br />"; } if (msg.Length > 0) { return(false); } } return(true); } catch (Exception ex) { msg = ex.Message.ToString(); return(false); } }
public virtual void DeleteStorageBin(StorageBin entity) { entityDao.DeleteStorageBin(entity); }
private static async Task BuildDemoBin(IRepository <StorageBin> storageUnits) { var item = await storageUnits.FindOneAsync(_ => _.Name == string.Format(DemoBinNameFormat, 1)); if (item != null) { return; } item = new StorageBin() { Name = string.Format(DemoBinNameFormat, 1), Contents = new List <StorageBinContent>() { new StorageBinContent() { Name = "Red LED Lights", Quantity = 10, UnitWeight = 2, Tags = new List <string>() { "Red", "LED", "Light" } }, new StorageBinContent() { Name = "Green LED Lights", Quantity = 5, UnitWeight = 2, Tags = new List <string>() { "Green", "LED", "Light" } }, new StorageBinContent() { Name = "Blue LED Lights", Quantity = 25, UnitWeight = 2, Tags = new List <string>() { "Blue", "LED", "Light" } }, } }; await storageUnits.InsertOneAsync(item); item = await storageUnits.FindOneAsync(_ => _.Name == string.Format(DemoBinNameFormat, 2)); if (item != null) { return; } item = new StorageBin() { Name = string.Format(DemoBinNameFormat, 2), Contents = new List <StorageBinContent>() { new StorageBinContent() { Name = "Uno Boards", Quantity = 1, UnitWeight = 150, Tags = new List <string>() { "Arduino", "Uno", "Board" } }, } }; await storageUnits.InsertOneAsync(item); item = await storageUnits.FindOneAsync(_ => _.Name == string.Format(DemoBinNameFormat, 3)); if (item != null) { return; } item = new StorageBin() { Name = string.Format(DemoBinNameFormat, 3), }; await storageUnits.InsertOneAsync(item); }
public virtual void CreateStorageBin(StorageBin entity) { entityDao.CreateStorageBin(entity); }
public virtual void UpdateStorageBin(StorageBin entity) { entityDao.UpdateStorageBin(entity); }
/// <summary> /// 行命令触发前先清空界面消息提示 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gv_BinList_RowCommand(object sender, GridViewCommandEventArgs e) { GridView senderGrid = sender as GridView; //更新或删除前对消息Label清空 if (e.CommandName == "Edit" || e.CommandName == "Update" || e.CommandName == "Delete") { //lblGridViewMsg.Text = ""; ClearTipMsgLabel();//清除提示信息 } else if (e.CommandName == "MyDefineUpdate") { lblGridViewMsg.Text = ""; if (senderGrid.EditIndex != -1) { string editBinCode = senderGrid.DataKeys[senderGrid.EditIndex].Value.ToString(); try { using (GoldEntities context = new GoldEntities()) { StorageBin updateModel = (from r in context.StorageBin where r.BinCode == editBinCode select r).FirstOrDefault(); string msg = ""; if (GetUpdateModel(ref updateModel, senderGrid.Rows[senderGrid.EditIndex], out msg) == false) { lblGridViewMsg.Text = msg; return; } else { int result = context.SaveChanges(); if (result > 0) { lblGridViewMsg.Text = "更新成功!"; senderGrid.EditIndex = -1;//取消编辑状态 } else { lblGridViewMsg.Text = "更新失败(影响行数为0)"; } } } } catch (Exception ex) { lblGridViewMsg.Text = "更新失败[" + Utility.LogHelper.GetExceptionMsg(ex) + "]"; } } } else { if (e.CommandName == "TagAlarmStart" || e.CommandName == "TagAlarmStop") { string shortMsg = ""; string detailMsg = ""; string binTagID = ""; bool result = false; GridViewRow drv = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent)); //此得出的值是表示那行被选中的索引值 Label lblRowBinTagID = drv == null ? null : drv.FindControl("lblRowBinTagID") as Label; Label lblRowTagTestShortMsg = drv == null ? null : drv.FindControl("lblRowTagTestShortMsg") as Label; //非编辑状态下 显示标签编码的控件 TextBox tbxRowBinTagID = drv == null ? null : drv.FindControl("tbxRowBinTagID") as TextBox; //编辑状态下 显示标签编码的控件 //先清空提示 lblRowTagTestShortMsg.Text = ""; lblGridViewMsg.Text = ""; if (lblRowBinTagID == null && tbxRowBinTagID == null) { lblGridViewMsg.Text = "获取列表中层位标签标签信息失败!"; shortMsg = lblGridViewMsg.Text; return; } else { if (senderGrid.EditIndex == -1 && lblRowBinTagID != null)//非编辑态下获取标签编码 { binTagID = lblRowBinTagID.Text.Trim(); } else if (senderGrid.EditIndex != -1 && tbxRowBinTagID != null)//编辑态下获取标签编码 { binTagID = tbxRowBinTagID.Text.Trim(); } } if (e.CommandName == "TagAlarmStart") { result = StartOrStopAlarm(binTagID, true, out shortMsg, out detailMsg); } else if (e.CommandName == "TagAlarmStop") { result = StartOrStopAlarm(binTagID, false, out shortMsg, out detailMsg); } lblRowTagTestShortMsg.Text = shortMsg; lblGridViewMsg.Text = detailMsg; gv_BinList.DataBind();//亮灯和关灯后手持机服务会改标签数据库字段状态,所以这里刷新数据源 } } }
public virtual void DeleteStorageBin(StorageBin entity) { Delete(entity); }
public virtual void UpdateStorageBin(StorageBin entity) { Update(entity); }
public virtual void CreateStorageBin(StorageBin entity) { Create(entity); }
/// <summary> /// 获取新增界面中的数据 /// </summary> /// <param name="msg">异常消息</param> /// <returns></returns> private bool GetNewModel(out StorageBin newModel, out string msg) { msg = ""; newModel = null; try { if (string.IsNullOrEmpty(dropdownList_NewBinType.SelectedItem.Value) || string.IsNullOrEmpty(dropdownList_NewBinTagStatus.SelectedItem.Value) || string.IsNullOrEmpty(dropdownList_NewWareHouse.SelectedItem.Value)) { msg = "层位类型、标签状态、所属仓库 均为必填项!请填写!"; return(false); } newModel = new StorageBin(); string binCode = tbxNewBinCode.Text.Trim(); string binName = tbxNewBinName.Text.Trim(); int binType = 1; int binTagStatus = 1; newModel.BinCode = binCode; newModel.BinName = binName; int.TryParse(dropdownList_NewBinType.SelectedItem.Value.ToString(), out binType); int.TryParse(dropdownList_NewBinTagStatus.SelectedItem.Value.ToString(), out binTagStatus); newModel.BinType = binType; newModel.BinTagStatus = binTagStatus; newModel.WareHouse = dropdownList_NewWareHouse.SelectedItem.Value.ToString(); newModel.BinTagID = tbxNewBinTagID.Text.Trim(); newModel.Comment = tbxNewComment.Text.Trim(); using (GoldEntities context = new GoldEntities()) { var sameCode = (from r in context.StorageBin where r.BinCode == binCode select r).ToList(); if (sameCode != null && sameCode.Count > 0) { msg += "系统中已经存在编号为[" + binCode + "]的层位信息,请重填编号!<br />"; } var sameName = (from r in context.StorageBin where r.BinName == binName select r).ToList(); if (sameName != null && sameName.Count > 0) { msg += "系统中已经存在名称为[" + binName + "]的层位信息,请重填名称!<br />"; } string newBinTagID = newModel.BinTagID; StorageBin existTagIDBin = (from r in context.StorageBin where r.BinTagID == newBinTagID select r).FirstOrDefault(); if (existTagIDBin != null) { msg += "电子标签[" + newModel.BinTagID + "]已经在层位[" + existTagIDBin.BinCode + "]被注册过了!请重新填写未注册的标签编号!<br />"; } if (msg.Length > 0) { return(false); } } return(true); } catch (Exception ex) { msg = ex.Message.ToString(); return(false); } }