public bool DeleteDispatchDetail(DispatchDetail dispatchDetail) { if (dispatchDetail == null) return false; _unitOfWork.DispatchDetailRepository.Delete(dispatchDetail); _unitOfWork.Save(); return true; }
private void btnDelete_Click(object sender, EventArgs e) { try { if (dl.OperateDetails.Count < 1) { MessageBox.Show("没有操作的数据!"); return; } if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { int rindex = dataGrid1.CurrentRowIndex; decimal sub = dl.OperateDetails[rindex].inewquantity; string cinvcode = dl.OperateDetails[rindex].cinvcode; dataGrid1.DataSource = null; dl.OperateDetails.RemoveAt(rindex);//删除操作数据 dataGrid1.DataSource = dl.OperateDetails; /// TODO:批次与货位 DispatchDetail dd = dl.U8Details.Find(delegate(DispatchDetail tdd) { return(tdd.cinvcode.Equals(cinvcode)); }); dd.inewquantity -= sub; } } catch (Exception er) { MessageBox.Show(er.Message); } }
public bool DeleteDispatchDetail(DispatchDetail dispatchDetail) { if (dispatchDetail == null) { return(false); } _unitOfWork.DispatchDetailRepository.Delete(dispatchDetail); _unitOfWork.Save(); return(true); }
private static DispatchDetailModel GenerateReceiveDetailModel(DispatchDetail dispatchDetail) { DispatchDetailModel model = new DispatchDetailModel(); model.Id = dispatchDetail.DispatchDetailID; model.DispatchID = dispatchDetail.DispatchID; model.CommodityID = dispatchDetail.CommodityID; model.Description = dispatchDetail.Description; model.Unit = dispatchDetail.UnitID; model.RequestedQuantity = dispatchDetail.RequestedQunatityInUnit; model.RequestedQuantityMT = dispatchDetail.RequestedQuantityInMT; model.DispatchedQuantity = dispatchDetail.DispatchedQuantityInUnit; model.DispatchedQuantityMT = dispatchDetail.DispatchedQuantityInMT; return(model); }
/// <summary> /// 验证销售订单号 /// </summary> /// <param name="csocode">销售订单号</param> /// <param name="csocode_id">id号</param> /// <param name="errMsg"></param> /// <returns></returns> public static bool VerifySO_SO(string csocode, out Model.DispatchList dispatchlist, out string errMsg) { Common co = Common.GetInstance(); errMsg = ""; dispatchlist = null; DataSet list = null; co.Service.VerifySO_SO(csocode, Common.CurrentUser.ConnectionString, out list, out errMsg); if (errMsg != "") { throw new Exception(errMsg); } else { if (list.Tables[0] != null && list.Tables[0].Rows.Count > 0) { dispatchlist = new Model.DispatchList(list); dispatchlist.U8Details = new List <Model.DispatchDetail>(); dispatchlist.OperateDetails = new List <Model.DispatchDetail>(); DataSet ds = null; int int_ds = GetSO_SODetails(dispatchlist.csoid, out ds, out errMsg); if (errMsg != "" && int_ds != 0) { throw new Exception(errMsg); return(false); } DispatchDetail dd = null; foreach (DataRow dr in ds.Tables[0].Rows) { dd = new DispatchDetail(dr); dd.ccusname = dispatchlist.ccusname; //客户名称 dd.ccusabbname = dispatchlist.ccusabbname; //客户简称 dispatchlist.U8Details.Add(dd); } return(true); } else { errMsg = "验证销售订单号出错"; return(false); } } }
/// <summary> /// 批号,仓库,存货编码 获取生产日期失败日期信息等 /// </summary> /// <param name="dd"></param> /// <param name="cWhCode"></param> /// <param name="cInvCode"></param> /// <param name="cBatch"></param> public void GetSTOutInvBatch(DispatchDetail dd, string cWhCode, string cInvCode, string cBatch) { DataSet ds_batch = null; string errMsg = string.Empty; if (Common.getSTOutInvBatch(cWhCode, cInvCode, cBatch, out ds_batch, out errMsg) == 0) { try { //生产日期 dd.dmdate = Convert.ToDateTime(ds_batch.Tables[0].Rows[0]["dMDate"]); lblProDate.Text = dd.dmdate.ToString("yyyy-MM-dd"); //失效日期 dd.dvdate = Convert.ToDateTime(ds_batch.Tables[0].Rows[0]["dvdate"]); //有效期至为失效日期-1 lblValidDate.Text = dd.dvdate.AddDays(-1).ToString("yyyy-MM-dd"); dd.cmassunit = Convert.ToInt32(ds_batch.Tables[0].Rows[0]["cmassunit"]); dd.dexpirationdate = ds_batch.Tables[0].Rows[0]["dexpirationdate"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(ds_batch.Tables[0].Rows[0]["dexpirationdate"]); dd.cexpirationdate = ds_batch.Tables[0].Rows[0]["cexpirationdate"] == DBNull.Value ? DateTime.Now : Convert.ToDateTime(ds_batch.Tables[0].Rows[0]["cexpirationdate"]); favailqtty = Convert.ToDecimal(ds_batch.Tables[0].Rows[0]["fAvailQtty"]); txtCount.SelectAll(); txtCount.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("批号错误:" + errMsg); } }
public bool EditDispatchDetail(DispatchDetail dispatchDetail) { _unitOfWork.DispatchDetailRepository.Edit(dispatchDetail); _unitOfWork.Save(); return(true); }
public bool EditDispatchDetail(DispatchDetail dispatchDetail) { _unitOfWork.DispatchDetailRepository.Edit(dispatchDetail); _unitOfWork.Save(); return true; }