FrmPlnOrderZgSL1.cs 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Format;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Tool;
  14. using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
  15. using Core.StlMes.Client.PlnSaleOrd.工序排产;
  16. using Core.StlMes.Client.PlnSaleOrd.工序排产.entity;
  17. using CoreFS.CA06;
  18. using Infragistics.Win;
  19. using Infragistics.Win.UltraWinEditors;
  20. using Infragistics.Win.UltraWinGrid;
  21. using Core.StlMes.Client.PlnSaleOrd.OrderManage.froms;
  22. using Newtonsoft.Json;
  23. using Core.StlMes.Client.PlnSaleOrd.窗体;
  24. using Core.Mes.Client.Comm;
  25. namespace Core.StlMes.Client.PlnSaleOrd
  26. {
  27. ///custominfo==0 表示轧管排产查询界面
  28. /// <summary>
  29. /// 轧制排产
  30. /// </summary>
  31. public partial class FrmPlnOrderZgSL1 : FrmBase
  32. {
  33. DataTable dtPlinGroup = null;
  34. private string departm = "";//获取部门ID
  35. private string[] plineCode = null;//获取产线代码
  36. /// <summary>
  37. /// 订单编号
  38. /// </summary>
  39. private string _ProPlanId = "";
  40. /// <summary>
  41. /// 排产序号
  42. /// </summary>
  43. private string _GxPlanNo = "";
  44. UltraComboEditor uceDimaM = new UltraComboEditor();//芯棒直径
  45. /// <summary>
  46. /// 行首背景色
  47. /// </summary>
  48. private Color _backColor = new Color();
  49. /// <summary>
  50. /// 调整行集合
  51. /// </summary>
  52. private ArrayList _entityList = null;
  53. public FrmPlnOrderZgSL1()
  54. {
  55. InitializeComponent();
  56. this.IsLoadUserView = true;
  57. }
  58. public override void ToolBar_Click(object sender, string ToolbarKey)
  59. {
  60. base.ToolBar_Click(sender, ToolbarKey);
  61. switch (ToolbarKey)
  62. {
  63. case "Query"://查询
  64. Query();
  65. break;
  66. case "Capacity"://产线能力维护
  67. Capacity();
  68. break;
  69. case "AddRepairPlan"://检修计划
  70. AddRepairPlan();
  71. break;
  72. case "DeleteRepairPlan"://删除检修计划
  73. DeleteRepairPlan();
  74. break;
  75. case "PlineChange"://产线调整
  76. PlineChange();
  77. break;
  78. case "TimeChange"://时间调整
  79. TimeChange();
  80. break;
  81. case "StatusChange"://状态调整
  82. StatusChange();
  83. break;
  84. case "InitData"://耗时初始化
  85. InitData();
  86. break;
  87. case "Spit"://拆分订单
  88. Spit();
  89. break;
  90. case "Merge"://合并订单
  91. Merge();
  92. break;
  93. case "Issued"://下发
  94. Issued("0");
  95. break;
  96. case "CancelIssued"://取消下发
  97. Issued("1");
  98. break;
  99. case "SetPlanFinish"://设置合同完成
  100. SetPlanFinish();
  101. break;
  102. case "ModifyGpAimWall"://重算
  103. ModifyGpAimWall();
  104. break;
  105. case "UpdateCrop"://修改切头尾
  106. UpdateCrop();
  107. break;
  108. case "UpdateDiameM"://修改芯棒直径
  109. UpdateDiameM();
  110. break;
  111. case "ModifyThicknesWall"://修改控制壁厚
  112. ModifyThicknesWall();
  113. break;
  114. case "Recalculate"://重新计算
  115. Recalculate();
  116. break;
  117. case "Export": //导出
  118. GridHelper.ulGridToExcel(ultraGridZgS, "轧管排产信息");
  119. break;
  120. case "UpdateMonth"://修改排产月份
  121. UpdateMonth();
  122. break;
  123. case "ApplyApproval"://申请审批
  124. ApplyApproval();
  125. break;
  126. case "ModifyBatter"://修改坯子
  127. ModifyBatter();
  128. break;
  129. case "UpdateGroupGp"://修改索引码
  130. UpdateGroupGp();
  131. break;
  132. case "UpdateGradeCode"://修改钢种
  133. UpdateGradeCode();
  134. break;
  135. case "DeleteGperId"://删除管坯需求号
  136. DeleteGperId();
  137. break;
  138. case "UpdateZz"://获取铸造产线
  139. UpdateZz();
  140. break;
  141. case "Termination": //订单终止
  142. doTermination();
  143. break;
  144. case "Close": //关闭
  145. this.Close();
  146. break;
  147. default:
  148. break;
  149. }
  150. }
  151. private void FrmPlnOrderZgS_Load(object sender, EventArgs e)
  152. {
  153. if (CustomInfo == null) { CustomInfo = ""; }
  154. //设置列头名称
  155. EntityHelper.ShowGridCaption<PlnOrderZgSOEntity>(ultraGridZgS.DisplayLayout.Bands[0]);
  156. if (CustomInfo == "0")
  157. {
  158. PlanComm.setGridActivation(this.ultraGridZgS.DisplayLayout.Bands[0], "CHC", "ProMonth");//, "OutsBilletFl"
  159. EntityHelper.setColumnShowOrHidden(ultraGridZgS, new string[] { "PenaltyDesc", "OrderDocumentaryName", "OrderCreateName" }, false);
  160. }
  161. else
  162. {
  163. BaseHelper.setOtherColumnReadOnly(ultraGridZgS, new string[] { "CHC", "PlineCode", "PlanTimeB", "RepairType", "PlanUsetime", "Aimwallthick", "LenGpSingle", "LenCuthead", "LenCutend", "TubeEndRatio", "Memo", "LengthdiscN" });
  164. BaseHelper.setColumnBackColor(ultraGridZgS, new string[] { "PlineCode", "Aimwallthick", "LenGpSingle", "LenCuthead", "LenCutend", "DiameterMandrel", "TubeEndRatio", "Memo", "LengthdiscN" });
  165. }
  166. BaseHelper.InitCellPosition(ultraGridZgS, new string[] { "GxPlanNo", "OrderSeq", "DeliveryNo", "Outdiameter", "Wallthick",
  167. "LenRollMax", "LenRollMin", "Aimoutdiameter", "Aimwallthick", "Aimlength", "DiameterGp", "LenGpSingle", "RollLength",
  168. "LenCuthead", "LenCutend", "OutnumCut", "DiameterMandrel", "InWeightS", "InNumS", "WeigthS", "NumS", "AddWtIn",
  169. "AddNumIn", "MatchWtIn", "MatchNumIn", "GxProSeq", "PlanUsetime", "BatchedWt", "BatchedNum", "Finishweight",
  170. "Finishnum", "ProcessingCost", "TotalCost" ,"FinishWgt","UnfinishWgt","UnfinishNum","OutdiameterZg","WallthickZg","GpreqNum","GpreqWeight","TubeEndRatio","WeigthSMin","PlansNum","TimeDiffer","AfProNum","AmountDifference","LjNum","LjWeight","FurnaNum","FurnaWeight" ,"CkNum","CkWeight","HrCapcty","ExpectWt","ExpectNum","PendNum","PendWeight","LjWeightB","LjNumB"});
  171. BaseHelper.setUltraGridColumnMaxInput(ultraGridZgS, new string[] { "WeigthS", "WeigthSMin", "GpreqWeight", "InWeightS", "AddWtIn", "MatchWtIn", "BatchedWt", "AmountDifference", "UnfinishWgt", "LjWeight", "FurnaWeight", "CkWeight", "ExpectWt", "PendWeight", "LjWeightB" });
  172. plineCode= PlanHelper.InitDropPlinePower("D",comPline,this.ValidDataPurviewIds, this.ob);
  173. PlanHelper.InitRepairType(ultraGridZgS, this);
  174. PlanHelper.InitEditPline("D", "", ultraGridZgS, this);
  175. if (CustomInfo != "0") { BaseHelper.ForbidSort(ultraGridZgS); }
  176. BaseHelper.GridColumnSum(ultraGridZgS, new string[] { "WeigthS", "WeigthSMin", "GpreqWeight", "PendWeight" });
  177. BaseHelper.GridColumnCount(ultraGridZgS, new string[] { "NumS", "GpreqNum", "PlansNum", "PendNum" });
  178. BaseHelper.InitCellPositionMiddle(ultraGridZgS, new string[] { "IsRepairPln", "IsPlanOk", "IfMonitorZg", "GpreqIfOk", "Isendgx" });
  179. BaseHelper.setUltraGridColumnColor(ultraGridZgS, new string[] { "CraftFileNo", "CraftFileLv2G", "Gradename", "DiameterGp" }, Color.GreenYellow);
  180. //PlanHelper.InitEditGroup("1218", ultraGridZgS, this, "OutsBilletFl");
  181. PlanHelper.InitEditGroup("1219", ultraGridZgS, this, "OutsStlPipeFl");
  182. _backColor = ultraGridZgS.DisplayLayout.Override.RowSelectorAppearance.BackColor;
  183. InitTime();
  184. InitColorStyle();
  185. }
  186. /// <summary>
  187. /// 初始化列状态
  188. /// </summary>
  189. private void InitColorStyle()
  190. {
  191. ultraGridZgS.DisplayLayout.Bands[0].Columns["Gradename"].EditorComponent = ultraTextEditor1;
  192. ultraGridZgS.DisplayLayout.Bands[0].Columns["Gradename"].ButtonDisplayStyle
  193. = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
  194. ultraGridZgS.DisplayLayout.Bands[0].Columns["PlanTimeB"].Format = "yyyy-MM-dd HH:mm:ss";
  195. ultraGridZgS.DisplayLayout.Bands[0].Columns["PlanTimeB"].MaskInput = "yyyy-mm-dd hh:mm:ss";
  196. ultraGridZgS.DisplayLayout.Bands[0].Columns["PlanTimeB"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTime;
  197. ultraGridZgS.DisplayLayout.Bands[0].Columns["CraftFileLv2G"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  198. ultraGridZgS.DisplayLayout.Bands[0].Columns["CraftFileNo"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  199. //ultraGridZgS.DisplayLayout.Bands[0].Columns["Gradename"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  200. ultraGridZgS.DisplayLayout.Bands[0].Columns["DiameterGp"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  201. ultraGridZgS.DisplayLayout.Bands[0].Columns["AfInfo"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  202. ultraGridZgS.DisplayLayout.Bands[0].Columns["AfInfo"].CellAppearance.BackColor = Color.GreenYellow;
  203. ultraGridZgS.DisplayLayout.Bands[0].Columns["DiameterMandrel"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  204. ultraGridZgS.DisplayLayout.Bands[0].Columns["AfProLin"].CellAppearance.BackColor = Color.GreenYellow;
  205. ultraGridZgS.DisplayLayout.Bands[0].Columns["TimeDiffer"].CellAppearance.BackColor = Color.GreenYellow;
  206. ultraGridZgS.DisplayLayout.Bands[0].Columns["AfProNum"].CellAppearance.BackColor = Color.GreenYellow;
  207. ultraGridZgS.DisplayLayout.Bands[0].Columns["AfProLin"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  208. UltraNumericEditor[] uneArr = new UltraNumericEditor[3];
  209. for (int i = 0; i < uneArr.Length; i++)
  210. {
  211. uneArr [i]= new UltraNumericEditor();
  212. uneArr[i].NumericType =NumericType.Double;
  213. if (i == 1)
  214. {
  215. uneArr[i].MaskInput = "nnnnn";
  216. }
  217. else
  218. {
  219. uneArr[i].MaskInput = "nnnnn.nn";
  220. }
  221. uneArr[i].SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always;
  222. this.Controls.Add(uneArr[i]);
  223. uneArr[i].Visible = false;
  224. }
  225. uneArr[0].SpinIncrement = 0.01;
  226. uneArr[1].SpinIncrement = 50;
  227. uneArr[2].SpinIncrement =10;
  228. ultraGridZgS.DisplayLayout.Bands[0].Columns["Outdiameter"].EditorComponent = uneArr[0];
  229. ultraGridZgS.DisplayLayout.Bands[0].Columns["Wallthick"].EditorComponent = uneArr[0];
  230. ultraGridZgS.DisplayLayout.Bands[0].Columns["OutdiameterZg"].EditorComponent = uneArr[0];
  231. ultraGridZgS.DisplayLayout.Bands[0].Columns["WallthickZg"].EditorComponent = uneArr[0];
  232. //ultraGridZgS.DisplayLayout.Bands[0].Columns["PipeLengthMin"].EditorComponent = uneArr[0];
  233. //ultraGridZgS.DisplayLayout.Bands[0].Columns["PipeLengthMax"].EditorComponent = uneArr[0];
  234. ultraGridZgS.DisplayLayout.Bands[0].Columns["Aimoutdiameter"].EditorComponent = uneArr[0];
  235. ultraGridZgS.DisplayLayout.Bands[0].Columns["Aimwallthick"].EditorComponent = uneArr[0];
  236. ultraGridZgS.DisplayLayout.Bands[0].Columns["Aimlength"].EditorComponent = uneArr[0];
  237. ultraGridZgS.DisplayLayout.Bands[0].Columns["RollLength"].EditorComponent = uneArr[0];
  238. ultraGridZgS.DisplayLayout.Bands[0].Columns["LenGpSingle"].EditorComponent = uneArr[2];
  239. ultraGridZgS.DisplayLayout.Bands[0].Columns["LenCuthead"].EditorComponent = uneArr[1];
  240. ultraGridZgS.DisplayLayout.Bands[0].Columns["LenCutend"].EditorComponent = uneArr[1];
  241. }
  242. private void InitTime()
  243. {
  244. DateTime now = DateTime.Now;
  245. DateTime d1 = new DateTime(now.Year, now.Month, 1);
  246. DateTime d2 = d1.AddMonths(1).AddSeconds(-1);
  247. txtPlanTimeB1.Value = d1;
  248. txtPlanTimeB2.Value = d2;
  249. txtPlanTimeE1.Value = d1;
  250. txtPlanTimeE2.Value = d2;
  251. }
  252. /// <summary>
  253. /// 初始化芯棒直径
  254. /// </summary>
  255. /// <param name="plineCode">产线</param>
  256. /// <param name="PassCode">孔型编码</param>
  257. /// <param name="aimoutdiameter">控制外径</param>
  258. /// <param name="aimwallthick">控制壁厚</param>
  259. //private void InitDimaM(string plineCode, string passCode, string aimoutdiameter, string aimwallthick)
  260. //{
  261. // DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.order.CorePlnProcessOrd.queryPlnMandrelId", new object[] { plineCode, passCode, aimoutdiameter,aimwallthick }, this.ob);
  262. // UltraComboEditor uce = new UltraComboEditor();
  263. // ultraGridZgS.Controls.Add(uce);
  264. // uce.Visible = false;
  265. // uce.DropDownListWidth = -1;
  266. // uce.DropDownStyle = DropDownStyle.DropDownList;
  267. // uce.DataSource = dt1;
  268. // uce.DisplayMember = "DIAMETER_MANDREL";
  269. // uce.ValueMember = "MANDREL_ID";
  270. // ultraGridZgS.DisplayLayout.Bands[0].Columns["DiameterMandrel"].EditorComponent = uce;
  271. // ultraGridZgS.DisplayLayout.Bands[0].Columns["DiameterMandrel"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  272. //}
  273. private void chcPline_CheckedChanged(object sender, EventArgs e)
  274. {
  275. if (chcPline.Checked) { comPline.ReadOnly = false; } else { comPline.ReadOnly = true; }
  276. if (chcOrderNo.Checked) { txtOrderNo.ReadOnly = false; } else { txtOrderNo.ReadOnly = true; }
  277. if (chcProPlanId.Checked) { txtProPlanId.ReadOnly = false; } else { txtProPlanId.ReadOnly = true; }
  278. if (chcPlanTimeB.Checked) { txtPlanTimeB1.ReadOnly = false; txtPlanTimeB2.ReadOnly = false; } else { txtPlanTimeB1.ReadOnly = true; txtPlanTimeB2.ReadOnly = true; }
  279. if (chcPlanTimeE.Checked) { txtPlanTimeE1.ReadOnly = false; txtPlanTimeE2.ReadOnly = false; } else { txtPlanTimeE1.ReadOnly = true; txtPlanTimeE2.ReadOnly = true; }
  280. }
  281. private void ultraGridZgS_InitializeRow(object sender, InitializeRowEventArgs e)
  282. {
  283. PlanHelper.ControlCellEdit(e.Row);
  284. }
  285. /// <summary>
  286. /// 查询
  287. /// </summary>
  288. private void Query()
  289. {
  290. //产线
  291. string comPlineCode = "";
  292. if (chcPline.Checked)
  293. {
  294. comPlineCode = comPline.Value == null ? "" : comPline.Value.ToString();
  295. }
  296. //如果是排产界面,则下拉框的产线不能为空,需要排序
  297. if (!CustomInfo.Equals("0") && comPline.Text.Equals(""))
  298. {
  299. MessageUtil.ShowTips("请选择产线!");
  300. return;
  301. }
  302. WaitingForm2 wf3 = new WaitingForm2("正在刷新,请稍候....");
  303. try
  304. {
  305. this.Cursor = Cursors.WaitCursor;
  306. //执行状态
  307. string[] statusArr = contorlPlanStatus1.statusArr;
  308. //合同号
  309. string orderNo = "";
  310. if (chcOrderNo.Checked) { orderNo = txtOrderNo.Text.Trim(); }
  311. string proPlanId = "";
  312. if (chcProPlanId.Checked) { proPlanId = txtProPlanId.Text.Trim(); }
  313. string planTimeB1 = "";
  314. string planTimeB2 = "";
  315. if (chcPlanTimeB.Checked && txtPlanTimeB2.Value != null && txtPlanTimeB1.Value != null)
  316. {
  317. planTimeB1 = DateTime.Parse(txtPlanTimeB1.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  318. planTimeB2 = DateTime.Parse(txtPlanTimeB2.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  319. }
  320. string planTimeE1 = "";
  321. string planTimeE2 = "";
  322. if (chcPlanTimeE.Checked && txtPlanTimeE2.Value != null && txtPlanTimeE1.Value != null)
  323. {
  324. planTimeE1 = DateTime.Parse(txtPlanTimeE1.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  325. planTimeE2 = DateTime.Parse(txtPlanTimeE2.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  326. }
  327. if (plineCode == null)
  328. {
  329. MessageUtil.ShowTips("该用户没有轧管产线查看权限!");
  330. return;
  331. }
  332. dtPlinGroup = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryPlinCodeGroup", null, this.ob);
  333. List<PlnOrderZgSOEntity> listSource = EntityHelper.GetData<PlnOrderZgSOEntity>
  334. ("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryPlanOrderD", new object[] { plineCode, proPlanId, orderNo, statusArr, planTimeB1, planTimeB2, planTimeE1, planTimeE2, comPlineCode,"","" }, this.ob);
  335. plnOrderZgSOEntityBindingSource.DataSource = listSource;
  336. //ProducHelper.copyLZData(ultraGridZgS, "D", this.ob);
  337. //ProducHelper.copyLZDataZg(ultraGridZgS, "D", this.ob);
  338. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  339. {
  340. string str = ugr.Cells["AfInfo"].Text.Trim();
  341. if (str != null && str != "")
  342. {
  343. string[] sArray = str.Split(new char[1] { ','});
  344. ugr.Cells["TimeDiffer"].Value = String.Format("{0:N2} ", sArray[0]).Substring(0, sArray[0].IndexOf("天"));
  345. ugr.Cells["AfProLin"].Value = sArray[1];
  346. ugr.Cells["AfProNum"].Value = sArray[2].Substring(0, sArray[2].IndexOf("条"));
  347. if (dtPlinGroup.Rows.Count > 0)
  348. {
  349. //for (int i = 0; i < dtPlinGroup.Rows.Count; i++)
  350. //{
  351. string plinGroup = dtPlinGroup.Rows[0]["PLINE_NAME_M"].ToString() + "/" + dtPlinGroup.Rows[0]["PLINE_NAME_C"].ToString();
  352. DataRow[] dr = dtPlinGroup.Select("PLINE_NAME_M='" + ugr.Cells["PlineCode"].Text.ToString() + "' AND PLINE_NAME_C ='" + ugr.Cells["AfProLin"].Value.ToString() + "'", "");
  353. if (dr == null || dr.Length == 0) { }
  354. else
  355. {
  356. //DataTable tmp = dr.Table.Clone(); // 复制DataRow的表结构
  357. //if (tmp.Rows.Count > 0)
  358. //{
  359. ugr.Cells["StockGroupName"].Value = dr[0]["STOCK_GROUP_NAME"].ToString();
  360. //}
  361. }
  362. }
  363. }
  364. if (ugr.Cells["WeigthSMin"].Text.ToString().Equals("") || ugr.Cells["WeigthSMin"].Value.ToString().Equals("0"))
  365. {
  366. ugr.Cells["AmountDifference"].Value = (double.Parse(ugr.Cells["ExpectWt"].Value.ToString()) - double.Parse(ugr.Cells["WeigthS"].Value.ToString())).ToString();
  367. }
  368. else
  369. {
  370. ugr.Cells["AmountDifference"].Value = (double.Parse(ugr.Cells["ExpectWt"].Value.ToString()) - double.Parse(ugr.Cells["WeigthSMin"].Value.ToString())).ToString();
  371. }
  372. }
  373. //激活操作行代码
  374. //if ((!_ProPlanId.Equals("") && !_GxPlanNo.Equals("")) || _entityList != null)
  375. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  376. {
  377. if (!_ProPlanId.Equals("") && !_GxPlanNo.Equals(""))
  378. {
  379. if (ugr.Cells["ProPlanId"].Text.Trim().Equals(_ProPlanId) && ugr.Cells["GxPlanNo"].Text.Trim().Equals(_GxPlanNo))
  380. {
  381. ugr.Activate();
  382. break;
  383. }
  384. }
  385. if (_entityList != null)
  386. {
  387. for (int i = 0; i < _entityList.Count; i++)
  388. {
  389. PlnOrderZgSEntity jgxsEntity = (PlnOrderZgSEntity)_entityList[i];
  390. if (ugr.Cells["ProPlanId"].Text.Trim().Equals(jgxsEntity.ProPlanId) && ugr.Cells["GxPlanNo"].Text.Trim().Equals(jgxsEntity.GxPlanNo))
  391. {
  392. ugr.Appearance.BackColor = Color.Wheat;
  393. ugr.Activate();
  394. }
  395. //if (!ugr.Cells["GxProSeq"].Text.Trim().Equals(jgxsEntity.GxProSeq))
  396. //{
  397. // ugr.Cells["GxProSeq"].Appearance.BackColor = Color.Wheat;
  398. // ugr.Activate();
  399. //}
  400. }
  401. }
  402. }
  403. _entityList = null;
  404. _ProPlanId = "";
  405. _ProPlanId = "";
  406. }
  407. finally
  408. {
  409. wf3.Close();
  410. this.Cursor = Cursors.Default;
  411. }
  412. }
  413. /// <summary>
  414. /// 修改切头尾数据
  415. /// </summary>
  416. private void UpdateCrop()
  417. {
  418. try
  419. {
  420. ArrayList messageErr = new ArrayList();
  421. ultraGridZgS.UpdateData();
  422. ArrayList list = new ArrayList();
  423. IQueryable<UltraGridRow> checkRows = ultraGridZgS.Rows.AsQueryable().Where("CHC = 'True'");
  424. if (checkRows.Count() == 0)
  425. {
  426. MessageUtil.ShowWarning("请选择订单!");
  427. return;
  428. }
  429. PlanComm.WaitFromOpen(this.Cursor);
  430. foreach (UltraGridRow uRow in checkRows)
  431. {
  432. ArrayList param = new ArrayList();
  433. param.Add(UserInfo.GetUserName());
  434. param.Add(uRow.Cells["ProPlanId"].Value.ToString());
  435. param.Add(uRow.Cells["GxPlanNo"].Value.ToString());
  436. param.Add(uRow.Cells["InwlId"].Text);
  437. param.Add(uRow.Cells["OutwlId"].Text);
  438. param.Add(uRow.Cells["PlineCode"].Value.ToString());
  439. list.Add(param);
  440. }
  441. if (list.Count == 0)
  442. {
  443. PlanComm.WaitFromColse(this.Cursor);
  444. MessageUtil.ShowTips("0条修改成功," + messageErr.Count + "条修改失败。\n" + messageErr[0]);
  445. return;
  446. }
  447. CoreClientParam ccp = new CoreClientParam();
  448. ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.base.ProducHelper";
  449. ccp.MethodName = "updateCrop";
  450. ccp.ServerParams = new object[] { list, UserInfo.GetUserName() };
  451. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  452. PlanComm.WaitFromColse(this.Cursor);
  453. if (ccp.ReturnCode == -1) return;
  454. MessageUtil.ShowTips(ccp.ReturnInfo);
  455. if (ccp.ReturnInfo.Equals("批量获取切头尾成功!"))
  456. {
  457. Query();
  458. }
  459. }
  460. catch (Exception ex)
  461. {
  462. PlanComm.WaitFromColse(this.Cursor);
  463. if (!(ex is MESException))
  464. {
  465. MessageUtil.ShowError(ex.Message);
  466. }
  467. }
  468. }
  469. /// <summary>
  470. /// 产线能力维护
  471. /// </summary>
  472. private void Capacity()
  473. {
  474. UltraGridRow ugr = ultraGridZgS.ActiveRow;
  475. if (ugr == null)
  476. {
  477. return;
  478. }
  479. string inMaterialNo = ugr.Cells["InwlId"].Text;
  480. string outMaterialNo = ugr.Cells["OutwlId"].Text;
  481. string plineCode = ugr.Cells["PlineCode"].Value.ToString();
  482. FrmBaseMaterialDPl frmBaseMaterialDPl = new FrmBaseMaterialDPl(inMaterialNo, outMaterialNo, plineCode, this.ob);
  483. frmBaseMaterialDPl.ShowDialog();
  484. }
  485. /// <summary>
  486. /// 新增检修计划
  487. /// </summary>
  488. private void AddRepairPlan()
  489. {
  490. if (comPline.Value == null || comPline.Value.ToString().Equals(""))
  491. {
  492. MessageUtil.ShowTips("请选择产线!");
  493. return;
  494. }
  495. FrmJxjh frmJxjh = new FrmJxjh(this.ob, comPline.Value.ToString(), "D");
  496. frmJxjh.ShowDialog();
  497. Query();
  498. }
  499. /// <summary>
  500. /// 折分订单
  501. /// </summary>
  502. private void Spit()
  503. {
  504. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  505. bool flag = ProducHelper.SpitPlanOrder(list, "D", this.ob);
  506. if (flag)
  507. {
  508. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  509. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  510. Query();
  511. }
  512. }
  513. /// <summary>
  514. /// 合并订单
  515. /// </summary>
  516. private void Merge()
  517. {
  518. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  519. bool flag = ProducHelper.MergePlanOrder(list, "D", this.ob);
  520. if (flag)
  521. {
  522. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  523. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  524. Query();
  525. }
  526. }
  527. /// <summary>
  528. /// 产线调整
  529. /// </summary>
  530. private void PlineChange()
  531. {
  532. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  533. bool flag = ProducHelper.PlineChange(list, "D", this.ob);
  534. if (flag)
  535. {
  536. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  537. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  538. Query();
  539. }
  540. }
  541. /// <summary>
  542. /// 初始化
  543. /// </summary>
  544. private void InitData()
  545. {
  546. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  547. bool flag = ProducHelper.InitData(list, "D", this.ob);
  548. if (flag)
  549. {
  550. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  551. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  552. Query();
  553. }
  554. }
  555. /// <summary>
  556. /// 状态调整
  557. /// </summary>
  558. private void StatusChange()
  559. {
  560. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  561. bool flag = ProducHelper.StatusChange(list, "D", this.ob);
  562. if (flag)
  563. {
  564. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  565. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  566. Query();
  567. }
  568. }
  569. /// <summary>
  570. /// 时间调整
  571. /// </summary>
  572. private void TimeChange()
  573. {
  574. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  575. bool flag = ProducHelper.TimeChange(list, "D", this.ob);
  576. if (flag)
  577. {
  578. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  579. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  580. Query();
  581. }
  582. }
  583. /// <summary>
  584. /// 排序
  585. /// </summary>
  586. /// <param name="sender"></param>
  587. /// <param name="e"></param>
  588. private void ultraGridZgS_MouseDown(object sender, MouseEventArgs e)
  589. {
  590. //排产查询界面,不能排序
  591. if (CustomInfo.Equals("0"))
  592. { return; }
  593. try
  594. { ultraGridZgS.UpdateData(); }
  595. catch (Exception)
  596. {
  597. MessageUtil.ShowWarning("数据异常,请刷新数据!"); return;
  598. }
  599. if (e.Button == MouseButtons.Right)
  600. {
  601. //移动行
  602. ArrayList entityList = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  603. if (entityList == null || entityList.Count == 0)
  604. {
  605. return;
  606. }
  607. //定位行
  608. UIElement myUIElement = ultraGridZgS.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
  609. UltraGridCell myCell = (UltraGridCell)myUIElement.GetContext(typeof(UltraGridCell));
  610. if (myCell == null) { return; }
  611. UltraGridRow ugr = myCell.Row;
  612. if (ugr == null) { return; }
  613. PlnOrderZgSEntity entityD = (PlnOrderZgSEntity)ugr.ListObject;
  614. bool flag = ProducHelper.SortPlanOrder(entityList, entityD, "D", "", this.ob);
  615. if (flag)
  616. {
  617. _entityList = entityList;
  618. Query();
  619. }
  620. }
  621. }
  622. private void ultraGridZgS_AfterRowActivate(object sender, EventArgs e)
  623. {
  624. UltraGridRow ugrAc = ultraGridZgS.ActiveRow;
  625. if (ugrAc == null)
  626. {
  627. return;
  628. }
  629. foreach (UltraGridRow ugr in ultraGridZgS.Rows)
  630. {
  631. if (ugr.Cells["ProPlanId"].Text.Equals(ugrAc.Cells["ProPlanId"].Text))
  632. {
  633. ugr.RowSelectorAppearance.BackColor = Color.LightGreen;
  634. }
  635. else
  636. {
  637. ugr.RowSelectorAppearance.BackColor = _backColor;
  638. }
  639. if (ugr.Cells["PlanUsetime"].Value == null || ugr.Cells["PlanUsetime"].Value.ToString().Equals("") || Convert.ToDouble(ugr.Cells["PlanUsetime"].Value.ToString()) <= 0)
  640. {
  641. ugr.Cells["PlanUsetime"].Appearance.BackColor = Color.MistyRose;
  642. }
  643. if (ugr.Cells["ExeStatus"].Value.ToString().Equals("生产中"))
  644. {
  645. ugr.Cells["PlanTimeB"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
  646. }
  647. if (ugr.Cells["IsRepairPln"].Text.Equals("Y"))
  648. {
  649. ugr.Cells["PlanUsetime"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
  650. ugr.Cells["RepairType"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
  651. }
  652. }
  653. }
  654. private void ultraGridZgS_CellChange(object sender, CellEventArgs e)
  655. {
  656. try
  657. {
  658. ultraGridZgS.UpdateData();
  659. if (e.Cell.Column.Key.Equals("PlineCode"))
  660. {
  661. IQueryable<UltraGridRow> chcRows = ultraGridZgS.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True");
  662. if (CustomInfo.Equals("0"))
  663. {
  664. e.Cell.Row.Cells["PlineName"].Value = e.Cell.Text;
  665. }
  666. else
  667. {
  668. if (chcRows != null && chcRows.Count() > 0)
  669. {
  670. foreach (UltraGridRow ugr in chcRows)
  671. {
  672. ugr.Cells["PlineCode"].Value = e.Cell.Value.ToString();
  673. ugr.Cells["PlineName"].Value = e.Cell.Text;
  674. }
  675. }
  676. }
  677. }
  678. }
  679. catch (Exception)
  680. {
  681. }
  682. }
  683. /// <summary>
  684. /// 删除检修计划
  685. /// </summary>
  686. public void DeleteRepairPlan()
  687. {
  688. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  689. bool flag = ProducHelper.DeleteRepairPlan(list, "D", this.ob);
  690. if (flag)
  691. {
  692. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  693. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  694. Query();
  695. }
  696. }
  697. private void comPline_ValueChanged(object sender, EventArgs e)
  698. {
  699. if (comPline == null)
  700. { return; }
  701. else
  702. { if (!CustomInfo.Equals("0")) { } }
  703. }
  704. /// <summary>
  705. /// 下发(取消)
  706. /// </summary>
  707. private void Issued(string isFlag)
  708. {
  709. IQueryable<UltraGridRow> checkRows = ultraGridZgS.Rows.AsQueryable().Where("CHC = 'True'");
  710. if (checkRows.Count()==0)
  711. {
  712. MessageUtil.ShowWarning("请选择订单!");
  713. return;
  714. }
  715. if (isFlag.Equals("0"))
  716. {
  717. foreach (UltraGridRow row in checkRows)
  718. {
  719. if (row.Cells["LenCuthead"].Text.Trim().Equals(""))
  720. {
  721. MessageUtil.ShowTips("切头无数据,不允许确认!");
  722. return;
  723. }
  724. if (row.Cells["LenCutend"].Text.Trim().Equals(""))
  725. {
  726. MessageUtil.ShowTips("切尾无数据,不允许确认!");
  727. return;
  728. }
  729. //if (row.Cells["Verify1"].Text.Trim().Equals(""))
  730. //{
  731. // MessageUtil.ShowTips("长度需调整!");
  732. // return;
  733. //}
  734. //if (row.Cells["Verify2"].Text.Trim().Equals(""))
  735. //{
  736. // MessageUtil.ShowTips("长度超出范围!");
  737. // return;
  738. //}
  739. //if (row.Cells["Verify3"].Text.Trim().Equals(""))
  740. //{
  741. // MessageUtil.ShowTips("脱不出!");
  742. // return;
  743. //}
  744. if (row.Cells["CicGp"].Text.Trim().Equals(""))
  745. {
  746. MessageUtil.ShowTips("钢种索引码为空!");
  747. return;
  748. }
  749. }
  750. }
  751. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  752. bool flag = ProducHelper.issuedPlanOrder(list, UserInfo.GetUserName(), isFlag, "D", this.ob);
  753. if (flag)
  754. {
  755. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  756. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  757. Query();
  758. }
  759. }
  760. private void ultraGridZgS_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  761. {
  762. foreach (UltraGridRow uRow in ultraGridZgS.Selected.Rows)
  763. {
  764. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  765. {
  766. uRow.Cells["CHC"].Value = true;
  767. }
  768. }
  769. }
  770. private void ultraGridZgS_ClickCellButton(object sender, CellEventArgs e)
  771. {
  772. UltraGridRow row = ultraGridZgS.ActiveRow;
  773. if (e.Cell.Column.Key.Equals("CraftFileNo"))
  774. {
  775. string filePath = row.GetValue("CraftPath");
  776. dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, filePath);
  777. askDown.Show();
  778. }
  779. else if (e.Cell.Column.Key.Equals("CraftFileLv2G"))
  780. {
  781. string craftFileLv2G = row.GetValue("CraftFileLv2G");
  782. dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, craftFileLv2G);
  783. askDown.Show();
  784. }
  785. else if (e.Cell.Column.Key.Equals("DiameterGp"))
  786. {
  787. string exeStatus = row.GetValue("ExeStatus");
  788. if (!exeStatus.Equals("计划") && !exeStatus.Equals("生产中"))
  789. {
  790. return;
  791. }
  792. string ordLnDlyPk = row.GetValue("OrdLnDlyPk");
  793. string proPlanId = row.GetValue("ProPlanId");
  794. string gxPlanNo = row.GetValue("GxPlanNo");
  795. string gradeCode = row.GetValue("GradeCode");
  796. if (gradeCode.Equals(""))
  797. {
  798. return;
  799. }
  800. string[] groupCic = null;
  801. if (!row.GetValue("GradeCode").Equals(""))
  802. {
  803. groupCic = row.Cells["CicGroupGp"].Text.ToString().Split(',');
  804. }
  805. string cicGp = row.GetValue("CicGp");
  806. //int numz = 0;
  807. //double wtz = 0;
  808. //if (!row.Cells["FurnaNum"].Text.ToString().Equals(""))
  809. //{
  810. // numz = int.Parse(row.Cells["FurnaNum"].Value.ToString());
  811. // wtz = double.Parse(row.Cells["FurnaWeight"].Value.ToString());
  812. //}
  813. int numLj = 0;
  814. double wtLj = 0;
  815. //if (!row.Cells["LjNum"].Value.ToString().Equals("0"))
  816. //{
  817. numLj = int.Parse(row.Cells["LjNum"].Value.ToString());
  818. wtLj = double.Parse(row.Cells["LjWeight"].Value.ToString());
  819. //}
  820. //else
  821. //{
  822. // numLj = int.Parse(row.Cells["MatchNumIn"].Value.ToString());
  823. // wtLj = double.Parse(row.Cells["MatchWtIn"].Value.ToString());
  824. //}
  825. //int batNum = 0;
  826. //double batWt = 0;
  827. //if (!row.Cells["CkNum"].Text.ToString().Equals(""))
  828. //{
  829. // batNum = int.Parse(row.Cells["CkNum"].Value.ToString());
  830. // batWt = double.Parse(row.Cells["CkWeight"].Value.ToString());
  831. //}
  832. //int num = numz + numLj + batNum;
  833. int num = numLj;
  834. FrmBomConfirm frmBomConfirm = new FrmBomConfirm(ordLnDlyPk, proPlanId, gxPlanNo, this.ob, groupCic, cicGp, num);
  835. frmBomConfirm.ShowDialog();
  836. bool flag = frmBomConfirm.Flag;
  837. if (flag) { Query(); }//如果有修改数据,则刷新页面
  838. }
  839. else if (e.Cell.Column.Key.Equals("Gradename"))
  840. {
  841. string exeStatus = row.GetValue("ExeStatus");
  842. if (!exeStatus.Equals("计划") && !exeStatus.Equals("生产中"))
  843. {
  844. return;
  845. }
  846. string ordLnDlyPk = row.GetValue("OrdLnDlyPk");
  847. string proPlanId = row.GetValue("ProPlanId");
  848. string gxPlanNo = row.GetValue("GxPlanNo");
  849. string gradeCode = row.GetValue("GradeCode");
  850. if (gradeCode.Equals(""))
  851. {
  852. return;
  853. }
  854. string[] groupCic = null;
  855. if (!row.GetValue("GradeCode").Equals(""))
  856. {
  857. groupCic = row.Cells["CicGroupGp"].Text.ToString().Split(',');
  858. }
  859. string cicGp = row.GetValue("CicGp");
  860. int numz = 0;
  861. double wtz = 0;
  862. //if (!row.Cells["FurnaNum"].Text.ToString().Equals(""))
  863. //{
  864. // numz = int.Parse(row.Cells["FurnaNum"].Value.ToString());
  865. // wtz = double.Parse(row.Cells["FurnaWeight"].Value.ToString());
  866. //}
  867. int numLj = 0;
  868. double wtLj = 0;
  869. //if (!row.Cells["LjNum"].Text.ToString().Equals(""))
  870. //{
  871. numLj = int.Parse(row.Cells["LjNum"].Value.ToString());
  872. wtLj = double.Parse(row.Cells["LjWeight"].Value.ToString());
  873. //}
  874. //int batNum = 0;
  875. //double batWt = 0;
  876. //if (!row.Cells["CkNum"].Text.ToString().Equals(""))
  877. //{
  878. // batNum = int.Parse(row.Cells["CkNum"].Value.ToString());
  879. // batWt = double.Parse(row.Cells["CkWeight"].Value.ToString());
  880. //}
  881. int num = numLj ;
  882. FrmBomConfirm frmBomConfirm = new FrmBomConfirm(ordLnDlyPk, proPlanId, gxPlanNo, this.ob, groupCic, cicGp,num);
  883. frmBomConfirm.ShowDialog();
  884. bool flag = frmBomConfirm.Flag;
  885. if (flag) { Query(); }//如果有修改数据,则刷新页面
  886. }
  887. else if (e.Cell.Column.Key.Equals("AfProLin"))
  888. {
  889. string proPlanId = row.GetValue("ProPlanId");
  890. string afInfo = row.GetValue("AfInfo");
  891. if (afInfo == null || afInfo.Length == 0) { return; }
  892. FrmPreGxInfo frmPreGxInfo = new FrmPreGxInfo(proPlanId, "D", "Af", this.ob);
  893. frmPreGxInfo.ShowDialog();
  894. }
  895. else if (e.Cell.Column.Key.Equals("DiameterMandrel"))
  896. {
  897. //InitDimaM(ugr.Cells["PlineCode"].Text.ToString().Trim(), ugr.Cells["PassCode"].Text.ToString().Trim(), ugr.Cells["Aimoutdiameter"].Text.ToString().Trim(), ugr.Cells["Aimwallthick"].Text.ToString().Trim());
  898. FrmDiameterMandrel frmDm = new FrmDiameterMandrel(row.GetValue("PlineCode"), row.GetValue("PassCode"), row.GetValue("Aimoutdiameter"), row.GetValue("Aimwallthick"), this.ob);
  899. frmDm.AutoSize = true;
  900. //frmDm.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  901. frmDm.Text = "芯棒直径";
  902. frmDm.ShowDialog();
  903. if (frmDm.DialogResult == System.Windows.Forms.DialogResult.OK)
  904. {
  905. //获取弹出窗体的属性值
  906. row.Cells["DiameterMandrel"].Value = frmDm.DiameterMandrel;
  907. }
  908. }
  909. else if (e.Cell.Column.Key.Equals("ApplyNo"))
  910. {
  911. UndoApply();
  912. }
  913. else if (e.Cell.Column.Key.Equals("LengthdiscN"))
  914. {
  915. if (row.GetValue("ApplyStatus") == "审批通过" || row.GetValue("ApplyStatus") == "审批不通过")
  916. {
  917. MessageUtil.ShowTips("该合同:" + row.GetValue("OrderNo") + ",已" + row.GetValue("ApplyStatus") + ",不允许修改推荐长度描述!");
  918. return;
  919. }
  920. string len = row.GetValue("LenNo");//合同长度编码
  921. string LenNoN = row.GetValue("LenNoN");//推荐长度编码
  922. frmOrderLenPln lenPln = new frmOrderLenPln(ob, len, LenNoN);
  923. lenPln.ShowDialog();
  924. if (lenPln.DialogResult == System.Windows.Forms.DialogResult.OK)
  925. {
  926. //获取弹出窗体的属性值
  927. row.Cells["LenNoN"].Value = lenPln.LenNo;
  928. row.Cells["LengthdiscN"].Value = lenPln.LengthdiscN;
  929. }
  930. }
  931. }
  932. /// <summary>
  933. /// 设置完成
  934. /// </summary>
  935. private void SetPlanFinish()
  936. {
  937. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  938. bool flag = ProducHelper.SetPlanFinish(list, UserInfo.GetUserName(), "D", this.ob);
  939. if (flag)
  940. {
  941. _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  942. _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  943. Query();
  944. }
  945. }
  946. /// <summary>
  947. /// 调整单倍坯长
  948. /// </summary>
  949. private void ModifyGpAimWall()
  950. {
  951. this.ultraGridZgS.UpdateData();
  952. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  953. if (list == null || list.Count == 0)
  954. {
  955. MessageUtil.ShowTips("请选择订单!");
  956. return;
  957. }
  958. ArrayList jsonList = new ArrayList();
  959. foreach (PlnOrderZgSEntity entity in list)
  960. {
  961. if (entity.IsRepairPln.Equals("Y"))
  962. {
  963. MessageUtil.ShowTips("检修计划不能重算!");
  964. return;
  965. }
  966. if (entity.LenCutend == null)
  967. {
  968. //entity.LenCutend = 0;
  969. MessageUtil.ShowWarning("请输入切尾数据!");
  970. return;
  971. }
  972. if (entity.LenCuthead == null)
  973. {
  974. //entity.LenCuthead = 0;
  975. MessageUtil.ShowWarning("请输入切头数据!");
  976. return;
  977. }
  978. if (entity.DiameterMandrel == null || entity.DiameterMandrel == 0)
  979. {
  980. MessageUtil.ShowWarning("未取到芯棒直径!");
  981. return;
  982. }
  983. //不是外购管的判断
  984. if (!entity.PlineCode.Equals("C065") && !entity.PlineCode.Equals("C072") && !entity.PlineCode.Equals("C066"))
  985. {
  986. //判断基础信息是否有切头尾数据
  987. string cutPlineH = "";//切头
  988. string cutPlineE = "";//切尾
  989. DataTable dt = ServerHelper
  990. .GetData("com.steering.pss.plnsaleord.order.CorePlnProcessOrd.queryBaseMaterialDPl", new object[] { entity.InwlId, entity.OutwlId, entity.PlineCode }, this.ob);
  991. if (dt.Rows.Count > 0)
  992. {
  993. cutPlineH = dt.Rows[0]["CROP_HEAD"].ToString();
  994. cutPlineE = dt.Rows[0]["CROP_END"].ToString();
  995. }
  996. if (cutPlineH == null || cutPlineH.Equals(""))
  997. {
  998. MessageUtil.ShowWarning("基础信息无投入产出物料对应切头数据,请维护!");
  999. return;
  1000. }
  1001. if (cutPlineE == null || cutPlineE.Equals(""))
  1002. {
  1003. MessageUtil.ShowWarning("基础信息无投入产出物料对应切尾数据,请维护!");
  1004. return;
  1005. }
  1006. }
  1007. if (entity.TubeEndRatio == null)
  1008. {
  1009. entity.TubeEndRatio = 0;
  1010. }
  1011. int lenGpSingle = Convert.ToInt32(entity.LenGpSingle);
  1012. if (lenGpSingle % 10 != 0)
  1013. {
  1014. MessageUtil.ShowWarning("单倍坯长个位数不为0!");
  1015. return;
  1016. }
  1017. jsonList.Add(JSONFormat.Format(entity));
  1018. }
  1019. if (MessageUtil.ShowYesNoAndQuestion("是否重算?") == DialogResult.No)
  1020. {
  1021. return;
  1022. }
  1023. CoreClientParam ccp = new CoreClientParam();
  1024. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1025. ccp.MethodName = "modifyGpAimWall";
  1026. ccp.ServerParams = new object[] { jsonList, "0" };
  1027. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1028. if (ccp.ReturnCode != -1)
  1029. {
  1030. if (ccp.ReturnObject != null)
  1031. {
  1032. List<string> message = (List<string>)JsonConvert.DeserializeObject(
  1033. ccp.ReturnObject.ToString(), typeof(List<string>));
  1034. if (message.Count == 0)
  1035. {
  1036. MessageUtil.ShowTips(list.Count - message.Count + "条修改成功,"
  1037. + message.Count + "条修改失败。");
  1038. }
  1039. else
  1040. {
  1041. MessageUtil.ShowTips(list.Count - message.Count + "条修改成功,"
  1042. + message.Count + "条修改失败。\n" + message[0]);
  1043. }
  1044. if (list.Count - message.Count>0)
  1045. {
  1046. Query();
  1047. }
  1048. }
  1049. }
  1050. }
  1051. /// <summary>
  1052. /// 调整控制壁厚
  1053. /// </summary>
  1054. private void ModifyThicknesWall()
  1055. {
  1056. this.ultraGridZgS.UpdateData();
  1057. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1058. if (list == null || list.Count == 0)
  1059. {
  1060. MessageUtil.ShowTips("请选择订单!");
  1061. return;
  1062. }
  1063. ArrayList jsonList = new ArrayList();
  1064. foreach (PlnOrderZgSEntity entity in list)
  1065. {
  1066. if (entity.IsRepairPln.Equals("Y"))
  1067. {
  1068. MessageUtil.ShowTips("检修计划不能调整控制壁厚!");
  1069. return;
  1070. }
  1071. jsonList.Add(JSONFormat.Format(entity));
  1072. }
  1073. if (MessageUtil.ShowYesNoAndQuestion("是否修改控制壁厚?") == DialogResult.No)
  1074. {
  1075. return;
  1076. }
  1077. CoreClientParam ccp = new CoreClientParam();
  1078. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1079. ccp.MethodName = "modifyThicknesWall";
  1080. ccp.ServerParams = new object[] { jsonList,this.UserInfo.GetUserName() };
  1081. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1082. if (ccp.ReturnCode == -1) return;
  1083. MessageUtil.ShowTips(ccp.ReturnInfo);
  1084. if (ccp.ReturnInfo.Equals("调整控制壁厚成功!"))
  1085. {
  1086. Query();
  1087. }
  1088. }
  1089. /// <summary>
  1090. /// 修改芯棒直接
  1091. /// </summary>
  1092. private void UpdateDiameM()
  1093. {
  1094. try
  1095. {
  1096. ArrayList messageErr = new ArrayList();
  1097. ultraGridZgS.UpdateData();
  1098. ArrayList list = new ArrayList();
  1099. //IQueryable<UltraGridRow> checkRows = ultraGridZgS.Rows.AsQueryable().Where("CHC = 'True'");
  1100. ArrayList list1 = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1101. if (list1 == null || list1.Count == 0)
  1102. {
  1103. MessageUtil.ShowTips("请选择订单!");
  1104. return;
  1105. }
  1106. foreach (PlnOrderZgSEntity entity in list1)
  1107. {
  1108. if (entity.IsRepairPln.Equals("Y"))
  1109. {
  1110. MessageUtil.ShowTips("检修计划不能调整芯棒!");
  1111. return;
  1112. }
  1113. if (entity.DiameterMandrel==null||entity.DiameterMandrel.Equals(""))
  1114. {
  1115. PlanComm.WaitFromColse(this.Cursor);
  1116. MessageUtil.ShowWarning("芯棒不能为空,请选择芯棒!");
  1117. return;
  1118. }
  1119. ArrayList param = new ArrayList();
  1120. param.Add(entity.ProPlanId);
  1121. param.Add(entity.GxPlanNo);
  1122. param.Add(entity.DiameterMandrel.ToString());
  1123. list.Add(param);
  1124. }
  1125. if (list.Count == 0)
  1126. {
  1127. PlanComm.WaitFromColse(this.Cursor);
  1128. MessageUtil.ShowTips("0条修改成功," + messageErr.Count + "条修改失败。\n" + messageErr[0]);
  1129. return;
  1130. }
  1131. if (MessageUtil.ShowYesNoAndQuestion("是否调整芯棒直径?") == DialogResult.No)
  1132. {
  1133. return;
  1134. }
  1135. PlanComm.WaitFromOpen(this.Cursor);
  1136. CoreClientParam ccp = new CoreClientParam();
  1137. ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.base.ProducHelper";
  1138. ccp.MethodName = "updateDimaM";
  1139. ccp.ServerParams = new object[] { list };
  1140. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1141. PlanComm.WaitFromColse(this.Cursor);
  1142. if (ccp.ReturnCode == -1) return;
  1143. MessageUtil.ShowTips(ccp.ReturnInfo);
  1144. if (ccp.ReturnInfo.Equals("芯棒直径调整成功!"))
  1145. {
  1146. Query();
  1147. }
  1148. }
  1149. catch (Exception ex)
  1150. {
  1151. PlanComm.WaitFromColse(this.Cursor);
  1152. if (!(ex is MESException))
  1153. {
  1154. MessageUtil.ShowError(ex.Message);
  1155. }
  1156. }
  1157. }
  1158. /// <summary>
  1159. /// 重新计算
  1160. /// </summary>
  1161. private void Recalculate()
  1162. {
  1163. try
  1164. {
  1165. ArrayList messageErr = new ArrayList();
  1166. ultraGridZgS.UpdateData();
  1167. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1168. if (list == null || list.Count == 0)
  1169. {
  1170. MessageUtil.ShowTips("请选择订单!");
  1171. return;
  1172. }
  1173. ArrayList jsonList = new ArrayList();
  1174. foreach (PlnOrderZgSEntity entity in list)
  1175. {
  1176. if (entity.IsRepairPln.Equals("Y"))
  1177. {
  1178. MessageUtil.ShowTips("检修计划不能重新计算!");
  1179. return;
  1180. }
  1181. jsonList.Add(JSONFormat.Format(entity));
  1182. }
  1183. if (MessageUtil.ShowYesNoAndQuestion("是否重头计算?") == DialogResult.No)
  1184. {
  1185. return;
  1186. }
  1187. PlanComm.WaitFromOpen(this.Cursor);
  1188. CoreClientParam ccp = new CoreClientParam();
  1189. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1190. ccp.MethodName = "recalculate";
  1191. ccp.ServerParams = new object[] { jsonList };
  1192. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1193. PlanComm.WaitFromColse(this.Cursor);
  1194. if (ccp.ReturnCode == -1) return;
  1195. MessageUtil.ShowTips(ccp.ReturnInfo);
  1196. if (ccp.ReturnInfo.Equals("重新计算完成!"))
  1197. {
  1198. Query();
  1199. }
  1200. }
  1201. catch (Exception ex)
  1202. {
  1203. PlanComm.WaitFromColse(this.Cursor);
  1204. if (!(ex is MESException))
  1205. {
  1206. MessageUtil.ShowError(ex.Message);
  1207. }
  1208. }
  1209. }
  1210. /// <summary>
  1211. ///修改排产月份
  1212. /// </summary>
  1213. private void UpdateMonth()
  1214. {
  1215. try
  1216. {
  1217. ArrayList messageErr = new ArrayList();
  1218. ultraGridZgS.UpdateData();
  1219. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1220. if (list == null || list.Count == 0)
  1221. {
  1222. MessageUtil.ShowTips("请选择订单!");
  1223. return;
  1224. }
  1225. ArrayList jsonList = new ArrayList();
  1226. foreach (PlnOrderZgSEntity entity in list)
  1227. {
  1228. entity.ProMonth = DateTime.Parse(entity.ProMonth.ToString()).ToString("yyyy-MM");
  1229. jsonList.Add(JSONFormat.Format(entity));
  1230. }
  1231. if (MessageUtil.ShowYesNoAndQuestion("是否调整生产年月?") == DialogResult.No)
  1232. {
  1233. return;
  1234. }
  1235. PlanComm.WaitFromOpen(this.Cursor);
  1236. CoreClientParam ccp = new CoreClientParam();
  1237. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1238. ccp.MethodName = "updateMonth";
  1239. ccp.ServerParams = new object[] { jsonList };
  1240. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1241. PlanComm.WaitFromColse(this.Cursor);
  1242. if (ccp.ReturnCode == -1) return;
  1243. MessageUtil.ShowTips(ccp.ReturnInfo);
  1244. if (ccp.ReturnInfo.Equals("调整成功!"))
  1245. {
  1246. //ArrayList list1 = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1247. //bool flag =InitDataMonth(list1, "D", this.ob);
  1248. //if (flag)
  1249. //{
  1250. // _ProPlanId = ((PlnOrderZgSEntity)list[0]).ProPlanId;
  1251. // _GxPlanNo = ((PlnOrderZgSEntity)list[0]).GxPlanNo;
  1252. Query();
  1253. //}
  1254. }
  1255. }
  1256. catch (Exception ex)
  1257. {
  1258. MessageUtil.ShowTips("请输入正确的时间格式!");
  1259. }
  1260. }
  1261. public static bool InitDataMonth(ArrayList entityList, string processCode, OpeBase ob)
  1262. {
  1263. if (entityList == null)
  1264. {
  1265. MessageUtil.ShowWarning("请选择订单!");
  1266. return false;
  1267. }
  1268. ArrayList jsonlist = new ArrayList();
  1269. foreach (Object obj in entityList)
  1270. {
  1271. ProducEntity entity = ProducHelper.GenerationProEntity(obj, processCode);
  1272. if (entity.IfStoveIssued.Equals("Y"))
  1273. {
  1274. MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划下发!");
  1275. return false;
  1276. }
  1277. if (entity.PlanUseTime == null || entity.PlanUseTime.Equals(""))
  1278. {
  1279. MessageUtil.ShowWarning("计划耗时不能为空!");
  1280. return false;
  1281. }
  1282. jsonlist.Add(entity.JsonStr);
  1283. }
  1284. string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.initData", new object[] { jsonlist, processCode }, ob);
  1285. if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
  1286. else
  1287. {
  1288. //MessageUtil.ShowTips(param[1]);
  1289. if ((bool.Parse(param[0]))) { return true; } else { return false; }
  1290. }
  1291. }
  1292. /// <summary>
  1293. /// 申请审批
  1294. /// </summary>
  1295. private void ApplyApproval()
  1296. {
  1297. ArrayList messageErr = new ArrayList();
  1298. ultraGridZgS.UpdateData();
  1299. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1300. if (list == null || list.Count == 0)
  1301. {
  1302. MessageUtil.ShowTips("请选择订单!");
  1303. return;
  1304. }
  1305. ArrayList jsonList = new ArrayList();
  1306. foreach (PlnOrderZgSEntity entity in list)
  1307. {
  1308. if (entity.LenNoN == null)
  1309. {
  1310. MessageUtil.ShowTips("无推荐长度,不允许申请!");
  1311. return;
  1312. }
  1313. jsonList.Add(JSONFormat.Format(entity));
  1314. }
  1315. if (MessageUtil.ShowYesNoAndQuestion("是否申请?") == DialogResult.No)
  1316. {
  1317. return;
  1318. }
  1319. PlanComm.WaitFromOpen(this.Cursor);
  1320. CoreClientParam ccp = new CoreClientParam();
  1321. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1322. ccp.MethodName = "applyApproval";
  1323. ccp.ServerParams = new object[] { jsonList, this.UserInfo.GetUserName() };
  1324. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1325. PlanComm.WaitFromColse(this.Cursor);
  1326. if (ccp.ReturnCode == -1) return;
  1327. MessageUtil.ShowTips(ccp.ReturnInfo);
  1328. if (ccp.ReturnInfo.Equals("申请成功!"))
  1329. {
  1330. Query();
  1331. }
  1332. }
  1333. /// <summary>
  1334. /// 撤销申请单
  1335. /// </summary>
  1336. private void UndoApply()
  1337. {
  1338. ultraGridZgS.UpdateData();
  1339. UltraGridRow ugrM = ultraGridZgS.ActiveRow;
  1340. if (ugrM == null)
  1341. {
  1342. return;
  1343. }
  1344. if (ugrM.Cells["ApplyNo"].Text.ToString().Equals(""))
  1345. {
  1346. MessageUtil.ShowTips("合同号:" + ugrM.Cells["OrderNo"].Value.ToString() + "未申请,不允许此操作!");
  1347. return;
  1348. }
  1349. ArrayList jsonList = new ArrayList();
  1350. jsonList.Add(ugrM.Cells["ApplyNo"].Value.ToString());
  1351. jsonList.Add(ugrM.Cells["OrdLnDlyPk"].Value.ToString());
  1352. jsonList.Add(ugrM.Cells["ProPlanId"].Value.ToString());
  1353. jsonList.Add(ugrM.Cells["GxPlanNo"].Value.ToString());
  1354. jsonList.Add(ugrM.Cells["LenNoN"].Value.ToString());
  1355. if (MessageUtil.ShowYesNoAndQuestion("是否撤销申请?") == DialogResult.No)
  1356. {
  1357. return;
  1358. }
  1359. PlanComm.WaitFromOpen(this.Cursor);
  1360. CoreClientParam ccp = new CoreClientParam();
  1361. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1362. ccp.MethodName = "undoApplyApproval";
  1363. ccp.ServerParams = new object[] { jsonList };
  1364. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1365. PlanComm.WaitFromColse(this.Cursor);
  1366. if (ccp.ReturnCode == -1) return;
  1367. MessageUtil.ShowTips(ccp.ReturnInfo);
  1368. if (ccp.ReturnInfo.Equals("撤销申请成功!"))
  1369. {
  1370. Query();
  1371. }
  1372. }
  1373. /// <summary>
  1374. /// 修改坯子
  1375. /// </summary>
  1376. private void ModifyBatter()
  1377. {
  1378. ArrayList messageErr = new ArrayList();
  1379. ultraGridZgS.UpdateData();
  1380. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1381. if (list == null || list.Count == 0)
  1382. {
  1383. MessageUtil.ShowTips("请选择订单!");
  1384. return;
  1385. }
  1386. ArrayList jsonList = new ArrayList();
  1387. foreach (PlnOrderZgSEntity entity in list)
  1388. {
  1389. entity.OutsBilletFl.ToString();
  1390. jsonList.Add(JSONFormat.Format(entity));
  1391. }
  1392. if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
  1393. {
  1394. return;
  1395. }
  1396. PlanComm.WaitFromOpen(this.Cursor);
  1397. CoreClientParam ccp = new CoreClientParam();
  1398. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1399. ccp.MethodName = "modifyBatter";
  1400. ccp.ServerParams = new object[] { jsonList, this.UserInfo.GetUserName() };
  1401. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1402. PlanComm.WaitFromColse(this.Cursor);
  1403. if (ccp.ReturnCode == -1) return;
  1404. MessageUtil.ShowTips(ccp.ReturnInfo);
  1405. if (ccp.ReturnInfo.Equals("修改成功!"))
  1406. {
  1407. Query();
  1408. }
  1409. }
  1410. private void ultraGridZgS_KeyUp(object sender, KeyEventArgs e)
  1411. {
  1412. PlanComm.setGridCopyActColumn(this.ultraGridZgS, "CHC", e,
  1413. "OutsBilletFl", "ProMonth");
  1414. }
  1415. /// <summary>
  1416. /// 修改索引码
  1417. /// </summary>
  1418. private void UpdateGroupGp()
  1419. {
  1420. ArrayList messageErr = new ArrayList();
  1421. ultraGridZgS.UpdateData();
  1422. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1423. if (list == null || list.Count == 0)
  1424. {
  1425. MessageUtil.ShowTips("请选择订单!");
  1426. return;
  1427. }
  1428. ArrayList jsonList = new ArrayList();
  1429. foreach (PlnOrderZgSEntity entity in list)
  1430. {
  1431. entity.OutsBilletFl.ToString();
  1432. jsonList.Add(JSONFormat.Format(entity));
  1433. }
  1434. if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
  1435. {
  1436. return;
  1437. }
  1438. PlanComm.WaitFromOpen(this.Cursor);
  1439. CoreClientParam ccp = new CoreClientParam();
  1440. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1441. ccp.MethodName = "updateGroupGp";
  1442. ccp.ServerParams = new object[] { jsonList };
  1443. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1444. PlanComm.WaitFromColse(this.Cursor);
  1445. if (ccp.ReturnCode == -1) return;
  1446. MessageUtil.ShowTips(ccp.ReturnInfo);
  1447. if (ccp.ReturnInfo.Equals("修改成功!"))
  1448. {
  1449. Query();
  1450. }
  1451. }
  1452. /// <summary>
  1453. /// 换bom 换钢种
  1454. /// </summary>
  1455. /// <param name="sender"></param>
  1456. /// <param name="e"></param>
  1457. private void ultraTextEditor1_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1458. {
  1459. UltraGridRow row = ultraGridZgS.ActiveRow;
  1460. string exeStatus = row.GetValue("ExeStatus");
  1461. if (!exeStatus.Equals("计划") && !exeStatus.Equals("生产中"))
  1462. {
  1463. return;
  1464. }
  1465. string ordLnDlyPk = row.GetValue("OrdLnDlyPk");
  1466. string proPlanId = row.GetValue("ProPlanId");
  1467. string gxPlanNo = row.GetValue("GxPlanNo");
  1468. string gradeCode = row.GetValue("GradeCode");
  1469. string outSurst = "";
  1470. if (gradeCode.Equals(""))
  1471. {
  1472. return;
  1473. }
  1474. if (row.GetValue("OutsBilletFl").Equals("121801"))
  1475. {
  1476. outSurst = "1";//外购
  1477. }
  1478. else
  1479. {
  1480. outSurst = "0";//自炼
  1481. }
  1482. if (e.Button.Key.ToLower().Equals("0"))
  1483. {
  1484. if (outSurst.Equals("0"))
  1485. {
  1486. FrmGradeChoose frmgradeC = new FrmGradeChoose(outSurst, this.ob, ordLnDlyPk, proPlanId, gxPlanNo, gradeCode);
  1487. frmgradeC.ShowDialog();
  1488. if (frmgradeC.DialogResult == System.Windows.Forms.DialogResult.OK)
  1489. {
  1490. //获取弹出窗体的属性值
  1491. row.Cells["Gradename"].Value = frmgradeC.Gradename;
  1492. row.Cells["GradeCode"].Value = frmgradeC.Gradecode;
  1493. }
  1494. }
  1495. else
  1496. {
  1497. return;
  1498. }
  1499. }
  1500. else
  1501. {
  1502. string[] groupCic = null;
  1503. if (!row.GetValue("GradeCode").Equals(""))
  1504. {
  1505. groupCic = row.Cells["CicGroupGp"].Text.ToString().Split(',');
  1506. }
  1507. string cicGp = row.GetValue("CicGp");
  1508. //int numz = 0;
  1509. //double wtz = 0;
  1510. //if (!row.Cells["FurnaNum"].Text.ToString().Equals(""))
  1511. //{
  1512. // numz = int.Parse(row.Cells["FurnaNum"].Value.ToString());
  1513. // wtz = double.Parse(row.Cells["FurnaWeight"].Value.ToString());
  1514. //}
  1515. int numLj = 0;
  1516. double wtLj = 0;
  1517. //if (!row.Cells["LjNum"].Text.ToString().Equals(""))
  1518. //{
  1519. numLj = int.Parse(row.Cells["LjNum"].Value.ToString());
  1520. wtLj = double.Parse(row.Cells["LjWeight"].Value.ToString());
  1521. //}
  1522. //int batNum = 0;
  1523. //double batWt = 0;
  1524. //if (!row.Cells["CkNum"].Text.ToString().Equals(""))
  1525. //{
  1526. // batNum = int.Parse(row.Cells["CkNum"].Value.ToString());
  1527. // batWt = double.Parse(row.Cells["CkWeight"].Value.ToString());
  1528. //}
  1529. int num =numLj ;
  1530. FrmBomConfirm frmBomConfirm = new FrmBomConfirm(ordLnDlyPk, proPlanId, gxPlanNo, this.ob, groupCic, cicGp,num);
  1531. frmBomConfirm.ShowDialog();
  1532. bool flag = frmBomConfirm.Flag;
  1533. if (flag) { Query(); }//如果有修改数据,则刷新页面
  1534. }
  1535. }
  1536. /// <summary>
  1537. /// 修改钢种
  1538. /// </summary>
  1539. private void UpdateGradeCode()
  1540. {
  1541. ArrayList messageErr = new ArrayList();
  1542. ultraGridZgS.UpdateData();
  1543. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1544. if (list == null || list.Count == 0)
  1545. {
  1546. MessageUtil.ShowTips("请选择订单!");
  1547. return;
  1548. }
  1549. ArrayList jsonList = new ArrayList();
  1550. foreach (PlnOrderZgSEntity entity in list)
  1551. {
  1552. entity.Gradecode.ToString();
  1553. entity.Gradename.ToString();
  1554. jsonList.Add(JSONFormat.Format(entity));
  1555. }
  1556. if (MessageUtil.ShowYesNoAndQuestion("是否修改钢种?") == DialogResult.No)
  1557. {
  1558. return;
  1559. }
  1560. PlanComm.WaitFromOpen(this.Cursor);
  1561. CoreClientParam ccp = new CoreClientParam();
  1562. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1563. ccp.MethodName = "updateGradeCode";
  1564. ccp.ServerParams = new object[] { jsonList };
  1565. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1566. PlanComm.WaitFromColse(this.Cursor);
  1567. if (ccp.ReturnCode == -1) return;
  1568. MessageUtil.ShowTips(ccp.ReturnInfo);
  1569. if (ccp.ReturnInfo.Equals("修改成功!"))
  1570. {
  1571. Query();
  1572. }
  1573. }
  1574. /// <summary>
  1575. /// 删除管坯需求号
  1576. /// </summary>
  1577. private void DeleteGperId()
  1578. {
  1579. ultraGridZgS.UpdateData();
  1580. IQueryable<UltraGridRow> checkRows = ultraGridZgS.Rows.AsQueryable().Where("CHC = 'True'");
  1581. if (checkRows.Count() == 0)
  1582. {
  1583. MessageUtil.ShowTips("请选择订单!");
  1584. return;
  1585. }
  1586. ArrayList list = new ArrayList();
  1587. foreach (UltraGridRow ugr in checkRows)
  1588. {
  1589. ArrayList jsonList = new ArrayList();
  1590. if (!ugr.Cells["LjNum"].Text.ToString().Equals("") && !ugr.Cells["LjNum"].Value.ToString().Equals("0"))
  1591. {
  1592. MessageUtil.ShowTips("有LJ支吨不允许删除管坯需求号!");
  1593. return;
  1594. }
  1595. //if (!ugr.Cells["FurnaNum"].Text.ToString().Equals("") && !ugr.Cells["FurnaNum"].Value.ToString().Equals("0"))
  1596. //{
  1597. // MessageUtil.ShowTips("有装炉支吨不允许删除管坯需求号!");
  1598. // return;
  1599. //}
  1600. //if (!ugr.Cells["CkNum"].Text.ToString().Equals("") && !ugr.Cells["CkNum"].Value.ToString().Equals("0"))
  1601. //{
  1602. // MessageUtil.ShowTips("有出库支吨不允许删除管坯需求号!");
  1603. // return;
  1604. //}
  1605. jsonList.Add(ugr.Cells["ProPlanId"].Value.ToString());
  1606. jsonList.Add(ugr.Cells["GxPlanNo"].Value.ToString());
  1607. list.Add(jsonList);
  1608. }
  1609. if (MessageUtil.ShowYesNoAndQuestion("是否删除管坯需求号?") == DialogResult.No)
  1610. {
  1611. return;
  1612. }
  1613. PlanComm.WaitFromOpen(this.Cursor);
  1614. CoreClientParam ccp = new CoreClientParam();
  1615. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1616. ccp.MethodName = "deleteGperId";
  1617. ccp.ServerParams = new object[] { list };
  1618. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1619. PlanComm.WaitFromColse(this.Cursor);
  1620. if (ccp.ReturnCode == -1) return;
  1621. MessageUtil.ShowTips(ccp.ReturnInfo);
  1622. if (ccp.ReturnInfo.Equals("删除成功!"))
  1623. {
  1624. Query();
  1625. }
  1626. }
  1627. /// <summary>
  1628. /// 获取铸造产线
  1629. /// </summary>
  1630. private void UpdateZz()
  1631. {
  1632. ultraGridZgS.UpdateData();
  1633. IQueryable<UltraGridRow> checkRows = ultraGridZgS.Rows.AsQueryable().Where("CHC = 'True'");
  1634. if (checkRows.Count() == 0)
  1635. {
  1636. MessageUtil.ShowTips("请选择订单!");
  1637. return;
  1638. }
  1639. ArrayList jsonList = new ArrayList();
  1640. foreach (UltraGridRow entity in checkRows)
  1641. {
  1642. ArrayList List = new ArrayList();
  1643. List.Add(entity.Cells["ProPlanId"].Value.ToString());
  1644. List.Add(entity.Cells["GxPlanNo"].Value.ToString());
  1645. jsonList.Add(List);
  1646. }
  1647. //if (MessageUtil.ShowYesNoAndQuestion("是否修改钢种?") == DialogResult.No)
  1648. //{
  1649. // return;
  1650. //}
  1651. PlanComm.WaitFromOpen(this.Cursor);
  1652. CoreClientParam ccp = new CoreClientParam();
  1653. ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
  1654. ccp.MethodName = "doUpdateZz";
  1655. ccp.ServerParams = new object[] { jsonList };
  1656. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1657. PlanComm.WaitFromColse(this.Cursor);
  1658. if (ccp.ReturnCode == -1) return;
  1659. MessageUtil.ShowTips(ccp.ReturnInfo);
  1660. if (ccp.ReturnInfo.Equals("修改成功!"))
  1661. {
  1662. Query();
  1663. }
  1664. }
  1665. /// <summary>
  1666. /// 订单终止
  1667. /// </summary>
  1668. private void doTermination()
  1669. {
  1670. ArrayList messageErr = new ArrayList();
  1671. ultraGridZgS.UpdateData();
  1672. ArrayList list = ProducHelper.GetChcRows<PlnOrderZgSEntity>(ultraGridZgS);
  1673. if (list == null || list.Count == 0)
  1674. {
  1675. MessageUtil.ShowTips("请选择订单!");
  1676. return;
  1677. }
  1678. ArrayList jsonList = new ArrayList();
  1679. foreach (PlnOrderZgSEntity entity in list)
  1680. {
  1681. entity.Passive.ToString();
  1682. if (!entity.ExeStatus.Equals("计划"))
  1683. {
  1684. MessageUtil.ShowTips("订单不是计划状态不能关闭!");
  1685. return;
  1686. }
  1687. jsonList.Add(JSONFormat.Format(entity));
  1688. }
  1689. if (MessageUtil.ShowYesNoAndQuestion("是否终止订单?") == DialogResult.No)
  1690. {
  1691. return;
  1692. }
  1693. PlanComm.WaitFromOpen(this.Cursor);
  1694. CoreClientParam ccp = new CoreClientParam();
  1695. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.StoveHelper";
  1696. ccp.MethodName = "doTermination";
  1697. ccp.ServerParams = new object[] { jsonList, "D" };
  1698. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1699. PlanComm.WaitFromColse(this.Cursor);
  1700. if (ccp.ReturnCode == -1) return;
  1701. MessageUtil.ShowTips(ccp.ReturnInfo);
  1702. if (ccp.ReturnInfo.Equals("终止成功!"))
  1703. {
  1704. Query();
  1705. }
  1706. }
  1707. }
  1708. }