//需要调用窗体名称 System.Windows.Forms.Control INetUserControl.CreateControl(UFSoft.U8.Framework.Login.UI.clsLogin login, string MenuID, string Paramters) { UFSoft.U8.Framework.LoginContext.UserData LoginInfo = new UFSoft.U8.Framework.LoginContext.UserData(); LoginInfo = login.GetLoginInfo(); string conn = LoginInfo.ConnString; conn = Utils.ConvertConn(conn); DbHelperSQL.connectionString = conn; string sLogUserid = LoginInfo.UserId; string sLogUserName = LoginInfo.UserName; string sLogDate = LoginInfo.operDate; string sAccID = LoginInfo.AccID; ClsUserRight clsUser = new ClsUserRight(); if (clsUser.chkRight(login, "TH_1")) { PurchasePlan fm = new PurchasePlan(); fm.Conn = conn; fm.sUserID = sLogUserid; fm.sUserName = sLogUserName; fm.sLogDate = sLogDate; fm.sAccID = sAccID; this._Title = "PurchasePlan"; return(fm); } else { return(null); } }
//[ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "Order,SKU,Id,OrderKey,SKUId,DesignName,ComponentSKU,ALTSku,GraphSKU,StockSKU,Status,ConsumeQty,RequirementQty,RejectRatio,Deploy,Locator,Brand,Supplier,OrderPlanDate,PlanedStartDate,ActualStartDate,PlanDeliveryDate,ActualDeliveryDate,Remark,OrderId,BomComponentId,ParentBomComponentId,CreatedUserId,CreatedDateTime,LastEditUserId,LastEditDateTime")] PurchasePlan purchasePlan) { if (ModelState.IsValid) { purchasePlan.ObjectState = ObjectState.Modified; _purchasePlanService.Update(purchasePlan); _unitOfWork.SaveChanges(); if (Request.IsAjaxRequest()) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } DisplaySuccessMessage("Has update a PurchasePlan record"); return(RedirectToAction("Index")); } var orderRepository = _unitOfWork.Repository <Order>(); ViewBag.OrderId = new SelectList(orderRepository.Queryable(), "Id", "OrderKey", purchasePlan.OrderId); var skuRepository = _unitOfWork.Repository <SKU>(); ViewBag.SKUId = new SelectList(skuRepository.Queryable(), "Id", "Sku", purchasePlan.SKUId); if (Request.IsAjaxRequest()) { var modelStateErrors = String.Join("", this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors.Select(n => n.ErrorMessage))); return(Json(new { success = false, err = modelStateErrors }, JsonRequestBehavior.AllowGet)); } DisplayErrorMessage(); return(View(purchasePlan)); }
// GET: PurchasePlans/Create public ActionResult Create() { PurchasePlan purchasePlan = new PurchasePlan(); //set default value var orderRepository = _unitOfWork.Repository <Order>(); ViewBag.OrderId = new SelectList(orderRepository.Queryable(), "Id", "OrderKey"); var skuRepository = _unitOfWork.Repository <SKU>(); ViewBag.SKUId = new SelectList(skuRepository.Queryable(), "Id", "Sku"); return(View(purchasePlan)); }
//[ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { PurchasePlan purchasePlan = _purchasePlanService.Find(id); _purchasePlanService.Delete(purchasePlan); _unitOfWork.SaveChanges(); if (Request.IsAjaxRequest()) { return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } DisplaySuccessMessage("Has delete a PurchasePlan record"); return(RedirectToAction("Index")); }
// GET: PurchasePlans/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PurchasePlan purchasePlan = _purchasePlanService.Find(id); if (purchasePlan == null) { return(HttpNotFound()); } return(View(purchasePlan)); }
/// <summary> /// Initializes a new instance of the DiskRestorePoint class. /// </summary> /// <param name="id">Resource Id</param> /// <param name="name">Resource name</param> /// <param name="type">Resource type</param> /// <param name="timeCreated">The timestamp of restorePoint /// creation</param> /// <param name="sourceResourceId">arm id of source disk</param> /// <param name="osType">The Operating System type. Possible values /// include: 'Windows', 'Linux'</param> /// <param name="hyperVGeneration">The hypervisor generation of the /// Virtual Machine. Applicable to OS disks only. Possible values /// include: 'V1', 'V2'</param> /// <param name="purchasePlan">Purchase plan information for the the /// image from which the OS disk was created.</param> /// was created.</param> /// <param name="familyId">id of the backing snapshot's MIS /// family</param> /// <param name="sourceUniqueId">unique incarnation id of the source /// disk</param> /// <param name="encryption">Encryption property can be used to encrypt /// data at rest with customer managed keys or platform managed /// keys.</param> /// <param name="supportsHibernation">Indicates the OS on a disk /// supports hibernation.</param> /// <param name="networkAccessPolicy">Possible values include: /// 'AllowAll', 'AllowPrivate', 'DenyAll'</param> /// <param name="publicNetworkAccess">Possible values include: /// 'Enabled', 'Disabled'</param> /// <param name="diskAccessId">ARM id of the DiskAccess resource for /// using private endpoints on disks.</param> /// <param name="completionPercent">Percentage complete for the /// background copy when a resource is created via the CopyStart /// operation.</param> /// <param name="supportedCapabilities">List of supported capabilities /// (like accelerated networking) for the image from which the OS disk public DiskRestorePoint(string id, string name, string type, System.DateTime?timeCreated, string sourceResourceId, OperatingSystemTypes?osType, string hyperVGeneration, PurchasePlan purchasePlan, string familyId, string sourceUniqueId = default(string), Encryption encryption = default(Encryption), bool?supportsHibernation = default(bool?)) : base(id, name, type) { TimeCreated = timeCreated; SourceResourceId = sourceResourceId; OsType = osType; HyperVGeneration = hyperVGeneration; PurchasePlan = purchasePlan; FamilyId = familyId; SourceUniqueId = sourceUniqueId; Encryption = encryption; SupportsHibernation = supportsHibernation; CustomInit(); }
public List <PurchasePlan> GetPurchasePlanByStoreID(int storeID) { var list = new List <PurchasePlan>(); try { var sql = new StringBuilder(); sql.Append("SELECT "); sql.Append("p2.[Title],p2.[PName],p2.[State],p2.[PurchaseDetails],p2.[Spec],p2.[Qty],p2.[Unit],p2.[HopePrice],p2.[PurchaseName],p2.[ContantName],p2.[ContantWay],p2.[EndDateTime],p2.[PurchaseType],"); sql.Append("p2.[RequestManufactureArea],p2.[RequestReceiveArea],p2.[RequestContant],p2.[CreateDate],p2.[CreateUserID],p2.[LastUpdateDate],p2.[LastUpdateUserID] "); sql.Append("FROM PurchasePlanStore p "); sql.Append("LEFT JOIN PurchasePlan p2 ON p.PlanID=p2.ID "); sql.Append(string.Format("WHERE StoreID={0}", storeID)); var dt = SQLHelper.GetTable(sql.ToString()); for (int i = 0; i < dt.Rows.Count; i++) { var obj = new PurchasePlan { Title = Convert.IsDBNull(dt.Rows[i]["Title"]) ? "" : Convert.ToString(dt.Rows[i]["Title"]), PName = Convert.IsDBNull(dt.Rows[i]["PName"]) ? "" : Convert.ToString(dt.Rows[i]["PName"]), State = Convert.IsDBNull(dt.Rows[i]["State"]) ? "" : Convert.ToString(dt.Rows[i]["State"]), PurchaseDetails = Convert.IsDBNull(dt.Rows[i]["PurchaseDetails"]) ? "" : Convert.ToString(dt.Rows[i]["PurchaseDetails"]), Spec = Convert.IsDBNull(dt.Rows[i]["Spec"]) ? "" : Convert.ToString(dt.Rows[i]["Spec"]), Qty = Convert.IsDBNull(dt.Rows[i]["Qty"]) ? 0 : Convert.ToInt32(dt.Rows[i]["Qty"]), Unit = Convert.IsDBNull(dt.Rows[i]["Unit"]) ? "" : Convert.ToString(dt.Rows[i]["Unit"]), HopePrice = Convert.IsDBNull(dt.Rows[i]["Unit"]) ? 0 : Convert.ToDecimal(dt.Rows[i]["Unit"]), PurchaseName = Convert.IsDBNull(dt.Rows[i]["PurchaseName"]) ? "" : Convert.ToString(dt.Rows[i]["PurchaseName"]), ContantName = Convert.IsDBNull(dt.Rows[i]["ContantName"]) ? "" : Convert.ToString(dt.Rows[i]["ContantName"]), ContantWay = Convert.IsDBNull(dt.Rows[i]["ContantWay"]) ? "" : Convert.ToString(dt.Rows[i]["ContantWay"]), EndDateTime = Convert.IsDBNull(dt.Rows[i]["EndDateTime"]) ? new DateTime() : Convert.ToDateTime(dt.Rows[i]["EndDateTime"]), PurchaseType = new Category { }, RequestManufactureArea = Convert.IsDBNull(dt.Rows[i]["RequestManufactureArea"]) ? "" : Convert.ToString(dt.Rows[i]["RequestManufactureArea"]), RequestReceiveArea = Convert.IsDBNull(dt.Rows[i]["RequestReceiveArea"]) ? "" : Convert.ToString(dt.Rows[i]["RequestReceiveArea"]), RequestContant = Convert.IsDBNull(dt.Rows[i]["RequestContant"]) ? "" : Convert.ToString(dt.Rows[i]["RequestContant"]), CreateDate = Convert.IsDBNull(dt.Rows[i]["CreateDate"]) ? new DateTime() : Convert.ToDateTime(dt.Rows[i]["CreateDate"]), CreateUser = new User { } }; list.Add(obj); } } catch (Exception ex) { } return(list); }
public IEnumerable <PurchasePlan> GeneratePurchasePlan(int orderId) { List <PurchasePlan> list = new List <PurchasePlan>(); var order = this.Find(orderId); list = _purchaseservice.Queryable().Where(x => x.OrderId == orderId).ToList(); if (list.Count > 0) { return(list); } else { var orderdetails = _orderdetailrepository.Queryable().Where(x => x.OrderId == orderId).ToList(); foreach (var item in orderdetails) { var bomlist = _bomrepository.Queryable().Include(x => x.ParentComponent).Include(s => s.SKU).Where(x => x.FinishedSKU == item.ProductionSku && x.MadeType == "外购").ToList(); foreach (var component in bomlist) { PurchasePlan purchase = new PurchasePlan(); purchase.OrderId = orderId; purchase.OrderKey = order.OrderKey; purchase.BomComponentId = component.Id; purchase.ComponentSKU = component.ComponentSKU; purchase.ConsumeQty = component.ConsumeQty; purchase.Deploy = component.Deploy; purchase.DesignName = component.DesignName; purchase.GraphSKU = component.GraphSKU; purchase.Locator = component.Locator; purchase.OrderPlanDate = order.OrderDate; purchase.ParentBomComponentId = component.ParentComponentId; //purchase.ProductionLine = component.ProductionLine; purchase.Brand = component.SKU.Brand; purchase.RejectRatio = component.RejectRatio; purchase.Remark = component.Remark1; purchase.RequirementQty = item.Qty * component.ConsumeQty; purchase.SKUId = component.SKUId; purchase.StockSKU = component.StockSKU; list.Add(purchase); this._purchaseservice.Insert(purchase); } } return(list); } }
/// <summary> /// 发布采购计划 /// </summary> /// <param name="PurchasePlanModel">采购计划总的实体</param> /// <returns></returns> public int AddPurchasePlan(PurchasePlan plan) { var pID = 0; try { var nowDate = DateTime.Now; StringBuilder str = new StringBuilder(); str.Append("INSERT INTO PurchasePlan([Title],[PName],[State],[PurchaseDetails],[Spec],[Qty],[Unit],[HopePrice],[PurchaseName],[ContantName],[ContantWay],"); str.Append("[EndDateTime],[PurchaseType],[RequestManufactureArea],[RequestReceiveArea],[RequestContant],[CreateDate],[CreateUserID],[LastUpdateDate] ,[LastUpdateUserID]) "); str.Append("VALUES(@Title,@PName,@State,@PurchaseDetails,@Spec,@Qty,@Unit,@HopePrice,@PurchaseName,@ContantName,@ContantWay@)"); str.Append("@EndDateTime,@PurchaseType,@RequestManufactureArea,@RequestReceiveArea,@RequestContant,@CreateDate,@CreateUserID,@LastUpdateDate,@LastUpdateUserID) SELECT @@IDENTITY"); SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@Title", plan.Title), new SqlParameter("@PName", plan.PName), new SqlParameter("@State", plan.State), new SqlParameter("@PurchaseDetails", plan.PurchaseDetails), new SqlParameter("@Spec", plan.Spec), new SqlParameter("@Qty", plan.Qty), new SqlParameter("@Unit", plan.Unit), new SqlParameter("@HopePrice", plan.HopePrice), new SqlParameter("@PurchaseName", plan.PurchaseName), new SqlParameter("@ContantName", plan.ContantName), new SqlParameter("@ContantWay", plan.ContantWay), new SqlParameter("@EndDateTime", plan.EndDateTime), new SqlParameter("@PurchaseType", plan.PurchaseType), new SqlParameter("@RequestManufactureArea", plan.RequestManufactureArea), new SqlParameter("@RequestReceiveArea", plan.RequestReceiveArea), new SqlParameter("@RequestContant", plan.RequestContant), new SqlParameter("@CreateDate", nowDate), new SqlParameter("@CreateUserID", plan.CreateUser != null?plan.CreateUser.UID:0), new SqlParameter("@LastUpdateDate", nowDate), new SqlParameter("@LastUpdateUserID", plan.LastUpdateUser != null?plan.LastUpdateUser.UID:0), }; pID = SQLHelper.ExcuteScalarSQL(str.ToString(), parms); } catch (Exception) { } return(pID); }
// GET: PurchasePlans/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PurchasePlan purchasePlan = _purchasePlanService.Find(id); if (purchasePlan == null) { return(HttpNotFound()); } var orderRepository = _unitOfWork.Repository <Order>(); ViewBag.OrderId = new SelectList(orderRepository.Queryable(), "Id", "OrderKey", purchasePlan.OrderId); var skuRepository = _unitOfWork.Repository <SKU>(); ViewBag.SKUId = new SelectList(skuRepository.Queryable(), "Id", "Sku", purchasePlan.SKUId); return(View(purchasePlan)); }
/// <summary> /// 发布采购计划 /// </summary> /// <param name="PurchasePlanModel">采购计划总的实体</param> /// <returns></returns> public int AddPurchasePlan(PurchasePlan plan) { return(dal.AddPurchasePlan(plan)); }