| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- 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.pur_orderEntiy;
- using Core.Mes.Client.Comm.Control;
- using Pur.Entity.configureEntity;
- using Infragistics.Win.UltraWinEditors;
- using com.hnshituo.pur.vo;
- using Core.Mes.Client.Comm.Tool;
- using System.Collections;
- using Infragistics.Win;
- using Pur.Entity.ck;
- using Infragistics.Win.UltraWinGrid;
- using Pur.configure;
- using Core.Mes.Client.Comm.Server;
- using Pur.PublicTools;
- namespace Pur.Pop_upWindow
- {
- public partial class FrmPopConfirmGoods : FrmBase
- {
- public string QstrInstockNo = "";
- public FrmPopConfirmGoods()
- {
- InitializeComponent();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void FrmPopConfirmGoods_Load(object sender, EventArgs e)
- {
- QcreateTime_BeginNoJL.Value = DateTime.Now.AddMonths(-1);
- QcreateTime_EndNoJL.Value = DateTime.Now.AddDays(2);
- QcreateTime_BeginNoJL.Enabled = true;
- QcreateTime_EndNoJL.Enabled = true;
- ck_createTimeNoJL.Checked = true;
- txt_status.SelectedIndex = 0;
- GridHelper.SetExcludeColumnsActive(ultraGrid4.DisplayLayout.Bands[0], new string[] {"Check"});
- PublicPur.InitCellEdit(new UltraGrid[] { ultraGrid1 }, new string[] {"remark2", "SHIPQTY", "RECQTY" });
- PublicPur.InitCellPositionRight(new UltraGrid[] { ultraGrid1 }, new string[] { "SHIPQTY", "RECQTY" });
- PublicPur.InitColumnShowLength(new UltraGrid[] { ultraGrid1 }, 0, new string[] { "SHIPQTY", "RECQTY" }, 3, false);
- }
- //菜单按钮事件
- #region toolbar工具
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- Get_PUR_EXC_DELIVERY_M();
- break;
- case "conFirmation":
- setRecList();//收货
- break;
- case "QuitCheckAgain"://撤销复检
- QuitCheckAgain();
- break;
- case "ESC":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询送货通知单主表
- /// </summary>
- private void Get_PUR_EXC_DELIVERY_M()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- //查询发货通知单行表
- dataSet1.Clear();
- Hashtable map = new Hashtable();
- map.Add("deliverySubId", txt_DELIVERY_ID.Text);
- map.Add("orderId", COP_OrderId.Text);
- map.Add("suppName", QsuppNameNoJL.Text.Trim());
- map.Add("statusFJ", txt_status.Value == null ? "" : txt_status.Value.ToString());
- map.Add("invPhysicName", QInphysicNoJL.Text.Trim());
- map.Add("deliveryLocation", QLocationNoJL.Text.Trim());
- if (ck_createTimeNoJL.Checked)
- {
- if (QcreateTime_BeginNoJL.Value != null)//创建开始时间
- {
- map.Add("createTimeBegin", Convert.ToDateTime(QcreateTime_BeginNoJL.Value));
- }
- if (QcreateTime_EndNoJL.Value != null)//创建结束时间
- {
- map.Add("createTimeEnd", Convert.ToDateTime(QcreateTime_EndNoJL.Value));
- }
- }
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliverySubMService", "doQueryDeliverySubMList", new object[] { map });
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- GridHelper.RefreshAndAutoSize(ultraGrid4);
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("加载数据异常:" + ex.Message);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- /// <summary>
- /// 生成收货单,2016-6-6 收货界面跟换成编辑框形式,tips:0为收货,1为退货
- /// </summary>
- private void setRecList()
- {
- ultraGrid1.UpdateData();
- ArrayList al = new ArrayList();
- ArrayList al_ExcDeliveryException = new ArrayList();//送货单行
- ExcDeliverySubC subc=new ExcDeliverySubC();
- ExcDeliverySubM subM=new ExcDeliverySubM();
- for (int j = 0; j < ultraGrid1.Rows.Count; j++)
- {
- String strSubSqe = ultraGrid1.Rows[j].Cells["DeliverySubLineSqe"].Value.ToString().Trim();
- if (String.IsNullOrEmpty(strSubSqe))
- {
- MessageUtil.ShowTips("异常,送货单行号为空");
- }
- if (!testDeliveryStatus(strSubSqe,1,ref subc, ref subM))
- {
- return;
- }
- double b_Qty = 0; //送货量
- double.TryParse(ultraGrid1.Rows[j].Cells["QTY"].Value.ToString().Trim(), out b_Qty);
- double b_ReceivedQty = 0; //收货量
- double.TryParse(ultraGrid1.Rows[j].Cells["SHIPQTY"].Value.ToString().Trim(), out b_ReceivedQty);
- double b_RECQty = 0; //待处置量
- double.TryParse(ultraGrid1.Rows[j].Cells["RECQTY"].Value.ToString().Trim(), out b_RECQty);
- b_Qty = Math.Round(b_Qty,3);
- b_ReceivedQty = Math.Round(b_ReceivedQty,3);
- b_RECQty = Math.Round(b_RECQty,3);
- String strRemark = ultraGrid1.Rows[j].Cells["remark2"].Value.ToString().Trim();
- if (b_RECQty > 0 && String.IsNullOrEmpty(strRemark))
- {
- MessageUtil.ShowTips("若送货单行:" + strSubSqe + "存在待处置物料,请输入待处置原因或意见");
- ultraGrid1.Rows[j].Activate();
- return;
- }
- if (b_ReceivedQty<=0)
- {
- if(MessageUtil.ShowYesNoAndQuestion("送货单行:" + strSubSqe + "确定收货数量为0?若存在存在异常单,请填写异常单量")!=DialogResult.Yes)
- ultraGrid1.Rows[j].Activate();
- return;
- }
- ExcDeliverySubC EdC = new ExcDeliverySubC();
- EdC.DeliverySubLineSqe = strSubSqe;
- EdC.Status = "3";
- EdC.ShipQty = b_ReceivedQty;//收货量
- EdC.ReceivedQty = b_RECQty;//待处置
- EdC.Remark = strRemark;
- EdC.FjName = UserInfo.GetUserName();
- EdC.FjUserid = UserInfo.GetUserID();
- EdC.FjTime = System.DateTime.Now;
- al.Add(EdC);
- }
- if (al.Count < 1)
- {
- MessageUtil.ShowTips("没有需要仓储复检送货单");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确认复检?若存在待处置量,请及时通知业务员进行异常单处理。").Equals(DialogResult.Yes))
- {
- CoreResult crt = this.GetJsonService().execute<CoreResult>("com.hnshituo.pur.ck.service.ExcDeliverySubMService", "AddCheckAgain", new object[] { al});
- if (crt.Resultcode == 0)
- {
- MessageUtil.ShowTips("复检成功");
- Get_PUR_EXC_DELIVERY_M();
- }
- else
- {
- MessageUtil.ShowTips("复检失败");
- }
- }
- }
- /// <summary>
- /// 撤销仓储复检
- /// </summary>
- private void QuitCheckAgain()
- {
- ExcDeliverySubC subc = new ExcDeliverySubC();
- ExcDeliverySubM subM = new ExcDeliverySubM();
- ArrayList al = new ArrayList();
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- String strSubSqe = ugr.Cells["DeliverySubLineSqe"].Value.ToString().Trim();
- if (String.IsNullOrEmpty(strSubSqe))
- {
- MessageUtil.ShowTips("异常,送货单行号为空");
- }
- if (!testDeliveryStatus(strSubSqe,2, ref subc, ref subM))
- {
- return;
- }
- ExcDeliverySubC Edc = new ExcDeliverySubC();
- Edc.DeliverySubLineSqe = strSubSqe;
- Edc.FjName = UserInfo.GetUserName();
- Edc.FjUserid = UserInfo.GetUserID();
- Edc.FjTime = System.DateTime.Now;
- al.Add(Edc);
- }
- if (al.Count <= 0)
- {
- MessageUtil.ShowTips("没有找到须要撤销的送货单行");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确认撤销?").Equals(DialogResult.Yes))
- {
- CoreResult cr = this.GetJsonService().execute<CoreResult>("com.hnshituo.pur.ck.service.ExcDeliverySubMService", "QuitCheckAgain", new object[] { al });
- if (cr.Resultcode == 0)
- {
- MessageUtil.ShowTips("撤销成功");
- Get_PUR_EXC_DELIVERY_M();
- }
- else
- {
- MessageUtil.ShowTips("撤销失败");
- return;
- }
- }
- }
- #endregion
- #region 界面事件
- /// <summary>
- /// 选择送货单主表
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid4_CellChange(object sender, CellEventArgs e)
- {
- try
- {
- if (e.Cell.Column.Key == "Check")
- {
- getSubM();
- }
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("加载行信息异常:"+ex.Message);
- }
- }
- private void ultraGrid4_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
- {
- try
- {
- if (e.Column.Key == "Check")
- {
- getSubM();
- }
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("加载行信息异常:" + ex.Message);
- }
- }
- private void getSubM()
- {
- ultraGrid4.UpdateData();
- ExcDeliverySubC edsc = new ExcDeliverySubC();
- List<string> l = new List<string>();
- foreach (UltraGridRow ugr in ultraGrid4.Rows)
- {
- if ((bool)ugr.Cells["Check"].Value)
- {
- l.Add(ugr.Cells["DeliverySubId"].Value.ToString());
- }
- }
- edsc.Col = l.ToArray();
- Get_PUR_EXC_DELIVERY_C(edsc);
- }
- private void ck_createTimeNoJL_CheckedChanged(object sender, EventArgs e)
- {
- QcreateTime_BeginNoJL.Enabled = ck_createTimeNoJL.Checked;
- QcreateTime_EndNoJL.Enabled = ck_createTimeNoJL.Checked;
- }
- #endregion
- #region 公共函数
- /// <summary>
- /// 送货单行状态校验
- /// </summary>
- /// <param name="deliverySubId"></param>
- /// <param name="p"></param>
- /// <returns></returns>
- private bool testDeliveryStatus(String deliverySubId, int p, ref ExcDeliverySubC subc, ref ExcDeliverySubM subM)
- {
- if (String.IsNullOrEmpty(deliverySubId))
- {
- MessageUtil.ShowTips("送货单行号为空,无法校验数据有效性");
- return false;
- }
- subc = this.GetJsonService().execute<ExcDeliverySubC>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "findById", new object[] { deliverySubId });
- if (subc == null)
- {
- MessageUtil.ShowTips("未发现送货单行:" + deliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- if (subc.Validflag != "1")
- {
- MessageUtil.ShowTips("未发现送货单行:" + deliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- String testStatus = subc.Status;
- if (String.IsNullOrEmpty(subc.DeliverySubId))
- {
- MessageUtil.ShowTips("未找到送货单行的头信息");
- return false;
- }
- subM = this.GetJsonService().execute<ExcDeliverySubM>("com.hnshituo.pur.ck.service.ExcDeliverySubMService", "findById", new object[] { subc.DeliverySubId });
- if (subM == null)
- {
- MessageUtil.ShowTips("未发现送货单:" + subc.DeliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- if (subM.Validflag != "1")
- {
- MessageUtil.ShowTips("未发现送货单:" + subc.DeliverySubId + " 信息记录,可能已作废,或请刷新界面重试");
- return false;
- }
- if (subM.ReceiveType!= "110107")
- {
- MessageUtil.ShowTips("未发现送货单:" + subc.DeliverySubId + " 为非JIT送货单,无操作权限");
- return false;
- }
- //复检
- if (p == 1)
- {
- if (testStatus != "2")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 不在待复检状态");
- return false;
- }
- }
- //取消复检
- else if (p == 2)
- {
- if (testStatus != "3")
- {
- MessageUtil.ShowTips("送货单行:" + deliverySubId + " 不在已复检状态");
- return false;
- }
- }
- else
- {
- MessageUtil.ShowTips("未知参数:" + p);
- return false;
- }
- return true;
- }
- /// <summary>
- /// 查询送货通知单行表
- /// </summary>
- private void Get_PUR_EXC_DELIVERY_C(ExcDeliverySubC EdC)
- {
- EdC.Validflag = "1";
- dataTable2.Rows.Clear();
- EdC.CreateUserid = this.UserInfo.GetUserID();//控制当前仓库人员登录只能看到自己所维护的库区
- EdC.Status = txt_status.Value == null ? "" : txt_status.Value.ToString();
- if (EdC.Col.Length > 0)
- {
- DataTable dt = this.GetJsonService().execute<DataTable>("com.hnshituo.pur.ck.service.ExcDeliverySubCService", "Query_C", new object[] { EdC });
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- }
- #endregion
- }
- }
|