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.YdmBase; using Core.StlMes.Client.YdmPipeManage.Controls; using Core.StlMes.Client.YdmPipeManage.Entity; using CoreFS.CA06; 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.Windows.Forms; namespace Core.StlMes.Client.YdmPipeManage { public partial class FrmInListRead : FrmBase { public FrmInListRead() { InitializeComponent(); } private string departId = ""; private string[] arr = null; private string strInbound = "800704";//产出红冲 private void FrmInListRead_Load(object sender, EventArgs e) { StartTime.Value = DateTime.Parse(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString()); DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); EndTime.Value = DateTime.Parse(d1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59"); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); this.StartTime.Enabled = false; this.EndTime.Enabled = false; this.cmbJudge.Enabled = false; this.cmbOrder.Enabled = false; this.cmbStorager.Enabled = false; Init(); InitBindColumn(); departId = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob); } private void Init() { YdmBaseClass.InitComboEditor(cmbStorager, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); } 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("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", "商品"); //材料状态 this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出待判"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料产出(已判定)"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料已编计划"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料待处理"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料加工"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(已综合判定)"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编提单"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编提单"); this.ultraGrid2.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂"); //材料类别 this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801401", "在制品"); this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801402", "成品"); this.ultraGrid2.DisplayLayout.ValueLists[1].ValueListItems.Add("801403", "商品"); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QueryInList(); break; case "Query1": getRedInList(); break; case "pipRedStore": pipRedStore(); break; case "CanclePipe": DoCanclePipeIn(); break; case "adjust": adjustYear(); break; case "Export": exportData(); break; case "Close": this.Close(); break; } } /// /// 查询入库记录 /// private void QueryInList() { string heatNo = ""; string orderNo = ""; string storgeNo = ""; string startTim = ""; string endTim = ""; if (ultraCheckEditor5.Checked) { startTim = StartTime.Value.ToString(); endTim = EndTime.Value.ToString(); } if (chkJudge.Checked) { if (this.cmbJudge.Text == "") { MessageUtil.ShowTips("请输入炉号!"); return; } else { heatNo = this.cmbJudge.Text.Trim(); } } if (chkOrder.Checked) { if (this.cmbOrder.Text == "") { MessageUtil.ShowTips("请输入合同号!"); return; } else { orderNo = this.cmbOrder.Text.Trim(); } } if (chkStrong.Checked) { if (this.cmbStorager.Text == "") { MessageUtil.ShowTips("请选择仓库!"); return; } else { storgeNo = this.cmbStorager.Value.ToString(); } } ArrayList list = new ArrayList(); list.Add(heatNo); list.Add(orderNo); list.Add(storgeNo); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmInListRead.doQueryInList", new object[] { list, startTim, endTim, departId }, this.ob); MatZcMEntity1bindingSource.DataSource = listSource; } /// /// 查询红冲实绩 /// private void getRedInList() { string heatNo = ""; string orderNo = ""; string storgeNo = ""; string startTim = ""; string endTim = ""; if (ultraCheckEditor5.Checked) { startTim = StartTime.Value.ToString(); endTim = EndTime.Value.ToString(); } if (chkJudge.Checked) { if (this.cmbJudge.Text == "") { MessageUtil.ShowTips("请选择炉号!"); return; } else { heatNo = this.cmbJudge.Text.Trim(); } } if (chkOrder.Checked) { if (this.cmbOrder.Text == "") { MessageUtil.ShowTips("请选择合同号!"); return; } else { orderNo = this.cmbOrder.Text.Trim(); } } if (chkStrong.Checked) { if (this.cmbStorager.Text == "") { MessageUtil.ShowTips("请选择仓库!"); return; } else { storgeNo = this.cmbStorager.Value.ToString(); } } ArrayList list = new ArrayList(); list.Add(heatNo); list.Add(orderNo); list.Add(storgeNo); List listSource = EntityHelper.GetData( "com.steering.pss.ydm.pipemanage.FrmInListRead.doQueryInListRead", new object[] { list, startTim, endTim, departId }, this.ob); YdmZcInlistEntitybindingSource2.DataSource = listSource; } /// /// 红冲 /// private void pipRedStore() { this.ultraGrid1.UpdateData(); string strInMemo = ""; UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("未选中库存信息,不允许进行红冲!"); return; } if (Math.Abs(int.Parse((uRow.Cells["ActCount"].Value.ToString2()))) == 0) { MessageUtil.ShowTips("红冲支数不能为零或者空!"); return; } DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob); if (dtMemo.Rows.Count >= 1) { strInMemo = dtMemo.Rows[0]["MEMO"].ToString(); } ArrayList matList = new ArrayList(); matList.Add(strInbound); matList.Add(strInMemo); matList.Add(this.UserInfo.GetUserName()); matList.Add(this.UserInfo.GetDeptid()); matList.Add(this.UserInfo.GetDepartment()); matList.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob)); matList.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob)); MatZcMEntity1 ydmInList = (MatZcMEntity1)uRow.ListObject; string ydmInListEntity = JSONFormat.Format(ydmInList); if (MessageUtil.ShowYesNoAndQuestion("是否确认进行红冲?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmInListRead"; ccp.MethodName = "doPipeRedDased"; ccp.ServerParams = new object[] { ydmInListEntity, departId, matList }; ccp = ob.ExecuteNonQuery(ccp,CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("红冲成功!")) { QueryInList(); getRedInList(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销红冲 /// private void DoCanclePipeIn() { this.ultraGrid2.UpdateData(); UltraGridRow row = this.ultraGrid2.ActiveRow; if (row == null) { MessageUtil.ShowTips("未选中红冲实绩信息,不允许进行撤销!"); return; } ArrayList list = new ArrayList(); string moth = DateTime.Parse(row.Cells["BalYearMonth"].Text).AddMonths(1).ToString("yyyyMM"); list.Add(moth); list.Add(this.UserInfo.GetUserName()); list.Add(this.UserInfo.GetDeptid()); list.Add(this.UserInfo.GetDepartment()); list.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob)); list.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob)); YdmZcInlistEntity ydmInList = (YdmZcInlistEntity)row.ListObject; string ydmInListEntity = JSONFormat.Format(ydmInList); if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销红冲?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmInListRead"; ccp.MethodName = "cancelDoPipeRedDased"; ccp.ServerParams = new object[] { ydmInListEntity, departId, list }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤消成功!")) { QueryInList(); getRedInList(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 调整红冲年月 /// private void adjustYear() { this.ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("未选中调整结转年月的数据,不允许调整结转年月!"); return; } string moth = DateTime.Parse(uRow.Cells["BalYearMonth"].Text).AddMonths(1).ToString("yyyyMM"); ArrayList list = new ArrayList(); list.Add(moth); list.Add(DateTime.Parse(uRow.Cells["BalYearMonth"].Text).ToString("yyyyMM")); list.Add(DateTime.Parse(uRow.Cells["BalYearMonth"].Text).ToString("yyyy-MM") + "-02 12:00:00"); YdmZcInlistEntity ydmInList = (YdmZcInlistEntity)uRow.ListObject; string ydmInListEntity = JSONFormat.Format(ydmInList); if (MessageUtil.ShowYesNoAndQuestion("是否确认调整结转年月?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmInListRead"; ccp.MethodName = "adjustBalYearMoth"; ccp.ServerParams = new object[] { ydmInListEntity, departId,list }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("调整成功!")) { getRedInList(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 导出 /// private void exportData() { GridHelper.ulGridToExcel(ultraGrid2, "红冲实绩总汇"); } private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e) { this.StartTime.Enabled = this.EndTime.Enabled = ultraCheckEditor5.Checked; } private void chkJudge_CheckedChanged(object sender, EventArgs e) { this.cmbJudge.Enabled = this.chkJudge.Checked; } private void chkOrder_CheckedChanged(object sender, EventArgs e) { this.cmbOrder.Enabled = this.chkOrder.Checked; } private void chkStrong_CheckedChanged(object sender, EventArgs e) { this.cmbStorager.Enabled = this.chkStrong.Checked; } } }