public FrmEditAsn(AsnHeaderEntity header) { InitializeComponent(); Header = header; this.Text = string.Format("填写备注(单号:{0})", Header.BillNO); }
public FrmStrategyDialog(AsnHeaderEntity asnHeaderEntity) : this() { asnDal = new AsnDal(); codeItemDal = new CodeItemDal(); bindDataSouce = new BindLookUpEditDataSouce(); this.asnHeaderEntity = asnHeaderEntity; }
public AsnHeaderEntity prepareSave() { AsnHeaderEntity editEntity = asnHeaderEntity; editEntity.InboundType = ConvertUtil.ToString(lookUpEditStrategy.EditValue); editEntity.InboundTypeName = lookUpEditStrategy.Text; return(editEntity); }
public RepAsnTransfer(int billID, short copies) : this() { BillID = billID; this.copies = copies; //获取数据 try { header = GetBillHeader(BillID); WarehouseEntity warehouseEntity = GetWarehouseByCode(header.Sales); if (warehouseEntity != null) { this.lblFormWarehouse.Text = warehouseEntity.WarehouseName; } else { this.lblFormWarehouse.Text = header.Sales; } this.xrLabel10.Text = GlobeSettings.LoginedUser.WarehouseName; List <PODetailEntity> details = GetDetailByBillID(BillID); dataSource = new ASNBody(); dataSource.Header = header; dataSource.Details = details; decimal n = 0; foreach (PODetailEntity entity in this.dataSource.Details) { decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.MaterialName.Length) / ConvertUtil.ToDecimal(12)); if (num > 2) { n += num; } } // 更新打印次数 if (header.Printed == 0) { this.xrLabel7.Text = (header.Printed + 1).ToString(); UpdatePrinted(header.BillID, header.Printed); header.Printed++; UpdatePrinted(header.BillID, header.Printed); } else { header.Printed++; this.xrLabel7.Text = header.Printed.ToString(); UpdatePrinted(header.BillID, header.Printed); } this.PageHeight = (int)(details.Count + n) * 65 + 920; } catch (Exception ex) { MsgBox.Err(ex.Message); } }
private void ConfirmInbound() { AsnHeaderEntity asnHeaderEntity = SelectedHeader; if (asnHeaderEntity == null) { MsgBox.Warn("请选择要确认入库的单据。"); return; } if (asnHeaderEntity.Status != SysCodeConstant.ASN_STATUS_AWAIT_CHECK) { MsgBox.Warn("只有待验收状态的【越库单据】才能执行【确认入库】操作。"); return; } if (!CanSave()) { return; } //FrmChooseAcrossLocation frmLocation = new FrmChooseAcrossLocation(); //if (DialogResult.OK == frmLocation.ShowDialog()) //{ try { List <AsnDetailEntity> details = gvDetails.DataSource as List <AsnDetailEntity>; int qty = details.Sum(d => d.Qty); int putQty = details.Sum(d => d.PutawayQty.Value); if (MsgBox.AskOK(string.Format("应收数量为“{0}”,实收数量为“{1}”,确定要入库吗?", qty, putQty)) != DialogResult.OK) { return; } string errMsg = asnDal.ExecuteCrossInstore(asnHeaderEntity.BillID, listLocations.Text, details, GlobeSettings.LoginedUser.UserName); if (string.IsNullOrEmpty(errMsg)) { MsgBox.OK("越库收货成功,单据将从下面的表格中移除。"); gvHeader.DeleteSelectedRows(); ShowFocusDetail(); } else { MsgBox.Warn(errMsg); } } catch (Exception ex) { MsgBox.Err(ex.Message); } //} }
/// <summary> /// 持久化入库策略 /// </summary> /// <param name="entity">到货通知到实体</param> /// <returns></returns> public int AsnUpdate(AsnHeaderEntity entity, string userCode) { IMapper map = DatabaseInstance.Instance(); int ret = -2; ret = map.Execute("UPDATE ASN_HEADER SET INBOUND_TYPE = @StrategyType WHERE BILL_ID = @BillId", new { StrategyType = entity.InstoreType, BillId = entity.BillID }); return(ret); }
void ShowFocusDetail() { AsnHeaderEntity selectedHeader = SelectedHeader; if (selectedHeader == null) { gridDetails.DataSource = null; lblBillNO.Text = "未选择单据"; } else { gridDetails.DataSource = asnDal.GetDetailsByBillID(selectedHeader.BillID); lblBillNO.Text = selectedHeader.BillNO; } }
public void ShowFocusDetail() { AsnHeaderEntity selectedHeader = SelectedHeader; if (selectedHeader == null) { gridDetails.DataSource = null; gvDetails.ViewCaption = "未选择单据"; } else { gridDetails.DataSource = asnDal.GetDetailsByBillID(selectedHeader.BillID); gvDetails.ViewCaption = string.Format("单据号: {0}", selectedHeader.BillNO); } }
public RepAsn(int billID, short copies, int tag) : this() { BillID = billID; this.copies = copies; //获取数据 try { header = GetBillHeader(BillID); List <PODetailEntity> details = GetDetailByBillID(BillID); dataSource = new ASNBody(); dataSource.Header = header; dataSource.Details = details; decimal n = 0; foreach (PODetailEntity entity in this.dataSource.Details) { decimal num = Math.Ceiling(ConvertUtil.ToDecimal(entity.MaterialName.Length) / ConvertUtil.ToDecimal(12)); if (num > 2) { n += num; } } // 更新打印次数 //header.Printed++; //this.xrLabel4.Text = header.Printed.ToString(); UpdatePrinted(header.BillID, header.Printed); if (tag == 1) { header.Printed++; this.xrLabel4.Text = header.Printed.ToString(); UpdatePrinted(header.BillID, header.Printed); this.xrlblUnin.Text = "*记账联*"; } else { this.xrlblUnin.Text = "*供应商存查联*"; this.xrLabel4.Text = header.Printed.ToString(); } this.PageHeight = (int)(details.Count + n) * 65 + 1000; } catch (Exception ex) { MsgBox.Err(ex.Message); } }
/// <summary> /// 利用RowCellStyle给特殊的行标记字体颜色 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnHeaderRowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) { GridView vw = (sender as GridView); try { AsnHeaderEntity header = vw.GetRow(e.RowHandle) as AsnHeaderEntity; if (header != null) { if (header.RowBackgroundColor != null) { e.Appearance.ForeColor = Color.FromArgb(header.RowBackgroundColor.Value); } } } catch (Exception ex) { } }
private bool Save() { if (!IsFieldValueValid()) { return(false); } bool success = false; try { string status = asnDal.GetStatus(asnHeaderEntity.BillID); if (status != SysCodeConstant.ASN_STATUS_AWAIT_CHECK) { MsgBox.Warn("该单据的状态已发生变化,只有等待验收状态的单据才能制定入库策略,请稍后重试。"); return(false); } AsnHeaderEntity editEntity = prepareSave(); int ret = asnDal.AsnUpdate(editEntity, GlobeSettings.LoginedUser.UserCode); if (ret == -2) { MsgBox.Warn("更新失败。"); } else { success = true; if (dataSourceChanged != null) { dataSourceChanged(editEntity, null); } } } catch (Exception ex) { MsgBox.Warn(ex.Message); } return(success); }
/// <summary> /// 从列表中移除 /// </summary> /// <param name="header"></param> public void RemoveBill(AsnHeaderEntity header) { bindingSource1.Remove(header); }