FrmBalanceTicketMgt.cs 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Threading;
  9. using System.Collections;
  10. using System.Reflection;
  11. using CoreFS.CA06;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.StlMes.Client.Sale.UI.Balance.BalanceAccount
  14. {
  15. public partial class FrmBalanceTicketMgt : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase
  16. {
  17. public FrmBalanceTicketMgt()
  18. {
  19. InitializeComponent();
  20. }
  21. private String cusInfo = "";
  22. private String suppunit = "";
  23. private string _key = "2";
  24. private void SetKey()
  25. {
  26. if (this.CustomInfo.Length > 0)
  27. {
  28. this._key = this.CustomInfo.Trim().Split('_')[0];
  29. }
  30. }
  31. //待结算单据管理(结算价维护) 1
  32. //待结算单据管理(结算编单) 2
  33. private void HiddenToolbars()
  34. {
  35. try
  36. {
  37. foreach ( Infragistics.Win.UltraWinToolbars.ToolBase tb in toolMenu.Toolbars[0].Tools)
  38. {
  39. if (tb.Key == "QueryUnAcept" || tb.Key == "Accept" || tb.Key == "Exit" || tb.Key == "Export")
  40. {
  41. continue;
  42. }
  43. else
  44. tb.SharedProps.Visible = false;
  45. }
  46. }
  47. catch
  48. {
  49. }
  50. try
  51. {
  52. this.ultraExpandableGroupBox1.Visible = false;
  53. this.toolMenu.Toolbars[0].Tools["UpdatePrice"].SharedProps.Visible = false;
  54. this.toolMenu.Toolbars[0].Tools["RollBack"].SharedProps.Visible = false;
  55. this.toolMenu.Toolbars[0].Tools["SavePrice"].SharedProps.Visible = false;
  56. }
  57. catch
  58. { }
  59. if (this._key == "1")
  60. {
  61. try
  62. {
  63. this.label4.Visible = false;
  64. this.textBox2.Visible = false;
  65. this.ultraExpandableGroupBox2.Visible = false;
  66. this.toolMenu.Toolbars[0].Tools["UpdatePrice"].SharedProps.Visible = false;
  67. this.toolMenu.Toolbars[0].Tools["RollBack"].SharedProps.Visible = false;
  68. this.toolMenu.Toolbars[0].Tools["Invoice"].SharedProps.Visible = false;
  69. this.toolMenu.Toolbars[0].Tools["UnAffrim"].SharedProps.Visible = false;
  70. this.toolMenu.Toolbars[0].Tools["Affrim"].SharedProps.Visible = false;
  71. }
  72. catch
  73. { }
  74. }
  75. }
  76. private string LISTNUMBER = "LISTNUMBER";
  77. private void AcceptTicket()
  78. {
  79. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  80. if (this.ultraGrid5.Rows.Count == 0)
  81. return;
  82. ugr = this.ultraGrid5.ActiveRow;
  83. if (ugr == null)
  84. ugr = this.ultraGrid5.Rows[0];
  85. ugr.Selected = true;
  86. ArrayList listask = new ArrayList();
  87. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugs in this.ultraGrid5.Selected.Rows)
  88. {
  89. listask.Add(ugs.Cells[LISTNUMBER].Value.ToString());
  90. }
  91. // string askPlanId = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString();
  92. if (Util.MessageUtil.ShowYesNoAndQuestion("是否接收选定行?") == DialogResult.No) return;
  93. string errMsg = "";
  94. this.slmBalanceInfo.AffrimAcceptTicket(listask, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
  95. if (errMsg.Length == 0)
  96. {
  97. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  98. this.QueryUnAcceptTicket();
  99. }
  100. }
  101. private void UnAcceptTicket()
  102. {
  103. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  104. if (this.ultraGrid1.Rows.Count == 0)
  105. return;
  106. ugr = this.ultraGrid1.ActiveRow;
  107. if (ugr == null)
  108. ugr = this.ultraGrid1.Rows[0];
  109. if (ugr == null)
  110. {
  111. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要取消的行");
  112. return;
  113. }
  114. // string askPlanId = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString();
  115. if (Util.MessageUtil.ShowYesNoAndQuestion("是否取消接收选定行?") == DialogResult.No) return;
  116. string errMsg = "";
  117. this.slmBalanceInfo.UnAffrimAcceptTicket(ugr.Cells[this.LISTNUMBER].Value.ToString(), CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
  118. if (errMsg.Length == 0)
  119. {
  120. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  121. try
  122. {
  123. string listnum = ugr.Cells[this.LISTNUMBER].Value.ToString();
  124. ArrayList list = new ArrayList();
  125. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugs in this.ultraGrid1.Rows)
  126. {
  127. if (ugs.Cells[this.LISTNUMBER].Value.ToString() == listnum)
  128. {
  129. list.Add(ugs);
  130. }
  131. }
  132. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugg in list)
  133. {
  134. ugg.Delete();
  135. }
  136. }
  137. catch
  138. {
  139. }
  140. }
  141. }
  142. private Infragistics.Win.ValueList GetAgenCyFlList()
  143. {
  144. Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList();
  145. lit.ValueListItems.Add("0", "否");
  146. lit.ValueListItems.Add("1", "是");
  147. return lit;
  148. }
  149. private Infragistics.Win.ValueList GetStatusList()
  150. {
  151. Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList();
  152. lit.ValueListItems.Add("0", "未确认");
  153. lit.ValueListItems.Add("1", "确认");
  154. lit.ValueListItems.Add("2", "编单");
  155. return lit;
  156. }
  157. private Infragistics.Win.ValueList GetPriceStatusList()
  158. {
  159. Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList();
  160. lit.ValueListItems.Add("0", " 无效");
  161. lit.ValueListItems.Add("1", " 有效");
  162. return lit;
  163. }
  164. private Infragistics.Win.ValueList GetBalStatusList()
  165. {
  166. Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList();
  167. lit.ValueListItems.Add("0", "未确认");
  168. // lit.ValueListItems.Add("1", "确认");
  169. lit.ValueListItems.Add("2", "确认");
  170. lit.ValueListItems.Add("3", "编单");
  171. return lit;
  172. }
  173. private Infragistics.Win.ValueList GetFst_Drawee_unit()
  174. {
  175. Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList();
  176. lit.ValueListItems.Add("120601", "N/A");
  177. lit.ValueListItems.Add("120602", "/");
  178. lit.ValueListItems.Add("120603", "天津钢管集团股份有限公司");
  179. lit.ValueListItems.Add("120604", "天津钢管钢铁贸易有限公司");
  180. lit.ValueListItems.Add("120605", "天津钢管国际经济贸易有限公司");
  181. lit.ValueListItems.Add("120606", "合同结算单位");
  182. lit.ValueListItems.Add("120607", "江苏天淮钢管有限公司");
  183. lit.ValueListItems.Add("120608", "天津钢管制造有限公司");
  184. return lit;
  185. }
  186. private string[] GetGridFourDataStruct()
  187. {
  188. return new string[]
  189. {
  190. "ASKPLAN_ID",
  191. "TALLYSHEET_NO",
  192. "BATCH_NO",
  193. "QUANTITY",
  194. "ACT_WGT" ,
  195. "OUTSTOCKMNY",
  196. "MONEY_TYPE",
  197. "AGENCY_FL",
  198. "DELVRY_ADDR",
  199. "RECEIV_ADDR"
  200. };
  201. }
  202. protected override List<string> GetNumberColumn()
  203. {
  204. return new List<string>(new string[] {
  205. "SEND_NUM",
  206. "MONEY",
  207. "WEIGHT",
  208. "QUANTITY",
  209. "ACT_WGT",
  210. "OUTSTOCKMNY",
  211. "TRANSMNY",
  212. "PRICE",
  213. "PRICE_ORG",
  214. "MONEY_ORG",
  215. });
  216. }
  217. private DataSet dsBalanceMain = new DataSet ();
  218. private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo slmBalanceInfo = null;
  219. DataSet dsGridThree = new DataSet();
  220. DataSet dsGridFour = new DataSet();
  221. DataSet dsGridUnAccept = new DataSet();
  222. private void FrmBalanceTicketMgt_Load(object sender, EventArgs e)
  223. {
  224. this.ultraExpandableGroupBox1.Visible = false;
  225. this.ultraExpandableGroupBox2.Visible = true;
  226. this.dateTimePicker1.Value = System.DateTime.Now.AddMonths(-1);
  227. SetKey();
  228. this.Init();
  229. this.dsBalanceMain = base.GetDataSetByColumnName(this.GetGrid1DataStruct(),
  230. null, GetColumnAndCaption());
  231. this.ultraGrid1.DataSource = dsBalanceMain;
  232. this.dsGridThree = base.GetDataSetByColumnName(this.GetGridThreeDataStruct(),
  233. StaticData.TbColumnAndCaption.GetDataSetColumnType(), StaticData.TbColumnAndCaption.GetColumnAndCaption());
  234. this.ultraGrid3.DataSource = dsGridThree;
  235. dsGridFour = base.GetDataSetByColumnName(this.GetGridFourDataStruct(),
  236. StaticData.TbColumnAndCaption.GetDataSetColumnType(), StaticData.TbColumnAndCaption.GetColumnAndCaption());
  237. // this.ultraGrid4.DataSource = dsGridFour;
  238. slmBalanceInfo = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo(this.ob);
  239. this.dsGridFine = base.GetDataSetByColumnName(this.GetGridFiveDataStruct(),
  240. StaticData.TbColumnAndCaption.GetDataSetColumnType(), StaticData.TbColumnAndCaption.GetColumnAndCaption());
  241. // this.ultraGrid2.DataSource = dsGridFine;
  242. this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
  243. dsGridUnAccept = base.GetDataSetByColumnName(GetUnAcceptBalaceColumn(),
  244. null, GetColumnAndCaption());
  245. this.ultraGrid5.DataSource = dsGridUnAccept;
  246. HiddenColumn();
  247. InitGrid();
  248. base.SetGridStyle(ref this.ultraGrid1, ref this.ultraGrid3,ref this.ultraGrid5);
  249. cusInfo = CustomInfo.Split('_')[0];
  250. if (CustomInfo.Split('_').Length > 1)
  251. suppunit = CustomInfo.Split('_')[1];
  252. SetGridShowLength();
  253. if (this.cusInfo == "2")
  254. {
  255. this.ultraTabControl1.Tabs[0].Visible = true;
  256. }
  257. else
  258. {
  259. if (base.GetSaleOrgDesc() == "国贸公司" || suppunit == "120504")
  260. this.ultraTabControl1.Tabs[0].Visible = true;
  261. else
  262. {
  263. this.ultraTabControl1.Tabs[0].Visible = false;
  264. }
  265. }
  266. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.ASKPLAN_ID].MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always;
  267. this.ultraGrid1.DisplayLayout.Bands[0].Columns["LISTNUMBER"].MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always;
  268. }
  269. private void InitGrid()
  270. {
  271. try
  272. {
  273. // this.ultraGrid4.DisplayLayout.Bands[0].Columns["AGENCY_FL"].ValueList = GetAgenCyFlList();
  274. }
  275. catch
  276. { }
  277. try
  278. {
  279. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CONTAIN_TAX"].ValueList = GetAgenCyFlList();
  280. }
  281. catch
  282. { }
  283. try
  284. {
  285. this.ultraGrid1.DisplayLayout.Bands[0].Columns["TICKETSTATUS"].ValueList = GetAgenCyFlList();
  286. }
  287. catch
  288. { }
  289. try
  290. {
  291. this.ultraGrid1.DisplayLayout.Bands[0].Columns["BALANCESTATUS_ORG"].ValueList = GetBalStatusList();
  292. }
  293. catch
  294. { }
  295. try
  296. {
  297. // this.ultraGrid2.DisplayLayout.Bands[0].Columns["STATUS_CD"].ValueList = GetStatusList();
  298. }
  299. catch
  300. { }
  301. try
  302. {
  303. this.ultraGrid1.DisplayLayout.Bands[0].Columns["FST_DRAWEE_UNIT"].ValueList = GetFst_Drawee_unit();
  304. }
  305. catch
  306. { }
  307. try
  308. {
  309. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_STS].ValueList = GetPriceStatusList();
  310. }
  311. catch
  312. { }
  313. try
  314. {
  315. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_ORG_STS].ValueList = GetPriceStatusList();
  316. }
  317. catch
  318. { }
  319. }
  320. private void HiddenColumn()
  321. {
  322. try
  323. {
  324. this.ultraGrid1.DisplayLayout.Bands[0].Columns["BALANCESTATUS"].Hidden = true;
  325. // this.ultraGrid1.DisplayLayout.Bands[0].Columns["BALANCESTATUS_ORG"].Hidden = true;
  326. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.ADJUSTPRICEREASON].Hidden = true;
  327. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ADJUSTPRICEREASON"].Hidden = true;
  328. this.ultraGrid1.DisplayLayout.Bands[0].Columns[BUYERCODE].Hidden = true;
  329. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ADJUSTPRICEPERSON"].Hidden = true;
  330. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_PK"].Hidden = true;
  331. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_LN_PK"].Hidden = true;
  332. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_LN_DLY_PK"].Hidden = true;
  333. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CUSTOMER_NO"].Hidden = true;
  334. this.ultraGrid1.DisplayLayout.Bands[0].Columns["SALE_AREA_NO"].Hidden = true;
  335. this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_STYLE"].Hidden = true;
  336. }
  337. catch
  338. { }
  339. }
  340. private DataSet dsGridFine = new DataSet();
  341. private Hashtable hstransFee = new Hashtable();
  342. private void QueryGridFour()
  343. {
  344. this.dsGridFour.Clear();
  345. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  346. if (this.ultraGrid1.Rows.Count == 0)
  347. return;
  348. ugr = this.ultraGrid1.ActiveRow;
  349. if (ugr == null)
  350. ugr = this.ultraGrid1.Rows[0];
  351. string orderno = ugr.Cells[StaticData.TbColumnAndCaption.ORD_NO].Value.ToString();
  352. string orderseq = ugr.Cells[StaticData.TbColumnAndCaption.ORD_SEQ].Value.ToString();
  353. string orderlineseq = ugr.Cells[StaticData.TbColumnAndCaption.ORD_LN_DLY].Value.ToString();
  354. string askplanid = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString();
  355. string askplanidseq = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID_SEQ].Value.ToString();
  356. string spetkey = ugr.Cells[StaticData.TbColumnAndCaption.SPETKEY].Value.ToString();
  357. string steelkey = ugr.Cells[StaticData.TbColumnAndCaption.STEELCODEKEY].Value.ToString();
  358. DataSet dsDetail =
  359. this.slmBalanceInfo.GetSlmBalanceDetailAllGroupByBatchNo(
  360. orderno, orderseq, orderlineseq, askplanid, askplanidseq, spetkey, steelkey);
  361. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridFour, dsDetail);
  362. }
  363. private void QueryGridFive()
  364. {
  365. this.dsGridFine.Clear();
  366. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  367. if (this.ultraGrid1.Rows.Count == 0)
  368. return;
  369. ugr = this.ultraGrid1.ActiveRow;
  370. if (ugr == null)
  371. ugr = this.ultraGrid1.Rows[0];
  372. string askPlanId = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString();
  373. DataSet ds = null;
  374. ds = this.slmBalanceInfo.GetSlmBalanceTransMoneyAskPlanid(askPlanId);
  375. ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "MONEY_TYPE", "运费");
  376. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridFine, ds);
  377. }
  378. private void Init()
  379. {
  380. try
  381. {
  382. this.radioButton1.Checked = true;
  383. }
  384. catch
  385. { }
  386. }
  387. private Hashtable GetHashTableByImpExcel()
  388. {
  389. Hashtable hs = new Hashtable();
  390. string fileName = Util.UtilExcel.GetExcelFileName();
  391. if (fileName.Length == 0)
  392. return hs;
  393. DataSet ds = Util.UtilExcel.ToDataSet(fileName);
  394. if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
  395. return hs;
  396. string key = "";
  397. foreach (DataRow dr in ds.Tables[0].Rows)
  398. {
  399. key = dr[0].ToString() + dr[1].ToString() + dr[2].ToString();
  400. if (!hs.ContainsKey(key))
  401. {
  402. hs.Add(key,dr[3].ToString());
  403. }
  404. }
  405. return hs;
  406. }
  407. private string GetSqlStr(string price,string person,string condition)
  408. {
  409. String sqlStr = @" update SLM_BALANCEINFO set PRICE_ORG = nvl({1},0),
  410. MONEY_ORG = round(nvl({1},0) * weight ,5),
  411. PRICE_INPUTPERSON_ORG = '{2}' ,PRICE_INPUTPEDATE_ORG = sysdate,PRICE_PRE_ORG = {1}
  412. where ORD_NO||ORD_SEQ||ORD_LN_DLY||ASKPLAN_ID||ASKPLAN_ID_SEQ||spetKey||steelCodeKey = '{0}'
  413. and forecorpcode = '国贸公司' and balancestatus_org = '0' ";
  414. sqlStr = string.Format(sqlStr, condition, price, person);
  415. return sqlStr;
  416. }
  417. private void BatchUPdateBalancePrice()
  418. {
  419. if (this.ultraGrid1.Selected.Rows.Count == 0)
  420. {
  421. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要保存价格的行");
  422. return;
  423. }
  424. if (this.radioButton2.Checked)
  425. {
  426. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("只允许保存未接收数据价格");
  427. return;
  428. }
  429. Hashtable hsOrderPrice = GetHashTableByImpExcel();
  430. if (hsOrderPrice.Count == 0)
  431. return;
  432. ArrayList sqllist = new ArrayList();
  433. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  434. {
  435. string sql = "";
  436. string key = ugr.Cells["CATEGORY"].Value.ToString().Trim() + ugr.Cells["STEELCODEKEY"].Value.ToString().Trim() + ugr.Cells["MODEL_DESC"].Value.ToString().Trim();
  437. string orderno = ugr.Cells[this.ORD_NO].Value.ToString();
  438. string ord_seq = ugr.Cells[this.ORD_SEQ].Value.ToString();
  439. string ord_ln = ugr.Cells[this.ORD_LN_DLY].Value.ToString();
  440. string askplanId = ugr.Cells[this.ASKPLAN_ID].Value.ToString();
  441. string askPlanIdSeq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString();
  442. string spetKey = ugr.Cells[this.SPETKEY].Value.ToString();
  443. string steelcodekey = ugr.Cells[this.STEELCODEKEY].Value.ToString();
  444. string person = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  445. string price = "0";
  446. if (hsOrderPrice.ContainsKey(key))
  447. {
  448. price = hsOrderPrice[key].ToString();
  449. if (Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(price) == 0)
  450. continue;
  451. }
  452. if (price == "0")
  453. continue;
  454. sql = GetSqlStr(price, person, orderno + ord_seq + ord_ln + askplanId + askPlanIdSeq + spetKey + steelcodekey);
  455. sqllist.Add(sql);
  456. }
  457. if (sqllist.Count > 0)
  458. {
  459. base.ExecuteNoReader(sqllist);
  460. this.QueryOrg();
  461. }
  462. }
  463. public override void ToolBar_Click(object sender, string ToolbarKey)
  464. {
  465. switch (ToolbarKey)
  466. {
  467. case "Query":
  468. {
  469. this.Query();
  470. break;
  471. }
  472. case "QueryUnAcept":
  473. {
  474. this.QueryUnAcceptTicket();
  475. break;
  476. }
  477. case "QueryOrg":
  478. {
  479. this.QueryOrg();
  480. break;
  481. }
  482. case "Affrim":
  483. {
  484. this.Affrim();
  485. break;
  486. }
  487. case "AffrimOrg":
  488. {
  489. this.AffrimOrg();
  490. break;
  491. }
  492. case "UnAffrim":
  493. {
  494. this.UnAffrim();
  495. break;
  496. }
  497. case "UnAffrimOrg":
  498. {
  499. this.UnAffrimOrg();
  500. break;
  501. }
  502. case "Exit":
  503. {
  504. this.Close();
  505. break;
  506. }
  507. case "Invoice":
  508. {
  509. InvoiceWithTranMny();
  510. // this.Invoice();
  511. break;
  512. }
  513. case "InvoiceOrg":
  514. {
  515. this.InvoiceOrg();
  516. // this.Invoice();
  517. break;
  518. }
  519. case "InvoiceGuoMao":
  520. {
  521. this.InvoiceGuom();
  522. // this.Invoice();
  523. break;
  524. }
  525. case "InvoiceWithTranMny":
  526. {
  527. InvoiceWithTranMny();
  528. break;
  529. }
  530. case "UpdatePrice":
  531. {
  532. this.UpdatePrice();
  533. break;
  534. }
  535. case "SavePrice":
  536. {
  537. this.InputPrice();
  538. break;
  539. }
  540. case "RollBack":
  541. {
  542. this.RollBackAskPlanId();
  543. break;
  544. }
  545. case "Export":
  546. {
  547. Util.UtilUltraGrid.ExportGridDataToExcel(this.Text, this.ultraGrid1);
  548. break;
  549. }
  550. case "SetPrice":
  551. {
  552. SetBalPrice();
  553. break;
  554. }
  555. case "SetPriceOrg":
  556. {
  557. SetBalPriceOrg();
  558. break;
  559. }
  560. case "ExportPrice":
  561. {
  562. BatchUPdateBalancePrice();
  563. break;
  564. }
  565. case "Accept":
  566. {
  567. AcceptTicket();
  568. break;
  569. }
  570. case "UnAccept":
  571. {
  572. UnAcceptTicket();
  573. break;
  574. }
  575. case "AcpRllRecord":
  576. {
  577. AccetpRollCreditRecord();
  578. break;
  579. }
  580. }
  581. }
  582. private void AccetpRollCreditRecord()
  583. {
  584. try
  585. {
  586. DlgBox.DlgCredit dlgCredit
  587. = new Core.StlMes.Client.Sale.UI.Balance.DlgBox.DlgCredit(this.ob);
  588. if (this.cusInfo == "3")
  589. dlgCredit.SetFlag("2");
  590. dlgCredit.ShowDialog();
  591. }
  592. catch
  593. {
  594. }
  595. }
  596. private void SetBalPriceOrg()
  597. {
  598. ArrayList listOrder = GetUpdateCondition();
  599. if (listOrder.Count == 0)
  600. return;
  601. //foreach (string[] s in listOrder)
  602. //{
  603. // this.slmBalanceInfo.SetBalPriceOrg(new ArrayList() { s }, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  604. //}
  605. this.slmBalanceInfo.SetBalPriceOrg(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  606. this.QueryOrg();
  607. }
  608. /// <summary>
  609. /// 重新获取结算明细价格,防止因维护不及时无法获取正确价格
  610. /// </summary>
  611. private void SetBalPrice()
  612. {
  613. ArrayList listOrder = GetUpdateCondition();
  614. if (listOrder.Count == 0)
  615. return;
  616. //foreach (string[] s in listOrder)
  617. //{
  618. // this.slmBalanceInfo.SetBalPrice(new ArrayList() { s}, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  619. //}
  620. this.slmBalanceInfo.SetBalPrice(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  621. this.Query();
  622. }
  623. private void InvoiceWithTranMny()
  624. {
  625. if (!IsCanBeInvoiced())
  626. return;
  627. ArrayList listOrder = GetUpdateCondition();
  628. if (listOrder.Count == 0)
  629. return;
  630. if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return;
  631. string errMsg = "";
  632. this.slmBalanceInfo.InvoiceLightly(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
  633. if (errMsg.Length > 0)
  634. {
  635. }
  636. else
  637. {
  638. removeUgr();
  639. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  640. }
  641. // this.Query();
  642. }
  643. private void InvoiceOrg()
  644. {
  645. if (!this.IsCanBeInvoicedOrg())
  646. return;
  647. ArrayList listOrder = GetUpdateConditionSaleOrg();
  648. if (listOrder.Count == 0)
  649. return;
  650. if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return;
  651. string errMsg = "";
  652. this.slmBalanceInfo.InvoiceLightlyOrg(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
  653. // this.QueryOrg();
  654. if (errMsg.Length > 0)
  655. {
  656. }
  657. else
  658. {
  659. removeUgr();
  660. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  661. }
  662. }
  663. private void InvoiceGuom()
  664. {
  665. if (!this.IsCanBeInvoiced())
  666. return;
  667. ArrayList listOrder = GetUpdateCondition();
  668. if (listOrder.Count == 0)
  669. return;
  670. if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return;
  671. string errMsg = "";
  672. // this.slmBalanceInfo.Invoice(listOrder,"", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  673. this.slmBalanceInfo.InvoiceLightlyGuoM(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg);
  674. // this.QueryOrg();
  675. if (errMsg.Length > 0)
  676. {
  677. }
  678. else
  679. {
  680. removeUgr();
  681. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  682. }
  683. }
  684. private DataSet GetSlmOrderLine(List<string> odpkList)
  685. {
  686. DataSet ds = new DataSet();
  687. if (odpkList.Count == 0)
  688. {
  689. return ds;
  690. }
  691. string sqlCondition = Core.StlMes.Client.Sale.Util.ConverObject
  692. .ConvertListStringValueToSqlCondition("ORD_PK", odpkList);
  693. string sql = @"select nvl(A.BALNCE_PRICE_STS, '0') BALNCE_PRICE_STS,
  694. nvl(A.BALNCE_PRICE_ORG_STS, '0') BALNCE_PRICE_ORG_STS,
  695. a.ord_pk,
  696. a.ord_ln_pk
  697. from slm_order_line a
  698. where 1=1 and validflag = '1' {0}";
  699. sql = string.Format(sql,sqlCondition);
  700. ds = base.ExecuteReader(sql);
  701. return ds;
  702. }
  703. private Hashtable GetOrderBalSts(List<string> odpkList)
  704. {
  705. Hashtable hs = new Hashtable();
  706. DataSet ds = GetSlmOrderLine(odpkList);
  707. try
  708. {
  709. string ordandlinePk = "";
  710. foreach (DataRow dr in ds.Tables[0].Rows)
  711. {
  712. ordandlinePk = dr["ORD_PK"].ToString() + dr["ORD_LN_PK"].ToString();
  713. if (!hs.ContainsKey(ordandlinePk))
  714. {
  715. hs.Add(ordandlinePk, new string[] { dr["BALNCE_PRICE_STS"].ToString(), dr["BALNCE_PRICE_ORG_STS"].ToString() });
  716. }
  717. }
  718. }
  719. catch
  720. {
  721. }
  722. return hs;
  723. }
  724. private void QueryUnAcceptTicket()
  725. {
  726. DataSet ds = null;
  727. ds = this.slmBalanceInfo.GetUnAcceptTicketAndTransAndOutStockTicket(this.dateTimePicker1.Value,
  728. this.dateTimePicker2.Value,cusInfo, suppunit);
  729. if (this.textBox7.Text.Length > 0)
  730. {
  731. ds = Core.StlMes.Client.Sale.Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch
  732. (ds, ASKPLAN_ID, this.textBox7.Text.Trim());
  733. }
  734. if (!this.UserInfo.GetUserName().Equals("admin"))
  735. ds = base.GetDataSetByFilterDeptId(ds);
  736. //if ("120504".Equals(suppunit))
  737. // ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "supply_unit", suppunit);
  738. Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridUnAccept, ds);
  739. Core.StlMes.Client.Sale.Util.UtilDataSet.GetDsByDescOrderFromSourceDataSet(dsGridUnAccept, "LISTNUMBER");
  740. }
  741. private void Query()
  742. {
  743. DataSet ds = null;
  744. DataSet dsTrans = null;
  745. // 只有编单界面才查
  746. if (this.radioButton1.Checked) // 已编卡
  747. {
  748. ds = this.slmBalanceInfo.GetUnAffrimSlmBalaneInfoByPlanBeginDateAndEndDate(this.dateTimePicker1.Value,
  749. this.dateTimePicker2.Value, suppunit);
  750. dsTrans = this.slmBalanceInfo.GetAcceptAndUnAffrimTransAndOutStockTicket(suppunit);
  751. }
  752. if (this.radioButton2.Checked)// 未编卡
  753. {
  754. ds = this.slmBalanceInfo.GetAffrimSlmBalaneInfoByPlanBeginDateAndEndDate(this.dateTimePicker1.Value,
  755. this.dateTimePicker2.Value, suppunit);
  756. dsTrans = this.slmBalanceInfo.GetAcceptAndAffrimTransAndOutStockTicket(suppunit);
  757. }
  758. if (this.textBox7.Text.Trim().Length > 0)
  759. {
  760. ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ASKPLAN_ID, this.textBox7.Text.Trim());
  761. dsTrans = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(dsTrans, this.ASKPLAN_ID, this.textBox7.Text.Trim());
  762. }
  763. if (this.textBox1.Text.Trim().Length > 0)
  764. {
  765. ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ORD_NO, this.textBox1.Text.Trim());
  766. }
  767. if (!this.UserInfo.GetUserName().Equals("admin"))
  768. ds = base.GetDataSetByFilterDeptId(ds);
  769. dsTrans = base.GetDataSetByFilterDeptId(dsTrans);
  770. //if ("120504".Equals(suppunit))
  771. // ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "supply_unit", suppunit);
  772. //if ("120504".Equals(suppunit))
  773. // dsTrans = Util.UtilDataSet.GetDataSetWithRowFilter(dsTrans, "supply_unit", suppunit);
  774. this.dsBalanceMain.Clear();
  775. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsBalanceMain,ds);
  776. SetTicketMoneyType(ref this.dsBalanceMain);
  777. SetOrd();
  778. try
  779. {
  780. dsTrans.Tables[0].TableName = this.dsBalanceMain.Tables[0].TableName;
  781. this.dsBalanceMain.Merge(dsTrans, false, System.Data.MissingSchemaAction.Ignore);
  782. }
  783. catch
  784. {
  785. }
  786. Core.StlMes.Client.Sale.Util.UtilDataSet.GetDsByDescOrderFromSourceDataSet(this.dsBalanceMain, this.ASKPLAN_ID);
  787. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_STS].CellActivation = Activation.ActivateOnly;
  788. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_ORG_STS].CellActivation = Activation.ActivateOnly;
  789. CleanGrid();
  790. // this.SetMoney(ref this.dsBalanceMain);
  791. }
  792. private void SetTicketMoneyType(ref DataSet ds)
  793. {
  794. try
  795. {
  796. foreach (DataRow dr in ds.Tables[0].Rows)
  797. {
  798. dr["MONEY_TYPE"] = "货款";
  799. }
  800. }
  801. catch
  802. {
  803. }
  804. }
  805. private string ORD_PK = "ORD_PK";
  806. private string ORD_LN_PK = "ORD_LN_PK";
  807. private string BALNCE_PRICE_STS = "BALNCE_PRICE_STS";
  808. private string BALNCE_PRICE_ORG_STS = "BALNCE_PRICE_ORG_STS";
  809. private void SetOrd()
  810. {
  811. if (this.ultraGrid1.Rows.Count == 0)
  812. {
  813. return;
  814. }
  815. List<string> list = new List<string>();
  816. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows)
  817. {
  818. if (!list.Contains(ugr.Cells[this.ORD_PK].Value.ToString()))
  819. {
  820. list.Add(ugr.Cells[this.ORD_PK].Value.ToString());
  821. }
  822. }
  823. Hashtable hs = GetOrderBalSts(list);
  824. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows)
  825. {
  826. if (hs.ContainsKey(ugr.Cells[this.ORD_PK].Value.ToString() + ugr.Cells[this.ORD_LN_PK].Value.ToString()))
  827. {
  828. string[] str = (string[])
  829. hs[ugr.Cells[this.ORD_PK].Value.ToString() + ugr.Cells[this.ORD_LN_PK].Value.ToString()];
  830. ugr.Cells[this.BALNCE_PRICE_STS].Value = str[0];
  831. ugr.Cells[this.BALNCE_PRICE_ORG_STS].Value = str[1];
  832. }
  833. // list.Add(ugr.Cells[this.ORD_PK].Value.ToString() + ugr.Cells[this.ORD_LN_PK].Value.ToString());
  834. }
  835. }
  836. private void QueryOrg()
  837. {
  838. DataSet ds = null;
  839. DataSet dsTrans = null;
  840. // 只有编单界面才查
  841. if (this.radioButton1.Checked)
  842. {
  843. ds = this.slmBalanceInfo.GetUnAffrimSlmBalaneInfoByPlanBeginDateAndEndDateOrg(this.dateTimePicker1.Value,
  844. this.dateTimePicker2.Value);
  845. dsTrans = this.slmBalanceInfo.GetAcceptAndUnAffrimTransAndOutStockTicketOrg();
  846. }
  847. if (this.radioButton2.Checked)
  848. {
  849. ds = this.slmBalanceInfo.GetAffrimSlmBalaneInfoByPlanBeginDateAndEndDateOrg(this.dateTimePicker1.Value,
  850. this.dateTimePicker2.Value);
  851. dsTrans = this.slmBalanceInfo.GetAcceptAndAffrimTransAndOutStockTicketOrg();
  852. }
  853. if (this.textBox7.Text.Trim().Length > 0)
  854. {
  855. ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ASKPLAN_ID, this.textBox7.Text.Trim());
  856. dsTrans = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(dsTrans, this.ASKPLAN_ID, this.textBox7.Text.Trim());
  857. }
  858. if (this.textBox1.Text.Trim().Length > 0)
  859. {
  860. ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ORD_NO, this.textBox1.Text.Trim());
  861. }
  862. // 按部门过滤数据
  863. // 按首次受票人过滤数据
  864. ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "FST_DRAWEE_UNIT", GetFilterSaleOrg(suppunit));
  865. //if ("120504".Equals(suppunit))
  866. ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "supply_unit", suppunit);
  867. if (!this.UserInfo.GetUserName().Equals("admin"))
  868. ds = base.GetDataSetByFilterDeptId(ds);
  869. dsTrans = base.GetDataSetByFilterDeptId(dsTrans);
  870. //if ("120504".Equals(suppunit))
  871. dsTrans = Util.UtilDataSet.GetDataSetWithRowFilter(dsTrans, "supply_unit", suppunit);
  872. this.dsBalanceMain.Clear();
  873. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsBalanceMain, ds);
  874. SetTicketMoneyType(ref this.dsBalanceMain);
  875. try
  876. {
  877. dsTrans.Tables[0].TableName = this.dsBalanceMain.Tables[0].TableName;
  878. this.dsBalanceMain.Merge(dsTrans, false, System.Data.MissingSchemaAction.Ignore);
  879. }
  880. catch
  881. {
  882. }
  883. SetOrd();
  884. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_STS].CellActivation = Activation.ActivateOnly;
  885. this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_ORG_STS].CellActivation = Activation.ActivateOnly;
  886. CleanGrid();
  887. // this.SetMoney(ref this.dsBalanceMain);
  888. }
  889. private string[] GetFilterSaleOrg(String flag)
  890. {
  891. if (flag == "120504")
  892. return new string[] { "120603", "120604", "120605", "120608" };
  893. else
  894. return new string[] { "120603", "120604", "120605" };
  895. }
  896. private void CleanGrid()
  897. {
  898. this.dsGridThree.Clear();
  899. this.dsGridFour.Clear();
  900. }
  901. private void Affrim()
  902. {
  903. ArrayList listOrder = GetUpdateCondition();
  904. if (listOrder.Count == 0)
  905. return;
  906. string errMsg = "";
  907. this.slmBalanceInfo.Affrim(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
  908. if (errMsg.Length > 0)
  909. {
  910. }
  911. else
  912. {
  913. removeUgr();
  914. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  915. }
  916. }
  917. private void removeUgr()
  918. {
  919. try
  920. {
  921. System.Collections.Generic.List<Infragistics.Win.UltraWinGrid.UltraGridRow> listugr
  922. = new List<UltraGridRow>();
  923. if(this.ultraGrid1.ActiveRow != null)
  924. this.ultraGrid1.ActiveRow.Selected = true;
  925. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  926. {
  927. listugr.Add(ugr);
  928. }
  929. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in listugr)
  930. {
  931. ugr.Delete();
  932. }
  933. this.ultraGrid1.UpdateData();
  934. }
  935. catch { }
  936. }
  937. private void AffrimOrg()
  938. {
  939. ArrayList listOrder = GetUpdateCondition();
  940. if (listOrder.Count == 0)
  941. return;
  942. string errMsg = "";
  943. this.slmBalanceInfo.AffrimOrg(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg);
  944. // this.QueryOrg();
  945. if (errMsg.Length > 0)
  946. {
  947. }
  948. else
  949. {
  950. removeUgr();
  951. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  952. }
  953. }
  954. private void UnAffrim()
  955. {
  956. ArrayList listOrder = GetUpdateCondition();
  957. if (listOrder.Count == 0)
  958. return;
  959. string errMsg = "";
  960. if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定取消选定行?") == DialogResult.No) return;
  961. this.slmBalanceInfo.UnAffrim(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg);
  962. // this.Query();
  963. if (errMsg.Length > 0)
  964. {
  965. }
  966. else
  967. {
  968. removeUgr();
  969. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  970. }
  971. }
  972. private void UnAffrimOrg()
  973. {
  974. ArrayList listOrder = GetUpdateCondition();
  975. if (listOrder.Count == 0)
  976. return;
  977. if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定取消选定行?") == DialogResult.No) return;
  978. string errMsg = "";
  979. this.slmBalanceInfo.UnAffrimOrg(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg);
  980. // this.QueryOrg();
  981. if (errMsg.Length > 0)
  982. {
  983. }
  984. else
  985. {
  986. removeUgr();
  987. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  988. }
  989. }
  990. private int saveDigit = 4;
  991. private void SetMoney(ref DataSet ds)
  992. {
  993. if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
  994. return;
  995. foreach (DataRow dr in ds.Tables[0].Rows)
  996. {
  997. dr[this.MONEY] = Math.Round(Util.ConverObject.ConvertToDouble(dr[this.WEIGHT].ToString())
  998. * Util.ConverObject.ConvertToDouble(dr[this.PRICE].ToString()), saveDigit);
  999. }
  1000. }
  1001. private Boolean IsCanBeUpdateWithDifferentPerson(string user)
  1002. {
  1003. if (user == CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName())
  1004. {
  1005. return true;
  1006. }
  1007. else
  1008. {
  1009. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("只允许操作本人数据");
  1010. return false;
  1011. }
  1012. }
  1013. private void Invoice()
  1014. {
  1015. if (!IsCanBeInvoiced())
  1016. return;
  1017. ArrayList listOrder = GetUpdateCondition();
  1018. if (listOrder.Count == 0)
  1019. return;
  1020. if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return;
  1021. string errMsg = "";
  1022. // this.slmBalanceInfo.Invoice(listOrder,"", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  1023. this.slmBalanceInfo.InvoiceLightly(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg);
  1024. if (errMsg.Length > 0)
  1025. {
  1026. }
  1027. else
  1028. {
  1029. removeUgr();
  1030. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  1031. }
  1032. // this.Query();
  1033. }
  1034. private void RollBackAskPlanId()
  1035. {
  1036. if (this.ultraGrid1.Rows.Count == 0)
  1037. return;
  1038. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  1039. if (ugr == null)
  1040. return;
  1041. this.slmBalanceInfo.RollBaskAskPlanId(ugr.Cells[this.ASKPLAN_ID].Value.ToString(),
  1042. CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName());
  1043. }
  1044. private Boolean IsCanBeInvoiced()
  1045. {
  1046. // 钢贸是否必须要在首次结算后再进行末次编单
  1047. Boolean isAllowInvoice = true;
  1048. if (this.ultraGrid1.Rows.Count == 0)
  1049. return false;
  1050. if (this.ultraGrid1.Rows.Count == 1)
  1051. this.ultraGrid1.Rows[0].Selected = true;
  1052. this.ultraGrid1.ActiveRow.Selected = true;
  1053. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  1054. {
  1055. //if (Util.ConverObject.ConvertToDouble(ugr.Cells["PRICE"].Value.ToString()) == 0
  1056. // && ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款"
  1057. // )
  1058. //{
  1059. // Util.MessageUtil.ShowError("记录中有单价为0记录,不允许编单");
  1060. // return false;
  1061. //}
  1062. string FST_DRAWEE_UNIT = ugr.Cells["FST_DRAWEE_UNIT"].Value.ToString();
  1063. // 钢贸的首次结算必须要等首次开票完成
  1064. if (( FST_DRAWEE_UNIT =="120604"|| FST_DRAWEE_UNIT =="120605") && isAllowInvoice && ugr.Cells["FORECORPCODE"].Value.ToString() == "钢贸公司" && ugr.Cells["BALANCESTATUS_ORG"].Value.ToString()+"" != "3")
  1065. {
  1066. if (ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款")
  1067. {
  1068. Util.MessageUtil.ShowError("记录中有未进行首次编单记录,不允许编单");
  1069. return false;
  1070. }
  1071. }
  1072. if ( ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款" && !IsCanBeUpdateWithDifferentPerson(ugr.Cells["AFFRIMPERSON"].Value.ToString()))
  1073. {
  1074. return false;
  1075. }
  1076. }
  1077. return true;
  1078. }
  1079. private Boolean IsCanBeInvoicedOrg()
  1080. {
  1081. if (this.ultraGrid1.Rows.Count == 0)
  1082. return false;
  1083. if (this.ultraGrid1.Rows.Count == 1)
  1084. this.ultraGrid1.Rows[0].Selected = true;
  1085. this.ultraGrid1.ActiveRow.Selected = true;
  1086. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  1087. {
  1088. if (Util.ConverObject.ConvertToDouble(ugr.Cells["PRICE_ORG"].Value.ToString()) == 0 && ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款")
  1089. {
  1090. Util.MessageUtil.ShowError("记录中有单价为0记录,不允许编单");
  1091. return false;
  1092. }
  1093. if (ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款" && !IsCanBeUpdateWithDifferentPerson(ugr.Cells["AFFRIMPERSON_ORG"].Value.ToString()))
  1094. {
  1095. return false;
  1096. }
  1097. }
  1098. return true;
  1099. }
  1100. private ArrayList GetUpdateCondition()
  1101. {
  1102. ArrayList list = new ArrayList();
  1103. if (this.ultraGrid1.Rows.Count == 0)
  1104. return list;
  1105. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  1106. if (ugr == null)
  1107. return list;
  1108. if (this.ultraGrid1.Selected.Rows.Count == 0)
  1109. {
  1110. CheckedIsGridGroupRow(ugr, ref list);
  1111. }
  1112. else
  1113. {
  1114. for (int i = 0; i < this.ultraGrid1.Selected.Rows.Count; i++)
  1115. {
  1116. CheckedIsGridGroupRow(this.ultraGrid1.Selected.Rows[i], ref list);
  1117. }
  1118. }
  1119. return list;
  1120. }
  1121. private ArrayList GetUpdateConditionSaleOrg()
  1122. {
  1123. ArrayList list = new ArrayList();
  1124. if (this.ultraGrid1.Rows.Count == 0)
  1125. return list;
  1126. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  1127. if (ugr == null)
  1128. return list;
  1129. if (this.ultraGrid1.Selected.Rows.Count == 0)
  1130. {
  1131. CheckedIsGridGroupRowSaleOrg(ugr, ref list);
  1132. }
  1133. else
  1134. {
  1135. for (int i = 0; i < this.ultraGrid1.Selected.Rows.Count; i++)
  1136. {
  1137. CheckedIsGridGroupRowSaleOrg(this.ultraGrid1.Selected.Rows[i], ref list);
  1138. }
  1139. }
  1140. return list;
  1141. }
  1142. private void CheckedIsGridGroupRow(UltraGridRow ugr, ref ArrayList ar1)
  1143. {
  1144. if (ugr is UltraGridGroupByRow)
  1145. {
  1146. for (int i = 0; i < ugr.ChildBands[0].Rows.Count; i++)
  1147. {
  1148. CheckedIsGridGroupRow(ugr.ChildBands[0].Rows[i], ref ar1);
  1149. }
  1150. }
  1151. else
  1152. {
  1153. ar1.Add(new string[]{
  1154. ugr.Cells[this.ORD_NO].Value.ToString(),
  1155. ugr.Cells[this.ORD_SEQ].Value.ToString(),
  1156. ugr.Cells[this.ORD_LN_DLY].Value.ToString(),
  1157. ugr.Cells[this.ASKPLAN_ID].Value.ToString(),
  1158. ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(),
  1159. ugr.Cells[this.SPETKEY].Value.ToString(),
  1160. ugr.Cells[this.STEELCODEKEY].Value.ToString(),
  1161. ugr.Cells[this.BUYERCODE].Value.ToString(),
  1162. ugr.Cells[this.PRICE].Value.ToString(),
  1163. ugr.Cells[this.BALANCESTATUS].Value.ToString(),
  1164. ugr.Cells["ORD_PK"].Value.ToString(),
  1165. ugr.Cells["ORD_LN_PK"].Value.ToString(),
  1166. ugr.Cells["ORD_LN_DLY_PK"].Value.ToString(),
  1167. ugr.Cells["BALANCESTATUS_ORG"].Value.ToString(),
  1168. ugr.Cells["CUSTOMER_NO"].Value.ToString(),
  1169. ugr.Cells["SALE_AREA_NO"].Value.ToString(),
  1170. ugr.Cells["FST_DRAWEE_UNIT"].Value.ToString(),
  1171. ugr.Cells["FORECORPCODE"].Value.ToString(),
  1172. ugr.Cells["LISTNUMBER"].Value.ToString(),
  1173. ugr.Cells["MONEY_TYPE"].Value.ToString()
  1174. });
  1175. }
  1176. }
  1177. private void CheckedIsGridGroupRowSaleOrg(UltraGridRow ugr, ref ArrayList ar1)
  1178. {
  1179. if (ugr is UltraGridGroupByRow)
  1180. {
  1181. for (int i = 0; i < ugr.ChildBands[0].Rows.Count; i++)
  1182. {
  1183. CheckedIsGridGroupRowSaleOrg(ugr.ChildBands[0].Rows[i], ref ar1);
  1184. }
  1185. }
  1186. else
  1187. {
  1188. ar1.Add(new string[]{
  1189. ugr.Cells[this.ORD_NO].Value.ToString(),
  1190. ugr.Cells[this.ORD_SEQ].Value.ToString(),
  1191. ugr.Cells[this.ORD_LN_DLY].Value.ToString(),
  1192. ugr.Cells[this.ASKPLAN_ID].Value.ToString(),
  1193. ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(),
  1194. ugr.Cells[this.SPETKEY].Value.ToString(),
  1195. ugr.Cells[this.STEELCODEKEY].Value.ToString(),
  1196. ugr.Cells[this.BUYERCODE].Value.ToString(),
  1197. ugr.Cells["PRICE_ORG"].Value.ToString(),
  1198. ugr.Cells[this.BALANCESTATUS].Value.ToString(),
  1199. ugr.Cells["ORD_PK"].Value.ToString(),
  1200. ugr.Cells["ORD_LN_PK"].Value.ToString(),
  1201. ugr.Cells["ORD_LN_DLY_PK"].Value.ToString(),
  1202. ugr.Cells["BALANCESTATUS_ORG"].Value.ToString(),
  1203. ugr.Cells["CUSTOMER_NO"].Value.ToString(),
  1204. ugr.Cells["SALE_AREA_NO"].Value.ToString(),
  1205. ugr.Cells["FST_DRAWEE_UNIT"].Value.ToString(),
  1206. ugr.Cells["FORECORPCODE"].Value.ToString(),
  1207. ugr.Cells["LISTNUMBER"].Value.ToString(),
  1208. ugr.Cells["MONEY_TYPE"].Value.ToString()
  1209. });
  1210. }
  1211. }
  1212. private void UpdatePrice()
  1213. {
  1214. if (this.ultraGrid1.Rows.Count == 0)
  1215. return;
  1216. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  1217. double price = Convert.ToDouble(this.ultraNumericEditor1.Value);
  1218. string reason = this.textBox2.Text.Trim();
  1219. if (reason.Length == 0)
  1220. {
  1221. MessageBox.Show("请输入调整原因");
  1222. return;
  1223. }
  1224. if (price == 0)
  1225. return;
  1226. string errMsg = "";
  1227. string orderno = ugr.Cells[this.ORD_NO].Value.ToString();
  1228. string ord_seq = ugr.Cells[this.ORD_SEQ].Value.ToString();
  1229. string ord_ln = ugr.Cells[this.ORD_LN_DLY].Value.ToString();
  1230. string askplanId = ugr.Cells[this.ASKPLAN_ID].Value.ToString();
  1231. string askPlanIdSeq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString();
  1232. string spetKey = ugr.Cells[this.SPETKEY].Value.ToString();
  1233. string steelcodekey = ugr.Cells[this.STEELCODEKEY].Value.ToString();
  1234. string person = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  1235. this.slmBalanceInfo.UpdatePrice(orderno, ord_seq, ord_ln, askplanId, askPlanIdSeq, spetKey, steelcodekey,
  1236. price, reason, person, out errMsg);
  1237. if (errMsg.Length == 0)
  1238. {
  1239. MessageBox.Show("修改成功");
  1240. ugr.Cells[this.PRICE].Value = Math.Round(price,this.saveDigit);
  1241. ugr.Cells[this.MONEY].Value = Math.Round(Convert.ToDouble(ugr.Cells[this.WEIGHT].Value) * price, this.saveDigit);
  1242. ugr.Cells[this.ADJUSTPRICEREASON].Value = reason;
  1243. }
  1244. }
  1245. private string[] GetGridThreeDataStruct()
  1246. {
  1247. return new string[]
  1248. {
  1249. "ASKPLAN_ID",
  1250. "TALLYSHEET_NO",
  1251. // "ORD_LN_DLY",
  1252. "BATCH_NO",
  1253. "QUANTITY",
  1254. "ACT_WGT"
  1255. };
  1256. }
  1257. /// <summary>
  1258. /// 价格由专门的人员维护,结算人员只需要进行编单
  1259. /// 但是也提供价格调整功能,只是调整原因必须输入,见UpdatePrice
  1260. /// </summary>
  1261. private void InputPrice()
  1262. {
  1263. if (this.ultraGrid1.Rows.Count == 0)
  1264. return;
  1265. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  1266. double price = Convert.ToDouble(this.ultraNumericEditor1.Value);
  1267. string reason = this.textBox2.Text.Trim();
  1268. if (price == 0)
  1269. return;
  1270. string errMsg = "";
  1271. string orderno = ugr.Cells[this.ORD_NO].Value.ToString();
  1272. string ord_seq = ugr.Cells[this.ORD_SEQ].Value.ToString();
  1273. string ord_ln = ugr.Cells[this.ORD_LN_DLY].Value.ToString();
  1274. string askplanId = ugr.Cells[this.ASKPLAN_ID].Value.ToString();
  1275. string askPlanIdSeq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString();
  1276. string spetKey = ugr.Cells[this.SPETKEY].Value.ToString();
  1277. string steelcodekey = ugr.Cells[this.STEELCODEKEY].Value.ToString();
  1278. string person = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  1279. this.slmBalanceInfo.inputPrice(orderno, ord_seq, ord_ln, askplanId, askPlanIdSeq, spetKey, steelcodekey,
  1280. price, person, out errMsg);
  1281. if (errMsg.Length == 0)
  1282. {
  1283. MessageBox.Show("修改成功");
  1284. ugr.Cells[this.PRICE].Value = Math.Round(price, this.saveDigit);
  1285. ugr.Cells[this.MONEY].Value = Math.Round(Convert.ToDouble(ugr.Cells[this.WEIGHT].Value) * price, this.saveDigit);
  1286. ugr.Cells[this.ADJUSTPRICEREASON].Value = reason;
  1287. }
  1288. }
  1289. private string[] GetGrid1DataStruct()
  1290. {
  1291. return GetBalanceMainColumn();
  1292. }
  1293. private string[] GetUnAcceptBalaceColumn()
  1294. {
  1295. return new string[]
  1296. {
  1297. "LISTNUMBER",
  1298. "ASKPLAN_ID",
  1299. "SEND_NUM",
  1300. // "ORDER_UNIT",
  1301. "QUANTITY",
  1302. "WEIGHT",
  1303. "MONEY",
  1304. "OUTWEIGHT",
  1305. "OUTSTOCKMNY",
  1306. "TRANSMONEY",
  1307. "TRANS_TYPE_NAME",
  1308. "SALE_AREA_DESC",
  1309. "BUYERNAME",
  1310. "INCEPTCORPCODE",
  1311. "SUPPLY_UNIT_DESC"
  1312. };
  1313. }
  1314. private string[] GetBalanceMainColumn()
  1315. {
  1316. return new string[]
  1317. {
  1318. "ASKPLAN_ID",
  1319. LISTNUMBER,
  1320. "MONEY_TYPE",
  1321. "SALE_AREA_DESC",
  1322. "FORECORPCODE",
  1323. "BUYERCODE",
  1324. "BUYERNAME",
  1325. "SUPPLY_UNIT_DESC",
  1326. "FST_DRAWEE_UNIT",
  1327. "ORD_NO",
  1328. "ORD_SEQ",
  1329. "ORD_LN_DLY",
  1330. "ASKPLAN_ID_SEQ",
  1331. "STEELCODEKEY",
  1332. "PACTINDEX",
  1333. "SPETKEY",
  1334. "SEND_NUM",
  1335. "ORDER_UNIT",
  1336. "QUANTITY",
  1337. "WEIGHT",
  1338. "BALNCE_PRICE_STS",
  1339. "BALNCE_PRICE_ORG_STS",
  1340. "PRICE",
  1341. "MONEY",
  1342. "PRICE_ORG",
  1343. "MONEY_ORG",
  1344. "CONTAIN_TAX",
  1345. "CATEGORY",
  1346. "SPEC_ABBSYMNAME",
  1347. "STD_STYLE_DESC",
  1348. "MODEL_DESC",
  1349. "TRANS_TYPE_NAME",
  1350. "ADJUSTPRICEPERSON",
  1351. "ADJUSTPRICEREASON",
  1352. "BASEPRICE",
  1353. "INCEPTCORPCODE",
  1354. // "STATIONCODE",
  1355. "BALANCESTATUS_ORG",
  1356. "AFFRIMPERSON_ORG",
  1357. "AFFIRMTIME_ORG",
  1358. "BALANCESTATUS",
  1359. "AFFRIMPERSON",
  1360. "AFFIRMTIME",
  1361. // "AREACODE",
  1362. // "DOCKCODE",
  1363. // "SHIPNO",
  1364. // "FIXSIZE",
  1365. "INVOICENO_ORG",
  1366. "REALINVOICENO_ORG",
  1367. "ORD_PK",
  1368. "ORD_LN_PK",
  1369. "ORD_LN_DLY_PK",
  1370. "CUSTOMER_NO",
  1371. "CUSTOMER_NM",
  1372. "SALE_AREA_NO"
  1373. };
  1374. }
  1375. private string BUYERCODE = "BUYERCODE";
  1376. private string ORD_NO = "ORD_NO";
  1377. private string ORD_SEQ = "ORD_SEQ";
  1378. private string ORD_LN_DLY = "ORD_LN_DLY";
  1379. private string ASKPLAN_ID = "ASKPLAN_ID";
  1380. private string ASKPLAN_ID_SEQ = "ASKPLAN_ID_SEQ";
  1381. private string SPETKEY = "SPETKEY";
  1382. private string STEELCODEKEY = "STEELCODEKEY";
  1383. private string MONEY = "MONEY";
  1384. private string WEIGHT = "WEIGHT";
  1385. private string PRICE = "PRICE";
  1386. private string BALANCESTATUS = "BALANCESTATUS";
  1387. private string ADJUSTPRICEREASON = "ADJUSTPRICEREASON";
  1388. private string BALANCESTATUS_INIT = "0";
  1389. private string BALANCESTATUS_AFFRIM = "2";
  1390. private string BALANCESTATUS_INVOINCE = "3";
  1391. private string[] GetGrid2DataStruct()
  1392. {
  1393. return new string[]
  1394. {
  1395. "ORDERNO",
  1396. "PLY",
  1397. "WIDTH",
  1398. "LENGTH",
  1399. "STEELCODE",
  1400. "WEIGHT",
  1401. "QUANTITY",
  1402. "BASEPRICE",
  1403. "PRICE",
  1404. "MONEY",
  1405. "HOISTINGFEE",
  1406. "CARFMONEY",
  1407. "SHIPPRICE",
  1408. "TRANSMONEYQC",
  1409. "TRANSMONEYSY1",
  1410. "TRANSMONETRAIN"
  1411. }
  1412. ;
  1413. }
  1414. private Hashtable GetColumnAndCaption()
  1415. {
  1416. Hashtable hs = new Hashtable();
  1417. hs.Add("SHIPNO", "船号");
  1418. hs.Add("WEIGHT", "重量");
  1419. hs.Add("DOCKCODE", "港口");
  1420. hs.Add("TRANSMONEYSY1", "船运费");
  1421. hs.Add("SHIPPRICE", "船运价");
  1422. hs.Add("PLY", "厚/直径/壁厚");
  1423. hs.Add("WIDTH", "宽/外径");
  1424. hs.Add("HOISTINGFEE", "吊装费");
  1425. hs.Add("TRANSMONETRAIN", "火运费");
  1426. hs.Add("ORD_NO", "合同号");
  1427. hs.Add("ORD_SEQ", "合同行");
  1428. hs.Add("ORD_LN_DLY", "交货行");
  1429. hs.Add("ASKPLAN_ID", "提单号");
  1430. hs.Add("ASKPLAN_ID_SEQ", "提单序号");
  1431. hs.Add("SPETKEY", "规格");
  1432. hs.Add("STEELCODEKEY", " 钢级(牌号)");
  1433. hs.Add("ADJUSTPRICEPERSON", "调价人");
  1434. hs.Add("ADJUSTPRICEREASON", "调价原因");
  1435. hs.Add("AFFRIMPERSON", "末次确认人");
  1436. hs.Add("AFFIRMTIME", "末次确认时间");
  1437. hs.Add("AFFRIMPERSON_ORG", "首次确认人");
  1438. hs.Add("AFFIRMTIME_ORG", "首次确认时间");
  1439. hs.Add("BASEPRICE", "订单价");
  1440. hs.Add("FORECORPCODE", "子公司");
  1441. hs.Add("STATIONCODE", "到站");
  1442. hs.Add("BUYERNAME", "结算单位名称");
  1443. hs.Add("BUYERCODE", "客户编码");
  1444. hs.Add("CUSTOMER_NM", "订货单位");
  1445. hs.Add("TRANS_TYPE_NAME", "运输方式");
  1446. hs.Add("MONEY_ORG", "首次结算金额");
  1447. hs.Add("PRICE_ORG", "首次结算价");
  1448. hs.Add("CATEGORY", "品名");
  1449. hs.Add("SPEC_ABBSYMNAME", "标准");
  1450. hs.Add("STD_STYLE_DESC", "标准类别");
  1451. hs.Add("MODEL_DESC", "扣型");
  1452. hs.Add("ORDER_UNIT", "计量单位");
  1453. hs.Add("SALE_AREA_DESC", "销售区域");
  1454. hs.Add("SEND_NUM", "实发量");
  1455. hs.Add("CONTAIN_TAX", "是否含税");
  1456. hs.Add("BALANCESTATUS_ORG", "首次结算状态");
  1457. hs.Add("FST_DRAWEE_UNIT", "首次受票人");
  1458. hs.Add("INVOICENO_ORG", "首次结算单号");
  1459. hs.Add("REALINVOICENO_ORG", "首次真实单号");
  1460. hs.Add("BALNCE_PRICE_STS", "末次价格有效性");
  1461. hs.Add("BALNCE_PRICE_ORG_STS", "首次价格有效性");
  1462. hs.Add("PACTINDEX", "钢种");
  1463. hs.Add("OUTWEIGHT", "出库费(重量)");
  1464. hs.Add("OUTSTOCKMNY", "出库费(金额)");
  1465. hs.Add("MONEY_TYPE", "类型");
  1466. hs.Add("SUPPLY_UNIT_DESC", "制造商");
  1467. return hs;
  1468. }
  1469. protected override List<string> GetGridColumnListHidden()
  1470. {
  1471. List<string> list = new List<string>();
  1472. list.Add(this.ASKPLAN_ID_SEQ);
  1473. list.Add(this.BALANCESTATUS);
  1474. return list;
  1475. }
  1476. private void SetGridShowLength()
  1477. {
  1478. Hashtable hs = StaticData.TbColumnAndCaption.GetDataSetColumnLength();
  1479. try
  1480. {
  1481. foreach (string s in hs.Keys)
  1482. {
  1483. try
  1484. {
  1485. this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].Width =
  1486. (int) Util.ConverObject.ConvertToDouble(hs[s]);
  1487. }
  1488. catch
  1489. { }
  1490. try
  1491. {
  1492. // this.ultraGrid2.DisplayLayout.Bands[0].Columns[s].Width = (int)Util.ConverObject.ConvertToDouble(hs[s]);
  1493. }
  1494. catch
  1495. { }
  1496. try
  1497. {
  1498. this.ultraGrid3.DisplayLayout.Bands[0].Columns[s].Width = (int)Util.ConverObject.ConvertToDouble(hs[s]);
  1499. }
  1500. catch
  1501. { }
  1502. }
  1503. }
  1504. catch
  1505. { }
  1506. }
  1507. private string[] GetGridFiveDataStruct()
  1508. {
  1509. return new string[]
  1510. {
  1511. "TICKETTYPE",
  1512. "MONEY",
  1513. // "TICKETNUM",
  1514. "MONEY_TYPE",
  1515. "TRANS_TYPE",
  1516. // "MOTORMANNAME",
  1517. "REG_ID",
  1518. "REG_DTIME",
  1519. "AFFRIM_ID",
  1520. "AFFRIM_TIME",
  1521. "STATUS_CD"
  1522. };
  1523. }
  1524. protected override Hashtable GetGridColumnLength()
  1525. {
  1526. return StaticData.TbColumnAndCaption.GetDataSetColumnLength();
  1527. }
  1528. private void QueryGridThree()
  1529. {
  1530. this.dsGridThree.Clear();
  1531. if (this.ultraGrid1.Rows.Count == 0)
  1532. return;
  1533. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  1534. if (ugr == null)
  1535. ugr = this.ultraGrid1.Rows[0];
  1536. string orderno = ugr.Cells[this.ORD_NO].Value.ToString();
  1537. string orderseq = ugr.Cells[this.ORD_SEQ].Value.ToString();
  1538. string orderlineseq = ugr.Cells[this.ORD_LN_DLY].Value.ToString();
  1539. string askplanid = ugr.Cells[this.ASKPLAN_ID].Value.ToString();
  1540. string askplanidseq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString();
  1541. string spetkey = ugr.Cells[this.SPETKEY].Value.ToString();
  1542. string steelkey = ugr.Cells[this.STEELCODEKEY].Value.ToString();
  1543. DataSet dsDetail =
  1544. this.slmBalanceInfo.GetSlmBalanceDetailAllGroupByBatchNo(
  1545. orderno, orderseq, orderlineseq, askplanid, askplanidseq, spetkey, steelkey);
  1546. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridThree, dsDetail);
  1547. }
  1548. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  1549. {
  1550. QueryGridThree();
  1551. QueryGridFive();
  1552. QueryGridFour();
  1553. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  1554. if (this.ultraGrid1.Rows.Count == 0)
  1555. return;
  1556. if (this.ultraGrid1.Rows.Count == 1)
  1557. ugr = this.ultraGrid1.Rows[0];
  1558. else
  1559. ugr = this.ultraGrid1.ActiveRow;
  1560. double price = Util.ConverObject.ConvertToDouble(ugr.Cells[this.PRICE].Value);
  1561. string adjustReason = ugr.Cells[this.ADJUSTPRICEREASON].Value.ToString();
  1562. this.ultraNumericEditor1.Value = price;
  1563. this.textBox2.Text = adjustReason;
  1564. }
  1565. private void FrmBalanceTicketMgt_Shown(object sender, EventArgs e)
  1566. {
  1567. HiddenToolbars();
  1568. if (!(base.GetSaleOrgDesc() == "国贸公司"))
  1569. {
  1570. string[] keys = new string[] { "QueryOrg", "AffrimOrg", "UnAffrimOrg",
  1571. "InvoiceOrg","SetPriceOrg","ExportPrice","Export","AcpRllRecord"};
  1572. try
  1573. {
  1574. foreach (string s in keys)
  1575. {
  1576. toolMenu.Toolbars[0].Tools[s].SharedProps.Visible = true;
  1577. }
  1578. }
  1579. catch
  1580. { }
  1581. try
  1582. {
  1583. if (cusInfo == "2")
  1584. {
  1585. toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = true;
  1586. toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = true;
  1587. // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = true;
  1588. }
  1589. else
  1590. {
  1591. toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = false;
  1592. toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = false;
  1593. // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = false;
  1594. }
  1595. }
  1596. catch
  1597. {
  1598. }
  1599. }
  1600. }
  1601. private void ultraGrid1_AfterRowActivate_1(object sender, EventArgs e)
  1602. {
  1603. QueryGridThree();
  1604. QueryGridFive();
  1605. QueryGridFour();
  1606. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  1607. if (this.ultraGrid1.Rows.Count == 0)
  1608. return;
  1609. if (this.ultraGrid1.Rows.Count == 1)
  1610. ugr = this.ultraGrid1.Rows[0];
  1611. else
  1612. ugr = this.ultraGrid1.ActiveRow;
  1613. double price = Util.ConverObject.ConvertToDouble(ugr.Cells[this.PRICE].Value);
  1614. string adjustReason = ugr.Cells[this.ADJUSTPRICEREASON].Value.ToString();
  1615. this.ultraNumericEditor1.Value = price;
  1616. this.textBox2.Text = adjustReason;
  1617. }
  1618. private void groupBox1_Enter(object sender, EventArgs e)
  1619. {
  1620. }
  1621. private void textBox7_KeyPress(object sender, KeyPressEventArgs e)
  1622. {
  1623. if (e.KeyChar == 13)
  1624. {
  1625. if (cusInfo == "2")
  1626. this.Query();
  1627. else
  1628. this.QueryOrg();
  1629. }
  1630. }
  1631. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  1632. {
  1633. if (e.KeyChar == 13)
  1634. {
  1635. if (cusInfo == "2")
  1636. this.Query();
  1637. else
  1638. this.QueryOrg();
  1639. }
  1640. }
  1641. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  1642. {
  1643. if (cusInfo == "2")
  1644. this.Query();
  1645. else
  1646. this.QueryOrg();
  1647. }
  1648. private void radioButton2_CheckedChanged(object sender, EventArgs e)
  1649. {
  1650. if (cusInfo == "2")
  1651. this.Query();
  1652. else
  1653. this.QueryOrg();
  1654. }
  1655. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  1656. {
  1657. }
  1658. private void SetToolBars()
  1659. {
  1660. string[] keys = new string[] { "QueryOrg", "AffrimOrg", "UnAffrimOrg",
  1661. "InvoiceOrg","SetPriceOrg","ExportPrice","Export"};
  1662. if (ultraTabControl1.SelectedTab.Index == 0)
  1663. {
  1664. this.textBox1.ReadOnly = true;
  1665. this.radioButton1.Visible = false;
  1666. this.radioButton2.Visible = false;
  1667. try
  1668. {
  1669. toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = true;
  1670. toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = true;
  1671. // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = false;
  1672. }
  1673. catch
  1674. {
  1675. }
  1676. foreach (string s in keys)
  1677. {
  1678. try
  1679. {
  1680. toolMenu.Toolbars[0].Tools[s].SharedProps.Visible = false;
  1681. }
  1682. catch
  1683. {
  1684. }
  1685. }
  1686. }
  1687. if (ultraTabControl1.SelectedTab.Index == 1)
  1688. {
  1689. this.textBox1.ReadOnly = false;
  1690. this.radioButton1.Visible = true;
  1691. this.radioButton2.Visible = true;
  1692. try
  1693. {
  1694. toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = false;
  1695. toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = false;
  1696. // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = true;
  1697. }
  1698. catch
  1699. {
  1700. }
  1701. foreach (string s in keys)
  1702. {
  1703. try
  1704. {
  1705. toolMenu.Toolbars[0].Tools[s].SharedProps.Visible = true;
  1706. }
  1707. catch
  1708. {
  1709. }
  1710. }
  1711. }
  1712. }
  1713. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  1714. {
  1715. if (cusInfo == "2")
  1716. {
  1717. if (ultraTabControl1.SelectedTab.Index == 0)
  1718. {
  1719. this.textBox1.ReadOnly = true;
  1720. this.radioButton1.Visible = false;
  1721. this.radioButton2.Visible = false;
  1722. try
  1723. {
  1724. toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = true;
  1725. toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = true;
  1726. // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = false;
  1727. toolMenu.Toolbars[0].Tools["Affrim"].SharedProps.Visible = false;
  1728. toolMenu.Toolbars[0].Tools["UnAffrim"].SharedProps.Visible = false;
  1729. toolMenu.Toolbars[0].Tools["Invoice"].SharedProps.Visible = false;
  1730. toolMenu.Toolbars[0].Tools["SetPrice"].SharedProps.Visible = false;
  1731. // toolMenu.Toolbars[0].Tools["Export"].SharedProps.Visible = false;
  1732. toolMenu.Toolbars[0].Tools["Query"].SharedProps.Visible = false;
  1733. }
  1734. catch
  1735. { }
  1736. }
  1737. else
  1738. {
  1739. try
  1740. {
  1741. this.textBox1.ReadOnly = false;
  1742. this.radioButton1.Visible = true;
  1743. this.radioButton2.Visible = true;
  1744. toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = false;
  1745. toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = false;
  1746. toolMenu.Toolbars[0].Tools["Affrim"].SharedProps.Visible = true;
  1747. toolMenu.Toolbars[0].Tools["UnAffrim"].SharedProps.Visible = true;
  1748. toolMenu.Toolbars[0].Tools["Invoice"].SharedProps.Visible = true;
  1749. toolMenu.Toolbars[0].Tools["SetPrice"].SharedProps.Visible = true;
  1750. toolMenu.Toolbars[0].Tools["Export"].SharedProps.Visible = true;
  1751. // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = true;
  1752. try
  1753. {
  1754. toolMenu.Toolbars[0].Tools["Query"].SharedProps.Visible = true;
  1755. }
  1756. catch
  1757. { }
  1758. try
  1759. {
  1760. toolMenu.Toolbars[0].Tools["AcpRllRecord"].SharedProps.Visible = true;
  1761. }
  1762. catch
  1763. { }
  1764. }
  1765. catch
  1766. { }
  1767. }
  1768. }
  1769. else if (cusInfo == "3")
  1770. SetToolBars();
  1771. }
  1772. private void ultraGrid1_AfterRowActivate_2(object sender, EventArgs e)
  1773. {
  1774. QueryGridThree();
  1775. // QueryGridFive();
  1776. // QueryGridFour();
  1777. Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null;
  1778. if (this.ultraGrid1.Rows.Count == 0)
  1779. return;
  1780. if (this.ultraGrid1.Rows.Count == 1)
  1781. ugr = this.ultraGrid1.Rows[0];
  1782. else
  1783. ugr = this.ultraGrid1.ActiveRow;
  1784. double price = Util.ConverObject.ConvertToDouble(ugr.Cells[this.PRICE].Value);
  1785. string adjustReason = ugr.Cells[this.ADJUSTPRICEREASON].Value.ToString();
  1786. this.ultraNumericEditor1.Value = price;
  1787. this.textBox2.Text = adjustReason;
  1788. }
  1789. }
  1790. }