private void InitData() { Hashtable ht = DataFactory.SqlDataBase().GetHashtableById("MMS_MaterialInfo", "Material_ID", this._key); if (string.IsNullOrEmpty(this._key)) { ht["Material_Code"] = BatchEvaluate.GeneralCode(); } if (ht.Count > 0 && ht != null) { ControlBindHelper.SetWebControls(this.Page, ht); } foreach (DictionaryEntry element in ht) { string name = (string)element.Key; if (name == "MATERIAL_TYPE") { this._Material_Type = (string)element.Value.ToString().Trim(); } if (name == "DELETEMARK") { this._Status = (string)element.Value.ToString().Trim(); } } }
private void ClearTextBox() { txtPurchasePlanBillCode.Text = BatchEvaluate.GeneralCode(); //入库单号 txtPurchasePlanDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //入库日期 txtDeptName.Text = ""; lblOperator.Text = RequestSession.GetSessionUser().UserName.ToString();; //领料人员 }
public bool UpdateInfo(Base_DictionaryInfo info) { var query = from item in dc.Base_DictionaryInfo where item.DictionaryInfo_ID == info.DictionaryInfo_ID select item; BatchEvaluate.Eval(info, query.First()); dc.SubmitChanges(); return(true); }
private void ClearTextBox() { txtInvoiceCode.Text = ""; //发票号 txtPurchaseBillCode.Text = BatchEvaluate.GeneralCode(); //入库单号 txtPurchaseDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //入库日期 txtProviderName.Text = ""; //供应商 hidProvider.Value = ""; hidProviderName.Value = ""; // txtPurchaseManName.Text = ""; //经办人 hidPurchaseMan.Value = ""; hidPurchaseManName.Value = ""; lblStorageUser.Text = RequestSession.GetSessionUser().UserAccount.ToString(); lblTotalAmount.Text = ""; lblTotalQuantity.Text = ""; id = string.Empty; }
/// <summary> /// 自动生成采购计划 /// </summary> /// <param name="oprCode"> </param> /// <returns> </returns> public TPurchasePlan GeneralPurchasePlan(string oprCode) { TPurchasePlan tplan = new TPurchasePlan(); //创建采购计划单 //设置采购计划主信息操作类型为插入以在调用数据访问层做添加处理 tplan.OprType = OperateType.otInsert; tplan.Content = new MMS_PurchasePlanContent(); //创建采购计划单主信息 //生成采购计划单号 tplan.Content.PurchaseBillCode = BatchEvaluate.GeneralCode(); tplan.Content.PurchaseDate = DateTime.Now; //设置采购日期 tplan.Content.Provider = ""; //采购供应商 tplan.Content.PurchaseMan = ""; //采购经办人 tplan.Content.AuditFlag = false; //采购计划确认标志 //取允许采购的货品信息列表 List <MMS_ProductInfo> productList = ProductInfoService.Instance.GetAllInfo().Where(itm => itm.IsStop == null || itm.IsStop == false).ToList(); //取所有库存信息列表 List <MMS_Store> storeList = StoreService.Instance.GetAllInfo(); //用LINQ将库存信息按货品代码进行分组汇总 var query = from store in storeList group store by store.ProductCode into g orderby g.Key select new { ProductCode = g.Key, Quantity = g.Sum(itm => itm.Quantity) }; //循环遍历货品信息列表 foreach (var product in productList) { int qty = 0; if (query.Count() != 0) //取该货品的库存汇总数量 { var store = query.FirstOrDefault(itm => itm.ProductCode == product.ProductCode); if (store != null) { qty = store.Quantity; } } if (qty < product.MinStore) //如果该货品的库存汇总数量小于最低库存 { //创建采购计划货品实例 TPurchasePlanDetail tDetail = new TPurchasePlanDetail(); //设置为插入操作以便数据访问层处理 tDetail.OprType = OperateType.otInsert; tDetail.DetDetail = new MMS_PurchasePlanDetail(); tDetail.DetDetail.PurchaseBillCode = tplan.Content.PurchaseBillCode; //计划单号 tDetail.DetDetail.ProductCode = product.ProductCode; //货品代码 tDetail.DetDetail.Quantity = (product.MinStore ?? 0) - qty; //货品数量 //调用入库单服务类的GetLastPurchasePrice方法取货品单价 tDetail.DetDetail.Price = daoPur.GetLastPurchasePrice(tplan.Content.Provider, product.ProductCode); tDetail.DetDetail.Memo = ""; //注备 tplan.Detail.Add(tDetail); //将采购计划货品实体添加到采购计划单中 } } int cnt = dao.SavePurchasePlan(tplan); //调用数据访问层的保存采购计划单方法 tplan.Content.ID = cnt; //返回新生成计划单的主键值 return(tplan); }