public ActionResult SubmitApprolvalApplyForm(ApplyBillEntity applyBillEntity, string keyValue) { try { string[] Ids = keyValue.Split(','); foreach (var Id in Ids) { int ID = Convert.ToInt32(Id); var apply = applyBillApp.GetForm(ID); apply.appAuthDate = DateTime.Now; apply.appAuthIdea = applyBillEntity.appAuthIdea; apply.appAuthTag = applyBillEntity.appAuthTag; if (apply.appAuthTag == "F")//不批准 { apply.caseTag = "T"; var user = userApp.GetFormByName(apply.appMan); if (!string.IsNullOrEmpty(user.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(user.F_Email, "申购单批准不通过", "你好,你的申购单批准不通过,详情查看请点击链接<a>http://10.110.120.6:8090/</a>"); } } applyBillApp.SubmitForm(apply, ID); } return(Success("操作成功。")); } catch (Exception) { return(Error("操作失败。")); } }
private decimal GetSum(ApplyBillEntity apply, PriceEntity price) { if (apply.appUnit == price.unit) { return(Math.Round((apply.appNum ?? 0) * (price.price ?? 0), 2)); } else { return(Math.Round((apply.viceNum ?? 0) * (price.price ?? 0), 2)); } }
public void SubmitForm(ApplyBillEntity applyEntity, int?keyValue = null) { try { if (keyValue != null) { applyEntity.ID = keyValue.Value; service.Update(applyEntity); } else { service.Insert(applyEntity); } } catch (Exception ex) { throw; } }
public ActionResult BackApply(ApplyBillEntity applyBillEntity, int?keyValue) { if (keyValue != null) { var apply = applyBillApp.GetForm(keyValue.Value); apply.backReason = applyBillEntity.backReason; apply.appAuthDate = null; apply.appAuthIdea = null; apply.appAuthMan = null; apply.appAuthTag = "M"; apply.appExaDate = null; apply.appExaIdea = null; apply.appExaMan = null; apply.appExaTag = "M"; applyBillApp.SubmitForm(apply, keyValue); return(Success("操作成功。")); } return(Error("操作失败。")); }
public ActionResult SubmitApprolvalPurchaseForm(ApplyBillEntity applyBillEntity, string keyValue) { try { List <string> purList = new List <string>(); string[] Ids = keyValue.Split(','); foreach (var Id in Ids) { int ID = Convert.ToInt32(Id); var apply = applyBillApp.GetForm(ID); apply.purAuthDate = DateTime.Now; apply.purAuthIdea = applyBillEntity.purAuthIdea; apply.purAuthTag = applyBillEntity.purAuthTag; applyBillApp.SubmitForm(apply, ID); if (apply.purAuthTag == "F") { if (!purList.Contains(apply.purMan)) { purList.Add(apply.purMan); } } } if (applyBillEntity.purAuthTag == "F") { foreach (var item in purList) { var user = userApp.GetFormByName(item); if (!string.IsNullOrEmpty(user.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(user.F_Email, "采购单审核不通过", "你好,你的采购单审核不通过,详情查看请点击链接<a>http://10.110.120.6:8090/</a>"); } } } return(Success("操作成功。")); } catch (Exception) { return(Error("操作失败。")); } }
public ActionResult GetFormDetail(int keyValue) { ApplyBillEntity applyBillEntity = applyBillApp.GetForm(keyValue); if (!string.IsNullOrEmpty(applyBillEntity.priNO)) { PriceEntity price = priceApp.GetFormJson(applyBillEntity.priNO); return(Json(new { prdName = price.prdName, spc = price.spc, mat = applyBillEntity.mat, orderNo = price.orderNo, appUnit = applyBillEntity.appUnit, viceNum = applyBillEntity.viceNum }, JsonRequestBehavior.AllowGet)); } else { return(Content(applyBillEntity.ToJson())); } }
/// <summary> /// /// </summary> /// <param name="PS_ID"></param> /// <param name="billNo"></param> /// <param name="WH"></param> /// <param name="ITM"></param> /// <param name="NAME"></param> /// <param name="applyBillEntity"></param> /// <param name="billEntity"></param> /// <param name="priceEntity"></param> /// <returns></returns> public TF_PSSEntity SubmitForm(string PS_ID, string billNo, string WH, BillEntity bill, string NAME, ApplyBillEntity applyBillEntity, BillEntity billEntity, PriceEntity priceEntity) { try { TF_PSSEntity tF_PSSEntity = new TF_PSSEntity(); TF_PSSEntity entity = null; TF_PSSEntity entity1 = null; if (applyBillEntity.WAREWAY == 0)//工具仓 { entity = service.TOOLIQueryable(t => t.PS_NO.Equals(billNo)).OrderByDescending(t => t.ITM).FirstOrDefault(); entity1 = service.TOOLIQueryable(t => t.PS_NO.Equals(billNo)).OrderByDescending(t => t.PRE_ITM).FirstOrDefault(); } else { entity = service.G_WSIQueryable(t => t.PS_NO.Equals(billNo)).OrderByDescending(t => t.ITM).FirstOrDefault(); entity1 = service.G_WSIQueryable(t => t.PS_NO.Equals(billNo)).OrderByDescending(t => t.PRE_ITM).FirstOrDefault(); } if (entity != null) { tF_PSSEntity.ITM = entity.ITM + 1; } else { tF_PSSEntity.ITM = 1; } if (entity1 != null) { tF_PSSEntity.PRE_ITM = entity1.PRE_ITM + 1; } else { tF_PSSEntity.PRE_ITM = 1; } tF_PSSEntity.PS_ID = PS_ID; tF_PSSEntity.PS_NO = billNo; tF_PSSEntity.PS_DD = DateTime.Now.Date; tF_PSSEntity.WH = WH; tF_PSSEntity.PRD_NO = applyBillEntity.prdNo; tF_PSSEntity.PRD_NAME = NAME; tF_PSSEntity.PRD_MARK = ""; tF_PSSEntity.UNIT = "1"; tF_PSSEntity.QTY = Math.Abs(billEntity.num ?? 0); #region 单位及数量转换 if (priceEntity.unit == applyBillEntity.appUnit) { tF_PSSEntity.UP = priceEntity.price; tF_PSSEntity.AMT = decimal.Round(applyBillEntity.purPrice.Value * Math.Abs(billEntity.num.Value), 2); tF_PSSEntity.AMTN_NET = decimal.Round((applyBillEntity.purPrice.Value * Math.Abs(billEntity.num.Value)) / (1 + priceEntity.principal.Value), 2); tF_PSSEntity.CSTN_SAL = tF_PSSEntity.AMTN_NET; tF_PSSEntity.TAX = tF_PSSEntity.AMT - tF_PSSEntity.AMTN_NET; } else { var up = Math.Round((billEntity.viceNum ?? 0) * (priceEntity.price ?? 0) / (Math.Abs(billEntity.num ?? 0)), 2); tF_PSSEntity.UP = up; if (PS_ID.Equals("PB")) { tF_PSSEntity.UP_QTY1 = billEntity.num; } tF_PSSEntity.AMT = decimal.Round(up * Math.Abs(billEntity.num.Value), 2); tF_PSSEntity.AMTN_NET = decimal.Round((up * Math.Abs(billEntity.num.Value)) / (1 + priceEntity.principal.Value), 2); tF_PSSEntity.CSTN_SAL = tF_PSSEntity.AMTN_NET; tF_PSSEntity.TAX = tF_PSSEntity.AMT - tF_PSSEntity.AMTN_NET; } #endregion if (PS_ID.Equals("PB")) //退货单 { tF_PSSEntity.OS_ID = "PC"; //来源单ID tF_PSSEntity.OS_NO = bill.billNo; tF_PSSEntity.OTH_ITM = bill.erpItm; tF_PSSEntity.CUS_OS_NO = applyBillEntity.purNo; tF_PSSEntity.SL_ITM = 0; tF_PSSEntity.BL_OS_ITM = 0; } else if (PS_ID.Equals("PC")) { tF_PSSEntity.FREE_ID_DEF = "F"; } tF_PSSEntity.TAX_RTO = priceEntity.principal * 100; tF_PSSEntity.QTY1 = billEntity.viceNum; tF_PSSEntity.REM = billEntity.remark; tF_PSSEntity.PAK_WEIGHT_UNIT = applyBillEntity.viceUnit; tF_PSSEntity.CUS_OS_NO = applyBillEntity.purNo; if (applyBillEntity.WAREWAY == 0) { service.TOOLInsert(tF_PSSEntity); } else { service.G_WSInsert(tF_PSSEntity); } return(tF_PSSEntity); } catch (Exception ex) { new ErrorLogApp().SubmitForm(ex); return(null); } }
public ActionResult SubmitCheckApplyForm(ApplyBillEntity applyBillEntity, string keyValue) { try { string[] Ids = keyValue.Split(','); List <string> authList = new List <string>(); List <string> appList = new List <string>(); foreach (var Id in Ids) { int ID = Convert.ToInt32(Id); var apply = applyBillApp.GetForm(ID); var TimeSpan = DateTime.Now - apply.date; apply.appExaDate = DateTime.Now; apply.appExaIdea = applyBillEntity.appExaIdea; if (applyBillEntity.appExaTag == "T")//审核通过 { apply.appExaTag = applyBillEntity.appExaTag; if (apply.appExaMan == apply.appAuthMan) { apply.appAuthTag = "T"; applyBillApp.SubmitForm(apply, ID); } else { applyBillApp.SubmitForm(apply, ID); } if (!authList.Contains(apply.appAuthMan)) { authList.Add(apply.appAuthMan); } if (!appList.Contains(apply.appMan)) { appList.Add(apply.appMan); } } else { apply.appExaTag = applyBillEntity.appExaTag; applyBillApp.SubmitForm(apply, ID); if (!appList.Contains(apply.appMan)) { appList.Add(apply.appMan); } } } if (applyBillEntity.appExaTag == "T") { foreach (var item in authList) { var user = userApp.GetFormByName(item); if (!string.IsNullOrEmpty(user.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(user.F_Email, "申购单审批", "你好,有申购单需要你登录OA去做审批,请点击链接<a>http://10.110.120.6:8090/</a>"); } } } else { foreach (var item in appList) { var user = userApp.GetFormByName(item); if (!string.IsNullOrEmpty(user.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(user.F_Email, "申购单审核不通过", "你好,你的申购单审核不通过,详情查看请点击链接<a>http://10.110.120.6:8090/</a>"); } } } return(Success("操作成功。")); } catch (Exception) { return(Error("操作失败。")); } }
public ActionResult SubmitForm(ApplyBillEntity applyBillEntity, int?keyValue) { try { var userId = OperatorProvider.Provider.GetCurrent().UserId; var roleId = OperatorProvider.Provider.GetCurrent().RoleId; var role = new RoleApp().GetForm(roleId); var appMan = userApp.GetForm(userId); UserEntity firstExaMan = null; if (applyBillEntity != null) { if (Request.Files.Count > 0) { var file = Request.Files[0]; if (!string.IsNullOrEmpty(file.FileName)) { var fileName = file.FileName; foreach (char invalidChar in Path.GetInvalidFileNameChars()) { fileName = fileName.Replace(invalidChar.ToString(), "_"); } fileName = fileName.Replace(" ", ""); var filePath = Path.Combine(HttpContext.Server.MapPath("/Uploads/"), fileName); file.SaveAs(filePath); applyBillEntity.annex = fileName; } } if (keyValue != null)//修改 { var apply = applyBillApp.GetForm(keyValue.Value); var userName = OperatorProvider.Provider.GetCurrent().UserName; if (!apply.appMan.Equals(userName)) { return(Error("非本人不能修改申购单。")); } if (apply.appExaTag == "T") { return(Error("该申购单已审核,不能修改。")); } if (apply.appExaTag == "F" || apply.appExaMan == null) { apply.appExaTag = "M"; } apply.appExaDate = null; apply.appExaIdea = null; apply.backReason = null; apply.prdName = applyBillEntity.prdName; apply.spc = applyBillEntity.spc; apply.rem = applyBillEntity.rem; apply.useGroup = applyBillEntity.useGroup; apply.viceNum = applyBillEntity.viceNum; apply.annex = applyBillEntity.annex; apply.TypeID = applyBillEntity.TypeID; if (!string.IsNullOrEmpty(applyBillEntity.viceUnit)) { apply.viceUnit = applyBillEntity.viceUnit.Trim().ToUpper(); } apply.appNum = applyBillEntity.appNum; apply.appUnit = applyBillEntity.appUnit.Trim().ToUpper(); apply.purIsTem = applyBillEntity.purIsTem; apply.WAREWAY = applyBillEntity.WAREWAY; apply.hopeDD = applyBillEntity.hopeDD; apply.mat = applyBillEntity.mat; apply.orderNo = applyBillEntity.orderNo; if (apply.appExaMan != applyBillEntity.appExaMan) { apply.appExaMan = applyBillEntity.appExaMan; var appExaMan = userApp.GetFormByName(applyBillEntity.appExaMan); if (!string.IsNullOrEmpty(appExaMan.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(appExaMan.F_Email, "申购单审核", "你好," + appMan.F_RealName + "有申购单需要你登录OA去做审核,请点击链接<a>http://10.110.120.6:8090/</a>"); } } apply.appAuthMan = applyBillEntity.appAuthMan; applyBillApp.SubmitForm(apply, keyValue); } else { applyBillEntity.appUnit = applyBillEntity.appUnit.Trim().ToUpper(); if (!string.IsNullOrEmpty(applyBillEntity.viceUnit)) { applyBillEntity.viceUnit = applyBillEntity.viceUnit.Trim().ToUpper(); } applyBillEntity.appAuthTag = "D"; if (role != null) { if (role.F_FullName.Equals("工程师")) { applyBillEntity.appExaTag = "A"; firstExaMan = userApp.GetForm(appMan.F_ManagerId); applyBillEntity.FirstExaMan = firstExaMan.F_RealName; } else { applyBillEntity.appExaTag = "D"; } } applyBillEntity.purAuthTag = "D"; applyBillEntity.purExaTag = "D"; applyBillEntity.prtTag = "F"; applyBillEntity.caseTag = "F"; applyBillEntity.isPreMoney = "N"; if (applyBillEntity.purIsTem == null) { applyBillEntity.purIsTem = "F"; } var appExaMan = userApp.GetFormByName(applyBillEntity.appExaMan); var appManDepart = organizeApp.GetForm(appMan.F_DepartmentId); applyBillEntity.appMan = appMan.F_RealName; applyBillEntity.appDep = appManDepart.F_FullName; applyBillEntity.date = DateTime.Now; applyBillApp.SubmitForm(applyBillEntity, keyValue); if (role != null && !role.F_FullName.Equals("工程师")) { if (!string.IsNullOrEmpty(appExaMan.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(appExaMan.F_Email, "申购单审核", "你好," + appMan.F_RealName + "有申购单需要你登录OA去做审核,请点击链接<a>http://10.110.120.6:8090/</a>"); } } else { if (!string.IsNullOrEmpty(firstExaMan.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(firstExaMan.F_Email, "申购单初审", "你好," + firstExaMan.F_RealName + "有申购单需要你登录OA去做审核,请点击链接<a>http://10.110.120.6:8090/</a>"); } } } return(Success("操作成功。")); } } catch (Exception ex) { new ErrorLogApp().SubmitForm(ex); return(Error("操作失败。")); } return(Success("操作成功。")); }
public ActionResult GetFormJson(int keyValue) { ApplyBillEntity applyBillEntity = applyBillApp.GetForm(keyValue); return(Content(applyBillEntity.ToJson())); }
public ActionResult SubmitCheckPurchaseForm(ApplyBillEntity applyBillEntity, string keyValue) { try { string[] Ids = keyValue.Split(','); List <string> authList = new List <string>(); List <string> purList = new List <string>(); foreach (var Id in Ids) { int ID = Convert.ToInt32(Id); var apply = applyBillApp.GetForm(ID); apply.purExaDate = DateTime.Now; apply.purExaIdea = applyBillEntity.purExaIdea; PriceEntity price = priceApp.GetFormJson(apply.priNO); decimal sumMoney = 0; if (price.unit == apply.appUnit) { sumMoney = (price.price ?? 0) * (apply.appNum ?? 0); } else { sumMoney = (price.price ?? 0) * (apply.viceNum ?? 0); } if (applyBillEntity.purExaTag == "T")//审核通过 { apply.purExaTag = applyBillEntity.purExaTag; if (sumMoney <= 3000) { apply.purAuthMan = apply.purExaMan; apply.purAuthTag = "T"; apply.purAuthDate = DateTime.Now; applyBillApp.SubmitForm(apply, ID); } else { if (!authList.Contains(apply.purAuthMan)) { authList.Add(apply.purAuthMan); } applyBillApp.SubmitForm(apply, ID); } } else { apply.purExaTag = applyBillEntity.purExaTag; if (!purList.Contains(apply.purMan)) { purList.Add(apply.purMan); } applyBillApp.SubmitForm(apply, ID); } } if (applyBillEntity.purExaTag == "T") { foreach (var item in authList) { var user = userApp.GetFormByName(item); if (!string.IsNullOrEmpty(user.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(user.F_Email, "采购单审批", "你好,有采购单需要你登录OA去做审批,请点击链接<a>http://10.110.120.6:8090/</a>"); } } } else { foreach (var item in purList) { var user = userApp.GetFormByName(item); if (!string.IsNullOrEmpty(user.F_Email)) { mHelper.MailServer = "10.110.120.2"; mHelper.Send(user.F_Email, "采购单审核不通过", "你好,你的采购单审核不通过,详情查看请点击链接<a>http://10.110.120.6:8090/</a>"); } } } return(Success("操作成功。")); } catch (Exception ex) { return(Error("操作失败。")); } }
public ActionResult SubmitForm(ApplyBillEntity applyBillEntity, int?keyValue, string code) { ApplyBillEntity apply = null; var userName = OperatorProvider.Provider.GetCurrent().UserName; apply = applyBillApp.GetForm(keyValue.Value); var price = priceApp.GetFormJson(applyBillEntity.priNO); if (!string.IsNullOrEmpty(code))//转厂 { ApplyBillEntity apply1 = new ApplyBillEntity(); var applyBill = applyBillApp.GetForm(keyValue.Value); apply1.purNo = applyBillApp.ProducePurNO(applyBillEntity.purSup, price.currency.Value); apply1.appExaTag = applyBill.appExaTag; apply1.appExaDate = applyBill.appExaDate; apply1.appExaIdea = applyBill.appExaIdea; apply1.appExaMan = applyBill.appExaMan; apply1.appAuthTag = applyBill.appAuthTag; apply1.appAuthDate = applyBill.appAuthDate; apply1.appAuthMan = applyBill.appAuthMan; apply1.appAuthIdea = applyBill.appAuthIdea; apply1.prdName = applyBill.prdName; apply1.spc = applyBill.spc; apply1.rem = applyBill.rem; apply1.prdNo = applyBill.prdNo; apply1.useGroup = applyBill.useGroup; apply1.viceNum = applyBill.viceNum; apply1.viceUnit = applyBill.viceUnit; apply1.appNum = (applyBill.appNum ?? 0) - (applyBill.yiJiaoNum ?? 0); apply1.appUnit = applyBill.appUnit; apply1.purIsTem = applyBill.purIsTem; apply1.WAREWAY = applyBill.WAREWAY; apply1.hopeDD = applyBill.hopeDD; apply1.mat = applyBill.mat; apply1.orderNo = applyBill.orderNo; apply1.appMan = applyBill.appMan; apply1.appDep = applyBill.appDep; apply1.date = applyBill.date; apply1.isPreMoney = "N"; apply1.prtTag = "F"; apply1.caseTag = "F"; apply1.purWay = 0; apply1.purAuthTag = "D"; apply1.purExaTag = "D"; apply1.purDD = DateTime.Now; apply1.purExaMan = applyBillEntity.purExaMan; apply1.purAuthMan = applyBillEntity.purAuthMan; apply1.purSup = applyBillEntity.purSup; apply1.purPrice = applyBillEntity.purPrice; apply1.priNO = applyBillEntity.priNO; apply1.purMan = userName; apply1.priNO = applyBillEntity.priNO; apply1.purExaDate = null; apply1.purAuthDate = null; apply1.purAuthIdea = null; apply1.purExaIdea = null; applyBillApp.SubmitForm(apply1); applyBill.caseTag = "T";//当前项结案 applyBill.rem = "转厂:" + apply1.purNo; applyBillApp.SubmitForm(applyBill, applyBill.ID); if (!string.IsNullOrEmpty(apply1.purExaMan)) { var purExaMan = userApp.GetFormByName(apply1.purExaMan); mHelper.MailServer = "10.110.120.2"; if (!string.IsNullOrEmpty(purExaMan.F_Email)) { mHelper.Send(purExaMan.F_Email, "采购单审核", "你好," + apply1.purMan + "有采购单需要你登录OA去做审核,请点击链接<a>http://10.110.120.6:8090/</a>"); } } } else //转单 { apply.purNo = applyBillApp.ProducePurNO(applyBillEntity.purSup, price.currency.Value); apply.purDD = DateTime.Now; apply.purExaMan = applyBillEntity.purExaMan; apply.purAuthMan = applyBillEntity.purAuthMan; apply.purSup = applyBillEntity.purSup; apply.purPrice = applyBillEntity.purPrice; apply.priNO = applyBillEntity.priNO; apply.purMan = userName; apply.priNO = applyBillEntity.priNO; apply.purExaDate = null; apply.purAuthDate = null; apply.purAuthIdea = null; apply.purExaIdea = null; if (apply.purExaTag != "D") { apply.purExaTag = "M"; } if (apply.purAuthTag == "F") { apply.purAuthTag = "M"; } applyBillApp.SubmitForm(apply, keyValue);//转单 if (!string.IsNullOrEmpty(apply.purExaMan)) { var purExaMan = userApp.GetFormByName(apply.purExaMan); mHelper.MailServer = "10.110.120.2"; if (!string.IsNullOrEmpty(purExaMan.F_Email)) { mHelper.Send(purExaMan.F_Email, "采购单审核", "你好," + apply.purMan + "有采购单需要你登录OA去做审核,请点击链接<a>http://10.110.120.6:8090/</a>"); } } } return(Success("操作成功。")); }