| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- 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 Core.Mes.Client.Comm.Control;
- using Pur.configure;
- using Pur.Entity;
- using Pur.Entity.configureEntity;
- using Pur.PublicTools;
- namespace Pur.require_plan
- {
- public partial class FrmPurRequireProcessQuery : FrmPmsBase
- {
- private string req_org_id = "";
- public FrmPurRequireProcessQuery()
- {
- InitializeComponent();
- }
- private void FrmPurRequireProcessQuery_Load(object sender, EventArgs e)
- {
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
- PurmatclassEntity mat = new PurmatclassEntity();
- mat.DeleteUserid = "1";
- mat.DeleteName = "1";
- ck_instock.Checked = true;
- ck_isNotice.Checked = true;
- DataTable dt2 = this.execute<DataTable>("com.hnshituo.pur.configure.service.MatClassService", "getMatClass", new object[] { mat });
- publicPms.FilComboboxAdd(txt_ItemClass, dt2, "baseCode", "baseName", "", true, "/", "");
- txt_ItemClass.SelectedIndex = 0;
- PhysicSeatEntity Phouse = new PhysicSeatEntity();
- Phouse.Validflag = "1";
- Phouse.DeleteUserid = "1";
- DataTable dt3 = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatService", "getActualSeat", new object[] { Phouse, 0, 0 });
- publicPms.FilComboboxAdd(txt_InvPhysic, dt3, "INVPHYSIC", "INVPHYSICNAME", "", true, "/", "");
- txt_InvPhysic.SelectedIndex = 0;
- txt_REQ_ORG.Text = UserInfo.GetDepartment();
- req_org_id = UserInfo.GetDeptid();
- }
- private void txt_REQ_ORG_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- frmdepartment frm = new frmdepartment(this.ob);
- //frm.StartPosition = FormStartPosition.Manual;
- //frm.Location = publicPms.getShowLocation(frm);
- frm.ShowDialog();
- String strdeptId = frm.BuyerUnitCode;
- String strDeptName = frm.Fulltext;
- txt_REQ_ORG.Text = strDeptName;
- req_org_id = strdeptId;
- }
- /// <summary>
- /// toolbar
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)//菜单toolbar按钮
- {
- switch (ToolbarKey)
- {
- case "Query":
- getUserPlan();
- break;
- case "Quit"://退出
- this.Close();
- break;
- case "doExcel"://退出
- //doExcel();
- break;
- }
- }
- private void getUserPlan()
- {
- dataSet1.Clear();
- EntityPurPlanD pd = new EntityPurPlanD();
- pd.UpdateName = req_org_id;
- if (txt_ItemClass.SelectedIndex != -1 && txt_ItemClass.SelectedIndex != 0)
- {
- pd.ItemDescE = txt_ItemClass.Value.ToString().Trim();
- }
- if (txt_InvPhysic.SelectedIndex != -1 && txt_InvPhysic.SelectedIndex != 0)
- {
- pd.DeleteName = txt_InvPhysic.Value.ToString().Trim();
- }
- pd.ItemCode = txt_itemCode.Text.Trim();
- pd.ItemName = txt_itemName.Text.Trim();
- pd.ItemDesc = txt_mrId.Text.Trim();
- pd.DeleteUserid = ck_instock.Checked == true ? "1" : "0";
- pd.UpdateUserid = ck_isNotice.Checked == true ? "1" : "0";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.purplan.service.PurPlanDService", "getCanOutBillPlanRe", new object[] { pd });
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- foreach (DataRow rowq in dataTable1.Rows)
- {
- double QtyPur = 0;
- double QtyInstock = 0;
- double QtyReq = 0;
- double QtyUse = 0;
- double QtyWill = 0;
- double.TryParse(rowq["qty"].ToString(), out QtyPur);//采购计划数量
- double.TryParse(rowq["qtyYcUseable"].ToString(), out QtyInstock);//库存量
- double.TryParse(rowq["qtyYc"].ToString(), out QtyReq);//通知发货量---生产厂
- double.TryParse(rowq["qtyYcUsed"].ToString(), out QtyUse);//已经领用量(所有部门)
- double.TryParse(rowq["QTYPURED"].ToString(), out QtyWill);//待领用量(所有部门)
- double canUseQty = QtyInstock;//-----供应部可全部编制
- canUseQty = Math.Min(Math.Min(QtyPur, (QtyInstock - QtyWill)), (QtyReq - QtyUse - QtyWill));//------生产厂只能部分编制
- if (canUseQty <= 0)
- {
- rowq["canUseQty"] = 0;
- }
- else
- {
- rowq["canUseQty"] = canUseQty;
- }
- if (rowq["itemuom"].ToString() == "基吨")
- {
- rowq["itemuom"] = "吨";
- }
- }
- GridHelper.RefreshAndAutoSize(ultraGrid1);
-
- }
- }
- }
|