| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | |
| | | { |
| | | public partial class Frm_Womdaahb : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string _webServiceName = "WompbaManager/"; |
| | | string _webServiceName = "WomdaahbManager/"; |
| | | List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | string _cjBm = "";//车间 |
| | | public Frm_Womdaahb() |
| | |
| | | { |
| | | if (string.IsNullOrEmpty(this.txt_daahb013.GetId())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择车间,才能选择任务单!"); |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择车间,才能选择生产工单!"); |
| | | return; |
| | | } |
| | | var frm = new SelectWompba(this.txt_daahb013.GetId()); |
| | | var frm = new SelectWomdaa(this.txt_daahb013.GetId(),this.txt_daahb015.GetId()); |
| | | //赋值给明细表 |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | |
| | | lst = ee.StringList; |
| | | var _obj = lst; |
| | | var strReturn = UtilityHelper.HttpPost("", |
| | | "WompbaManager/SelectPbaToView", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | "WomdaaManager/SelectDaaToView", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var dt = UtilityHelper.ReturnToList(strReturn); |
| | | DataTable _newTable = dt.rtnData; |
| | | DataTable _oldTable = (DataTable)gcMx1.DataSource; |
| | | DataRow[] sourceRows = _newTable.Select(); |
| | | DataRow[] sourceRowsOld = _oldTable.Select(); |
| | | // 获取当前最大的scheduleOrder值(更安全的做法) |
| | | int maxOrder = 0; |
| | | if (sourceRowsOld.Length > 0) |
| | | { |
| | | maxOrder = sourceRowsOld.Max(row => |
| | | row.Table.Columns.Contains("scheduleOrder") ? Convert.ToInt32(row["scheduleOrder"]) : 0); |
| | | } |
| | | |
| | | for (int i = 0; i < sourceRows.Length; i++) |
| | | { |
| | | // 确保目标表也有这个列 |
| | | if (sourceRows[i].Table.Columns.Contains("scheduleOrder") && |
| | | _oldTable.Columns.Contains("scheduleOrder")) |
| | | { |
| | | // 使用maxOrder作为基准,而不是sourceRowsOld.Length |
| | | sourceRows[i]["scheduleOrder"] = maxOrder + 1 + i; |
| | | } |
| | | _oldTable.ImportRow(sourceRows[i]); |
| | | } |
| | | gcMx1.BindingContext = new BindingContext(); |
| | |
| | | { |
| | | string rowGuid = "", rowName = ""; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_daahb001, gridView1, "hNo"); |
| | | lbGuid, txt_daahb001, gridView1, "daahb001"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | string workId = txt_daahb013.GetId(); |
| | | string lineId = txt_daahb015.GetId(); |
| | | if (string.IsNullOrEmpty(workId.Trim())) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择车间!"); |
| | |
| | | guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建 |
| | | bz = txt_daahb009.Text.Trim(), |
| | | cjId = workId, |
| | | xtId = lineId, |
| | | list = new List<dynamic>(), |
| | | }; |
| | | gvMx1.CloseEditor(); |
| | |
| | | { |
| | | Guid? _guid = UtilityHelper.ToGuid(row["guid"].ToString()); |
| | | string _LineId = row["daa015"].ToString(); |
| | | if (string.IsNullOrEmpty(_LineId)) |
| | | { |
| | | MsgHelper.ShowError("线别不能为空!"); |
| | | return; |
| | | } |
| | | if (Gs.DevApp.ToolBox.UtilityHelper.ToDecimal(row["daa008"].ToString()) <= 0) |
| | | { |
| | | MsgHelper.ShowError("请输入正确的排产数量!"); |
| | | return; |
| | | } |
| | | string _Yjkgsj = row["mesStartProd"].ToString(); |
| | | if (string.IsNullOrEmpty(_Yjkgsj)) |
| | | { |
| | | MsgHelper.ShowError("预计开工时间不能为空!"); |
| | | return; |
| | | } |
| | | //string _prepareTime = row["prepareTime"].ToString(); |
| | | //if (string.IsNullOrEmpty(_prepareTime)) |
| | | //{ |
| | | // MsgHelper.ShowError("预计备料时间不能为空!"); |
| | | // return; |
| | | //} |
| | | //string _planPersonnel = row["planPersonnel"].ToString(); |
| | | //if (string.IsNullOrEmpty(_planPersonnel)) |
| | | //{ |
| | | // MsgHelper.ShowError("计划人数!"); |
| | | // return; |
| | | //} |
| | | //string _changeLinetime = row["changeLinetime"].ToString(); |
| | | //if (string.IsNullOrEmpty(_changeLinetime)) |
| | | //{ |
| | | // MsgHelper.ShowError("换线时间不能为空!"); |
| | | // return; |
| | | //} |
| | | string _mesEndProd = row["mesEndProd"].ToString(); |
| | | if (string.IsNullOrEmpty(_mesEndProd)) |
| | | { |
| | | MsgHelper.ShowError("预计完工时间不能为空!"); |
| | | return; |
| | | } |
| | | //string _restTime = row["restTime"].ToString(); |
| | | //if (string.IsNullOrEmpty(_prepareTime)) |
| | | //{ |
| | | // MsgHelper.ShowError("休息时间不能为空!"); |
| | | // return; |
| | | //} |
| | | _obj.list.Add(new |
| | | { |
| | | Guid = _guid, |
| | | AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["caaGuid"].ToString()), |
| | | Rwdh = row["daa021"].ToString(),//任务单号 |
| | | Xh = row["scheduleOrder"].ToString(),//序号 |
| | | Xsdh = row["caa015"].ToString(),//销售单号 |
| | | Cpbm = row["itemNo"].ToString(), |
| | | Cpmc = row["daa003"].ToString(), |
| | | Cpgg = row["daa004"].ToString(), |
| | | Gdsl = row["daa008"].ToString(),//工单数量 |
| | | LineId = row["daa015"].ToString(),//产线id |
| | | Yjkgsj = (row["mesStartProd"].ToString()),//预计开工时间 |
| | | Jhrs = row["planPersonnel"].ToString(),//计划人数 |
| | | Hxsj = row["changeLinetime"].ToString(),//换线时间 |
| | | Bz = row["daa009"].ToString(),//备注 |
| | | Blsj = row["prepareTime"].ToString(),//预计备料时间 |
| | | Pcsl = row["daa008"].ToString(),//排产数量 |
| | | Yjwgsj = row["mesEndProd"].ToString()//预计完工时间 |
| | | }); |
| | | } |
| | |
| | | lbGuid.Text = strGuid; |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | gvList.Add(gvMx2); |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); |
| | | _cjBm = ""; |
| | | JObject _job = JObject.Parse(strJson); |
| | |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | JObject _job2 = JObject.Parse(strJson); |
| | | JArray array2 = new JArray(); |
| | | foreach (var a2 in _job2["rtnData"]["list2"]) |
| | | { |
| | | array2.Add(a2); |
| | | } |
| | | DataTable dt2 = JsonConvert.DeserializeObject<DataTable>(array2.ToString()); |
| | | if (dt2.Rows.Count > 0) |
| | | { |
| | | gcMx2.BindingContext = new BindingContext(); |
| | | gcMx2.DataSource = dt2; |
| | | gcMx2.ForceInitialize(); |
| | | gvMx2.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx2); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2); |
| | | } |
| | | } |
| | | else |
| | |
| | | }; |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_daahb001, gridView1, "hNo"); |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_daahb001, gridView1, "daahb001"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |