public TransportationOrder CreateTransportationOrder(string route, IList <InProcessLocation> ipList, User user) { if (ipList == null || ipList.Count == 0) { throw new BusinessErrorException("TransportationOrder.Error.DetailEmpty"); } #region 初始化订单头 TransportationOrder orderHead = new TransportationOrder(); orderHead.OrderNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_TRANSPORTATION_ORDER); orderHead.TransportationRoute = transportationRouteMgr.LoadTransportationRoute(route); orderHead.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; orderHead.CreateDate = DateTime.Now; orderHead.CreateUser = user; orderHead.LastModifyUser = user; orderHead.LastModifyDate = DateTime.Now; #endregion #region 创建订单 CreateTransportationOrder(orderHead); #endregion #region 创建OrderDetail foreach (InProcessLocation ip in ipList) { TransportationOrderDetail orderDetail = new TransportationOrderDetail(); orderDetail.InProcessLocation = ip; orderDetail.TransportationOrder = orderHead; transportationOrderDetailMgr.CreateTransportationOrderDetail(orderDetail); //更新ip ip.IsReferenced = true; inProcessLocationMgr.UpdateInProcessLocation(ip); } #endregion return(orderHead); }
private void PrintASN(Resolver resolver, string[] region) { DetachedCriteria criteria = DetachedCriteria.For(typeof(InProcessLocation)); criteria.Add(Expression.Eq("IsPrinted", false)); criteria.Add(Expression.Eq("NeedPrintAsn", true)); criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)); criteria.Add(Expression.Or(Expression.Eq("OrderType", BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION), Expression.Eq("OrderType", BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER))); criteria.Add(Expression.In("PartyFrom.Code", region)); IList <InProcessLocation> inProcessLocationList = criteriaMgr.FindAll <InProcessLocation>(criteria); List <ReceiptNote> receiptNotes = new List <ReceiptNote>(); if (inProcessLocationList != null && inProcessLocationList.Count > 0) { foreach (InProcessLocation inProcessLocation in inProcessLocationList) { IList <object> list = new List <object>(); list.Add(inProcessLocation); list.Add(inProcessLocation.InProcessLocationDetails); string newUrl = reportMgr.WriteToFile(inProcessLocation.AsnTemplate, list); inProcessLocation.IsPrinted = true;//to be refactored inProcessLocationMgr.UpdateInProcessLocation(inProcessLocation); ReceiptNote receiptNote = InProcessLocation2ReceiptNote(inProcessLocation); receiptNote.PrintUrl = newUrl; receiptNotes.Add(receiptNote); } } if (resolver.ReceiptNotes == null) { resolver.ReceiptNotes = receiptNotes; } else { IListHelper.AddRange <ReceiptNote>(resolver.ReceiptNotes, receiptNotes); } }
protected override bool FillValuesImpl(String templateFileName, IList <object> list) { try { if (list == null || list.Count < 2) { return(false); } InProcessLocation inProcessLocation = (InProcessLocation)list[0]; IList <InProcessLocationDetail> inProcessLocationDetailList = (IList <InProcessLocationDetail>)list[1]; if (inProcessLocation == null || inProcessLocationDetailList == null || inProcessLocationDetailList.Count == 0) { return(false); } //ASN号: List <Transformer> transformerList = Utility.TransformerHelper.ConvertInProcessLocationDetailsToTransformers(inProcessLocationDetailList); this.CopyPage(transformerList.Count); this.FillHead(inProcessLocation); int pageIndex = 1; int rowIndex = 0; int rowTotal = 0; foreach (Transformer transformer in transformerList) { //零件号 this.SetRowCell(pageIndex, rowIndex, 1, transformer.ItemCode); //客户零件号 //IList<ItemReference> referenceItemList = itemReferenceMgr.GetItemReference(transformer.ItemCode); //if (referenceItemList != null && referenceItemList.Count > 0) //{ // this.SetRowCell(pageIndex, rowIndex, 2, referenceItemList[0].ReferenceCode); //} this.SetRowCell(pageIndex, rowIndex, 2, transformer.ReferenceItemCode); //零件名称 this.SetRowCell(pageIndex, rowIndex, 3, transformer.ItemDescription); //库位 this.SetRowCell(pageIndex, rowIndex, 4, transformer.LocationFromCode); //包装箱 类型 //this.SetRowCell(pageIndex, rowIndex, 5, transformer.Cartons.ToString("0.########")); //长 //宽 //高 //单位 this.SetRowCell(pageIndex, rowIndex, 9, transformer.UomCode); //实送数量 this.SetRowCell(pageIndex, rowIndex, 10, transformer.Qty.ToString("0.########")); //实收数量 //装箱数(transformer.Qty / transformer.UnitCount).ToString("0.########") this.SetRowCell(pageIndex, rowIndex, 12, (transformer.Qty / transformer.UnitCount).ToString("0.########")); //件箱数 //单价 //总金额 //备注 if (this.isPageBottom(rowIndex, rowTotal))//页的最后一行 { //承运经办人 //发货人 //收货经办人 //送货日期 //送货日期 //出门日期 //执勤门卫 //客户代码 this.SetRowCell(pageIndex, this.pageDetailRowCount + 4, 10, inProcessLocation.PartyTo == null ? string.Empty : inProcessLocation.PartyTo.Code); //开单人 this.SetRowCell(pageIndex, this.pageDetailRowCount + 6, 1, inProcessLocation.CreateUser.Name); //开单日期 this.SetRowCell(pageIndex, this.pageDetailRowCount + 6, 3, inProcessLocation.CreateDate.ToString("yyyy MM dd")); this.sheet.SetRowBreak(this.GetRowIndexAbsolute(pageIndex, this.pageDetailRowCount + this.bottomRowCount - 1)); pageIndex++; rowIndex = 0; } else { rowIndex++; } rowTotal++; } this.sheet.DisplayGridlines = false; this.sheet.IsPrintGridlines = false; //打印标记 if (inProcessLocation.IsPrinted == null || inProcessLocation.IsPrinted == false) { inProcessLocation.IsPrinted = true; } inProcessLocation.PrintCount += 1; inProcessLocationMgr.UpdateInProcessLocation(inProcessLocation); } catch (Exception) { return(false); } return(true); }
protected override bool FillValuesImpl(String templateFileName, IList <object> list) { try { if (list == null || list.Count < 2) { return(false); } InProcessLocation inProcessLocation = (InProcessLocation)list[0]; IList <InProcessLocationDetail> inProcessLocationDetailList = (IList <InProcessLocationDetail>)list[1]; if (inProcessLocation == null || inProcessLocationDetailList == null || inProcessLocationDetailList.Count == 0) { return(false); } //this.SetRowCellBarCode(0, 2, 5); List <Transformer> transformerList = Utility.TransformerHelper.ConvertInProcessLocationDetailsToTransformers(inProcessLocationDetailList); this.barCodeFontName = this.GetBarcodeFontName(2, 5); this.CopyPage(transformerList.Count); this.FillHead(inProcessLocation); int pageIndex = 1; int rowIndex = 0; int rowTotal = 0; //ASN号: // List<Transformer> transformerList = Utility.TransformerHelper.ConvertInProcessLocationDetailsToTransformers(inProcessLocationDetailList); foreach (Transformer transformer in transformerList) { OrderHead orderHead = orderHeadMgr.LoadOrderHead(transformer.OrderNo); //订单号 (销售发运显示客户订单号,其它为订单号) if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION) { this.SetRowCell(pageIndex, rowIndex, 0, orderHead.ExternalOrderNo); } else { this.SetRowCell(pageIndex, rowIndex, 0, orderHead.OrderNo); } //序号. this.SetRowCell(pageIndex, rowIndex, 1, transformer.Sequence.ToString()); //"零件号Item Code" this.SetRowCell(pageIndex, rowIndex, 2, transformer.ItemCode); //"参考号Ref No." //this.SetRowCell(pageIndex, rowIndex, 3, orderDetail.ReferenceItemCode); //"描述Description" this.SetRowCell(pageIndex, rowIndex, 3, transformer.ItemDescription); //"单位Unit" this.SetRowCell(pageIndex, rowIndex, 4, transformer.UomCode); //"单包装UC" this.SetRowCell(pageIndex, rowIndex, 5, transformer.UnitCount.ToString("0.########")); //发货 Delivery 包装 int UCs = (int)Math.Ceiling(transformer.Qty / transformer.UnitCount); this.SetRowCell(pageIndex, rowIndex, 6, UCs.ToString()); //发货 Delivery 发货数 this.SetRowCell(pageIndex, rowIndex, 7, transformer.Qty.ToString("0.########")); //实收 Received 包装 //this.SetRowCell(pageIndex, rowIndex, 8, ""); //实收 Received 零件数 //this.SetRowCell(pageIndex, rowIndex, 9, ""); if (this.isPageBottom(rowIndex, rowTotal))//页的最后一行 { //实际到货时间: //this.SetRowCell(pageIndex, rowIndex, , ""); pageIndex++; rowIndex = 0; } else { rowIndex++; } rowTotal++; } this.sheet.DisplayGridlines = false; this.sheet.IsPrintGridlines = false; if (inProcessLocation.IsPrinted == null || inProcessLocation.IsPrinted == false) { inProcessLocation.IsPrinted = true; } inProcessLocation.PrintCount += 1; inProcessLocationMgr.UpdateInProcessLocation(inProcessLocation); } catch (Exception) { return(false); } return(true); }