| | |
| | | { |
| | | EC_SpecialOrdersBLL bll_EC_SpecialOrdersBLL = null; |
| | | EC_OrderBasicBLL _eC_OrderBasicBLL = null; |
| | | OA_OutOfStorageBLL _OA_OutOfStorageBLL = null; |
| | | OA_InventoryBLL _OA_InventoryBLL = null; |
| | | |
| | | //初始化 |
| | | public AgSpecialOrderList() |
| | | { |
| | | bll_EC_SpecialOrdersBLL = new EC_SpecialOrdersBLL(); |
| | | _eC_OrderBasicBLL = new EC_OrderBasicBLL(); |
| | | _OA_OutOfStorageBLL = new OA_OutOfStorageBLL(); |
| | | _OA_InventoryBLL = new OA_InventoryBLL(); |
| | | } |
| | | |
| | | //页面加载 |
| | |
| | | EC_SpecialOrders model = bll_EC_SpecialOrdersBLL.GetModelByKeyid(Request["delete"].ToInt32()); |
| | | if (model != null && model.Keyid != null) |
| | | { |
| | | //退回库存 |
| | | var oA_OutOfStorages = _OA_OutOfStorageBLL.getModelListByRemark(model.Memberid, "<span class='a_under' title='点击查看施工单详情' onclick=\"ViewModel_Special('" + model.PO_OrderId + "')\">专版:" + model.PSO_OrderNum + "</span>").ToList(); |
| | | if (oA_OutOfStorages != null && oA_OutOfStorages.Count > 0) |
| | | { |
| | | foreach (var outOfStorage in oA_OutOfStorages) |
| | | { |
| | | if (outOfStorage.InfoType == "确认出库") |
| | | { |
| | | _OA_OutOfStorageBLL.DeleteModel(outOfStorage); |
| | | } |
| | | else if (outOfStorage.InfoType == "出库") |
| | | { |
| | | |
| | | |
| | | OA_Inventory Inventory = new OA_Inventory(); |
| | | Inventory.BrandId = outOfStorage.BrandId; |
| | | Inventory.FirmId = outOfStorage.FirmId; |
| | | Inventory.GoodsId = outOfStorage.GoodsId; |
| | | Inventory.LastUpdateTime = DateTime.Now; |
| | | Inventory.WarehouseId = outOfStorage.WarehouseId; |
| | | Inventory.SpecificationId = outOfStorage.SpecificationId; |
| | | Inventory.PaperWeightId = outOfStorage.PaperWeightId; |
| | | |
| | | var m_OA_Inventory = _OA_InventoryBLL.IfHasModel(Inventory); |
| | | if (m_OA_Inventory != null)//如果所选货位存在此产品 |
| | | { |
| | | |
| | | m_OA_Inventory.InventoryCount = m_OA_Inventory.InventoryCount + outOfStorage.Quantity; |
| | | bool isSuccess = _OA_InventoryBLL.UpdateModel(m_OA_Inventory); |
| | | } |
| | | _OA_OutOfStorageBLL.DeleteModel(outOfStorage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | bll_EC_SpecialOrdersBLL.DeleteModel(model); |
| | | JavaScript.MessageBox("删除成功", this); |
| | | Response.Redirect("/Pages/business/AgSpecialOrderList.aspx"); |
| | |
| | | List<EC_OrderOperate> oprates = new List<EC_OrderOperate>(); |
| | | oprates.Add(new EC_OrderOperate() |
| | | { |
| | | OperateType = 2, |
| | | OperateType = 1, |
| | | OrderId = _eC_OrderBasic.Keyid, |
| | | Operator = CurrentUser.ShortName, |
| | | Remark = "" |
| | |
| | | |
| | | |
| | | |
| | | } |
| | | //退回库存 |
| | | var oA_OutOfStorages = _OA_OutOfStorageBLL.getModelListByRemark(model.Memberid, "<span class=''a_under'' title=''点击查看施工单详情'' onclick=\"ViewModel_Special(''" + model.PO_OrderId + "'')\">专版:" + model.PSO_OrderNum + "</span>").ToList(); |
| | | if (oA_OutOfStorages != null && oA_OutOfStorages.Count > 0) |
| | | { |
| | | foreach(var outOfStorage in oA_OutOfStorages) |
| | | { |
| | | if (outOfStorage.InfoType == "确认出库") |
| | | { |
| | | _OA_OutOfStorageBLL.DeleteModel(outOfStorage); |
| | | } |
| | | else if(outOfStorage.InfoType == "出库") |
| | | { |
| | | |
| | | |
| | | OA_Inventory Inventory = new OA_Inventory(); |
| | | Inventory.BrandId = outOfStorage.BrandId; |
| | | Inventory.FirmId = outOfStorage.FirmId; |
| | | Inventory.GoodsId = outOfStorage.GoodsId; |
| | | Inventory.LastUpdateTime = DateTime.Now; |
| | | Inventory.WarehouseId = outOfStorage.WarehouseId; |
| | | Inventory.SpecificationId = outOfStorage.SpecificationId; |
| | | Inventory.PaperWeightId = outOfStorage.PaperWeightId; |
| | | |
| | | var m_OA_Inventory = _OA_InventoryBLL.IfHasModel(Inventory); |
| | | if (m_OA_Inventory != null)//如果所选货位存在此产品 |
| | | { |
| | | |
| | | m_OA_Inventory.InventoryCount = m_OA_Inventory.InventoryCount + outOfStorage.Quantity; |
| | | bool isSuccess = _OA_InventoryBLL.UpdateModel(m_OA_Inventory); |
| | | } |
| | | _OA_OutOfStorageBLL.DeleteModel(outOfStorage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | bll_EC_SpecialOrdersBLL.DeleteModel(model); |
| | |
| | | pa.PageSize = UCPager1.AspNetPager.PageSize; |
| | | pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex; |
| | | this.RepClientList.DataSource = bll_EC_SpecialOrdersBLL.SelectModelPage(pa, CurrentUser.MemberId,this.txtPrintName.Value,this.txtCustormerName.Value,this.txtPSO_OrderNum.Value, string.IsNullOrEmpty(this.txtBeginDate.Value) ? beginTime : Convert.ToDateTime(this.txtBeginDate.Value) |
| | | , string.IsNullOrEmpty(this.txtEndDate.Value) ? endTime : MyConvert.GetDateTime(this.txtEndDate.Value) |
| | | , string.IsNullOrEmpty(this.txtEndDate.Value) ? endTime : MyConvert.GetDateTime(this.txtEndDate.Value), "补单" |
| | | ); |
| | | this.RepClientList.DataBind(); |
| | | UCPager1.AspNetPager.RecordCount = pa.RecordCount; |