| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Server;
- using Infragistics.Win.UltraWinTree;
- using System.Collections;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.SaleOrder.BLL;
- using Core.StlMes.Client.Qcm;
- namespace Core.StlMes.Client.SaleOrder.Dialog
- {
- public partial class frmDesignFallBack : FrmBase
- {
- private string _ordLnPk;
- private string _craftSeq;
- private bool _isCraft = false;
- public frmDesignFallBack(string ordLnPk, string craftSeq, bool isCraft, OpeBase ob)
- {
- InitializeComponent();
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- _ordLnPk = ordLnPk;
- _isCraft = isCraft;
- if (_isCraft)
- {
- this.Text = "工艺评审回退";
- }
- _craftSeq = craftSeq;
- this.ob = ob;
- }
- private void frmDesignFallBack_Load(object sender, EventArgs e)
- {
- DoQuery();
- }
- /// <summary>
- /// 生成树
- /// </summary>
- /// <param name="dt">DataTable</param>
- /// <param name="key">key</param>
- /// <param name="showValue">显示值</param>
- private void CreateTree(DataTable dt, string hideValue, string showValue)
- {
- if (dt == null || dt.Rows.Count == 0)
- {
- return;
- }
- UltraTreeNode utn = null;
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- utn = new UltraTreeNode(dt.Rows[i][hideValue].ToString(), dt.Rows[i][showValue].ToString());
- utn.Override.NodeStyle = NodeStyle.OptionButton;
- utn.Tag = dt.Rows[i];
- ultraTree.Nodes.Add(utn);
- }
- }
- private void DoQuery()
- {
- DataTable dt = null;
- if (_isCraft)
- {
- dt = GetCraftItemByOrdLnPk(_ordLnPk);
- CreateTree(dt, "LST_ITEM", "LST_ITEM");
- }
- else
- {
- dt = ServerHelper.GetData("com.steering.pss.sale.order.qualityDesign.QualityDesignFallback.getItems",
- new Object[] { _ordLnPk }, this.ob);
- CreateTree(dt, "SEQ_INDEX", "LST_ITEM");
- }
- if (ultraTree.Nodes.Count > 0)
- {
- ultraTree.Nodes[0].CheckedState = CheckState.Checked;
- }
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "FallBack":
- if (_isCraft)
- {
- DoCraftFallBack();
- }
- else
- {
- DoFallBack();
- }
- break;
- case "Cancel":
- this.Close();
- break;
- default:
- break;
- }
- }
- private void DoCraftFallBack()
- {
- //...
- ultraTree.Update();
- if (ultraTree.ActiveNode == null)
- {
- MessageUtil.ShowWarning("请选择回退节点");
- return;
- }
- CraftOrdDesignBLL craftOrdDesignBLL = new CraftOrdDesignBLL(ob);
- CraftOrdDesignEntity craftOrdDesign = craftOrdDesignBLL.QueryByPk(new CraftOrdDesignEntity()
- {
- OrdLnPk = _ordLnPk,
- CraftSeq = decimal.Parse(_craftSeq == "" ? "0" : _craftSeq)
- });
- if (craftOrdDesign == null)
- {
- MessageUtil.ShowWarning("当前合同行不存在工艺设计结果,不能回退!");
- return;
- }
- //if (craftOrdDesign.LockFlag != "1" || craftOrdDesign.Validflag != "2")
- //{
- // MessageUtil.ShowWarning("当前合同行已经生成工艺文件,不能回退!");
- // return;
- //}
- DataTable dtCraftItem = GetCraftItemByOrdLnPk(_ordLnPk);
- DataRow[] drs = dtCraftItem.Select("DESIGN_STS = 'F'");
- if (drs.Length > 0)
- {
- DataRow dr = (DataRow)ultraTree.ActiveNode.Tag;
- if (decimal.Parse(dr["SEQ_INDEX"].ToString()) > decimal.Parse(drs[0]["SEQ_INDEX"].ToString()))
- {
- MessageUtil.ShowWarning("不能回退到失败项之后的节点!");
- return;
- }
- }
- string item = ultraTree.ActiveNode.Text.Trim();
- string mscPline = "";
- string processCode = "";
- string dimater = "";
- string height = "";
- string pic = "";
- if (item == "试样码(内控)")
- {
- DataTable dtBackLogProcess = ServerHelper.GetData("com.steering.pss.sale.order.qualityDesign.QualityDesignFallback.getCraftBackLogProcess",
- new object[]{ _ordLnPk, _craftSeq }, ob);
- dtBackLogProcess.Columns["MSC_PLINE"].Caption = "制程号";
- dtBackLogProcess.Columns["WHOLE_BACKLOG"].Caption = "全程途径码";
- dtBackLogProcess.Columns["WHOLE_BACKLOG_DESC"].Caption = "全程途径描述";
- dtBackLogProcess.Columns["PROCESS_DESC"].Caption = "工序";
- dtBackLogProcess.Columns["DIMATER"].Caption = "外径";
- dtBackLogProcess.Columns["HEIGHT"].Caption = "壁厚";
- BaseInfoPopup popup = new BaseInfoPopup(dtBackLogProcess, "MSC_PLINE", "PROCESS_CODE");
- popup.Text = "选择要回退的记录!";
- if (popup.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- mscPline = popup.ChoicedRow.GetValue("MSC_PLINE");
- processCode = popup.ChoicedRow.GetValue("PROCESS_CODE");
- dimater = popup.ChoicedRow.GetValue("DIMATER");
- height = popup.ChoicedRow.GetValue("HEIGHT");
- pic = popup.ChoicedRow.GetValue("PIC");
- }
- else
- {
- return;
- }
- }
- dlgReviewMemo dlg = new dlgReviewMemo();
- dlg.ReviewFlag = 0;
- dlg.ReviewSatus = "工艺评审回退";
- dlg.ShowDialog();
- string backReason = dlg.ReviewMemo;
- if (backReason.Trim().Length == 0)
- {
- return;
- }
- backReason = UserInfo.ParentDepartment + "-" + (UserInfo.GetDepartment()) + ":" + UserInfo.GetUserName() + " 退回说明:" + backReason;
-
- ServerHelper.SetData("com.steering.pss.sale.order.qualityDesign.QualityDesignFallback.craftFallBack",
- new object[] { _ordLnPk, item, backReason, mscPline, processCode, dimater, height, pic }, ob);
- MessageUtil.ShowTips("回退成功!");
- this.Close();
- }
- private DataTable GetCraftItemByOrdLnPk(string ordLnPk)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.qualityDesign.QualityDesignFallback.getCraftItems",
- new object[] { ordLnPk }, ob);
- return dt;
- }
- private void DoFallBack()
- {
- ultraTree.Update();
- if (ultraTree.ActiveNode == null)
- {
- MessageUtil.ShowWarning("请选择回退节点");
- return;
- }
- String item = ultraTree.ActiveNode.Text.Trim();
- if (item.Equals("MSC(n)") || item.Equals("产品技术要求") || item.Equals(
- "合同附加要求"))
- {
- MessageUtil.ShowWarning("MSC(n)管理科室、产品技术要求、MSC(n)、合同附加要求 暂不提供回退功能");
- return;
- }
- if (item.Equals("生产周期"))
- {
- MessageUtil.ShowWarning("生产周期无需回退");
- return;
- }
- String retrunMessage = checkOrdLine(ultraTree.ActiveNode.Text.Trim());
- if (!retrunMessage.Equals(""))
- {
- MessageUtil.ShowWarning(retrunMessage);
- return;
- }
- dlgReviewMemo dlg = new dlgReviewMemo();
- dlg.ReviewFlag = 0;
- dlg.ReviewSatus = "技术评审回退";
- dlg.ShowDialog();
- string backReason = dlg.ReviewMemo;
- if (backReason.Trim().Length == 0)
- {
- return;
- }
- backReason = UserInfo.ParentDepartment + "-" + (UserInfo.GetDepartment()) + ":" + UserInfo.GetUserName() + " 退回说明:" + backReason;
- ArrayList list = new ArrayList();
- list.Add(_ordLnPk);
- list.Add(ultraTree.ActiveNode.Text.Trim());
- list.Add(backReason);
- list.Add(UserInfo.GetDeptid());
- list.Add(UserInfo.GetDepartment());
- list.Add(UserInfo.GetUserName());
- list.Add(UserInfo.GetUserID());
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.qualityDesign.QualityDesignFallback";
- ccp.MethodName = "fallBack";
- ccp.ServerParams = new object[] { list };
- ccp = this.ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (Boolean.Parse(ccp.ReturnObject.ToString()))
- {
- this.Close();
- }
- }
- }
- private void ultraTree_AfterActivate(object sender, NodeEventArgs e)
- {
- //e.TreeNode.Selected = true;
- // e.TreeNode.Nodes.Override.NodeStyle = NodeStyle.OptionButton;
- e.TreeNode.CheckedState = CheckState.Checked;
- }
- private void ultraTree_AfterCheck(object sender, NodeEventArgs e)
- {
- e.TreeNode.Selected = true;
- ultraTree.ActiveNode = e.TreeNode;
- }
- private String checkOrdLine(String item)
- {
- List<SlmOrderLineEntityFallBack> listSource = EntityHelper.GetData<SlmOrderLineEntityFallBack>(
- "com.steering.pss.sale.order.qualityDesign.QualityDesignFallback.getOrdLineInfo", new object[] { _ordLnPk }, this.ob);
- if (listSource != null && listSource.Count > 0)
- {
- SlmOrderLineEntityFallBack orderLine = listSource[0];
- // A:钢管(管坯)(交付、制程)
- //B:钢管+接箍(交付、制程、接箍码)
- //C:短节+附件 (制程、接箍码、备料码)
- //D:接箍 (制程、接箍)
- //E:双公短节(交付、制程、备料码)
- if (orderLine.MscStyle.Equals("A"))
- {
- if (item.Equals("接箍") || item.Equals("备料"))
- {
- return "钢管/管坯产品没有接箍、备料要求,不能回退至:" + item;
- }
- }
- else if (orderLine.MscStyle.Equals("B"))
- {
- if (item.Equals("备料"))
- {
- return "钢管+接箍产品没有备料要求,不能回退至:" + item;
- }
- }
- else if (orderLine.MscStyle.Equals("C"))
- {
- if (item.Equals("成分标准") || item.Equals("理化标准") || item.Equals("公差标准") || item.Equals("探伤标准") || item.Equals("水压标准") || item.Equals("加工标准"))
- {
- return "短节+附件产品没有交付标准,不能回退至:" + item;
- }
- }
- else if (orderLine.MscStyle.Equals("D"))
- {
- if (item.Equals("备料") || item.Equals("成分标准") || item.Equals("理化标准") || item.Equals("公差标准") || item.Equals("探伤标准") || item.Equals("水压标准") || item.Equals("加工标准"))
- {
- return "接箍产品没有交付标准与备料要求,不能回退至:" + item;
- }
- }
- else
- {
- if (item.Equals("接箍"))
- {
- return "双公短节产品没有接箍要求,不能回退至:" + item;
- }
- }
- if (orderLine.MpsFl.Equals("0") && item.Equals("MPS"))
- {
- return "合同对MPS 没有要求,不能回退至" + item;
- }
- }
- return "";
- }
- }
- }
|