| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- using com.steering.mes.zgmil.entity;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- 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.ZGMil.Signature
- {
- public partial class FrmEntrustedCheck : FrmBase
- {
- public FrmEntrustedCheck()
- {
- InitializeComponent();
- }
- UltraComboEditor uceReson = new UltraComboEditor();
- private void FrmEntrustedCheck_Load(object sender, EventArgs e)
- {
- DateTime now = DateTime.Now;
- DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
- DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
- this.StartTime2.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- this.EndTime2.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- EntityHelper.ShowGridCaption<MilEntrustedBillEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- initBase();
- PipeManageClass.InitComboEditor(uceReson, "com.steering.mes.signature.FrmEntrustedCheck.doQueryPline", "PLINE_CODE", this.ob, false);
- PipeManageClass.BindColumn(uceReson, "EntrustedPlineName", this.Controls, this.ultraGrid1, 0);
- }
- private void initBase()
- {
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("0", "未审核");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("1", "审核通过");
- this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("2", "审核未通过");
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("0", "未完成");
- this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("1", "已完成");
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuerySubContract":
- doQuerySubContract();
- break;
- case"checkPass":
- checkcheckPass();
- break;
- case "noCheckPass":
- noCheckPass();
- break;
- case"cancelCheck":
- cancelCheck();
- break;
- case "subcontractComplete":
- subcontractComplete();
- break;
- case "cancelSubcontractComplete":
- cancelSubcontractComplete();
- break;
- case "Export":
- ExportData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
-
-
-
- /// <summary>
- /// 查询委托
- /// </summary>
- private void doQuerySubContract()
- {
- string subcontracNo = "";
- string startTim = "";
- string endTim = "";
- string entrustedFlag = "";
- string jugeNo = "";
- NativeMethodNew na = new NativeMethodNew(this.ob);
- string plinCode = na.GetPCode(this.UserInfo.GetDepartment());
- if (this.chkOrderNo.Checked && this.txtOrderNo.Text.Trim() != "")
- {
- subcontracNo = this.txtOrderNo.Text.Trim();
- }
- if(this.chkJugeNo.Checked&& this.txtJugeNo.Text.Trim() !="")
- {
- jugeNo = this.txtJugeNo.Text.Trim();
- }
- if (chkTim2.Checked)
- {
- if (DateTime.Parse(StartTime2.Value.ToString()) > DateTime.Parse(EndTime2.Value.ToString()))
- {
- MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
- return;
- }
- else
- {
- startTim = this.StartTime2.Value.ToString("yyyy-MM-dd HH:mm:ss");
- endTim = this.EndTime2.Value.ToString("yyyy-MM-dd HH:mm:ss");
- }
- }
- entrustedFlag = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
- ArrayList list = new ArrayList();
- list.Add(subcontracNo);
- list.Add(entrustedFlag);
- list.Add(jugeNo);
- List<MilEntrustedBillEntity> listSource = EntityHelper.GetData<MilEntrustedBillEntity>(
- "com.steering.mes.signature.FrmEntrustedCheck.doQuerySubContact", new object[] { list, startTim, endTim, plinCode }, this.ob);
- MilEntrustedBillEntitybindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 审核通过
- /// </summary>
- private void checkcheckPass()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要进行操作的主信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- MilEntrustedBillEntity milEntrustEntity = (MilEntrustedBillEntity)uRow.ListObject;
- if (uRow.Cells["EntrustedPlineName"].Text.ToString() == "")
- {
- MessageUtil.ShowTips("审核通过请指定委托产线!");
- return;
- }
- milEntrustEntity.EntrustedPlineCode = uRow.Cells["EntrustedPlineName"].Value.ToString();
- milEntrustEntity.EntrustedPlineName = uRow.Cells["EntrustedPlineName"].Text.ToString();
- string milEntrustTity = JSONFormat.Format(milEntrustEntity);
- parm.Add(milEntrustTity);
- }
-
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmEntrustedCheck";
- ccp.MethodName = "checkPass";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("审核成功!"))
- {
- doQuerySubContract();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 审核不通过
- /// </summary>
- private void noCheckPass()
- {
- this.ultraGrid1.UpdateData();
- int m = 0;
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要进行操作的主信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- MilEntrustedBillEntity milEntrustEntity = (MilEntrustedBillEntity)uRow.ListObject;
- if (milEntrustEntity.EntrustedRemark.ToString() == "")
- {
- m = m + 1;
- }
- string milEntrustTity = JSONFormat.Format(milEntrustEntity);
- parm.Add(milEntrustTity);
- }
- if(m>0)
- {
- MessageUtil.ShowTips("审核不通过,请输入审核说明!");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmEntrustedCheck";
- ccp.MethodName = "noCheckPass";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("审核成功!"))
- {
- doQuerySubContract();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 撤销审核
- /// </summary>
- private void cancelCheck()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要进行操作的主信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- MilEntrustedBillEntity milEntrustEntity = (MilEntrustedBillEntity)uRow.ListObject;
- string milEntrustTity = JSONFormat.Format(milEntrustEntity);
- parm.Add(milEntrustTity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmEntrustedCheck";
- ccp.MethodName = "cancelCheckPass";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- doQuerySubContract();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 委外加工完成
- /// </summary>
- private void subcontractComplete()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要操作的主信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- int m = 0;
-
- foreach (UltraGridRow uRow in checkMagRows)
- {
- //if (int.Parse(uRow.Cells["SubcontractcompleteNum"].Value.ToString3()) + int.Parse(uRow.Cells["SubcontractscrapNum"].Value.ToString3()) != int.Parse(uRow.Cells["SubcontractNum"].Value.ToString3()) * int.Parse(uRow.Cells["SubcontractCompleteCut"].Value.ToString3()))
- //{
- // m = m + 1;
- //}
- MilEntrustedBillEntity milEntrustTity = (MilEntrustedBillEntity)uRow.ListObject;
- string milEntrustEntity = JSONFormat.Format(milEntrustTity);
- parm.Add(milEntrustEntity);
- if (milEntrustTity.OfflinePro.Equals("XX"))
- {
- if (!getData(milEntrustTity))
- {
- return;
- }
- }
- else
- {
- if (!getDataS(milEntrustTity))
- {
- return;
- }
- }
- }
- //if (m > 1)
- //{
- // MessageUtil.ShowTips("委外回报实绩的支数与委外出去加工支数不符!");
- // return;
- //}
- if (MessageUtil.ShowYesNoAndQuestion("是否确认回报委外实绩?") == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmDownlineManage";
- ccp.MethodName = "subcontractComplete";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("委外加工完成!"))
- {
- doQuerySubContract();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 撤销委外完成
- /// </summary>
- private void cancelSubcontractComplete()
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要操作的主信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- int m = 0;
- foreach (UltraGridRow uRow in checkMagRows)
- {
- MilEntrustedBillEntity milEntrustTity = (MilEntrustedBillEntity)uRow.ListObject;
- string milEntrustEntity = JSONFormat.Format(milEntrustTity);
- parm.Add(milEntrustEntity);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认回报委外实绩?") == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.signature.FrmDownlineManage";
- ccp.MethodName = "cancelSubcontractComplete";
- ccp.ServerParams = new object[] { parm };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("撤销成功!"))
- {
- doQuerySubContract();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 数据验证
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private bool getData(MilEntrustedBillEntity milEntrustTity)
- {
- if (milEntrustTity.SubcontractCompleteCut.ToString2() == "")
- {
- MessageUtil.ShowTips("交库点离线外委的管子需回报分切数!");
- return false;
- }
- if (milEntrustTity.SubcontractCompleteLen.ToString2() == "")
- {
- MessageUtil.ShowTips("交库点离线外委的管子需回报分切定尺长度!");
- return false;
- }
- if (milEntrustTity.SubcontractCompleteWgt.ToString2() == "")
- {
- MessageUtil.ShowTips("交库点离线外委的管子需回报外委合格重量!");
- return false;
- }
- if (milEntrustTity.SubcontractcompleteNum.ToString2() == "")
- {
- MessageUtil.ShowTips("交库点离线外委的管子需回报外委合格支数!");
- return false;
- }
- return true;
- }
- /// <summary>
- /// 其他点委外数据验证
- /// </summary>
- /// <returns></returns>
- private bool getDataS(MilEntrustedBillEntity milEntrustTity)
- {
- if (milEntrustTity.SubcontractcompleteNum.ToString2() =="")
- {
- MessageUtil.ShowTips("离线外委的管子需回报外委合格支数!");
- return false;
- }
- return true;
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "轧管委外审核信息");
- }
- private void chkTim2_CheckedChanged(object sender, EventArgs e)
- {
- this.StartTime2.Enabled = this.EndTime2.Enabled = this.chkTim2.Checked;
- }
- private void chkOrderNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtOrderNo.Enabled = this.chkOrderNo.Checked;
- }
- private void chkJugeNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtJugeNo.Enabled = this.chkJugeNo.Checked;
- }
- }
- }
|