/// <summary> /// 编辑 /// </summary> private void ShowEdit() { UnitGroupEntity editEntity = SelectedHeaderRow; if (editEntity == null) { MsgBox.Warn("没有要修改的数据。"); return; } FrmUnitGroupEditType_C frmUnitGroupEdit = new FrmUnitGroupEditType_C(editEntity); frmUnitGroupEdit.DataSourceChanged += OnEditChanage; frmUnitGroupEdit.ShowDialog(); }
private void OnItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { switch (e.Item.Tag.ToString()) { case "刷新": ReLoad(); break; case "新增": DoCreate(); break; case "添加关联行": UnitGroupEntity selectedHeaderRow = SelectedHeaderRow; if (selectedHeaderRow == null) { MsgBox.Warn("请选中一行包装关系。"); } else { using (FrmUnitGroupItemType_C frmAddItem = new FrmUnitGroupItemType_C(selectedHeaderRow)) { frmAddItem.DataSourceChanged += new EventHandler(frmAddItem_DataSourceChanged); frmAddItem.ShowDialog(); } } break; case "修改": ShowEdit(); break; case "删除": DoDeleteSelectedItem(); break; case "快速查找": if (gridView1.IsFindPanelVisible) { gridView1.HideFindPanel(); } else { gridView1.ShowFindPanel(); } break; } }
private void ShowEditInfo(UnitGroupEntity grpEntity) { //txtCode.Text = grpEntity.GrpCode; listSku.EditValue = grpEntity.SkuCode; txtBarcode.Text = grpEntity.SkuBarcode; listUnit1.EditValue = grpEntity.UnitCode; txtCount.Text = grpEntity.Qty.ToString(); txtWeight.Text = grpEntity.Weight.ToString(); txtChang.Text = grpEntity.Length.ToString(); txtKuan.Text = grpEntity.Width.ToString(); txtGao.Text = grpEntity.Height.ToString(); //txtDesc.Text = grpEntity.GrpDesc; listUnit1.EditValue = grpEntity.UnitCode; comboIsActive.Text = grpEntity.IsActive; txtSkuLevel.Text = grpEntity.SkuLevel.ToString(); }
/// <summary> /// 删除 /// </summary> private void DoDeleteSelectedItem() { UnitGroupEntity removeEntity = SelectedHeaderRow; if (removeEntity == null) { MsgBox.Warn("没有要删除的数据。"); return; } if (MsgBox.AskOK(string.Format("确定要删除包装关系行{0}吗?", removeEntity.SkuName)) == DialogResult.OK) { //int ret = unitGrpDal.Delete(removeEntity.ID); //if (ret >= 1) //{ // bindingSource1.Remove(removeEntity); //} //else // MsgBox.Warn("删除失败,该包装关系行正在使用中。"); } }
///<summary> ///查询所有计量单位组 ///</summary> ///<returns></returns> public List <UnitGroupEntity> GetAllZJQ(int nums, int begin, out int total) { List <UnitGroupEntity> list = new List <UnitGroupEntity>(); total = 0; try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); if (begin == 0) { loStr.Append("beginRow=").Append("&"); } else { loStr.Append("beginRow=").Append(begin).Append("&"); } loStr.Append("warehouseType=").Append(EUtilStroreType.WarehouseTypeToInt(GlobeSettings.LoginedUser.WarehouseType)).Append("&"); if (begin == 0) { loStr.Append("rows="); } else { loStr.Append("rows=").Append(nums); } string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetAllZJQ); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonGetAllZJQ bill = JsonConvert.DeserializeObject <JsonGetAllZJQ>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonGetAllZJQResult jbr in bill.result) { UnitGroupEntity asnEntity = new UnitGroupEntity(); #region 0-10 asnEntity.Height = StringToDecimal.GetTwoDecimal(jbr.height); asnEntity.ID = Convert.ToInt32(jbr.id); asnEntity.IsActive = jbr.isActive; asnEntity.Length = StringToDecimal.GetTwoDecimal(jbr.length); asnEntity.Qty = Convert.ToInt32(jbr.qty); asnEntity.SkuBarcode = jbr.skuBarcode; asnEntity.SkuCode = jbr.skuCode; asnEntity.SkuLevel = Convert.ToInt32(jbr.skuLevel); asnEntity.SkuName = jbr.skuName; asnEntity.Spec = jbr.spec; #endregion #region 11-15 asnEntity.UnitCode = jbr.umCode; asnEntity.UnitName = jbr.umName; asnEntity.Weight = StringToDecimal.GetTwoDecimal(jbr.weight); asnEntity.Width = StringToDecimal.GetTwoDecimal(jbr.width); if (GlobeSettings.LoginedUser.WarehouseType == EWarehouseType.散货仓) { asnEntity.SkuLevel = Convert.ToInt32(jbr.skuLevel); asnEntity.Skuvol = StringToDecimal.GetTwoDecimal(jbr.skuVol); }// #endregion list.Add(asnEntity); } total = bill.total; return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message + ex.StackTrace); } return(list); }
public FrmUnitGroupItem(UnitGroupEntity unitGrpEntity) : this() { this.unitGrpEntity = unitGrpEntity; }
public FrmUnitGroupEditType_C(UnitGroupEntity unitGrpEntity) : this() { this.unitGrpEntity = unitGrpEntity; }
/// <summary> /// 物料信息编辑 /// </summary> /// <param name="sku_code"></param> /// <returns></returns> public List <UnitGroupEntity> GetUmName(string sku_code) { List <UnitGroupEntity> list = new List <UnitGroupEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("skuCode=").Append(sku_code); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetUmName); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonGetUmName bill = JsonConvert.DeserializeObject <JsonGetUmName>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonGetUmNameResult jbr in bill.result) { UnitGroupEntity asnEntity = new UnitGroupEntity(); #region 0-10 asnEntity.Height = StringToDecimal.GetTwoDecimal(jbr.height); asnEntity.ID = Convert.ToInt32(jbr.id); asnEntity.IsActive = jbr.isActive; asnEntity.Length = StringToDecimal.GetTwoDecimal(jbr.length); //jbr.namePy; asnEntity.Qty = Convert.ToInt32(jbr.qty); asnEntity.SkuBarcode = jbr.skuBarCode; asnEntity.SkuCode = jbr.skuCode; asnEntity.SkuLevel = Convert.ToInt32(jbr.skuLevel); asnEntity.SkuName = jbr.skuName; asnEntity.Spec = jbr.spec; #endregion #region 11-15 asnEntity.UnitCode = jbr.umCode; asnEntity.UnitName = jbr.umName; asnEntity.Weight = StringToDecimal.GetTwoDecimal(jbr.weight); asnEntity.Width = StringToDecimal.GetTwoDecimal(jbr.width); #endregion list.Add(asnEntity); } return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }