示例#1
0
 protected override void AddNew()
 {
     this.lookUpEditDepot.EditValue = null;
     this.bindingSourceDepotPositionId.DataSource = null;
     this._produceOtherMaterial = new Model.ProduceOtherMaterial();
     this._produceOtherMaterial.ProduceOtherMaterialDate = DateTime.Now;
     this._produceOtherMaterial.ProduceOtherMaterialId   = this.produceOtherMaterialManager.GetId();// Guid.NewGuid().ToString();
     this._produceOtherMaterial.Employee0 = BL.V.ActiveOperator.Employee;
     if (this._produceOtherMaterial.Employee0 != null)
     {
         this._produceOtherMaterial.Employee0Id = this._produceOtherMaterial.Employee0.EmployeeId;
     }
     this._produceOtherMaterial.Details = new List <Model.ProduceOtherMaterialDetail>();
     if (this.action == "insert")
     {
         Model.ProduceOtherMaterialDetail detail = new Model.ProduceOtherMaterialDetail();
         detail.ProduceOtherMaterialDetailId = Guid.NewGuid().ToString();
         detail.OtherMaterialQuantity        = 0;
         detail.OtherMaterialALLUserQuantity = 0;
         detail.ProductStock         = 0;
         detail.ProductSpecification = "";
         detail.Product = new Book.Model.Product();
         this._produceOtherMaterial.Details.Add(detail);
         this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
     }
     this.action = "insert";
 }
示例#2
0
 public EditForm(string produceOtherMaterialId)
     : this()
 {
     this._produceOtherMaterial = this.produceOtherMaterialManager.GetDetails(produceOtherMaterialId);
     this.action = "view";
     this.flag   = 1;
 }
 public void UpdateDepotOutState(Model.ProduceOtherMaterial produceOtherMaterial)
 {
     //
     // todo: add other logic here.
     //
     accessor.Update(produceOtherMaterial);
 }
示例#4
0
 public EditForm(Model.ProduceOtherMaterial produceOtherMaterial, string action)
     : this()
 {
     this._produceOtherMaterial         = produceOtherMaterial;
     this._produceOtherMaterial.Details = this.produceOtherMaterialDetailManager.Select(produceOtherMaterial);
     this.action = action;
     this.flag   = 1;
 }
示例#5
0
        /// <summary>
        /// 重写父类方法
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        protected override Book.UI.Settings.BasicData.BaseEditForm GetEditForm(object[] args)
        {
            Type type = typeof(EditForm);

            Model.ProduceOtherMaterial model = (new BL.ProduceOtherMaterialManager()).Get((args[0] as Model.ProduceOtherMaterialDetail).ProduceOtherMaterialId);
            args[0] = model;
            return((EditForm)type.Assembly.CreateInstance(type.FullName, false, System.Reflection.BindingFlags.CreateInstance, null, args, null, null));
        }
示例#6
0
 protected override void MovePrev()
 {
     Model.ProduceOtherMaterial produceOtherMaterial = this.produceOtherMaterialManager.GetPrev(this._produceOtherMaterial);
     if (produceOtherMaterial == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._produceOtherMaterial = this.produceOtherMaterialManager.Get(produceOtherMaterial.ProduceOtherMaterialId);
 }
 public Model.ProduceOtherMaterial GetDetails(string produceOtherMaterialID)
 {
     Model.ProduceOtherMaterial produceOtherMaterial = accessor.Get(produceOtherMaterialID);
     if (produceOtherMaterial != null)
     {
         produceOtherMaterial.Details = ProduceOtherMaterialDetailAccessor.Select(produceOtherMaterial);
     }
     return(produceOtherMaterial);
 }
示例#8
0
 protected override void MoveLast()
 {
     if (this.flag == 1)
     {
         this.flag = 0;
         return;
     }
     this._produceOtherMaterial = this.produceOtherMaterialManager.Get(this.produceOtherMaterialManager.GetLast() == null ? "" : this.produceOtherMaterialManager.GetLast().ProduceOtherMaterialId);
 }
 private void Validate(Model.ProduceOtherMaterial produceOtherMaterial)
 {
     if (string.IsNullOrEmpty(produceOtherMaterial.ProduceOtherMaterialId))
     {
         throw new Helper.RequireValueException(Model.ProduceOtherMaterial.PRO_ProduceOtherMaterialId);
     }
     //if (string.IsNullOrEmpty(produceOtherMaterial.WorkHouseId))
     //{
     //    throw new Helper.RequireValueException(Model.ProduceOtherMaterial.PROPERTY_WORKHOUSEID);
     //}
 }
示例#10
0
文件: Q54.cs 项目: daobataotie/Jianli
        private void xrSubreport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            Q54_1 subReport = this.xrSubreport1.ReportSource as Q54_1;

            Model.ProduceOtherMaterial temp = this.GetCurrentRow() as Model.ProduceOtherMaterial;
            if (temp != null)
            {
                temp.Details = detailManger.SelectByCondition(temp.ProduceOtherMaterialId, conditionMaterial.ProductId1, conditionMaterial.ProductId2);
                subReport.ProduceOtherMaterial = temp;
            }
        }
示例#11
0
        private void barButtonItemSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ListForm f = new ListForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                this._produceOtherMaterial = f.SelectItem as Model.ProduceOtherMaterial;
                this.action = "view";
                this.Refresh();
            }
        }
 private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     this._ProduceOtherMaterial = this.bindingSourceProduceOtherMaterial.Current as Model.ProduceOtherMaterial;
     if (this._ProduceOtherMaterial == null)
     {
         this.bindingSourceProduceOtherMaterialDetail.DataSource = null;
     }
     else
     {
         this.bindingSourceProduceOtherMaterialDetail.DataSource = this._ProduceOtherMaterialDetailManager.Select(this._ProduceOtherMaterial);
     }
 }
        private void UpdateAndInsert(Book.Model.ProduceOtherMaterial produceOtherMaterial)
        {
            try
            {
                produceOtherMaterial.InsertTime = produceOtherMaterial.InsertTime == null ? DateTime.Now : produceOtherMaterial.InsertTime;

                produceOtherMaterial.UpdateTime = DateTime.Now;
                BL.V.BeginTransaction();

                //删除旧单据
                Model.ProduceOtherMaterial produceMaterialOld = this.GetDetails(produceOtherMaterial.ProduceOtherMaterialId);
                foreach (Model.ProduceOtherMaterialDetail detail in produceMaterialOld.Details)
                {
                    Model.Product product = productManager.Get(detail.Product.ProductId);
                    product.OtherMaterialDistributioned = (product.OtherMaterialDistributioned == null ? 0 : product.OtherMaterialDistributioned) - (detail.OtherMaterialQuantity == null ? 0 : detail.OtherMaterialQuantity) + (detail.OtherMaterialALLUserQuantity == null ? 0 : detail.OtherMaterialALLUserQuantity);
                    productManager.update(product);
                }
                this.Delete(produceOtherMaterial.ProduceOtherMaterialId);

                //新增

                produceOtherMaterial.InvoiceStatus = 1;
                accessor.Insert(produceOtherMaterial);

                foreach (Model.ProduceOtherMaterialDetail produceOtherMaterialDetail in produceOtherMaterial.Details)
                {
                    if (produceOtherMaterialDetail.Product == null || string.IsNullOrEmpty(produceOtherMaterialDetail.Product.ProductId))
                    {
                        throw new Exception("貨品不為空");
                    }
                    //if (produceOtherMaterialDetail.DepotPositionId == null)
                    //    throw new Helper.MessageValueException("貨位不能為空!");
                    produceOtherMaterialDetail.ProduceOtherMaterialId = produceOtherMaterial.ProduceOtherMaterialId;


                    Model.Product product = productManager.Get(produceOtherMaterialDetail.ProductId);
                    //已分配
                    produceOtherMaterialDetail.Distributioned = (product.OtherMaterialDistributioned == null ? 0 : product.OtherMaterialDistributioned) + (produceOtherMaterialDetail.OtherMaterialQuantity == null ? 0 : produceOtherMaterialDetail.OtherMaterialQuantity);

                    ProduceOtherMaterialDetailAccessor.Insert(produceOtherMaterialDetail);
                    product.OtherMaterialDistributioned = (product.OtherMaterialDistributioned == null ? 0 : product.OtherMaterialDistributioned) + (produceOtherMaterialDetail.OtherMaterialQuantity == null ? 0 : produceOtherMaterialDetail.OtherMaterialQuantity);
                    productManager.update(product);
                }

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
        public void Update(Model.ProduceOtherMaterial produceOtherMaterial)
        {
            Validate(produceOtherMaterial);
            if (produceOtherMaterial != null)
            {
                //this.Delete(produceOtherMaterial);
                //produceOtherMaterial.UpdateTime = DateTime.Now;
                //this.Insert(produceOtherMaterial);

                //旧方法会导致在修改的时候如果先删除了旧单据新增新单据时出错,旧单据则无法找回
                UpdateAndInsert(produceOtherMaterial);
            }
        }
        public void Delete(string produceOtherMaterialId)
        {
            //
            // todo:add other logic here
            //
            Model.ProduceOtherMaterial model = this.Get(produceOtherMaterialId);
            string invoiceKind   = this.GetInvoiceKind().ToLower();
            string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));

            SequenceManager.Decrement(sequencekey_d);

            accessor.Delete(produceOtherMaterialId);
        }
 private void TiGuiExists(Model.ProduceOtherMaterial model)
 {
     if (this.HasRows(model.ProduceOtherMaterialId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.ProduceOtherMaterialDate.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.ProduceOtherMaterialDate.Value.Year, model.ProduceOtherMaterialDate.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.ProduceOtherMaterialDate.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.ProduceOtherMaterialId = this.GetId(model.ProduceOtherMaterialDate.Value);
         TiGuiExists(model);
     }
 }
示例#17
0
 protected override void Delete()
 {
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     try
     {
         this.produceOtherMaterialManager.Delete(this._produceOtherMaterial);
         this._produceOtherMaterial = this.produceOtherMaterialManager.GetNext(this._produceOtherMaterial);
         if (this._produceOtherMaterial == null)
         {
             this._produceOtherMaterial = this.produceOtherMaterialManager.GetLast();
         }
     }
     catch
     {
         throw;
     }
 }
        public void Delete(Model.ProduceOtherMaterial produceOtherMaterial)
        {
            try
            {
                BL.V.BeginTransaction();

                //foreach (var item in ProduceOtherMaterialDetailAccessor.Select(produceOtherMaterial))
                //{
                //    stockAccessor.Increment(new BL.DepotPositionManager().Get(item.DepotPositionId), item.Product, item.OtherMaterialQuantity);

                //    Model.ProduceOtherCompactMaterial CompactDetail = produceOtherCompactMaterialAccessor.Get(item.ProduceOtherCompactMaterialId);
                //    if (CompactDetail != null)
                //    {
                //        CompactDetail.AlreadyOutQuantity = CompactDetail.AlreadyOutQuantity == null ? 0 : CompactDetail.AlreadyOutQuantity - item.OtherMaterialQuantity;
                //        produceOtherCompactMaterialAccessor.Update(CompactDetail);
                //    }
                //}
                Model.ProduceOtherMaterial produceMaterialOld = this.GetDetails(produceOtherMaterial.ProduceOtherMaterialId);
                foreach (Model.ProduceOtherMaterialDetail detail in produceMaterialOld.Details)
                {
                    //  produceMaterialdetails.Distributioned = (produceMaterialdetails.Distributioned == null ? 0 : produceMaterialdetails.Distributioned) + produceMaterialdetails.Materialprocessum;

                    Model.Product product = productManager.Get(detail.Product.ProductId);
                    product.OtherMaterialDistributioned = (product.OtherMaterialDistributioned == null ? 0 : product.OtherMaterialDistributioned) - (detail.OtherMaterialQuantity == null ? 0 : detail.OtherMaterialQuantity) + (detail.OtherMaterialALLUserQuantity == null ? 0 : detail.OtherMaterialALLUserQuantity);
                    productManager.update(product);
                }
                this.Delete(produceOtherMaterial.ProduceOtherMaterialId);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
示例#19
0
 public void Insert(Model.ProduceOtherMaterial e)
 {
     this.Insert <Model.ProduceOtherMaterial>(e);
 }
示例#20
0
 public Model.ProduceOtherMaterial GetNext(Model.ProduceOtherMaterial e)
 {
     return(sqlmapper.QueryForObject <Model.ProduceOtherMaterial>("ProduceOtherMaterial.get_next", e));
 }
示例#21
0
 public bool HasRowsAfter(Model.ProduceOtherMaterial e)
 {
     return(sqlmapper.QueryForObject <bool>("ProduceOtherMaterial.has_rows_after", e));
 }
示例#22
0
 public Model.ProduceOtherMaterial GetPrev(Model.ProduceOtherMaterial e)
 {
     return(sqlmapper.QueryForObject <Model.ProduceOtherMaterial>("ProduceOtherMaterial.get_prev", e));
 }
 public IList <Book.Model.ProduceOtherMaterialDetail> SelectByState(Model.ProduceOtherMaterial produceMaterial)
 {
     return(accessor.SelectByState(produceMaterial));
 }
示例#24
0
文件: RO.cs 项目: daobataotie/EDERP
        public RO(string produceOtherMaterialId)
        {
            InitializeComponent();
            this.produceOtherMaterial = this.produceOtherMaterialManager.GetDetails(produceOtherMaterialId);

            if (this.produceOtherMaterial == null)
            {
                return;
            }

            //   this.produceOtherMaterial.Details = this.ProduceOtherMaterialDetailManager.GetOrderById(this.produceOtherMaterial);

            this.DataSource = this.produceOtherMaterial.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.ProduceOtherMaterialDetail;
            this.xrLabelDepot.Text           = this.produceOtherMaterial.Depot == null ? "" : this.produceOtherMaterial.Depot.ToString();
            this.xrLabelDate.Text           += DateTime.Now.ToShortDateString();

            xrLabelSup.Text = this.produceOtherMaterial.Supplier == null ? null : this.produceOtherMaterial.Supplier.SupplierShortName;
            //外包領料
            this.xrLabelProduceOtherMaterialId.Text   = this.produceOtherMaterial.ProduceOtherMaterialId;
            this.xrLabelProduceOtherMaterialDate.Text = this.produceOtherMaterial.ProduceOtherMaterialDate.Value.ToString("yyyy-MM-dd");
            if (this.produceOtherMaterial.Employee0 != null)
            {
                this.xrLabelEmployee0.Text = this.produceOtherMaterial.Employee0.EmployeeName;
            }
            if (this.produceOtherMaterial.Employee1 != null)
            {
                this.xrLabelEmployee1.Text = this.produceOtherMaterial.Employee1.EmployeeName;
            }
            if (this.produceOtherMaterial.WorkHouse != null)
            {
                this.xrLabelDepartment.Text = this.produceOtherMaterial.WorkHouse.Workhousename;
            }
            this.xrLabelOtherCam.Text = this.produceOtherMaterial.ProduceOtherCompactId;
            this.xrLabelProduceOtherMaterialDesc.Text = this.produceOtherMaterial.ProduceOtherMaterialDesc;

            if (!string.IsNullOrEmpty(produceOtherMaterial.ProduceOtherCompactId))
            {
                Model.ProduceOtherCompact OtherCompact = new BL.ProduceOtherCompactManager().Get(produceOtherMaterial.ProduceOtherCompactId);
                if (OtherCompact != null)
                {
                    //Model.MRSHeader mrsHeader = this.mRSHeaderManager.Get(OtherCompact.MRSHeaderId);
                    //if (mrsHeader != null)
                    //{
                    //    Model.MPSheader mPSheader = this.mPSheaderManager.Get(mrsHeader.MPSheaderId);
                    //    if (mPSheader != null)
                    //    {
                    //        Model.InvoiceXO invoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId);
                    //        this.xrLabelCustomerXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId;
                    //    }
                    //}
                    Model.InvoiceXO invoiceXO = OtherCompact.InvoiceXO;
                    if (invoiceXO != null)
                    {
                        this.xrLabelCustomerXOId.Text = invoiceXO.CustomerInvoiceXOId;

                        if (invoiceXO.xocustomer != null && !string.IsNullOrEmpty(invoiceXO.xocustomer.CheckedStandard))
                        {
                            if (invoiceXO.xocustomer.CheckedStandard.ToLower().Contains("jis") && invoiceXO.xocustomer.CustomerFullName.ToUpper().Contains("MIDORI"))
                            {
                                //CreateTagLable("JIS");

                                this.lbl_JIS.Text = "JIS";
                            }
                            else if (invoiceXO.xocustomer.CheckedStandard.ToLower().Contains("as"))
                            {
                                //CreateTagLable("AS");

                                this.lbl_JIS.Text = "AS";
                            }
                        }
                    }
                }
            }
            //this.xrLabelCustomerXOId.Text = this.produceOtherMaterial.InvoiceCusId;
            //明细
            //this.xrTableCell1ProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            //if (produceOtherMaterial.WorkHouse!=null)
            //{
            //    if(produceOtherMaterial.WorkHouse.Workhousename != null)
            //    this.xrTableCellDepartment.DataBindings.Add("Text", this.DataSource, "ProduceOtherMaterialWorkHouse.Workhousename");
            //}
            // this.xrTableCellProduceOtherMaterialDate.DataBindings.Add("Text", this.DataSource, "ProduceOtherMaterial." + Model.ProduceOtherMaterial.PRO_ProduceOtherMaterialDate, "{0:yyyy-MM-dd}");
            this.xrTableCellOtherMaterialQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_OtherMaterialQuantity);
            this.xrTableCellDesc.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_Description);
            this.xrTableCell4.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_ProductUnit);
            //this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, "Product." + Model.Product.PRO_ProductDescription);
            this.xrTableCellParent.DataBindings.Add("Text", this.DataSource, "ParentProduct." + Model.Product.PRO_ProductName);
            this.xrTableInumber.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_Inumber);
            this.xrTableStock.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_ProductStock);
            this.xrTableCellNum.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_PiHao);
            this.TCKouliaoDate.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_KouliaoDate, "{0:yyyy-MM-dd}");
            this.TCInvoiceUseQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceOtherMaterialDetail.PRO_InvoiceUseQuantity);
        }
示例#25
0
 protected override void MoveFirst()
 {
     this._produceOtherMaterial = this.produceOtherMaterialManager.Get(this.produceOtherMaterialManager.GetFirst() == null ? "" : this.produceOtherMaterialManager.GetFirst().ProduceOtherMaterialId);
 }
示例#26
0
        public override void Refresh()
        {
            if (this._produceOtherMaterial == null)
            {
                //this._produceOtherMaterial = new Book.Model.ProduceOtherMaterial();
                //this.action = "insert";
                this.AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._produceOtherMaterial = this.produceOtherMaterialManager.GetDetails(_produceOtherMaterial.ProduceOtherMaterialId);
                    if (this._produceOtherMaterial == null)
                    {
                        this.AddNew();
                        this.action = "insert";
                    }
                }
            }

            if (this.produceOtherMaterialManager.IsDepotOut(this._produceOtherMaterial.ProduceOtherMaterialId) && this.action == "update")
            {
                MessageBox.Show("已出倉,請勿修改!", this.Text, MessageBoxButtons.OK);
                this.action = "view";
            }

            this.newChooseContorlSipu.EditValue = this._produceOtherMaterial.Supplier;
            this.textEditOtherCompact.Text      = this._produceOtherMaterial.ProduceOtherCompactId;

            this.textEditProduceOtherMaterialId.Text   = this._produceOtherMaterial.ProduceOtherMaterialId;
            this.textEditProduceOtherMaterialDesc.Text = this._produceOtherMaterial.ProduceOtherMaterialDesc;
            this.lookUpEditDepot.EditValue             = this._produceOtherMaterial.DepotId;
            //this.newChooseWorkHorseId.EditValue = this.produceOtherMaterial.WorkHouse;
            if (global::Helper.DateTimeParse.DateTimeEquls(this._produceOtherMaterial.ProduceOtherMaterialDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditProduceOtherMaterialDate.EditValue = null;
            }
            else
            {
                this.dateEditProduceOtherMaterialDate.EditValue = this._produceOtherMaterial.ProduceOtherMaterialDate;
            }
            //this.textEditCusXOId.Text = this._produceOtherMaterial.InvoiceCusId;

            Model.ProduceOtherCompact otherCompact = this.produceOtherCompactManager.Get(this._produceOtherMaterial.ProduceOtherCompactId);
            if (otherCompact != null)
            {
                this.textEditCusXOId.Text = (otherCompact.InvoiceXO == null ? null : otherCompact.InvoiceXO.CustomerInvoiceXOId);
            }
            else
            {
                this.textEditCusXOId.Text = null;
            }
            this.newChooseEmployee0.EditValue    = this._produceOtherMaterial.Employee0;
            this.newChooseEmployee1.EditValue    = this._produceOtherMaterial.Employee1;
            this.bindingSourceDetails.DataSource = this._produceOtherMaterial.Details;
            this.EmpAudit.EditValue      = this._produceOtherMaterial.AuditEmp;
            this.textEditAuditState.Text = this.GetAuditName(this._produceOtherMaterial.AuditState);

            base.Refresh();

            switch (this.action)
            {
            case "insert":
                this.gridView1.OptionsBehavior.Editable = true;
                this.barButtonItem1.Enabled             = true;
                break;

            case "update":
                this.gridView1.OptionsBehavior.Editable = true;
                this.barButtonItem1.Enabled             = true;
                break;

            case "view":
                //this.gridView1.OptionsBehavior.Editable = false;
                this.barButtonItem1.Enabled = false;
                break;
            }
            this.newChooseEmployee0.Enabled = false;
            this.textEditProduceOtherMaterialId.Properties.ReadOnly = true;
        }
 public IList <Book.Model.ProduceOtherMaterialDetail> GetOrderById(Model.ProduceOtherMaterial produceOtherMaterial)
 {
     return(sqlmapper.QueryForList <Model.ProduceOtherMaterialDetail>("ProduceOtherMaterialDetail.select_byProduceOtherMaterialIdOrderByCategoryId", produceOtherMaterial.ProduceOtherMaterialId));
 }
        public void Insert(Model.ProduceOtherMaterial produceOtherMaterial)
        {
            Validate(produceOtherMaterial);
            try
            {
                produceOtherMaterial.InsertTime = produceOtherMaterial.InsertTime == null ? DateTime.Now : produceOtherMaterial.InsertTime;

                produceOtherMaterial.UpdateTime = DateTime.Now;
                BL.V.BeginTransaction();
                this.TiGuiExists(produceOtherMaterial);
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, produceOtherMaterial.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, produceOtherMaterial.InsertTime.Value.Year, produceOtherMaterial.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, produceOtherMaterial.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);

                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);
                produceOtherMaterial.InvoiceStatus = 1;
                accessor.Insert(produceOtherMaterial);

                foreach (Model.ProduceOtherMaterialDetail produceOtherMaterialDetail in produceOtherMaterial.Details)
                {
                    if (produceOtherMaterialDetail.Product == null || string.IsNullOrEmpty(produceOtherMaterialDetail.Product.ProductId))
                    {
                        throw new Exception("貨品不為空");
                    }
                    //if (produceOtherMaterialDetail.DepotPositionId == null)
                    //    throw new Helper.MessageValueException("貨位不能為空!");
                    produceOtherMaterialDetail.ProduceOtherMaterialId = produceOtherMaterial.ProduceOtherMaterialId;


                    Model.Product product = productManager.Get(produceOtherMaterialDetail.ProductId);
                    //已分配
                    produceOtherMaterialDetail.Distributioned = (product.OtherMaterialDistributioned == null ? 0 : product.OtherMaterialDistributioned) + (produceOtherMaterialDetail.OtherMaterialQuantity == null ? 0 : produceOtherMaterialDetail.OtherMaterialQuantity);

                    ProduceOtherMaterialDetailAccessor.Insert(produceOtherMaterialDetail);
                    product.OtherMaterialDistributioned = (product.OtherMaterialDistributioned == null ? 0 : product.OtherMaterialDistributioned) + (produceOtherMaterialDetail.OtherMaterialQuantity == null ? 0 : produceOtherMaterialDetail.OtherMaterialQuantity);
                    productManager.update(product);
                    ////Model.Stock stock = stockAccessor.GetStockByProductIdAndDepotPositionId(produceOtherMaterialDetail.ProductId, produceOtherMaterialDetail.DepotPositionId);
                    // stockAccessor.Increment(new BL.DepotPositionManager().Get(produceOtherMaterialDetail.DepotPositionId), produceOtherMaterialDetail.Product, -produceOtherMaterialDetail.OtherMaterialQuantity);

                    //Model.ProduceOtherCompactMaterial produceOtherCompactMaterial = produceOtherCompactMaterialAccessor.Get(produceOtherMaterialDetail.ProduceOtherCompactMaterialId);
                    //if (produceOtherCompactMaterial != null)
                    //{
                    //    if (produceOtherCompactMaterial.AlreadyOutQuantity == null)
                    //        produceOtherCompactMaterial.AlreadyOutQuantity = 0;
                    //    produceOtherCompactMaterial.AlreadyOutQuantity += produceOtherMaterialDetail.OtherMaterialQuantity;
                    //    if (produceOtherCompactMaterial.AlreadyOutQuantity >= produceOtherCompactMaterial.ProduceQuantity)
                    //    {
                    //        produceOtherCompactMaterial.DetailsFlag = 2;
                    //    }
                    //    else
                    //    {
                    //        if (produceOtherCompactMaterial.AlreadyOutQuantity > 0)
                    //        {
                    //            produceOtherCompactMaterial.DetailsFlag = 1;
                    //        }
                    //        else
                    //        {
                    //            produceOtherCompactMaterial.DetailsFlag = 0;
                    //        }
                    //    }
                    //    produceOtherCompactMaterialAccessor.Update(produceOtherCompactMaterial);
                    //    UpdateProduceOtherCompactFlag(produceOtherCompactMaterial.ProduceOtherCompact);
                    //}
                }

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
 public IList <Book.Model.ProduceOtherMaterialDetail> SelectByState(Model.ProduceOtherMaterial produceMaterial)
 {
     return(sqlmapper.QueryForList <Model.ProduceOtherMaterialDetail>("ProduceOtherMaterialDetail.select_byState", produceMaterial.ProduceOtherMaterialId));
 }
示例#30
0
 public void Update(Model.ProduceOtherMaterial e)
 {
     this.Update <Model.ProduceOtherMaterial>(e);
 }