public static void ReadJk(ArchiveOperationForm masterForm) { IControlManager masterCm = masterForm.ControlManager; if (masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue == null) { ServiceProvider.GetService<IMessageBox>().ShowWarning("请输入提单号!"); return; } string tdh = masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue.ToString().Trim(); #region 从"npedi进口卸箱查询"获取箱信息 IList<进口卸箱查询结果> boxList = m_npediGrab.进口卸箱查询(tdh); if (boxList.Count <= 0) { return; } AskToReplace(masterCm, "船名航次", boxList[0].船名航次); AskToReplace(masterCm, "卸箱地编号", NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", boxList[0].码头)); AskToReplace(masterCm, "到港时间", boxList[0].卸船时间); AskToReplace(masterCm, "提单号", boxList[0].提单号); AskToReplace(masterCm, "箱量", boxList.Count); IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager; int? xxbh = null; string pm = null; foreach (进口卸箱查询结果 data in boxList) { bool have = false; foreach (Xceed.Grid.DataRow row in ((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0].DataRows) { if (row.Cells["箱型编号"].Value != null) { xxbh = (int)row.Cells["箱型编号"].Value; } if (row.Cells["品名"].Value != null) { pm = row.Cells["品名"].Value.ToString(); } if (row.Cells["箱号"].Value != null && row.Cells["箱号"].Value.ToString().Trim() == data.集装箱号.Trim()) { have = true; break; } } if (!have) { if (xxbh == null) { xxbh = Convert.ToInt32(NameValueMappingCollection.Instance.FindIdFromName("备案_箱型_全部", boxList[0].尺寸类型)); } 进口箱 newItem = new 进口箱 { 箱号 = data.集装箱号, 箱型编号 = xxbh, 重量 = Convert.ToInt32(data.箱毛重), 品名 = pm }; detailCm.AddNew(); detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = newItem; detailCm.EndEdit(); } } #endregion #region 从"nbeport集装箱进场信息"获取箱信息 //m_nbeportGrab.SetLoginInfo(SystemDirectory.DefaultUserProfile.GetValue("Hd.Options", "NetReadUserName", ""), // SystemDirectory.DefaultUserProfile.GetValue("Hd.Options", "NetReadPassword", "")); //IList<集装箱数据> boxList = m_nbeportGrab.查询集装箱数据(ImportExportType.进口集装箱, tdh); //if (boxList.Count <= 0) //{ // return; //} //AskToReplace(masterCm, "船名航次", boxList[0].船舶英文名称 + "/" + boxList[0].航次); //AskToReplace(masterCm, "卸箱地编号", NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", boxList[0].堆场区)); //AskToReplace(masterCm, "到港时间", boxList[0].进场时间); //AskToReplace(masterCm, "提单号", boxList[0].提单号); //AskToReplace(masterCm, "箱量", boxList.Count); //IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager; //int? xxbh = null; //string pm = null; //foreach (集装箱数据 data in boxList) //{ // bool have = false; // foreach (Xceed.Grid.DataRow row in ((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0].DataRows) // { // if (row.Cells["箱型编号"].Value != null) // { // xxbh = (int)row.Cells["箱型编号"].Value; // } // if (row.Cells["品名"].Value != null) // { // pm = row.Cells["品名"].Value.ToString(); // } // if (row.Cells["箱号"].Value != null && row.Cells["箱号"].Value.ToString().Trim() == data.集装箱号.Trim()) // { // have = true; // break; // } // } // if (!have) // { // //进口箱 newItem = new 进口箱 { 箱号 = data.集装箱号, 箱型 = ConvertHelper.ChangeType(data.箱型, typeof(箱型)) as 箱型 }; // 进口箱 newItem = new 进口箱 { 箱号 = data.集装箱号, 箱型编号 = xxbh, 品名 = pm }; // detailCm.AddNew(); // detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = newItem; // detailCm.EndEdit(); // } //} #endregion }
public static void ReadJk(ArchiveOperationForm masterForm) { IControlManager masterCm = masterForm.ControlManager; if (masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue == null) { ServiceProvider.GetService <IMessageBox>().ShowWarning("请输入提单号!"); return; } string tdh = masterCm.DisplayManager.DataControls["提单号"].SelectedDataValue.ToString().Trim(); #region 从"npedi进口卸箱查询"获取箱信息 IList <进口卸箱查询结果> boxList = m_npediGrab.进口卸箱查询(tdh); if (boxList.Count <= 0) { return; } AskToReplace(masterCm, "船名航次", boxList[0].船名航次); AskToReplace(masterCm, "卸箱地编号", NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", boxList[0].码头)); AskToReplace(masterCm, "到港时间", boxList[0].卸船时间); AskToReplace(masterCm, "提单号", boxList[0].提单号); AskToReplace(masterCm, "箱量", boxList.Count); IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager; int? xxbh = null; string pm = null; foreach (进口卸箱查询结果 data in boxList) { bool have = false; foreach (Xceed.Grid.DataRow row in ((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0].DataRows) { if (row.Cells["箱型编号"].Value != null) { xxbh = (int)row.Cells["箱型编号"].Value; } if (row.Cells["品名"].Value != null) { pm = row.Cells["品名"].Value.ToString(); } if (row.Cells["箱号"].Value != null && row.Cells["箱号"].Value.ToString().Trim() == data.集装箱号.Trim()) { have = true; break; } } if (!have) { if (xxbh == null) { xxbh = Convert.ToInt32(NameValueMappingCollection.Instance.FindIdFromName("备案_箱型_全部", boxList[0].尺寸类型)); } 进口箱 newItem = new 进口箱 { 箱号 = data.集装箱号, 箱型编号 = xxbh, 重量 = Convert.ToInt32(data.箱毛重), 品名 = pm }; detailCm.AddNew(); detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = newItem; detailCm.EndEdit(); } } #endregion #region 从"nbeport集装箱进场信息"获取箱信息 //m_nbeportGrab.SetLoginInfo(SystemDirectory.DefaultUserProfile.GetValue("Hd.Options", "NetReadUserName", ""), // SystemDirectory.DefaultUserProfile.GetValue("Hd.Options", "NetReadPassword", "")); //IList<集装箱数据> boxList = m_nbeportGrab.查询集装箱数据(ImportExportType.进口集装箱, tdh); //if (boxList.Count <= 0) //{ // return; //} //AskToReplace(masterCm, "船名航次", boxList[0].船舶英文名称 + "/" + boxList[0].航次); //AskToReplace(masterCm, "卸箱地编号", NameValueMappingCollection.Instance.FindColumn2FromColumn1("人员单位_港区堆场", "全称", "编号", boxList[0].堆场区)); //AskToReplace(masterCm, "到港时间", boxList[0].进场时间); //AskToReplace(masterCm, "提单号", boxList[0].提单号); //AskToReplace(masterCm, "箱量", boxList.Count); //IControlManager detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager; //int? xxbh = null; //string pm = null; //foreach (集装箱数据 data in boxList) //{ // bool have = false; // foreach (Xceed.Grid.DataRow row in ((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0].DataRows) // { // if (row.Cells["箱型编号"].Value != null) // { // xxbh = (int)row.Cells["箱型编号"].Value; // } // if (row.Cells["品名"].Value != null) // { // pm = row.Cells["品名"].Value.ToString(); // } // if (row.Cells["箱号"].Value != null && row.Cells["箱号"].Value.ToString().Trim() == data.集装箱号.Trim()) // { // have = true; // break; // } // } // if (!have) // { // //进口箱 newItem = new 进口箱 { 箱号 = data.集装箱号, 箱型 = ConvertHelper.ChangeType(data.箱型, typeof(箱型)) as 箱型 }; // 进口箱 newItem = new 进口箱 { 箱号 = data.集装箱号, 箱型编号 = xxbh, 品名 = pm }; // detailCm.AddNew(); // detailCm.DisplayManager.Items[detailCm.DisplayManager.Position] = newItem; // detailCm.EndEdit(); // } //} #endregion }