Пример #1
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);
        }
Пример #2
0
        protected override DataRow GetGridRow(object obj)
        {
            BenQGuru.eMES.Domain.Warehouse.PickDetail pick = (BenQGuru.eMES.Domain.Warehouse.PickDetail)obj;
            BenQGuru.eMES.Domain.Warehouse.Pick       s    = (BenQGuru.eMES.Domain.Warehouse.Pick)_WarehouseFacade.GetPick(pick.PickNo);

            DataRow row = this.DtSource.NewRow();

            row["PICKLINE"]        = pick.PickLine;
            row["STATUS"]          = languageComponent1.GetString(pick.Status);//dicStu.ContainsKey(pick.Status) ? dicStu[pick.Status] : string.Empty;
            row["MCODE"]           = pick.MCode;
            row["DQMCODE"]         = pick.DQMCode;
            row["MDESC"]           = pick.MDesc;
            row["CustMCode"]       = pick.VEnderItemCode;
            row["QTY"]             = pick.QTY;
            row["UNIT"]            = pick.Unit;
            row["OutCStorageCode"] = s.StorageCode;// dicStu.ContainsKey(s.StorageCode) ? dicStu[s.StorageCode] : string.Empty;
            row["SQTY"]            = pick.SQTY;
            row["OUTQTY"]          = pick.OutQTY;
            //row["Down_Time"] = FormatHelper.ToTimeString(pick.DownTime);
            row["CDATE"] = FormatHelper.ToDateString(pick.CDate);
            //row["REMARK1"] = pick.Remark1;
            row["CTIME"] = FormatHelper.ToTimeString(pick.CTime);
            row["CUSER"] = pick.CUser;
            row["MDATE"] = FormatHelper.ToDateString(pick.MaintainDate);
            row["MTIME"] = FormatHelper.ToTimeString(pick.MaintainTime);
            row["MUSER"] = pick.MaintainUser;

            //row["MUSER"] = pick.MaintainUser;
            return(row);
        }