| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- 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.Control;
- using System.Collections;
- using Core.Mes.Client.Comm.Tool;
- using Core.Mes.Client.Comm.Server;
- namespace Core.StlMes.Client.SaleOrder
- {
- public partial class frmOrderReviewManager : FrmBase
- {
- public frmOrderReviewManager()
- {
- InitializeComponent();
- }
- private void che_date_CheckedChanged(object sender, EventArgs e)
- {
- if (che_date.Checked)
- {
- date_starte.ReadOnly = false;
- date_end.ReadOnly = false;
- }
- else
- {
- date_starte.ReadOnly = true;
- date_end.ReadOnly = true;
- }
- }
- private void ord_no_CheckedChanged(object sender, EventArgs e)
- {
- orde_cho.Enabled = ord_no.Checked;
- }
- private void app_no_CheckedChanged(object sender, EventArgs e)
- {
- app_chm.Enabled = app_no.Checked;
- }
- private void frmOrderReviewManager_Load(object sender, EventArgs e)
- {
- this.date_starte.DateTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1);
- this.date_end.DateTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1).AddSeconds(-1);
- Appstatus();
- }
- /// <summary>
- /// 绑定评审状态
- /// </summary>
- private void Appstatus()
- {
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewLaw.appStatus", null, this.ob);
- app_chm.DataSource = dt;
- app_chm.DisplayMember = "BASENAME";
- app_chm.ValueMember = "BASECODE";
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- this.Query();
- break;
- case "doAdd":
- this.doAdd();//提报评审
- break;
- case "doClose":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 提报技术评审
- /// </summary>
- public void doAdd()
- {
- if (ultraGrid2.Rows.Count == 0)
- {
- MessageUtil.ShowTips("没有可提报的数据!");
- return;
- }
- if (ultraGrid2.ActiveRow.Cells["ORDER_STS"].Value.ToString() == "待技术评审")
- {
- MessageUtil.ShowTips("当前这条数据已经进行提报!");
- return;
- }
- //int count = ServerHelper.SetData("com.steering.pss.sale.order.CopyOrderApproval.getThOrderStatus", new object[] { ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString() }, this.ob);
- //if (count < 0)
- //{
- // MessageUtil.ShowWarning("请等待天淮合同技术评审,交货期通过!");
- // return;
- //}
- //if (count == 1)
- //{
- // MessageUtil.ShowWarning("配套服务科未确认下发,无法提报!");
- // return;
- //}
- if (ultraGrid2.ActiveRow.Cells["ORDER_STS"].Value.ToString() == "待提报评审")
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否评审提报选择的合同?") == DialogResult.No) return;
- ArrayList a1 = new ArrayList();
- string reviewSrc = "H";
- a1.Add(reviewSrc);
- a1.Add(ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString());//pk值
- a1.Add(this.UserInfo.GetUserName());
- a1.Add(ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString());
- string ordertype = "";
- if (ultraGrid2.ActiveRow.Cells["ORDER_TYPCODE"].Value.ToString().Equals("120102")
- || ultraGrid2.ActiveRow.Cells["ORDER_TYPCODE"].Value.ToString().Equals("120105")) //现货合同和贸易
- {
- ordertype = "A";
- }
- else
- {
- ordertype = "B";
- }
- //先进行质量设计 看合同是否满足评审提报的要求。 否则不能提报
- if (ordertype != "A")
- {
- string errMsg = doQuality(); //质量设计
- if (errMsg != "")
- {
- MessageUtil.ShowWarning(errMsg + "不能提报技术评审,请修改合同信息,重新提报!");
- return;
- }
- //质量设计预处理这是判断合同信息合理性
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.getOrderDesignKey", new object[] { ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString() }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- if (!dt.Rows[0][0].ToString().Equals("0"))
- {
- MessageUtil.ShowWarning("质量设计预处理失败,请尝试重新提报!");
- return;
- }
- }
- }
- string name = UserInfo.GetUserName();
- string dept1 = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
- dept1 = dept1 + "-" + UserInfo.GetDepartment();
- string saleOrg = ClsBaseInfo.GetSaleOrg(UserInfo.GetDeptid());
- CoreClientParam ccp = new CoreClientParam();
- ccp.IfShowErrMsg = false;
- ccp.ServerName = "com.steering.pss.sale.order.CoreOrderReviewManager";
- ccp.MethodName = "coreOrderReviewManagerReport";
- ccp.ServerParams = new object[] { a1, ordertype, name, dept1, saleOrg };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp == null)
- return;
- else
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
- return;
- }
- }
- //这一段代码并到上面的方法 在后台以一个事务处理
- /* if (ordertype != "A")
- {
- string dept = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
- CoreClientParam ccp1 = new CoreClientParam();
- ccp1.IfShowErrMsg = false;
- ccp1.ServerName = "com.steering.pss.sale.order.CoreOrderReviewManager";
- ccp1.MethodName = "updateReviewItemListStatus";
- ccp1.ServerParams = new object[] { ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString(), UserInfo.GetUserName(), dept + "-" + UserInfo.GetDepartment() };
- ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
- }*/
- MessageUtil.ShowTips("提报成功!");
- Query();
- }
- else
- {
- MessageUtil.ShowTips("当前这条数据不是待提报评审!");
- return;
- }
- }
- /// <summary>
- /// 质量设计
- /// </summary>
- private string doQuality()
- {
- //执行数据库相关操作
- string returnMsg = "";
- CoreClientParam ccp = new CoreClientParam();
- //这三个参数 合同行的三个参数 ordPk ordLnPk 以及合同行号 不能为空
- for (int i = 0; i < ultraGrid9.Rows.Count; i++)
- {
- string ordPk = ultraGrid2.ActiveRow.Cells["ORD_PK"].Value.ToString();
- string ordLnPk = ultraGrid9.Rows[i].Cells["ORD_LN_PK"].Value.ToString();
- string ordSeq = ultraGrid9.Rows[i].Cells["ORDER_SEQ"].Value.ToString();
- ArrayList param = new ArrayList();
- param.Add("SYSTEM");
- //服务端的包名+类名
- ccp.ServerName = "com.steering.pss.sale.order.qualityDesign.QualityDesignMain";
- //类里的方法名
- ccp.MethodName = "qualityDesign";
- ccp.ServerParams = new object[] { ordPk, ordLnPk, ordSeq, param };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnInfo != "")
- {
- returnMsg = ordSeq+" "+ccp.ReturnInfo;
- return returnMsg;
- }
- }
- return returnMsg;
- }
- public void Query()
- {
- designStatus1.DoClear();
- dataSet1.Clear();
- String beginTime = "";
- String endTime = "";
- //合同号
- string order = "";
- if (ord_no.Checked)
- {
- order = orde_cho.Text.Trim();
- }
- if (che_date.Checked)
- {
- beginTime = date_starte.DateTime.ToString("yyyy-MM-dd") + "00:00:01";
- endTime = date_end.DateTime.ToString("yyyy-MM-dd") + "23:59:59";
- }
- else
- {
- beginTime = "1000-01-01 00:00:01";
- endTime = "9999-12-31 23:59:59";
- }
- //评审状态
- string appstatus = "";
- if (app_no.Checked)
- {
- appstatus = app_chm.Value.ToString().Trim();
- }
- string[] arr = this.ValidDataPurviewIds;
- string supp = this.CustomInfo.Contains("120504") ? "120504" : "";
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.CoreOrderReviewManagerHeadQuery", new Object[] { order, appstatus, beginTime, endTime, arr, supp }, this.ob);
- ultraGrid2.DataSource = dt;
- }
- public void doQueryeReview(string orderReview)
- {
- DataTable dt1 = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.CoreOrderReviewManagerReviewQuery", new Object[] { orderReview }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt1, ref this.orderReviewDw, true);
- }
- private void doQueryOrder(string ordermodel)
- {
- DataTable dt1 = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewLaw.ordermodelQuery", new Object[] { ordermodel }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt1, ref this.orderlawDp, true);
- }
- private void doQueryeffect(string order)
- {
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.CoreOrderReviewManager.CoreOrderReviewManagerSqeQuery", new Object[] { order }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderLineDt, true);
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < ultraGrid9.Rows.Count; i++)
- {
- if (ultraGrid9.Rows[i].Cells["ASSEL_FL"].Value.ToString() == "1")
- {
- ultraGrid9.Rows[i].Cells["ASSEL_FL"].Value = true;
- }
- else
- {
- ultraGrid9.Rows[i].Cells["ASSEL_FL"].Value = false;
- }
- if ("1".Equals(ultraGrid9.Rows[i].Cells["VALIDFLAG"].Value.ToString()))
- {
- ultraGrid9.Rows[i].Cells["VALIDFLAG"].Value = true;
- }
- else
- {
- ultraGrid9.Rows[i].Cells["VALIDFLAG"].Value = false;
- }
- if ("1".Equals(ultraGrid9.Rows[i].Cells["MPS_FL"].Value.ToString()))
- {
- ultraGrid9.Rows[i].Cells["MPS_FL"].Value = true;
- }
- else
- {
- ultraGrid9.Rows[i].Cells["MPS_FL"].Value = false;
- }
- if ("1".Equals(ultraGrid9.Rows[i].Cells["PRODUCER_FL"].Value.ToString()))
- {
- ultraGrid9.Rows[i].Cells["PRODUCER_FL"].Value = true;
- }
- else
- {
- ultraGrid9.Rows[i].Cells["PRODUCER_FL"].Value = false;
- }
- }
- }
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- this.doQueryeffect(ultraGrid2.ActiveRow.Cells["ORD_PK"].Text);
- this.doQueryOrder(ultraGrid2.ActiveRow.Cells["ORDER_MODEL_NO"].Text);
- this.doQueryeReview(ultraGrid2.ActiveRow.Cells["ORD_PK"].Text);
- designStatus1.DoQuery(ultraGrid2.ActiveRow.Cells["ORDER_NO"].Text.Trim(), this.ob);
- }
- private void orde_cho_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- Query();
- }
- }
- }
|