| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660 |
- 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.YdmBcPipeManage.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.YdmBcPipeManage.吊带
- {
- public partial class YdmBsSling : FrmBase
- {
- private string[] storageArr = null;
- public YdmBsSling()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<YdmBsStorageEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmBsLocationEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmBsSlingEntity>(ultraGrid3.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmBsSlingEntity>(ultraGrid4.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmBsSlingEntity>(ultraGrid5.DisplayLayout.Bands[0]);
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Add":
- //DoAdd();
- break;
- case "Update":
- DoUpdate();
- break;
- case "Delete":
- OutKu();
- break;
- case "Refresh":
- InsertKu();
- break;
- case "Remove":
- remove();
- break;
- case "RemoveIn":
- removeIn();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void remove()
- {
- this.ultraGrid4.UpdateData();
- YdmBsLocationEntity ydmBsLocation = null;
- foreach (UltraGridRow row in ultraGrid4.Rows)
- {
- if (row.Cells["CHK"].Value != null)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- string LocationNo = row.Cells["LocationNo"].Value.ToString();
- List<YdmBsLocationEntity> location = EntityHelper.GetData<YdmBsLocationEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryLocationNo", new object[] { LocationNo }, this.ob);
- ydmBsLocation = location[0];
- decimal sling = decimal.Parse(row.Cells["Sling"].Value.ToString());
- var template = new YdmBsLocationEntity
- {
- LocationNo = LocationNo,
- Sling = sling+ydmBsLocation.Sling
- };
- var ccp1 = new CoreClientParam();
- ccp1.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp1.MethodName = "doUpdateSling";
- ccp1.ServerParams = new object[]
- {
- JSONFormat.Format(template)
- };
- ccp1 = ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
- if (ccp1.ReturnCode == -1)
- {
- MessageUtil.ShowTips("撤销失败");
- return;
- }
- string resultNo = row.Cells["ResultNo"].Value.ToString();
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp.MethodName = "DeleteInsert";
- ccp.ServerParams = new object[]
- {
- resultNo
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowTips("撤销失败");
- return;
- }
-
- }
- }
- }
- MessageUtil.ShowTips("撤销成功");
- queryAll();
- }
- private void removeIn()
- {
- this.ultraGrid5.UpdateData();
- YdmBsSlingEntity st1 = this.ultraGrid5.ActiveRow.ListObject as YdmBsSlingEntity;
- string SlingNo = st1.SlingNo;
- YdmBsSlingEntity ydm = null;
- YdmBsLocationEntity YdmLocation = null;
- if (st1.Type == "3")
- {
- List<YdmBsSlingEntity> SlingLocation = EntityHelper.GetData<YdmBsSlingEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.QueryBySlingNo", new object[] { SlingNo }, this.ob);
-
- for (int i = 0; i <= SlingLocation.Count-1; i++)
- {
- ydm = SlingLocation[i];
- if (ydm.Type =="3")
- {
- List<YdmBsLocationEntity> location = EntityHelper.GetData<YdmBsLocationEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryLocationNo", new object[] { ydm.LocationNo }, this.ob);
- YdmLocation = location[0];
- var template = new YdmBsLocationEntity
- {
- LocationNo = ydm.LocationNo,
- Sling = YdmLocation.Sling - ydm.Sling
- };
- var ccp1 = new CoreClientParam();
- ccp1.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp1.MethodName = "doUpdateSling";
- ccp1.ServerParams = new object[]
- {
- JSONFormat.Format(template)
- };
- ccp1 = ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
- if (ccp1.ReturnCode == -1)
- {
- MessageUtil.ShowTips("撤销失败");
- return;
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp.MethodName = "DeleteInsert";
- ccp.ServerParams = new object[]
- {
- ydm.ResultNo
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowTips("撤销失败");
- return;
- }
- }
- else
- {
- var ccp2 = new CoreClientParam();
- ccp2.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp2.MethodName = "doUpdateFlag";
- ccp2.ServerParams = new object[]
- {
- ydm.SlingNo
- };
- ccp2 = ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- if (ccp2.ReturnCode == -1)
- {
- MessageUtil.ShowTips("撤销失败");
- return;
- }
- }
-
- }
-
- MessageUtil.ShowTips("撤销成功");
- queryAll();
- return;
- }
- else
- {
- MessageUtil.ShowTips("不是入库记录无法撤销!");
- return;
- }
- }
- private void doQuery()
- {
- string managementName = "";
- if (ultrlSection.Checked)
- {
- if (cbm_Dw.Text == "")
- {
- MessageBox.Show("请选择作业科室!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- managementName = this.cbm_Dw.Value.ToString().Trim();
- }
- }
- List<YdmBsStorageEntity> listSource = EntityHelper.GetData<YdmBsStorageEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQuery", new object[] { managementName }, this.ob);
- ydmBsStorageEntityBindingSource.DataSource = listSource;
- }
- private void OutKu()
- {
- YdmBsStorageEntity sto = this.ultraGrid1.ActiveRow.ListObject as YdmBsStorageEntity;
- this.ultraGrid2.UpdateData();
- string tagStorageNo = "";
- string tagStorageName = "";
- YdmBsLocationEntity ydmBsLocation = null;
- decimal slingNew = 0;
- string slingno = "";
- if (this.ultraComboEditor2.Text == "")
- {
- MessageUtil.ShowTips("请选择目标仓库!");
- return;
- }
- else
- {
- tagStorageNo = this.ultraComboEditor2.Value.ToString2();
- tagStorageName = this.ultraComboEditor2.Text.ToString2();
- }
- var list = new List<string>();
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (row.Cells["CHK"].Value != null)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- string LocationNo= row.Cells["LocationNo"].Value.ToString();
- List<YdmBsLocationEntity> location = EntityHelper.GetData<YdmBsLocationEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryLocationNo", new object[] { LocationNo }, this.ob);
- List<YdmBsSlingEntity> listSource = EntityHelper.GetData<YdmBsSlingEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.getSlingNo", new object[] { }, this.ob);
- slingno = listSource[0].SlingNo.ToString();
- ydmBsLocation = location[0];
-
-
-
- slingNew = decimal.Parse(row.Cells["Sling"].Value.ToString());
- if (ydmBsLocation.Sling != null)
- {
- if (ydmBsLocation.Sling == 0)
- {
- MessageUtil.ShowTips("数量为0不能出库");
- return;
- }
- if (ydmBsLocation.Sling.Value - slingNew < 0)
- {
- MessageUtil.ShowTips("出库数量为负数不能出库");
- return;
- }
- var template = new YdmBsSlingEntity
- {
- ResultNo = Guid.NewGuid().ToString(),
- SlingOld=ydmBsLocation.Sling.Value,
- SlingNew=ydmBsLocation.Sling.Value-slingNew,
- Sling = slingNew,
- LocationNo=ydmBsLocation.LocationNo,
- LocationName=ydmBsLocation.LocationName,
- CreateName=this.UserInfo.GetUserName(),
- StorageNo = sto.StorageNo,
- StorageName = sto.StorageName,
- TarStorageNo = tagStorageNo,
- TarStorageName = tagStorageName,
- SlingNo=slingno
- };
- list.Add(JSONFormat.Format(template));
- }
- else
- {
- MessageUtil.ShowTips("没有数量不能出库");
- return;
- }
- }
- }
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp.MethodName = "addSlingOut";
- ccp.ServerParams = new object[]
- {
- list
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowTips("出库失败");
- return;
- }
- var tem = new YdmBsLocationEntity
- {
- LocationNo = ydmBsLocation.LocationNo,
- Sling = ydmBsLocation.Sling.Value - slingNew
- };
- var ccp2 = new CoreClientParam();
- ccp2.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp2.MethodName = "doUpdateSling";
- ccp2.ServerParams = new object[]
- {
- JSONFormat.Format(tem)
- };
- ccp2 = ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- if (ccp2.ReturnCode == -1)
- {
- MessageUtil.ShowTips("出库失败");
- return;
- }else {
- MessageUtil.ShowTips("出库成功");
- }
- queryAll();
-
- }
- private void InsertKu()
- {
- YdmBsStorageEntity sto = this.ultraGrid1.ActiveRow.ListObject as YdmBsStorageEntity;
- this.ultraGrid2.UpdateData();
- this.ultraGrid5.UpdateData();
- YdmBsSlingEntity st1 = this.ultraGrid5.ActiveRow.ListObject as YdmBsSlingEntity;
- YdmBsLocationEntity ydmBsLocation = null;
- decimal slingNew = 0;
- decimal sling = 0;
- var list = new List<string>();
- if (st1.Type != "3")
- {
- if (st1.Flag != null)
- {
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (row.Cells["CHK"].Value != null)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- string LocationNo = row.Cells["LocationNo"].Value.ToString();
- List<YdmBsLocationEntity> location = EntityHelper.GetData<YdmBsLocationEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryLocationNo", new object[] { LocationNo }, this.ob);
- ydmBsLocation = location[0];
- if (ydmBsLocation.Sling == null)
- {
- ydmBsLocation.Sling = 0;
- }
- slingNew = decimal.Parse(row.Cells["Sling"].Value.ToString());
-
- if (ydmBsLocation.Sling != null)
- {
- var template = new YdmBsSlingEntity
- {
- ResultNo = Guid.NewGuid().ToString(),
- SlingOld = ydmBsLocation.Sling.Value,
- SlingNew = ydmBsLocation.Sling.Value + slingNew,
- Sling = slingNew,
- LocationNo = ydmBsLocation.LocationNo,
- LocationName = ydmBsLocation.LocationName,
- CreateName = this.UserInfo.GetUserName(),
- StorageNo = sto.StorageNo,
- StorageName = sto.StorageName,
- SlingNo = st1.SlingNo
- };
- sling = st1.Sling.Value;
- if (sling - slingNew >= 0)
- {
- st1.Sling = sling - slingNew;
- list.Add(JSONFormat.Format(template));
- }
- else
- {
- MessageUtil.ShowTips("请重新分配吊带!");
- return;
- }
- var tem = new YdmBsLocationEntity
- {
- LocationNo = ydmBsLocation.LocationNo,
- Sling = ydmBsLocation.Sling.Value + slingNew
- };
- var ccp2 = new CoreClientParam();
- ccp2.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp2.MethodName = "doUpdateSling";
- ccp2.ServerParams = new object[]
- {
- JSONFormat.Format(tem)
- };
- ccp2 = ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- if (ccp2.ReturnCode == -1)
- {
- MessageUtil.ShowTips("入库失败");
- return;
- }
- }
-
- }
- }
- }
- }
- else
- {
- MessageUtil.ShowTips("已经入库无法再次入库!");
- return;
- }
- }
- else
- {
- MessageUtil.ShowTips("入库记录无法入库!");
- return;
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp.MethodName = "addSlingInsert";
- ccp.ServerParams = new object[]
- {
- list
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
-
- MessageUtil.ShowTips("入库失败");
- return;
- }
- var ccp3 = new CoreClientParam();
- ccp3.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp3.MethodName = "doUpdateInsertFlag";
- ccp3.ServerParams = new object[]
- {
- st1.ResultNo
- };
- ccp3 = ExecuteNonQuery(ccp3, CoreInvokeType.Internal);
- if (ccp3.ReturnCode == -1)
- {
- MessageUtil.ShowTips("入库失败");
- return;
- }
- else
- {
- MessageUtil.ShowTips("入库成功");
- }
- queryAll();
-
- }
-
- private void DoUpdate()
- {
- YdmBsStorageEntity sto = this.ultraGrid1.ActiveRow.ListObject as YdmBsStorageEntity;
- this.ultraGrid2.UpdateData();
- decimal slingOld = 0;
- decimal slingNew = 0;
- decimal sling = 0;
- string storageno = "";
- string storagename = "";
- string slingno = "";
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (row.Cells["CHK"].Value != null)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- YdmBsLocationEntity upg = this.ultraGrid2.ActiveRow.ListObject as YdmBsLocationEntity;
- List<YdmBsLocationEntity> location = EntityHelper.GetData<YdmBsLocationEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryLocationNo", new object[] { upg.LocationNo }, this.ob);
- if (upg.Sling != null)
- {
- if (location[0].Sling!= null)
- {
- slingOld = location[0].Sling.Value;
- }
- }
- if (upg.Sling != null)
- {
- sling = upg.Sling.Value;
- }
- var tem = new YdmBsLocationEntity
- {
- LocationNo = upg.LocationNo,
- Sling = sling
- };
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer";
- ccp.MethodName = "doUpdateSling";
- ccp.ServerParams = new object[]
- {
- JSONFormat.Format(tem)
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- string locationname = upg.LocationName;
- string locationNo = upg.LocationNo;
- if (upg.Sling != null)
- {
- slingNew = upg.Sling.Value;
- }
- sling = slingNew-slingOld ;
- storageno = sto.StorageNo;
- storagename = sto.StorageName;
- List<YdmBsSlingEntity> listSource = EntityHelper.GetData<YdmBsSlingEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.getSlingNo", new object[] { }, this.ob);
- slingno = listSource[0].SlingNo.ToString();
- var template = new YdmBsSlingEntity
- {
- ResultNo = Guid.NewGuid().ToString(),
- SlingOld = slingOld,
- SlingNew = slingNew,
- Sling = sling,
- StorageNo = storageno,
- StorageName = storagename,
- LocationNo = locationNo,
- LocationName = locationname,
- CreateName = this.UserInfo.GetUserName(),
- SlingNo = slingno
- };
- var ccp2 = new CoreClientParam
- {
- ServerName = "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer",
- MethodName = "addSlingNull",
- ServerParams = new object[]
- {
- JSONFormat.Format(template)
- }
- };
- ccp2 = ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- if (ccp2.ReturnCode == -1)
- {
- MessageUtil.ShowTips("维护失败");
- return;
- }
- else
- {
- MessageUtil.ShowTips("维护成功!");
- }
- }
- }
- }
- queryAll();
- }
- private void getStoreAll()
- {
- //DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmFilpOutStorage.getStoreAll", new object[] { storageArr }, this.ob);
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.getStoreAll", new object[] { storageArr }, this.ob);
- if (dt.Rows.Count > 0)
- {
- ultraComboEditor2.DataSource = dt;
- ultraComboEditor2.DisplayMember = "STORAGE_NAME";
- ultraComboEditor2.ValueMember = "STORAGE_NO";
- }
- }
- private void frmLocationDefine_Load(object sender, EventArgs e)
- {
- //InitGrid2();
- //QueryTree();
- //getDepartMent();
- cbm_Dw.Enabled = false;
- YdmBaseClass.InitSection(cbm_Dw, this.ValidDataPurviewIds, this.ob);
- storageArr = WarehousePermissionsStore11(this.ValidDataPurviewIds, ob);
- getStoreAll();
- }
- public static string[] WarehousePermissionsStore11(String[] validDataPurviewIds, OpeBase ob)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.getWarehousePermissionsStore", new object[] { validDataPurviewIds }, ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- string[] storages = new string[dt.Rows.Count];
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- storages[i] = dt.Rows[i]["STORAGE_NO"].ToString();
- }
- return storages;
- }
- else
- {
- return new string[1] { "" };
- }
- }
- private void ultrlSection_CheckedChanged(object sender, EventArgs e)
- {
- cbm_Dw.Enabled = this.ultrlSection.Checked;
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- queryAll();
- }
- private void queryAll()
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- string managementName = ultraGrid1.ActiveRow.Cells["MANAGEMENTNAME"].Value.ToString();
- string storgeNo = ultraGrid1.ActiveRow.Cells["STORAGENO"].Value.ToString();
- List<YdmBsLocationEntity> listSource = EntityHelper.GetData<YdmBsLocationEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQuerySling", new object[] { managementName }, this.ob);
- ydmBsLocationEntityBindingSource.DataSource = listSource;
- List<YdmBsSlingEntity> listSource1 = EntityHelper.GetData<YdmBsSlingEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryYdm", new object[] { storgeNo }, this.ob);
- ydmBsSlingEntityBindingSource.DataSource = listSource1;
- List<YdmBsSlingEntity> listSource2 = EntityHelper.GetData<YdmBsSlingEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryOut", new object[] { storgeNo }, this.ob);
- ydmBsSlingEntityBindingSource1.DataSource = listSource2;
- List<YdmBsSlingEntity> listSource3 = EntityHelper.GetData<YdmBsSlingEntity>(
- "com.steering.pss.ydm.Stuffmanage.YdmBsSlingServer.doQueryInsert", new object[] { storgeNo }, this.ob);
- ydmBsSlingEntityBindingSource2.DataSource = listSource3;
- }
-
- }
- }
|