| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572 |
- using Core.Mes.Client.Comm;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.GlBusiness.Dialog;
- using Core.StlMes.Client.Judge.Forms;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.GlBusiness
- {
- public partial class FrmGlOrderManage : FrmBase
- {
- public FrmGlOrderManage()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();//查询
- break;
- case "doAdd":
- doAdd();//新增合同
- break;
- case "doUpdate":
- doUpdate();//修改合同
- break;
- case "doDelete":
- doDelete();//作废合同头
- break;
- case "doSavePrice":
- doSavePrice();///价格维护
- break;
- case "doConfirm":
- doConfirm();//确认生效
- break;
- case "cancelConfirm":
- cancelConfirm();//取消确认
- break;
- case "doApprove1":
- doApprove("1");//审批通过
- break;
- case "doApprove2":
- doApprove("2");//审批退回
- break;
- case "doApprove3":
- doApprove("3");//审批拒绝
- break;
- case "doReturn":
- doReturn();//审批拒绝
- break;
- case "doPrint":
- doPrint();//打印
- break;
- case "queryBuyInfo":
- queryInfo("122302");
- break;
- case "querySaleInfo":
- queryInfo("122301");
- break;
- }
- }
- private void doQuery()
- {
- string orderNo = ""; //合同号
- string orderStart = "";
- string orderEnd = "";
- if (uchkOrderNo.Checked)
- {
- orderNo = utxtOrderNo.Text.Trim();
- }
- if (uchkDate.Checked)
- {
- orderStart = udtStart.DateTime.ToString("yyyy-MM-dd") + " 00:00:01";
- orderEnd = udtEnd.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
- }
- else
- {
- orderStart = "1000-01-01 00:00:01";
- orderEnd = "9999-12-31 23:59:59";
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.doQuery", new Object[] { orderNo, orderStart, orderEnd, this.ValidDataPurviewIds }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderHead, true);
- if (orderHead.Rows.Count<=0)
- orderLine.Clear();
- GridHelper.RefreshAndAutoSizeExceptColumns(this.ultraGrid1, "MNY_ASK_DESC");
- }
- private void doAdd()
- {
- orderHeadInfo head = new orderHeadInfo();
- head.Key = "add";
- head.ob = this.ob;
- head.ShowDialog();
- if (head.CloseEvent.Equals("Add"))
- this.doQuery();
- }
- private void doUpdate()
- {
- if (this.ultraGrid1.ActiveRow == null)
- return;
- if (!ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString().Equals("10"))
- {
- MessageUtil.ShowTips("合同状态非有效状态,不能修改");
- return;
- }
- orderHeadInfo head = new orderHeadInfo();
- head.Key = "update";
- head.OrdPk = ultraGrid1.ActiveRow.Cells["ORD_PK"].Value.ToString();
- head.ob = this.ob;
- head.ShowDialog();
- if (head.CloseEvent.Equals("Add"))
- this.doQuery();
- }
- private void doDelete()
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- if (!ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString().Equals("10"))
- {
- MessageUtil.ShowTips("合同状态非有效状态,不能作废");
- return;
- }
-
- if (MessageUtil.ShowYesNoAndQuestion("是否确认作废选中合同?") == DialogResult.No) return;
- String ordPk = ultraGrid1.ActiveRow.Cells["ord_pk"].Value.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.GlOrderManage";
- ccp.MethodName = "deleteHead";
- ccp.ServerParams = new object[] { ordPk };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("作废成功!");
- doQuery();
- }
- }
- private void doSavePrice()
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- List<UltraGridRow> listRow = ComHelper.UltraGridGetOtherRows(ultraGrid2, "Choose");
- if(listRow.Count<=0)
- {
- MessageUtil.ShowTips("请选择需要保存的记录");
- return;
- }
- if (!ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString().Equals("10"))
- {
- MessageUtil.ShowTips("合同状态非有效状态,不能保存价格");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow row in listRow)
- {
- ArrayList list = new ArrayList();
- list.Add(row.Cells["BALNCE_PRICE"].Value.ToString());
- list.Add(row.Cells["BALNCE_TOL_PRICE"].Value.ToString());
- list.Add(row.Cells["ORD_LN_PK"].Value.ToString());
- parm.Add(list);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.GlOrderManage";
- ccp.MethodName = "doSavePrice";
- ccp.ServerParams = new object[] { parm };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("价格维护成功!");
- doQuery();
- }
- }
- private void doConfirm()
- {
- if (ultraGrid1.ActiveRow==null)
- return;
- String ordPk = ultraGrid1.ActiveRow.Cells["ord_pk"].Value.ToString();
- if (!ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString().Equals("10"))
- {
- MessageUtil.ShowTips("合同状态非有效状态,不能确认");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.GlOrderManage";
- ccp.MethodName = "doConfirm";
- ccp.ServerParams = new object[] { ordPk };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("确认成功!");
- doQuery();
- }
- }
- private void cancelConfirm()
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- if (!ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString().Equals("20"))
- {
- MessageUtil.ShowTips("合同状态非生效状态,不能取消确认");
- return;
- }
- if (!ultraGrid1.ActiveRow.Cells["APPROVALFLAG"].Value.ToString().Equals("00"))
- {
- MessageUtil.ShowTips("评审状态非待审不能取消确认");
- return;
- }
- String ordPk = ultraGrid1.ActiveRow.Cells["ord_pk"].Value.ToString();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.GlOrderManage";
- ccp.MethodName = "cancelConfirm";
- ccp.ServerParams = new object[] { ordPk };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("取消确认成功!");
- doQuery();
- }
- }
- //审批通过 1 退回 2 拒绝 3
- private void doApprove(String flag)
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- String ordPk = ultraGrid1.ActiveRow.Cells["ord_pk"].Value.ToString();
- if (!ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString().Equals("20"))
- {
- MessageUtil.ShowTips("合同状态非生效不能审批");
- return;
- }
- if (!ultraGrid1.ActiveRow.Cells["APPROVALFLAG"].Value.ToString().Equals("00"))
- {
- MessageUtil.ShowTips("评审状态非待审不能审批");
- return;
- }
- glReviewMemo gl = new glReviewMemo();
- gl.ShowDialog();
- string reviewMemo = gl.ReviewMemo;
- if (gl.DialogResult != DialogResult.OK)
- return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.GlOrderManage";
- ccp.MethodName = "doApprove";
- ccp.ServerParams = new object[] { ordPk, flag, reviewMemo,UserInfo.GetUserID(),UserInfo.GetUserName() };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("审批成功!");
- doQuery();
- }
- }
- //取消审批
- private void doReturn()
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- String ordPk = ultraGrid1.ActiveRow.Cells["ord_pk"].Value.ToString();
- if (!ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString().Equals("20"))
- {
- MessageUtil.ShowTips("合同状态非生效不能撤销审批");
- return;
- }
- if (ultraGrid1.ActiveRow.Cells["APPROVALFLAG"].Value.ToString().Equals("00"))
- {
- MessageUtil.ShowTips("未审批,不需要撤销审批");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.GlOrderManage";
- ccp.MethodName = "doReturn";
- ccp.ServerParams = new object[] { ordPk };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("撤销审批成功!");
- doQuery();
- }
- }
- //取消审批
- private void doPrint()
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null) { MessageUtil.ShowTips("无数据,请确认!"); return; }
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalPurchaseContractTH.cpt&op=view" + "&ORD_PK=" + ugr.Cells["ORD_PK"].Value.ToString();
- FrmOrderRepExcel fBug = new FrmOrderRepExcel(this.ob, strurl);
- fBug.AutoSize = true;
- fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fBug.WindowState = FormWindowState.Maximized;
- fBug.Text = "天津钢管制造有限公司采购合同";
- fBug.Show();
- doQuery();
- }
- private void doApproval()
- {
- throw new NotImplementedException();
- }
- private void queryInfo(String flag)
- {
- FrmMatInfo line = new FrmMatInfo();
- line.ob = this.ob;
- line.Flag = "1";
- line.TradeType = flag;
- line.ShowDialog();
- }
- private void FrmGlOrderManage_Load(object sender, EventArgs e)
- {
- //默认查询当前日期-1月——当前日期数据。
- udtStart.DateTime = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToShortDateString());
- udtEnd.DateTime = Convert.ToDateTime(DateTime.Now.ToShortDateString());
- DataTable dtCmbType = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1223" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["TRADE_TYPE"].ValueList = ComHelper.List_GetBaseInfo(dtCmbType);
- DataTable dtOrderType = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1201" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["ORDER_TYP"].ValueList = ComHelper.List_GetBaseInfo(dtOrderType);
- DataTable dtOrderUnit = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1205" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["SUPPLY_UNIT"].ValueList = ComHelper.List_GetBaseInfo(dtOrderUnit);
- DataTable dtAddress = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1106" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["DELVRY_ADDR"].ValueList = ComHelper.List_GetBaseInfo(dtAddress);
- DataTable dtDeliveryType = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1208" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["DELVRY_TYPE"].ValueList = ComHelper.List_GetBaseInfo(dtDeliveryType);
- DataTable dtTransType = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1105" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["TRANSIT_TYPE"].ValueList = ComHelper.List_GetBaseInfo(dtTransType);
- DataTable dtPackType = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1232" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["PACK_TYPE"].ValueList = ComHelper.List_GetBaseInfo(dtPackType);
- DataTable dtPayType = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getBaseInfo", new object[] { "1212" }, this.ob);
- ultraGrid1.DisplayLayout.Bands[0].Columns["MNY_ASK_TYP"].ValueList = ComHelper.List_GetBaseInfo(dtPayType);
- ValueList list = new ValueList();
- ValueListItem[] items = new ValueListItem[] {
- new ValueListItem("00", "无效"),
- new ValueListItem("10", "有效"),
- new ValueListItem("20", "生效"),
- };
- list.ValueListItems.AddRange(items);
- ultraGrid1.DisplayLayout.Bands[0].Columns["VALIDFLAG"].ValueList = list;
- ValueList list1 = new ValueList();
- ValueListItem[] items1 = new ValueListItem[] {
- new ValueListItem("00", "待审"),
- new ValueListItem("10", "通过"),
- new ValueListItem("20", "退回"),
- new ValueListItem("30", "拒绝"),
- };
- list1.ValueListItems.AddRange(items1);
- ultraGrid1.DisplayLayout.Bands[0].Columns["APPROVALFLAG"].ValueList = list1;
- ValueList list2 = new ValueList();
- ValueListItem[] items2 = new ValueListItem[] {
- new ValueListItem("0", "否"),
- new ValueListItem("1", "是")
- };
- list2.ValueListItems.AddRange(items2);
- ultraGrid2.DisplayLayout.Bands[0].Columns["PRODUCER_FL"].ValueList = list2;
- GridHelper.SetAllColumnsActive(ultraGrid1);
- if("1".Equals(CustomInfo))
- {
- GridHelper.SetAllColumnsActive(ultraGrid2);
- ultraGrid2.DisplayLayout.Bands[0].Columns["Choose"].Hidden = true;
- ultraGrid2.DisplayLayout.Bands[0].Columns["BALNCE_PRICE"].Hidden = true;
- ultraGrid2.DisplayLayout.Bands[0].Columns["BALNCE_TOL_PRICE"].Hidden = true;
- }
- else
- {
- ultraToolbarsManager1.Visible = false;
- GridHelper.SetColumnsActivateAndColor(ultraGrid2.Rows.Band, "Choose", "BALNCE_PRICE");
- }
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Add":
- Add();
- break;
- case "Delete":
- DeleteLine();
- break;
- case "Export":
- GridHelper.ulGridToExcel(ultraGrid2, "关联交易合同行信息表");
- break;
- }
- }
- private void DeleteLine()
- {
- if (ultraGrid2.ActiveRow == null)
- return;
- String ordLnPk = ultraGrid2.ActiveRow.Cells["ord_ln_pk"].Value.ToString();
- if (!"10".Equals(ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString()))
- {
- MessageUtil.ShowWarning("合同状态为有效时才能作废合同行");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认作废选中合同行?") == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.GlOrderManage";
- ccp.MethodName = "deleteLine";
- ccp.ServerParams = new object[] { ordLnPk };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("作废成功!");
- queryLine();
- }
- }
- private void Add()
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- String ordPk = ultraGrid1.ActiveRow.Cells["ord_pk"].Value.ToString();
- if (!"10".Equals(ultraGrid1.ActiveRow.Cells["VALIDFLAG"].Value.ToString()))
- {
- MessageUtil.ShowWarning("合同状态为有效时才能新增合同行");
- return;
- }
- FrmMatInfo line = new FrmMatInfo();
- line.ob = this.ob;
- line.OrdPk = ordPk;
- line.Flag = "0";
- line.TradeType = ultraGrid1.ActiveRow.Cells["TRADE_TYPE"].Value.ToString();
- line.ShowDialog();
- if (line.CloseEvent.Equals("Add"))
- {
- this.doQuery();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["ORD_PK"].Value.ToString() == ordPk)
- {
- row.Activate();
- break;
- }
- }
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- queryLine();
- }
- public void queryLine()
- {
- if (ultraGrid1.ActiveRow == null)
- return;
- String ordPk = ultraGrid1.ActiveRow.Cells["ord_pk"].Value.ToString();
- DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.doQueryLine", new Object[] { ordPk }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderLine, true);
- }
- private void uchkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (uchkDate.Checked)
- {
- udtStart.ReadOnly = false;
- udtEnd.ReadOnly = false;
- }
- else
- {
- udtStart.ReadOnly = true;
- udtEnd.ReadOnly = true;
- }
- }
- private void ultraGrid2_CellChange(object sender, CellEventArgs e)
- {
- this.ultraGrid2.UpdateData();
- if (e.Cell.Column.Key != "BALNCE_PRICE")
- return;
- int i = e.Cell.Row.Index;
- double price =0;
- if (!double.TryParse(ultraGrid2.Rows[i].Cells["BALNCE_PRICE"].Text, out price))
- return;
- double weight = double.Parse(ultraGrid2.Rows[i].Cells["ORDER_QTY"].Text);
- double money = price * weight;
- ultraGrid2.Rows[i].Cells["BALNCE_TOL_PRICE"].Value = Math.Round(money, 3);
- }
- private void uchkOrderNo_CheckedChanged(object sender, EventArgs e)
- {
- if (uchkOrderNo.Checked)
- utxtOrderNo.ReadOnly = false;
- else
- utxtOrderNo.ReadOnly = true;
- }
- private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
-
- string filePath = ultraGrid2.ActiveRow.GetValue("CRAFT_NO");
- DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getFilePath", new Object[] { filePath }, this.ob);
- string file = dt.Rows[0]["CRAFT_PATH"].ToString3();
- dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob,file);
- askDown.DeleteButton.Visible = false;
- askDown.Show();
- }
-
- }
- }
|