private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { DataGridView view = (DataGridView)sender; try { if (e.RowIndex >= 0 && e.ColumnIndex >= 0 && !view.Rows[e.RowIndex].IsNewRow) { List <CheckStoreDetail> list = (List <CheckStoreDetail>)view.DataSource; CheckStoreDetail item = (CheckStoreDetail)list[e.RowIndex]; switch (view.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.HeaderText) { case "选择": item.Selected = (bool)view[e.ColumnIndex, e.RowIndex].Value; SetZoneSelected(item); // SetSelectedTitle(); break; default: break; } } } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } }
internal void addCheckStore(CheckStoreRequestDto dto) { CheckStore checkStore = new CheckStore(); checkStore.Id = dto.id; checkStore.StaffId = long.Parse(dto.staffId); checkStore.StoreId = dto.storeId; checkStore.Time = stampConvert.convertTimeStamp(dto.time); db.CheckStore.Add(checkStore); db.SaveChanges(); int id = db.CheckStore.Where(s => s.Time == checkStore.Time).FirstOrDefault().Id; foreach (TransactionMaterialAmountDto dto1 in dto.detail) { CheckStoreDetail checkStoreDetail = new CheckStoreDetail(); checkStoreDetail.Amount = dto1.materialAmount; checkStoreDetail.CheckStoreInforId = id; checkStoreDetail.MaterialId = int.Parse(dto1.material.id); db.CheckStoreDetail.Add(checkStoreDetail); } db.SaveChanges(); }
private CheckStoreDetail ToCheckStoreDetail(CostumeStoreHistory item) { CheckStoreDetail detail = new CheckStoreDetail(); if (item != null) { Costume costume = CommonGlobalCache.GetCostume(item.CostumeID); if (costume != null) { ReflectionHelper.CopyProperty(costume, detail); detail.CostumeID = costume.ID; detail.CostumeName = costume.Name; detail.ColorName = item.ColorName; detail.BrandName = CommonGlobalCache.GetBrandName4CostumeID(detail.CostumeID); detail.FAtm = item.F; detail.SAtm = item.S; detail.MAtm = item.M; detail.LAtm = item.L; detail.XSAtm = item.XS; detail.XLAtm = item.XL; detail.XL2Atm = item.XL2; detail.XL3Atm = item.XL3; detail.XL4Atm = item.XL4; detail.XL5Atm = item.XL5; detail.XL6Atm = item.XL6; } else { // ShowErrorMessage("款号不存在:" + item.CostumeID); } } return(detail); }
private CheckStoreDetail SetCostumeStoreDiff(CheckStoreDetail real, CheckStoreDetail liaojian, CheckStoreDetail quick, string title) { if (quick == null) { return(null); } CheckStoreDetail costumeStore = new CheckStoreDetail(); CJBasic.Helpers.ReflectionHelper.CopyProperty(quick, costumeStore); // costumeStore.Title = title; //if (this.curUpdatedCheckStoreOrder == null) //{ costumeStore.XS = (short)(real.XS + liaojian.XS - quick.XS); costumeStore.L = (short)(real.L + liaojian.L - quick.L); costumeStore.M = (short)(real.M + liaojian.M - quick.M); costumeStore.S = (short)(real.S + liaojian.S - quick.S); costumeStore.XL = (short)(real.XL + liaojian.XL - quick.XL); costumeStore.XL2 = (short)(real.XL2 + liaojian.XL2 - quick.XL2); costumeStore.XL3 = (short)(real.XL3 + liaojian.XL3 - quick.XL3); costumeStore.XL4 = (short)(real.XL4 + liaojian.XL4 - quick.XL4); costumeStore.XL5 = (short)(real.XL5 + liaojian.XL5 - quick.XL5); costumeStore.XL6 = (short)(real.XL6 + liaojian.XL6 - quick.XL6); costumeStore.F = (short)(real.F + liaojian.F - quick.F); // } return(costumeStore); }
private void ToCheckStoreDetail(CheckStoreDetail detail, CostumeStoreHistory item) { if (item != null) { Costume costume = CommonGlobalCache.GetCostume(item.CostumeID); if (costume != null) { detail.CostumeID = item.CostumeID; detail.CostumeName = costume.Name; detail.ColorName = item.ColorName; detail.Price = costume.Price; detail.FAtm = item.F; detail.SAtm = item.S; detail.MAtm = item.M; detail.LAtm = item.L; detail.XSAtm = item.XS; detail.XLAtm = item.XL; detail.XL2Atm = item.XL2; detail.XL3Atm = item.XL3; detail.XL4Atm = item.XL4; detail.XL5Atm = item.XL5; detail.XL6Atm = item.XL6; } else { // ShowErrorMessage("款号不存在:" + item.CostumeID); } } }
private void ShowDiff() {//显示盘点录入中有差异的商品 List <CheckStoreDiff> diffList = new List <CheckStoreDiff>(); foreach (var item in costumeStores) { if (!CheckBrand(item)) { continue; } CheckStoreDetail real = item; CostumeStoreHistory shot = shots.Find(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && item.ColorName == t.ColorName); if (shot == null) { WebResponseObj <List <CostumeStoreHistory> > result = CommonGlobalCache.ServerProxy.GetCostumeStoreHistory4CheckStore( this.shopId, item.CostumeID, new Date(this.date), true ); if (result?.Data != null && result?.Data.Count > 0) { shot = result.Data.Find(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && item.ColorName == t.ColorName); } } CheckStoreDetail quick = ToCheckStoreDetail(shot); CheckStoreDetail liaojian = new CheckStoreDetail(); CheckStoreDetail diff = null; diff = SetCostumeStoreDiff(real, liaojian, quick, "差异"); foreach (string sizeName in CostumeStoreHelper.CostumeSizeColumn) { String dbSize = sizeName; //CostumeStoreHelper.GetCostumeSize(sizeName, sizeGroup); int differenceCount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(diff, sizeName + "WinLost")); if (differenceCount != 0) { int realcount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(real, sizeName)); int changeCount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(liaojian, sizeName)); int storeCount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(quick, sizeName + "Atm")); CheckStoreDiff storeDiff = new CheckStoreDiff(); ReflectionHelper.CopyProperty(real, storeDiff); Costume costume = CommonGlobalCache.GetCostume(storeDiff.CostumeID); String sizeDisplayName = CostumeStoreHelper.GetCostumeSizeName(sizeName, CommonGlobalCache.GetSizeGroup(costume.SizeGroupName)); storeDiff.SizeName = sizeDisplayName; storeDiff.BrandName = CommonGlobalCache.GetBrandName(costume.BrandID); storeDiff.DiffCount = differenceCount; storeDiff.RealCount = realcount; storeDiff.QuickCount = storeCount; storeDiff.ChangeCount = changeCount; diffList.Add(storeDiff); } } } dataGridViewPagingSumCtrl2.BindingDataSource(diffList); }
public override void HighlightCostume() { if (dataGridView1.DataSource != null) { if (!String.IsNullOrEmpty(BaseModifyCostumeID)) { foreach (DataGridViewRow row in dataGridView1.Rows) { CheckStoreDetail detail = row.DataBoundItem as CheckStoreDetail; HighlightCostume(row, detail?.CostumeID); } } } }
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } if (costumeIDDataGridViewTextBoxColumn.Index == e.ColumnIndex || costumeNameDataGridViewTextBoxColumn.Index == e.ColumnIndex) { // CheckStoreDetail store = dataGridView1.Rows[e.RowIndex].DataBoundItem as CheckStoreDetail; if (!store.ShowSelected) { e.Value = null; } } }
private void SetZoneSelected(CheckStoreDetail zone) { if (zone != null) { List <CheckStoreDetail> list = (List <CheckStoreDetail>)dataGridView1.DataSource; foreach (var item in list) { if (zone.CostumeID.ToUpper() == item.CostumeID.ToUpper()) { // item.Selected = zone.Selected; } } dataGridView1.Refresh(); } }
private void CheckTheSame() { //检查相同无差异款,根据盘点录入列表 List <CheckStoreDetail> noDiffList = new List <CheckStoreDetail>(); foreach (var item in costumeStores) { CheckStoreDetail real = item; if (!CheckBrand(item)) { continue; } CostumeStoreHistory shot = shots.Find(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && item.ColorName == t.ColorName); if (shot == null) { //读取已盘点单,并且与账面进行对比 WebResponseObj <List <CostumeStoreHistory> > result = CommonGlobalCache.ServerProxy.GetCostumeStoreHistory4CheckStore( this.shopId, item.CostumeID, new Date(this.date), true ); if (result?.Data != null && result?.Data.Count > 0) { shot = result.Data.Find(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && item.ColorName == t.ColorName); } // shot = new CostumeStoreHistory(); } CheckStoreDetail quick = ToCheckStoreDetail(shot); CheckStoreDetail liaojian = new CheckStoreDetail(); CheckStoreDetail diff = null; diff = SetCostumeStoreDiff(real, liaojian, quick, "差异"); if (diff.SumCountWinLost == 0) { noDiffList.Add(real); } } dataGridViewPagingSumCtrl1.BindingDataSource(noDiffList); }
private bool CheckBrand(CheckStoreDetail store) { return(store.BrandID == brandID || brandID == "-1"); }
private void DoShowUnCheck() { try { uncheckList = new List <CheckStoreDetail>(); //不在列表中的款號 InitProgress(shots.Count); int k = 0; foreach (CostumeStoreHistory item in shots) { List <CheckStoreDetail> storeList = costumeStores.FindAll(t => t.CostumeID.ToUpper() == item.CostumeID.ToUpper() && t.ColorName == item.ColorName); if (storeList == null || storeList.Count == 0) { int i = 0; UpdateProgress("正在加载"); k++; if (item != null) { CheckStoreDetail store = ToCheckStoreDetail(item); //如果账面数为0不显示 if (store.HasNoDiffAtm) { continue; } if (!CheckBrand(store)) { continue; } if (i == 0) { store.ShowSelected = true; } uncheckList.Add(store); } i++; } else { //已存在某款某颜色 int i = 0; //同款的,只加入不同颜色的 //有对应颜色的话,不加入 CheckStoreDetail store = storeList.Find(t => t.ColorName == item.ColorName); if (store == null) { //不存在则添加 store = new CheckStoreDetail(); CJBasic.Helpers.ReflectionHelper.CopyProperty(item, store); ToCheckStoreDetail(store, item); //如果账面数为0不显示 if (store.HasNoDiffAtm) { continue; } if (!CheckBrand(store)) { continue; } Costume costume = CommonGlobalCache.GetCostume(store.CostumeID); store.CostumeName = costume?.Name; CJBasic.Helpers.ReflectionHelper.CopyProperty(costume, store); if (i == 0) { store.ShowSelected = true; } uncheckList.Add(store); i++; } } } BindingSource(uncheckList); } catch (Exception ex) { FailedProgress(ex); ShowError(ex); } finally { CompleteProgressForm(); UnLockPage(); } }