| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- 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 Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.YdmStuffManage.Entity;
- using System.Collections;
- using Core.Mes.Client.Comm.Server;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win;
- using Core.Mes.Client.Comm.Format;
- namespace Core.StlMes.Client.YdmStuffManage
- {
- public partial class FrmStuffAdjust : FrmBase
- {
- public FrmStuffAdjust()
- {
- InitializeComponent();
- }
- private string strBound = "800603";//调差编码
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- if (!CheckQuery()) return;
- doQueryData();
- break;
- case "Add":
- doAdd();
- break;
- case"Export":
- exportData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void exportData()
- {
- GridHelper.ulGridToExcel(ultraGrid2, "调差实绩");
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void doAdd()
- {
- this.ultraGrid1.UpdateData();
- string departId = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob);
- string departMent = ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob);
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选需要调差的物料!");
- return;
- }
- ArrayList parmlist = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- if (Double.Parse(row.Cells["adjustActWeight"].Text.Trim()) + Double.Parse(row.Cells["actWeight"].Text.Trim())<0)
- {
- MessageUtil.ShowTips("调差量不允许大于库存量!");
- return;
- }
- MatGpMEntity matZcMEntity = (MatGpMEntity)row.ListObject;
- string matEntity = JSONFormat.Format(matZcMEntity);
- parmlist.Add(matEntity);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否调差?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.FrmStuffAdjust";
- ccp.MethodName = "doAddAdjust";
- ccp.ServerParams = new object[] { parmlist,strBound, this.UserInfo.GetUserName(),this.UserInfo.GetDeptid(), this.UserInfo.GetDepartment(), departId, departMent };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("调差成功!"))
- {
- doQueryData();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQueryData()
- {
- if (ultraTabControl1.SelectedTab.Key == "0")
- {
- doQueryMat();
- }
- else
- {
- doQueryStockData();
- }
- }
- /// <summary>
- /// 查询库存信息
- /// </summary>
- private void doQueryMat()
- {
- string strRegStart = "";
- string strRegEnd = "";
- string heatNo = "";
- string[] arr = BaseMethod.WarehousePermissions(this.CustomInfo, this.ValidDataPurviewIds, this.ob);
- ArrayList parm = new ArrayList();
- if (chkRegTime.Checked)
- {
- strRegStart = RegStartTime.Value.ToString();
- strRegEnd = RegEndTime.Value.ToString();
- }
- if (this.checkHeatNo.Checked)
- {
- heatNo = this.txt_heatNo.Text.Trim();
- }
- parm.Add(heatNo);
- List<MatGpMEntity> listSource = EntityHelper.GetData<MatGpMEntity>(
- "com.steering.pss.ydm.Stuffmanage.FrmStuffMoveOut.doQuery", new object[] { parm, strRegStart, strRegEnd, arr }, this.ob);
- MatGpMEntitybindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 查询调差实绩
- /// </summary>
- private void doQueryStockData()
- {
- string strRegStart = "";
- string strRegEnd = "";
- string heatNo = "";
- string[] arr = BaseMethod.WarehousePermissions(this.CustomInfo, this.ValidDataPurviewIds, this.ob);
- ArrayList parm = new ArrayList();
- if (chkRegTime.Checked)
- {
- strRegStart = RegStartTime.Value.ToString();
- strRegEnd = RegEndTime.Value.ToString();
- }
- if (this.checkHeatNo.Checked)
- {
- heatNo = this.txt_heatNo.Text.Trim();
- }
- parm.Add(heatNo);
- List<YdmGpStocktakinglistEntity> listSource = EntityHelper.GetData<YdmGpStocktakinglistEntity>(
- "com.steering.pss.ydm.Stuffmanage.FrmStuffMoveOut.doQueryStock", new object[] { parm, strRegStart, strRegEnd, arr }, this.ob);
- YdmGpStocktakinglistEntitybindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 数据验证
- /// </summary>
- /// <returns></returns>
- private bool CheckQuery()
- {
- if (DataTimeUtil.JudgeTime(DateTime.Parse(RegStartTime.Value.ToString()), DateTime.Parse(RegEndTime.Value.ToString())) == 0)
- {
- MessageUtil.ShowTips("开始时间不能大于结束时间!");
- return false;
- }
- if (checkHeatNo.Checked && string.IsNullOrEmpty(this.txt_heatNo.Text.Trim()))
- {
- MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- return true;
- }
- private void FrmStuffAdjust_Load(object sender, EventArgs e)
- {
- RegStartTime.Value = DateTime.Parse(DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00");
- RegEndTime.Value = DateTime.Parse(DateTime.Today.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd") + " 23:59:59");
- BaseMethod.InitCellPosition(ultraGrid1, new string[] { "ActWeight", "ActCount", "ActLenMax", "ActLenMin", "ActTheoryWeight", "ActHeight", "ActDimater", "CuttingNum", "ActLen", "ActFixNum", "ActFixLen" });
- BaseMethod.InitCellPosition(ultraGrid2, new string[] { "ActWeight", "ActCount", "ActLenMax", "ActLenMin", "ActTheoryWeight", "ActHeight", "ActDimater", "CuttingNum", "ActLen", "ActFixNum", "ActFixLen" });
- EntityHelper.ShowGridCaption<MatGpMEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmGpStocktakinglistEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- InitBindColumn();
- }
- /// <summary>
- /// 绑定列
- /// </summary>
- private void InitBindColumn()
- {
- //材料状态
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料管理封锁");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料质量封锁");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料可编计划");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料已编计划");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(已综合判定)");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编计划(发运控制)");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编计划(发运控制)");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂");
- //材料类别
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801401", "在制品");
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801402", "成品");
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801403", "商品");
- DataTable ds = ClsLoad.GetValueListDataTable("8014", this.ob);
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["productFlag"].ValueList = ClsLoad.GeneralValuelist(ref ds, "BASECODE", "BASENAME");
- string[] arr = new string[3] { "801501", "801502", "801503" };
- DataTable dt = ClsLoad.GetValueListDataTable(arr, this.ob);
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["matStatus"].ValueList = ClsLoad.GeneralValuelist(ref dt, "BASECODE", "BASENAME");
- }
- private void checkHeatNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txt_heatNo.Enabled = this.checkHeatNo.Checked;
- }
- private void chkRegTime_CheckedChanged(object sender, EventArgs e)
- {
- RegStartTime.Enabled = this.chkRegTime.Checked;
- RegEndTime.Enabled = this.chkRegTime.Checked;
- }
- private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if (toolMenu == null) return;
- if (ultraTabControl1.SelectedTab.Key == "0")
- {
- if (toolMenu.Toolbars[0].Tools.Exists("Export"))
- {
- toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Add"))
- {
- toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- this.chkRegTime.Text = "入库时间";
- }
- else
- {
- if (toolMenu.Toolbars[0].Tools.Exists("Export"))
- {
- toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.True;
- }
- if (toolMenu.Toolbars[0].Tools.Exists("Add"))
- {
- toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- this.chkRegTime.Text = "调差时间";
- }
- }
- private void FrmStuffAdjust_Shown(object sender, EventArgs e)
- {
- if (toolMenu == null) return;
- if (toolMenu.Toolbars[0].Tools.Exists("Export"))
- {
- toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.False;
- }
- }
- }
- }
|