锐腾搅拌上料功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

960 lines
46 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Windows.Forms;
  5. using DevExpress.XtraEditors;
  6. using ICSSoft.Base.Config.AppConfig;
  7. using ICSSoft.Base.Config.DBHelper;
  8. using ICSSoft.Base.ReferForm.AppReferForm;
  9. using ICSSoft.Frame.Data.Entity;
  10. using ICSSoft.Frame.Data.BLL;
  11. namespace ICSSoft.Frame.APP
  12. {
  13. public partial class FormICSMROPickingEditAdd : DevExpress.XtraEditors.XtraForm
  14. {
  15. private DataTable data;
  16. //DataTable body;
  17. string VRow = "";
  18. String guid = "";
  19. FormICSPickingModel entity = new FormICSPickingModel();
  20. public string Sys = "";
  21. #region 构造函数
  22. public FormICSMROPickingEditAdd()
  23. {
  24. InitializeComponent();
  25. }
  26. public FormICSMROPickingEditAdd(String id)
  27. {
  28. InitializeComponent();
  29. guid = id;
  30. }
  31. #endregion
  32. #region 关闭 退出
  33. private void btnClose_Click(object sender, EventArgs e)
  34. {
  35. this.Close();
  36. }
  37. #endregion
  38. #region 移动窗体
  39. private const int WM_NCHITTEST = 0x84;
  40. private const int HTCLIENT = 0x1;
  41. private const int HTCAPTION = 0x2;
  42. //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
  43. //系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
  44. //假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
  45. //同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
  46. //重写窗体,使窗体可以不通过自带标题栏实现移动
  47. protected override void WndProc(ref Message m)
  48. {
  49. //当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
  50. //当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
  51. //这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
  52. //注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
  53. switch (m.Msg)
  54. {
  55. case WM_NCHITTEST:
  56. base.WndProc(ref m);
  57. if ((int)m.Result == HTCLIENT)
  58. m.Result = (IntPtr)HTCAPTION;
  59. return;
  60. }
  61. //拦截双击标题栏、移动窗体的系统消息
  62. if (m.Msg != 0xA3)
  63. {
  64. base.WndProc(ref m);
  65. }
  66. }
  67. #endregion
  68. #region 新增 修改
  69. private void save_Click(object sender, EventArgs e)
  70. {
  71. //if (txtPickingNO.Text.Trim() == "" || txtWHCode.Text.Trim() == "" || txtCode.Text.Trim() == "" || txtiQuantity.Text.Trim() == "" )
  72. //{
  73. // ICSBaseSimpleCode.AppshowMessageBox("请添加一行内容!");
  74. // return;
  75. //}
  76. if (txtPickingNO.Text.Trim() == "" || txtWHCode.Text.Trim() == "" || txtOutCategory.Text.Trim() == "")
  77. {
  78. ICSBaseSimpleCode.AppshowMessageBox("请输入退料单号、仓库、出库类别内容!");
  79. return;
  80. }
  81. for (int i = 0; i < grdDetail.RowCount; i++)
  82. {
  83. string PickingNO = string.Empty;
  84. PickingNO = grdDetail.GetRowCellValue(i, colPickingNO).ToString();
  85. if (string.IsNullOrWhiteSpace(PickingNO))
  86. {
  87. ICSBaseSimpleCode.AppshowMessageBox("请添加字表行信息!");
  88. return;
  89. }
  90. }
  91. entity.ID = guid;
  92. entity.VouchCode = txtPickingNO.Text.Trim();
  93. entity.MUSER = AppConfig.UserCode;
  94. entity.MUSERName = AppConfig.UserName;
  95. entity.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  96. entity.WorkPoint = AppConfig.WorkPointCode;
  97. entity.EATTRIBUTE1 = null;
  98. entity.CreateTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  99. entity.CreateUSER = AppConfig.UserName;
  100. entity.IsPickingOrBack = 1;
  101. entity.PickingSTATUS = "新建";
  102. try
  103. {
  104. guid = ICSPickingBLL.Add(entity, AppConfig.AppConnectString);
  105. this.Close();
  106. ICSBaseSimpleCode.AppshowMessageBox("操作成功");
  107. }
  108. catch (Exception ex)
  109. {
  110. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  111. }
  112. }
  113. #endregion
  114. #region 取消
  115. //private void can_Click(object sender, EventArgs e)
  116. //{
  117. // this.Close();
  118. //}
  119. #endregion
  120. #region 页面加载
  121. private void FormICSINVENTORYEditAdd_Load(object sender, EventArgs e)
  122. {
  123. Sys = GetSys();
  124. if (Sys == "")
  125. {
  126. ICSBaseSimpleCode.AppshowMessageBox("连接数据库不正确!");
  127. return;
  128. }
  129. if (guid != "")
  130. {
  131. lblTitle.Text = "MRO领料单维护";
  132. txtPickingNO.Properties.ReadOnly = true;
  133. txtWHCode.Properties.ReadOnly = true;
  134. entity = ICSPickingBLL.SearchInfoByID(guid, AppConfig.AppConnectString);
  135. txtPickingNO.Text = entity.VouchCode;
  136. txtWHCode.Text = entity.WHCode;
  137. //20190705ZM
  138. txtDept.Text = entity.Dept;
  139. txtCREWCODE.Text = entity.VENDORCODE;
  140. this.txtOutCategory.Text = entity.OutCategory;
  141. this.txtMEMO.Text = entity.MEMO;
  142. //txtRDCode.Text = entity.RDCode;
  143. txtMUSERName.Text = AppConfig.UserName;
  144. txtMTIME.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  145. DataTable body = ICSPickingBLL.GetDetailList(entity.VouchCode);
  146. grvDetail.DataSource = body;
  147. grdDetail.BestFitColumns();
  148. }
  149. else
  150. {
  151. lblTitle.Text = "MRO领料单修改";
  152. txtPickingNO.Properties.ReadOnly = true;
  153. txtDept.Text = entity.Dept;
  154. this.txtOutCategory.Text = entity.OutCategory;
  155. txtPickingNO.Text = ICSPickingBLL.GetOutInNo(AppConfig.AppConnectString);
  156. txtMUSERName.Text = AppConfig.UserName;
  157. txtMTIME.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  158. }
  159. init();
  160. }
  161. #endregion
  162. #region 初始化查询条件
  163. private void init()
  164. {
  165. #region
  166. string sql = "SELECT DISTINCT INVCODE AS [存货编码] ,INVNAME AS [存货名称] ,INVSTD AS [规格型号] FROM ICSINVENTORY WHERE WorkPoint='{0}' ORDER BY INVCODE ";
  167. sql = string.Format(sql, AppConfig.WorkPointCode);
  168. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  169. txtCode.Properties.ValueMember = "存货编码";
  170. txtCode.Properties.DisplayMember = "存货编码";
  171. txtCode.Properties.DataSource = dt;
  172. txtCode.Properties.NullText = "";//空时的值
  173. txtCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  174. txtCode.Properties.ValidateOnEnterKey = true;//回车确认
  175. txtCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  176. txtCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  177. //自适应宽度
  178. txtCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  179. #endregion
  180. #region 仓库
  181. string sql1 = "SELECT DISTINCT StorageCode AS [仓库编号] ,StorageName AS[仓库名称] FROM ICSStorage WHERE WorkPoint='{0}' ORDER BY StorageCode";
  182. sql1 = string.Format(sql1, AppConfig.WorkPointCode);
  183. DataTable dt1 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql1).Tables[0];
  184. txtWHCode.Properties.ValueMember = "仓库编号";
  185. txtWHCode.Properties.DisplayMember = "仓库编号";
  186. txtWHCode.Properties.DataSource = dt1;
  187. txtWHCode.Properties.NullText = "";//空时的值
  188. txtWHCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  189. txtWHCode.Properties.ValidateOnEnterKey = true;//回车确认
  190. txtWHCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  191. txtWHCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  192. //自适应宽度
  193. txtWHCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  194. #endregion
  195. #region 出库类型
  196. string sql2 = "SELECT DISTINCT cRdCode AS [出库类型编号],cRdName AS [出库类型名称] FROM ICSRdStyle WHERE WorkPoint = '{0}' AND bRdFlag=0 AND bRdEnd=1 AND cRdCode != '20201' ORDER BY cRdCode";
  197. sql2 = string.Format(sql2, AppConfig.WorkPointCode);
  198. DataTable dt2 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql2).Tables[0];
  199. txtOutCategory.Properties.ValueMember = "出库类型编号";
  200. txtOutCategory.Properties.DisplayMember = "出库类型编号";
  201. txtOutCategory.Properties.DataSource = dt2;
  202. txtOutCategory.Properties.NullText = "";//空时的值
  203. txtOutCategory.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  204. txtOutCategory.Properties.ValidateOnEnterKey = true;//回车确认
  205. txtOutCategory.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  206. txtOutCategory.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  207. //自适应宽度
  208. txtOutCategory.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  209. #endregion
  210. #region 部门
  211. string sql3 = "SELECT DISTINCT cDepCode AS [部门编号],cDepName AS [部门名称] FROM ICSDepartment WHERE WorkPoint = '{0}' AND bDepEnd = 1 ORDER BY cDepCode";
  212. sql3 = string.Format(sql3, AppConfig.WorkPointCode);
  213. DataTable dt3 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0];
  214. txtDept.Properties.ValueMember = "部门编号";
  215. txtDept.Properties.DisplayMember = "部门编号";
  216. txtDept.Properties.DataSource = dt3;
  217. txtDept.Properties.NullText = "";//空时的值
  218. txtDept.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  219. txtDept.Properties.ValidateOnEnterKey = true;//回车确认
  220. txtDept.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  221. txtDept.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  222. //自适应宽度
  223. txtDept.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  224. #endregion
  225. #region 班组
  226. string sql4 = "";
  227. if (Sys == "ICSMES_YTSys")
  228. {
  229. if (this.txtOutCategory.Text == "20301" && this.txtDept.Text == "0401")
  230. {
  231. sql4 = @"SELECT CREWCODE 班组编码, CREWDESC 班组名称 FROM ICSCREW
  232. WHERE 1=1 AND WorkPoint = '{0}' AND ISNULL(EATTRIBUTE3, '') = '' AND ISNULL(EATTRIBUTE1, '') = '01' ORDER BY CREWCODE ";
  233. }
  234. else if (this.txtOutCategory.Text == "20301" && this.txtDept.Text == "0301")
  235. {
  236. sql4 = @"SELECT CREWCODE 班组编码, CREWDESC 班组名称 FROM ICSCREW
  237. WHERE 1=1 AND WorkPoint = '{0}' AND ISNULL(EATTRIBUTE3, '') = '' AND ISNULL(EATTRIBUTE1, '') = '02' ORDER BY CREWCODE ";
  238. }
  239. else
  240. {
  241. sql4 = "SELECT CREWCODE 班组编码, CREWDESC 班组名称 FROM ICSCREW WHERE 1=1 AND WorkPoint = '{0}' AND ISNULL(EATTRIBUTE3, '') = '' ORDER BY CREWCODE ";
  242. }
  243. }
  244. else
  245. {
  246. if (this.txtOutCategory.Text == "20302" && this.txtDept.Text == "0301")
  247. {
  248. sql4 = @"SELECT CREWCODE 班组编码, CREWDESC 班组名称 FROM ICSCREW
  249. WHERE 1=1 AND WorkPoint = '{0}' AND ISNULL(EATTRIBUTE3, '') = '03' AND ISNULL(EATTRIBUTE1, '') = '03' ORDER BY CREWCODE ";
  250. }
  251. else
  252. {
  253. sql4 = "SELECT CREWCODE 班组编码, CREWDESC 班组名称 FROM ICSCREW WHERE 1=1 AND WorkPoint = '{0}' AND ISNULL(EATTRIBUTE3, '') = '03' ORDER BY CREWCODE ";
  254. }
  255. }
  256. sql4 = string.Format(sql4, AppConfig.WorkPointCode);
  257. DataTable dt4 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql4).Tables[0];
  258. txtCREWCODE.Properties.ValueMember = "班组名称";
  259. txtCREWCODE.Properties.DisplayMember = "班组名称";
  260. txtCREWCODE.Properties.DataSource = dt4;
  261. txtCREWCODE.Properties.NullText = "";//空时的值
  262. txtCREWCODE.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  263. txtCREWCODE.Properties.ValidateOnEnterKey = true;//回车确认
  264. txtCREWCODE.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  265. txtCREWCODE.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  266. //自适应宽度
  267. txtCREWCODE.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  268. #endregion
  269. }
  270. #endregion
  271. #region 工单号
  272. private void txtMOCode_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
  273. {
  274. string sql = @" SELECT DISTINCT MOCODE AS [工单号] FROM ICSMO ";
  275. DataTable data = DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.SYS]"), CommandType.Text, sql).Tables[0];
  276. FormDataRefer reForm = new FormDataRefer();
  277. reForm.FormTitle = "工单信息";
  278. reForm.DataSource = data;
  279. reForm.MSelectFlag = false;
  280. reForm.RowIndexWidth = 35;
  281. reForm.Width = 600;
  282. reForm.FormHeight = 900;
  283. //if (reForm.ShowDialog() == DialogResult.OK)
  284. //{
  285. // foreach (DataRow dr in reForm.ReturnData.Rows)
  286. // {
  287. // txtMOCode.Text = dr["生产订单号"].ToString();
  288. // }
  289. //}
  290. //if (data != null&&data.Rows.Count>0) {
  291. // txtMORow.Text = data.Rows[0]["生产订单行号"].ToString();
  292. // txtMoverCode.Text = data.Rows[0]["苏船工号"].ToString();
  293. //}
  294. }
  295. #endregion
  296. //#region 库房
  297. //private void txtWHCode_EditValueChanged(object sender, EventArgs e)
  298. //{
  299. // string sql = "SELECT DISTINCT StorageCode AS [仓库编号] FROM ICSStorage WHERE WorkPoint='{0}' ORDER BY StorageCode";
  300. // sql = string.Format(sql, AppConfig.WorkPointCode);
  301. // DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  302. // txtWHCode.Properties.ValueMember = "行号";
  303. // txtWHCode.Properties.DisplayMember = "行号";
  304. // txtWHCode.Properties.DataSource = dt;
  305. // txtWHCode.Properties.NullText = "";//空时的值
  306. // txtWHCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  307. // txtWHCode.Properties.ValidateOnEnterKey = true;//回车确认
  308. // txtWHCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  309. // txtWHCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  310. // //自适应宽度
  311. // txtWHCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  312. //}
  313. //#endregion
  314. #region 行号
  315. private void txtMORow_EditValueChanged(object sender, EventArgs e)
  316. {
  317. //string MOCODE = txtMOCode.EditValue.ToString();
  318. //string sql = "SELECT DISTINCT MOSEQ AS [行号] FROM ICSMO WHERE MOCODE='{0}' ORDER BY MOSEQ";
  319. //sql = string.Format(sql, MOCODE);
  320. //DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  321. //txtMORow.Properties.ValueMember = "行号";
  322. //txtMORow.Properties.DisplayMember = "行号";
  323. //txtMORow.Properties.DataSource = dt;
  324. //txtMORow.Properties.NullText = "";//空时的值
  325. //txtMORow.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  326. //txtMORow.Properties.ValidateOnEnterKey = true;//回车确认
  327. //txtMORow.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  328. //txtMORow.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  329. ////自适应宽度
  330. //txtMORow.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  331. //txtMORow.EditValue = "";
  332. //txtMoverCode.Text = "";
  333. //if (MOCODE == "")
  334. //{
  335. // txtMoverCode.Properties.ReadOnly = false;
  336. //}
  337. //else
  338. //{
  339. // txtMoverCode.Properties.ReadOnly = true;
  340. //}
  341. ////DataTable dt_temp = (DataTable)glue.Properties.DataSource;
  342. ////if (dt_temp.Rows.Count > 0)
  343. //if (dt.Rows.Count > 0)
  344. //{
  345. // //默认选择第一项
  346. // txtMORow.EditValue = dt.Rows[0][0].ToString().Trim();
  347. //}
  348. }
  349. #endregion
  350. private void btnSaveDetail_Click_bak(object sender, EventArgs e)
  351. {
  352. //1. 填写出库类别,部门,存货编码,数量三项为必输项,备注为不必输;
  353. if (txtWHCode.Text == "")
  354. {
  355. ICSBaseSimpleCode.AppshowMessageBox("请选择仓库!");
  356. return;
  357. }
  358. if (txtCode.Text == "")
  359. {
  360. ICSBaseSimpleCode.AppshowMessageBox("存货编码不能为空");
  361. return;
  362. }
  363. if (txtiQuantity.Text == "" || Convert.ToDecimal(txtiQuantity.Text) == 0)
  364. {
  365. ICSBaseSimpleCode.AppshowMessageBox("数量不能为空");
  366. return;
  367. }
  368. if (this.txtOutCategory.Text == "")
  369. {
  370. ICSBaseSimpleCode.AppshowMessageBox("出库类别不能为空");
  371. return;
  372. }
  373. if (this.txtDept.Text == "")
  374. {
  375. ICSBaseSimpleCode.AppshowMessageBox("部门不能为空!");
  376. return;
  377. }
  378. try
  379. {
  380. string sqlQ = @"SELECT '' AS ID,'' VouchCode,'' UserId,'' MUSERName,'' MTIME,'' WorkPoint,'' AS CreateTIME,'' AS CreateUSER,'' AS MEMO, '' AS IsPickingOrBack, '' AS OutCategory ";
  381. sqlQ = string.Format(sqlQ, AppConfig.WorkPointCode);
  382. data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sqlQ).Tables[0];
  383. DataRow dr = data.NewRow();
  384. dr["ID"] = new Guid().ToString();
  385. dr["VouchCode"] = txtPickingNO.Text.Trim();
  386. dr["UserId"] = AppConfig.UserId;
  387. dr["MUSERName"] = AppConfig.UserName;
  388. dr["MTIME"] = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  389. dr["WorkPoint"] = AppConfig.WorkPointCode;
  390. dr["CreateTIME"] = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  391. dr["CreateUSER"] = AppConfig.UserName;
  392. dr["MEMO"] = txtMEMO.Text.Trim();
  393. dr["IsPickingOrBack"] = 1; //1--领料;3-退料
  394. dr["OutCategory"] = this.txtOutCategory.Text;
  395. data.Rows.Add(dr);
  396. this.grvDetail.DataSource = data;
  397. #region
  398. //FormICSPickingModel Picking = new FormICSPickingModel();
  399. //Picking.ID = guid;
  400. //Picking.VouchCode = txtPickingNO.Text.Trim();
  401. ////Picking.StorageID = txtStorageID.Text.Trim();
  402. //Picking.MUSER = AppConfig.UserId;
  403. //Picking.MUSERName = AppConfig.UserName;
  404. //Picking.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  405. //Picking.WorkPoint = AppConfig.WorkPointCode;
  406. //Picking.CreateTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  407. //Picking.CreateUSER = AppConfig.UserName;
  408. //Picking.MEMO = txtMEMO.Text.Trim();
  409. //Picking.IsPickingOrBack = 1; //1--领料;3-退料
  410. //Picking.OutCategory = this.txtOutCategory.Text;
  411. //Picking.FormICSPickingDetail = new List<FormICSPickingDetailModel>();
  412. #endregion
  413. if (string.IsNullOrWhiteSpace(txtirowno.Text))
  414. {
  415. txtirowno.Text = ICSPickingBLL.GetPickingRowNo(guid, AppConfig.AppConnectString);//入库单行号
  416. }
  417. #region
  418. //FormICSPickingDetailModel PickingDetail = new FormICSPickingDetailModel();
  419. //bool detailIsID = false;
  420. //if (txtDetailId.Text == "")
  421. //{
  422. // detailIsID = true;
  423. // PickingDetail.ID = "0";//领料单明细ID
  424. //}
  425. //else
  426. //{
  427. // PickingDetail.ID = txtDetailId.Text; //领料单ID
  428. //}
  429. ////PickingDetail.VoucherNO = txtMoverCode.Text.Trim();//苏船工号
  430. //PickingDetail.VouchCode = txtPickingNO.Text.Trim();//单号
  431. //string strtime = DateTime.Now.ToString("yyyyMMdd");
  432. //string sql = @"SELECT CONVERT(INT,RIGHT(MAX(A.VouchRow),4)) AS MAXLOT FROM ICSMaterialPick A WHERE A.VouchCode ='{0}'";
  433. //sql = string.Format(sql, PickingDetail.VouchCode);//取已存的transNo后四位
  434. //DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
  435. //if (dt == null || dt.Rows.Count <= 0)
  436. //{
  437. // VRow = "0001";
  438. //}
  439. //else if (dt.Rows[0][0] == null || dt.Rows[0][0].ToString() == "")
  440. //{
  441. // VRow = "0001";
  442. //}
  443. //else
  444. //{
  445. // VRow = (Convert.ToInt32(dt.Rows[0][0]) + 1).ToString().PadLeft(4, '0');//自动生成transNo
  446. //}
  447. //PickingDetail.VouchRow = VRow; //入库单行号
  448. //PickingDetail.SubInvCode = txtCode.Text.Trim();//物料代码
  449. //PickingDetail.WHCode = txtWHCode.Text.Trim();//仓库
  450. //PickingDetail.Quantity = Convert.ToDecimal(txtiQuantity.Text.Trim());//应退数量
  451. //PickingDetail.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");//领料时间
  452. //PickingDetail.OutCategory = this.txtOutCategory.Text.Trim();
  453. //PickingDetail.Dept = this.txtDept.Text.Trim();
  454. //Picking.FormICSPickingDetail.Add(PickingDetail);
  455. //string id = ICSPickingBLL.AddAndEditDetail(Picking, AppConfig.AppConnectString);
  456. //if (guid == "" && string.IsNullOrWhiteSpace(guid))
  457. //{
  458. // guid = id;
  459. //}
  460. //if (string.IsNullOrWhiteSpace(txtDetailId.Text.Trim()))
  461. //{
  462. // txtDetailId.Text = "";
  463. // txtirowno.Text = "";
  464. // ICSBaseSimpleCode.AppshowMessageBox(0, "新增成功");
  465. //}
  466. //else
  467. //{
  468. // ICSBaseSimpleCode.AppshowMessageBox(0, "维护成功");
  469. // txtWHCode.Text = "";
  470. // txtCode.Text = "";
  471. // txtcInvName.Text = "";
  472. // txtcInvStd.Text = "";
  473. // txtINVUOM.Text = "";
  474. // txtiQuantity.Text = "";
  475. // //txtMOCode.Text = "";
  476. // //txtMORow.Text = "";
  477. // txtDetailId.Text = "0";
  478. // txtDept.Text = "";
  479. // txtOutCategory.Text = "";
  480. //}
  481. //FormICSINVENTORYEditAdd_Load(null, null);
  482. #endregion
  483. }
  484. catch (Exception ex)
  485. {
  486. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  487. return;
  488. }
  489. }
  490. private void btnSaveDetail_Click(object sender, EventArgs e)
  491. {
  492. //20190910新增一个单据只能保存一个出库类别,在表行中新增仓库、出库类别、部门
  493. string sqlOutCategory = @" SELECT DISTINCT
  494. j.OutCategory
  495. FROM
  496. ICSMaterialPick a
  497. LEFT JOIN ICSMaterial j ON a.VouchCode = j.VouchCode
  498. WHERE
  499. a.VouchCode = '{0}'
  500. AND a.WorkPoint = '" + AppConfig.WorkPointCode + "' ";
  501. sqlOutCategory = string.Format(sqlOutCategory, this.txtPickingNO.Text);
  502. DataTable dtOutCategory = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sqlOutCategory).Tables[0];
  503. if (dtOutCategory != null && dtOutCategory.Rows.Count > 0)
  504. {
  505. string _OutCategory = dtOutCategory.Rows[0][0].ToString();
  506. if (_OutCategory != this.txtOutCategory.Text)
  507. {
  508. ICSBaseSimpleCode.AppshowMessageBox("一张MRO领料单不能出现两个出库类别!");
  509. return;
  510. }
  511. }
  512. //1. 填写出库类别,部门,存货编码,数量三项为必输项,备注为不必输;
  513. if (txtWHCode.Text == "")
  514. {
  515. ICSBaseSimpleCode.AppshowMessageBox("请选择仓库!");
  516. return;
  517. }
  518. if (txtCode.Text == "")
  519. {
  520. ICSBaseSimpleCode.AppshowMessageBox("存货编码不能为空");
  521. return;
  522. }
  523. if (txtiQuantity.Text == "" || Convert.ToDecimal(txtiQuantity.Text) == 0)
  524. {
  525. ICSBaseSimpleCode.AppshowMessageBox("数量不能为空");
  526. return;
  527. }
  528. if (this.txtOutCategory.Text == "")
  529. {
  530. ICSBaseSimpleCode.AppshowMessageBox("出库类别不能为空");
  531. return;
  532. }
  533. if (Sys == "ICSMES_YTSys")
  534. {
  535. if (this.txtOutCategory.Text == "20303" || this.txtOutCategory.Text == "20306")
  536. {
  537. if (txtMEMO.Text == "")
  538. {
  539. ICSBaseSimpleCode.AppshowMessageBox("亚太账套,出库类别为20303或20306时,备注不能为空");
  540. return;
  541. }
  542. }
  543. }
  544. if (this.txtOutCategory.Text == "20202" && txtRDCode.Text == "")
  545. {
  546. ICSBaseSimpleCode.AppshowMessageBox("出库类别为20202时, RD号不能为空!");
  547. return;
  548. }
  549. if (this.txtDept.Text == "")
  550. {
  551. ICSBaseSimpleCode.AppshowMessageBox("部门不能为空!");
  552. return;
  553. }
  554. try
  555. {
  556. FormICSPickingModel Picking = new FormICSPickingModel();
  557. Picking.ID = guid;
  558. Picking.VouchCode = txtPickingNO.Text.Trim();
  559. //Picking.StorageID = txtStorageID.Text.Trim();
  560. Picking.MUSER = AppConfig.UserId;
  561. Picking.MUSERName = AppConfig.UserName;
  562. Picking.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  563. Picking.WorkPoint = AppConfig.WorkPointCode;
  564. Picking.CreateTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  565. Picking.CreateUSER = AppConfig.UserName;
  566. Picking.MEMO = txtMEMO.Text.Trim();
  567. Picking.IsPickingOrBack = 1; //1--领料;3-退料
  568. Picking.OutCategory = this.txtOutCategory.Text;
  569. Picking.VENDORCODE = txtCREWCODE.Text.Trim();
  570. Picking.FormICSPickingDetail = new List<FormICSPickingDetailModel>();
  571. if (string.IsNullOrWhiteSpace(txtirowno.Text))
  572. {
  573. txtirowno.Text = ICSPickingBLL.GetPickingRowNo(guid, AppConfig.AppConnectString);//入库单行号
  574. }
  575. FormICSPickingDetailModel PickingDetail = new FormICSPickingDetailModel();
  576. bool detailIsID = false;
  577. if (txtDetailId.Text == "")
  578. {
  579. detailIsID = true;
  580. PickingDetail.ID = "0";//领料单明细ID
  581. }
  582. else
  583. {
  584. PickingDetail.ID = txtDetailId.Text; //领料单ID
  585. }
  586. //PickingDetail.VoucherNO = txtMoverCode.Text.Trim();//苏船工号
  587. PickingDetail.VouchCode = txtPickingNO.Text.Trim();//单号
  588. string strtime = DateTime.Now.ToString("yyyyMMdd");
  589. string sql = @"SELECT CONVERT(INT,RIGHT(MAX(A.VouchRow),4)) AS MAXLOT FROM ICSMaterialPick A WHERE A.VouchCode ='{0}'";
  590. sql = string.Format(sql, PickingDetail.VouchCode);//取已存的transNo后四位
  591. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
  592. if (dt == null || dt.Rows.Count <= 0)
  593. {
  594. VRow = "0001";
  595. }
  596. else if (dt.Rows[0][0] == null || dt.Rows[0][0].ToString() == "")
  597. {
  598. VRow = "0001";
  599. }
  600. else
  601. {
  602. VRow = (Convert.ToInt32(dt.Rows[0][0]) + 1).ToString().PadLeft(4, '0');//自动生成transNo
  603. }
  604. PickingDetail.VouchRow = VRow; //入库单行号
  605. PickingDetail.SubInvCode = txtCode.Text.Trim();//物料代码
  606. PickingDetail.WHCode = txtWHCode.Text.Trim();//仓库
  607. #region
  608. //PickingDetail.MOCode = txtMOCode.Text.Trim();//工单号
  609. // if (txtMOCode.Text == "")
  610. // {
  611. // PickingDetail.MORow = "";
  612. // }
  613. // else
  614. //{
  615. // PickingDetail.MORow = txtMORow.Text.Trim();//行号
  616. // }
  617. #endregion
  618. PickingDetail.Quantity = Convert.ToDecimal(txtiQuantity.Text.Trim());//应退数量
  619. //PickingDetail.HasQuantity = Convert.ToDecimal(txtiQuantity.Text.Trim());//已退数量
  620. PickingDetail.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");//领料时间
  621. PickingDetail.OutCategory = this.txtOutCategory.Text.Trim();
  622. if (this.txtOutCategory.Text == "20202")
  623. {
  624. PickingDetail.RDCode = txtRDCode.Text.Trim();
  625. }
  626. PickingDetail.Dept = this.txtDept.Text.Trim();
  627. Picking.FormICSPickingDetail.Add(PickingDetail);
  628. string id = ICSPickingBLL.AddAndEditDetail(Picking, AppConfig.AppConnectString);
  629. if (guid == "" && string.IsNullOrWhiteSpace(guid))
  630. {
  631. guid = id;
  632. }
  633. if (string.IsNullOrWhiteSpace(txtDetailId.Text.Trim()))
  634. {
  635. txtDetailId.Text = "";
  636. txtirowno.Text = "";
  637. ICSBaseSimpleCode.AppshowMessageBox(0, "新增成功");
  638. }
  639. else
  640. {
  641. ICSBaseSimpleCode.AppshowMessageBox(0, "维护成功");
  642. txtWHCode.Text = "";
  643. txtCode.Text = "";
  644. txtcInvName.Text = "";
  645. txtcInvStd.Text = "";
  646. txtINVUOM.Text = "";
  647. txtiQuantity.Text = "";
  648. //txtMOCode.Text = "";
  649. //txtMORow.Text = "";
  650. txtDetailId.Text = "0";
  651. txtDept.Text = "";
  652. txtOutCategory.Text = "";
  653. txtRDCode.Text = "";
  654. }
  655. FormICSINVENTORYEditAdd_Load(null, null);
  656. }
  657. catch (Exception ex)
  658. {
  659. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  660. return;
  661. }
  662. }
  663. private void btnDelDetail_Click(object sender, EventArgs e)
  664. {
  665. grdDetail.PostEditor();
  666. this.Validate();
  667. if (grdDetail.RowCount == 0)
  668. return;
  669. List<string> guidList = new List<string>();
  670. List<string> codeList = new List<string>();
  671. for (int i = 0; i < grdDetail.RowCount; i++)
  672. {
  673. if (grdDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  674. {
  675. guidList.Add(grdDetail.GetRowCellValue(i, colID).ToString());
  676. }
  677. }
  678. if (guidList.Count == 0)
  679. {
  680. ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
  681. return;
  682. }
  683. try
  684. {
  685. #region 20190920ZM新增有领过料就不能删除单据行不能删除 ICSMaterialPick
  686. string HasQuantityMsg = string.Empty;
  687. foreach (var item in guidList)
  688. {
  689. string VouchCode = string.Empty;
  690. string VouchRow = string.Empty;
  691. string sql = @"SELECT VouchCode,VouchRow FROM ICSMaterialPick WHERE ID='" + item + "' AND HasQuantity>0";
  692. sql = string.Format(sql);
  693. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  694. if (dt != null && dt.Rows.Count > 0)
  695. {
  696. VouchCode = dt.Rows[0]["VouchCode"].ToString();
  697. VouchRow = dt.Rows[0]["VouchRow"].ToString();
  698. HasQuantityMsg += "单号:" + VouchCode + " 行号:" + VouchRow + " 已经有领料不能删除该行!";
  699. }
  700. }
  701. if (!string.IsNullOrWhiteSpace(HasQuantityMsg))
  702. {
  703. ICSBaseSimpleCode.AppshowMessageBox(HasQuantityMsg);
  704. return;
  705. }
  706. #endregion
  707. if (ICSBaseSimpleCode.AppshowMessageBoxRepose("确定删除该领料信息吗?删除后无法恢复,确定吗?") != DialogResult.OK)
  708. return;
  709. ICSPickingBLL.deleteDetailInfo(guidList, AppConfig.AppConnectString);
  710. txtirowno.Text = "";
  711. txtDetailId.Text = "";
  712. ICSBaseSimpleCode.AppshowMessageBox(0, "删除成功");
  713. FormICSINVENTORYEditAdd_Load(null, null);
  714. }
  715. catch (Exception ex)
  716. {
  717. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  718. }
  719. }
  720. private void btnUpdateDetail_Click(object sender, EventArgs e)
  721. {
  722. int count = 0;
  723. for (int i = 0; i < grdDetail.RowCount; i++)
  724. {
  725. if (grdDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  726. {
  727. count++;
  728. }
  729. }
  730. if (count != 1)
  731. {
  732. ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
  733. return;
  734. }
  735. try
  736. {
  737. FormICSPickingModel Picking = new FormICSPickingModel();
  738. //Picking.ID = guid;
  739. Picking.VouchCode = txtPickingNO.Text.Trim();
  740. //Picking.StorageID = txtStorageID.Text.Trim();
  741. Picking.FormICSPickingDetail = new List<FormICSPickingDetailModel>();
  742. FormICSPickingDetailModel PickingDetail = new FormICSPickingDetailModel();
  743. //PickingDetail.DetailID = txtDetailId.Text.Trim();//领料单明细ID
  744. //PickingDetail.PickingID = guid;//领料单ID
  745. PickingDetail.VouchCode = txtPickingNO.Text.Trim();//退料单号
  746. PickingDetail.SubInvCode = txtCode.Text.Trim();//物料代码
  747. PickingDetail.WHCode = txtWHCode.Text.Trim();//仓库
  748. //if (txtMOCode.Text == "")
  749. //{
  750. // PickingDetail.MOCode = "";
  751. // PickingDetail.MORow = "";
  752. //}
  753. //else {
  754. // PickingDetail.MOCode = txtMOCode.Text.Trim();//工单号
  755. // PickingDetail.MORow = txtMORow.Text.Trim();//行号
  756. //}
  757. PickingDetail.Quantity = Convert.ToDecimal(txtiQuantity.Text.Trim());//应退数量
  758. //PickingDetail.HasQuantity = Convert.ToDecimal(txtiQuantity.Text.Trim());//已退数量
  759. //PickingDetail.CreateTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
  760. //PickingDetail.CreateUSER = AppConfig.UserName;
  761. Picking.FormICSPickingDetail.Add(PickingDetail);
  762. string id = ICSPickingBLL.AddAndEditDetail(Picking, AppConfig.AppConnectString);
  763. if (guid == "" && string.IsNullOrWhiteSpace(guid))
  764. {
  765. guid = Picking.VouchCode;
  766. }
  767. ICSBaseSimpleCode.AppshowMessageBox(0, "修改成功");
  768. FormICSINVENTORYEditAdd_Load(null, null);
  769. }
  770. catch (Exception ex)
  771. {
  772. ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
  773. return;
  774. }
  775. }
  776. private void grvDetail_DoubleClick(object sender, EventArgs e)
  777. {
  778. if (grdDetail.FocusedRowHandle < 0)
  779. {
  780. return;
  781. }
  782. for (int i = 0; i < grdDetail.RowCount; i++)
  783. {
  784. grdDetail.SetRowCellValue(i, colisSelect, "");
  785. }
  786. if (grdDetail.FocusedColumn == colisSelect)
  787. {
  788. if (grdDetail.GetRowCellValue(grdDetail.FocusedRowHandle, colisSelect).ToString() == "")
  789. {
  790. grdDetail.SetRowCellValue(grdDetail.FocusedRowHandle, colisSelect, "Y");
  791. }
  792. else
  793. {
  794. grdDetail.SetRowCellValue(grdDetail.FocusedRowHandle, colisSelect, "");
  795. }
  796. }
  797. string ID = "";
  798. for (int i = 0; i < grdDetail.RowCount; i++)
  799. {
  800. if (grdDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
  801. {
  802. ID = grdDetail.GetRowCellValue(i, colID).ToString();
  803. }
  804. }
  805. DataTable dt = ICSPickingBLL.GetDetailInfo(ID);
  806. foreach (DataRow dr in dt.Rows)
  807. {
  808. txtPickingNO.Text = dr["VouchCode"].ToString().Trim();
  809. txtMTIME.Text = dr["dDate"].ToString().Trim();
  810. txtMUSERName.Text = dr["cMaker"].ToString().Trim();
  811. txtWHCode.Text = dr["iWHCode"].ToString().Trim();
  812. txtCode.Text = dr["cInvCode"].ToString().Trim();
  813. txtcInvName.Text = dr["cInvName"].ToString().Trim();
  814. txtcInvStd.Text = dr["cInvStd"].ToString().Trim();
  815. txtINVUOM.Text = dr["cInvStd"].ToString().Trim();
  816. txtiQuantity.Text = dr["iQuantity"].ToString().Trim();
  817. txtINVUOM.Text = dr["INVUOM"].ToString().Trim();
  818. //txtMOCode.Text = dr["MOCode"].ToString().Trim();
  819. //txtMORow.Text = dr["MORow"].ToString().Trim();
  820. txtDetailId.Text = dr["ID"].ToString().Trim();
  821. txtRDCode.Text = dr["RDCode"].ToString().Trim();
  822. }
  823. }
  824. private void txtCode_EditValueChanged(object sender, EventArgs e)
  825. {
  826. try
  827. {
  828. string Code = txtCode.EditValue.ToString();
  829. string sql = @"select INVCODE as 存货编码, INVNAME as 存货名称,INVSTD as 规格型号,INVUOM as 单位
  830. from ICSINVENTORY WHERE INVCODE='{0}'";
  831. sql = string.Format(sql, Code);
  832. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  833. if (dt != null && dt.Rows.Count > 0)
  834. {
  835. txtcInvName.Text = dt.Rows[0]["存货名称"].ToString();
  836. txtcInvStd.Text = dt.Rows[0]["规格型号"].ToString();
  837. //txtcDepName.Text = dt.Rows[0]["生产部门"].ToString();
  838. txtINVUOM.Text = dt.Rows[0]["单位"].ToString();
  839. txtiQuantity.Text = "";
  840. }
  841. }
  842. catch (Exception ex)
  843. {
  844. ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
  845. }
  846. }
  847. private void txtMORow_EditValueChanged_1(object sender, EventArgs e)
  848. {
  849. try
  850. {
  851. //string Row = txtMORow.EditValue.ToString();
  852. //string sql = @"select MOCODE ,MOSEQ ,MOVER from ICSMO WHERE MOCODE='{0}' and MOSEQ='{1}'";
  853. //sql = string.Format(sql, txtMOCode.Text.Trim(), txtMORow.Text.Trim());
  854. //DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  855. //if (dt != null && dt.Rows.Count > 0)
  856. //{
  857. // txtMoverCode.Text = dt.Rows[0]["MOVER"].ToString();
  858. //}
  859. #region
  860. //string sql1 = "SELECT MOCODE 工单号,SEQ 生产订单行号,MOBITEMCODE 存货编码 FROM ICSMOBOM WHERE MOCODE='{0}' and SEQ='{1}'";
  861. string sql1 = "SELECT MOCODE 工单号,SEQ 生产订单行号,MOBITEMCODE 存货编码 FROM ICSMOBOM WHERE MOCODE='{0}' and SEQ='{1}'";
  862. //sql1 = string.Format(sql1,txtMOCode.Text.Trim(),txtMORow.Text.Trim());
  863. sql1 = string.Format(sql1);
  864. DataTable dt1 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql1).Tables[0];
  865. txtCode.Properties.ValueMember = "存货编码";
  866. txtCode.Properties.DisplayMember = "存货编码";
  867. txtCode.Properties.DataSource = dt1;
  868. txtCode.Properties.NullText = "";//空时的值
  869. txtCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
  870. txtCode.Properties.ValidateOnEnterKey = true;//回车确认
  871. txtCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
  872. txtCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
  873. //自适应宽度
  874. txtCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
  875. #endregion
  876. }
  877. catch (Exception ex)
  878. {
  879. ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
  880. }
  881. }
  882. private void txtOutCategory_EditValueChanged(object sender, EventArgs e)
  883. {
  884. if (txtOutCategory.Text.ToString() == "20202")
  885. {
  886. txtRDCode.Properties.ReadOnly = false;
  887. }
  888. else
  889. {
  890. txtRDCode.Properties.ReadOnly = true;
  891. }
  892. }
  893. public string GetSys()
  894. {
  895. string sql = @"SELECT DBName FROM Sys_DataBase WHERE 1=1 AND DBSourceName = 'SYS' AND WorkCode = '{0}' ";
  896. sql = string.Format(sql, AppConfig.WorkPointCode);
  897. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
  898. if (dt != null && dt.Rows.Count > 0)
  899. {
  900. return dt.Rows[0]["DBName"].ToString();
  901. }
  902. else
  903. {
  904. return "";
  905. }
  906. }
  907. }
  908. }