You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using NFine.Application.ProductManage; using NFine.Application.SystemManage; using NFine.Code; using NFine.Domain.Entity.ProductManage; using NFine.Domain.Entity.SystemManage; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Web.Mvc;
namespace NFine.Web.Areas.ProductManage.Controllers { public class PreSellController : ControllerBase { private MaintainApp maintainApp = new MaintainApp(); private PreSellApp presellApp = new PreSellApp(); private CustomerApp cusapp = new CustomerApp(); [HttpGet] [HandlerAjaxOnly] public ActionResult GetGridJson(Pagination pagination, string queryJson) { //var data = maintainAppApp.GetList(keyword);
var data = new { rows = maintainApp.GetListPS(pagination, queryJson), total = pagination.total, page = pagination.page, records = pagination.records }; return Content(data.ToJson()); }
public ActionResult GetGridJsonPS(string keyword) { var data = presellApp.GetList(keyword); return Content(data.ToJson()); }
public ActionResult GetOrderNo() { string userCode = OperatorProvider.Provider.GetCurrent().UserCode; string date = DateTime.Now.ToString("yyyyMMdd"); string year = DateTime.Now.ToString("yyyy"); string orderno = userCode + "-" + date + "-"; string no = presellApp.GetOrderNo(orderno); int newNo = string.IsNullOrEmpty(no) ? 1 : Convert.ToInt32(no.Substring(no.Length - 3, 3)) + 1; orderno = userCode + "-" + date + "-" + newNo.ToString().PadLeft(3, '0'); return Content(orderno); }
[HttpGet] [HandlerAjaxOnly] public ActionResult GetFormJson(string keyValue) { var data = maintainApp.GetForm(keyValue); return Content(data.ToJson()); }
[HttpGet] [HandlerAjaxOnly] public ActionResult GetFormJsonPS(string keyValue) { var data = maintainApp.GetForm(keyValue); return Content(data.ToJson()); }
[HttpPost] public void Export(string keyValue) { string ids = ""; var str = keyValue.Split(','); for (int i = 0; i < str.Length; i++) { if (i == 0) ids = "'" + str[i].ToString() + "'"; else ids += ",'" + str[i].ToString() + "'"; } //var data = maintainApp.GetList2(ids); //preselldetailApp.GetList2(keyValue, keyword);
var data = maintainApp.GetList2All(); DataTable dt = (DataTable)data; if (dt != null && dt.Rows.Count > 0) { //string PreSellNo = presellApp.GetPreSellNo(dt.Rows[0]["F_Id"].ToString());
dt.Columns.Remove("F_Id"); //dt.Columns.Remove("Product_Id");
GridViewExportUtil.Export2(dt); } }
[HttpPost] [HandlerAjaxOnly] [HandlerAuthorize] [ValidateAntiForgeryToken] public ActionResult SubmitForm(string newPreSellNo, string oldPreSell, string IsUse, string keyValue, string cusID, string cusName) { string salesmanID = NFine.Code.OperatorProvider.Provider.GetCurrent().UserId; CustomerEntity cus = cusapp.GetForm(cusID); //获取选中的产品的ID数组
string[] array = keyValue.Split(','); ICSProductPreSellEntity ppsEntity = null; List<ICSProductPreSellDetailEntity> entityList = new List<ICSProductPreSellDetailEntity>(); if (IsUse.ToLower() == "false") { //创建新的订单项目
//string GUID = Guid.NewGuid().ToString();
ppsEntity = new ICSProductPreSellEntity(); ppsEntity.F_Id = Common.GuId(); ppsEntity.PreSellNo = newPreSellNo; ppsEntity.CustomerId = cus.F_Id; ppsEntity.CustomerName = cus.F_CusName; ppsEntity.IsConfirm = false; ppsEntity.F_CreatorUserId = salesmanID; ppsEntity.F_CreatorTime = DateTime.Now; ppsEntity.F_Location = NFine.Code.OperatorProvider.Provider.GetCurrent().Location; //根据旧的订单编号插入子表数据
foreach (string productID in array) { if (!string.IsNullOrEmpty(productID)) { ICSProductPreSellDetailEntity entity = new ICSProductPreSellDetailEntity(); //entity.F_Id = Guid.NewGuid().ToString();
entity.PreSell_Id = ppsEntity.F_Id; entity.Product_Id = productID; entity.Product_SN = maintainApp.GetForm(productID).ProductSN; entity.PreSellTime = DateTime.Now; entity.F_CreatorUserId = salesmanID; entity.F_CreatorTime = DateTime.Now; entityList.Add(entity); } } } else { foreach (string productID in array) { ICSProductPreSellDetailEntity entity = new ICSProductPreSellDetailEntity(); //entity.F_Id = Guid.NewGuid().ToString();
entity.PreSell_Id = oldPreSell; entity.Product_Id = productID; entity.Product_SN = maintainApp.GetForm(productID).ProductSN; entity.PreSellTime = DateTime.Now; entity.Status = 2; entity.F_CreatorUserId = salesmanID; entity.F_CreatorTime = DateTime.Now; entityList.Add(entity); } }
List<ICSProductEntity> list = new List<ICSProductEntity>(); foreach (string id in array) { ICSProductEntity model = new ICSProductEntity(); model = maintainApp.GetForm(id); model.F_Id = id; //model.IsLock = true;
list.Add(model); } presellApp.SubmitForm(list, ppsEntity, entityList); string ExpiredDays = presellApp.GetExpiredDays("ExpiredDays"); return Success("Scheduled success.<br/>Your order will expire in " + ExpiredDays + " days. Please confirm the order as soon as possible."); }
[HttpPost] [HandlerAjaxOnly] [HandlerAuthorize] [ValidateAntiForgeryToken] public ActionResult DeleteForm(string keyValue) { maintainApp.DeleteForm(keyValue); return Success("Delete success."); }
[HttpPost] [HandlerAjaxOnly] [HandlerAuthorize] [ValidateAntiForgeryToken] public ActionResult PreSll(string keyValue) { string[] array = keyValue.Split(','); //for (int i = 0; i < array.Length; i++)
//{
// ids.Add(array[i]);
//}
List<ICSProductEntity> list = new List<ICSProductEntity>(); foreach (string id in array) { ICSProductEntity model = new ICSProductEntity(); model.F_Id = id; model.IsLock = true; list.Add(model); } maintainApp.PrsSell(list); //model.F_Id =
//UserEntity userEntity = new UserEntity();
//userEntity.F_Id = keyValue
return Success("Scheduled success."); }
[HttpGet] public ActionResult Orders() { return View(); } } }
|