private void BaseButton_Add_Click(object sender, EventArgs e) { try { if (this.curSelectedCostumeStoreList == null || this.curSelectedCostumeStoreList.Count == 0) { return; } List <CostumeStore> costumeStoreList = this.curSelectedCostumeStoreList; foreach (CostumeStore store in costumeStoreList) { if (store.Title == "库存" || store.SumCount == 0) { continue; } BoundDetail detail = this.CostumeStoreConvertToOutboundDetail(store); this.OutboundDetailListAddItem(detail); } //清空dataGirdView1的绑定源 this.costumeFromShopTextBox1.Text = string.Empty; this.dataGridView1.DataSource = null; this.BindingOutboundDetailSource(); this.costumeFromShopTextBox1.Focus(); } catch (Exception ee) { GlobalUtil.ShowError(ee); } }
private void OutboundDetailListAddItem(BoundDetail detail) { bool existed = false; DialogResult result = DialogResult.No; BoundDetail repeatItem = null; foreach (BoundDetail item in this.curDetailList) { if (item.CostumeID.ToUpper() == detail.CostumeID.ToUpper() && item.ColorName == detail.ColorName) { repeatItem = item; existed = true; result = GlobalMessageBox.Show(string.Format("款号:{0} 颜色:{1} 的服装已经存在待补货列表中,是否覆盖", item.CostumeID, item.ColorName), "", MessageBoxButtons.YesNo); break; } } if (!existed || result == DialogResult.Yes) { //不存在或者重复时直接覆盖 if (repeatItem != null) { this.curDetailList.Remove(repeatItem); } //this.curDetailList.Insert(0, detail); this.curDetailList.Add(detail); } }
private List <BoundDetail> ToBoundDetail(List <ScrapDetail> scrapDetails) { List <BoundDetail> details = new List <BoundDetail>(); foreach (var item in scrapDetails) { BoundDetail detail = new BoundDetail(); ReflectionHelper.CopyProperty(item, detail); if (item.SizeName == "F") { detail.F = (short)item.ScrapCount; } if (item.SizeName == "XS") { detail.XS = (short)item.ScrapCount; } if (item.SizeName == "S") { detail.S = (short)item.ScrapCount; } if (item.SizeName == "M") { detail.M = (short)item.ScrapCount; } if (item.SizeName == "L") { detail.L = (short)item.ScrapCount; } if (item.SizeName == "XL") { detail.XL = (short)item.ScrapCount; } if (item.SizeName == "XL2") { detail.XL2 = (short)item.ScrapCount; } if (item.SizeName == "XL3") { detail.XL3 = (short)item.ScrapCount; } if (item.SizeName == "XL4") { detail.XL4 = (short)item.ScrapCount; } if (item.SizeName == "XL5") { detail.XL5 = (short)item.ScrapCount; } if (item.SizeName == "XL6") { detail.XL6 = (short)item.ScrapCount; } details.Add(detail); } return(details); }
private static BoundDetail OutboundDetailConvertToInboundDetail(BoundDetail outboundDetail, string inboundID) { BoundDetail b = new BoundDetail(); CJBasic.Helpers.ReflectionHelper.CopyProperty(outboundDetail, b); //370 调拨单查询:入库明细为空,不能根据款号查询调拨单 b.BoundOrderID = inboundID; return(b); }
private void BaseButton_Add_Click(object sender, EventArgs e) { try { if (CommonGlobalUtil.EngineUnconnectioned(this)) { return; } if (this.curSelectedCostumeStoreList == null || this.curSelectedCostumeStoreList.Count == 0) { return; } //ValidateUtil.CheckEmptyValue(this.skinComboBoxShopID.SelectedValue), if (shopComboBox1.SelectedValue != null && skinComboBoxShopID.SelectedValue != null && ValidateUtil.CheckEmptyValue(shopComboBox1.SelectedValue) == ValidateUtil.CheckEmptyValue(skinComboBoxShopID.SelectedValue)) { GlobalMessageBox.Show("发货方与收货方不能相同!"); return; } CommonGlobalUtil.WriteLog("添加调拨信息前:" + curSelectedCostumeStoreList?.Count); List <CostumeStore> costumeStoreList = this.curSelectedCostumeStoreList.FindAll((x) => x.Title == "调拨"); CommonGlobalUtil.WriteLog("添加调拨信息后:" + costumeStoreList?.Count); AddStoreCache(this.curSelectedCostumeStoreList.FindAll((x) => x.Title == "库存")); foreach (CostumeStore store in costumeStoreList) { if (store.SumCount == 0) { CommonGlobalUtil.WriteLog("跳过总数为0:" + store.CostumeID + " " + store.ColorName); continue; } //GlobalMessageBox.Show("修改后吊牌价:"+store.Price+" "+ "修改后售价:" + store.SalePrice); BoundDetail detail = this.CostumeStoreConvertToInboundDetail(store, ""); CommonGlobalUtil.WriteLog("添加纪录:" + store.CostumeID + " " + store.ColorName); this.InboundDetailListAddItem(detail); } //清空dataGirdView1的绑定源 this.SetCostumeDetails(null); this.BindingInboundDetailSource(); dataGridView1.DataSource = null; this.skinComboBox_Color.DataSource = null; this.CostumeCurrentShopTextBox1.Focus(); } catch (Exception ee) { CommonGlobalUtil.ShowError(ee); } finally { CommonGlobalUtil.UnLockPage(this); } }
private void dataGridView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { //加载库存信息 if (this.dataGridView2 != null && this.dataGridView2.Rows.Count > 0) { BoundDetail detail = (BoundDetail)this.dataGridView2.CurrentRow.DataBoundItem; List <CostumeStore> stores = orderStoreCache.FindAll(t => t.CostumeID == detail.CostumeID && detail.ColorName == t.ColorName); this.curSelectedCostumeStoreList = stores; this.BindingSelectedCostumeStoreSource(detail); } }
private List <BarCode4Costume> CheckDetailBarCodes(BoundDetail detail) { List <BarCode4Costume> barCode4Costumes = new List <BarCode4Costume>(); foreach (var sizeName in CostumeStoreHelper.CostumeSizeColumn) { barCode4Costumes.AddRange(GetDetailBarCodesCount(detail, sizeName)); } return(barCode4Costumes); }
private ScrapDetail NewScrapDetail(string orderID, BoundDetail item, string sizeName, short count) { ScrapDetail scrap = new ScrapDetail(); scrap.ScrapOrderID = orderID; scrap.CostumeID = item.CostumeID; scrap.ColorName = item.ColorName; scrap.Price = item.Price; scrap.SizeName = sizeName; scrap.ScrapCount = count; return(scrap); }
public override void HighlightCostume() { if (dataGridView1.DataSource != null) { if (!String.IsNullOrEmpty(BaseModifyCostumeID)) { foreach (DataGridViewRow row in dataGridView1.Rows) { BoundDetail detail = row.DataBoundItem as BoundDetail; HighlightCostume(row, detail?.CostumeID); } } } }
private BoundDetail CostumeStoreConvertToOutboundDetail(CostumeStore store, string replenishOrderID) { if (store == null) { return(null); } Costume costume = GlobalCache.GetCostume(store.CostumeID); BoundDetail boundDetail = new BoundDetail(); ReflectionHelper.CopyProperty(costume, boundDetail); ReflectionHelper.CopyProperty(store, boundDetail); boundDetail.SupplierID = ValidateUtil.CheckEmptyValue(this.skinComboBoxSupplierID.SelectedValue); return(boundDetail); }
/// <summary> /// 将CostumeStore转化为InboundDetail /// </summary> /// <param name="store"></param> /// <returns></returns> private BoundDetail CostumeStoreConvertToInboundDetail(CostumeStore store, string replenishOrderID) { if (store == null) { return(null); } BoundDetail b = new BoundDetail(); CJBasic.Helpers.ReflectionHelper.CopyProperty(store, b); b.Comment = store.Remarks; b.Price = store.Price; b.SalePrice = store.SalePrice; return(b); }
private List <BarCode4Costume> GetDetailBarCodesCount(BoundDetail detail, string sizeName) { List <BarCode4Costume> barCode4Costumes = new List <BarCode4Costume>(); //获取对应尺码的值 short count = GetSizeCount(sizeName, detail); for (int i = 0; i < count; i++) { BarCode4Costume costume = new BarCode4Costume(); ReflectionHelper.CopyProperty(detail, costume); costume.SizeName = sizeName; barCode4Costumes.Add(costume); } return(barCode4Costumes); }
private void dataGridView2_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } try { //加载库存信息 BoundDetail detail = (BoundDetail)this.dataGridView2.CurrentRow.DataBoundItem; List <CostumeStore> stores = orderStoreCache.FindAll(t => t.CostumeID == detail.CostumeID && detail.ColorName == t.ColorName); this.curSelectedCostumeStoreList = stores; this.BindingSelectedCostumeStoreSource(detail); } catch {} }
private DataGridView deepCopyDataGridView() { DataGridView dgvTmp = new DataGridView(); dgvTmp.Name = "dgvTmp"; this.Controls.Add(dgvTmp); dgvTmp.AutoGenerateColumns = false; // dgvTmp.AllowUserToAddRows = false; //不允许用户生成行,否则导出后会多出最后一行 for (int i = 0; i < dataGridView2.Columns.Count; i++) { dgvTmp.Columns.Add(dataGridView2.Columns[i].Name, dataGridView2.Columns[i].HeaderText); if (dataGridView2.Columns[i].DefaultCellStyle.Format.Contains("N")) //使导出Excel文档金额列可做SUM运算 { dgvTmp.Columns[i].DefaultCellStyle.Format = dataGridView2.Columns[i].DefaultCellStyle.Format; } if (!dataGridView2.Columns[i].Visible) { dgvTmp.Columns[i].Visible = false; } dgvTmp.Columns[i].DataPropertyName = dataGridView2.Columns[i].DataPropertyName; dgvTmp.Columns[i].HeaderText = dataGridView2.Columns[i].HeaderText; dgvTmp.Columns[i].Tag = dataGridView2.Columns[i].Tag; dgvTmp.Columns[i].Name = dataGridView2.Columns[i].Name; } List <BoundDetail> listtb1 = DataGridViewUtil.BindingListToList <BoundDetail>(dataGridView2.DataSource); List <BoundDetail> tb2 = new List <BoundDetail>(); foreach (BoundDetail idetail in listtb1) { BoundDetail tDetail = new BoundDetail(); ReflectionHelper.CopyProperty(idetail, tDetail); tb2.Add(tDetail); } dgvTmp.DataSource = tb2; return(dgvTmp); }
private void BindingSelectedCostumeStoreSource(BoundDetail detail) { if (this.curSelectedCostumeStoreList == null) { this.dataGridView1.DataSource = null; } else { this.dataGridView1.DataSource = null; if (this.curSelectedCostumeStoreList != null && this.curSelectedCostumeStoreList.Count > 0) { List <CostumeStore> tempList = new List <CostumeStore>(); foreach (CostumeStore store in this.curSelectedCostumeStoreList) { store.Title = "库存"; CostumeStore tempStore = this.BuildCostumeStore4NeedReplenish(store, detail); //CJBasic.Helpers.ReflectionHelper.CopyProperty(store, obj); tempList.Add(store); tempList.Add(tempStore); } this.curSelectedCostumeStoreList = tempList; this.dataGridView1.DataSource = DataGridViewUtil.ListToBindingList(this.curSelectedCostumeStoreList); } } foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Index % 2 == 0) { row.ReadOnly = true; row.HeaderCell.Value = "库存"; } else { row.ReadOnly = false; row.HeaderCell.Value = "退货"; } } // cell获取焦点 dataGridViewPagingSumCtrl1.AutoFocusToWritableCell(); // this.dataGridView1.Refresh(); }
private void BindingOutboundSource() { this.outboundDetailListCounterpart.Clear(); this.dataGridView1.DataSource = null; if (this.curOutbound != null && this.curOutbound.OutboundDetails != null && this.curOutbound.OutboundDetails.Count > 0) { foreach (BoundDetail detail in this.curOutbound.OutboundDetails) { detail.CostumeName = CommonGlobalCache.GetCostumeName(detail.CostumeID); BoundDetail item = new BoundDetail(); detail.IsConfirmed = true; CJBasic.Helpers.ReflectionHelper.CopyProperty(detail, item); this.outboundDetailListCounterpart.Add(item); } // this.dataGridView1.DataSource = this.curOutbound.OutboundDetails; dataGridViewPagingSumCtrl.BindingDataSource <BoundDetail>(this.curOutbound.OutboundDetails); } this.dataGridView1.Refresh(); }
private BoundDetail OutboundDetailConvertToOutboundDetail(BoundDetail from, string id) { return(new BoundDetail() { CostumeID = from.CostumeID, ColorName = from.ColorName, CostPrice = from.CostPrice, BoundOrderID = id, Price = from.Price, S = from.S, M = from.M, XS = from.XS, L = from.L, F = from.F, XL = from.XL, XL2 = from.XL2, XL3 = from.XL3, XL4 = from.XL4, XL5 = from.XL5, XL6 = from.XL6, Comment = from.Comment }); }
private void dataGridView2_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } DataGridView dataGridView = (DataGridView)sender; DataGridViewCell cell = dataGridView.CurrentCell; List <BoundDetail> stores = DataGridViewUtil.BindingListToList <BoundDetail>(dataGridView2.DataSource); BoundDetail store = dataGridView.Rows[e.RowIndex].DataBoundItem as BoundDetail; //联动吊牌价和售价 foreach (var item in stores) { if (store.CostumeID == item.CostumeID) { if (e.ColumnIndex == SalePrice.Index) { item.SalePrice = store.SalePrice; } else if (e.ColumnIndex == priceDataGridViewTextBoxColumn.Index) { item.Price = store.Price; } } } if (cell != null) { if (cell.OwningColumn.DataPropertyName == priceDataGridViewTextBoxColumn.DataPropertyName) { BoundDetail change = (BoundDetail)cell.OwningRow.DataBoundItem; //735 管理端增加售价管理功能 03-19 myy 实时更新总销售额 change.SumMoney = change.Price * change.SumCount; } } dataGridView.Refresh(); }
private void BaseButton_Add_Click(object sender, EventArgs e) { try { if (this.curSelectedCostumeStoreList == null || this.curSelectedCostumeStoreList.Count == 0) { return; } List <CostumeStore> costumeStoreList = this.curSelectedCostumeStoreList.FindAll((x) => x.Title == "退货"); AddStoreCache(this.curSelectedCostumeStoreList.FindAll((x) => x.Title == "库存")); foreach (CostumeStore store in costumeStoreList) { if (store.SumCount == 0) { continue; } if (store.Remarks == null) { store.Remarks = ""; } BoundDetail detail = this.CostumeStoreConvertToOutboundDetail(store, ""); detail.Comment = store.Remarks; detail.Year = GlobalCache.GetCostume(store.CostumeID).Year; detail.Season = GlobalCache.GetCostume(store.CostumeID).Season; this.OutboundDetailListAddItem(detail); } //清空dataGirdView1的绑定源 this.SetCostumeDetails(null); this.BindingOutboundDetailSource(); this.CostumeCurrentShopTextBox1.Focus(); } catch (Exception ex) { GlobalUtil.ShowError(ex); } }
private void GetData() { List <ReplenishDetail> curReplenishDetailList = CommonGlobalCache.ServerProxy.GetReplenishDetail(this.order.ID); List <BoundDetail> detailList = new List <BoundDetail>(); foreach (var item in curReplenishDetailList) { BoundDetail detail = new BoundDetail(); ReflectionHelper.CopyProperty(item, detail); List <CostumeItem> costumesItemList = CommonGlobalCache.ServerProxy.GetCostumeStoreList(new CostumeStoreListPara() { CostumeID = item.CostumeID, IsOnlyShowValid = false, ShopID = ValidateUtil.CheckEmptyValue(skinComboBoxShopID.SelectedValue), }); CostumeItem curCostumeItem = costumesItemList.Find(t => t.Costume.ID == item.CostumeID); // CostumePrice destShopStore = CommonGlobalCache.ServerProxy.GetCostumeStorePrice(ValidateUtil.CheckEmptyValue(skinComboBoxShopID.SelectedValue),item.CostumeID); // GlobalMessageBox.Show(CommonGlobalCache.GetShopName(ValidateUtil.CheckEmptyValue(skinComboBoxShopID.SelectedValue))); CostumeStore destShopStore = curCostumeItem?.CostumeStoreList?.Find(t => t.CostumeID == item.CostumeID && t.ColorName == item.ColorName); if (destShopStore != null) { //取收货方的吊牌价售价 detail.Price = destShopStore.Price; detail.SalePrice = destShopStore.SalePrice; } detailList.Add(detail); } curDetailList = detailList; }
/// <summary> /// 获取对应的尺码的数量值 /// </summary> /// <param name="sizeName"></param> /// <returns></returns> private Int16 GetSizeCount(string sizeName, BoundDetail detail) { return(Int16.Parse(ReflectUtil.GetModelValue(sizeName, detail))); }
private DataGridView deepCopyDataGridView(List <BoundDetail> list) { DataGridView dgvTmp = new DataGridView(); dgvTmp.Name = "dgvTmp"; this.Controls.Add(dgvTmp); dgvTmp.AutoGenerateColumns = false; // dgvTmp.AllowUserToAddRows = false; //不允许用户生成行,否则导出后会多出最后一行 for (int i = 0; i < dataGridView2.Columns.Count; i++) { dgvTmp.Columns.Add(dataGridView2.Columns[i].Name, dataGridView2.Columns[i].HeaderText); if (dataGridView2.Columns[i].DefaultCellStyle.Format.Contains("N")) //使导出Excel文档金额列可做SUM运算 { dgvTmp.Columns[i].DefaultCellStyle.Format = dataGridView2.Columns[i].DefaultCellStyle.Format; } if (!dataGridView2.Columns[i].Visible) { dgvTmp.Columns[i].Visible = false; } dgvTmp.Columns[i].DataPropertyName = dataGridView2.Columns[i].DataPropertyName; dgvTmp.Columns[i].HeaderText = dataGridView2.Columns[i].HeaderText; dgvTmp.Columns[i].Tag = dataGridView2.Columns[i].Tag; dgvTmp.Columns[i].Name = dataGridView2.Columns[i].Name; } // List<AllocateOrder> listtb1 = (List<AllocateOrder>)(dataGridView1.DataSource); List <BoundDetail> tb2 = new List <BoundDetail>(); foreach (BoundDetail idetail in list) { BoundDetail tDetail = new BoundDetail(); ReflectionHelper.CopyProperty(idetail, tDetail); tb2.Add(tDetail); } dgvTmp.DataSource = tb2; /* foreach (DataGridViewColumn dgvColumn in dgvTmp.Columns) * { * //dgvColumn.DataPropertyName== * switch (dgvColumn.DataPropertyName) * { * case "CostumeID": * dgvColumn.HeaderText = "款号"; * break; * case "CostumeName": * dgvColumn.HeaderText = "商品名称"; * break; * case "BrandName": * dgvColumn.HeaderText = "品牌"; * break; * case "ColorName": * dgvColumn.HeaderText = "颜色"; * break; * case "Year": * dgvColumn.HeaderText = "年份"; * break; * case "Season": * dgvColumn.HeaderText = "季节"; * break; * case "Price": * dgvColumn.HeaderText = "吊牌价"; * break; * case "SalePrice": * dgvColumn.HeaderText = "售价"; * break; * case "F": * dgvColumn.HeaderText = "F"; * break; * case "XS": * dgvColumn.HeaderText = "XS"; * break; * * case "S": * dgvColumn.HeaderText = "S"; * break; * case "M": * dgvColumn.HeaderText = "M"; * break; * * case "L": * dgvColumn.HeaderText = "L"; * break; * case "XL": * dgvColumn.HeaderText = "XL"; * break; * case "XL2": * dgvColumn.HeaderText = "2XL"; * break; * case "XL3": * dgvColumn.HeaderText = "3XL"; * break; * case "XL4": * dgvColumn.HeaderText = "4XL"; * break; * case "XL5": * dgvColumn.HeaderText = "5XL"; * break; * case "XL6": * dgvColumn.HeaderText = "6XL"; * break; * case "SumCount": * dgvColumn.HeaderText = "数量"; * break; * case "SumMoney": * dgvColumn.HeaderText = "总金额"; * break; * case "Comment": * dgvColumn.HeaderText = "备注"; * break; * default: * break; * } * * }*/ return(dgvTmp); }
private CostumeStore BuildCostumeStore4NeedReplenish(CostumeStore oldCostumeStore, BoundDetail detail) { CostumeStore store = null; if (oldCostumeStore != null) { store = new CostumeStore() { }; ReflectionHelper.CopyProperty(oldCostumeStore, store); store.Title = "退货"; store.F = 0; store.L = 0; store.XS = 0; store.M = 0; store.S = 0; store.XL = 0; store.XL2 = 0; store.XL3 = 0; store.XL4 = 0; store.XL5 = 0; store.XL6 = 0; if (detail != null) { store.F = detail.F; store.L = detail.L; store.XS = detail.XS; store.M = detail.M; store.S = detail.S; store.XL = detail.XL; store.XL2 = detail.XL2; store.XL3 = detail.XL3; store.XL4 = detail.XL4; store.XL5 = detail.XL5; store.XL6 = detail.XL6; store.CostPrice = detail.CostPrice; } } return(store); }
/// <summary> /// 绑定选定款号对应的CostumeStore集合 /// </summary> private void BindingSelectedCostumeStoreSource(BoundDetail detail) { try { if (this.curSelectedCostumeStoreList != null && this.curSelectedCostumeStoreList.Count > 0) { List <CostumeStore> tempList = new List <CostumeStore>(); foreach (CostumeStore store in this.curSelectedCostumeStoreList) { store.Title = "库存"; // store.Price = 0; // store.CostumeName = CommonGlobalCache.GetCostumeName(store.CostumeID); //CJBasic.Helpers.ReflectionHelper.CopyProperty(store, obj); // this.ReadOnly = true; List <CostumeItem> resultList = CommonGlobalCache.ServerProxy.GetCostumeStoreList( new CostumeStoreListPara() { CostumeID = store.CostumeID, ShopID = ValidateUtil.CheckEmptyValue(skinComboBoxShopID.SelectedValue), IsOnlyShowValid = false }); CostumeItem item = resultList?.Find(t => t.Costume.ID == store.CostumeID); CostumeStore destShopStore = item?.CostumeStoreList?.Find(t => t.CostumeID == store.CostumeID && t.ColorName == store.ColorName); if (destShopStore != null) { //取收货方的吊牌价售价 store.Price = destShopStore.Price; store.SalePrice = destShopStore.SalePrice; } CostumeStore tempStore = this.BuildCostumeStore4NeedReplenish(store, detail); tempList.Add(store); tempList.Add(tempStore); } this.curSelectedCostumeStoreList = tempList; } List <CostumeStore> selectResultList = new List <CostumeStore>(); /* if (this.skinComboBox_Color.DataSource!= null && this.curSelectedCostumeStoreList != null && this.skinComboBox_Color.SelectedValue != null) * { * selectResultList = this.curSelectedCostumeStoreList.FindAll(t => t.ColorName == ValidateUtil.CheckEmptyValue(this.skinComboBox_Color.SelectedValue)); * } */ dataGridViewPagingSumCtrl1.BindingDataSource(DataGridViewUtil.ListToBindingList(curSelectedCostumeStoreList)); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Index % 2 == 0) { row.ReadOnly = true; row.HeaderCell.Value = "库存"; } else { row.ReadOnly = false; row.HeaderCell.Value = "调拨"; } } // curSelectedCostumeStoreList = null; dataGridViewPagingSumCtrl1.AutoFocusToWritableCell(); } catch (Exception ex) { CommonGlobalUtil.ShowError(ex); } finally { // this.ReadOnly = false; } }