| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.GlBusiness.Models;
- 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 FrmTHOrderManage : FrmBase
- {
- public FrmTHOrderManage()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<PlnOrderZgSEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- this.IsLoadUserView = true;
- }
- private void FrmTHOrderManage_Load(object sender, EventArgs e)
- {
- //默认查询当前日期-1月——当前日期数据。
- udtStart.DateTime = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToShortDateString());
- udtEnd.DateTime = Convert.ToDateTime(DateTime.Now.ToShortDateString());
- if (this.CustomInfo.ToString2().Equals("123504"))
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["thOrderNoSeq"].CellAppearance.BackColor = Color.FromArgb(255, 255, 128);
-
- ultraGrid1.DisplayLayout.Bands[0].Columns["OrderQty"].Hidden=true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["Lengthdisc"].Hidden = true;
- }
- }
- private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- string filePath = ultraGrid1.ActiveRow.GetValue("CraftFileNo");
- 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();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();//查询
- break;
- case "confirm":
- doConfirm();//确认
- break;
- case "cancel":
- doCancel();//取消
- break;
- case "updateField":
- updateField();//修改信息
- break;
- case "updateWeight":
- updateWeight();//修改重量
- break;
- case "update":
- doUpdateThOrder();//修改合同
- break;
- case "AddOrder": // 生成合同
- doAddOrder();
- break;
- case "Export":
- doExport();
- break;
- }
- }
- private void doAddOrder()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
- ArrayList list = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- PlnOrderZgSEntity entity = row.ListObject as PlnOrderZgSEntity;
- if (!entity.ProductionThFlag.Equals("123506"))
- {
- MessageUtil.ShowTips(entity.ProPlanId + ",合同未确认!");
- return;
- }
- if (!String.IsNullOrEmpty(entity.ThOrderNoSeq))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "天淮合同已存在!");
- return;
- }
- list.Add(JSONFormat.Format(entity));
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
- ccp.MethodName = "doAddOrder";
- ccp.ServerParams = new object[] { list };
- 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 doExport()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "关联交易-半成品");
- }
- private void updateField()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
- ArrayList list = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- PlnOrderZgSEntity entity = row.ListObject as PlnOrderZgSEntity;
- list.Add(JSONFormat.Format(entity));
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
- ccp.MethodName = "doupdateField";
- ccp.ServerParams = new object[] { list };
- 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 updateWeight()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
- ArrayList list = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- PlnOrderZgSEntity entity = row.ListObject as PlnOrderZgSEntity;
- list.Add(JSONFormat.Format(entity));
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
- ccp.MethodName = "doupdateWeight";
- ccp.ServerParams = new object[] { list };
- 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 doUpdateThOrder()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
- ArrayList list = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- PlnOrderZgSEntity entity = row.ListObject as PlnOrderZgSEntity;
- if (!entity.ProductionThFlag.Equals("123506"))
- {
- MessageUtil.ShowTips(entity.ProPlanId + ",合同未确认!");
- return;
- }
- if (String.IsNullOrEmpty(entity.ThOrderNoSeq))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "天淮合同不能为空!");
- return;
- }
- list.Add(new object[] { entity.ThOrderNoSeq, entity.ProPlanId, entity.GxPlanNo });
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
- ccp.MethodName = "doUpdateThOrder";
- ccp.ServerParams = new object[] { list };
- 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 doCancel()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
- ArrayList list = new ArrayList();
- foreach (UltraGridRow row in checkRows)
- {
- PlnOrderZgSEntity entity = row.ListObject as PlnOrderZgSEntity;
- string productionThFlag = "";
- // 制造部
- if (this.CustomInfo.ToString2().Equals("123501"))
- {
- if (!entity.ProductionThFlag.Equals("123502") && !entity.ProductionThFlag.Equals("123503"))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "," + entity.ProductionThName+ "状态有误,无法撤销,请确认状态!");
- return;
- }
- else
- {
- productionThFlag = "123501";
- }
- }
- // 配套服务科
- if (this.CustomInfo.ToString2().Equals("123502"))
- {
- if (!entity.ProductionThFlag.Equals("123504") && !entity.ProductionThFlag.Equals("123505"))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "," + entity.ProductionThName + ",状态有误,无法撤销,请确认状态!");
- return;
- }
- else
- {
- productionThFlag = "123503";
- }
- }
- // 天淮公司
- if (this.CustomInfo.ToString2().Equals("123504"))
- {
- if (!entity.ProductionThFlag.Equals("123506"))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "," + entity.ProductionThName + ",状态有误,无法撤销,请确认状态!");
- return;
- }
- else
- {
- productionThFlag = "123505";
- }
- }
- list.Add(new object[] { productionThFlag, entity.ProPlanId, entity.GxPlanNo, this.CustomInfo.ToString2() });
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { list };
- 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()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
- ArrayList list = new ArrayList();
- foreach(UltraGridRow row in checkRows){
- PlnOrderZgSEntity entity = row.ListObject as PlnOrderZgSEntity;
- string productionThFlag = "";
- // 制造部
- if (this.CustomInfo.ToString2().Equals("123501"))
- {
- if (!(entity.ProductionThFlag.Equals("") || entity.ProductionThFlag.Equals("123501") || entity.ProductionThFlag.Equals("123503")))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "," + entity.ProductionThName + ",状态有误,无法确认,请确认状态!");
- return;
- }
- else
- {
- productionThFlag = "123502";
- }
- }
- // 配套服务科
- if (this.CustomInfo.ToString2().Equals("123502"))
- {
- if (!(entity.ProductionThFlag.Equals("123502") || entity.ProductionThFlag.Equals("123503") || entity.ProductionThFlag.Equals("123505")))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "," + entity.ProductionThName + ",状态有误,无法确认,请确认状态!");
- return;
- }
- else
- {
- productionThFlag = "123504";
- }
- }
- // 天淮公司
- if (this.CustomInfo.ToString2().Equals("123504"))
- {
- if (!(entity.ProductionThFlag.Equals("123504") || entity.ProductionThFlag.Equals("123505")))
- {
- MessageUtil.ShowTips(entity.ProPlanId + "," + entity.ProductionThName + ",状态有误,无法确认,请确认状态!");
- return;
- }
- else
- {
- productionThFlag = "123506";
- }
- }
- list.Add(new object[] { productionThFlag, entity.ProPlanId, entity.GxPlanNo, this.CustomInfo.ToString2() });
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { list };
- 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 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";
- }
- string productionThFlag = this.CustomInfo.ToString2().Equals("123501") ? "" : this.CustomInfo.ToString2();
- List<PlnOrderZgSEntity> listSource = EntityHelper.GetData<PlnOrderZgSEntity>(
- "com.steering.pss.glbusiness.FrmTHOrderManage.doQuery", new object[] { orderNo, orderStart, orderEnd, productionThFlag }, this.ob);
- plnOrderZgSEntityBindingSource.DataSource = listSource;
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- this.ultraGrid1.UpdateData();
- UltraGridRow row = this.ultraGrid1.ActiveRow;
- if (row == null)
- {
- return;
- }
- FrmProInformation fp = new FrmProInformation(ob, row.Cells["PrdcrNo"].Text, row.Cells["IndexSeq"].Text, "D");
- fp.ShowDialog();
- }
-
-
- }
- }
|