public void _ValidateForDelete(Model.MRSHeader mRSHeader)
        {
            switch (mRSHeader.SourceType)
            {
            case "3":
            case "6":
                if (this.JudgeValueExists(" SELECT  1 FROM ProduceOtherCompact where MRSHeaderId ='" + mRSHeader.MRSHeaderId + "' "))
                {
                    throw new Helper.ViolateConstraintException("Has generated outsourcing contract,cannot delete");
                }
                break;

            case "1":
                if (this.JudgeValueExists(" SELECT  1 FROM InvoiceCO where MRSHeaderId ='" + mRSHeader.MRSHeaderId + "'"))
                {
                    throw new Helper.ViolateConstraintException("Has generated purchase order ,cannot delete");
                }
                break;

            case "0":
            case "4":
            case "5":
                if (this.JudgeValueExists("SELECT 1 FROM PronoteHeader WHERE MRSHeaderId='" + mRSHeader.MRSHeaderId + "'"))
                {
                    throw new Helper.ViolateConstraintException("Has generated processing order,cannot delete");
                }
                break;
            }
        }
Beispiel #2
0
        public ListForm(Model.MRSHeader mrsheader, int sourceType)
            : this()
        {
            // this.barButtonItem2.item = DevExpress.XtraBars.BarItemVisibility.Always;
            this.tag = 1;
            flag     = 1;

            switch (sourceType)
            {
            case 0:
                this.Text = "生產管理-生產加工單列表";
                break;

            case 4:
                this.Text = "生產管理-" + Properties.Resources.ZZJiaGong + "列表";
                break;

            case 5:
            case 7:
                this.Text = "生產管理-" + Properties.Resources.GZZhiShi + "列表";
                break;

            default:
                this.Text = "";
                break;
            }
            this.sourceType = sourceType;
            listDetail      = (this.manager as BL.PronoteHeaderManager).Select(mrsheader);
            foreach (Model.PronoteHeader pronoteHeader in listDetail)
            {
                pronoteHeader.Checkeds = true;
            }
            this.bindingSource1.DataSource = listDetail;
        }
Beispiel #3
0
        public void UpdateMRSHeaderFlag(Model.MRSHeader mRSHeader)
        {
            int flag = 0;
            //IList<Model.MRSdetails> list = mRSdetailsManager.Select(mRSHeader);
            IList <Model.MRSdetails> list = mRSdetailsManager.SelectBySqlMap(mRSHeader);


            foreach (Model.MRSdetails detail in list)
            {
                flag += detail.DetailsFlag == null ? 0 : detail.DetailsFlag.Value;
            }
            if (flag == 0)
            {
                mRSHeader.InvoiceFlag = 0;
            }
            else if (flag < list.Count * 2)
            {
                mRSHeader.InvoiceFlag = 1;
            }
            else if (flag == list.Count * 2)
            {
                mRSHeader.InvoiceFlag = 2;
            }
            new BL.MRSHeaderManager().UpdateHeader(mRSHeader);
        }
Beispiel #4
0
        public void _ValidateForDelete(Model.MRSHeader mRSHeader)
        {
            switch (mRSHeader.SourceType)
            {
            case "3":
            case "6":
                if (this.JudgeValueExists(" SELECT  1 FROM ProduceOtherCompact where MRSHeaderId ='" + mRSHeader.MRSHeaderId + "' "))
                {
                    throw new Helper.ViolateConstraintException("已形成委外單,不能刪除");
                }
                break;

            case "1":
                if (this.JudgeValueExists(" SELECT  1 FROM InvoiceCO where MRSHeaderId ='" + mRSHeader.MRSHeaderId + "'"))
                {
                    throw new Helper.ViolateConstraintException("已形成採購單,不能刪除");
                }
                break;

            case "0":
            case "4":
            case "5":
                if (this.JudgeValueExists("SELECT 1 FROM PronoteHeader WHERE MRSHeaderId='" + mRSHeader.MRSHeaderId + "'"))
                {
                    throw new Helper.ViolateConstraintException("已形成加工單,不能刪除");
                }
                break;
            }
        }
Beispiel #5
0
        public ListForm(Model.MRSHeader mrsheader, int sourceType)
            : this()
        {
            // this.barButtonItem2.item = DevExpress.XtraBars.BarItemVisibility.Always;
            this.tag = 1;
            flag     = 1;

            switch (sourceType)
            {
            case 0:
                this.Text = "Production and processing list";
                break;

            case 4:
                this.Text = "Assembly processing list";
                break;

            case 5:
                this.Text = "Processing instructions list";
                break;

            default:
                this.Text = "";
                break;
            }
            this.sourceType = sourceType;
            listDetail      = (this.manager as BL.PronoteHeaderManager).Select(mrsheader);
            foreach (Model.PronoteHeader pronoteHeader in listDetail)
            {
                pronoteHeader.Checkeds = true;
            }
            this.bindingSource1.DataSource = listDetail;
        }
Beispiel #6
0
        private void Validate(Model.MRSHeader mRSHeader)
        {
            if (mRSHeader.MRSstartdate == new DateTime() || mRSHeader.MRSstartdate == global::Helper.DateTimeParse.NullDate || mRSHeader.MRSstartdate == null)
            {
                throw new Helper.RequireValueException(Model.MRSHeader.PRO_MRSstartdate);
            }

            bool IsNullOrZero = false;

            if (mRSHeader.Details != null)
            {
                foreach (Model.MRSdetails item in mRSHeader.Details)
                {
                    if (item.MRSdetailssum != null)
                    {
                        IsNullOrZero = true;
                    }
                    if (mRSHeader.SourceType == "1" || mRSHeader.SourceType == "3")
                    {
                        if (string.IsNullOrEmpty(item.SupplierId))
                        {
                            throw new Helper.RequireValueException(Model.MRSdetails.PRO_SupplierId);
                        }
                    }
                }
                if (IsNullOrZero == false)
                {
                    throw new Helper.MessageValueException("數量不能為空!");
                }
            }
        }
Beispiel #7
0
        public bool ExistsExcept(Model.MRSHeader e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.MRSHeaderId).Id);
            return(sqlmapper.QueryForObject <bool>("MRSHeader.existsexcept", paras));
        }
Beispiel #8
0
 public ListForm(Model.MRSHeader mrsheader)
     : this()
 {
     if (produceManager.MRSHeader.EditForm.isDelete)
     {
         this.CanDelete();
     }
     this._mrsHeader = mrsheader;
 }
Beispiel #9
0
 public Model.MRSHeader GetDetails(string mRSheaderId)
 {
     Model.MRSHeader mRSheader = accessor.Get(mRSheaderId);
     if (mRSheader != null)
     {
         mRSheader.Details = MRSdetailsAccessor.Select(mRSheader);
     }
     return(mRSheader);
 }
Beispiel #10
0
 public EditForm(Model.MRSHeader mrsheader)
     : this()
 {
     this._mrsheader = mrsheader;
     this.action     = "view";
     if (this.action == "view")
     {
         LastFlag = 1;
     }
 }
Beispiel #11
0
        public IList <Book.Model.MRSdetails> Select(Model.MRSHeader mRSheader)
        {
            //StringBuilder sb = new StringBuilder("SELECT *,(SELECT (ProduceMaterialDistributioned+OtherMaterialDistributioned) FROM Product WHERE Product.ProductId = MRSdetails.ProductId) AS ProductFPSLsum");
            //sb.Append(" ,(SELECT ProductName FROM Product WHERE Product.ProductId = MRSdetails.ProductId) AS ProductName");
            //sb.Append(" ,(SELECT ProductName FROM Product WHERE Product.ProductId = MRSdetails.MadeProductId) AS MadeProductName");
            //sb.Append(" ,(SELECT SupplierShortName FROM Supplier WHERE Supplier.SupplierId = MRSdetails.SupplierId) AS SupplierShortName");
            //sb.Append(" FROM MRSdetails WHERE MRSHeaderId='" + mRSheader.MRSHeaderId + "' order by Inumber");

            //return this.DataReaderBind<Model.MRSdetails>(sb.ToString(), null, CommandType.Text);
            return(sqlmapper.QueryForList <Model.MRSdetails>("MRSdetails.select_byMRSheaderId", mRSheader.MRSHeaderId));
        }
Beispiel #12
0
        private void xrSubreport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            RO1Details1 detail = this.xrSubreport1.ReportSource as RO1Details1;

            Model.MRSHeader mrsh = this.GetCurrentRow() as Model.MRSHeader;
            if (mrsh != null)
            {
                mrsh.Details      = this.mRSdetailsManager.Select(mrsh);
                detail.MMRSHeader = mrsh;
            }
        }
Beispiel #13
0
        private void Q59_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            Q59_1 reportProducts = this.xrSubreport1.ReportSource as Q59_1;

            Model.MRSHeader mrsHeader = this.GetCurrentRow() as Model.MRSHeader;
            if (mrsHeader != null)
            {
                mrsHeader.Details        = this.mrsDetailManager.GetByMRSIDAndProId(mrsHeader.MRSHeaderId, this.condition.Product == null?null:this.condition.Product.ProductId);
                reportProducts.MrsHeader = mrsHeader;
            }
        }
        public IList <Book.Model.PronoteHeader> Select(Model.MRSHeader mrsheader)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("SELECT w.Workhousename,a.Checkeds,a.InvoiceXOId,a.PronoteHeaderID,a.InvoiceCusId, a.InvoiceXODetailQuantity,a.PronoteDate,a.Pronotedesc,a.MRSHeaderId,a.MRSdetailsId,a.DetailsSum,a.ProductId,a.ProductUnit,a.InvoiceXODetailQuantity,(select  EmployeeName from employee where employee.employeeid=a.Employee0Id) as Employee0Name,(select  EmployeeName from employee where employee.employeeid=a.Employee1Id) as Employee1Name,(select  EmployeeName from employee where employee.employeeid=a.Employee2Id) as Employee2Name,i.CustomerInvoiceXOId,(SELECT CheckedStandard FROM Customer c WHERE c.CustomerId = i.xocustomerId) as CustomerCheckStandard,(SELECT CustomerShortName FROM Customer c WHERE c.CustomerId = i.xocustomerId) as CustomerShortName,b.ProductName,b.id,b.CustomerProductName,b.ProductDescription as ProductDesc FROM PronoteHeader a left join   Product b  on a.productid=b.productid left join invoicexo i on a.invoicexoid=i.invoiceid left join   WorkHouse w  on a.WorkHouseId=w.WorkHouseId");
            sql.Append("  where  a.MRSHeaderId= '" + mrsheader.MRSHeaderId + "'");
            sql.Append(" order by a.PronoteHeaderID desc ");
            return(this.DataReaderBind <Model.PronoteHeader>(sql.ToString(), null, CommandType.Text));

            // return sqlmapper.QueryForList<Book.Model.PronoteHeader>("PronoteHeader.select_bymrsheader", mrsheader.MRSHeaderId);
        }
Beispiel #15
0
 public ListForm(Model.MRSHeader mrsheader)
     : this()
 {
     flag       = 1;
     listDetail = (this.manager as BL.ProduceOtherCompactManager).SelectByMRSHeaderId(mrsheader.MRSHeaderId);
     foreach (Model.ProduceOtherCompact item in listDetail)
     {
         item.Checkeds = true;
     }
     this.bindingSource1.DataSource = listDetail;
 }
Beispiel #16
0
 public ListForm(Model.MRSHeader mrsheader)
     : this()
 {
     flag = 1;
     //listDetail = (this.manager as BL.ProduceOtherCompactManager).SelectByMRSHeaderId(mrsheader.MRSHeaderId);
     //foreach (Model.ProduceOtherCompact item in listDetail)
     //{
     //    item.Checkeds = true;
     //}
     this.mrsheader = mrsheader;
 }
Beispiel #17
0
        /// <summary>
        /// Delete MRSHeader by primary key.
        /// </summary>
        public void Delete(string mRSHeaderID)
        {
            //
            // todo:add other logic here
            //
            Model.MRSHeader model         = this.Get(mRSHeaderID);
            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(mRSHeaderID);
        }
Beispiel #18
0
 public void Delete(Model.MRSHeader mRSHeader)
 {
     //
     // todo:add other logic here
     //
     _ValidateForDelete(mRSHeader);
     try
     {
         BL.V.BeginTransaction();
         this._Delete(mRSHeader);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
Beispiel #19
0
        /// <summary>
        /// Update a MRSHeader.
        /// </summary>
        public void Update(Model.MRSHeader mRSHeader)
        {
            //
            // todo: add other logic here.
            Validate(mRSHeader);
            //if (this.ExistsExcept(mRSHeader))
            //{
            //    throw new Helper.InvalidValueException(Model.MRSHeader.PRO_Id);
            //}
            // mPSheader.UpdateTime = DateTime.Now;
            // accessor.Update(mPSheader);
            if (mRSHeader != null)
            {
                try
                {
                    BL.V.BeginTransaction();
                    //this.Delete(mRSHeader);
                    mRSHeader.UpdateTime = DateTime.Now;
                    //修改头



                    this.UpdateHeader(mRSHeader);
                    //删除详细
                    MRSdetailsAccessor.DeleteByHeader(mRSHeader);
                    //添加详细
                    foreach (Model.MRSdetails item in mRSHeader.Details)
                    {
                        item.MRSHeaderId = mRSHeader.MRSHeaderId;

                        MRSdetailsAccessor.Insert(item);
                    }



                    BL.V.CommitTransaction();
                }
                catch
                {
                    BL.V.RollbackTransaction();
                    throw;
                }
            }
        }
Beispiel #20
0
 private void TiGuiExists(Model.MRSHeader model)
 {
     if (this.ExistsPrimary(model.MRSHeaderId))
     {
         //设置KEY值
         string invoiceKind = this.GetInvoiceKind().ToLower();
         //string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         //string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.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);
         model.MRSHeaderId = this.GetIdSimple(model.InsertTime.Value);
         TiGuiExists(model);
         //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
     }
 }
Beispiel #21
0
 public ListForm(Model.MRSHeader mrsheader)
     : this()
 {
     this._mrsHeader = mrsheader;
 }
Beispiel #22
0
        private void simpleButtonOther_Click(object sender, EventArgs e)
        {
            ProduceOtherCompact.ChooseOutContract f = new ProduceOtherCompact.ChooseOutContract();
            if (f.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            Model.ProduceOtherCompact OtherCompact = f.SelectItem as Model.ProduceOtherCompact;
            if (OtherCompact == null)
            {
                return;
            }

            if (this._produceOtherMaterial.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherMaterial.Details[0].ProductId))
            {
                this._produceOtherMaterial.Details.RemoveAt(0);
            }
            this._produceOtherMaterial.Details.Clear();
            this.textEditOtherCompact.Text      = OtherCompact.ProduceOtherCompactId;
            this.newChooseContorlSipu.EditValue = OtherCompact.Supplier;
            this.textEditCusXOId.Text           = string.Empty;
            if (!string.IsNullOrEmpty(OtherCompact.MRSHeaderId))
            {
                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.textEditCusXOId.Text = invoiceXO == null ? string.Empty : invoiceXO.CustomerInvoiceXOId;
                    }
                }
            }
            //if (ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList.Count == 0) return;
            //if (this._produceOtherInDepot.Details.Count > 0 && string.IsNullOrEmpty(this._produceOtherInDepot.Details[0].ProductId))
            //    this._produceOtherInDepot.Details.RemoveAt(0);
            //this._produceOtherInDepot.Details.Clear();
            //this.textEditOtherCompact.Text = ProduceOtherCompact.ChooseOutContract._OtherCompactDetailList[0].ProduceOtherCompactId;

            //this._produceOtherMaterial.Details = (from p in this.OtherCompactMaterialManager.Select(OtherCompact)
            //           group p by new { p.ProductId, p.ProductUnit } into b
            //           select new Model.ProduceOtherMaterialDetail()
            //           {
            //               ProduceOtherMaterialDetailId = Guid.NewGuid().ToString(),
            //               ProduceOtherCompactMaterialId = (from p in b select p.ProduceOtherCompactMaterialId).ToString(),
            //               ProductId = b.Key.ProductId,
            //               Product = new BL.ProductManager().Get(b.Key.ProductId),
            //               ProductUnit =b.Key.ProductUnit,
            //               OtherMaterialQuantity = (from p in b select p.ProduceQuantity).Sum(),
            //               Description = (from p in b select p.Description).ToString(),
            //           }).ToList();

            foreach (Model.ProduceOtherCompactMaterial item in this.OtherCompactMaterialManager.Select(OtherCompact))
            {
                Model.ProduceOtherMaterialDetail detail = new Model.ProduceOtherMaterialDetail();
                detail.ProduceOtherMaterialDetailId  = Guid.NewGuid().ToString();
                detail.ProduceOtherCompactMaterialId = item.ProduceOtherCompactMaterialId;
                detail.Product               = this.productManager.Get(item.ProductId);
                detail.ProductId             = item.ProductId;
                detail.ProductUnit           = item.ProductUnit;
                detail.OtherMaterialQuantity = item.ProduceQuantity;// - (item.AlreadyOutQuantity == null ? 0 : item.AlreadyOutQuantity);
                if (detail.OtherMaterialQuantity < 0)
                {
                    detail.OtherMaterialQuantity = 0;
                }
                // detail.ProcessPrice = 0;
                detail.Description     = item.Description;
                detail.ParentProductId = item.ParentProductId;
                detail.ParentProduct   = item.ParentProduct;
                detail.ProductStock    = detail.Product.StocksQuantity;

                if (!detail.Product.ProduceMaterialDistributioned.HasValue)
                {
                    detail.Product.ProduceMaterialDistributioned = 0;
                }
                if (!detail.Product.OtherMaterialDistributioned.HasValue)
                {
                    detail.Product.OtherMaterialDistributioned = 0;
                }
                detail.Distributioned = detail.Product.OtherMaterialDistributioned + detail.Product.ProduceMaterialDistributioned;
                detail.Inumber        = this._produceOtherMaterial.Details.Count + 1;
                this._produceOtherMaterial.Details.Add(detail);
            }
            this.gridControl1.RefreshDataSource();
        }
Beispiel #23
0
 public void DeleteByHeader(Model.MRSHeader header)
 {
     sqlmapper.Delete("MRSdetails.DeleteByHeader", header.MRSHeaderId);
 }
Beispiel #24
0
        public override void Refresh()
        {
            if (this._produceOtherCompact == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this._produceOtherCompact = this.produceOtherCompactManager.GetDetails(_produceOtherCompact.ProduceOtherCompactId);
                }
            }

            this.textEditProduceOtherCompactId.Text   = this._produceOtherCompact.ProduceOtherCompactId;
            this.textEditProduceOtherCompactDesc.Text = this._produceOtherCompact.ProduceOtherCompactDesc;
            // this.comboBoxOperationType.SelectedIndex =this._produceOtherCompact.OtherOperationType==null?-1: this._produceOtherCompact.OtherOperationType.Value;
            this.comboBoxProduceType.SelectedIndex = this._produceOtherCompact.OtherProduceType == null ? -1 : this._produceOtherCompact.OtherProduceType.Value;
            this.textEditPaymentCondition.Text     = this._produceOtherCompact.PaymentCondition;
            if (global::Helper.DateTimeParse.DateTimeEquls(this._produceOtherCompact.ProduceOtherCompactDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditProduceOtherCompactDate.EditValue = null;
            }
            else
            {
                this.dateEditProduceOtherCompactDate.EditValue = this._produceOtherCompact.ProduceOtherCompactDate;
            }
            //if (global::Helper.DateTimeParse.DateTimeEquls(this._produceOtherCompact.JiaoHuoDate, global::Helper.DateTimeParse.NullDate))
            //{
            //    this.dateEditJHDate.EditValue = null;
            //}
            //else
            //{
            //    this.dateEditJHDate.EditValue = this._produceOtherCompact.JiaoHuoDate;
            //}


            this.newChooseEmployee0Id.EditValue = this._produceOtherCompact.Employee0;
            this.newChooseEmployee1Id.EditValue = this._produceOtherCompact.Employee1;
            this.newChooseSupplierId.EditValue  = this._produceOtherCompact.Supplier;
            if (!string.IsNullOrEmpty(this._produceOtherCompact.MRSHeaderId))
            {
                Model.MRSHeader mRSHeader = this.mRSHeaderManager.Get(this._produceOtherCompact.MRSHeaderId);
                if (mRSHeader != null)
                {
                    Model.MPSheader mPSheader = this.mPSheaderManager.Get(mRSHeader.MPSheaderId);
                    if (mPSheader != null)
                    {
                        this.textEditCustomerXOId.Text = this.invoiceXOManager.Get(mPSheader.InvoiceXOId) == null ? "" : this.invoiceXOManager.Get(mPSheader.InvoiceXOId).CustomerInvoiceXOId;
                    }
                    else
                    {
                        this.textEditCustomerXOId.Text = string.Empty;
                    }
                }
                else
                {
                    this.textEditCustomerXOId.Text = string.Empty;
                }
            }
            else
            {
                this.textEditCustomerXOId.Text = string.Empty;
            }

            this.textEditAuditState.Text = this.GetAuditName(this._produceOtherCompact.AuditState);
            this.txtLotNumber.Text       = this._produceOtherCompact.LotNumber;

            this.EmpAudit.EditValue = this._produceOtherCompact.AuditEmp;
            this.bindingSourceDetails.DataSource  = this._produceOtherCompact.Details;
            this.bindingSourceMaterial.DataSource = this._produceOtherCompact.DetailMaterial;
            base.Refresh();

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

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

            case "view":
                this.barButtonItemProcedures.Enabled    = false;
                this.gridView1.OptionsBehavior.Editable = false;
                this.gridView2.OptionsBehavior.Editable = false;
                break;
            }

            this.textEditProduceOtherCompactId.Properties.ReadOnly = true;
            this.txtLotNumber.Properties.ReadOnly = true;
        }
Beispiel #25
0
        public OutStockReport(string DepotOutId)
        {
            InitializeComponent();
            this.DepotOut = this.DepotOutManager.Get(DepotOutId);

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

            this.DepotOut.Details = this.DepotOutDetailManager.GetDepotOutDetailByDepotOutId(this.DepotOut.DepotOutId);

            this.DataSource = this.DepotOut.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.DepotOut;
            this.xrLabelPrintDate.Text       = "列表日期:" + DateTime.Now.ToShortDateString();

            this.xrLabelDepotOutId.Text   = this.DepotOut.DepotOutId;
            this.xrLabelDepotOutDate.Text = this.DepotOut.DepotOutDate.Value.ToString("yyyy-MM-dd");
            if (this.DepotOut.Employee != null)
            {
                this.xrLabelEmployeeId.Text = this.DepotOut.Employee.EmployeeName;
            }
            if (this.DepotOut.InvioiceEmployee0 != null)
            {
                this.xrLabelInvoiceEmp0.Text = this.DepotOut.InvioiceEmployee0.EmployeeName;
            }
            if (DepotOut.Depot != null)
            {
                this.xrLabelProduceInDepotId.Text = DepotOut.Depot.DepotName;
            }

            if (this.DepotOut.SourceType == "領料單")
            {
                Model.ProduceMaterial ProduceMaterial = this.produceMaterialManager.Get(this.DepotOut.InvioiceId);
                if (ProduceMaterial != null)
                {
                    //Model.PronoteHeader PronoteHeader = this.pronoteHeaderManager.Get(ProduceMaterial.InvoiceId);
                    //if (PronoteHeader != null)
                    //{
                    Model.InvoiceXO InvoiceXO = this.invoiceXOManager.Get(ProduceMaterial.InvoiceXOId);
                    if (InvoiceXO != null)
                    {
                        this.xrLabelCustomXoId.Text = InvoiceXO.CustomerInvoiceXOId;
                        this.lblPiHao.Text          = InvoiceXO.CustomerLotNumber;
                        this.lblXOCustomer.Text     = InvoiceXO.xocustomer == null ? null : InvoiceXO.xocustomer.ToString();
                    }
                    //if (ProduceMaterial.Employee0 != null)
                    //    this.xrLabelInvoiceEmp0.Text = ProduceMaterial.Employee0.ToString();
                    if (ProduceMaterial.WorkHouse != null)
                    {
                        this.xrLabelWorkHouse.Text = ProduceMaterial.WorkHouse.ToString();
                    }
                    // }
                }
            }


            else if (this.DepotOut.SourceType == "委外領料單")
            {
                Model.ProduceOtherMaterial ProduceOtherMaterial = new BL.ProduceOtherMaterialManager().Get(this.DepotOut.InvioiceId);
                if (ProduceOtherMaterial != null)
                {
                    Model.ProduceOtherCompact ProduceOtherCompact = this.produceOtherCompactManager.Get(ProduceOtherMaterial.ProduceOtherCompactId);
                    if (ProduceOtherCompact != null)
                    {
                        if (!string.IsNullOrEmpty(ProduceOtherCompact.MRSHeaderId))
                        {
                            Model.MRSHeader mRSHeader = this.mRSHeaderManager.Get(ProduceOtherCompact.MRSHeaderId);
                            if (mRSHeader != null)
                            {
                                Model.MPSheader mPSheader = this.mPSheaderManager.Get(mRSHeader.MPSheaderId);
                                if (mPSheader != null)
                                {
                                    Model.InvoiceXO InvoiceXO = this.invoiceXOManager.Get(mPSheader.InvoiceXOId);
                                    if (InvoiceXO != null)
                                    {
                                        this.xrLabelCustomXoId.Text = InvoiceXO.CustomerInvoiceXOId;
                                        this.lblPiHao.Text          = InvoiceXO.CustomerLotNumber;
                                        this.lblXOCustomer.Text     = InvoiceXO.xocustomer == null ? null : InvoiceXO.xocustomer.ToString();
                                    }
                                }
                            }
                        }
                    }
                    if (ProduceOtherMaterial.WorkHouse != null)
                    {
                        this.xrLabelWorkHouse.Text = ProduceOtherMaterial.WorkHouse.ToString();
                    }
                }
            }
            this.txt_ParentProduct.Text  = DepotOut.ParentProduct;
            this.xrLabelXqlu.Text        = DepotOut.SourceType;
            this.xrLabeldescription.Text = DepotOut.description;
            this.xrLabelXgdj.Text        = DepotOut.InvioiceId;
            this.xrTableCellProductId.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Inumber);
            this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            //this.xrTableCellXH.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            this.xrTableCellCount.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_DepotOutDetailQuantity);
            this.xrTableCellUnit.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_ProductUnit);
            this.xrTableCurrentDepotStock.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_CurrentDepotQuantity);
            this.xrTableCell_CurrentStock.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_CurrentStockQuantity);
            this.xrTableCellDepotId.DataBindings.Add("Text", this.DataSource, "DepotPosition." + Model.DepotPosition.PROPERTY_ID);
            //this.xrTableCellSafeStockQuantity.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.Pro_SafeStockQuantity);
            this.TCPihao.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Pihao);
            this.xrRichText1.DataBindings.Add("Rtf", this.DataSource, Model.DepotOutDetail.Pro_ProductDescription);
            //this.TCPihao.DataBindings.Add("Text", this.DataSource, Model.DepotOutDetail.PRO_Pihao);
            this.TCProductCustomerName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_CustomerProductName);
        }
Beispiel #26
0
        public void Insert(Model.MRSHeader mRSHeader)
        {
            //
            // todo:add other logic here
            //
            Validate(mRSHeader);
            if (this.Exists(mRSHeader.Id))
            {
                throw new Helper.InvalidValueException(Model.MRSHeader.PRO_Id);
            }
            try
            {
                mRSHeader.InsertTime = DateTime.Now;

                BL.V.BeginTransaction();
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, mRSHeader.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, mRSHeader.InsertTime.Value.Year, mRSHeader.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, mRSHeader.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);
                if (mRSHeader.Employee0 != null)
                {
                    mRSHeader.Employee0Id = mRSHeader.Employee0.EmployeeId;
                }
                if (mRSHeader.Employee1 != null)
                {
                    mRSHeader.Employee1Id = mRSHeader.Employee1.EmployeeId;
                }
                mRSHeader.InvoiceStatus = 1;



                accessor.Insert(mRSHeader);

                if (mRSHeader.Details != null)
                {
                    foreach (Model.MRSdetails mRSdetails in mRSHeader.Details)
                    {
                        if (string.IsNullOrEmpty(mRSdetails.ProductId))
                        {
                            continue;
                        }
                        mRSdetails.MRSHeaderId = mRSHeader.MRSHeaderId;
                        MRSdetailsAccessor.Insert(mRSdetails);

                        //Model.Product product =ProductAccessor.Get(mRSdetails.ProductId);
                        //if (product.MRSStockQuantity != null )
                        //{
                        //    product.MRSStockQuantity += mRSdetails.Product.StocksQuantity;
                        //    if (product.ProductImage == null)
                        //        product.ProductImage = pic;
                        //    if (product.ProductImage1 == null)
                        //        product.ProductImage1 = pic;
                        //    if (product.ProductImage2 == null)
                        //        product.ProductImage2 = pic;
                        //    if (product.ProductImage3 == null)
                        //        product.ProductImage3 = pic;

                        //    ProductAccessor.Update(product);
                        //}
                    }
                }

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Beispiel #27
0
 public IList <Book.Model.MRSdetails> SelectBySqlMap(Model.MRSHeader mRSheader)
 {
     return(accessor.Select(mRSheader));
 }
Beispiel #28
0
 public void UpdateHeader(Model.MRSHeader mrsHeader)
 {
     accessor.Update(mrsHeader);
 }
Beispiel #29
0
 public IList <Book.Model.PronoteHeader> Select(Model.MRSHeader mrsheader)
 {
     return(accessor.Select(mrsheader));
 }
Beispiel #30
0
 public void _Delete(Model.MRSHeader mRSHeader)
 {
     this.Delete(mRSHeader.MRSHeaderId);
 }