public override void Copy(CostDetail to) { base.Copy(to); RepassRollCostDetail to2 = (RepassRollCostDetail)to; to = to2; }
public override void Copy(CostDetail to) { base.Copy(to); ImplantCostDetail to2 = (ImplantCostDetail)to; to = to2; }
public override void Copy(CostDetail to) { base.Copy(to); PrintingFlatRollCostDetail to2 = (PrintingFlatRollCostDetail)to; to2.BuyingFormat = this.BuyingFormat; to = to2; }
public override void Copy(CostDetail to) { base.Copy(to); PrintedArticleCostDetail to2 = (PrintedArticleCostDetail)to; to2.CostPerUnit = this.CostPerUnit; to2.CostTakenFrom = this.CostTakenFrom; to = to2; }
public override double TransformQuantity(double quantity, CostDetail.QuantityType from) { if (from == CostDetail.QuantityType.MqWorkTypeOfQuantity) { return Math.Floor(quantity / ((Width ?? 0) / 100)); } else { return quantity; } }
public override void Copy(CostDetail to) { base.Copy(to); PrintedSheetArticleCostDetail to2 = (PrintedSheetArticleCostDetail)to; to2.CostPerKg = this.CostPerKg; to2.CostPerSheet = this.CostPerSheet; to = to2; }
public override void Copy(CostDetail to) { base.Copy(to); PrintedRollArticleCostDetail to2 = (PrintedRollArticleCostDetail)to; to2.CostPerMq = this.CostPerMq; to2.CostPerMl = this.CostPerMl; to = to2; }
public override void Copy(CostDetail to) { base.Copy(to); PrintingCostDetail to2 = (PrintingCostDetail)to; to2.PrintingFormat = this.PrintingFormat; to2.HideBuyingInView = this.HideBuyingInView; to2.ForceLateral = this.ForceLateral; to2.Lateral = this.Lateral; to = to2; }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { double ret; //var ret = base.Quantity(qta); //questo dovrebbe far ottenere il costo!!!!!! var extract = _articles.GetArticlesByProductPartPrintableArticle(ProductPart.ProductPartPrintableArticles.FirstOrDefault(x => x.CodProductPartPrintableArticle == this.TaskCost.CodProductPartPrintableArticle)); var article = (SheetPrintableArticle)extract.FirstOrDefault(); double mqMat = 0; double mlMat = 0; double runMat = 0; double kgMat = 0; var thisArticle = ProductPart.ProductPartPrintableArticles.FirstOrDefault(x => x.CodProductPartPrintableArticle == this.TaskCost.CodProductPartPrintableArticle); //devo ottenere i mq totali di materiale stampato ed uso un trucco... voglio il numero di fogli... lo moltiplico per la resa del materiale e per i mq var lastTypeOfQuantity = ComputedBy.TypeOfQuantity; ComputedBy.TypeOfQuantity = 0; mqMat = ComputedBy.QuantityMaterial(qta) * (GainForRunForPrintableArticle ?? 1) * ComputedBy.ProductPartPrinting.PrintingFormat.GetSide1() * ComputedBy.ProductPartPrinting.PrintingFormat.GetSide2() / 10000; ComputedBy.TypeOfQuantity = lastTypeOfQuantity; mlMat = mqMat / (ComputedBy.ProductPartPrinting.PrintingFormat.GetSide1() / 100); runMat = ComputedBy.QuantityMaterial(qta) / (double)this.ComputedBy.GainPrintingOnBuying.Makereadies.Average(x => x.CalculatedGain ?? 1); kgMat = mqMat * thisArticle.Weight ?? 0; kgMat /= 1000; this.CalculatedMq = mqMat; this.CalculatedMl = mlMat; this.CalculatedKg = kgMat; this.CalculatedRun = runMat; switch ((QuantityType)(TypeOfQuantity ?? 0)) { case QuantityType.MqWorkTypeOfQuantity: ret = Math.Ceiling(mqMat); break; case QuantityType.NumberTypeOfQuantity: case QuantityType.RunTypeOfQuantity: ret = Math.Ceiling(runMat); break; default: ret = base.Quantity(qta); break; } return ret; }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { if (TypeOfQuantity == (int)CostDetail.QuantityType.NumberTypeOfQuantity) { return Math.Ceiling((GainForRun ?? 0) * 100) / 100; } //colori * mq f.to stampa if (TypeOfQuantity == (int)CostDetail.QuantityType.NColorPerMqTypeOfQuantity) { // var x= (GainForRun ?? 0) * (GainForMqRun ?? 0); return GainForRun ?? 0; //GainForRum -> numero impianti } return 0; }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; double quantita = 0; int typeOfQ = 0; if (Printers != null) { foreach (var item in Printers) { quantita = item.Quantity(qta, CostDetail.QuantityType.RunLengthMlTypeOfQuantity); //quantita += item.TaskCost.Quantity ?? 0; this.TypeOfQuantity = (Nullable<int>) CostDetail.QuantityType.RunLengthMlTypeOfQuantity; //TaskexEcutorSelected.TypeOfQuantity??0; //item.TypeOfQuantity; } } return quantita; }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; var ret = base.Quantity(qta, type); //questo dovrebbe far ottenere il costo!!!!!! var extract = _articles.GetArticlesByProductPartPrintableArticle(ProductPart.ProductPartPrintableArticles.FirstOrDefault(x => x.CodProductPartPrintableArticle == this.TaskCost.CodProductPartPrintableArticle)); var article = (RigidPrintableArticle)extract.FirstOrDefault(); if (article.FromMinFormat != null) { var to = article.FromMinFormat.GetSide1() * article.FromMinFormat.GetSide1() / 10000; ret = ret <= to ? to : ret; } if (article.ToNexMq??false) { ret = Math.Ceiling(ret); } return ret; }
private void SaveCostDetailInDictionary(CostDetail c) { CheckExistDic(); CostDetail val; if (CostDetailsDic.TryGetValue(c.CodCostDetail, out val)) { // yay, value exists! CostDetailsDic[c.CodCostDetail] = c; } else { // darn, lets add the value CostDetailsDic.Add(c.CodCostDetail, c); } //aggiorno anche il costdetail con il riferimento!!! var x = GetCostFromDictionary(c.CodCost); if (x != null) { if (!x.CostDetails.Select(s => s.CodCost).Contains(c.CodCost)) { x.CostDetails.Add(c); } else { var extract = x.CostDetails.Single(s => s.CodCost == c.CodCost); x.CostDetails.Remove(extract); x.CostDetails.Add(c); } c.TaskCost = x; } }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; if (TaskexEcutorSelected == null) { UpdateCoeff(); } double ret; double mqMat = 0; double mlMat = 0; double runMat = 0; double kgMat = 0; //calcoli per mt lineari!!!!!!!! Nullable<long> paperFirstStartLenght;// = ((Flexo)TaskexEcutorSelected).PaperFirstStartLenght; Nullable<long> paperSecondStartLenght;// = ((Flexo)TaskexEcutorSelected).PaperSecondStartLenght; if (TaskexEcutorSelected.TypeOfExecutor == TaskExecutor.ExecutorType.Flexo) { paperFirstStartLenght = ((Flexo)TaskexEcutorSelected).PaperFirstStartLenght; paperSecondStartLenght = ((Flexo)TaskexEcutorSelected).PaperSecondStartLenght; } else { paperFirstStartLenght = 0; paperSecondStartLenght = 0; } var runs = Math.Ceiling(QuantityProp * this.GainForRun ?? 0); var mtRuns = runs * PrintingFormat.GetSide2() / 100; var mtWaste = (paperFirstStartLenght ?? 0) + (RollChanges * paperSecondStartLenght ?? 0); mlMat = Math.Ceiling(mtRuns + mtWaste); CalculatedMl = mlMat; mqMat = Math.Ceiling(base.Quantity(qta)); CalculatedMq = mqMat; kgMat = 0; CalculatedKg = kgMat; CalculatedRun = runs; switch ((QuantityType)(typeOfQuantity ?? 0)) { case QuantityType.MqWorkTypeOfQuantity: ret = Math.Ceiling(base.Quantity(qta)); break; case QuantityType.RunLengthMlTypeOfQuantity: //calcoli per mt lineari!!!!!!!! ret = mlMat; break; default: ret = base.Quantity(qta, type); break; } return ret; }
public virtual double QuantityMaterial(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { double ret; var typeOfQuantity = type==CostDetail.QuantityType.NOTypeOfQuantity? TypeOfQuantity:(Nullable<int>)type; switch ((QuantityType)(typeOfQuantity ?? 0)) { case QuantityType.RunTypeOfQuantity: ret = Math.Ceiling(qta * this.GainForRunForPrintableArticle ?? 0); break; case QuantityType.MqWorkTypeOfQuantity: //se la lavorazione è prezzata a mq allora devo moltiplicare per i mq ret = Math.Truncate(1000 * qta * (this.GainForMqRunForPrintableArticle ?? 0)) / 1000; break; case QuantityType.WeigthTypeOfQuantity: ret = Math.Ceiling(qta * this.GainForRunForPrintableArticle ?? 0); break; case QuantityType.NColorPerMqTypeOfQuantity: //se la lavorazione è prezzata a mq allora devo moltiplicare per i mq ret = Math.Truncate(1000 * qta * (this.GainForMqRunForPrintableArticle ?? 0)) / 1000; break; default: ret = Math.Ceiling(qta * this.GainForRunForPrintableArticle ?? 0); break; } return ret; }
public virtual void Copy(CostDetail to) { to.TimeStampTable = this.TimeStampTable; to.CodCostDetail = this.CodCostDetail; to.CodTaskExecutorSelected = this.CodTaskExecutorSelected; to.CodCost = null; to.CodProductPart = this.CodProductPart; to.CodComputedBy = this.CodComputedBy; to.Starts = this.Starts; // to. = this.Washes; to.GainForRun = this.GainForRun; to.GainForRunForPrintableArticle = this.GainForRunForPrintableArticle; to.GainForMqRun = this.GainForMqRun; to.GainForMqRunForPrintableArticle = this.GainForMqRunForPrintableArticle; to.TypeOfQuantity = this.TypeOfQuantity; to.GainForWeigthRun = this.GainForWeigthRun; to.GainForWeigthRunForPrintableArticle = this.GainForWeigthRunForPrintableArticle; to.Error = this.Error; to.Guid = this.Guid; to.RollChanges = this.RollChanges; to.CalculatedMl = this.CalculatedMl; to.CalculatedMq = this.CalculatedMq; to.CalculatedKg = this.CalculatedKg; to.CalculatedRun = this.CalculatedRun; to.Implants = this.Implants; // public virtual Cost TaskCost = this. to.ProductPart = this.ProductPart; to.TaskexEcutorSelected = this.TaskexEcutorSelected; to.Computes = null; to.ComputedBy = null; if (ProductPartPrinting != null) { to.ProductPartPrinting = (ProductPartPrinting)ProductPartPrinting.Clone(); // to.ProductPartPrinting.CostDetail = to; } if (GainPrintingOnBuying != null) { var x = (ProductPartPrintingGain)GainPrintingOnBuying.Clone(); // x.CostDetail = to; to.GainPrintingOnBuying = x; } to.TaskCost = null; }
public override void Copy(CostDetail to) { base.Copy(to); PrePostPressCostDetail to2 = (PrePostPressCostDetail)to; to2.WorkingFormat = this.WorkingFormat; to = to2; }
public void InitPrinters(CostDetail cv) { //TEMPORANEOOOOOOOOO //devo collegare anche i costi di stampa per reperire alcune unformazioni ultili ai calcoli!!! if (cv.TypeOfCostDetail == CostDetail.CostDetailType.ControlTableCostDetail || cv.TypeOfCostDetail == CostDetail.CostDetailType.PrePostPressCostDetail || cv.TypeOfCostDetail == CostDetail.CostDetailType.RepassRollCostDetail) { cv.CodPartPrintingCostDetail = DocumentRepository.GetCostsByCodDocumentProduct(cv.TaskCost.CodDocumentProduct).Where(y => y.CodItemGraph == "ST").Select(z => z.CodCost); var items = cv.CodPartPrintingCostDetail.ToList(); if (items != null) { foreach (var item in items) { var cv2 = GetCostDetailFromDictionary(item); if (!cv.Printers.Select(x => x.CodCost).Contains(cv2.CodCost)) { if (!cv.Printers.Select(x=>x.CodCostDetail).Contains(cv2.CodCostDetail)) { cv.Printers.Add(cv2); cv2.InitCostDetail(TaskExecutorRepository.GetAll(), ArticleRepository.GetAll()); } } } } } }
void ReLink(CostDetail cv) { if (cv != null) if (cv.TaskCost == null) { cv.TaskCost = GetCostFromDictionary(cv.CodCost); cv.ProductPart = GetProductPartFromDictionary(cv.CodProductPart); cv.TaskexEcutorSelected = GetTaskExecutorFromDictionary(cv.CodTaskExecutorSelected); foreach (var c in cv.Computes) { ReLink(c); } ReLink(cv.ComputedBy); } }
public CostDetail SaveCostDetailFromController(CostDetail cv) { //venedo da un controller non ho i costdetail e i cost inizializzati... per cui //devo ottenere il CodDocumentProduct e poi inizializzare e salvare InitCostDocumentProduct(cv.TaskCost.CodDocumentProduct); SaveCostDetailLocally(cv, new Guid()); SaveCostDetailOnDisk(); return cv; }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { double ret; var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; double quantita = 0; quantita = Math.Ceiling(qta * (GainForRun ?? 1)); return quantita; }
public virtual Double TransformQuantity(double quantity, CostDetail.QuantityType from) { throw new NotImplementedException(); }
public override void Copy(CostDetail to) { base.Copy(to); }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; double ret = 0; switch ((QuantityType)(TypeOfQuantity ?? 0)) { case QuantityType.MqWorkTypeOfQuantity: ret = base.Quantity(qta); break; default: ret = base.Quantity(qta); break; } return ret; }
void RemoveLink(CostDetail cv) { if (cv != null) { cv.CostDetailCostCodeRigen(); if (cv.TaskCost != null) { cv.CodCost = cv.TaskCost.CodCost; cv.TaskCost = null; if (cv.ProductPart != null) { cv.CodProductPart = cv.ProductPart.CodProductPart; SaveProductPartInDictionary(cv.ProductPart); cv.ProductPart = null; } if (cv.TaskexEcutorSelected != null) { SaveTaskExecutorInDictionary(cv.TaskexEcutorSelected); cv.TaskexEcutorSelected = null; } foreach (var c in cv.Computes) { RemoveLink(c); } RemoveLink(cv.ComputedBy); } } }
public void SaveCostDetailAutomatically(CostDetail cv) { //try //{ var pPart = cv.ProductPart; // var prod = productRepository.GetSingle(pPart.Product.CodProduct); switch (cv.TypeOfCostDetail) { //if it is a printing... we have to case CostDetail.CostDetailType.PrintingSheetCostDetail: if (cv.Computes.Count == 0) { var costs = DocumentRepository.GetCostsByCodDocumentProduct(cv.TaskCost.CodDocumentProduct); var temp = costs.ToList(); List<PrintedArticleCostDetail> x = ((PrintingCostDetail)cv).GetRelatedPrintedCostDetail(ArticleRepository.GetAll(), costs); foreach (var item in x) { item.ComputedBy = cv; item.InitCostDetail(null, ArticleRepository.GetAll()); //item.UpdateCost(); //item.GetCostFromList(articleRepository.GetAll()); CostDetailRepository.Add(item); } } CostDetailRepository.Add(cv); CostDetailRepository.Save(); //aggiorna il costo rigenerando prima i coefficienti var inizio = DateTime.Now; UpdateCost(cv.CodCost); var tempo = DateTime.Now.Subtract(inizio); Console.Write(tempo); break; case CostDetail.CostDetailType.PrintingRollCostDetail: break; case CostDetail.CostDetailType.PrintedSheetArticleCostDetail: break; case CostDetail.CostDetailType.PrintedRollArticleCostDetail: break; default: break; } }
public void SaveCostDetailLocally(CostDetail cv, Guid guid) { if (cv != null) { var pPart = cv.ProductPart; switch (cv.TypeOfCostDetail) { //if it is a printing... we have to case CostDetail.CostDetailType.PrintingFlatRollCostDetail: case CostDetail.CostDetailType.PrintingZRollCostDetail: case CostDetail.CostDetailType.PrintingSheetCostDetail: case CostDetail.CostDetailType.PrintingRollCostDetail: case CostDetail.CostDetailType.RepassRollCostDetail: case CostDetail.CostDetailType.PrePostPressCostDetail: if (cv.Computes.Count == 0) { // var tempCost = DocumentCostsDic.ToList().Select(y => y.Value); List<CostDetail> x = cv.CreateRelatedPrintedCostDetail(ArticleRepository.GetAll(), tempCost.AsQueryable()).Union( cv.GetRelatedImplantCostDetail(cv.TaskCost.CodProductPartTask, tempCost.AsQueryable())).ToList(); foreach (var item in x) { item.ComputedBy = cv; item.InitCostDetail(TaskExecutorRepository.GetAll(), ArticleRepository.GetAll()); if (!CostDetailIsJustSaved(item.CodCostDetail, guid)) { SaveCostDetailInDictionary(item); } } } //cv.TaskCost = null; SaveCostDetailInDictionary(cv); //aggiorna il costo rigenerando prima i coefficienti var inizio = DateTime.Now; // UpdateCost(cv.CodCostDetail); var tempo = DateTime.Now.Subtract(inizio); Console.Write(tempo); break; case CostDetail.CostDetailType.ControlTableCostDetail: SaveCostDetailInDictionary(cv); //CostDetailRepository.Add(cv); //CostDetailRepository.Save(); //aggiorna il costo rigenerando prima i coefficienti // UpdateCost(cv.CodCostDetail); break; case CostDetail.CostDetailType.PrintedSheetArticleCostDetail: break; case CostDetail.CostDetailType.PrintedRollArticleCostDetail: break; default: break; } } }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { double ret; var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; try { var extract = _articles.GetArticlesByProductPartPrintableArticle(ProductPart.ProductPartPrintableArticles.FirstOrDefault(x => x.CodProductPartPrintableArticle == this.TaskCost.CodProductPartPrintableArticle)); var article = (RollPrintableArticle)extract.FirstOrDefault(); } catch (Exception) { return 0; } //var ret = base.Quantity(qta); //questo dovrebbe far ottenere il costo!!!!!! double mqMat = 0; double mlMat = 0; double runMat = 0; double kgMat = 0; var thisArticle= ProductPart.ProductPartPrintableArticles.FirstOrDefault(x => x.CodProductPartPrintableArticle == this.TaskCost.CodProductPartPrintableArticle); if ((QuantityType)(ComputedBy.TypeOfQuantity ?? 0) == QuantityType.RunLengthMlTypeOfQuantity) { //prendo i ml li moltiplico per la banda mqMat = ComputedBy.Quantity(qta) * ComputedBy.ProductPartPrinting.PrintingFormat.GetSide1() / 100; mlMat = ComputedBy.Quantity(qta); } else { //devo ottenere i mq totali di materiale stampato ed uso un trucco... voglio il numero di fogli... lo moltiplico per la resa del materiale e per i mq var lastTypeOfQuantity = ComputedBy.TypeOfQuantity; ComputedBy.TypeOfQuantity = 0; mqMat = ComputedBy.Quantity(qta) * (GainForRunForPrintableArticle ?? 1) * ComputedBy.ProductPartPrinting.PrintingFormat.GetSide1() * ComputedBy.ProductPartPrinting.PrintingFormat.GetSide2() / 10000; ComputedBy.TypeOfQuantity = lastTypeOfQuantity; mlMat = mqMat / (ComputedBy.ProductPartPrinting.PrintingFormat.GetSide1() / 100); } kgMat = mqMat * thisArticle.Weight ?? 0; kgMat /= 1000; this.CalculatedMq = mqMat; this.CalculatedMl = mlMat; this.CalculatedKg = kgMat; this.CalculatedRun = runMat; switch ((QuantityType)(TypeOfQuantity ?? 0)) { case QuantityType.MqWorkTypeOfQuantity: ret = Math.Ceiling(mqMat); break; default: ret = base.Quantity(qta); break; } return ret; }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; //mi serve calcolare la quantità con gli scarti!!! if (TaskexEcutorSelected == null) { UpdateCoeff(); } double ret; double mqMat = 0; double mlMat = 0; double runMat = 0; double kgMat = 0; Nullable<long> proof1 = 0; Nullable<long> proof2 = 0; try { proof1 = ((PrinterMachine)TaskexEcutorSelected).ProofSheetFirstStart; proof2 = ((PrinterMachine)TaskexEcutorSelected).ProofSheetSecondsStart; } catch (Exception) { } var runs = Math.Ceiling(QuantityProp * this.GainForRun ?? 0); var waste = (proof1 ?? 0) + ((Starts - 1) * proof2 ?? 0); CalculatedMl = 0; mqMat = Math.Ceiling((runs + waste) * ProductPart.Format.GetSide1() * ProductPart.Format.GetSide2() / 10000); CalculatedMq = mqMat; kgMat = 0; CalculatedKg = kgMat; CalculatedRun = runs + waste; switch ((QuantityType)(TypeOfQuantity ?? 0)) { case QuantityType.RunTypeOfQuantity: ret = CalculatedRun ?? 0; break; default: ret = base.Quantity(qta); break; } return ret; }
public override double Quantity(double qta, CostDetail.QuantityType type = CostDetail.QuantityType.NOTypeOfQuantity) { double ret; var typeOfQuantity = type == CostDetail.QuantityType.NOTypeOfQuantity ? TypeOfQuantity : (Nullable<int>)type; double quantita = 0; if (Printers != null) { foreach (var item in Printers) { quantita += item.TaskCost.QuantityMaterial ?? 0; this.TypeOfQuantity = item.TypeOfQuantity; } } if (true) { return quantita / (GainForRun ?? 1); } }