Ejemplo n.º 1
0
        protected override void SetEditObject(object obj)
        {
            if (obj == null)
            {
                txtPickLineEdit.Text = "";

                txtDQMCodeEdit.Text = "";
                txtDMESCEdit.Text   = "";
                txtInvLineEidt.Text = "";
                return;
            }


            BenQGuru.eMES.Domain.Warehouse.PickDetail d = (BenQGuru.eMES.Domain.Warehouse.PickDetail)obj;
            BenQGuru.eMES.Domain.MOModel.Material     m = _WarehouseFacade.GetMaterialFromDQMCode(d.DQMCode);
            txtPickLineEdit.Text = d.PickLine;
            txtDMESCEdit.Text    = m.MchlongDesc;
            txtDQMCodeEdit.Text  = d.DQMCode;

            txtInvLineEidt.Text = d.InvLine.ToString();
        }
Ejemplo n.º 2
0
        protected void cmdLotSave_ServerClick(object sender, EventArgs e)
        {
            try
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider);
                BenQGuru.eMES.Domain.Warehouse.Pick p = (BenQGuru.eMES.Domain.Warehouse.Pick)_WarehouseFacade.GetPick(txtPickNoQuery.Text);
                if (p.Status != Pick_STATUS.Status_Release)
                {
                    WebInfoPublish.Publish(this, p.PickNo + "拣货任务令的状态必须是初始化才能修改!", this.languageComponent1);
                    return;
                }
                StringBuilder sb = new StringBuilder(300);
                this.DataProvider.BeginTransaction();
                List <string> pickLineGtQty = new List <string>();
                for (int i = 0; i < this.gridWebGrid.Rows.Count; i++)
                {
                    string pickLine = this.gridWebGrid.Rows[i].Items.FindItemByKey("PICKLINE").Value.ToString();
                    BenQGuru.eMES.Domain.Warehouse.PickDetail d = (BenQGuru.eMES.Domain.Warehouse.PickDetail)_WarehouseFacade.GetPickdetail(txtPickNoQuery.Text, pickLine);
                    decimal qty = d.QTY;
                    BenQGuru.eMES.Domain.MOModel.Material m = (BenQGuru.eMES.Domain.MOModel.Material)_WarehouseFacade.GetMaterialFromDQMCode(d.DQMCode);

                    if (m == null)
                    {
                        WebInfoPublish.Publish(this, d.DQMCode + "物料号不存在!", this.languageComponent1);
                        this.DataProvider.RollbackTransaction();
                        return;
                    }



                    string qtyStr = this.gridWebGrid.Rows[i].Items.FindItemByKey("QTY").Value.ToString();

                    decimal decqty = 0;
                    if (!decimal.TryParse(qtyStr, out decqty))
                    {
                        WebInfoPublish.Publish(this, txtPickNoQuery.Text + ":" + pickLine + "数量必须是数字!", this.languageComponent1);
                        this.DataProvider.RollbackTransaction();
                        return;
                    }

                    string  invno   = FormatHelper.CleanString(txtInvNoEidt.Text);
                    decimal pickqty = _WarehouseFacade.GetPickDetailQty(invno, d.InvLine, m.MCode);
                    decimal wwpoqty = _WarehouseFacade.GetWWPOQty(invno, d.InvLine, m.MCode);

                    bool isFalse = (decqty + pickqty - qty > wwpoqty);
                    d.QTY = decqty;
                    if (isFalse)
                    {
                        sb.Append(string.Format(@"拣货任务令号:{0},SAP单据号:{1},状态:{2},下发人:{3},鼎桥物料编码:{4},描述:{5},领取数量:{6},超领数量:{7} \r\n",
                                                p.PickNo,
                                                txtInvNoEidt.Text,
                                                p.Status,
                                                GetUserCode(),
                                                m.DqmCode,
                                                m.MenshortDesc,
                                                decqty, decqty + pickqty - qty - wwpoqty));
                        pickLineGtQty.Add(pickLine);
                    }
                    _WarehouseFacade.UpdatePickdetail(d);
                }

                this.DataProvider.CommitTransaction();

                if (pickLineGtQty.Count == 0)
                {
                    WebInfoPublish.Publish(this, "保存成功", this.languageComponent1);
                }
                else
                {
                    GenWWPOMail(sb.ToString(), GetUserCode());
                    WebInfoPublish.Publish(this, "保存成功 - " + txtPickNoQuery.Text + "行项目" + string.Join(",", pickLineGtQty.ToArray()) + " 的领料数大于SAP物料数量", this.languageComponent1);
                }
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
            this.gridHelper.RequestData();
            this.buttonHelper.PageActionStatusHandle(PageActionType.Save);
        }
Ejemplo n.º 3
0
        protected void cmdAdd_ServerClick(object sender, EventArgs e)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }
            if (string.IsNullOrEmpty(txtStockCheckEdit.Text))
            {
                WebInfoPublish.Publish(this, "盘点单号不能为空!", this.languageComponent1); return;
            }
            if (string.IsNullOrEmpty(drpStorageCodeEdit.SelectedValue))
            {
                WebInfoPublish.Publish(this, "库位不能为空!", this.languageComponent1); return;
            }
            if (string.IsNullOrEmpty(drpCheckTypeEdit.SelectedValue))
            {
                WebInfoPublish.Publish(this, "盘点类型不能为空!", this.languageComponent1); return;
            }
            if (drpCheckTypeEdit.SelectedValue != "Portion")
            {
                if (!string.IsNullOrEmpty(txtBDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "盘点日期动盘时才可用!", this.languageComponent1); return;
                }
                if (!string.IsNullOrEmpty(txtEDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "盘点日期动盘时才可用!", this.languageComponent1); return;
                }
            }
            if (drpCheckTypeEdit.SelectedValue == "Portion")
            {
                if (string.IsNullOrEmpty(txtBDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "必须输入盘点日期!", this.languageComponent1); return;
                }
                if (string.IsNullOrEmpty(txtEDateEdit.Text))
                {
                    WebInfoPublish.Publish(this, "必须输入盘点日期!", this.languageComponent1); return;
                }
            }

            try
            {
                this.DataProvider.BeginTransaction();
                BenQGuru.eMES.Domain.Warehouse.StockCheck s = new BenQGuru.eMES.Domain.Warehouse.StockCheck();
                s.CheckNo     = txtStockCheckEdit.Text;
                s.CheckType   = drpCheckTypeEdit.SelectedValue;
                s.StorageCode = drpStorageCodeEdit.Text;
                s.REMARK1     = txtREMARKEdit.Text;
                s.STATUS      = "WaitCheck";
                s.FACCODE     = " ";
                s.SDATE       = FormatHelper.TODateInt(txtBDateEdit.Text);
                s.EDATE       = FormatHelper.TODateInt(txtEDateEdit.Text);
                s.MDATE       = FormatHelper.TODateInt(DateTime.Now);
                s.MTIME       = FormatHelper.TOTimeInt(DateTime.Now);
                s.MUSER       = GetUserCode();
                s.CDATE       = FormatHelper.TODateInt(DateTime.Now);
                s.CTIME       = FormatHelper.TOTimeInt(DateTime.Now);
                s.CUSER       = GetUserCode();
                _WarehouseFacade.AddStockCheck(s);

                BenQGuru.eMES.Material.Do[] ds;
                bool isPortion = false;
                if (drpCheckTypeEdit.SelectedValue == "Portion")
                {
                    ds        = _WarehouseFacade.GetPortionStorageQty(drpStorageCodeEdit.Text, s.SDATE, s.EDATE);
                    isPortion = true;
                }
                else
                {
                    ds = _WarehouseFacade.GetStorageQTY123(drpStorageCodeEdit.Text);
                }
                foreach (BenQGuru.eMES.Material.Do d in ds)
                {
                    BenQGuru.eMES.Domain.Warehouse.StockCheckDetail ss = new BenQGuru.eMES.Domain.Warehouse.StockCheckDetail();
                    ss.CheckNo     = txtStockCheckEdit.Text;
                    ss.StorageCode = drpStorageCodeEdit.SelectedValue;
                    ss.DQMCODE     = d.DQMCODE;

                    BenQGuru.eMES.Domain.MOModel.Material m = _WarehouseFacade.GetMaterialFromDQMCode(d.DQMCODE);
                    if (m == null)
                    {
                        throw new Exception(d.DQMCODE + "物料在物料表中不存在!");
                    }
                    ss.MDESC = m.MchshortDesc;
                    ss.UNIT  = m.Muom;

                    ss.STORAGEQTY   = d.sum;
                    ss.LocationCode = " ";
                    ss.CARTONNO     = string.IsNullOrEmpty(d.CARTONNO) ? " " : d.CARTONNO;
                    if (isPortion)
                    {
                        ss.LocationCode = d.LOCATIONCODE;
                        //StorageDetail storageDetail = (StorageDetail)_WarehouseFacade.GetStorageDetail(ss.CARTONNO);
                        //if (storageDetail != null)
                        //{
                        //    ss.LocationCode = storageDetail.LocationCode;
                        //}
                    }
                    ss.MDATE = FormatHelper.TODateInt(DateTime.Now);
                    ss.MTIME = FormatHelper.TOTimeInt(DateTime.Now);
                    ss.MUSER = GetUserCode();
                    ss.CDATE = FormatHelper.TODateInt(DateTime.Now);
                    ss.CTIME = FormatHelper.TOTimeInt(DateTime.Now);
                    ss.CUSER = GetUserCode();
                    _WarehouseFacade.AddStockCheckDetails(ss);
                }
                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }



            WebInfoPublish.Publish(this, "添加成功!", this.languageComponent1); return;
        }