| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.IO; |
| | | using System.Security.Cryptography; |
| | | using System.Threading.Tasks; |
| | | using System.Web.UI; |
| | |
| | | }; |
| | | frm.ShowDialog(); |
| | | }; |
| | | #region 2025-11-04 复制beg |
| | | btnCopyXls.Click += (s, e) => |
| | | { |
| | | string kcZz = txt_erpSczz.GetId(); |
| | | if (string.IsNullOrEmpty(kcZz)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择生产组织后才能使用复制功能!"); |
| | | txt_erpSczz.Focus(); |
| | | return; |
| | | } |
| | | string filePath = AppContext.BaseDirectory + "xlsCopy.xls"; |
| | | if (File.Exists(filePath)) |
| | | { |
| | | var frm = new CopyXls(kcZz, lbGuid.Text.Trim(), OrderType.批量排产.ToString()); |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | try |
| | | { |
| | | var lst = ee.DynamicList; |
| | | DataTable _Table = (DataTable)gcMx1.DataSource; |
| | | |
| | | // 记录开始的行索引 |
| | | int startIndex = _Table.Rows.Count; |
| | | |
| | | foreach (dynamic dym in lst) |
| | | { |
| | | DataRow _row = _Table.NewRow(); |
| | | _row["caaGuid"] = dym.caaid; |
| | | _row["daa021"] = dym.workno; |
| | | _row["itemNo"] = dym.itemNo; |
| | | _row["daa003"] = dym.itemName; |
| | | _row["daa004"] = dym.itemModel; |
| | | _row["daa025"] = dym.sclx; |
| | | _row["mesStartProd"] = dym.yjkg; |
| | | _row["mesEndProd"] = dym.yjwg; |
| | | _row["caa012"] = dym.Workqty; |
| | | _row["fname"] = dym.unit_name; |
| | | _row["yp"] = dym.yp; |
| | | _row["wp"] = dym.wp; |
| | | _row["daa008"] = dym.pc_qty; |
| | | _row["daa015LineName"] = dym.line_no; |
| | | _row["daa014"] = dym.pbill_no; |
| | | _row["caa015"] = dym.SALE_ORDER_NO; |
| | | _row["daa015"] = dym.lineid; |
| | | |
| | | _Table.Rows.Add(_row); |
| | | } |
| | | |
| | | |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = _Table; |
| | | gcMx1.ForceInitialize(); |
| | | |
| | | // 使用正确的行索引设置单元格值 |
| | | for (int i = 0; i < lst.Count; i++) |
| | | { |
| | | dynamic dym = lst[i]; |
| | | int rowHandle = gvMx1.GetRowHandle(startIndex + i); |
| | | |
| | | gvMx1.SetRowCellValue(rowHandle, "daa015LineName", dym.line_no); |
| | | gvMx1.SetRowCellValue(rowHandle, "daa015", dym.lineid); |
| | | } |
| | | |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.PostEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | gvMx1.BestFitColumns(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); |
| | | } |
| | | }; |
| | | frm.ShowDialog(); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("找不到xlsCopy.xls文件,请联系管理员!"); |
| | | } |
| | | }; |
| | | #endregion |
| | | } |
| | | private void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |