private void btn_repack_Click(object sender, RoutedEventArgs e) { Repack Page = new Repack(); this.FinposContainer.Navigate(Page); e.Handled = true; }
public void CreateRepack(Resolver resolver) { IList <RepackDetail> repackDetailList = executeMgr.ConvertTransformerListToRepackDetail(resolver.Transformers); if (repackDetailList.Count == 0) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } Repack repack = repackMgr.CreateRepack(repackDetailList, userMgr.LoadUser(resolver.UserCode, false, true)); resolver.Code = repack.RepackNo; resolver.Transformers = null; resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL; resolver.Result = languageMgr.TranslateMessage("MasterData.Inventory.Repack.Successfully", resolver.UserCode); #region 打印 if (resolver.IsCSClient) { IList <Hu> huList = new List <Hu>(); repack = repackMgr.LoadRepack(resolver.Code, true); foreach (RepackDetail repackDet in repack.RepackDetails) { if (repackDet.IOType == BusinessConstants.IO_TYPE_OUT && repackDet.LocationLotDetail.Hu != null && repackDet.LocationLotDetail.Hu.PrintCount == 0) { huList.Add(repackDet.LocationLotDetail.Hu); } } resolver.PrintUrl = PrintHu(huList, resolver.UserCode); } #endregion }
public void InitPageParameter(string repackNo) { IList <TransformerDetail> repackDetailInList = new List <TransformerDetail>(); IList <TransformerDetail> repackDetailOutList = new List <TransformerDetail>(); if (repackNo != string.Empty) { Repack repack = TheRepackMgr.LoadRepack(repackNo, true); IList <TransformerDetail> transformerDetailList = TransformerHelper.ConvertRepackDetailListToTransformerDetailList(repack.RepackDetails); foreach (TransformerDetail transformerDetail in transformerDetailList) { if (transformerDetail.IOType == BusinessConstants.IO_TYPE_IN) { repackDetailInList.Add(transformerDetail); } else if (transformerDetail.IOType == BusinessConstants.IO_TYPE_OUT) { repackDetailOutList.Add(transformerDetail); } } } this.GV_InList.DataSource = repackDetailInList; this.GV_InList.DataBind(); this.GV_OutList.DataSource = repackDetailOutList; this.GV_OutList.DataBind(); }
public Repack LoadRepack(String repackNo, bool includeDetail) { Repack repack = this.LoadRepack(repackNo); if (includeDetail && repack.RepackDetails != null && repack.RepackDetails.Count > 0) { } return(repack); }
public void InitPageParameter(string repackNo) { Repack repack = TheRepackMgr.LoadRepack(repackNo); this.lbRepackNo.Text = repack.RepackNo; this.lbCreateUser.Text = repack.CreateUser.Name; this.lbCreateDate.Text = repack.CreateDate.ToString("yyyy-MM-dd"); this.lblRepackNo.Text = RepackHelper.GetRepackLabel(this.RepackType, true); }
private ReceiptNote Repack2ReceiptNote(Repack repack) { ReceiptNote receiptNote = new ReceiptNote(); receiptNote.OrderNo = repack.RepackNo; receiptNote.CreateDate = repack.CreateDate; receiptNote.CreateUser = repack.CreateUser == null ? string.Empty : repack.CreateUser.Code; return(receiptNote); }
protected void btnPrint_Click(object sender, EventArgs e) { string repackNo = this.lbRepackNo.Text; IList <object> list = new List <object>(); Repack repack = TheRepackMgr.LoadRepack(repackNo, true); list.Add(repack); string printUrl = TheReportMgr.WriteToFile("Repack.xls", list); Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + printUrl + "'); </script>"); }
public override IList <object> GetDataList(string code) { IList <object> list = new List <object>(); Repack repack = repackMgr.LoadRepack(code, true); if (repack != null) { list.Add(repack); } return(list); }
void Ribbon_RepackClicked() { lock (multiBoard) { Repack r = new Repack(); r.ShowDialog(); } if (Program.Restarting && CloseRequested != null) { CloseRequested.Invoke(); } }
/* * 填充报表头 * * Param repack 翻箱头对象 */ private void FillHead(Repack repack) { string repackCode = Utility.BarcodeHelper.GetBarcodeStr(repack.RepackNo, this.barCodeFontName); //翻箱单号 this.SetRowCell(2, 6, repackCode); //翻箱单号 this.SetRowCell(3, 6, repack.RepackNo); //翻箱人 Create User: this.SetRowCell(5, 1, repack.CreateUser.Name); //翻箱时间 this.SetRowCell(5, 7, repack.CreateDate.ToString("yyyy-MM-dd HH:mm")); }
/// <summary> /// Start a task to repack all selected paks. /// </summary> /// <param name="waitTask">Wait for the task to finish.</param> public static void InitRepacking(bool waitTask = false) { if (IsWorking) { return; } else { Repack?.Dispose(); Repack = new Repack(); if (waitTask) { Repack.Task.Wait(); } } }
private void CreateRepack(Resolver resolver) { string[] huIdArr = resolver.Input.Split(','); List <ReceiptNote> receiptNotes = new List <ReceiptNote>(); foreach (string huId in huIdArr) { try { IList <RepackDetail> repackDetailList = new List <RepackDetail>(); LocationLotDetail locationLotDetail = locationLotDetailMgr.CheckLoadHuLocationLotDetail(huId); RepackDetail inRepackDetail = new RepackDetail(); inRepackDetail.LocationLotDetail = locationLotDetail; inRepackDetail.Hu = locationLotDetail.Hu; inRepackDetail.IOType = BusinessConstants.IO_TYPE_IN; inRepackDetail.Qty = inRepackDetail.Hu.Qty * inRepackDetail.Hu.UnitQty; repackDetailList.Add(inRepackDetail); RepackDetail outRepackDetail = new RepackDetail(); outRepackDetail.itemCode = inRepackDetail.Hu.Item.Code; outRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT; outRepackDetail.Qty = inRepackDetail.Qty; repackDetailList.Add(outRepackDetail); Repack repack = repackMgr.CreateDevanning(repackDetailList, userMgr.CheckAndLoadUser(resolver.UserCode)); ReceiptNote receiptNote = Repack2ReceiptNote(repack); receiptNotes.Add(receiptNote); } catch (Exception ex) { continue; } } if (resolver.ReceiptNotes == null) { resolver.ReceiptNotes = receiptNotes; } else { IListHelper.AddRange <ReceiptNote>(resolver.ReceiptNotes, receiptNotes); } }
public void CreateDevanning(Resolver resolver) { IList <RepackDetail> repackDetailList = executeMgr.ConvertTransformerListToRepackDetail(resolver.Transformers); if (repackDetailList.Count == 0) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } //KSS 客户化需求, 拆箱并上架 foreach (RepackDetail repackDetail in repackDetailList) { repackDetail.StorageBinCode = resolver.BinCode; } Repack repack = repackMgr.CreateDevanning(repackDetailList, this.userMgr.LoadUser(resolver.UserCode, false, true)); resolver.Code = repack.RepackNo; resolver.Result = languageMgr.TranslateMessage("MasterData.Inventory.Devanning.Successfully", resolver.UserCode, resolver.Transformers[0].TransformerDetails[0].HuId); resolver.Transformers = null; }
public void SaveUpdateRepackitems(List <RepackModel> model) { try { List <Repack> insertRepackItem = new List <Repack>(); model?.ForEach(x => { Repack updateStock = new Repack(0, x.BulkCode, x.ProductCode, x.Quantity, x.CreatedBy, string.Empty, null, CommonFunctions.ParseDateToFinclaveString(DateTime.Now.ToShortDateString())); insertRepackItem.Add(updateStock); }); _productRepository.SaveUpdateRepackitems(insertRepackItem); } catch (Exception ex) { fault.Result = false; fault.ErrorMessage = "Error in SaveUpdateRepackitems method"; fault.ErrorDetails = ex.ToString(); throw new FaultException <FaultData>(fault); } }
/** * 填充报表 * * Param list [0]Repack * */ protected override bool FillValuesImpl(String templateFileName, IList <object> list) { try { if (list == null || list.Count < 1) { return(false); } Repack repack = (Repack)list[0]; IList <RepackDetail> repackDetails = repack.RepackDetails; //投入/产出 排序 repackDetails = IListHelper.Sort(repackDetails, "IOType"); if (repack == null || repackDetails == null || repackDetails.Count == 0) { return(false); } //this.SetRowCellBarCode(0, 2, 6); this.barCodeFontName = this.GetBarcodeFontName(2, 6); this.CopyPage(repackDetails.Count); this.FillHead(repack); int pageIndex = 1; int rowIndex = 0; int rowTotal = 0; foreach (RepackDetail repackDetail in repackDetails) { //物料号 this.SetRowCell(pageIndex, rowIndex, 0, repackDetail.LocationLotDetail.Item.Code); //物料描述 this.SetRowCell(pageIndex, rowIndex, 1, repackDetail.LocationLotDetail.Item.Description); //"单位Unit" this.SetRowCell(pageIndex, rowIndex, 2, repackDetail.LocationLotDetail.Hu.Uom.Code); //"单包装UC" this.SetRowCell(pageIndex, rowIndex, 3, repackDetail.LocationLotDetail.Hu.UnitCount.ToString("0.########")); //库位 this.SetRowCell(pageIndex, rowIndex, 4, repackDetail.LocationLotDetail.Location.Code); //批号 this.SetRowCell(pageIndex, rowIndex, 5, repackDetail.LocationLotDetail.Hu.LotNo); //Hu编号 this.SetRowCell(pageIndex, rowIndex, 6, repackDetail.LocationLotDetail.Hu.HuId); //数量 this.SetRowCell(pageIndex, rowIndex, 7, (repackDetail.Qty / repackDetail.LocationLotDetail.Hu.UnitQty).ToString("0.########")); //类型 this.SetRowCell(pageIndex, rowIndex, 8, repackDetail.IOType); if (this.isPageBottom(rowIndex, rowTotal))//页的最后一行 { pageIndex++; rowIndex = 0; } else { rowIndex++; } rowTotal++; } this.sheet.DisplayGridlines = false; this.sheet.IsPrintGridlines = false; } catch (Exception) { return(false); } return(true); }
public virtual void UpdateRepack(Repack entity) { Update(entity); }
public virtual void DeleteRepack(Repack entity) { Delete(entity); }
private Repack CreateRepack(IList <RepackDetail> repackDetailList, string type, User user) { IList <RepackDetail> inRepackDetailList = new List <RepackDetail>(); IList <RepackDetail> outRepackDetailList = new List <RepackDetail>(); bool hasHu = false; #region 判断RepackDetailList是否为空 if (repackDetailList != null && repackDetailList.Count > 0) { foreach (RepackDetail repackDetail in repackDetailList) { if (repackDetail.Qty != 0) { if (repackDetail.IOType == BusinessConstants.IO_TYPE_IN) { inRepackDetailList.Add(repackDetail); } else if (repackDetail.IOType == BusinessConstants.IO_TYPE_OUT) { outRepackDetailList.Add(repackDetail); if (!hasHu && repackDetail.Hu != null) { hasHu = true; } } else { throw new TechnicalException("Invalid IO Type:" + repackDetail.IOType); } } } #region 翻箱的如果没有输出,将输入代码合并,生成一张新条码 if (outRepackDetailList.Count == 0 && type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK) { Hu inHu = inRepackDetailList[0].Hu; Hu outHu = new Hu(); CloneHelper.CopyProperty(inHu, outHu); outHu.OrderNo = null; outHu.ReceiptNo = null; outHu.Location = null; outHu.StorageBin = null; outHu.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; string repackShift = entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_REPACK_SHIFT).Value; string prefix = inHu.HuId.Substring(0, inHu.HuId.Length - 4) + repackShift; outHu.HuId = numberControlMgr.GenerateNumber(prefix, 3); outHu.Qty = (from l in inRepackDetailList select l.Qty).Sum(); outHu.UnitCount = outHu.Qty; outHu.LotSize = outHu.UnitCount; outHu.PrintCount = 0; huMgr.CreateHu(outHu); RepackDetail outRepackDetail = new RepackDetail(); outRepackDetail.Hu = outHu; outRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT; outRepackDetail.Qty = outHu.Qty; outRepackDetail.itemCode = outHu.Item.Code; outRepackDetailList.Add(outRepackDetail); } #endregion if (inRepackDetailList.Count == 0 || outRepackDetailList.Count == 0) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } if (hasHu && type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING && outRepackDetailList.Count < 2) { throw new BusinessErrorException("MasterData.Inventory.Devanning.Error.DevanningDetailLessThanTwo"); } } else { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } #endregion #region 判断是否被拣货 foreach (RepackDetail inRepackDetail in inRepackDetailList) { if (inRepackDetail.LocationLotDetail.Hu != null && this.locationMgr.IsHuOcuppyByPickList(inRepackDetail.LocationLotDetail.Hu.HuId)) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuOccupied", inRepackDetail.Hu.HuId); } } #endregion #region 判断翻箱后条码是否为新条码 foreach (RepackDetail outRepackDetail in outRepackDetailList) { if (outRepackDetail.Hu != null && outRepackDetail.Hu.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuStatusNotCreate", outRepackDetail.Hu.HuId); } } #endregion #region 检查In和Out明细数量是否匹配 IDictionary <string, decimal> inItemQtyDic = new Dictionary <string, decimal>(); Location location = null; #region 收集In数量 foreach (RepackDetail inRepackDetail in inRepackDetailList) { LocationLotDetail inLocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inRepackDetail.LocationLotDetail.Id); if (location == null) { location = inLocationLotDetail.Location; if (!user.HasPermission(inLocationLotDetail.Location.Region.Code)) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.NoPermission", location.Code); } } else if (location.Code != inLocationLotDetail.Location.Code) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InRepackDetailLocationNotEqual"); } if (inItemQtyDic.ContainsKey(inLocationLotDetail.Item.Code)) { inItemQtyDic[inLocationLotDetail.Item.Code] += inRepackDetail.Qty; } else { inItemQtyDic.Add(inLocationLotDetail.Item.Code, inRepackDetail.Qty); } } #endregion #region 收集Out数量 IDictionary <string, decimal> outItemQtyDic = new Dictionary <string, decimal>(); foreach (RepackDetail outRepackDetail in outRepackDetailList) { if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK) { if (outRepackDetail.Hu == null) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuIdIsEmpty"); } else { if (outItemQtyDic.ContainsKey(outRepackDetail.Hu.Item.Code)) { outItemQtyDic[outRepackDetail.Hu.Item.Code] += outRepackDetail.Qty; } else { outItemQtyDic.Add(outRepackDetail.Hu.Item.Code, outRepackDetail.Qty); } } } else if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING) { string itemCode = outRepackDetail.Hu != null ? outRepackDetail.Hu.Item.Code : outRepackDetail.itemCode; if (itemCode == null) { throw new TechnicalException("ItemCode not specified."); } if (outItemQtyDic.ContainsKey(itemCode)) { outItemQtyDic[itemCode] += outRepackDetail.Qty; } else { outItemQtyDic.Add(itemCode, outRepackDetail.Qty); } } else { throw new TechnicalException("Repack type: " + type + " is not valided."); } } #endregion #region 比较 if (inItemQtyDic.Count != outItemQtyDic.Count) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutQtyNotMatch"); } foreach (string itemCode in inItemQtyDic.Keys) { if (outItemQtyDic.ContainsKey(itemCode)) { decimal inQty = inItemQtyDic[itemCode]; decimal outQty = outItemQtyDic[itemCode]; //是否自动创建剩余数量的记录 bool autoCreate = bool.Parse(entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_AUTO_CREATE_WHEN_DEAVING).Value); #region 拆箱根据剩余数量得到剩余数量的条码 if (autoCreate && type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING && inQty > outQty) { RepackDetail remainRepackDetail = CloneHelper.DeepClone(inRepackDetailList[0]); remainRepackDetail.Qty = inQty - outQty; remainRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT; outRepackDetailList.Add(remainRepackDetail); } #endregion else if (inQty != outQty) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutQtyNotMatch"); } } else { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutItemNotMatch", itemCode); } } #endregion #endregion #region 创建翻箱单头 Repack repack = new Repack(); repack.RepackNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_REPACK); repack.CreateDate = DateTime.Now; repack.CreateUser = user; repack.Type = type; this.CreateRepack(repack); #endregion #region 创建翻箱单明细 Int32?plannedBillId = null; //拆箱传递PlannedBill foreach (RepackDetail inRepackDetail in inRepackDetailList) { //出库 inRepackDetail.Repack = repack; this.locationMgr.InventoryRepackIn(inRepackDetail, user); this.repackDetailMgr.CreateRepackDetail(inRepackDetail); if (repack.Type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING) { plannedBillId = inRepackDetail.LocationLotDetail.IsConsignment ? inRepackDetail.LocationLotDetail.PlannedBill : null; } } foreach (RepackDetail outRepackDetail in outRepackDetailList) { //入库 outRepackDetail.Repack = repack; InventoryTransaction inventoryTransaction = this.locationMgr.InventoryRepackOut(outRepackDetail, location, plannedBillId, user); outRepackDetail.LocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inventoryTransaction.LocationLotDetailId); this.repackDetailMgr.CreateRepackDetail(outRepackDetail); } #endregion return(repack); }
public virtual void CreateRepack(Repack entity) { Create(entity); }
public virtual void CreateRepack(Repack entity) { Create(entity); }
public void RemoveString(ModelConfigurationString modelConfigurationString) { Repack.RemoveString(modelConfigurationString.ConfigurationString); SourceNames.Remove(modelConfigurationString); }
private Repack CreateRepack(IList<RepackDetail> repackDetailList, string type, User user) { IList<RepackDetail> inRepackDetailList = new List<RepackDetail>(); IList<RepackDetail> outRepackDetailList = new List<RepackDetail>(); bool hasHu = false; #region �ж�RepackDetailList�Ƿ�Ϊ�� if (repackDetailList != null && repackDetailList.Count > 0) { foreach (RepackDetail repackDetail in repackDetailList) { if (repackDetail.Qty != 0) { if (repackDetail.IOType == BusinessConstants.IO_TYPE_IN) { inRepackDetailList.Add(repackDetail); } else if (repackDetail.IOType == BusinessConstants.IO_TYPE_OUT) { outRepackDetailList.Add(repackDetail); if (!hasHu && repackDetail.Hu != null) { hasHu = true; } } else { throw new TechnicalException("Invalid IO Type:" + repackDetail.IOType); } } } #region ��������û����������������ϲ�,����һ�������� if (outRepackDetailList.Count == 0 && type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK) { Hu inHu = inRepackDetailList[0].Hu; Hu outHu = new Hu(); CloneHelper.CopyProperty(inHu, outHu); outHu.OrderNo = null; outHu.ReceiptNo = null; outHu.Location = null; outHu.StorageBin = null; outHu.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE; string repackShift = entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_REPACK_SHIFT).Value; string prefix = inHu.HuId.Substring(0, inHu.HuId.Length - 4) + repackShift; outHu.HuId =numberControlMgr.GenerateNumber(prefix, 3); outHu.Qty = (from l in inRepackDetailList select l.Qty).Sum(); outHu.UnitCount = outHu.Qty; outHu.LotSize = outHu.UnitCount; outHu.PrintCount = 0; huMgr.CreateHu(outHu); RepackDetail outRepackDetail = new RepackDetail(); outRepackDetail.Hu = outHu; outRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT; outRepackDetail.Qty = outHu.Qty; outRepackDetail.itemCode = outHu.Item.Code; outRepackDetailList.Add(outRepackDetail); } #endregion if (inRepackDetailList.Count == 0 || outRepackDetailList.Count == 0) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } if (hasHu && type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING && outRepackDetailList.Count < 2) { throw new BusinessErrorException("MasterData.Inventory.Devanning.Error.DevanningDetailLessThanTwo"); } } else { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } #endregion #region �ж��Ƿ�� foreach (RepackDetail inRepackDetail in inRepackDetailList) { if (inRepackDetail.LocationLotDetail.Hu != null && this.locationMgr.IsHuOcuppyByPickList(inRepackDetail.LocationLotDetail.Hu.HuId)) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuOccupied", inRepackDetail.Hu.HuId); } } #endregion #region �жϷ���������Ƿ�Ϊ������ foreach (RepackDetail outRepackDetail in outRepackDetailList) { if (outRepackDetail.Hu != null && outRepackDetail.Hu.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuStatusNotCreate", outRepackDetail.Hu.HuId); } } #endregion #region ���In��Out��ϸ�����Ƿ�ƥ�� IDictionary<string, decimal> inItemQtyDic = new Dictionary<string, decimal>(); Location location = null; #region �ռ�In���� foreach (RepackDetail inRepackDetail in inRepackDetailList) { LocationLotDetail inLocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inRepackDetail.LocationLotDetail.Id); if (location == null) { location = inLocationLotDetail.Location; if (!user.HasPermission(inLocationLotDetail.Location.Region.Code)) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.NoPermission", location.Code); } } else if (location.Code != inLocationLotDetail.Location.Code) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InRepackDetailLocationNotEqual"); } if (inItemQtyDic.ContainsKey(inLocationLotDetail.Item.Code)) { inItemQtyDic[inLocationLotDetail.Item.Code] += inRepackDetail.Qty; } else { inItemQtyDic.Add(inLocationLotDetail.Item.Code, inRepackDetail.Qty); } } #endregion #region �ռ�Out���� IDictionary<string, decimal> outItemQtyDic = new Dictionary<string, decimal>(); foreach (RepackDetail outRepackDetail in outRepackDetailList) { if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK) { if (outRepackDetail.Hu == null) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuIdIsEmpty"); } else { if (outItemQtyDic.ContainsKey(outRepackDetail.Hu.Item.Code)) { outItemQtyDic[outRepackDetail.Hu.Item.Code] += outRepackDetail.Qty; } else { outItemQtyDic.Add(outRepackDetail.Hu.Item.Code, outRepackDetail.Qty); } } } else if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING) { string itemCode = outRepackDetail.Hu != null ? outRepackDetail.Hu.Item.Code : outRepackDetail.itemCode; if (itemCode == null) { throw new TechnicalException("ItemCode not specified."); } if (outItemQtyDic.ContainsKey(itemCode)) { outItemQtyDic[itemCode] += outRepackDetail.Qty; } else { outItemQtyDic.Add(itemCode, outRepackDetail.Qty); } } else { throw new TechnicalException("Repack type: " + type + " is not valided."); } } #endregion #region �Ƚ� if (inItemQtyDic.Count != outItemQtyDic.Count) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutQtyNotMatch"); } foreach (string itemCode in inItemQtyDic.Keys) { if (outItemQtyDic.ContainsKey(itemCode)) { decimal inQty = inItemQtyDic[itemCode]; decimal outQty = outItemQtyDic[itemCode]; //�Ƿ��Զ�����ʣ�������ļ�¼ bool autoCreate = bool.Parse(entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_AUTO_CREATE_WHEN_DEAVING).Value); #region �������ʣ�������õ�ʣ������������ if (autoCreate && type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING && inQty > outQty) { RepackDetail remainRepackDetail = CloneHelper.DeepClone(inRepackDetailList[0]); remainRepackDetail.Qty = inQty - outQty; remainRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT; outRepackDetailList.Add(remainRepackDetail); } #endregion else if (inQty != outQty) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutQtyNotMatch"); } } else { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutItemNotMatch", itemCode); } } #endregion #endregion #region �������䵥ͷ Repack repack = new Repack(); repack.RepackNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_REPACK); repack.CreateDate = DateTime.Now; repack.CreateUser = user; repack.Type = type; this.CreateRepack(repack); #endregion #region �������䵥��ϸ Int32? plannedBillId = null; //���䴫��PlannedBill foreach (RepackDetail inRepackDetail in inRepackDetailList) { //���� inRepackDetail.Repack = repack; this.locationMgr.InventoryRepackIn(inRepackDetail, user); this.repackDetailMgr.CreateRepackDetail(inRepackDetail); if (repack.Type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING) { plannedBillId = inRepackDetail.LocationLotDetail.IsConsignment ? inRepackDetail.LocationLotDetail.PlannedBill : null; } } foreach (RepackDetail outRepackDetail in outRepackDetailList) { //��� outRepackDetail.Repack = repack; InventoryTransaction inventoryTransaction = this.locationMgr.InventoryRepackOut(outRepackDetail, location, plannedBillId, user); outRepackDetail.LocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inventoryTransaction.LocationLotDetailId); this.repackDetailMgr.CreateRepackDetail(outRepackDetail); } #endregion return repack; }
public virtual void DeleteRepack(Repack entity) { entityDao.DeleteRepack(entity); }
/* * 填充报表头 * * Param repack 翻箱头对象 */ private void FillHead(Repack repack) { string repackCode = Utility.BarcodeHelper.GetBarcodeStr(repack.RepackNo, this.barCodeFontName); //翻箱单号 this.SetRowCell(2, 6, repackCode); //翻箱单号 this.SetRowCell(3, 6, repack.RepackNo); //翻箱人 Create User: this.SetRowCell(5, 1, repack.CreateUser.Name); //翻箱时间 this.SetRowCell(5, 7, repack.CreateDate.ToString("yyyy-MM-dd HH:mm")); }
public virtual void UpdateRepack(Repack entity) { entityDao.UpdateRepack(entity); }
private Repack CreateRepack(IList<RepackDetail> repackDetailList, string type, User user) { IList<RepackDetail> inRepackDetailList = new List<RepackDetail>(); IList<RepackDetail> outRepackDetailList = new List<RepackDetail>(); #region 判断RepackDetailList是否为空 if (repackDetailList != null && repackDetailList.Count > 0) { foreach (RepackDetail repackDetail in repackDetailList) { if (repackDetail.Qty != 0) { if (repackDetail.IOType == BusinessConstants.IO_TYPE_IN) { inRepackDetailList.Add(repackDetail); } else if (repackDetail.IOType == BusinessConstants.IO_TYPE_OUT) { outRepackDetailList.Add(repackDetail); } else { throw new TechnicalException("Invalid IO Type:" + repackDetail.IOType); } } } if (inRepackDetailList.Count == 0 || outRepackDetailList.Count == 0) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } } else { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); } #endregion #region 检查In和Out明细数量是否匹配 IDictionary<string, decimal> inItemQtyDic = new Dictionary<string, decimal>(); Location location = null; #region 收集In数量 foreach (RepackDetail inRepackDetail in inRepackDetailList) { LocationLotDetail inLocationLotDetail = this.locationLotDetailMgrE.LoadLocationLotDetail(inRepackDetail.LocationLotDetail.Id); if (location == null) { location = inLocationLotDetail.Location; if (!user.HasPermission(inLocationLotDetail.Location.Region.Code)) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.NoPermission", location.Code); } } else if (location.Code != inLocationLotDetail.Location.Code) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InRepackDetailLocationNotEqual"); } if (inItemQtyDic.ContainsKey(inLocationLotDetail.Item.Code)) { inItemQtyDic[inLocationLotDetail.Item.Code] += inRepackDetail.Qty; } else { inItemQtyDic.Add(inLocationLotDetail.Item.Code, inRepackDetail.Qty); } } #endregion #region 收集Out数量 IDictionary<string, decimal> outItemQtyDic = new Dictionary<string, decimal>(); foreach (RepackDetail outRepackDetail in outRepackDetailList) { if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK) { if (outRepackDetail.Hu == null) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.HuIdIsEmpty"); } else { if (outItemQtyDic.ContainsKey(outRepackDetail.Hu.Item.Code)) { outItemQtyDic[outRepackDetail.Hu.Item.Code] += outRepackDetail.Qty; } else { outItemQtyDic.Add(outRepackDetail.Hu.Item.Code, outRepackDetail.Qty); } } } else if (type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING) { string itemCode = outRepackDetail.Hu != null ? outRepackDetail.Hu.Item.Code : outRepackDetail.itemCode; if (itemCode == null) { throw new TechnicalException("ItemCode not specified."); } if (outItemQtyDic.ContainsKey(itemCode)) { outItemQtyDic[itemCode] += outRepackDetail.Qty; } else { outItemQtyDic.Add(itemCode, outRepackDetail.Qty); } } else { throw new TechnicalException("Repack type: " + type + " is not valided."); } } #endregion #region 比较 if (inItemQtyDic.Count != outItemQtyDic.Count) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutQtyNotMatch"); } foreach (string itemCode in inItemQtyDic.Keys) { if (outItemQtyDic.ContainsKey(itemCode)) { decimal inQty = inItemQtyDic[itemCode]; decimal outQty = outItemQtyDic[itemCode]; //是否自动创建剩余数量的记录 bool autoCreate = bool.Parse(entityPreferenceMgrE.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_AUTO_CREATE_WHEN_DEAVING).Value); #region 拆箱根据剩余数量得到剩余数量的条码 if (autoCreate &&type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING && inQty > outQty) { RepackDetail remainRepackDetail = CloneHelper.DeepClone(inRepackDetailList[0]); remainRepackDetail.Qty = inQty - outQty; remainRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT; outRepackDetailList.Add(remainRepackDetail); } #endregion else if (inQty != outQty) { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutQtyNotMatch"); } } else { throw new BusinessErrorException("MasterData.Inventory.Repack.Error.InOutItemNotMatch", itemCode); } } #endregion #endregion #region 创建翻箱单头 Repack repack = new Repack(); repack.RepackNo = this.numberControlMgrE.GenerateNumber(BusinessConstants.CODE_PREFIX_REPACK); repack.CreateDate = DateTime.Now; repack.CreateUser = user; repack.Type = type; this.CreateRepack(repack); #endregion #region 创建翻箱单明细 Int32? plannedBillId = null; //拆箱传递PlannedBill foreach (RepackDetail inRepackDetail in inRepackDetailList) { //出库 inRepackDetail.Repack = repack; this.locationMgrE.InventoryRepackIn(inRepackDetail, user); this.repackDetailMgrE.CreateRepackDetail(inRepackDetail); if (repack.Type == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING) { plannedBillId = inRepackDetail.LocationLotDetail.IsConsignment ? inRepackDetail.LocationLotDetail.PlannedBill : null; } } foreach (RepackDetail outRepackDetail in outRepackDetailList) { //入库 outRepackDetail.Repack = repack; InventoryTransaction inventoryTransaction = this.locationMgrE.InventoryRepackOut(outRepackDetail, location, plannedBillId, user); outRepackDetail.LocationLotDetail = this.locationLotDetailMgrE.LoadLocationLotDetail(inventoryTransaction.LocationLotDetailId); this.repackDetailMgrE.CreateRepackDetail(outRepackDetail); } #endregion return repack; }
protected void btnRepack_Click(object sender, EventArgs e) { try { if (this.RepackType == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK) { if (this.IsQty) { if (this.tbLocation.Text.Trim() == string.Empty) { ShowErrorMessage("MasterData.Inventory.Repack.Location.Empty"); return; } if (this.OutTransformerDetailList == null || this.OutTransformerDetailList.Count == 0) { ShowErrorMessage("MasterData.Inventory.Repack.Error.RepackDetailEmpty"); return; } IList <RepackDetail> repackDetailList = new List <RepackDetail>(); IDictionary <string, decimal> ItemDic = new Dictionary <string, decimal>(); foreach (TransformerDetail transformerDetail in OutTransformerDetailList) { RepackDetail outRepackDetail = new RepackDetail(); outRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT; outRepackDetail.Hu = TheHuMgr.LoadHu(transformerDetail.HuId); outRepackDetail.Qty = outRepackDetail.Hu.Qty * outRepackDetail.Hu.UnitQty; if (ItemDic.ContainsKey(outRepackDetail.Hu.Item.Code)) { ItemDic[outRepackDetail.Hu.Item.Code] += outRepackDetail.Qty; } else { ItemDic.Add(outRepackDetail.Hu.Item.Code, outRepackDetail.Qty); } repackDetailList.Add(outRepackDetail); } if (repackDetailList.Count > 0) { foreach (string item in ItemDic.Keys) { IList <LocationLotDetail> locationLotDetailList = TheLocationLotDetailMgr.GetLocationLotDetail(this.tbLocation.Text.Trim(), item, false, false, BusinessConstants.PLUS_INVENTORY, null, false); if (locationLotDetailList == null || locationLotDetailList.Count == 0) { ShowErrorMessage("MasterData.Inventory.Repack.LocationLotDetail.Empty"); return; } decimal locQty = (from l in locationLotDetailList select l.Qty).Sum(); decimal outQty = ItemDic[item]; if (outQty > locQty) { ShowErrorMessage("MasterData.Inventory.LocationLotDetail.LessThanHuQty", item, locQty.ToString("0.########"), outQty.ToString("0.########")); return; } foreach (LocationLotDetail locationLotDetail in locationLotDetailList) { RepackDetail inRepackDetail = new RepackDetail(); inRepackDetail.LocationLotDetail = locationLotDetail; inRepackDetail.IOType = BusinessConstants.IO_TYPE_IN; repackDetailList.Add(inRepackDetail); if (locationLotDetail.Qty < outQty) { inRepackDetail.Qty = locationLotDetail.Qty; outQty -= inRepackDetail.Qty; } else { inRepackDetail.Qty = outQty; break; } } } } Repack repack = TheRepackMgr.CreateRepack(repackDetailList, this.CurrentUser); if (this.IsQty) { RepackEvent(repack.RepackNo, e); } } else { ExecuteSubmit(); Repack repack = TheRepackMgr.LoadRepack(this.CacheResolver.Code, true); IList <Hu> huList = new List <Hu>(); foreach (RepackDetail repackDet in repack.RepackDetails) { if (repackDet.IOType == BusinessConstants.IO_TYPE_OUT && repackDet.LocationLotDetail.Hu != null && repackDet.LocationLotDetail.Hu.PrintCount == 0) { huList.Add(repackDet.LocationLotDetail.Hu); } } if (huList.Count > 0) { IList <object> huDetailObj = new List <object>(); huDetailObj.Add(huList); huDetailObj.Add(CurrentUser.Code); string huTemplate = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_HU_TEMPLATE).Value; if (huTemplate != null && huTemplate.Length > 0) { string barCodeUrl = TheReportMgr.WriteToFile(huTemplate, huDetailObj, "BarCode.xls"); Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>"); } } } } else if (this.RepackType == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING) { UpdateOutTransformer(); ExecuteSubmit(); } if (RepackEvent != null && !this.IsQty) { RepackEvent(this.CacheResolver.Code, e); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
public virtual void UpdateRepack(Repack entity) { Update(entity); }
public void AddString(object obj) { var newElement = Repack.AddString(); SourceNames.Add(new ModelConfigurationString(newElement)); }
public virtual void DeleteRepack(Repack entity) { Delete(entity); }
public virtual void CreateRepack(Repack entity) { entityDao.CreateRepack(entity); }
private void finposTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e != null) { TabControl tabControl = sender as TabControl; var _tab = e.OriginalSource as TabControl; if (tabControl.IsMouseOver == false && this.finposTabControl.SelectedIndex != 5) { this.finposTabControl.SelectedIndex = PrevTabIndex; return; } else if (tabControl.IsMouseOver) { PrevTabIndex = tabControl.SelectedIndex; } else { btn_company.Focusable = true; btn_company.Focus(); return; } if (_tab != null) { switch (_tab.SelectedIndex) { case 0: btn_customer.Focusable = true; btn_customer.Focus(); break; case 1: btn_supplier.Focusable = true; btn_supplier.Focus(); btn_supplier.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case 2: btn_category.Focusable = true; btn_category.Focus(); btn_category.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case 3: btn_expense.Focusable = true; btn_expense.Focus(); break; case 4: btn_manageSallary.Focusable = true; btn_manageSallary.Focus(); break; case 5: btn_company.Focusable = true; btn_company.Focus(); btn_company.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; } } } else { var contentpage = FinposContainer.Content as Page; var value = contentpage.GetType(); switch (value.Name) { case "Purchase": // this.FinposContainer.Navigate(contentpage); btnEvent(btn_purchase); //btn_purchase.Focusable = true; //btn_purchase.Focus(); //btn_purchase.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); break; case "Supplier": // this.FinposContainer.Navigate(contentpage); btnEvent(btn_supplier); break; case "DirectPurchase": btnEvent(btn_directPurchase); break; case "Category": btnEvent(btn_category); break; case "OpeningStock": btnEvent(btn_opening_stock); break; case "Wastage": btnEvent(btn_wastage); break; case "StockAdjustment": btnEvent(btn_stockAdjustment); break; case "inventory": btnEvent(btn_product); break; case "MasterLabelSetting": //btnEvent(btn_MasterLabel); break; case "Tax": btnEvent(btn_Tax); break; case "AddProductHistory": AddProductHistory objAddProduct = new AddProductHistory(); this.FinposContainer.Navigate(objAddProduct); break; case "AddWastage": AddWastage objAddWastage = new AddWastage(); this.FinposContainer.Navigate(objAddWastage); break; case "AddPurchase": AddPurchase objAddPurchase = new AddPurchase(); this.FinposContainer.Navigate(objAddPurchase); break; case "AddDirectPurchase": AddDirectPurchase objAddDirectPurchase = new AddDirectPurchase(); this.FinposContainer.Navigate(objAddDirectPurchase); break; case "Repack": Repack objRepack = new Repack(); this.FinposContainer.Navigate(objRepack); break; case "CoupanManagment": btnEvent(btnCoupons); break; //case "Tax": // btnEvent(btn_Tax); // break; //case "Tax": // btnEvent(btn_Tax); // break; } } //else //{ // finposTabControl.SelectedIndex = this.finposTabControl.SelectedIndex; //} //case 10: // btn_product.Focusable = true; // btn_product.Focus(); // btn_product.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // break; //case 11: // btn_wastage.Focusable = true; // btn_wastage.Focus(); // btn_wastage.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // break; #endregion }
public virtual void DeleteRepack(Repack entity) { entityDao.DeleteRepack(entity); }
public virtual void CreateRepack(Repack entity) { entityDao.CreateRepack(entity); }
private ReceiptNote Repack2ReceiptNote(Repack repack) { ReceiptNote receiptNote = new ReceiptNote(); receiptNote.OrderNo = repack.RepackNo; receiptNote.CreateDate = repack.CreateDate; receiptNote.CreateUser = repack.CreateUser == null ? string.Empty : repack.CreateUser.Code; return receiptNote; }
public virtual void UpdateRepack(Repack entity) { entityDao.UpdateRepack(entity); }