frmPipeTrainBill.cs 118 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.StlMes.Client.YdmBase;
  11. using Core.Mes.Client.Comm.Tool;
  12. using System.Collections;
  13. using Core.Mes.Client.Comm.Server;
  14. using Core.Mes.Client.Comm.Control;
  15. using Infragistics.Win.UltraWinGrid;
  16. using Infragistics.Win;
  17. using Core.StlMes.Client.PipeLeaveFactory.YdmObject;
  18. using Core.Mes.Client.Comm.Format;
  19. using com.steering.pss.ydm.entity;
  20. using Core.StlMes.Client.PipeLeaveFactory.Tool;
  21. using Core.StlMes.Client.SaleOrder.ReviewForm;
  22. using Core.StlMes.Client.YdmPipeManage;
  23. using Infragistics.Win.UltraWinEditors;
  24. using Core.StlMes.Client.PipeLeaveFactory.Dialog;
  25. namespace Core.StlMes.Client.PipeLeaveFactory
  26. {
  27. public partial class frmPipeTrainBill : FrmBase
  28. {
  29. /// <summary>
  30. /// 销售权限
  31. /// </summary>
  32. private string[] _salgPersion = null;
  33. /// <summary>
  34. /// 提示信息
  35. /// </summary>
  36. private string errMessage = "";
  37. ArrayList pram = new ArrayList();
  38. private string _sendPlanNo = "";
  39. private string _ordLnDlyPk = "";
  40. private string _ordLnDlyPkSoure = "";
  41. private string _billNo = "";
  42. private string departid;//对应部门ID
  43. private string departname;//对应部门
  44. private string management_no;//对应科室id
  45. private string management_name;//对应科室
  46. public frmPipeTrainBill()
  47. {
  48. InitializeComponent();
  49. this.IsLoadUserView = true;
  50. }
  51. UltraComboEditor uceVstel = new UltraComboEditor();//装车地点
  52. UltraComboEditor uceStorag = new UltraComboEditor();//出库地点
  53. UltraComboEditor uceLoad = new UltraComboEditor();
  54. UltraComboEditor uceDelvryN = new UltraComboEditor();//发货去向
  55. private void frmPipeTrainBill_Load(object sender, EventArgs e)
  56. {
  57. _salgPersion = BaseHelper.InitPermissions(this.ValidDataPurviewIds, this.ob);
  58. BaseHelper.setOtherColumnReadOnly(ultraGridSendPlan, new string[] { "" });
  59. BaseHelper.setOtherColumnReadOnly(ultraGridOrder, new string[] { "" });
  60. BaseHelper.setOtherColumnReadOnly(ultraGridSourse, new string[] { "CHC", "ActCount", "Vstel", "SendNum" });
  61. BaseHelper.setOtherColumnReadOnly(ultraGridBillM, new string[] { "CHC", "DelvryWhereabouts", "Realinvoiceno1" });
  62. BaseHelper.setOtherColumnReadOnly(ultraGridBillC, new string[] { "CANCELDOWN", "StorageNo", "CHK", "Vstel" });
  63. EntityHelper.ShowGridCaption<MatInfoEntity>(ultraGridSourse.DisplayLayout.Bands[0]);
  64. EntityHelper.ShowGridCaption<YdmZcBillMEntity>(ultraGridBillM.DisplayLayout.Bands[0]);
  65. EntityHelper.ShowGridCaption<YdmZcBillCEntity>(ultraGridBillC.DisplayLayout.Bands[0]);
  66. //EntityHelper.ShowGridCaption<PipeMatGpMEntity>(ultraGridPipeMat.DisplayLayout.Bands[0]);
  67. BillBtime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
  68. BillEtime.Value = DateTime.Parse(DateTime.Now.AddDays(10).ToString("yyyy-MM-dd"));
  69. DateTime now = DateTime.Now;
  70. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  71. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  72. billNoStime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  73. BillNoEtime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  74. YdmBaseClass.SetComboItemHeight(ComStatus);
  75. YdmBaseClass.SetComboItemHeight(ComBillStratus);
  76. BaseHelper.InitCellPosition(ultraGridSendPlan, new string[] { "PLAN_WT" });
  77. BaseHelper.InitCellPosition(ultraGridOrder, new string[] { "PREP_WT", "PLAN_WT", "WGT_ESTMT" });
  78. BaseHelper.InitCellPosition(ultraGridSourse, new string[] { "ActCount", "ActWeight", "YbCount", "YbWeight", "KcCount", "KcWeight", "ActLen", "YbLen", "KcLen", "SendNum" });
  79. BaseHelper.InitCellPosition(ultraGridBillM, new string[] { "PlanWt", "PlanNum", "PlanTotlLen", "SendNum" });
  80. BaseHelper.InitCellPosition(ultraGridBillC, new string[] { "ActHeight", "ActDimater", "ActLenMin1", "ActLenMax1", "ActCount", "ActWeight", "PrepWeight", "PrepCount", "BeenCount", "BeenWeight", "PrepLen", "BeenLen", "ActLen", "SendNum" });
  81. DoInitComDrop();
  82. BaseHelper.setUltraGridColumnColor(ultraGridSourse, new string[] { "ActCount", "Vstel", "ActLen", "SendNum" }, Color.FromArgb(255, 255, 192));
  83. BaseHelper.InitYear(ComYear);
  84. BaseHelper.InitMonth(ComMonth);
  85. ComYear.Value = DateTime.Now.Year.ToString();
  86. ComMonth.Value = string.Format("{0:00}", DateTime.Now.Month);
  87. BaseHelper.setUltraGridColumnMaxInput(ultraGridSendPlan, new string[] { "PLAN_WT" });
  88. BaseHelper.setUltraGridColumnMaxInput(ultraGridOrder, new string[] { "PLAN_WT", "PREP_WT", "WGT_ESTMT" });
  89. BaseHelper.setUltraGridColumnMaxInput(ultraGridSourse, new string[] { "ActWeight", "YbWeight", "KcWeight", "SendNum" });
  90. DivideInterface(CustomInfo);
  91. BaseHelper.setUltraGridColumnMaxInput(ultraGridBillM, new string[] { "PlanWt" });
  92. BaseHelper.setUltraGridColumnMaxInput(ultraGridBillC, new string[] { "ActWeight", "PrepWeight", "BeenWeight", "SendNum" });
  93. //长度
  94. BaseHelper.setUltraGridColumnMaxInputLen(ultraGridSourse, new string[] { "ActLen", "YbLen", "KcLen" });
  95. BaseHelper.setUltraGridColumnMaxInputLen(ultraGridBillM, new string[] { "PlanTotlLen", "SendNum" });
  96. BaseHelper.setUltraGridColumnMaxInputLen(ultraGridBillC, new string[] { "PrepLen", "BeenLen", "ActLen" });
  97. //统计字段(吨)
  98. BaseHelper.GridColumnSum(ultraGridOrder, new string[] { "PLAN_WT", "PREP_WT", "WGT_ESTMT" });
  99. BaseHelper.GridColumnSum(ultraGridSourse, new string[] { "ActWeight", "KcWeight", "YbWeight", "SendNum" });
  100. BaseHelper.GridColumnSum(ultraGridBillM, new string[] { "PlanWt", "SendNum" });
  101. BaseHelper.GridColumnSum(ultraGridBillC, new string[] { "ActWeight", "PrepWeight", "BeenWeight", "SendNum" });
  102. BaseHelper.GridColumnSum(ultraGridSendPlan, new string[] { "PLAN_WT" });
  103. //统计字段(支)
  104. BaseHelper.GridColumnCount(ultraGridSourse, new string[] { "ActCount", "KcCount", "YbCount" });
  105. BaseHelper.GridColumnCount(ultraGridBillM, new string[] { "PlanNum" });
  106. BaseHelper.GridColumnCount(ultraGridBillC, new string[] { "ActCount", "PrepCount", "BeenCount" });
  107. //统计字段(长度)
  108. BaseHelper.GridColumnCountLen(ultraGridSourse, new string[] { "ActLen", "YbLen", "KcLen" });
  109. BaseHelper.GridColumnCountLen(ultraGridBillM, new string[] { "PlanTotlLen" });
  110. BaseHelper.GridColumnCountLen(ultraGridBillC, new string[] { "PrepLen", "BeenLen", "ActLen" });
  111. YdmBaseClass.InitComboEditor(uceVstel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  112. YdmBaseClass.BindColumn(uceVstel, "Vstel", this.Controls, this.ultraGridSourse, 0);
  113. YdmBaseClass.InitComboEditor(uceStorag, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  114. YdmBaseClass.BindColumn(uceStorag, "StorageNo", this.Controls, this.ultraGridBillC, 0);
  115. YdmBaseClass.InitComboEditor(uceLoad, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  116. YdmBaseClass.BindColumn(uceLoad, "Vstel", this.Controls, this.ultraGridBillC, 0);
  117. YdmBaseClass.InitComboEditor(uceDelvryN, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  118. YdmBaseClass.BindColumn(uceDelvryN, "DelvryWhereabouts", this.Controls, this.ultraGridBillM, 0);
  119. management_no = this.UserInfo.GetDeptid();
  120. management_name = this.UserInfo.GetDepartment();
  121. departid = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
  122. departname = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  123. }
  124. /// <summary>
  125. /// 重写基类方法
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="ToolbarKey"></param>
  129. public override void ToolBar_Click(object sender, string ToolbarKey)
  130. {
  131. switch (ToolbarKey)
  132. {
  133. case "Query":
  134. DoQuery();
  135. break;
  136. case "Add":
  137. DoAddBill();
  138. break;
  139. case "Update":
  140. DoDelete();
  141. break;
  142. case "Down":
  143. DoDown();
  144. break;
  145. case "Refresh":
  146. DoInitComDrop();
  147. break;
  148. case "Export":
  149. Export();
  150. break;
  151. case "CancelDown":
  152. CancelDown();
  153. break;
  154. case "BillDrawOff":
  155. BillDrawOff();
  156. break;
  157. case "CancelBillDrawOff":
  158. CancelBillDrawOff();
  159. break;
  160. case "Print":
  161. Print();
  162. break;
  163. case "UpdateStoage":
  164. doUpdateStoage();//修改出库地点
  165. break;
  166. case "UpdateLoad":
  167. doUpdateLoad();//修改装车地点
  168. break;
  169. case "BillOut":
  170. doBillOut();
  171. break;
  172. case "DeleteBillOut":
  173. doDeleteBillOut();//撤销出库
  174. break;
  175. case "UpdateDelvryWhereabouts":
  176. UpdateDelvryWhereabouts();//修改发货去向
  177. break;
  178. case "UpdateRealinvoiceno1":
  179. UpdateRealinvoiceno1();//修改结算状态
  180. break;
  181. case "Close":
  182. this.Close();
  183. break;
  184. }
  185. }
  186. private void UpdateRealinvoiceno1()
  187. {
  188. ultraGridBillC.UpdateData();
  189. ultraGridBillM.UpdateData();
  190. UltraGridRow ugr1 = ultraGridBillM.ActiveRow;
  191. if (ugr1 == null) return;
  192. int count = 0;
  193. ArrayList list1 = new ArrayList();
  194. foreach (UltraGridRow row in ultraGridBillM.Rows)
  195. {
  196. if (Convert.ToBoolean(row.Cells["CHC"].Text) == true)
  197. {
  198. if (row.Cells["saleOrg"].Text != "100102")
  199. {
  200. MessageUtil.ShowTips("请选择要国际贸易部的提单!");
  201. return;
  202. }
  203. count += 1;
  204. ArrayList list = new ArrayList();
  205. list.Add(row.Cells["BillNo"].Value.ToString());
  206. list.Add(row.Cells["Realinvoiceno1"].Text);
  207. list1.Add(list);
  208. }
  209. }
  210. if (count == 0)
  211. {
  212. MessageUtil.ShowTips("请选择要修改提单信息!");
  213. return;
  214. }
  215. if (MessageUtil.ShowYesNoAndQuestion("是否修改结算状态") == DialogResult.No) return;
  216. CoreClientParam ccp = new CoreClientParam();
  217. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  218. ccp.MethodName = "UpdateRealinvoiceno1";
  219. ccp.ServerParams = new object[] { list1 };
  220. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  221. if (ccp.ReturnCode == -1) return;
  222. if (ccp.ReturnInfo.Equals("修改成功!"))
  223. {
  224. DoQuery();
  225. }
  226. }
  227. /// <summary>
  228. /// 修改发货去向
  229. /// </summary>
  230. private void UpdateDelvryWhereabouts()
  231. {
  232. ultraGridBillC.UpdateData();
  233. ultraGridBillM.UpdateData();
  234. UltraGridRow ugr1 = ultraGridBillM.ActiveRow;
  235. if (ugr1 == null) return;
  236. int count = 0;
  237. ArrayList list1 = new ArrayList();
  238. foreach (UltraGridRow row in ultraGridBillM.Rows)
  239. {
  240. if (Convert.ToBoolean(row.Cells["CHC"].Text) == true)
  241. {
  242. count += 1;
  243. ArrayList list = new ArrayList();
  244. list.Add(row.Cells["BillNo"].Value.ToString());
  245. list.Add(row.Cells["DelvryWhereabouts"].Text);
  246. list1.Add(list);
  247. }
  248. }
  249. if (count == 0)
  250. {
  251. MessageUtil.ShowTips("请选择要修改提单信息!");
  252. return;
  253. }
  254. if (MessageUtil.ShowYesNoAndQuestion("是否修改发货去向") == DialogResult.No) return;
  255. CoreClientParam ccp = new CoreClientParam();
  256. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  257. ccp.MethodName = "UpdateDelvryWhereabouts";
  258. ccp.ServerParams = new object[] { list1 };
  259. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  260. if (ccp.ReturnCode == -1) return;
  261. if (ccp.ReturnInfo.Equals("修改成功!"))
  262. {
  263. DoQuery();
  264. }
  265. }
  266. private void Export()
  267. {
  268. if (ultraTabControl1.SelectedTab.Key.Equals("0"))
  269. {
  270. GridHelper.ulGridToExcel(ultraGridSendPlan, "计划信息");
  271. }
  272. else
  273. {
  274. int count = 0;
  275. List<string> _billNo = new List<string>();
  276. foreach (UltraGridRow ugr in ultraGridBillM.Rows)
  277. {
  278. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  279. {
  280. count += 1;
  281. _billNo.Add(ugr.Cells["BillNo"].Text.Trim());
  282. }
  283. }
  284. if (count == 0)
  285. {
  286. MessageUtil.ShowTips("请选择需要导出的提单!");
  287. return;
  288. }
  289. FrmBillDiaLog fpdc = new FrmBillDiaLog(_billNo.ToArray(), ob);
  290. fpdc.AutoSize = true;
  291. fpdc.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  292. fpdc.Text = "导出提单信息";
  293. fpdc.ShowDialog();
  294. }
  295. }
  296. /// <summary>
  297. /// 绑定下拉框数据
  298. /// </summary>
  299. private void DoInitComDrop()
  300. {
  301. //订货单位
  302. BaseHelper.InitOrderUnit(ComRecive, _salgPersion, this.ob);
  303. BaseHelper.InitOrderUnit(ComReceiv1, _salgPersion, this.ob);
  304. //收货单位
  305. BaseHelper.InitReceivingUnit(ComCustomer, _salgPersion, this.ob);
  306. BaseHelper.InitReceivingUnit(ComCustomer1, _salgPersion, this.ob);
  307. //专用线
  308. YdmBaseClass.InitComboEditor(ComSpcl1, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryPrivateSid", "SPCL_LN_NO", ob, false);
  309. YdmBaseClass.InitComboEditor(ComSpcl, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryPrivateSid", "SPCL_LN_NO", ob, false);
  310. //到站
  311. YdmBaseClass.InitComboEditor(ComStation1, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryArriveStation", "STATION_NO", ob, false);
  312. YdmBaseClass.InitComboEditor(ComStation, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryArriveStation", "STATION_NO", ob, false);
  313. }
  314. /// <summary>
  315. /// Checkbox 选择事件
  316. /// </summary>
  317. /// <param name="sender"></param>
  318. /// <param name="e"></param>
  319. private void Chc_CheckedChanged(object sender, EventArgs e)
  320. {
  321. //发运计划
  322. if (ChcApplyTime.Checked) { ComYear.Enabled = true; ComMonth.Enabled = true; } else { ComYear.Enabled = false; ComMonth.Enabled = false; }
  323. if (ChcOrderNo.Checked) { TxtOrderNo.Enabled = true; } else { TxtOrderNo.Enabled = false; }
  324. if (ChcPlanNo.Checked) { TxtPlanNo.Enabled = true; } else { TxtPlanNo.Enabled = false; }
  325. if (ChcStation.Checked) { ComStation.Enabled = true; } else { ComStation.Enabled = false; }
  326. if (ChcSpcl.Checked) { ComSpcl.Enabled = true; } else { ComSpcl.Enabled = false; }
  327. if (ChcRecive.Checked) { ComRecive.Enabled = true; } else { ComRecive.Enabled = false; }
  328. if (ChcCustomer.Checked) { ComCustomer.Enabled = true; } else { ComCustomer.Enabled = false; }
  329. if (ChcStatus.Checked) { ComStatus.Enabled = true; } else { ComStatus.Enabled = false; }
  330. if (ChcBillNo.Checked) { TxtBillNo.Enabled = true; } else { TxtBillNo.Enabled = false; }
  331. //提单
  332. if (ChcBillTime.Checked) { billNoStime.Enabled = true; BillNoEtime.Enabled = true; } else { billNoStime.Enabled = false; BillNoEtime.Enabled = false; }
  333. if (ChcBillNo1.Checked) { TxtBillNo1.Enabled = true; } else { TxtBillNo1.Enabled = false; }
  334. if (ChcPlanNo1.Checked) { TxtPlanNo1.Enabled = true; } else { TxtPlanNo1.Enabled = false; }
  335. if (ChcReceiv1.Checked) { ComReceiv1.Enabled = true; } else { ComReceiv1.Enabled = false; }
  336. if (ChcSpcl1.Checked) { ComSpcl1.Enabled = true; } else { ComSpcl1.Enabled = false; }
  337. if (ChkStation1.Checked) { ComStation1.Enabled = true; } else { ComStation1.Enabled = false; }
  338. if (ChcCustomer1.Checked) { ComCustomer1.Enabled = true; } else { ComCustomer1.Enabled = false; }
  339. if (ChcOrderNo1.Checked) { TxtOrderNo1.Enabled = true; } else { TxtOrderNo1.Enabled = false; }
  340. if (ChcBillStatus.Checked) { ComBillStratus.Enabled = true; } else { ComBillStratus.Enabled = false; }
  341. if (ChcReceiv1.Checked) { ComReceiv1.Enabled = true; } else { ComReceiv1.Enabled = false; }
  342. }
  343. /// <summary>
  344. /// 初始化提单号
  345. /// </summary>
  346. /// <param name="sendPlanNo">计划号</param>
  347. private void InitBillNo(string sendPlanNo)
  348. {
  349. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillNoBySendPlanNo", new object[] { sendPlanNo, "110502" }, this.ob);
  350. DataRow dr = dt.NewRow();
  351. dr["BILL_NO"] = "";
  352. dr["BILL_NO"] = "";
  353. dt.Rows.Add(dr);
  354. ComBillNo.DataSource = dt;
  355. ComBillNo.DisplayMember = "BILL_NO";
  356. ComBillNo.ValueMember = "BILL_NO";
  357. }
  358. /// <summary>
  359. /// 发运计划查询条件
  360. /// </summary>
  361. /// <returns></returns>
  362. private ArrayList QuerySendPlanCondition()
  363. {
  364. ArrayList param = new ArrayList();
  365. string applytime = "";
  366. string orderNo = "";
  367. string sendPlanNo = "";
  368. string station = "";
  369. string spcl = "";
  370. string reciveName = "";
  371. string customerName = "";
  372. string billNo = "";
  373. string status = "";
  374. if (ChcApplyTime.Checked && ComYear.Value != null && ComMonth.Value != null)
  375. {
  376. applytime = ComYear.Value.ToString() + ComMonth.Value.ToString();
  377. }
  378. if (ChcOrderNo.Checked)
  379. {
  380. orderNo = TxtOrderNo.Text.Trim();
  381. }
  382. if (ChcPlanNo.Checked)
  383. {
  384. sendPlanNo = TxtPlanNo.Text.Trim();
  385. }
  386. if (ChcStation.Checked && ComStation.Value != null)
  387. {
  388. station = ComStation.Value.ToString();
  389. }
  390. if (ChcSpcl.Checked && ComSpcl.Value != null)
  391. {
  392. spcl = ComSpcl.Value.ToString();
  393. }
  394. if (ChcRecive.Checked)
  395. {
  396. reciveName = ComRecive.Text.Trim();
  397. }
  398. if (ChcCustomer.Checked)
  399. {
  400. customerName = ComCustomer.Text.Trim();
  401. }
  402. if (ChcBillNo.Checked)
  403. {
  404. billNo = TxtBillNo.Text.Trim();
  405. }
  406. if (ChcStatus.Checked && ComStatus.Value != null)
  407. {
  408. status = ComStatus.Value.ToString().Trim();
  409. }
  410. if (!ChcApplyTime.Checked && orderNo.Equals("") && sendPlanNo.Equals("") && station.Equals("") && spcl.Equals("") && reciveName.Equals("") && customerName.Equals("") && status.Equals("") && billNo.Equals(""))
  411. {
  412. errMessage = "请至少选择一个查询条件!";
  413. return null;
  414. }
  415. param.Add(applytime);
  416. param.Add(orderNo);
  417. param.Add(sendPlanNo);
  418. param.Add(station);
  419. param.Add(spcl);
  420. param.Add(reciveName);
  421. param.Add(customerName);
  422. param.Add(billNo);
  423. param.Add(status);
  424. return param;
  425. }
  426. /// <summary>
  427. /// 查询发运计划
  428. /// </summary>
  429. private void QuerySendPlan()
  430. {
  431. ArrayList param = QuerySendPlanCondition();
  432. if (param == null)
  433. {
  434. MessageUtil.ShowTips(errMessage);
  435. return;
  436. }
  437. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.querySendPlan", new object[] { param, this.ValidDataPurviewIds }, this.ob);
  438. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  439. if (dt.Rows.Count == 0)
  440. {
  441. GridHelper.ClearGridDataSourceData(ultraGridOrder);
  442. GridHelper.ClearGridDataSourceData(ultraGridSourse);
  443. }
  444. }
  445. /// <summary>
  446. /// 查询合同信息
  447. /// </summary>
  448. /// <param name="sendPlanNo">计划号</param>
  449. /// <param name="sendDayPlanNo">日计划号</param>
  450. private void QueryOrderInfo(string sendPlanNo)
  451. {
  452. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.queryOrderInfo", new object[] { sendPlanNo }, this.ob);
  453. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  454. }
  455. /// <summary>
  456. /// 查询仓库资源信息
  457. /// </summary>
  458. /// <param name="ordPk">合同主键</param>
  459. /// <param name="ordLnPk">合同行主键</param>
  460. /// <param name="ordLnDlyPk">交货行主键</param>
  461. private void QuerySourse(UltraGridRow row,string ordPk, string ordLnPk, string ordLnDlyPk)
  462. {
  463. List<MatInfoEntity> listSourse = EntityHelper.GetData<MatInfoEntity>("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.querySourse", new object[] { ordPk, ordLnPk, ordLnDlyPk }, this.ob);
  464. matInfoEntityBindingSource.DataSource = listSourse;
  465. UltraGridColumn[] col = new UltraGridColumn[] { ultraGridSourse.DisplayLayout.Bands[0].Columns["StdName"], ultraGridSourse.DisplayLayout.Bands[0].Columns["CHC"],
  466. ultraGridSourse.DisplayLayout.Bands[0].Columns["ActCount"], ultraGridSourse.DisplayLayout.Bands[0].Columns["YbCount"],ultraGridSourse.DisplayLayout.Bands[0].Columns["Vstel"] };
  467. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGridSourse, col);
  468. foreach (UltraGridRow ugr in ultraGridSourse.Rows)
  469. {
  470. ugr.Cells["Vstel"].Value = ugr.Cells["StorageNo"].Value.ToString();
  471. }
  472. if (row.Cells["ORDER_UNIT"].Text.Equals("米") || row.Cells["ORDER_UNIT"].Text.Equals("英尺"))
  473. {
  474. foreach (UltraGridRow ugr1 in ultraGridSourse.Rows)
  475. {
  476. ugr1.Cells["SendNum"].Value = ugr1.Cells["ActLen"].Value.ToString();
  477. ugr1.Cells["SendNum"].Appearance.BackColor = Color.FromArgb(255, 255, 192);
  478. ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.None;
  479. ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  480. }
  481. }
  482. else if (row.Cells["ORDER_UNIT"].Text.Equals("支") || row.Cells["ORDER_UNIT"].Text.Equals("个"))
  483. {
  484. foreach (UltraGridRow ugr1 in ultraGridSourse.Rows)
  485. {
  486. ugr1.Cells["SendNum"].Value = ugr1.Cells["ActCount"].Value.ToString();
  487. ugr1.Cells["SendNum"].Appearance.BackColor = Color.Transparent;
  488. ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.Default;
  489. ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  490. }
  491. }
  492. else
  493. {
  494. foreach (UltraGridRow ugr1 in ultraGridSourse.Rows)
  495. {
  496. ugr1.Cells["SendNum"].Appearance.BackColor = Color.Transparent;
  497. ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.Default;
  498. ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  499. ugr1.Cells["SendNum"].Value = ugr1.Cells["ActWeight"].Value.ToString();
  500. }
  501. }
  502. }
  503. /// <summary>
  504. /// 查询
  505. /// </summary>
  506. private void DoQuery()
  507. {
  508. if (ultraTabControl1.SelectedTab.Key.Equals("0"))
  509. {
  510. if (!ValidQuery()) return;
  511. QuerySendPlan();
  512. }
  513. else
  514. {
  515. if (!ValidQuery1()) return;
  516. QueryBillMInfo();
  517. }
  518. }
  519. private void ultraGridSendPlan_AfterRowActivate(object sender, EventArgs e)
  520. {
  521. UltraGridRow ugr = ultraGridSendPlan.ActiveRow;
  522. if (ugr == null)
  523. {
  524. ComBillNo.DataSource = null;
  525. return;
  526. }
  527. else
  528. {
  529. string sendPlanNo = ugr.Cells["SEND_PLAN_NO"].Text;
  530. QueryOrderInfo(sendPlanNo);
  531. InitBillNo(sendPlanNo);
  532. BaseHelper.UltraGridLocation(ultraGridOrder, new string[] { "ORD_LN_DLY_PK" }, new string[] { _ordLnDlyPk });
  533. _ordLnDlyPk = "";
  534. }
  535. PraFlag.Checked = false;
  536. }
  537. private void ultraGridOrder_AfterRowActivate(object sender, EventArgs e)
  538. {
  539. UltraGridRow ugr = ultraGridOrder.ActiveRow;
  540. if (ugr == null)
  541. {
  542. return;
  543. }
  544. else
  545. {
  546. if (ultraGridSendPlan.ActiveRow.Cells["SUPPLY_UNIT"].Value.ToString() != "120504")
  547. {
  548. ChcVirtual.Checked = false;
  549. if (!string.IsNullOrWhiteSpace(ugr.Cells["OUTBOUND_CALCULATE"].Text.ToString2()))
  550. {
  551. PraFlag.Enabled = false;
  552. if (!ugr.Cells["OUTBOUND_CALCULATE"].Text.ToString2().Equals("0"))
  553. {
  554. PraFlag.Checked = true;
  555. }
  556. }
  557. else
  558. {
  559. PraFlag.Enabled = true;
  560. PraFlag.Checked = false;
  561. }
  562. }
  563. string ordPk = ugr.Cells["ORD_PK"].Text;
  564. string ordLnPk = ugr.Cells["ORD_LN_PK"].Text;
  565. string ordLnDlyPk = ugr.Cells["ORD_LN_DLY_PK"].Text;
  566. //if (!ugr.Cells["PRD_CLS"].Text.Equals("405005"))//判断是否坯子
  567. //{
  568. ultraGridPipeMat.Visible = false;
  569. ultraGridSourse.Visible = true;
  570. QuerySourse(ugr, ordPk, ordLnPk, ordLnDlyPk);
  571. BaseHelper.UltraGridLocation(ultraGridSourse, new string[] { "OrdLnDlyPk" }, new string[] { _ordLnDlyPkSoure });
  572. //}
  573. //else
  574. //{
  575. // ultraGridPipeMat.Visible = true;
  576. // ultraGridSourse.Visible = false;
  577. // QueryPipeMat(ugr, ordLnDlyPk);
  578. // BaseHelper.UltraGridLocation(ultraGridPipeMat, new string[] { "OrdLnDlyPk" }, new string[] { _ordLnDlyPkSoure });
  579. //}
  580. _ordLnDlyPkSoure = "";
  581. }
  582. ultraGroupBox4.Text = "资源信息区";
  583. }
  584. /// <summary>
  585. /// 查询管坯库存
  586. /// </summary>
  587. /// <param name="row"></param>
  588. /// <param name="ordLnDlyPk"></param>
  589. private void QueryPipeMat(UltraGridRow row, string ordLnDlyPk)
  590. {
  591. EntityHelper.ShowGridCaption<PipeMatGpMEntity>(ultraGridPipeMat.DisplayLayout.Bands[0]);
  592. YdmBaseClass.InitComboEditor(uceVstel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  593. YdmBaseClass.BindColumn(uceVstel, "Vstel", this.Controls, this.ultraGridPipeMat, 0);
  594. BaseHelper.setUltraGridColumnMaxInput(ultraGridPipeMat, new string[] { "ActWeight", "YbWeight", "KcWeight", "SendNum" });
  595. List<PipeMatGpMEntity> listSourse = EntityHelper.GetData<PipeMatGpMEntity>("com.steering.pss.ydm.acasleavefactory.CoreCasCarBill.queryPipeMat", new object[] { ordLnDlyPk }, this.ob);
  596. pipeMatGpMbindingSource.DataSource = listSourse;
  597. UltraGridColumn[] col = new UltraGridColumn[] {ultraGridPipeMat.DisplayLayout.Bands[0].Columns["CHK"],
  598. ultraGridPipeMat.DisplayLayout.Bands[0].Columns["ActCount"], ultraGridPipeMat.DisplayLayout.Bands[0].Columns["YbCount"],ultraGridPipeMat.DisplayLayout.Bands[0].Columns["Vstel"] };
  599. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGridPipeMat, col);
  600. foreach (UltraGridRow ugr in ultraGridPipeMat.Rows)
  601. {
  602. ugr.Cells["Vstel"].Value = ugr.Cells["StorageNo"].Value.ToString();
  603. }
  604. if (row.Cells["ORDER_UNIT"].Text.Equals("米") || row.Cells["ORDER_UNIT"].Text.Equals("英尺"))
  605. {
  606. foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows)
  607. {
  608. ugr1.Cells["SendNum"].Appearance.BackColor = Color.FromArgb(255, 255, 192);
  609. ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.None;
  610. ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  611. }
  612. }
  613. else if (row.Cells["ORDER_UNIT"].Text.Equals("支") || row.Cells["ORDER_UNIT"].Text.Equals("个"))
  614. {
  615. foreach (UltraGridRow ugr1 in ultraGridSourse.Rows)
  616. {
  617. ugr1.Cells["SendNum"].Value = ugr1.Cells["ActCount"].Value.ToString();
  618. ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  619. }
  620. }
  621. else
  622. {
  623. foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows)
  624. {
  625. ugr1.Cells["SendNum"].Appearance.BackColor = Color.FromArgb(255, 255, 192);
  626. ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.None;
  627. ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  628. ugr1.Cells["SendNum"].Value = ugr1.Cells["ActWeight"].Value.ToString();
  629. }
  630. }
  631. }
  632. /// <summary>
  633. /// 提单查询条件
  634. /// </summary>
  635. /// <returns>ArrayList</returns>
  636. private ArrayList QueryBillCondition()
  637. {
  638. ArrayList param = new ArrayList();
  639. string billStime = "2000-01-01 00:00:00";
  640. string billEtime = "2100-12-30 00:00:00";
  641. string orderNo = "";
  642. string sendPlanNo = "";
  643. string station = "";
  644. string spcl = "";
  645. string reciveName = "";
  646. string customerName = "";
  647. string billNo = "";
  648. string status = "";
  649. if (ChcBillTime.Checked)
  650. {
  651. if (billNoStime.Value == null || BillNoEtime.Value == null || billNoStime.Value > BillNoEtime.Value)
  652. {
  653. errMessage = "请选择正确的提单日期区间!";
  654. return null;
  655. }
  656. billStime = billNoStime.Value.ToString();
  657. billEtime = BillNoEtime.Value.ToString();
  658. }
  659. if (ChcOrderNo1.Checked)
  660. {
  661. orderNo = TxtOrderNo1.Text.Trim();
  662. }
  663. if (ChcPlanNo1.Checked)
  664. {
  665. sendPlanNo = TxtPlanNo1.Text.Trim();
  666. }
  667. if (ChkStation1.Checked && ComStation1.Value != null)
  668. {
  669. station = ComStation1.Value.ToString();
  670. }
  671. if (ChcSpcl.Checked && ComSpcl.Value != null)
  672. {
  673. spcl = ComSpcl.Value.ToString();
  674. }
  675. if (ChcReceiv1.Checked)
  676. {
  677. reciveName = ComReceiv1.Text.Trim();
  678. }
  679. if (ChcCustomer1.Checked)
  680. {
  681. customerName = ComCustomer1.Text.Trim();
  682. }
  683. if (ChcBillNo1.Checked)
  684. {
  685. billNo = TxtBillNo1.Text.Trim();
  686. }
  687. if (ChcBillStatus.Checked && ComBillStratus.Value != null)
  688. {
  689. status = ComBillStratus.Value.ToString().Trim();
  690. }
  691. //if (!ChcBillTime.Checked && orderNo.Equals("") && sendPlanNo.Equals("") && station.Equals("") && spcl.Equals("") && reciveName.Equals("") && customerName.Equals("") && status.Equals("") && billNo.Equals(""))
  692. //{
  693. // errMessage = "请至少选择一个查询条件!";
  694. // return null;
  695. //}
  696. param.Add(billStime);
  697. param.Add(billEtime);
  698. param.Add(orderNo);
  699. param.Add(sendPlanNo);
  700. param.Add(station);
  701. param.Add(spcl);
  702. param.Add(reciveName);
  703. param.Add(customerName);
  704. param.Add(billNo);
  705. param.Add(status);
  706. return param;
  707. }
  708. /// <summary>
  709. /// 查询提单信息
  710. /// </summary>
  711. private void QueryBillMInfo()
  712. {
  713. ArrayList param = QueryBillCondition();
  714. if (param == null)
  715. {
  716. MessageUtil.ShowTips(errMessage);
  717. return;
  718. }
  719. //string prdCls = ComTransitTyp.Value.ToString();
  720. DataSourceList<YdmZcBillMEntity> listBillM = EntityHelper.GetData<YdmZcBillMEntity>("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.queryBillM", new object[] { param, this.ValidDataPurviewIds }, this.ob);
  721. ydmZcBillMEntityBindingSource.DataSource = listBillM;
  722. if (listBillM == null || listBillM.Count == 0)
  723. {
  724. QueryBillCInfo("");
  725. }
  726. }
  727. private DataSourceList<YdmZcBillCEntity> listBillC;
  728. /// <summary>
  729. /// 查询提单从表信息
  730. /// </summary>
  731. /// <param name="billNo"></param>
  732. private void QueryBillCInfo(String billNo)
  733. {
  734. listBillC = EntityHelper.GetData<YdmZcBillCEntity>("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.queryBillC", new object[] { billNo }, this.ob);
  735. ydmZcBillCEntityBindingSource.DataSource = listBillC;
  736. listBillC.AcceptChanges();
  737. foreach (UltraGridRow ugr in ultraGridBillC.Rows)
  738. {
  739. ugr.Cells["CANCELDOWN"].Value = "撤销";
  740. }
  741. }
  742. private void ultraGridBillM_AfterRowActivate(object sender, EventArgs e)
  743. {
  744. UltraGridRow ugr = ultraGridBillM.ActiveRow;
  745. if (ugr == null)
  746. {
  747. return;
  748. }
  749. string billNo = ugr.Cells["BillNo"].Text;
  750. QueryBillCInfo(billNo);
  751. }
  752. /// <summary>
  753. /// 验证提单量
  754. /// </summary>
  755. /// <param name="sender"></param>
  756. /// <param name="e"></param>
  757. private void ultraGridSourse_CellChange(object sender, CellEventArgs e)
  758. {
  759. UltraGridRow urg = ultraGridOrder.ActiveRow;
  760. if (e.Cell.Column.Key.Equals("ActCount"))
  761. {
  762. if (e.Cell.Row.Cells["ActCount"].Value == null)
  763. {
  764. e.Cell.Row.Cells["ActCount"].Value = "0";
  765. e.Cell.Row.Cells["ActWeight"].Value = "0";
  766. e.Cell.Row.Cells["ActLen"].Value = "0";
  767. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  768. {
  769. e.Cell.Row.Cells["SendNum"].Value = 0;
  770. }
  771. }
  772. else
  773. {
  774. ultraGridSourse.UpdateData();
  775. string actCount = e.Cell.Row.Cells["ActCount"].Value.ToString();
  776. if (!StringUtil.IsInt(actCount) || actCount == "0")
  777. {
  778. e.Cell.Row.Cells["ActCount"].Value = "0";
  779. e.Cell.Row.Cells["ActWeight"].Value = "0";
  780. e.Cell.Row.Cells["ActLen"].Value = "0";
  781. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  782. {
  783. e.Cell.Row.Cells["SendNum"].Value = 0;
  784. }
  785. }
  786. else
  787. {
  788. MatInfoEntity matInfoEntity = (MatInfoEntity)ultraGridSourse.ActiveRow.ListObject;
  789. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.checkMatWeight", new object[] { matInfoEntity }, this.ob);
  790. if (dt != null && dt.Rows.Count > 0)
  791. {
  792. e.Cell.Row.Cells["ActWeight"].Value = dt.Rows[0][0].ToString();
  793. e.Cell.Row.Cells["ActCount"].Value = dt.Rows[0][1].ToString();
  794. e.Cell.Row.Cells["ActLen"].Value = dt.Rows[0][2].ToString();
  795. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  796. {
  797. e.Cell.Row.Cells["SendNum"].Value = dt.Rows[0][0].ToString();
  798. }
  799. }
  800. else
  801. {
  802. e.Cell.Row.Cells["ActCount"].Value = "0";
  803. e.Cell.Row.Cells["ActWeight"].Value = "0";
  804. e.Cell.Row.Cells["ActLen"].Value = "0";
  805. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  806. {
  807. e.Cell.Row.Cells["SendNum"].Value = 0;
  808. }
  809. }
  810. }
  811. }
  812. }
  813. if (e.Cell.Column.Key.Equals("SendNum"))
  814. {
  815. if (e.Cell.Row.Cells["SendNum"].Value == null)
  816. {
  817. e.Cell.Row.Cells["SendNum"].Value = "0";
  818. }
  819. else
  820. {
  821. ultraGridSourse.UpdateData();
  822. string actLen = e.Cell.Row.Cells["SendNum"].Value.ToString();
  823. if (!StringUtil.IsFloat(actLen) || actLen == "0")//actCount == "" || int.Parse(actCount)==0
  824. {
  825. e.Cell.Row.Cells["SendNum"].Value = "0";
  826. }
  827. }
  828. }
  829. string storage = "";
  830. foreach (UltraGridRow ugr1 in ultraGridSourse.Rows)
  831. {
  832. if (Convert.ToBoolean(ugr1.Cells["CHC"].Text) == true)
  833. {
  834. storage = ugr1.Cells["StorageNo"].Value.ToString();
  835. }
  836. }
  837. double count = 0;
  838. double weght = 0;
  839. double len = 0;
  840. double send = 0;
  841. ultraGroupBox4.Text = "资源信息区";
  842. int i = 0;
  843. foreach (UltraGridRow ugr in ultraGridSourse.Rows)
  844. {
  845. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  846. {
  847. if (storage != ugr.Cells["StorageNo"].Value.ToString())
  848. {
  849. i++;
  850. }
  851. ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text;
  852. count += double.Parse(ugr.Cells["ActCount"].Value.ToString());
  853. weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString());
  854. len += double.Parse(ugr.Cells["ActLen"].Value.ToString());
  855. send += double.Parse(ugr.Cells["SendNum"].Value.ToString());
  856. }
  857. }
  858. //if (i > 0)
  859. //{
  860. // MessageUtil.ShowTips("您所选择的炉出库地点不一致,不能进行此操作?");
  861. // e.Cell.Row.Cells["CHC"].Value = false;
  862. // return;
  863. //}
  864. ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3") + " 实发数:" + send.ToString("f3");
  865. //if (e.Cell.Column.Key.Equals("Vstel"))
  866. //{
  867. // e.Cell.Row.Cells["VstelDesc"].Value = e.Cell.Row.Cells["Vstel"].Text;
  868. //}
  869. }
  870. /// <summary>
  871. /// 新增提单
  872. /// </summary>
  873. private void DoAddBill()
  874. {
  875. ultraGridSourse.UpdateData();
  876. ultraGridPipeMat.UpdateData();
  877. UltraGridRow ugrSendPlan = ultraGridSendPlan.ActiveRow;
  878. UltraGridRow ugrOrder = ultraGridOrder.ActiveRow;
  879. IQueryable<UltraGridRow> ugrMatNo = ultraGridPipeMat.Rows.AsQueryable().Where(" CHK = 'True'");
  880. IQueryable<UltraGridRow> ugrSourses = ultraGridSourse.Rows.AsQueryable().Where(" CHC = 'True'");
  881. //if (ugrOrder.Cells["PRD_CLS"].Text.Equals("405005"))//判断是否坯子
  882. //{
  883. // if (ugrSendPlan == null || ugrOrder == null || ugrMatNo.Count() == 0)
  884. // {
  885. // MessageUtil.ShowTips("请选择生成提货单的资源信息!");
  886. // return;
  887. // }
  888. //}
  889. //else
  890. //{
  891. if (ugrSendPlan == null || ugrOrder == null || ugrSourses.Count() == 0)
  892. {
  893. MessageUtil.ShowTips("请选择生成提货单的资源信息!");
  894. return;
  895. }
  896. //}
  897. string producName = ugrOrder.Cells["PRODUCNAME"].Text;
  898. string specName = ugrOrder.Cells["SPEC_NAME"].Text;
  899. string stdName = ugrOrder.Cells["STD_NAME"].Text;
  900. string steeName = ugrOrder.Cells["STEELNAME"].Text;
  901. string modelNmae = ugrOrder.Cells["MODEL_DESC"].Text;
  902. string stdSty = ugrOrder.Cells["STD_STYLE_DESC"].Text;
  903. string changpx = producName + stdSty + steeName + specName + modelNmae;//管
  904. string pipe = producName + specName + stdName;//坯
  905. string billNo = ComBillNo.Text.Trim();
  906. string virtualFlag = "1";
  907. if (ChcVirtual.Checked)
  908. {
  909. virtualFlag = "2";
  910. }
  911. string strPraFlag = "0";
  912. if (PraFlag.Checked)
  913. {
  914. strPraFlag = "1";
  915. }
  916. string plineName = "";
  917. //验证提单号
  918. if (!billNo.Equals(""))
  919. {
  920. DataTable dt = (DataTable)ComBillNo.DataSource;
  921. DataRow[] drs = dt.Select("BILL_NO =" + "'" + billNo + "'");
  922. if (drs == null || drs.Count() == 0)
  923. {
  924. return;
  925. }
  926. string beVirtualFlag = drs[0]["LOADVEHICLE_TYPE"].ToString();
  927. plineName = drs[0]["LOADVEHICLE_TYPE"].ToString();
  928. if (virtualFlag.Equals("1") && !virtualFlag.Equals(beVirtualFlag))
  929. {
  930. MessageUtil.ShowTips("实际提货单不能追加虚拟提货单类型的信息!");
  931. return;
  932. }
  933. if (virtualFlag.Equals("2") && !virtualFlag.Equals(beVirtualFlag))
  934. {
  935. MessageUtil.ShowTips("虚拟提货单不能追加实际提货单类型的信息!");
  936. return;
  937. }
  938. }
  939. if (ugrOrder.Cells["ORDER_NO"].Text.Equals(""))
  940. {
  941. MessageUtil.ShowTips("合同号不能为空");
  942. return;
  943. }
  944. if (BillBtime.Value == null || BillEtime.Value == null || BillBtime.Value > BillEtime.Value)
  945. {
  946. MessageUtil.ShowTips("请选择正确的提货单开始/结束时间!");
  947. return;
  948. }
  949. string sendPlanNo = ugrSendPlan.Cells["SEND_PLAN_NO"].Text;
  950. string ordPk = ugrOrder.Cells["ORD_PK"].Text;
  951. string ordLnPk = ugrOrder.Cells["ORD_LN_PK"].Text;
  952. string ordLnDlyPk = ugrOrder.Cells["ORD_LN_DLY_PK"].Text;
  953. string billBtime = BillBtime.Value.ToString("yyyy-MM-dd");
  954. string billEtime = BillEtime.Value.ToString("yyyy-MM-dd");
  955. ArrayList paramA = new ArrayList();
  956. paramA.Add(billNo);
  957. paramA.Add(sendPlanNo);
  958. paramA.Add(ordPk);
  959. paramA.Add(ordLnPk);
  960. paramA.Add(ordLnDlyPk);
  961. paramA.Add(UserInfo.GetUserName());
  962. paramA.Add(UserInfo.GetDeptid());
  963. paramA.Add(UserInfo.GetDepartment());
  964. paramA.Add(virtualFlag);
  965. paramA.Add(billBtime);
  966. paramA.Add(billEtime);
  967. ArrayList paramB = new ArrayList();
  968. DataTable dtOrdLnDlyPk = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryOrdLnDlyPkWT", new object[] { ordLnDlyPk }, this.ob);
  969. double ordWt = 0;//交货行量
  970. double delMat = 0;
  971. if (dtOrdLnDlyPk.Rows.Count > 0)
  972. {
  973. ordWt = double.Parse(dtOrdLnDlyPk.Rows[0]["WGT_ESTMT"].ToString());
  974. delMat = double.Parse(dtOrdLnDlyPk.Rows[0]["DELVRY_RANGE_MAX"].ToString());
  975. }
  976. DataTable dtBillC = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryBillWeight", new object[] { ordLnDlyPk }, this.ob);
  977. double billWeight = double.Parse(dtBillC.Rows[0]["ACT_WEIGHT"].ToString());
  978. double wegiht = 0;
  979. DateTime d1 = DateTime.Now;//当前时间
  980. DateTime dt1 = Convert.ToDateTime(d1);
  981. //if (ugrOrder.Cells["PRD_CLS"].Text.Equals("405005"))
  982. //{
  983. // foreach (UltraGridRow ugr in ugrMatNo)
  984. // {
  985. // PipeMatGpMEntity matInfoEntity = (PipeMatGpMEntity)ugr.ListObject;
  986. // _ordLnDlyPkSoure = matInfoEntity.OrdLnDlyPk;
  987. // wegiht += double.Parse(matInfoEntity.ActWeight.ToString());
  988. // if (matInfoEntity.ActCount.Equals("") || matInfoEntity.ActCount.Equals("0"))
  989. // {
  990. // MessageUtil.ShowTips("资源信息可编制量为0,不能生成提单!");
  991. // return;
  992. // }
  993. // if (matInfoEntity.StorageName.Equals("") || matInfoEntity.StorageName.Equals("/"))
  994. // {
  995. // MessageUtil.ShowTips("请确认资源信息出库地点!");
  996. // return;
  997. // }
  998. // if (pipe != matInfoEntity.Producname + matInfoEntity.SpecName + matInfoEntity.JudgeStdName)
  999. // {
  1000. // if (MessageUtil.ShowYesNoAndQuestion("合同产品信息与炉号产品信息不一致,是否继续!") == DialogResult.No) return;
  1001. // }
  1002. // if (ugr.Cells["SendNum"].Text.Equals("0.000"))
  1003. // {
  1004. // MessageUtil.ShowTips("请输入实发数!");
  1005. // return;
  1006. // }
  1007. // DateTime dt2 = Convert.ToDateTime(matInfoEntity.InstockTime);
  1008. // int months = (dt1.Year - dt2.Year) * 12 + (dt1.Month - dt2.Month);
  1009. // if (months > 6)
  1010. // {
  1011. // if (MessageUtil.ShowYesNoAndQuestion("您所选择的炉号信息入库日期与当前日期相隔6个月,是否继续!") == DialogResult.No) return;
  1012. // }
  1013. // paramB.Add(matInfoEntity);
  1014. // }
  1015. //}
  1016. //else
  1017. //{
  1018. string plineCode = "";
  1019. foreach (UltraGridRow ugr in ugrSourses)
  1020. {
  1021. MatInfoEntity matInfoEntity = (MatInfoEntity)ugr.ListObject;
  1022. _ordLnDlyPkSoure = matInfoEntity.OrdLnDlyPk;
  1023. wegiht += double.Parse(matInfoEntity.ActWeight.ToString());
  1024. if (matInfoEntity.ActCount.Equals("") || matInfoEntity.ActCount.Equals("0"))
  1025. {
  1026. MessageUtil.ShowTips("资源信息可编制量为0,不能生成提单!");
  1027. return;
  1028. }
  1029. if (matInfoEntity.StorageName.Equals("") || matInfoEntity.StorageName.Equals("/"))
  1030. {
  1031. MessageUtil.ShowTips("请确认资源信息出库地点!");
  1032. return;
  1033. }
  1034. if (changpx != matInfoEntity.Producname + matInfoEntity.StdStyleDesc + matInfoEntity.Steelname + matInfoEntity.SpecName + matInfoEntity.ModelDesc)
  1035. {
  1036. if (MessageUtil.ShowYesNoAndQuestion("合同产品信息与炉号产品信息不一致,是否继续!") == DialogResult.No) return;
  1037. }
  1038. if (ugr.Cells["SendNum"].Text.Trim().Equals("0.000"))
  1039. {
  1040. MessageUtil.ShowTips("请输入实发数!");
  1041. return;
  1042. }
  1043. if (_salgPersion.Length == 1)
  1044. {
  1045. if (!_salgPersion[0].Equals("100102"))
  1046. {
  1047. string plineDepart = "";
  1048. //根据产线产线管理部门
  1049. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryPlineDepart", new object[] { ugr.Cells["plineCode"].Text.Trim() }, this.ob);
  1050. if (dt.Rows.Count > 0)
  1051. {
  1052. plineDepart = dt.Rows[0]["PROCESS_CODE"].ToString();
  1053. }
  1054. if (plineCode.Equals(""))
  1055. {
  1056. plineCode = plineDepart;
  1057. }
  1058. else
  1059. {
  1060. plineCode = plineCode + "," + plineDepart;
  1061. }
  1062. }
  1063. }
  1064. else
  1065. {
  1066. string plineDepart = "";
  1067. //根据产线产线管理部门
  1068. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryPlineDepart", new object[] { ugr.Cells["plineCode"].Text.Trim() }, this.ob);
  1069. if (dt.Rows.Count > 0)
  1070. {
  1071. plineDepart = dt.Rows[0]["PROCESS_CODE"].ToString();
  1072. }
  1073. if (plineCode.Equals(""))
  1074. {
  1075. plineCode = plineDepart;
  1076. }
  1077. else
  1078. {
  1079. plineCode = plineCode + "," + plineDepart;
  1080. }
  1081. }
  1082. DateTime dt2 = Convert.ToDateTime(matInfoEntity.JudgeResultTime);
  1083. int months = (dt1.Year - dt2.Year) * 12 + (dt1.Month - dt2.Month);
  1084. if (months > 6)
  1085. {
  1086. if (MessageUtil.ShowYesNoAndQuestion("您所选择的炉号信息入库日期与当前日期相隔6个月,是否继续!") == DialogResult.No) return;
  1087. }
  1088. paramB.Add(matInfoEntity);
  1089. }
  1090. if (_salgPersion.Length == 1)
  1091. {
  1092. if (!_salgPersion[0].Equals("100102"))
  1093. {
  1094. if (plineCode.Contains("G") && plineCode.Contains("D"))
  1095. {
  1096. if (MessageUtil.ShowYesNoAndQuestion("选择炉号存在加工和轧管产线,是否继续生成一个提单!") == DialogResult.No) return;
  1097. }
  1098. //if (!billNo.Equals(""))
  1099. //{
  1100. // if (!plineName.Equals(ugr.Cells["plineName"].Text.Trim()))
  1101. // {
  1102. // if (MessageUtil.ShowYesNoAndQuestion("选择炉号产线不一致,是否继续!") == DialogResult.No) return;
  1103. // }
  1104. //}
  1105. }
  1106. }
  1107. else
  1108. {
  1109. //if (!billNo.Equals(""))
  1110. //{
  1111. // if (!plineName.Equals(ugr.Cells["plineName"].Text.Trim()))
  1112. // {
  1113. // if (MessageUtil.ShowYesNoAndQuestion("选择炉号产线不一致,是否继续!") == DialogResult.No) return;
  1114. // }
  1115. //}
  1116. if (plineCode.Contains("G") && plineCode.Contains("D"))
  1117. {
  1118. if (MessageUtil.ShowYesNoAndQuestion("选择炉号存在加工和轧管产线,是否继续生成一个提单!") == DialogResult.No) return;
  1119. }
  1120. }
  1121. //}
  1122. double ordb =ordWt+ ordWt * (delMat / 100);//交货行上限值
  1123. double billW = billWeight + wegiht;
  1124. if (ordb < billW)
  1125. {
  1126. if (MessageUtil.ShowYesNoAndQuestion("生成提单量不能大于交货量上限,交货量为:" + ordWt + "t,交货量上限值为:" + ordb + "t,已生成提单量为:" + billWeight + "t,要生成提单的量为:" + wegiht + "t") == DialogResult.No)
  1127. {
  1128. return;
  1129. }
  1130. }
  1131. if (BillBtime.Value == null || BillEtime.Value == null || BillBtime.Value > BillEtime.Value)
  1132. {
  1133. MessageUtil.ShowWarning("请选择正确的提单开始/结束时间");
  1134. return;
  1135. }
  1136. //定位
  1137. _sendPlanNo = sendPlanNo;
  1138. _ordLnDlyPk = ordLnDlyPk;
  1139. if (MessageUtil.ShowYesNoAndQuestion(billNo.Length == 0 ? "是否新增提货单?" : "是否在原提货单号:" + billNo + "追加提货单信息?") == DialogResult.No)
  1140. {
  1141. return;
  1142. }
  1143. CoreClientParam ccp = new CoreClientParam();
  1144. try
  1145. {
  1146. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  1147. if (Constant.WaitingForm == null)
  1148. {
  1149. Constant.WaitingForm = new WaitingForm();
  1150. }
  1151. Constant.WaitingForm.ShowToUser = true;
  1152. Constant.WaitingForm.Show();
  1153. Constant.WaitingForm.Update();
  1154. //if (ugrOrder.Cells["PRD_CLS"].Text.Equals("405005"))
  1155. //{
  1156. // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.CoreCasCarBill";
  1157. // ccp.MethodName = "doAddBillInfo";
  1158. //}
  1159. //else
  1160. //{
  1161. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill";
  1162. ccp.MethodName = "doAddBillInfo";
  1163. //}
  1164. ccp.ServerParams = new object[] { paramA, paramB, ugrOrder.Cells["ORDER_NO"].Text, ugrOrder.Cells["ORDER_SEQ"].Text, ugrOrder.Cells["DELIVERY_NO"].Text, strPraFlag, ugrSendPlan.Cells["SUPPLY_UNIT"].Text, ugrSendPlan.Cells["SUPPLY_UNIT_DESC"].Text };
  1165. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1166. this.Cursor = Cursors.Default;
  1167. Constant.WaitingForm.ShowToUser = false;
  1168. Constant.WaitingForm.Close();
  1169. Constant.WaitingForm = null;
  1170. }
  1171. catch (Exception e)
  1172. {
  1173. this.Cursor = Cursors.Default;
  1174. Constant.WaitingForm.ShowToUser = false;
  1175. Constant.WaitingForm.Close();
  1176. Constant.WaitingForm = null;
  1177. }
  1178. if (ccp.ReturnCode != -1)
  1179. {
  1180. MessageUtil.ShowTips(ccp.ReturnInfo);
  1181. if (ccp.ReturnInfo.Equals("新增提货单成功!") || ccp.ReturnInfo.Equals("修改提货单成功!"))
  1182. {
  1183. QuerySendPlan();
  1184. BaseHelper.UltraGridLocation(ultraGridSendPlan, new string[] { "SEND_PLAN_NO" }, new string[] { _sendPlanNo });
  1185. _sendPlanNo = "";
  1186. }
  1187. }
  1188. }
  1189. /// <summary>
  1190. /// 撤销提单
  1191. /// </summary>
  1192. private void DoDelete()
  1193. {
  1194. ultraGridBillM.UpdateData();
  1195. IQueryable<UltraGridRow> checkRows = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'");
  1196. if (checkRows.Count() == 0)
  1197. {
  1198. MessageUtil.ShowTips("请选择需要撤销的提货单!");
  1199. return;
  1200. }
  1201. ArrayList list = new ArrayList();
  1202. ArrayList pram = new ArrayList();
  1203. foreach (UltraGridRow ugr in checkRows)
  1204. {
  1205. list.Add(ugr.Cells["BillNo"].Text.Trim());
  1206. }
  1207. if (MessageUtil.ShowYesNoAndQuestion("是否撤销提货单?") == DialogResult.No)
  1208. {
  1209. return;
  1210. }
  1211. CoreClientParam ccp = new CoreClientParam();
  1212. //if (ComTransitTyp.Value.ToString().Equals("405005"))
  1213. //{
  1214. // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.CoreCasCarBill";
  1215. // ccp.MethodName = "updateBill";
  1216. // ccp.ServerParams = new object[] { list, UserInfo.GetUserName(), UserInfo.GetDeptid(), UserInfo.GetDepartment() };
  1217. // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1218. //}
  1219. //else
  1220. //{
  1221. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  1222. ccp.MethodName = "updateBill";
  1223. ccp.ServerParams = new object[] { list, UserInfo.GetUserName(), UserInfo.GetDeptid(), UserInfo.GetDepartment() };
  1224. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1225. //}
  1226. if (ccp.ReturnCode != -1)
  1227. {
  1228. MessageUtil.ShowTips(ccp.ReturnInfo);
  1229. if (ccp.ReturnInfo.Equals("提单撤销成功!"))
  1230. {
  1231. QueryBillMInfo();
  1232. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  1233. {
  1234. if (ugrc.Cells["BillNo"].Text.Equals(_billNo))
  1235. {
  1236. ugrc.Activate();
  1237. _billNo = "";
  1238. return;
  1239. }
  1240. }
  1241. }
  1242. }
  1243. }
  1244. /// <summary>
  1245. /// 下发
  1246. /// </summary>
  1247. private void DoDown()
  1248. {
  1249. ultraGridBillM.UpdateData();
  1250. UltraGridRow ugr = ultraGridBillM.ActiveRow;
  1251. if (ugr == null) return;
  1252. IQueryable<UltraGridRow> ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'");
  1253. if (ugrs.Count() == 0)
  1254. {
  1255. MessageUtil.ShowTips("请选择您要操作的数据!");
  1256. return;
  1257. }
  1258. ArrayList param = new ArrayList();
  1259. foreach (UltraGridRow row in ugrs)
  1260. {
  1261. string[] str = new string[2];
  1262. str[0] = row.Cells["BillNo"].Value.ToString();
  1263. str[1] = row.Cells["SendPlanNo"].Value.ToString();
  1264. param.Add(str);
  1265. // 查询提单合同金额
  1266. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillOrder", new object[] { row.Cells["BillNo"].Value.ToString() }, ob);
  1267. double price = 0.0;
  1268. string askDesc = "";
  1269. bool next_flag = false;
  1270. for (int i = 0; i < dt.Rows.Count; i++)
  1271. {
  1272. if (!dt.Rows[i]["FST_DRAWEE_UNIT"].ToString2().Equals("120604")) // 天津钢管钢铁贸易有限公司
  1273. {
  1274. next_flag = true;
  1275. continue;
  1276. }
  1277. if (!string.IsNullOrWhiteSpace(dt.Rows[i]["MNY_ASK_DESC"].ToString2())
  1278. && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全额排产")
  1279. && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("付讫发货")
  1280. && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全款提货")
  1281. && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全款预付")
  1282. && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("付讫后发货")
  1283. && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全额付款提货")
  1284. && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("发货前支付100%货款"))
  1285. {
  1286. if (MessageBox.Show(dt.Rows[i]["ORDER_NO"].ToString() + "此合同付款要求是:" + dt.Rows[i]["MNY_ASK_DESC"].ToString2() + "是否继续下发?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1287. {
  1288. return;
  1289. }
  1290. next_flag = true;
  1291. continue;
  1292. }
  1293. if (string.IsNullOrWhiteSpace(dt.Rows[i]["BALNCE_PRICE"].ToString2()))
  1294. {
  1295. MessageUtil.ShowTips(dt.Rows[i]["ORDER_NO"].ToString() + "/" + dt.Rows[i]["ORDER_SEQ"].ToString() + ",没有合同价格,请维护合同价格!");
  1296. return;
  1297. }
  1298. price += double.Parse(dt.Rows[0]["MONEY"].ToString3());
  1299. askDesc = dt.Rows[i]["MNY_ASK_DESC"].ToString2();
  1300. }
  1301. if (next_flag)
  1302. {
  1303. continue;
  1304. }
  1305. // 查询账本可发金额
  1306. DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getMoneyByBuyercode", new object[] { row.Cells["StlmtUnitNo"].Value.ToString() }, ob);
  1307. if (dt1.Rows.Count <= 0 || string.IsNullOrWhiteSpace(dt1.Rows[0]["MONEY"].ToString2()))
  1308. {
  1309. MessageUtil.ShowTips(row.Cells["StlmtUnitNM"].Value.ToString() + ",没有可发金额,请维护可发金额!");
  1310. return;
  1311. }
  1312. ArrayList param1 = new ArrayList();
  1313. ArrayList list1 = new ArrayList();
  1314. list1.Add(row.Cells["BillNo"].Value.ToString());
  1315. list1.Add(row.Cells["StlmtUnitNO"].Value.ToString());
  1316. list1.Add(row.Cells["StlmtUnitNM"].Value.ToString());
  1317. list1.Add(dt1.Rows[0]["MONEY"].ToString3());
  1318. list1.Add(price);
  1319. list1.Add(this.UserInfo.GetUserName());
  1320. param1.Add(list1);
  1321. if (double.Parse(dt1.Rows[0]["MONEY"].ToString3()) <= 0)
  1322. {
  1323. if (MessageBox.Show(row.Cells["StlmtUnitNM"].Value.ToString() + ",可发金额(" + dt1.Rows[0]["MONEY"].ToString2() + ")小于等于0!是否确认下发提货单?\n此合同付款要求是:" + askDesc, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1324. {
  1325. return;
  1326. }
  1327. }
  1328. if (double.Parse(dt1.Rows[0]["MONEY"].ToString3()) < price)
  1329. {
  1330. if (MessageBox.Show(row.Cells["StlmtUnitNM"].Value.ToString() + ",可发金额(" + dt1.Rows[0]["MONEY"].ToString2() + ")小于结算金额(" + price + ")!是否确认下发提货单?\n此合同付款要求是:" + askDesc, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1331. {
  1332. return;
  1333. }
  1334. }
  1335. if (double.Parse(dt1.Rows[0]["MONEY"].ToString3()) <= 0 || double.Parse(dt1.Rows[0]["MONEY"].ToString3()) < price)
  1336. {
  1337. CoreClientParam ccp1 = new CoreClientParam();
  1338. ccp1.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  1339. ccp1.MethodName = "DoDownLog";
  1340. ccp1.ServerParams = new object[] { param1 };
  1341. ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  1342. }
  1343. }
  1344. if (MessageBox.Show("是否确认下发提货单?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1345. {
  1346. return;
  1347. }
  1348. CoreClientParam ccp = new CoreClientParam();
  1349. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  1350. ccp.MethodName = "DoDown";
  1351. ccp.ServerParams = new object[] { param, UserInfo.GetUserName() };
  1352. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1353. if (ccp.ReturnCode != -1)
  1354. {
  1355. MessageUtil.ShowTips(ccp.ReturnInfo);
  1356. if (ccp.ReturnInfo.Equals("下发成功!"))
  1357. {
  1358. QueryBillMInfo();
  1359. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  1360. {
  1361. if (ugrc.Cells["BillNo"].Text.Equals(_billNo))
  1362. {
  1363. ugrc.Activate();
  1364. _billNo = "";
  1365. return;
  1366. }
  1367. }
  1368. }
  1369. }
  1370. }
  1371. /// <summary>
  1372. /// 撤销下发
  1373. /// </summary>
  1374. private void CancelDown()
  1375. {
  1376. ultraGridBillM.UpdateData();
  1377. UltraGridRow ugr = ultraGridBillM.ActiveRow;
  1378. if (ugr == null) return;
  1379. IQueryable<UltraGridRow> ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'");
  1380. if (ugrs.Count() == 0)
  1381. {
  1382. MessageUtil.ShowTips("请选择您要撤销下发的提货单!");
  1383. return;
  1384. }
  1385. ArrayList param = new ArrayList();
  1386. foreach (UltraGridRow row in ugrs)
  1387. {
  1388. string[] str = new string[2];
  1389. str[0] = row.Cells["BillNo"].Value.ToString();
  1390. str[1] = row.Cells["SendPlanNo"].Value.ToString();
  1391. _billNo = str[0];
  1392. param.Add(str);
  1393. }
  1394. if (MessageBox.Show("是否确认撤销下发的提货单?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1395. {
  1396. return;
  1397. }
  1398. CoreClientParam ccp = new CoreClientParam();
  1399. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  1400. ccp.MethodName = "cancelDown";
  1401. ccp.ServerParams = new object[] { param, UserInfo.GetUserName() };
  1402. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1403. if (ccp.ReturnCode != -1)
  1404. {
  1405. MessageUtil.ShowTips(ccp.ReturnInfo);
  1406. if (ccp.ReturnInfo.Equals("撤销下发成功!"))
  1407. {
  1408. QueryBillMInfo();
  1409. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  1410. {
  1411. if (ugrc.Cells["BillNo"].Text.Equals(_billNo))
  1412. {
  1413. ugrc.Activate();
  1414. _billNo = "";
  1415. return;
  1416. }
  1417. }
  1418. }
  1419. }
  1420. }
  1421. /// <summary>
  1422. /// 提单划断
  1423. /// </summary>
  1424. private void BillDrawOff()
  1425. {
  1426. ultraGridBillM.UpdateData();
  1427. UltraGridRow ugr = ultraGridBillM.ActiveRow;
  1428. if (ugr == null) return;
  1429. IQueryable<UltraGridRow> ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'");
  1430. if (ugrs.Count() == 0)
  1431. {
  1432. MessageUtil.ShowTips("请选择您要一次关闭的提货单!");
  1433. return;
  1434. }
  1435. ArrayList param = new ArrayList();
  1436. foreach (UltraGridRow row in ugrs)
  1437. {
  1438. if (row.Cells["LoadvehicleType"].Value.ToString().Equals("实际"))
  1439. {
  1440. MessageUtil.ShowTips("只有虚拟的提货单才能一次关闭!");
  1441. return;
  1442. }
  1443. string billNo = row.Cells["BillNo"].Value.ToString();
  1444. _billNo = billNo;
  1445. param.Add(billNo);
  1446. }
  1447. if (MessageBox.Show("是否提单一次关闭?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1448. {
  1449. return;
  1450. }
  1451. CoreClientParam ccp = new CoreClientParam();
  1452. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  1453. ccp.MethodName = "billDrawOff";
  1454. ccp.ServerParams = new object[] { param, UserInfo.GetUserName() };
  1455. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1456. if (ccp.ReturnCode != -1)
  1457. {
  1458. MessageUtil.ShowTips(ccp.ReturnInfo);
  1459. if (ccp.ReturnInfo.Equals("提单一次关闭成功!"))
  1460. {
  1461. QueryBillMInfo();
  1462. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  1463. {
  1464. if (ugrc.Cells["BillNo"].Text.Equals(_billNo))
  1465. {
  1466. ugrc.Activate();
  1467. _billNo = "";
  1468. return;
  1469. }
  1470. }
  1471. }
  1472. }
  1473. }
  1474. /// <summary>
  1475. /// 取消划断
  1476. /// </summary>
  1477. private void CancelBillDrawOff()
  1478. {
  1479. ultraGridBillM.UpdateData();
  1480. UltraGridRow ugr = ultraGridBillM.ActiveRow;
  1481. if (ugr == null) return;
  1482. IQueryable<UltraGridRow> ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'");
  1483. if (ugrs.Count() == 0)
  1484. {
  1485. MessageUtil.ShowTips("请选择您要撤销一次关闭的提货单!");
  1486. return;
  1487. }
  1488. ArrayList param = new ArrayList();
  1489. foreach (UltraGridRow row in ugrs)
  1490. {
  1491. if (row.Cells["LoadvehicleType"].Value.ToString().Equals("实际"))
  1492. {
  1493. MessageUtil.ShowTips("只有虚拟的提货单才能撤销一次关闭!");
  1494. return;
  1495. }
  1496. string billNo = row.Cells["BillNo"].Value.ToString();
  1497. _billNo = billNo;
  1498. param.Add(billNo);
  1499. }
  1500. if (MessageBox.Show("是否撤销一次关闭?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  1501. {
  1502. return;
  1503. }
  1504. CoreClientParam ccp = new CoreClientParam();
  1505. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  1506. ccp.MethodName = "cancelBillDrawOff";
  1507. ccp.ServerParams = new object[] { param, UserInfo.GetUserName() };
  1508. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1509. if (ccp.ReturnCode != -1)
  1510. {
  1511. MessageUtil.ShowTips(ccp.ReturnInfo);
  1512. if (ccp.ReturnInfo.Equals("撤销一次关闭成功!"))
  1513. {
  1514. QueryBillMInfo();
  1515. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  1516. {
  1517. if (ugrc.Cells["BillNo"].Text.Equals(_billNo))
  1518. {
  1519. ugrc.Activate();
  1520. _billNo = "";
  1521. return;
  1522. }
  1523. }
  1524. }
  1525. }
  1526. }
  1527. /// <summary>
  1528. /// 打印
  1529. /// </summary>
  1530. private void Print()
  1531. {
  1532. string billNo = "";
  1533. UltraGridRow ugr = this.ultraGridBillM.ActiveRow;
  1534. if (ugr == null) { MessageUtil.ShowTips("无数据,请确认!"); return; }
  1535. int count = 0;
  1536. foreach (UltraGridRow row in ultraGridBillM.Rows)
  1537. {
  1538. if (Convert.ToBoolean(row.Cells["CHC"].Text) == true)
  1539. {
  1540. count += 1;
  1541. billNo = ugr.Cells["BillNo"].Text.Trim();
  1542. }
  1543. }
  1544. if (count == 0)
  1545. {
  1546. MessageUtil.ShowTips("请选择要打印的提货单号!");
  1547. return;
  1548. }
  1549. if (count > 1)
  1550. {
  1551. MessageUtil.ShowTips("请勾选一个提货单号打印!");
  1552. return;
  1553. }
  1554. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeBillOfLadingClose.getBillStatus", new Object[] { ugr.Cells["BillNo"].Text.Trim() }, this.ob);
  1555. if (dt.Rows.Count > 0)
  1556. {
  1557. if (dt.Rows[0]["BILL_STATUS"].ToString().Equals("0"))
  1558. {
  1559. MessageUtil.ShowTips("该提单是编制状态,请下发之后再打印提单!");
  1560. return;
  1561. }
  1562. }
  1563. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepYdmBill.cpt&op=view" + "&billno=" + billNo;
  1564. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1565. ServerHelper.SetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.updatePintFlag", new object[] { time, billNo }, ob);
  1566. FrmDocPrintExcel fBug = new FrmDocPrintExcel(ob, strurl);
  1567. fBug.AutoSize = true;
  1568. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  1569. // fBug.WindowState = FormWindowState.Maximized;
  1570. fBug.Text = "提货单打印";
  1571. fBug.ShowDialog();
  1572. QueryBillMInfo();
  1573. }
  1574. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  1575. {
  1576. if (toolMenu == null) return;
  1577. if (CustomInfo.Equals("1"))
  1578. {
  1579. if (e.Tab.TabControl.SelectedTab.Key.Equals("0"))
  1580. {
  1581. if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.False; }
  1582. if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.True; }
  1583. if (toolMenu.Toolbars[0].Tools.Exists("UpdateDelvryWhereabouts")) { toolMenu.Toolbars[0].Tools["UpdateDelvryWhereabouts"].InstanceProps.Visible = DefaultableBoolean.False; }
  1584. if (toolMenu.Toolbars[0].Tools.Exists("UpdateRealinvoiceno1")) { toolMenu.Toolbars[0].Tools["UpdateRealinvoiceno1"].InstanceProps.Visible = DefaultableBoolean.False; }
  1585. }
  1586. else
  1587. {
  1588. if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.True; }
  1589. if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False; }
  1590. if (toolMenu.Toolbars[0].Tools.Exists("UpdateDelvryWhereabouts")) { toolMenu.Toolbars[0].Tools["UpdateDelvryWhereabouts"].InstanceProps.Visible = DefaultableBoolean.True; }
  1591. if (toolMenu.Toolbars[0].Tools.Exists("UpdateRealinvoiceno1")) { toolMenu.Toolbars[0].Tools["UpdateRealinvoiceno1"].InstanceProps.Visible = DefaultableBoolean.True; }
  1592. }
  1593. }
  1594. if (CustomInfo.Equals("2"))
  1595. {
  1596. if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.True; }
  1597. if (toolMenu.Toolbars[0].Tools.Exists("Down")) { toolMenu.Toolbars[0].Tools["Down"].InstanceProps.Visible = DefaultableBoolean.True; }
  1598. if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False; }
  1599. if (toolMenu.Toolbars[0].Tools.Exists("CancelDown")) { toolMenu.Toolbars[0].Tools["CancelDown"].InstanceProps.Visible = DefaultableBoolean.True; }
  1600. if (toolMenu.Toolbars[0].Tools.Exists("BillDrawOff")) { toolMenu.Toolbars[0].Tools["BillDrawOff"].InstanceProps.Visible = DefaultableBoolean.True; }
  1601. if (toolMenu.Toolbars[0].Tools.Exists("CancelBillDrawOff")) { toolMenu.Toolbars[0].Tools["CancelBillDrawOff"].InstanceProps.Visible = DefaultableBoolean.True; }
  1602. if (toolMenu.Toolbars[0].Tools.Exists("UpdateStoage")) { toolMenu.Toolbars[0].Tools["UpdateStoage"].InstanceProps.Visible = DefaultableBoolean.True; }
  1603. }
  1604. }
  1605. private void frmPipeTrainBill_Shown(object sender, EventArgs e)
  1606. {
  1607. if (CustomInfo.Equals("1"))
  1608. {
  1609. if (toolMenu.Toolbars[0].Tools.Exists("CancelDown")) { toolMenu.Toolbars[0].Tools["CancelDown"].InstanceProps.Visible = DefaultableBoolean.False; }
  1610. if (toolMenu.Toolbars[0].Tools.Exists("BillDrawOff")) { toolMenu.Toolbars[0].Tools["BillDrawOff"].InstanceProps.Visible = DefaultableBoolean.False; }
  1611. if (toolMenu.Toolbars[0].Tools.Exists("CancelBillDrawOff")) { toolMenu.Toolbars[0].Tools["CancelBillDrawOff"].InstanceProps.Visible = DefaultableBoolean.False; }
  1612. if (toolMenu.Toolbars[0].Tools.Exists("Down")) { toolMenu.Toolbars[0].Tools["Down"].InstanceProps.Visible = DefaultableBoolean.False; }
  1613. if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.False; }
  1614. if (toolMenu.Toolbars[0].Tools.Exists("Print")) { toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False; }
  1615. if (toolMenu.Toolbars[0].Tools.Exists("UpdateStoage")) { toolMenu.Toolbars[0].Tools["UpdateStoage"].InstanceProps.Visible = DefaultableBoolean.False; }
  1616. if (toolMenu.Toolbars[0].Tools.Exists("UpdateDelvryWhereabouts")) { toolMenu.Toolbars[0].Tools["UpdateDelvryWhereabouts"].InstanceProps.Visible = DefaultableBoolean.False; }
  1617. if (toolMenu.Toolbars[0].Tools.Exists("UpdateRealinvoiceno1")) { toolMenu.Toolbars[0].Tools["UpdateRealinvoiceno1"].InstanceProps.Visible = DefaultableBoolean.False; }
  1618. }
  1619. if (CustomInfo.Equals("2"))
  1620. {
  1621. if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.False; }
  1622. if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False; }
  1623. }
  1624. }
  1625. /// <summary>
  1626. /// 划分界面
  1627. /// </summary>
  1628. /// <param name="custInfo"></param>
  1629. private void DivideInterface(string custInfo)
  1630. {
  1631. if (custInfo.Equals("2"))
  1632. {
  1633. ultraTabControl1.Tabs[0].Visible = false;
  1634. }
  1635. else
  1636. {
  1637. ultraTabControl1.Tabs[1].Text = "提单信息";
  1638. }
  1639. }
  1640. private void ultraGridSourse_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  1641. {
  1642. //try
  1643. //{
  1644. // ultraGridSourse.UpdateData();
  1645. // foreach (UltraGridRow row in ultraGridSourse.Rows)
  1646. // {
  1647. // row.Cells["CHC"].Value = row.Selected;
  1648. // }
  1649. //}
  1650. //catch { }
  1651. foreach (UltraGridRow uRow in ultraGridSourse.Selected.Rows)
  1652. {
  1653. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  1654. {
  1655. uRow.Cells["CHC"].Value = true;
  1656. }
  1657. }
  1658. string storage = "";
  1659. foreach (UltraGridRow ugr1 in ultraGridSourse.Rows)
  1660. {
  1661. if (Convert.ToBoolean(ugr1.Cells["CHC"].Text) == true)
  1662. {
  1663. storage = ugr1.Cells["StorageNo"].Value.ToString();
  1664. }
  1665. }
  1666. double count = 0;
  1667. double weght = 0;
  1668. double len = 0;
  1669. double send = 0;
  1670. ultraGroupBox4.Text = "资源信息区";
  1671. int i = 0;
  1672. UltraGridRow row = ultraGridSourse.ActiveRow;
  1673. foreach (UltraGridRow ugr in ultraGridSourse.Rows)
  1674. {
  1675. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  1676. {
  1677. if (storage != ugr.Cells["StorageNo"].Value.ToString())
  1678. {
  1679. i++;
  1680. }
  1681. ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text;
  1682. count += double.Parse(ugr.Cells["ActCount"].Value.ToString());
  1683. weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString());
  1684. len += double.Parse(ugr.Cells["ActLen"].Value.ToString());
  1685. send += double.Parse(ugr.Cells["SendNum"].Value.ToString());
  1686. }
  1687. }
  1688. //if (i > 0)
  1689. //{
  1690. // MessageUtil.ShowTips("您所选择的炉出库地点不一致,不能进行此操作?");
  1691. // row.Cells["CHC"].Value = false;
  1692. // return;
  1693. //}
  1694. ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3") + " 实发数:" + send.ToString("f3");
  1695. }
  1696. private void ultraGridBillM_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  1697. {
  1698. // try
  1699. // {
  1700. // ultraGridBillM.UpdateData();
  1701. // foreach (UltraGridRow row in ultraGridBillM.Rows)
  1702. // {
  1703. // row.Cells["CHC"].Value = row.Selected;
  1704. // }
  1705. // }
  1706. // catch { }
  1707. foreach (UltraGridRow uRow in ultraGridBillM.Selected.Rows)
  1708. {
  1709. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  1710. {
  1711. uRow.Cells["CHC"].Value = true;
  1712. }
  1713. }
  1714. }
  1715. /// <summary>
  1716. /// 撤销合同
  1717. /// </summary>
  1718. private void CancelDownOrderNo()
  1719. {
  1720. UltraGridRow ugrM = ultraGridBillM.ActiveRow;
  1721. if (ugrM == null)
  1722. {
  1723. return;
  1724. }
  1725. if (!ugrM.Cells["BillStatus"].Text.Equals("提单编制"))
  1726. {
  1727. MessageUtil.ShowTips("提货单号:" + ugrM.Cells["BillNo"].Text + "不是提单编制状态,不能撤销提货单下的合同!");
  1728. return;
  1729. }
  1730. UltraGridRow ugr = ultraGridBillC.ActiveRow;
  1731. if (ugr == null)
  1732. {
  1733. return;
  1734. }
  1735. ArrayList param = new ArrayList();
  1736. param.Add(ugr.Cells["BillNo"].Text);
  1737. param.Add(ugr.Cells["OrdPk"].Text);
  1738. param.Add(ugr.Cells["OrdLnPk"].Text);
  1739. param.Add(ugr.Cells["OrdLnDlyPk"].Text);
  1740. param.Add(ugr.Cells["JudgeStoveNo"].Text);
  1741. param.Add(ugr.Cells["BatchNo"].Text);
  1742. param.Add(UserInfo.GetUserName());
  1743. param.Add(ugr.Cells["GroupNo"].Text);
  1744. param.Add(ugr.Cells["LocationNo"].Text);
  1745. string billNo = ugr.Cells["BillNo"].Text;
  1746. if (MessageUtil.ShowYesNoAndQuestion("是否撤销提货单:" + ugr.Cells["BillNo"].Text + " 下合同:"
  1747. + ugr.Cells["OrderNo"].Text + "/" + ugr.Cells["OrderSeq"].Text + "/" + ugr.Cells["DeliveryNo"].Text
  1748. + "的炉批号:" + ugr.Cells["JudgeStoveNo"].Text + "/" + ugr.Cells["BatchNo"].Text+"/"+ugr.Cells["GroupNo"].Text) == DialogResult.No)
  1749. {
  1750. return;
  1751. }
  1752. CoreClientParam ccp = new CoreClientParam();
  1753. //if (ComTransitTyp.Value.ToString().Equals("405005"))
  1754. //{
  1755. // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.CoreCasCarBill";
  1756. // ccp.MethodName = "cancelDownOrderNo";
  1757. //}
  1758. //else
  1759. //{
  1760. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill";
  1761. ccp.MethodName = "cancelDownOrderNo";
  1762. //}
  1763. ccp.ServerParams = new object[] { param };
  1764. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1765. if (ccp.ReturnCode != -1)
  1766. {
  1767. MessageUtil.ShowTips(ccp.ReturnInfo);
  1768. if (ccp.ReturnInfo.Equals("撤销成功!"))
  1769. {
  1770. QueryBillMInfo();
  1771. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  1772. {
  1773. if (ugrc.Cells["BillNo"].Text.Equals(billNo))
  1774. {
  1775. ugr.Activate();
  1776. return;
  1777. }
  1778. }
  1779. }
  1780. }
  1781. }
  1782. private void ultraGridBillC_ClickCellButton(object sender, CellEventArgs e)
  1783. {
  1784. if (e.Cell.Text.Equals("撤销"))
  1785. {
  1786. CancelDownOrderNo();
  1787. }
  1788. }
  1789. /// <summary>
  1790. /// 按回车键触发查询按钮
  1791. /// </summary>
  1792. /// <param name="sender"></param>
  1793. /// <param name="e"></param>
  1794. private void ContPublic_KeyDown(object sender, KeyEventArgs e)
  1795. {
  1796. if (e.KeyCode == Keys.Enter)
  1797. {
  1798. DoQuery();
  1799. }
  1800. }
  1801. /// <summary>
  1802. /// 查询时验证必填项
  1803. /// </summary>
  1804. /// <returns></returns>
  1805. private bool ValidQuery()
  1806. {
  1807. if (ChcOrderNo.Checked && string.IsNullOrEmpty(TxtOrderNo.Text.Trim()))
  1808. {
  1809. MessageBox.Show("请输入合同号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1810. return false;
  1811. }
  1812. if (ChcBillNo.Checked && string.IsNullOrEmpty(TxtBillNo.Text.Trim()))
  1813. {
  1814. MessageBox.Show("请输入提货单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1815. return false;
  1816. }
  1817. if (ChcPlanNo.Checked && string.IsNullOrEmpty(TxtPlanNo.Text.Trim()))
  1818. {
  1819. MessageBox.Show("请输入出厂计划号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1820. return false;
  1821. }
  1822. if (ChcCustomer.Checked && string.IsNullOrEmpty(ComCustomer.Text.Trim()))
  1823. {
  1824. MessageBox.Show("请选择订货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1825. return false;
  1826. }
  1827. if (ChcRecive.Checked && string.IsNullOrEmpty(ComRecive.Text.Trim()))
  1828. {
  1829. MessageBox.Show("请选择收货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1830. return false;
  1831. }
  1832. if (ChcStation.Checked && string.IsNullOrEmpty(ComStation.Text.Trim()))
  1833. {
  1834. MessageBox.Show("请选择到站!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1835. return false;
  1836. }
  1837. if (ChcSpcl.Checked && string.IsNullOrEmpty(ComSpcl.Text.Trim()))
  1838. {
  1839. MessageBox.Show("请选择专用线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1840. return false;
  1841. }
  1842. return true;
  1843. }
  1844. /// <summary>
  1845. /// 查询时验证必填项
  1846. /// </summary>
  1847. /// <returns></returns>
  1848. private bool ValidQuery1()
  1849. {
  1850. if (ChcBillTime.Checked)
  1851. {
  1852. if (DataTimeUtil.JudgeTime(DateTime.Parse(billNoStime.Value.ToString()), DateTime.Parse(BillNoEtime.Value.ToString())) == 0)
  1853. {
  1854. MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
  1855. return false;
  1856. }
  1857. }
  1858. if (ChcOrderNo1.Checked && string.IsNullOrEmpty(TxtOrderNo1.Text.Trim()))
  1859. {
  1860. MessageBox.Show("请输入合同号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1861. return false;
  1862. }
  1863. if (ChcBillNo1.Checked && string.IsNullOrEmpty(TxtBillNo1.Text.Trim()))
  1864. {
  1865. MessageBox.Show("请输入提货单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1866. return false;
  1867. }
  1868. if (ChcPlanNo1.Checked && string.IsNullOrEmpty(TxtPlanNo1.Text.Trim()))
  1869. {
  1870. MessageBox.Show("请输入出厂计划号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1871. return false;
  1872. }
  1873. if (ChcCustomer1.Checked && string.IsNullOrEmpty(ComCustomer1.Text.Trim()))
  1874. {
  1875. MessageBox.Show("请选择订货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1876. return false;
  1877. }
  1878. if (ChcReceiv1.Checked && string.IsNullOrEmpty(ComReceiv1.Text.Trim()))
  1879. {
  1880. MessageBox.Show("请选择收货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1881. return false;
  1882. }
  1883. if (ChkStation1.Checked && string.IsNullOrEmpty(ComStation1.Text.Trim()))
  1884. {
  1885. MessageBox.Show("请选择到站!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1886. return false;
  1887. }
  1888. if (ChcSpcl1.Checked && string.IsNullOrEmpty(ComSpcl1.Text.Trim()))
  1889. {
  1890. MessageBox.Show("请选择专用线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  1891. return false;
  1892. }
  1893. return true;
  1894. }
  1895. /// <summary>
  1896. /// 出库地点修改
  1897. /// </summary>
  1898. private void doUpdateStoage()
  1899. {
  1900. ultraGridBillC.UpdateData();
  1901. UltraGridRow ugr = ultraGridBillC.ActiveRow;
  1902. UltraGridRow ugr1 = ultraGridBillM.ActiveRow;
  1903. if (ugr == null) return;
  1904. int count = 0;
  1905. ArrayList list1 = new ArrayList();
  1906. foreach (UltraGridRow row in ultraGridBillC.Rows)
  1907. {
  1908. if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
  1909. {
  1910. count += 1;
  1911. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeBillOfLadingClose.getBillStatus", new Object[] { row.Cells["BillNo"].Text.Trim() }, this.ob);
  1912. if (dt.Rows.Count == 0) return;
  1913. //if (dt.Rows[0]["LOADVEHICLE_TYPE"].ToString().Equals("1"))
  1914. //{
  1915. // if (!dt.Rows[0]["BILL_STATUS"].ToString().Equals("0"))
  1916. // {
  1917. // MessageUtil.ShowTips("提货单不是编制状态不能修改出库地点!");
  1918. // return;
  1919. // }
  1920. //}
  1921. //else
  1922. //{
  1923. // if (dt.Rows[0]["ISPRECLOSE"].ToString().Equals("2"))
  1924. // {
  1925. // MessageUtil.ShowTips("虚单已对齐,不能进行此操作!");
  1926. // return;
  1927. // }
  1928. string endStatr = "0";
  1929. if (row.Cells["EditFlag"].Text.Trim().Equals("已理货")) { endStatr = "1"; }
  1930. DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillCedit", new Object[] { row.Cells["BillNo"].Text.Trim(), row.Cells["JudgeStoveNo"].Text, row.Cells["BatchNo"].Text, row.Cells["GroupNo"].Text, endStatr }, this.ob);
  1931. if (dt1.Rows[0]["EDIT_FLAG"].ToString().Equals("1"))
  1932. {
  1933. MessageUtil.ShowTips("您选择的这炉已理货,不能进行此操作!");
  1934. return;
  1935. }
  1936. //}
  1937. ArrayList list = new ArrayList();
  1938. list.Add(row.Cells["BillNo"].Value.ToString());
  1939. list.Add(row.Cells["JudgeStoveNo"].Value.ToString());
  1940. list.Add(row.Cells["BatchNo"].Value.ToString());
  1941. list.Add(row.Cells["GroupNo"].Value.ToString());
  1942. list.Add(row.Cells["StorageNo"].Value.ToString());
  1943. list.Add(row.Cells["StorageNo"].Text);
  1944. list1.Add(list);
  1945. }
  1946. }
  1947. if (count == 0)
  1948. {
  1949. MessageUtil.ShowTips("请选择要修改出库地点对应炉号!");
  1950. return;
  1951. }
  1952. if (MessageUtil.ShowYesNoAndQuestion("是否修改出库地点") == DialogResult.No) return;
  1953. int update = 0;
  1954. //if (ComTransitTyp.Value.ToString().Equals("405005"))
  1955. //{
  1956. // update = ServerHelper.SetData("com.steering.pss.ydm.acasleavefactory.CoreCasCarBill.updateStoager", new object[] { list1, ugr1.Cells["PlanTransType"].Text }, ob);
  1957. //}
  1958. //else
  1959. //{
  1960. update = ServerHelper.SetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.updateStoager", new object[] { list1 }, ob);
  1961. //}
  1962. if (update>0)
  1963. {
  1964. MessageUtil.ShowTips("出库地点修改成功!");
  1965. QueryBillCInfo(ugr1.Cells["BillNo"].Value.ToString());
  1966. }
  1967. }
  1968. /// <summary>
  1969. /// 装车地点修改
  1970. /// </summary>
  1971. private void doUpdateLoad()
  1972. {
  1973. ultraGridBillC.UpdateData();
  1974. UltraGridRow ugr = ultraGridBillC.ActiveRow;
  1975. UltraGridRow ugr1 = ultraGridBillM.ActiveRow;
  1976. if (ugr == null) return;
  1977. int count = 0;
  1978. ArrayList list1 = new ArrayList();
  1979. foreach (UltraGridRow row in ultraGridBillC.Rows)
  1980. {
  1981. if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
  1982. {
  1983. count += 1;
  1984. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeBillOfLadingClose.getBillStatus", new Object[] { row.Cells["BillNo"].Text.Trim() }, this.ob);
  1985. if (dt.Rows.Count == 0) return;
  1986. string endStatr = "0";
  1987. if (row.Cells["EditFlag"].Text.Trim().Equals("已理货")) { endStatr = "1"; }
  1988. DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillCedit", new Object[] { row.Cells["BillNo"].Text.Trim(), row.Cells["JudgeStoveNo"].Text, row.Cells["BatchNo"].Text, row.Cells["GroupNo"].Text, endStatr }, this.ob);
  1989. if (dt1.Rows[0]["EDIT_FLAG"].ToString().Equals("1"))
  1990. {
  1991. MessageUtil.ShowTips("您选择的这炉已理货,不能进行此操作!");
  1992. return;
  1993. }
  1994. //}
  1995. ArrayList list = new ArrayList();
  1996. list.Add(row.Cells["BillNo"].Value.ToString());
  1997. list.Add(row.Cells["JudgeStoveNo"].Value.ToString());
  1998. list.Add(row.Cells["BatchNo"].Value.ToString());
  1999. list.Add(row.Cells["GroupNo"].Value.ToString());
  2000. list.Add(row.Cells["Vstel"].Value.ToString());
  2001. list.Add(row.Cells["Vstel"].Text.ToString());
  2002. list1.Add(list);
  2003. }
  2004. }
  2005. if (count == 0)
  2006. {
  2007. MessageUtil.ShowTips("请选择要修改装车地点对应炉号!");
  2008. return;
  2009. }
  2010. if (MessageUtil.ShowYesNoAndQuestion("是否修改装车地点") == DialogResult.No) return;
  2011. int update = 0;
  2012. update = ServerHelper.SetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.updateLoad", new object[] { list1 }, ob);
  2013. if (update > 0)
  2014. {
  2015. MessageUtil.ShowTips("装车地点修改成功!");
  2016. QueryBillCInfo(ugr1.Cells["BillNo"].Value.ToString());
  2017. }
  2018. }
  2019. private void ultraGridBillC_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  2020. {
  2021. foreach (UltraGridRow uRow in ultraGridBillC.Selected.Rows)
  2022. {
  2023. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  2024. {
  2025. uRow.Cells["CHK"].Value = true;
  2026. }
  2027. }
  2028. }
  2029. private void ultraGridBillC_CellChange(object sender, CellEventArgs e)
  2030. {
  2031. ultraGridBillC.UpdateData();
  2032. listBillC.Change((YdmZcBillCEntity)e.Cell.Row.ListObject);
  2033. }
  2034. private void ultraGridBillM_BeforeCellDeactivate(object sender, CancelEventArgs e)
  2035. {
  2036. if (listBillC.IsChanged)
  2037. {
  2038. if (MessageUtil.ShowYesNoAndQuestion("是否放弃当前编辑?") == DialogResult.No)
  2039. {
  2040. e.Cancel = true;
  2041. }
  2042. }
  2043. }
  2044. private void ultraGridBillM_CellDataError(object sender, CellDataErrorEventArgs e)
  2045. {
  2046. e.RaiseErrorEvent = false;
  2047. }
  2048. /// <summary>
  2049. /// 直接出库
  2050. /// </summary>
  2051. private void doBillOut()
  2052. {
  2053. ultraGridBillM.UpdateData();
  2054. UltraGridRow ugr = ultraGridBillM.ActiveRow;
  2055. if (ugr == null) return;
  2056. IQueryable<UltraGridRow> ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'");
  2057. if (ugrs.Count() == 0)
  2058. {
  2059. MessageUtil.ShowTips("请选择您要操作的数据!");
  2060. return;
  2061. }
  2062. ArrayList param = new ArrayList();
  2063. ArrayList list = new ArrayList();
  2064. foreach (UltraGridRow row in ugrs)
  2065. {
  2066. string delvaddr = row.Cells["DelvryAddr"].Text;
  2067. if (delvaddr.Equals("客户库-腾飞") || delvaddr.Equals("客户库-宝仓") || delvaddr.Equals("客户库-安利") || delvaddr.Equals("客户库-润德")
  2068. || delvaddr.Equals("客户库-思创") || delvaddr.Equals("客户库-滨城"))
  2069. {
  2070. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic.queryBillC", new object[] { row.Cells["BillNo"].Value.ToString() }, ob);
  2071. if (dt.Rows.Count > 0)
  2072. {
  2073. for (int i = 0; i < dt.Rows.Count; i++)
  2074. {
  2075. string storage = dt.Rows[i]["STORAGE_NO"].ToString();
  2076. if (!storage.Equals("LAL1") && !storage.Equals("LAL2") && !storage.Equals("LAL3") && !storage.Equals("LBC1") &&
  2077. !storage.Equals("LBC2") && !storage.Equals("LTF1") && !storage.Equals("LZD1") && !storage.Equals("LZT1"))
  2078. {
  2079. if (MessageBox.Show("出库地点与交货地点不一致是否直接出库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;
  2080. }
  2081. }
  2082. }
  2083. }
  2084. string typeTran = "";
  2085. if (row.Cells["PlanTransType"].Value.ToString().Equals("汽运"))
  2086. {
  2087. typeTran = "110501";
  2088. }
  2089. else
  2090. {
  2091. typeTran = "110502";
  2092. }
  2093. string[] str = new string[19];
  2094. str[0] = row.Cells["BillNo"].Value.ToString();
  2095. str[1] = row.Cells["SendPlanNo"].Value.ToString();
  2096. str[2] = management_no;
  2097. str[3] = management_name;
  2098. str[4] = departid;
  2099. str[5] = departname;
  2100. str[6] = row.Cells["SaleOrg"].Value.ToString();
  2101. str[7] = row.Cells["SaleOrgDesc"].Value.ToString();
  2102. str[8] = typeTran;
  2103. str[9] = row.Cells["ReceivNo"].Value.ToString();
  2104. str[10] = row.Cells["ReceivNm"].Value.ToString();
  2105. str[11] = row.Cells["StlmtUnitNo"].Value.ToString();
  2106. str[12] = row.Cells["StlmtUnitNm"].Value.ToString();
  2107. str[13] = row.Cells["StationNo"].Value.ToString();
  2108. str[14] = row.Cells["StationNm"].Value.ToString();
  2109. str[15] = row.Cells["SpclLnNo"].Value.ToString();
  2110. str[16] = row.Cells["SpclLnNm"].Value.ToString();
  2111. str[17] = this.UserInfo.GetUserGroup();//班组
  2112. str[18] = this.UserInfo.GetUserOrder();//班次
  2113. param.Add(str);
  2114. }
  2115. if (MessageBox.Show("是否确认出库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  2116. {
  2117. return;
  2118. }
  2119. CoreClientParam ccp = new CoreClientParam();
  2120. try
  2121. {
  2122. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  2123. if (Constant.WaitingForm == null)
  2124. {
  2125. Constant.WaitingForm = new WaitingForm();
  2126. }
  2127. Constant.WaitingForm.ShowToUser = true;
  2128. Constant.WaitingForm.Show();
  2129. Constant.WaitingForm.Update();
  2130. //if (ComTransitTyp.Value.ToString().Equals("405005"))
  2131. //{
  2132. // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.FrmCasOutAutomatic";
  2133. // ccp.MethodName = "addTallyInfo";
  2134. //}
  2135. //else
  2136. //{
  2137. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic";
  2138. ccp.MethodName = "addTallyInfo";
  2139. //}
  2140. ccp.ServerParams = new object[] { param, this.UserInfo.GetUserName() };
  2141. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  2142. this.Cursor = Cursors.Default;
  2143. Constant.WaitingForm.ShowToUser = false;
  2144. Constant.WaitingForm.Close();
  2145. Constant.WaitingForm = null;
  2146. if (ccp.ReturnCode == -1) return;
  2147. }
  2148. catch (Exception ex)
  2149. {
  2150. this.Cursor = Cursors.Default;
  2151. Constant.WaitingForm.ShowToUser = false;
  2152. Constant.WaitingForm.Close();
  2153. Constant.WaitingForm = null;
  2154. }
  2155. if (ccp.ReturnCode != -1)
  2156. {
  2157. MessageUtil.ShowTips(ccp.ReturnInfo);
  2158. if (ccp.ReturnInfo.Equals("出库成功!"))
  2159. {
  2160. QueryBillMInfo();
  2161. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  2162. {
  2163. if (ugrc.Cells["BillNo"].Text.Equals(_billNo))
  2164. {
  2165. ugrc.Activate();
  2166. _billNo = "";
  2167. return;
  2168. }
  2169. }
  2170. }
  2171. }
  2172. }
  2173. /// <summary>
  2174. /// 撤销出库
  2175. /// </summary>
  2176. private void doDeleteBillOut()
  2177. {
  2178. ultraGridBillM.UpdateData();
  2179. UltraGridRow ugr = ultraGridBillM.ActiveRow;
  2180. if (ugr == null) return;
  2181. IQueryable<UltraGridRow> ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'");
  2182. if (ugrs.Count() == 0)
  2183. {
  2184. MessageUtil.ShowTips("请选择您要操作的数据!");
  2185. return;
  2186. }
  2187. ArrayList param = new ArrayList();
  2188. foreach (UltraGridRow row in ugrs)
  2189. {
  2190. ArrayList parm = new ArrayList();
  2191. parm.Add(row.Cells["BillNo"].Text.Trim());
  2192. DataTable dg = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic.selectYearMoth", new object[] { parm }, ob);
  2193. if (int.Parse(dg.Rows[0]["ACOUNT"].ToString()) > 0)
  2194. {
  2195. MessageUtil.ShowTips("该提货单【" + row.Cells["BillNo"].Text.Trim() + "】对应的炉批信息已进行结转,不允许撤销!");
  2196. return;
  2197. }
  2198. string[] str = new string[6];
  2199. str[0] = row.Cells["BillNo"].Value.ToString();
  2200. str[1] = row.Cells["SendPlanNo"].Value.ToString();
  2201. str[2] = management_no;
  2202. str[3] = management_name;
  2203. str[4] = departid;
  2204. str[5] = departname;
  2205. param.Add(str);
  2206. }
  2207. if (MessageBox.Show("是否确认撤销出库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  2208. {
  2209. return;
  2210. }
  2211. CoreClientParam ccp = new CoreClientParam();
  2212. try
  2213. {
  2214. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  2215. if (Constant.WaitingForm == null)
  2216. {
  2217. Constant.WaitingForm = new WaitingForm();
  2218. }
  2219. Constant.WaitingForm.ShowToUser = true;
  2220. Constant.WaitingForm.Show();
  2221. Constant.WaitingForm.Update();
  2222. //if (ComTransitTyp.Value.ToString().Equals("405005"))
  2223. //{
  2224. // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.FrmCasOutAutomatic";
  2225. // ccp.MethodName = "deleteTallyInfo";
  2226. //}
  2227. //else
  2228. //{
  2229. ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic";
  2230. ccp.MethodName = "deleteTallyInfo";
  2231. //}
  2232. ccp.ServerParams = new object[] { param, this.UserInfo.GetUserName() };
  2233. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  2234. this.Cursor = Cursors.Default;
  2235. Constant.WaitingForm.ShowToUser = false;
  2236. Constant.WaitingForm.Close();
  2237. Constant.WaitingForm = null;
  2238. if (ccp.ReturnCode == -1) return;
  2239. }
  2240. catch (Exception ex)
  2241. {
  2242. this.Cursor = Cursors.Default;
  2243. Constant.WaitingForm.ShowToUser = false;
  2244. Constant.WaitingForm.Close();
  2245. Constant.WaitingForm = null;
  2246. }
  2247. if (ccp.ReturnCode != -1)
  2248. {
  2249. MessageUtil.ShowTips(ccp.ReturnInfo);
  2250. if (ccp.ReturnInfo.Equals("撤销出库成功!"))
  2251. {
  2252. QueryBillMInfo();
  2253. foreach (UltraGridRow ugrc in ultraGridBillM.Rows)
  2254. {
  2255. if (ugrc.Cells["BillNo"].Text.Equals(_billNo))
  2256. {
  2257. ugrc.Activate();
  2258. _billNo = "";
  2259. return;
  2260. }
  2261. }
  2262. }
  2263. }
  2264. }
  2265. /// <summary>
  2266. /// 管坯支数
  2267. /// </summary>
  2268. /// <param name="sender"></param>
  2269. /// <param name="e"></param>
  2270. private void ultraGridPipeMat_CellChange(object sender, CellEventArgs e)
  2271. {
  2272. UltraGridRow urg = ultraGridOrder.ActiveRow;
  2273. if (e.Cell.Row.Cells["ActCount"].Value == null)
  2274. {
  2275. e.Cell.Row.Cells["ActCount"].Value = "0";
  2276. e.Cell.Row.Cells["ActWeight"].Value = "0";
  2277. e.Cell.Row.Cells["ActLen"].Value = "0";
  2278. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  2279. {
  2280. e.Cell.Row.Cells["SendNum"].Value = 0;
  2281. }
  2282. }
  2283. else
  2284. {
  2285. ultraGridPipeMat.UpdateData();
  2286. string actCount = e.Cell.Row.Cells["ActCount"].Value.ToString();
  2287. if (!StringUtil.IsInt(actCount) || actCount == "0")
  2288. {
  2289. e.Cell.Row.Cells["ActCount"].Value = "0";
  2290. e.Cell.Row.Cells["ActWeight"].Value = "0";
  2291. e.Cell.Row.Cells["ActLen"].Value = "0";
  2292. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  2293. {
  2294. e.Cell.Row.Cells["SendNum"].Value = 0;
  2295. }
  2296. }
  2297. else
  2298. {
  2299. PipeMatGpMEntity matpipeEntity = (PipeMatGpMEntity)ultraGridPipeMat.ActiveRow.ListObject;
  2300. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.acasleavefactory.CoreCasCarBill.checkMatWeight", new object[] { JSONFormat.Format(matpipeEntity) }, this.ob);
  2301. if (dt != null && dt.Rows.Count > 0)
  2302. {
  2303. e.Cell.Row.Cells["ActWeight"].Value = dt.Rows[0][0].ToString();
  2304. e.Cell.Row.Cells["ActCount"].Value = dt.Rows[0][1].ToString();
  2305. e.Cell.Row.Cells["ActLen"].Value = dt.Rows[0][2].ToString();
  2306. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  2307. {
  2308. e.Cell.Row.Cells["SendNum"].Value = dt.Rows[0][0].ToString();
  2309. }
  2310. }
  2311. else
  2312. {
  2313. e.Cell.Row.Cells["ActCount"].Value = "0";
  2314. e.Cell.Row.Cells["ActWeight"].Value = "0";
  2315. e.Cell.Row.Cells["ActLen"].Value = "0";
  2316. if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支"))
  2317. {
  2318. e.Cell.Row.Cells["SendNum"].Value = 0;
  2319. }
  2320. }
  2321. }
  2322. }
  2323. if (e.Cell.Column.Key.Equals("SendNum"))
  2324. {
  2325. if (e.Cell.Row.Cells["SendNum"].Value == null)
  2326. {
  2327. e.Cell.Row.Cells["SendNum"].Value = "0";
  2328. }
  2329. else
  2330. {
  2331. ultraGridPipeMat.UpdateData();
  2332. string actLen = e.Cell.Row.Cells["SendNum"].Value.ToString();
  2333. if (!StringUtil.IsFloat(actLen) || actLen == "0")//actCount == "" || int.Parse(actCount)==0
  2334. {
  2335. e.Cell.Row.Cells["SendNum"].Value = "0";
  2336. }
  2337. }
  2338. }
  2339. string storage = "";
  2340. foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows)
  2341. {
  2342. if (Convert.ToBoolean(ugr1.Cells["CHK"].Text) == true)
  2343. {
  2344. storage = ugr1.Cells["StorageNo"].Value.ToString();
  2345. }
  2346. }
  2347. double count = 0;
  2348. double weght = 0;
  2349. double len = 0;
  2350. ultraGroupBox4.Text = "资源信息区";
  2351. int i = 0;
  2352. foreach (UltraGridRow ugr in ultraGridPipeMat.Rows)
  2353. {
  2354. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  2355. {
  2356. if (storage != ugr.Cells["StorageNo"].Value.ToString())
  2357. {
  2358. i++;
  2359. }
  2360. ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text;
  2361. count += double.Parse(ugr.Cells["ActCount"].Value.ToString());
  2362. weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString());
  2363. len += double.Parse(ugr.Cells["ActLen"].Value.ToString());
  2364. }
  2365. }
  2366. ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3");
  2367. }
  2368. /// <summary>
  2369. /// 管坯托选
  2370. /// </summary>
  2371. /// <param name="sender"></param>
  2372. /// <param name="e"></param>
  2373. private void ultraGridPipeMat_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  2374. {
  2375. foreach (UltraGridRow uRow in ultraGridPipeMat.Selected.Rows)
  2376. {
  2377. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  2378. {
  2379. uRow.Cells["CHK"].Value = true;
  2380. }
  2381. }
  2382. string storage = "";
  2383. foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows)
  2384. {
  2385. if (Convert.ToBoolean(ugr1.Cells["CHK"].Text) == true)
  2386. {
  2387. storage = ugr1.Cells["StorageNo"].Value.ToString();
  2388. }
  2389. }
  2390. double count = 0;
  2391. double weght = 0;
  2392. double len = 0;
  2393. ultraGroupBox4.Text = "资源信息区";
  2394. int i = 0;
  2395. UltraGridRow row = ultraGridPipeMat.ActiveRow;
  2396. foreach (UltraGridRow ugr in ultraGridPipeMat.Rows)
  2397. {
  2398. if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true)
  2399. {
  2400. if (storage != ugr.Cells["StorageNo"].Value.ToString())
  2401. {
  2402. i++;
  2403. }
  2404. ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text;
  2405. count += double.Parse(ugr.Cells["ActCount"].Value.ToString());
  2406. weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString());
  2407. len += double.Parse(ugr.Cells["ActLen"].Value.ToString());
  2408. }
  2409. }
  2410. ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3");
  2411. }
  2412. private void chkAll_CheckedChanged(object sender, EventArgs e)
  2413. {
  2414. if (chkAll.Checked)
  2415. {
  2416. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGridSourse.Rows)
  2417. {
  2418. uRow.Cells["CHC"].Value = true;
  2419. }
  2420. }
  2421. else
  2422. {
  2423. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGridSourse.Rows)
  2424. {
  2425. uRow.Cells["CHC"].Value = false;
  2426. }
  2427. }
  2428. double count = 0;
  2429. double weght = 0;
  2430. double len = 0;
  2431. double send = 0;
  2432. ultraGroupBox4.Text = "资源信息区";
  2433. UltraGridRow row = ultraGridSourse.ActiveRow;
  2434. foreach (UltraGridRow ugr in ultraGridSourse.Rows)
  2435. {
  2436. if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true)
  2437. {
  2438. ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text;
  2439. count += double.Parse(ugr.Cells["ActCount"].Value.ToString());
  2440. weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString());
  2441. len += double.Parse(ugr.Cells["ActLen"].Value.ToString());
  2442. send += double.Parse(ugr.Cells["SendNum"].Value.ToString());
  2443. }
  2444. }
  2445. ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3") + " 实发数:" + send.ToString("f3");
  2446. }
  2447. private void cmbAcount_EditorButtonClick(object sender, EditorButtonEventArgs e)
  2448. {
  2449. this.ultraGridSourse.UpdateData();
  2450. UltraGridRow row = this.ultraGridSourse.ActiveRow;
  2451. UltraGridRow ugr = ultraGridOrder.ActiveRow;
  2452. if (row == null)
  2453. {
  2454. return;
  2455. }
  2456. FrmMatNo frm = new FrmMatNo(row, ob);
  2457. frm.ShowDialog();
  2458. if (frm.flag.Equals("1"))
  2459. {
  2460. row.Cells["MatNo"].Value = frm.matNo.TrimEnd(new char[] { ',' }).ToString();
  2461. row.Cells["ActCount"].Value = frm.acount.ToString();
  2462. row.Cells["MeasuringSeq"].Value = frm.mesNo.TrimEnd(new char[] { ',' }).ToString();
  2463. row.Cells["ActWeight"].Value = frm.wgt;
  2464. if (ugr.Cells["ORDER_UNIT"].Text.Trim().Equals("米") || ugr.Cells["ORDER_UNIT"].Text.Trim().Equals("英尺"))
  2465. {
  2466. row.Cells["SendNum"].Value = frm.sumlength;
  2467. }
  2468. else if (ugr.Cells["ORDER_UNIT"].Text.Equals("支") || ugr.Cells["ORDER_UNIT"].Text.Equals("个"))
  2469. {
  2470. row.Cells["SendNum"].Value = frm.acount;
  2471. }
  2472. else
  2473. {
  2474. row.Cells["SendNum"].Value = frm.wgt;
  2475. }
  2476. }
  2477. else
  2478. {
  2479. return;
  2480. }
  2481. }
  2482. private void cmbAcount_EditorButtonClick_1(object sender, EditorButtonEventArgs e)
  2483. {
  2484. }
  2485. }
  2486. }