protected void btSave_Click(object sender, EventArgs e) { List <GoodPackingForm> list = LAF.Common.Serialization.JsonConvertHelper.DeserializeObject <List <GoodPackingForm> >(this.hiMatList.Value); foreach (GoodPackingForm item in list) { item.PID = Guid.NewGuid().ToString(); item.GoodBarCode = this.GoodBarCode.Text; } if (list.Count == 0) { ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('请添加信息');", true); return; } GoodPackingBLL bll = BLLFactory.CreateBLL <GoodPackingBLL>(); bll.Packing(list); ClientScript.RegisterStartupScript(this.GetType(), "myjs", "alert('操作成功');window.location.href='MaterialPacking.aspx';", true); }
private void BindData() { string batchNumber = "2017111401"; string barCode = Request.QueryString["BarCode"]; TraceGood good = null; batchNumber = new GoodPackingBLL().GetBatchNumberByBarCode(barCode); if (string.IsNullOrEmpty(batchNumber) == true) { this.ProduceName.Text = "追溯码无效"; return; } //绑定产品基本信息 good = new QualityTraceQueryBLL().GetTraceGoodByBN(batchNumber); if (good == null) { this.ProduceName.Text = "追溯码无效"; return; } this.ProduceName.Text = good.ProductName; this.SPECIFICATION.Text = good.SPECIFICATION; this.ProductionAddress.Text = good.ProductionAddress; this.Manufacturer.Text = good.Manufacturer; this.QualityPeriod.Text = good.QualityPeriod; this.ProduceDate.Text = good.ProduceDate.ToString("yyyy年MM月dd日"); this.ProduceBatchNumber.Text = good.BatchNumber; this.ProductionLicense.Text = good.ProductionLicense; this.ProductStandard.Text = good.ProductStandard; //绑定物料组成信息 List <TraceMaterial> materialList = new QualityTraceQueryBLL().GetTraceMaterial(new TraceGood { BatchNumber = good.BatchNumber }); materialList = materialList.GroupBy(x => new { x.MatName, x.ProductPlace }).Select(g => new TraceMaterial { MatName = g.Key.MatName, ProductPlace = g.Key.ProductPlace }) .ToList(); int seq1 = 1; foreach (TraceMaterial tm in materialList) { this.lblMaterials.Text += string.Format("<tr><td align=center>{0}</td><td align=center>{1}</td><td align=center><a href=\"#\">{2}</a></td></tr>", seq1.ToString(), tm.MatName, tm.ProductPlace); seq1++; } //绑定加工工序信息 List <TraceProcess> processList = new QualityTraceQueryBLL().GetTraceProcess(new TraceGood { BatchNumber = good.BatchNumber }); int seq2 = 1; foreach (TraceProcess tp in processList) { this.tblProcess.Text += string.Format("<tr><td align=center>{0}</td><td align=center>{1}</td><td align=center>{2}</td></tr>", seq2.ToString(), tp.ProcessName, tp.EquName); seq2++; } }