| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- 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 com.hnshituo.pur.vo;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Pur.configure;
- using Pur.Entity;
- using Pur.Entity.configureEntity;
- using Pur.Entity.require_planEntiy;
- using Pur.Pop_upWindow;
- using Pur.PublicTools;
- namespace Pur.ck
- {
- public partial class frmUsePlanMAdd : FrmPmsBase
- {
- private string showType;
- private DataTable dt2 = new DataTable();
- private DataTable dt3 = new DataTable();
- private string req_org_id="";
- public string tips = "0";
- public String mrId = "";
- public frmUsePlanMAdd()
- {
- InitializeComponent();
- }
- public frmUsePlanMAdd(OpeBase OB, string showType)
- {
- // TODO: Complete member initialization
- this.ob = OB;
- this.showType = showType;
- InitializeComponent();
- }
- private void frmUsePlanMAdd_Load(object sender, EventArgs e)
- {
- PurmatclassEntity mat = new PurmatclassEntity();
- mat.DeleteUserid = "1";
- mat.DeleteName = "1";
- dt2 = this.execute<DataTable>("com.hnshituo.pur.configure.service.MatClassService", "getMatClass", new object[] { mat });
- //publicPms.FilComboboxAdd(txt_ItemClass, dt2, "baseCode", "baseName", "", true, "/", "");
- PhysicSeatEntity Phouse = new PhysicSeatEntity();
- Phouse.Validflag = "1";
- Phouse.DeleteUserid = "1";
- if (showType == "1")
- {
- Phouse.IsGybCk = "0";
- }
- dt3 = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatService", "getActualSeat", new object[] { Phouse, 0, 0 });
- // publicPms.FilComboboxAdd(txt_InvPhysic, dt3, "INVPHYSIC", "INVPHYSICNAME", "", true, "/", "");
- publicPms.FilComboboxAdd(txt_ItemClass, dt2, "baseCode", "baseName", "", false, "/", "");
- publicPms.FilComboboxAdd(txt_InvPhysic, dt3, "INVPHYSIC", "INVPHYSICNAME", "", false, "/", "");
- if (showType == "1")
- {
- //txt_REQ_ORG.Enabled = false;
- //txt_REQ_ORG.Text = UserInfo.GetDepartment();
- //req_org_id = UserInfo.GetDeptid();
- txt_REQ_ORG.Enabled = true;
- }
- else
- {
- txt_REQ_ORG.Enabled = true;
- }
- txt_ApplyTime.Value = DateTime.Now.AddDays(5);
- txt_planType.SelectedIndex = 0;
- }
- private void btn_addUsePlan_Click(object sender, EventArgs e)
- {
- UsePlanM Upm = new UsePlanM();
- if (showType == "1")
- {
- Upm.PlanType = "1";
- }
- else if (showType == "2")
- {
- Upm.PlanType = "2";
- }
- else
- {
- MessageUtil.ShowTips("界面配置错误,请指定界面使用者[1:生产厂,2:供应部]");
- return;
- }
- if (txt_ItemClass.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("请选择领用物料中类");
- txt_ItemClass.Focus();
- return;
- }
- if (String.IsNullOrEmpty(txt_REQ_ORG.Text.Trim()) || String.IsNullOrEmpty(req_org_id))
- {
- MessageUtil.ShowTips("请选择领用部门");
- txt_REQ_ORG.Focus();
- return;
- }
- if (txt_planType.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("请选择计划类型");
- txt_planType.Focus();
- return;
- }
- if (txt_InvPhysic.Value == null)
- {
- MessageUtil.ShowTips("请选择仓库");
- txt_InvPhysic.Focus();
- return;
- }
- if (txt_ApplyTime.Value == null)
- {
- MessageUtil.ShowTips("领用时间不能为空");
- txt_ApplyTime.Focus();
- return;
- }
- //if (Convert.ToDateTime(txt_ApplyTime.Value) <= DateTime.Now)
- //{
- // MessageUtil.ShowTips("领用时间需大于当前时间");
- // txt_ApplyTime.Focus();
- // return;
- //}
- if (String.IsNullOrEmpty(txt_selectlocation.Text.Trim()))
- {
- MessageUtil.ShowTips("请选择交货地址");
- txt_selectlocation.Focus();
- return;
- }
- if (String.IsNullOrEmpty(txt_selectlocationCode.Text.Trim()) || txt_selectlocationCode.Text.Trim() == "-")
- {
- MessageUtil.ShowTips("请选择交货地址,交付地址编码不能为空");
- txt_selectlocation.Focus();
- return;
- }
- Upm.Status = "1";
- Upm.Validflag = "1";
- Upm.Classes = this.UserInfo.GetUserGroup();
- Upm.MrPeriodEnd = (DateTime)txt_ApplyTime.Value;
- Upm.InvPhysic = txt_InvPhysic.Value.ToString();
- Upm.PlanType = txt_planType.Value.ToString().Trim();
- Upm.ReqOrgName = txt_REQ_ORG.Text.Trim();
- Upm.ReqOrgId = req_org_id;
- Upm.WorkShop = txt_WorkShop.Text.ToString().Trim();
- Upm.ItemClass = txt_ItemClass.Value.ToString().Trim();
- Upm.ApplyName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Upm.ApplyTime = DateTime.Now;
- Upm.ApplyReqOrgId = UserInfo.GetDeptid();
- Upm.ApplyReqOrgName = UserInfo.GetDepartment();
- Upm.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Upm.CreateTime = DateTime.Now;
- Upm.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- Upm.DeliveryLocationCode = txt_selectlocationCode.Text.Trim();
- Upm.DeliveryLocation = txt_selectlocation.Text.Trim();
- CoreResult crt = this.GetJsonService().execute<CoreResult>("com.hnshituo.pur.requireplan.service.UsePlanMService", "insert_M", new object[] { Upm});
- if (crt.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("领用单头生成失败!" + crt.Resultmsg);
- return;
- }
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("生成领用单:" + crt.Resultmsg);
- this.tips = "1";
- mrId = crt.Resultmsg;
- this.Close();
- }
- 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;
- if (!String.IsNullOrEmpty(strdeptId) && !String.IsNullOrEmpty(strDeptName))
- {
- txt_REQ_ORG.Text = strDeptName;
- req_org_id = strdeptId;
- }
- }
- private void txt_selectlocation_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- FrmPop_upDeliveryLocation frm = new FrmPop_upDeliveryLocation(this.ob, "0", "");
- frm.ShowDialog();
- if (frm.tips == "1")
- {
- if (!String.IsNullOrEmpty(frm.DeliveryLocationCode) && !String.IsNullOrEmpty(frm.DeliveryLocation))
- {
- txt_selectlocationCode.Text = frm.DeliveryLocationCode;
- txt_selectlocation.Text = frm.DeliveryLocation;
- }
- }
- }
- }
- }
|