| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- 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 Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm;
- using Pur.Entity.configureEntity;
- using Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using Pur.Entity.pur_orderEntiy;
- using Pur.configure;
- using Pur.Pop_upWindow;
- using Pur.require_plan;
- using Core.Mes.Client.Comm.Tool;
- using com.hnshituo.pur.vo;
- using Pur.Entity.ck;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win;
- namespace Pur.ck
- {
- public partial class PopFrmCkInBill : FrmPmsBase
- {
- public PopFrmCkInBill(OpeBase ob)
- {
- InitializeComponent();
- this.ob = ob;
- }
- public PopFrmCkInBill(OpeBase ob, DataTable dt)
- {
- InitializeComponent();
- this.ob = ob;
- //GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], "INVINQTY");
- //按创建时间降序
- dt.DefaultView.Sort = "CREATETIME DESC";
- dt = dt.DefaultView.ToTable();
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- ultraGrid1.Rows[i].Cells["InvInQty"].Value = ultraGrid1.Rows[i].Cells["RECQTY"].Value;
- }
- }
- //菜单单击事件
- private void barsManagerButon_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key.ToString())
- {
- case "Query":
- {
- }
- break;
- case "conFirmation":
- {
- AddCkInBill();
- this.Close();
- }
- break;
- case "ESC":
- {
- this.Close();
- }
- break;
- }
- }
- /// <summary>
- /// ultraGrid1激活行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
-
- }
- /// <summary>
- /// 初始化界面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void PopFrmCkInBill_Load(object sender, EventArgs e)
- {
- getRecAndStorage();
- }
- /// <summary>
- /// 查询收货单和库存关联表
- /// </summary>
- private void getRecAndStorage()
- {
- DataTable dt= this.execute<DataTable>("com.hnshituo.pur.ck.service.CkInBillService", "getRecAndStorage", new object[] { });
- ultraGrid1.DataSource = dt;
- }
- /// <summary>
- /// 入库
- /// </summary>
- private void AddCkInBill()
- {
- ultraGrid1.UpdateData();
- ArrayList al_CkInBillEntity = new ArrayList();//入库单表
- ArrayList al_CkStorageEntity = new ArrayList();//库存表
- ArrayList al_CkStatisticsEntity = new ArrayList();
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- PurCkRecBillEntity CkRecBillEntity = this.execute<PurCkRecBillEntity>("com.hnshituo.pur.ck.service.CkRecBillService", "findById", new object[] { ultraGrid1.Rows[i].Cells["RECID"].Value.ToString() });
- PurCkInBillEntity CkInBillEntity = new PurCkInBillEntity();//入库
- CkInBillEntity = EntityHelper.CopyEntity<PurCkInBillEntity>(CkRecBillEntity);//复制合同行号中相同的字段值
- CkInBillEntity.InvPos = CkRecBillEntity.TempPos;//临时库位赋值给库区储位
- CkInBillEntity.Status = "1";
- CkInBillEntity.Validflag = "1";
- if (ultraGrid1.Rows[i].Cells["INVINQTY"].Value.ToString().Trim() != "")
- {
- CkInBillEntity.InNum = double.Parse(ultraGrid1.Rows[i].Cells["INVINQTY"].Value.ToString());//入库量
- }
- else
- {
- MessageUtil.ShowTips("入库量不能为空");
- return;
- }
- CkInBillEntity.CreateUserid = UserInfo.GetUserID();
- CkInBillEntity.CreateName = UserInfo.GetUserName();
- CkInBillEntity.UpdateName = null;
- CkInBillEntity.UpdateUserid = null;
- CkInBillEntity.UpdateTime = null;
- al_CkInBillEntity.Add(CkInBillEntity);
- CkStorage CkStorageEntity = new CkStorage();//库存表
- CkStorageEntity = EntityHelper.CopyEntity<CkStorage>(CkRecBillEntity);//复制合同行号中相同的字段值
- CkStorageEntity = EntityHelper.CopyEntity<CkStorage>(CkInBillEntity);//复制合同行号中相同的字段值
- //CkStorageEntity.InvPos = CkInBillEntity.InvPos;
- CkStorageEntity.Validflag = "1";
- CkStorageEntity.CreateUserid = UserInfo.GetUserID();
- CkStorageEntity.CreateName = UserInfo.GetUserName();
- CkStorageEntity.UpdateName = null;
- CkStorageEntity.UpdateUserid = null;
- CkStorageEntity.UpdateTime = null;
- al_CkStorageEntity.Add(CkStorageEntity);
- CkStatistics CkStatisticsEntity = new CkStatistics();//库存收发存表
- CkStatisticsEntity = EntityHelper.CopyEntity<CkStatistics>(CkRecBillEntity);//复制合同行号中相同的字段值
- CkStatisticsEntity.Validflag = "1";
- CkStatisticsEntity.CreateUserid = UserInfo.GetUserID();
- CkStatisticsEntity.CreateName = UserInfo.GetUserName();
- CkStatisticsEntity.UpdateName = null;
- CkStatisticsEntity.UpdateUserid = null;
- CkStatisticsEntity.UpdateTime = null;
- if (ultraGrid1.Rows[i].Cells["INVINQTY"].Value.ToString().Trim() != "")
- {
- //修改库存收入量、期末库存数量,都加上入库量
- CkStatisticsEntity.InvInQty = double.Parse(ultraGrid1.Rows[i].Cells["INVINQTY"].Value.ToString());//修改库存收入量
- CkStatisticsEntity.InvEndingBalanceQty = double.Parse(ultraGrid1.Rows[i].Cells["INVINQTY"].Value.ToString());
- }
- else
- {
- MessageUtil.ShowTips("库存收入量不能为空");
- return;
- }
- al_CkStatisticsEntity.Add(CkStatisticsEntity);
- }
- if (al_CkInBillEntity.Count < 1)
- {
- MessageUtil.ShowTips("请至少选择一条收货行");
- return;
- }
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.ck.service.CkInBillService", "AddCkInBill", new object[] { al_CkInBillEntity, al_CkStorageEntity, al_CkStatisticsEntity });
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("入库失败 " + crt.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("入库成功,入库单号:" + crt.Resultmsg);
- }
- /// <summary>
- /// 初始化grid1
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- e.Layout.Override.MergedCellStyle = MergedCellStyle.Always;
- e.Layout.Bands[0].Columns["INSTOCKNO"].MergedCellEvaluator = new CustomMergedCellEvaluator();
- }
- }
-
- //自定义单元格合并类
- public class CustomMergedCellEvaluator : Infragistics.Win.UltraWinGrid.IMergedCellEvaluator
- {
- public CustomMergedCellEvaluator() { }
- public bool ShouldCellsBeMerged(UltraGridRow row1, UltraGridRow row2, UltraGridColumn column)//控件自带的方法,会自动进行调用,column为初始化中设置的列
- {
- DateTime date1 = (DateTime)row1.GetCellValue(column);
- DateTime date2 = (DateTime)row2.GetCellValue(column);
- return date1.Date == date2.Date;
- }
- }
- }
|