| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952 |
- 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 CoreFS.CA06;using Pur.Entity;
- using Pur.Entity.ck;
- using Pur.require_plan;
- using Pur.Entity.configureEntity;
- using Core.Mes.Client.Comm.Control;
- using com.hnshituo.pur.vo;
- using Pur.configure;
- using Infragistics.Win;
- using Pur.PublicTools;
- using Infragistics.Win.UltraWinGrid;
- using Pur.Pop_upWindow;
- using Core.Mes.Client.Comm.Tool;
- using System.Collections;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm;
- namespace Pur.ck
- {
- public partial class FrmCkStorage : FrmPmsBase
- {
- public FrmCkStorage()
- {
- InitializeComponent();
- txt_createTimeE.Value = System.DateTime.Now;
- txt_createTimeS.Value = ((DateTime)txt_createTimeE.Value).AddMonths(-1);
- //ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- }
- //菜单按钮事件
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- if (ultraTabControl2.SelectedTab.Key == "0")
- {
- GetPUR_CK_STORAGE();
- }
- else
- {
- getPur_Ck_StorageSuorce();
- }
- break;
- case "Add":
- addCkInBill();
- break;
- case "cockInv":
- cockInv();
- break;
- case "unCockInv":
- unCockInv();
- break;
- case "MovingInvPhy":
- MovingInvPhy();
- break;
- case "CanCelMovingInvPhy":
- CanCelMovingInvPhy();
- break;
- case "Print":
- doPrint("0");
- break;
- case "overPrint":
- doPrint("1");
- break;
- case "CanCelPrint":
- CanCelPrint();
- break;
- case "doexport":
- doexport();
- break;
- case "doSaveMemo":
- doSaveMemo();
- break;
- }
- }
- public void doexport()
- {
- if (ultraTabControl2.ActiveTab.Key == "0")
- GridHelper.ulGridToExcel(ultraGrid1, ultraGrid1.Text);
- else
- GridHelper.ulGridToExcel(ultraGrid5, ultraGrid5.Text);
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void GetPUR_CK_STORAGE()
- {
- dataTable2.Rows.Clear();
- dataTable3.Rows.Clear();
- CkStorage CkSto = new CkStorage();
- CkSto.InvId = txt_InvId.Text;
- CkSto.ItemCode = txt_itemCode.Text;
- CkSto.ItemName = txt_itemName.Text;
- if (txt_invBin.Value != null)
- {
- CkSto.DeleteName = txt_invBin.Text;
- }
- //CkSto.InvLogic = txt_invLogic.Text;
- if (txt_invPhysic.Value != null)
- {
- CkSto.DeleteUserid = txt_invPhysic.Text;
- }
- CkSto.SuppName = txt_suppName.Text;
- CkSto.OrderId = txt_orderId.Text;
- CkSto.InStockNo = txt_inStockNo.Text;
- CkSto.InvQty = Convert.ToDouble(txt_invOrigQty.Value);
- CkSto.CreateName = txtItemClass.Text;
-
- if (!string.IsNullOrEmpty(txt_createTimeS.Text) && !string.IsNullOrEmpty(txt_createTimeE.Text))
- {
- CkSto.CreateTime = Convert.ToDateTime(txt_createTimeS.Text);
- CkSto.UpdateTime = Convert.ToDateTime(txt_createTimeE.Text).AddDays(1);
- }
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStorageService", "find_Storage", new object[] { CkSto });
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- //publicPms.autoGridColumnWSize(ultraGrid1.DisplayLayout.Bands[0]);
- getBindInvPhySic();
- getBindInvPhySicPos();
- txt_invPhysic.Text = CkSto.DeleteUserid;
- txt_invBin.Text = CkSto.DeleteName;
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- //标记待检状态入库单
- if (ugr.Cells["USESTATUS"].Value.ToString() == "不可用")
- {
- ugr.Cells["USESTATUS"].Appearance.ForeColor = Color.Red;// System.Drawing.Color.FromArgb(255, 128, 0);
- ugr.Cells["STATUS"].Appearance.ForeColor = Color.Red;// System.Drawing.Color.FromArgb(255, 128, 0);
- }
- else
- {
- ugr.Cells["USESTATUS"].Appearance.ForeColor = Color.Black;
- ugr.Cells["STATUS"].Appearance.ForeColor = Color.Black;// System.Drawing.Color.FromArgb(255, 128, 0);
- }
- }
- }
- /// <summary>
- /// 获取移库记录
- /// </summary>
- private void getPur_Ck_StorageSuorce()
- {
- //dataTable7.Rows.Clear();
- //CkStorage CkSto = new CkStorage();
- //CkSto.InvId = txt_InvId.Text;
- //CkSto.ItemCode = txt_itemCode.Text;
- //CkSto.ItemName = txt_itemName.Text;
- //if (txt_invBin.Value != null)
- //{
- // CkSto.DeleteName = txt_invBin.Text;
- //}
- ////CkSto.InvLogic = txt_invLogic.Text;
- //if (txt_invPhysic.Value != null)
- //{
- // CkSto.DeleteUserid = txt_invPhysic.Text;
- //}
- //CkSto.SuppName = txt_suppName.Text;
- //CkSto.OrderId = txt_orderId.Text;
- //CkSto.InStockNo = txt_inStockNo.Text;
- //CkSto.InvQty = Convert.ToDouble(txt_invOrigQty.Value);
- //if (!string.IsNullOrEmpty(txt_createTimeS.Text) && !string.IsNullOrEmpty(txt_createTimeE.Text))
- //{
- // CkSto.CreateTime = Convert.ToDateTime(txt_createTimeS.Text);
- // CkSto.UpdateTime = Convert.ToDateTime(txt_createTimeE.Text).AddDays(1);
- //}
- ////查询源移库记录
- //CkSto.Status = "11";
- //DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStorageService", "find_Storage", new object[] { CkSto });
- //GridHelper.CopyDataToDatatable(dt, dataTable4, true);
- //GridHelper.RefreshAndAutoSize(ultraGrid2);
- dataTable6.Rows.Clear();
- CkStorage CkSto = new CkStorage();
- CkSto.InvId = txt_InvId.Text;
- CkSto.ItemCode = txt_itemCode.Text;
- CkSto.ItemName = txt_itemName.Text;
- if (txt_invBin.Value != null)
- {
- CkSto.DeleteName = txt_invBin.Text;
- }
- //CkSto.InvLogic = txt_invLogic.Text;
- if (txt_invPhysic.Value != null)
- {
- CkSto.DeleteUserid = txt_invPhysic.Text;
- }
- CkSto.SuppName = txt_suppName.Text;
- CkSto.OrderId = txt_orderId.Text;
- CkSto.InStockNo = txt_inStockNo.Text;
- CkSto.InvQty = Convert.ToDouble(txt_invOrigQty.Value);
- if (!string.IsNullOrEmpty(txt_createTimeS.Text) && !string.IsNullOrEmpty(txt_createTimeE.Text))
- {
- CkSto.CreateTime = Convert.ToDateTime(txt_createTimeS.Text);
- CkSto.UpdateTime = Convert.ToDateTime(txt_createTimeE.Text).AddDays(1);
- }
- CkSto.CreateName = txtItemClass.Text;
- CkSto.PrintNo = utPrintNo.Text.Trim();
- //查询源移库记录
- //CkSto.Status = "11";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStorageUseService", "getCk_YK", new object[] { CkSto });
- GridHelper.CopyDataToDatatable(dt, dataTable6, true);
- GridHelper.RefreshAndAutoSize(ultraGrid5);
- }
- /// <summary>
- /// 解冻库存
- /// </summary>
- private void unCockInv()
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- CkStorage ck = new CkStorage();
- ck.InvId = ugr.Cells["InvId"].Value.ToString();
- ck.UseStatus = "1";
- if (MessageUtil.ShowYesNoAndQuestion("确定解冻库存【" + ck.InvId + "】?").Equals(DialogResult.No))
- {
- return;
- }
- CoreResult re1 = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageService", "doUpdate", new object[] { ck });
- if (re1.Resultcode == -1)
- {
- MessageBox.Show("解冻失败:" + re1.Resultmsg, "");
- return;
- }
- MessageBox.Show("解冻成功!");
- GetPUR_CK_STORAGE();
- getPur_Ck_StorageSuorce();
- }
- /// <summary>
- /// 冻结库存
- /// </summary>
- private void cockInv()
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- CkStorage ck = new CkStorage();
- ck.InvId = ugr.Cells["InvId"].Value.ToString();
- ck.UseStatus = "0";
- if (MessageUtil.ShowYesNoAndQuestion("确定冻结库存【" + ck.InvId + "】?").Equals(DialogResult.No))
- {
- return;
- }
- CoreResult re1 = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageService", "doUpdate", new object[] { ck });
- if (re1.Resultcode == -1)
- {
- MessageBox.Show("冻结失败:" + re1.Resultmsg, "");
- return;
- }
- MessageBox.Show("冻结成功!");
- GetPUR_CK_STORAGE();
- getPur_Ck_StorageSuorce();
- }
- /// <summary>
- /// 新增入库操作
- /// </summary>
- private void addCkInBill()
- {
- PopFrmCkInBill frm = new PopFrmCkInBill(this.ob);
- frm.ShowDialog();
- }
- /// <summary>
- /// 物料弹窗
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_itemCode_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- FrmPurPlanMat mat = new FrmPurPlanMat(this.ob);
- mat.ShowDialog();
- if (mat.getItemCode() != null)
- {
- txt_itemCode.Text = mat.getItemCode().ToString();
- txt_itemName.Text = mat.getItemName().ToString();
- }
- }
- /// <summary>
- /// 界面加载,库区下拉框加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void PurCkStorage_Load(object sender, EventArgs e)
- {
- //加载成本中心
- DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1230" }, this.ob);
- if (dt1.Rows.Count > 0)
- {
- dt1.DefaultView.Sort = "BASENAME";
- dt1 = dt1.DefaultView.ToTable();
- }
- publicPms.FilComboboxAdd(txt_Dept1, dt1, "baseCode", "baseName", "validflag NOT in ('0')", false, "/", "");
- txt_createTimeS.Text = DateTime.Now.AddMonths(-1).ToString();
- txt_invOrigQty.Value = 2;
- //获取
- PurCkInBillEntity CkInBillEntity = new PurCkInBillEntity();
- DataTable dt_GropByItem = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkInBillService", "GetCkInBill_GropByItem", new object[] { CkInBillEntity });
- comm.FilComboboxAdd(txtItemClass, dt_GropByItem, "basecode", "basename", "", true, "", "");
- //LogicWareHouseEntity lhouse = new LogicWareHouseEntity();
- //lhouse.Validflag = "1";
- //DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.LogicSeatService", "getLogicSeat", new object[] { lhouse, 0, 0 });
- //if (dt.Rows.Count > 0)
- //{
- // txt_invLogic.DataSource = dt;
- // this.txt_invLogic.DisplayMember = "invLogicName";
- // this.txt_invLogic.ValueMember = "invLogic";
- //}
- //PhysicSeatEntity Phouse = new PhysicSeatEntity();
- //Phouse.Validflag = "1";
- //DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatService", "getActualSeat", new object[] { Phouse, 0, 0 });
- //if (dt1.Rows.Count > 0)
- //{
- // txt_invPhysic.DataSource = dt1;
- // this.txt_invPhysic.DisplayMember = "invPhysicName";
- // this.txt_invPhysic.ValueMember = "invPhysic";
- //}
- //ActualSeatPosEntity PosEntity = new ActualSeatPosEntity();
- //PosEntity.Validflag = "1";
- //DataTable dt3 = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatPosService", "find", new object[] { PosEntity, 0, 0 });
- //if (dt3.Rows.Count > 0)
- //{
- // txt_invBin.DataSource = dt3;
- // this.txt_invBin.DisplayMember = "invPosName";
- // this.txt_invBin.ValueMember = "invPos";
- //}
- ValueListItem[] item1 = new ValueListItem[] {
- new ValueListItem("0", "待确认"),
- new ValueListItem("1", "已确认"),
- };
- ValueList valueList1 = new ValueList();
- valueList1.ValueListItems.AddRange(item1);
- ultraGrid5.DisplayLayout.Bands[0].Columns["confirmStatus"].ValueList = valueList1;
- ValueListItem[] item2 = new ValueListItem[] {
- new ValueListItem("0", "未打印"),
- new ValueListItem("1", "已打印"),};
- ValueList valueList2 = new ValueList();
- valueList2.ValueListItems.AddRange(item2);
- ultraGrid5.DisplayLayout.Bands[0].Columns["printType"].ValueList = valueList2;
-
- GridHelper.SetExcludeColumnsActive(ultraGrid5.DisplayLayout.Bands[0], "Check","MEMO");
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], "Check", "MoveQtyKC", "MoveQty");
- ultraExpandableGroupBox2.Expanded = true;
- //GetPUR_CK_STORAGE();
- }
- /// <summary>
- /// 供应商弹窗
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_suppName_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- Supp Sp = new Supp();
- Sp.Validflag = "1";
- //DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppService", "find", new object[] {Sp,0,0 });
- frmSuppSel Sky = new frmSuppSel(this.ob);
- Sky.ShowDialog();
- if (Sky.strSUPP_CODE == null)
- return;
- txt_suppName.Text = Sky.strSUPP_NAME.ToString();
- //Supp_Code = Sky.strSUPP_CODE.ToString();
- }
- /// <summary>
- /// 激活库存表
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- //GetPUR_CK_STORAGE_USE();
- //GetPUR_CK_STORAGE_POS();
- }
- /// <summary>
- /// 保存备注
- /// </summary>
- private void doSaveMemo()
- {
- List<UltraGridRow> rows = ComHelper.UltraGridGetOtherRows(ultraGrid5, "Check");
- if (rows.Count <= 0)
- {
- MessageUtil.ShowTips("请勾选需要填写的记录");
- return;
- }
- if (!MessageUtil.ShowYesNoQuestion("确定保存当前记录?"))
- return;
- List<PurCkStorageUseEntity> list = new List<PurCkStorageUseEntity>();
- foreach (UltraGridRow row in rows)
- {
- PurCkStorageUseEntity ckuse = new PurCkStorageUseEntity();
- ckuse.Id = row.Cells["Id"].Value.ToString();
- ckuse.Memo = row.Cells["MEMO"].Value.ToString();
- list.Add(ckuse);
- }
- CoreResult re1 = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageUseService", "doSaveMemo", new object[] { list });
- if (re1.Resultcode == -1)
- {
- MessageBox.Show("保存失败:" + re1.Resultmsg, "");
- return;
- }
- MessageBox.Show("保存成功!");
- GetPUR_CK_STORAGE_USE();
- }
- /// <summary>
- /// 查询库存使用表
- /// </summary>
- private void GetPUR_CK_STORAGE_USE()
- {
- if (ultraGrid1.ActiveRow != null)
- {
- PurCkStorageUseEntity CkStorageUseEntity = new PurCkStorageUseEntity();
- CkStorageUseEntity.InvId = ultraGrid1.ActiveRow.Cells["INVID"].Value.ToString();
- CkStorageUseEntity.Validflag = "1";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStorageUseService", "find", new object[] { CkStorageUseEntity, 0, 0 });
- //按创建时间降序
- if (dt.Rows.Count > 1)
- {
- dt.DefaultView.Sort = "CREATETIME DESC";
- dt = dt.DefaultView.ToTable();
- }
- GridHelper.CopyDataToDatatable(dt, dataTable3, true);
- }
- }
- /// <summary>
- /// 查询库存库位
- /// </summary>
- private void GetPUR_CK_STORAGE_POS()
- {
- if (ultraGrid1.ActiveRow != null)
- {
- PurCkStoragePosEntity CkStoragePosEntity = new PurCkStoragePosEntity();
- CkStoragePosEntity.InvId = ultraGrid1.ActiveRow.Cells["INVID"].Value.ToString();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStoragePosService", "getCkStoragePos_ByInvId", new object[] { CkStoragePosEntity });
- //按创建时间降序
- if (dt.Rows.Count > 1)
- {
- dt.DefaultView.Sort = "CREATETIME DESC";
- dt = dt.DefaultView.ToTable();
- }
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- }
- //publicPms.autoGridColumnWSize(ultraGrid2.DisplayLayout.Bands[0]);
- }
- /// <summary>
- /// 查询库存中的库区分组
- /// </summary>
- private void getBindInvPhySic()
- {
- CkStorage CkSto = new CkStorage();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStorageService", "GetCkStorage_GropByInvPhisc", new object[] { CkSto });
- comm.setUltraComboEditorBind(txt_invPhysic, dt, "itemName", "itemCode");
- }
- /// <summary>
- /// 查询库存中的库位分组
- /// </summary>
- private void getBindInvPhySicPos()
- {
- CkStorage CkSto = new CkStorage();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStorageService", "GetCkStorage_GropByInvPos", new object[] { CkSto });
- dt = comm.getDtGroupBy_reDt(dt, "itemName");
- comm.setUltraComboEditorBind(txt_invBin, dt, "itemName", "itemCode");
- }
- /// <summary>
- /// 勾选库存记录
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- object o = e.Cell.Value;
- ultraGrid1.UpdateData();
- //UltraGridRow[] ugrs = GridHelper.GetRowsWithKey(ultraGrid1, new string[] { "Check" }, new string[] { e.Cell.Value.ToString()});
- //判断库区是否全相同
- //UltraGridRow[] ugrsPhysic = GridHelper.GetRowsWithKey(ultraGrid1, new string[] { "Check","invPhysic" }, new string[] { e.Cell.Value.ToString(),e.Cell.Row.Cells["invPhysic"].Value.ToString() });
- //判断库位是否全相同
- //UltraGridRow[] ugrsPhysicPos = GridHelper.GetRowsWithKey(ultraGrid1, new string[] { "Check", "invPos" }, new string[] { e.Cell.Value.ToString(), e.Cell.Row.Cells["invPos"].Value.ToString() });
- if (e.Cell.Column.Key == "MoveQtyKC")
- {
- double bMoveQtyKC = 0;
- double.TryParse(e.Cell.Row.Cells["MoveQtyKC"].Value.ToString(), out bMoveQtyKC);
- double bINVQTYWEIGHT = 0;
- double.TryParse(e.Cell.Row.Cells["INVQTYWEIGHT"].Value.ToString(), out bINVQTYWEIGHT);
- double bITEMUOMCONEFFICIENT = 0;
- double.TryParse(e.Cell.Row.Cells["ITEMUOMCONEFFICIENT"].Value.ToString(), out bITEMUOMCONEFFICIENT);
- if (bMoveQtyKC > bINVQTYWEIGHT)
- {
- MessageUtil.ShowTips("移库数量不能>库存数量");
- e.Cell.Value = o;
- return;
- }
- else
- {
- if (e.Cell.Row.Cells["itemUom"].Value.ToString() == "基吨")
- {
- e.Cell.Row.Cells["MoveQty"].Value = Math.Round(bMoveQtyKC * bITEMUOMCONEFFICIENT, 3);
- }
- else
- {
- e.Cell.Row.Cells["MoveQty"].Value = Math.Round(bMoveQtyKC / bITEMUOMCONEFFICIENT, 3);
- }
- }
- }
- if (e.Cell.Column.Key == "MoveQty")
- {
- double bMoveQty = 0;
- double.TryParse(e.Cell.Row.Cells["MoveQty"].Value.ToString(), out bMoveQty);
- double bINVQTY = 0;
- double.TryParse(e.Cell.Row.Cells["INVQTY"].Value.ToString(), out bINVQTY);
- double bITEMUOMCONEFFICIENT = 0;
- double.TryParse(e.Cell.Row.Cells["ITEMUOMCONEFFICIENT"].Value.ToString(), out bITEMUOMCONEFFICIENT);
- if (bMoveQty > bINVQTY)
- {
- MessageUtil.ShowTips("移库数量不能>采购数量");
- e.Cell.Value = o;
- return;
- }
- else
- {
- if (e.Cell.Row.Cells["itemUom"].Value.ToString() == "基吨")
- {
- e.Cell.Row.Cells["MoveQtyKC"].Value = Math.Round(bMoveQty / bITEMUOMCONEFFICIENT, 3);
- }
- else
- {
- e.Cell.Row.Cells["MoveQtyKC"].Value = Math.Round(bMoveQty * bITEMUOMCONEFFICIENT, 3);
- }
- }
- }
- }
- /// <summary>
- /// 选择库区
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_PhysicNew_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- try
- {
- frmPopActualSeat pas = new frmPopActualSeat(this.ob, "0");
- pas.ShowDialog();
- txt_PhysicNew.Text = pas.DeliveryLocation;
- txt_PhysicNewCode.Text = pas.DeliveryLocationCode;
- //获取储位
- ActualSeatPosEntity aspe = new ActualSeatPosEntity();
- aspe.InvPhysic = pas.DeliveryLocationCode;
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.ActualSeatPosService", "find", new object[] { aspe, 0, 0 });
- comm.setUltraComboEditorBind(txtPhysicPosNew, dt, "INVPOSNAME", "invpos");
- }
- catch (Exception ee)
- {
- MessageUtil.ShowTips(ee.Message);
- }
- }
- /// <summary>
- /// 移库操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_MovePhysic_Click(object sender, EventArgs e)
- {
- MovingInvPhy();
- }
- /// <summary>
- /// 移库
- /// </summary>
- private void MovingInvPhy()
- {
- ultraGrid1.UpdateData();
- if (ultraTabControl2.SelectedTab.Key != "0")
- {
- MessageUtil.ShowTips("请切换tab页面到“库存记录”,再进行移库");
- return;
- }
- if (txt_PhysicNew.Text.Trim() == "")
- {
- MessageUtil.ShowTips("请选择新库区");
- return;
- }
- if (txtPhysicPosNew.Text.Trim() == "")
- {
- MessageUtil.ShowTips("请选择新库位");
- return;
- }
- if (txt_PhysicNewCode.Text.Trim() == "")
- {
- MessageUtil.ShowTips("未获取到新库区编码,请重试或联系管理员");
- return;
- }
- if (txtPhysicPosNew.Value == null || txtPhysicPosNew.Value.ToString().Trim() == "")
- {
- MessageUtil.ShowTips("未获取到新库位编码,请重试或联系管理员");
- return;
- }
- ArrayList al = new ArrayList();
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if ((bool)ugr.Cells["Check"].Value)
- {
- double bMoveQty = 0;
- //if (ugr.Cells["itemUom"].Value.ToString() == "基吨")
- //{
- // double.TryParse(ugr.Cells["MoveQtyKC"].Value.ToString(), out bMoveQty);
- //}
- //else
- //{
- // double.TryParse(ugr.Cells["MoveQty"].Value.ToString(), out bMoveQty);
- //}
- double.TryParse(ugr.Cells["MoveQtyKC"].Value.ToString(), out bMoveQty);
- CkStorage ck = new CkStorage();
- ck.InvId = ugr.Cells["InvId"].Value.ToString();
- ck.InvQty = bMoveQty;//移库数量
- if (bMoveQty <= 0)
- {
- MessageUtil.ShowTips("库存记录【" + ck.InvId + "】移库数量必须>0");
- return;
- }
- //标记待检状态入库单
- if (ugr.Cells["USESTATUS"].Value.ToString() == "不可用")
- {
- MessageUtil.ShowTips("库存记录【" + ck.InvId + "】使用状态为“不可用”,不能做移库操作");
- return;
- }
- al.Add(ck);
- }
- }
- if (al.Count < 1)
- {
- MessageUtil.ShowTips("请勾选需要移库的库存记录");
- return;
- }
- PurCkStoragePosEntity csp = new PurCkStoragePosEntity();
- csp.InvPhysic = txt_PhysicNewCode.Text;
- csp.InvPos = txtPhysicPosNew.Value.ToString().Trim();
- csp.CreateName = UserInfo.GetUserName();
- csp.CreateUserid = UserInfo.GetUserID();
- if (MessageUtil.ShowYesNoAndQuestion("确定移库?").Equals(DialogResult.No))
- {
- return;
- }
- CoreResult re1 = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageService", "MoveInvPhysic", new object[] { al, csp });
- if (re1.Resultcode == -1)
- {
- MessageBox.Show("操作失败:" + re1.Resultmsg, "");
- return;
- }
- MessageBox.Show("移库成功!");
- GetPUR_CK_STORAGE();
- getPur_Ck_StorageSuorce();
- }
- /// <summary>
- /// 撤销移库
- /// </summary>
- private void CanCelMovingInvPhy()
- {
- if (ultraTabControl2.SelectedTab.Key != "1")
- {
- MessageUtil.ShowTips("请切换tab页面到“移库记录”,再撤销移库");
- return;
- }
- List<UltraGridRow> rows = ComHelper.UltraGridGetOtherRows(ultraGrid5, "Check");
- if (rows.Count<=0)
- {
- MessageUtil.ShowTips("请勾选需要撤销的记录");
- return;
- }
- if (!MessageUtil.ShowYesNoQuestion("确定进行撤销移库操作"))
- return;
- List<CkStorage> list = new List<CkStorage>();
- foreach (UltraGridRow row in rows)
- {
- CkStorage ck = new CkStorage();
- ck.InvId = row.Cells["INVIDNEW"].Value.ToString();
- ck.InvIdSource = row.Cells["invid"].Value.ToString();
- ck.UpdateName = UserInfo.GetUserName();
- ck.UpdateUserid = UserInfo.GetUserID();
- list.Add(ck);
- }
- CoreResult re1 = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageService", "CanCelMovingInvPhy", new object[] { list });
- if (re1.Resultcode == -1)
- {
- MessageBox.Show("撤销失败:" + re1.Resultmsg, "");
- return;
- }
- MessageBox.Show("撤销成功!");
- GetPUR_CK_STORAGE();
- getPur_Ck_StorageSuorce();
- }
- /// <summary>
- /// 选择新库位
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txtPhysicPosNew_ValueChanged(object sender, EventArgs e)
- {
- //获取库位编码
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- CkStorage CkSto = new CkStorage();
- CkSto.InvIdSource = ultraGrid2.ActiveRow.Cells["InvId"].Value.ToString();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.ck.service.CkStorageService", "find_Storage", new object[] { CkSto });
- GridHelper.CopyDataToDatatable(dt, dataTable7, true);
- GridHelper.RefreshAndAutoSize(ultraGrid4);
- }
- private void doPrint(String strTips)
- {
- if (ultraTabControl2.SelectedTab.Key != "1")
- {
- MessageUtil.ShowTips("请切换tab页面到“移库记录”,再进行打印操作");
- return;
- }
- List<UltraGridRow> rows = ComHelper.UltraGridGetOtherRows(ultraGrid5, "Check");
- if (rows.Count <= 0)
- {
- MessageUtil.ShowTips("请勾选需要打印的记录");
- return;
- }
- List<CkStorage> al = new List<CkStorage>();//打印出库单清单
- String strUrlPort = "http://172.54.10.42:8080";//报表系统IP
- String[] str = strUrlPort.Split(':');
- String strUrl = str[0] + ":" + str[1];
- String isAll_print = "0";//是否汇总打印
- //汇总打印
- if (!ck_single_m.Checked)
- {
- String strDeptUse = "";
- String strDept = txt_Dept1.Value == null ? "" : txt_Dept1.Value.ToString();
- if (is_JIT.Checked)
- {
- if (String.IsNullOrEmpty(strDept))
- {
- MessageUtil.ShowTips("若选择按照成本中心打印,请先指定成本中心");
- return;
- }
- strDeptUse = strDept;
- }
- //string strPrintNo = getPrintCode();
- string stroutStockno = "";
- ultraGrid1.UpdateData();
- foreach (UltraGridRow row in rows)
- {
- String invId = row.Cells["INVIDNEW"].Value.ToString();
- stroutStockno += "'" + invId + "',";
- CkStorage ck = new CkStorage();
- ck.InvId = invId;
- if (String.IsNullOrEmpty(invId))
- {
- MessageUtil.ShowTips("若单张打印的出库单号不能为空");
- return;
- }
- CkStorage ckInfo = this.execute<CkStorage>("com.hnshituo.pur.ck.service.CkStorageService", "findById", new object[] { invId });
- if (ckInfo == null)
- {
- MessageUtil.ShowTips("未发现库存号:" + invId + "信息记录");
- row.Activate();
- return;
- }
- if (!String.IsNullOrEmpty(ckInfo.PrintNo) && strTips == "0")
- {
- MessageUtil.ShowTips("库存号:" + invId + " 已打印,或请取消打印");
- row.Activate();
- return;
- }
- if (String.IsNullOrEmpty(ckInfo.PrintNo) && strTips == "1")
- {
- MessageUtil.ShowTips("库存号:" + invId + " 还未打印,或请先打印");
- row.Activate();
- return;
- }
- ck.CreateName = UserInfo.GetUserName();
- ck.CreateUserid = UserInfo.GetUserID();
- ck.CreateTime = DateTime.Now;
- //pcibEntity.PrintCode = strPrintNo;
- al.Add(ck);
- }
- stroutStockno = stroutStockno.Remove(0, 1);
- stroutStockno = stroutStockno.Remove(stroutStockno.Length - 2);
- strUrl = strUrlPort + "/webroot/decision/view/report?viewlet=rpt_InBill.cpt&op=view" + "&dept=" + strDeptUse + "&outStockNo=" + stroutStockno + "&ID=" + 1232025;
- isAll_print = "1";
- }
- //单张连打
- else
- {
- string stroutStockno = "";
- ultraGrid1.UpdateData();
- foreach (UltraGridRow row in rows)
- {
- String invId = row.Cells["INVIDNEW"].Value.ToString();
- stroutStockno += "'" + invId + "',";
- CkStorage ck = new CkStorage();
- ck.InvId = invId;
- ck.CreateName = UserInfo.GetUserName();
- ck.CreateUserid = UserInfo.GetUserID();
- ck.CreateTime = DateTime.Now;
- if (String.IsNullOrEmpty(invId))
- {
- MessageUtil.ShowTips("若单张打印的出库单号不能为空");
- return;
- }
- CkStorage ckInfo = this.execute<CkStorage>("com.hnshituo.pur.ck.service.CkStorageService", "findById", new object[] { invId });
- if (ckInfo == null)
- {
- MessageUtil.ShowTips("未发现库存号:" + invId + "信息记录");
- row.Activate();
- return;
- }
- if (!String.IsNullOrEmpty(ckInfo.PrintNo) && strTips == "0")
- {
- MessageUtil.ShowTips("库存号:" + invId + " 已打印,或请取消打印");
- row.Activate();
- return;
- }
- if (String.IsNullOrEmpty(ckInfo.PrintNo) && strTips == "1")
- {
- MessageUtil.ShowTips("库存号:" + invId + " 还未打印,或请先打印");
- row.Activate();
- return;
- }
- al.Add(ck);
- }
- stroutStockno = stroutStockno.Remove(0, 1);
- stroutStockno = stroutStockno.Remove(stroutStockno.Length - 2);
- strUrl = strUrlPort + "/webroot/decision/view/report?viewlet=rpt_InBill_single_ly_m.cpt&op=view" + "&outStockNo=" + stroutStockno + "&ID=" + 1232025;
- }
- if (strTips == "0")
- {
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageService", "doPrint", new object[] { al, isAll_print });
- if (rt.Resultcode != 0)
- {
- MessageUtil.ShowTips("生成打印编号失败:" + rt.Resultmsg);
- return;
- }
- }
- comm.printReport(this.ob, strUrl, "移库单打印");
- if (strTips == "0")
- {
- if (!MessageUtil.ShowYesNoAndQuestion("是否已打印移库单?").Equals(DialogResult.Yes))
- {
- CoreResult rt1 = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageService", "cancelPrint", new object[] { al });
- if (rt1.Resultcode != 0)
- {
- MessageUtil.ShowTips("取消标记打印失败:" + rt1.Resultmsg);
- }
- }
- }
- }
- private void CanCelPrint()
- {
- if (ultraTabControl2.SelectedTab.Key != "1")
- {
- MessageUtil.ShowTips("请切换tab页面到“移库记录”,再进行取消打印操作");
- return;
- }
- List<UltraGridRow> rows = ComHelper.UltraGridGetOtherRows(ultraGrid5, "Check");
- if (rows.Count <= 0)
- {
- MessageUtil.ShowTips("请勾选需要取消打印的记录");
- return;
- }
- List<CkStorage> list = new List<CkStorage>();
- foreach (UltraGridRow row in rows)
- {
- String invId = row.Cells["INVIDNEW"].Value.ToString();
- CkStorage ck = new CkStorage();
- ck.InvId = invId;
- ck.CreateName = UserInfo.GetUserName();
- ck.CreateUserid = UserInfo.GetUserID();
- ck.CreateTime = DateTime.Now;
- CkStorage ckInfo = this.execute<CkStorage>("com.hnshituo.pur.ck.service.CkStorageService", "findById", new object[] { invId });
- if (ckInfo == null)
- {
- MessageUtil.ShowTips("未发现库存号:" + invId + "信息记录");
- row.Activate();
- return;
- }
- if (String.IsNullOrEmpty(ckInfo.PrintNo))
- {
- MessageUtil.ShowTips("库存号:" + invId + " 还未打印,不能取消");
- row.Activate();
- return;
- }
- list.Add(ck);
- }
- CoreResult rt1 = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkStorageService", "cancelPrint", new object[] { list });
- if (rt1.Resultcode != 0)
- {
- MessageUtil.ShowTips("取消打印失败:" + rt1.Resultmsg);
- }
- }
- private void ultraTabControl2_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
- {
- if ("0".Equals(ultraTabControl2.SelectedTab.Key))
- {
- utPrintNo.Visible = false;
- ultraLabel18.Visible = false;
- ultraPanel3.Visible = false;
- }
- else
- {
- utPrintNo.Visible = true;
- ultraLabel18.Visible = true;
- ultraPanel3.Visible = true;
- }
-
- }
- }
- }
|