protected void btnPrint_Click(object sender, EventArgs e) { IList <ReceiptDetail> receiptDetailList = PopulateReceiptDetail(); if (receiptDetailList == null || receiptDetailList.Count == 0) { this.ShowErrorMessage("Inventory.Error.PrintHu.ReceiptDetail.Required"); return; } string huTemplate = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_HU_TEMPLATE).Value; if (receiptDetailList != null && receiptDetailList.Count > 0 && huTemplate != null && huTemplate.Length > 0) { IList <Hu> huList = new List <Hu>(); foreach (ReceiptDetail receiptDetail in receiptDetailList) { huList.Add(TheHuMgr.LoadHu(receiptDetail.HuId)); } IList <object> huDetailObj = new List <object>(); huDetailObj.Add(huList); huDetailObj.Add(CurrentUser.Code); //receiptDetailList[0].Receipt.HuTemplate string barCodeUrl = TheReportMgr.WriteToFile(huTemplate, huDetailObj, huTemplate); Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>"); this.ShowSuccessMessage("Inventory.PrintHu.Successful"); } }
protected string RenderingLanguage(string content, string userCode, params string[] parameters) { try { content = ProcessMessage(content, parameters); if (userCode != null && userCode.Trim() != string.Empty) { User user = TheUserMgr.LoadUser(userCode, true, false); if (user != null && user.UserLanguage != null && user.UserLanguage != string.Empty) { content = TheLanguageMgr.ProcessLanguage(content, user.UserLanguage); } else { EntityPreference defaultLanguage = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE); content = TheLanguageMgr.ProcessLanguage(content, defaultLanguage.Value); } } else { EntityPreference defaultLanguage = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE); content = TheLanguageMgr.ProcessLanguage(content, defaultLanguage.Value); } } catch (Exception ex) { return(content); } return(content); }
public void PageCleanup() { ((Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow")).Text = string.Empty; ((Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom")).Text = string.Empty; ((Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo")).Text = string.Empty; ((Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom")).Text = string.Empty; ((Controls_TextBox)this.FV_Flow.FindControl("tbLocTo")).Text = string.Empty; ((TextBox)(this.FV_Flow.FindControl("tbCode"))).Text = string.Empty; ((TextBox)(this.FV_Flow.FindControl("tbDescription"))).Text = string.Empty; ((CheckBox)(this.FV_Flow.FindControl("cbIsActive"))).Checked = true; ((CheckBox)(this.FV_Flow.FindControl("cbIsAutoCreate"))).Checked = false; ((CheckBox)(this.FV_Flow.FindControl("cbIsAutoRelease"))).Checked = false; ((CheckBox)(this.FV_Flow.FindControl("cbIsAutoStart"))).Checked = false; ((CheckBox)(this.FV_Flow.FindControl("cbNeedPrintOrder"))).Checked = false; ((CheckBox)(this.FV_Flow.FindControl("cbAllowExceed"))).Checked = false; ((CheckBox)(this.FV_Flow.FindControl("cbIsAutoReceive"))).Checked = false; ((CheckBox)(this.FV_Flow.FindControl("cbIsListDetail"))).Checked = true; ((CheckBox)(this.FV_Flow.FindControl("cbAllowCreateDetail"))).Checked = false; ((CheckBox)(this.FV_Flow.FindControl("cbFulfillUC"))).Checked = true; ((CheckBox)(this.FV_Flow.FindControl("cbIsShipByOrder"))).Checked = true; ((CheckBox)(this.FV_Flow.FindControl("cbIsAsnUniqueReceipt"))).Checked = true; ((com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo")).SelectedIndex = 0; ((com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCheckDetailOption")).SelectedIndex = 0; ((com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption")).SelectedIndex = 0; ((Controls_TextBox)(this.FV_Flow.FindControl("tbCurrency"))).Text = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_BASE_CURRENCY).Value; ((Controls_TextBox)this.FV_Flow.FindControl("tbCarrier")).Text = string.Empty; ((Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress")).Text = string.Empty; }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { string receiptOpt = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_RECEIPT_OPTION).Value; if (e.Row.RowType == DataControlRowType.DataRow) { Transformer transformer = (Transformer)e.Row.DataItem; GetTransformerDetailControl(e.Row).GV_DataBind(transformer.TransformerDetails); if (transformer.CurrentQty == 0) { GetCurrentQtyTextBox(e.Row).Text = string.Empty;//0不显示 } GetCurrentQtyTextBox(e.Row).ReadOnly = this.IsScanHu || this.ReadOnly; if (transformer.CurrentRejectQty == 0) { GetCurrentRejectQtyTextBox(e.Row).Text = string.Empty; } GetCurrentRejectQtyTextBox(e.Row).ReadOnly = this.IsScanHu || this.ReadOnly; if (transformer.LocationFromCode != null && transformer.LocationFromCode.Trim() != string.Empty) { GV_List.Columns[7].Visible = true;//LocationFrom } if (transformer.LocationToCode != null && transformer.LocationToCode.Trim() != string.Empty) { GV_List.Columns[8].Visible = true;//LocationTo } if (receiptOpt == BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_RECEIPT_OPTION_GOODS_RECEIPT_LOTSIZE && !GetCurrentQtyTextBox(e.Row).ReadOnly) { GetCurrentQtyTextBox(e.Row).Text = transformer.CurrentQty.ToString("0.#########"); } } }
protected void btnReceive_Click(object sender, EventArgs e) { OrderHead orderHead = this.ucDetail.PopulateReceiveOrder(); int detailCount = 0; bool allowExceedUC = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_ALLOW_EXCEED_UC).Value); foreach (OrderDetail orderDetail in orderHead.OrderDetails) { if (orderDetail.CurrentReceiveQty != 0 || orderDetail.CurrentRejectQty != 0 || orderDetail.CurrentScrapQty != 0) { if (!allowExceedUC && orderDetail.UnitCount < orderDetail.CurrentReceiveQty) { ShowErrorMessage("OrderDetail.Error.OrderDetailReceiveQtyExceedUC", orderDetail.Sequence.ToString()); return; } else { detailCount++; } } } if (detailCount == 0) { ShowErrorMessage("OrderDetail.Error.OrderDetailReceiveEmpty"); return; } bool isReceiptOneItem = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_IS_RECEIPT_ONE_ITEM).Value); if (isReceiptOneItem && detailCount > 1) { ShowErrorMessage("OrderDetail.Error.OrderDetailReceiveItem"); return; } if (orderHead.IsReceiptScanHu) { this.Session["Temp_Session_OrderNo"] = this.OrderNo; Response.Redirect("~/Main.aspx?mid=Order.GoodsReceipt__mp--ModuleType-Production"); } else { bool hasOdd = false; if (orderHead.CreateHuOption == BusinessConstants.CODE_MASTER_CREATE_HU_OPTION_VALUE_GR) { foreach (OrderDetail orderDetail in orderHead.OrderDetails) { if (orderDetail.CurrentReceiveQty % orderDetail.UnitCount != 0) { hasOdd = true; break; } } } this.ucConfirmInfo.Visible = true; this.ucConfirmInfo.InitPageParameter(orderHead, hasOdd, orderHead.IsOddCreateHu); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EntityPreference entityPreference = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_AMOUNT_DECIMAL_LENGTH); DecimalLength = int.Parse(entityPreference.Value); } }
protected void Submit_Click(object sender, EventArgs e) { if (Page.IsValid) { if (this.tbsubject.Text.Trim() == string.Empty || this.Content.Content == string.Empty) { ShowErrorMessage("MasterData.FeedBack.Empty"); return; } this.Submit.Enabled = false; string subject = string.Empty; string emailFrom = string.Empty; if (this.CurrentUser.Email == null || this.CurrentUser.Email.Trim() == string.Empty) { emailFrom = "*****@*****.**"; } else { emailFrom = this.CurrentUser.Email.Trim(); } subject = "[" + this.rblType.SelectedValue + "]"; subject += this.tbsubject.Text; string fileName = Server.MapPath("~/App_Data/ContactForm.txt"); string mailBody = System.IO.File.ReadAllText(fileName); mailBody = mailBody.Replace("##Company##", TheEntityPreferenceMgr.LoadEntityPreference("CompanyName").Value); mailBody = mailBody.Replace("##Account##", this.CurrentUser.Code); mailBody = mailBody.Replace("##Name##", this.CurrentUser.Name); mailBody = mailBody.Replace("##Email##", this.CurrentUser.Email); mailBody = mailBody.Replace("##Phone##", this.CurrentUser.Phone); mailBody = mailBody.Replace("##Mobile##", this.CurrentUser.MobliePhone); mailBody = mailBody.Replace("##Address##", this.CurrentUser.Address); mailBody = mailBody.Replace("##UrlReferrer##", this.UrlReferrer); mailBody = mailBody.Replace("##Type##", this.rblType.SelectedValue); mailBody = mailBody.Replace("##Comments##", this.Content.Content); if (SendSMTPEMail(subject, mailBody, emailFrom)) { ShowSuccessMessage("MainPage.FeedBack.Success"); //Response.Redirect(UrlReferrer.ToString()); this.Timer1.Enabled = true; } else { ShowErrorMessage("MainPage.FeedBack.Error"); this.Submit.Enabled = true; } } }
/* * 用于反射调用,参见GridView * */ public string Render(String content) { if (CurrentUser != null && CurrentUser.UserLanguage != null && CurrentUser.UserLanguage != string.Empty) { content = TheLanguageMgr.ProcessLanguage(content, CurrentUser.UserLanguage); } else { EntityPreference defaultLanguage = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE); content = TheLanguageMgr.ProcessLanguage(content, defaultLanguage.Value); } return(content); }
public void InitPageParameter(Flow flow) { this.PartyFromCode = flow.PartyFrom.Code; this.PartyToCode = flow.PartyTo.Code; this.FlowType = flow.Type; this.FlowCode = flow.Code; int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value); if (flow.AllowCreateDetail && false) //新增的Detail打印有问题,暂时不支持 { FlowDetail blankFlowDetail = new FlowDetail(); if (flow.FlowDetails == null || flow.FlowDetails.Count == 0) { blankFlowDetail.Sequence = seqInterval; } else { int CurrentSeq = flow.FlowDetails.Last <FlowDetail>().Sequence + seqInterval; blankFlowDetail.Sequence = CurrentSeq; } blankFlowDetail.IsBlankDetail = true; flow.AddFlowDetail(blankFlowDetail); } #region 设置默认LotNo string lotNo = LotNoHelper.GenerateLotNo(); foreach (FlowDetail flowDetail in flow.FlowDetails) { flowDetail.HuLotNo = lotNo; } #endregion this.GV_List.DataSource = flow.FlowDetails; this.GV_List.DataBind(); BindShift(); if (flow.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION) { this.TabProd.Visible = false; this.GV_List.Columns[8].Visible = true; } else { this.TabProd.Visible = true; this.GV_List.Columns[8].Visible = false; } }
private string UploadItemImage(string itemCode) { string mapPath = TheEntityPreferenceMgr.LoadEntityPreference("ItemImageDir").Value;//"~/Images/Item/"; string filePath = Server.MapPath(mapPath); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } System.Web.UI.WebControls.FileUpload fileUpload = (System.Web.UI.WebControls.FileUpload)(this.FV_Item.FindControl("fileUpload")); Literal lblUploadMessage = (Literal)(this.FV_Item.FindControl("lblUploadMessage")); if (fileUpload.HasFile) { if (fileUpload.FileName != "" && fileUpload.FileContent.Length != 0) { string fileExtension = Path.GetExtension(fileUpload.FileName); if (fileExtension.ToLower() == ".gif" || fileExtension.ToLower() == ".png" || fileExtension.ToLower() == ".jpg") { string fileName = itemCode + ".jpg"; string fileFullPath = filePath + "\\" + fileName; #region 调整图片大小 AdjustImageHelper.AdjustImage(150, fileFullPath, fileUpload.FileContent); #endregion if (File.Exists(fileFullPath)) { ShowWarningMessage("MasterData.Item.AddImage.Replace", fileName); } else { ShowSuccessMessage("MasterData.Item.AddImage.Successfully", fileName); } return(mapPath + fileName); } else { ShowWarningMessage("MasterData.Item.AddImage.UnSupportFormat"); return(null); } } } return(null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (this.ModuleType == BusinessConstants.BILL_TRANS_TYPE_PO) { this.GV_List.Columns[3].Visible = false; } else if (this.ModuleType == BusinessConstants.BILL_TRANS_TYPE_SO) { this.GV_List.Columns[1].HeaderText = "${MasterData.ActingBill.Customer}"; this.GV_List.Columns[2].Visible = false; } EntityPreference entityPreference = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_AMOUNT_DECIMAL_LENGTH); DecimalLength = int.Parse(entityPreference.Value); } }
public void InitPageParameter(string inspectNo, bool isWorkShop) { InspectOrder inspectOrder = TheInspectOrderMgr.LoadInspectOrder(inspectNo); this.lbInspectNo.Text = inspectOrder.InspectNo; this.lbCreateUser.Text = inspectOrder.CreateUser.Name; this.lbCreateDate.Text = inspectOrder.CreateDate.ToString("yyyy-MM-dd"); this.lbStatus.Text = inspectOrder.Status; this.IsPartQualified = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_ALLOW_PART_QUALIFIED).Value); this.btnQualified.Visible = (inspectOrder.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) && !this.IsPartQualified && inspectOrder.IsDetailHasHu && !isWorkShop; this.btnUnqalified.Visible = (inspectOrder.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) && !this.IsPartQualified && inspectOrder.IsDetailHasHu && !isWorkShop; this.btnInspect.Visible = (inspectOrder.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE) && (this.IsPartQualified || !inspectOrder.IsDetailHasHu) && !isWorkShop; this.btnUnqualifiedPrint.Visible = !isWorkShop; this.ucDetailList.IsPartQualified = this.IsPartQualified; this.ucDetailList.InitPageParameter(inspectNo, isWorkShop); }
protected void btnConfirm_Click(object sender, EventArgs e) { decimal unitCount = decimal.Parse(this.tbUnitCount.Text.Trim()); int count = int.Parse(this.tbQty.Text.Trim()); IList <Hu> huList = TheHuMgr.CloneHu(HuId, unitCount, count, this.CurrentUser); 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>"); this.ShowSuccessMessage("Inventory.PrintHu.Successful"); } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["OEM"]; if (cookie != null) { string imagePath = (cookie.Value == null || cookie.Value.Trim() == string.Empty) ? "Images/" : cookie.Value.Trim(); this.LeftImage.ImageUrl = imagePath + "Logo_Lit.png"; } this.Info.ForeColor = Color.Black; if (this.Session["Current_User"] == null) { this.Response.Redirect("~/Logoff.aspx"); } this.Info.Text = TheEntityPreferenceMgr.LoadEntityPreference("CompanyName").Value; if (Session[AbstractCasModule.CONST_CAS_PRINCIPAL] != null) { this.logoffHL.NavigateUrl = "https://sso.hoternet.cn:8443/cas/logout?service=http://demo.sconit.com/Logoff.aspx"; this.logoffHL.Target = "_parent"; } else { this.logoffHL.NavigateUrl = "~/Logoff.aspx"; this.logoffHL.Target = "_parent"; } //[{ desc: '愛彼思塑膠-原材料仓库', value: 'ABSS' },{ desc: '上海阿仨希-外购件二楼仓库', value: 'ABXG' }] //IList<Item> items = TheItemMgr.GetAllItem(); //string data = "["; //for (int i = 0; i < items.Count; i++) //{ // Item item = items[i]; // string desc = item.Desc1; // desc = desc.Replace("'", ""); // data += TextBoxHelper.GenSingleData(desc, item.Code) + (i < (items.Count - 1) ? "," : string.Empty); //} //data += "]"; this.data.Value = TheItemMgr.GetCacheAllItemString(); }
private bool SendSMTPEMail(string Subject, string Body, string emailFrom) { try { string SmtpServer = TheEntityPreferenceMgr.LoadEntityPreference("SMTPEmailHost").Value; string MailFromPasswd = TheEntityPreferenceMgr.LoadEntityPreference("SMTPEmailPasswd").Value; string MailFrom = TheEntityPreferenceMgr.LoadEntityPreference("SMTPEmailAddr").Value; string MailTo = TheEntityPreferenceMgr.LoadEntityPreference("MailTo").Value; MailMessage message = new MailMessage(); SmtpClient client = new SmtpClient(SmtpServer); foreach (string mailTo in MailTo.Split(';')) { foreach (string mailto in mailTo.Split(',')) { message.To.Add(new MailAddress(mailto)); } } message.Subject = Subject; message.Body = Body; message.From = new MailAddress(emailFrom); client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential(MailFrom, MailFromPasswd); client.DeliveryMethod = SmtpDeliveryMethod.Network; // System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment("D:\\logs\\" + filePath); // message.Attachments.Add(attachment); message.BodyEncoding = System.Text.Encoding.UTF8; message.IsBodyHtml = true; client.Send(message); // message.Dispose(); // logger.Error(Subject); return(true); } catch { return(false); } }
public override void UpdateView() { this.GV_List.Execute(); this.Visible = false; this.ShowTab = false; if (this.TransactionType == BusinessConstants.BILL_TRANS_TYPE_PO) { this.lTitle.InnerText = "${MasterData.Order.ActingBill.Po}"; } else if (this.TransactionType == BusinessConstants.BILL_TRANS_TYPE_SO) { this.lTitle.InnerText = "${MasterData.Order.ActingBill.So}"; } ArrayList dataSource = (ArrayList)this.GV_List.DataSource; if (dataSource != null && dataSource.Count > 0) { this.Visible = true; this.ShowTab = true; } else { OrderHead orderHead = TheOrderHeadMgr.LoadOrderHead(this.OrderNo); bool isShowPrice = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_IS_SHOW_PRICE).Value); if (isShowPrice) { isShowPrice = orderHead.IsShowPrice; } if (isShowPrice) { this.GV_List.Columns[5].Visible = true; this.GV_List.Columns[6].Visible = true; this.GV_List.Columns[7].Visible = true; this.GV_List.Columns[8].Visible = true; this.GV_List.Columns[9].Visible = true; this.GV_List.Columns[10].Visible = true; } } }
public string ListUserFavorites(string userCode, string type) { string listf = string.Empty; string icon = string.Empty; IList <Favorites> ifavorites = TheFavoritesMgr.GetFavorites(userCode, type); int count = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference("HistoryNo").Value); count = count < ifavorites.Count ? count : ifavorites.Count; for (int i = 0; i < count; i++) { Favorites fav = ifavorites[i]; icon = fav.PageImage; if (!File.Exists(Server.MapPath("~/Images/Nav/" + fav.PageImage + ".png"))) { icon = "Default"; } icon = "<img src = 'Images/Nav/" + icon + ".png' />"; listf += "<li class='div-favorite'><span onclick ='DeleteFavorite(" + fav.Id + ")'>XX</span>" + icon; listf += "<a href = 'Main.aspx" + fav.PageUrl + "' target = right title = " + fav.PageImage + ">" + fav.PageName + "</a></li>"; } return(listf); }
private void PrintRender(object sender, EventArgs e) { IList <Hu> huList = (IList <Hu>)sender; if (huList == null || huList.Count == 0) { this.ShowErrorMessage("Inventory.Error.PrintHu.LocationLotDetail.Required"); return; } 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>"); this.ShowSuccessMessage("Inventory.PrintHu.Successful"); } }
protected override void DoSearch() { string partyCode = this.tbPartyCode.Text != string.Empty ? this.tbPartyCode.Text.Trim() : string.Empty; string expenseNo = this.tbExpenseNo.Text != string.Empty ? this.tbExpenseNo.Text.Trim() : string.Empty; string startDate = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty; string endDate = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty; string itemCode = this.tbItemCode.Text != string.Empty ? this.tbItemCode.Text.Trim() : string.Empty; string currency = this.tbCurrency.Text != string.Empty ? this.tbCurrency.Text.Trim() : string.Empty; DateTime?effDateFrom = null; if (startDate != string.Empty) { effDateFrom = DateTime.Parse(startDate); } DateTime?effDateTo = null; if (endDate != string.Empty) { effDateTo = DateTime.Parse(endDate).AddDays(1).AddMilliseconds(-1); } bool needRecalculate = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_RECALCULATE_WHEN_TRANSPORTATIONBILL).Value); if (needRecalculate) { IList <TransportationActBill> allTransportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, this.billNo, true); TheTransportationActBillMgr.RecalculatePrice(allTransportationActBillList, this.CurrentUser); } IList <TransportationActBill> transportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, this.billNo); this.ucNewList.BindDataSource(transportationActBillList != null && transportationActBillList.Count > 0 ? transportationActBillList : null); this.ucNewList.Visible = true; }
protected void btnConfirm_Click(object sender, EventArgs e) { string partyCode = this.tbPartyCode.Text != string.Empty ? this.tbPartyCode.Text.Trim() : string.Empty; string expenseNo = this.tbExpenseNo.Text != string.Empty ? this.tbExpenseNo.Text.Trim() : string.Empty; string startDate = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty; string endDate = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty; string itemCode = this.tbItemCode.Text != string.Empty ? this.tbItemCode.Text.Trim() : string.Empty; string currency = this.tbCurrency.Text != string.Empty ? this.tbCurrency.Text.Trim() : string.Empty; DateTime?effDateFrom = null; if (startDate != string.Empty) { effDateFrom = DateTime.Parse(startDate); } DateTime?effDateTo = null; if (endDate != string.Empty) { effDateTo = DateTime.Parse(endDate).AddDays(1).AddMilliseconds(-1); } //重新计价 bool needRecalculate = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_RECALCULATE_WHEN_TRANSPORTATIONBILL).Value); if (needRecalculate) { IList <TransportationActBill> allTransportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, null, true); TheTransportationActBillMgr.RecalculatePrice(allTransportationActBillList, this.CurrentUser); } IList <TransportationActBill> transportationActBillList = TheTransportationActBillMgr.GetTransportationActBill(partyCode, expenseNo, effDateFrom, effDateTo, itemCode, currency, null); if (transportationActBillList != null && transportationActBillList.Count > 0) { foreach (TransportationActBill transportationActBill in transportationActBillList) { /* * * 1.TransType=Transportation 价格单明细(承运商) 或 短拨费(区域)时 * a.PricingMethod=M3或KG 按数量 * b.SHIPT 按金额 * 2.TransType=WarehouseLease(固定费用) 按金额 * 3.TransType=Operation(操作费) 按数量 */ if (transportationActBill.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_OPERATION || (transportationActBill.TransType == BusinessConstants.TRANSPORTATION_PRICELIST_DETAIL_TYPE_TRANSPORTATION && (transportationActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_M3 || transportationActBill.PricingMethod == BusinessConstants.TRANSPORTATION_PRICING_METHOD_KG) ) ) { transportationActBill.CurrentBillQty = transportationActBill.BillQty - transportationActBill.BilledQty; decimal orgAmount = transportationActBill.UnitPrice * transportationActBill.CurrentBillQty; transportationActBill.CurrentDiscount = orgAmount - (transportationActBill.BillAmount - transportationActBill.BilledAmount); } else { transportationActBill.CurrentBillAmount = transportationActBill.BillAmount - transportationActBill.BilledAmount; transportationActBill.CurrentDiscount = 0; } } IList <TransportationBill> transportationBillList = this.TheTransportationBillMgr.CreateTransportationBill(transportationActBillList, this.CurrentUser, (this.IsRelease.Checked ? BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT : BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)); ; DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(TransportationBill)); DetachedCriteria selectCountCriteria = DetachedCriteria.For(typeof(TransportationBill)) .SetProjection(Projections.Count("BillNo")); selectCriteria.Add(Expression.Eq("CreateDate", transportationBillList[0].CreateDate)); selectCriteria.Add(Expression.Eq("CreateUser.Code", this.CurrentUser.Code)); selectCountCriteria.Add(Expression.Eq("CreateDate", transportationBillList[0].CreateDate)); selectCountCriteria.Add(Expression.Eq("CreateUser.Code", this.CurrentUser.Code)); SearchEvent((new object[] { selectCriteria, selectCountCriteria }), null); this.ShowSuccessMessage("Transportation.TransportationBill.BatchCreateSuccessfully"); } else { this.ShowErrorMessage("TransportationBill.Error.EmptyBillDetail"); } }
protected void ODS_Flow_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { flow = (Flow)e.InputParameters[0]; Controls_TextBox tbRefFlow = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow"); Controls_TextBox tbPartyFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom"); Controls_TextBox tbPartyTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo"); Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom"); Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo"); com.Sconit.Control.CodeMstrDropDownList ddlGrGapTo = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo"); com.Sconit.Control.CodeMstrDropDownList ddlCheckDetailOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCheckDetailOption"); com.Sconit.Control.CodeMstrDropDownList ddlOrderTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlOrderTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlAsnTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlAsnTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlReceiptTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlReceiptTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlHuTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlHuTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlCreateHuOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption"); Controls_TextBox tbCarrier = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrier"); Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress"); Controls_TextBox tbCurrency = (Controls_TextBox)this.FV_Flow.FindControl("tbCurrency"); Controls_TextBox tbPriceListTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPriceListTo"); Controls_TextBox tbTPriceList = (Controls_TextBox)this.FV_Flow.FindControl("tbTPriceList"); Controls_TextBox tbTRoute = (Controls_TextBox)this.FV_Flow.FindControl("tbTRoute"); if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty) { flow.ReferenceFlow = TheFlowMgr.CheckAndLoadFlow(tbRefFlow.Text.Trim()).Code; } if (tbPartyFrom != null && tbPartyFrom.Text.Trim() != string.Empty) { flow.PartyFrom = ThePartyMgr.LoadParty(tbPartyFrom.Text.Trim()); } if (tbPartyTo != null && tbPartyTo.Text.Trim() != string.Empty) { flow.PartyTo = ThePartyMgr.LoadParty(tbPartyTo.Text.Trim()); } if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty) { flow.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim()); } if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flow.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } if (ddlOrderTemplate.SelectedIndex != -1) { flow.OrderTemplate = ddlOrderTemplate.SelectedValue; } if (ddlGrGapTo != null && ddlGrGapTo.SelectedIndex != -1) { flow.GoodsReceiptGapTo = ddlGrGapTo.SelectedValue; } if (ddlCheckDetailOption != null && ddlCheckDetailOption.SelectedIndex != -1) { flow.CheckDetailOption = ddlCheckDetailOption.SelectedValue; } if (ddlAsnTemplate.SelectedIndex != -1) { flow.AsnTemplate = ddlAsnTemplate.SelectedValue; } if (ddlReceiptTemplate.SelectedIndex != -1) { flow.ReceiptTemplate = ddlReceiptTemplate.SelectedValue; } if (ddlHuTemplate.SelectedIndex != -1) { flow.HuTemplate = ddlHuTemplate.SelectedValue; } if (ddlCreateHuOption.SelectedIndex != -1) { flow.CreateHuOption = ddlCreateHuOption.SelectedValue; } if (tbCarrier != null && tbCarrier.Text.Trim() != string.Empty) { flow.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); } if (tbCarrierBillAddress != null && tbCarrierBillAddress.Text.Trim() != string.Empty) { flow.CarrierBillAddress = TheAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim()); } if (tbTPriceList != null && tbTPriceList.Text.Trim() != string.Empty) { flow.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(tbTPriceList.Text.Trim()); } if (tbTRoute != null && tbTRoute.Text.Trim() != string.Empty) { flow.TransportationRoute = TheTransportationRouteMgr.LoadTransportationRoute(tbTRoute.Text.Trim()); } if (tbCurrency != null && tbCurrency.Text.Trim() != string.Empty) { flow.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); } else { string currencyCode = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_BASE_CURRENCY).Value; flow.Currency = TheCurrencyMgr.LoadCurrency(currencyCode); } flow.BillSettleTerm = null; flow.CheckDetailOption = BusinessConstants.CODE_MASTER_CHECK_ORDER_DETAIL_OPTION_VALUE_NOT_CHECK; flow.Type = BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_TRANSFER; flow.AntiResolveHu = BusinessConstants.CODE_MASTER_ANTI_RESOLVE_HU_VALUE_NOT_RESOLVE; flow.CreateUser = this.CurrentUser; flow.CreateDate = DateTime.Now; flow.LastModifyUser = this.CurrentUser; flow.LastModifyDate = DateTime.Now; flow.Version = 0; }
private void HuScan(Hu hu) { if (hu == null) { this.lblMessage.Text = Resources.Language.MasterDataHuNotExist; return; } else { if (TheOrder.OrderDetails != null) { foreach (OrderDetail orderDetail in TheOrder.OrderDetails) { if (orderDetail.HuId == hu.HuId) { this.lblMessage.Text = Resources.Language.MasterDataHuExist; return; } } } Flow flow = this.TheFlowMgr.LoadFlow(TheOrder.Flow); if (flow != null && !flow.AllowCreateDetail) { bool isMatch = false; if (TheOrder.OrderDetails != null) { foreach (OrderDetail orderDetail in TheOrder.OrderDetails) { if (orderDetail.Item.Code == hu.Item.Code && orderDetail.Uom.Code == hu.Uom.Code) { if (!orderDetail.OrderHead.FulfillUnitCount || orderDetail.UnitCount == hu.UnitCount) { if (orderDetail.HuId != string.Empty && orderDetail.HuId != null) { OrderDetail newOrderDetail = new OrderDetail(); newOrderDetail.IsScanHu = true; int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value); int seq = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value); if (this.TheOrder.OrderDetails == null || this.TheOrder.OrderDetails.Count == 0) { newOrderDetail.Sequence = seqInterval; } else { newOrderDetail.Sequence = this.TheOrder.OrderDetails.Last <OrderDetail>().Sequence + seqInterval; } newOrderDetail.Item = orderDetail.Item; newOrderDetail.Uom = orderDetail.Uom; newOrderDetail.HuId = hu.HuId; newOrderDetail.HuQty = hu.Qty; if ((this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION && this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ) || this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN) { newOrderDetail.OrderedQty = -hu.Qty; } else { newOrderDetail.OrderedQty = hu.Qty; } newOrderDetail.LocationFrom = orderDetail.LocationFrom; if (this.IsReject) { newOrderDetail.LocationTo = TheLocationMgr.GetRejectLocation(); } else { newOrderDetail.LocationTo = orderDetail.LocationTo; } newOrderDetail.ReferenceItemCode = orderDetail.ReferenceItemCode; newOrderDetail.UnitCount = orderDetail.UnitCount; newOrderDetail.PackageType = orderDetail.PackageType; newOrderDetail.OrderHead = orderDetail.OrderHead; newOrderDetail.IsScanHu = true; TheOrder.AddOrderDetail(newOrderDetail); } else { orderDetail.IsScanHu = true; orderDetail.HuId = hu.HuId; orderDetail.HuQty = hu.Qty; if ((this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION && this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ) || this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN) { orderDetail.OrderedQty = -hu.Qty; } else { orderDetail.OrderedQty = hu.Qty; } if (this.IsReject) { orderDetail.LocationTo = TheLocationMgr.GetRejectLocation(); } } isMatch = true; break; } } } } if (!isMatch) { this.lblMessage.Text = Resources.Language.MasterDataFlowNotExistHuItem; return; } } else { OrderDetail newOrderDetail = new OrderDetail(); newOrderDetail.IsScanHu = true; int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value); int seq = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value); if (this.TheOrder.OrderDetails == null || this.TheOrder.OrderDetails.Count == 0) { newOrderDetail.Sequence = seqInterval; } else { newOrderDetail.Sequence = this.TheOrder.OrderDetails.Last <OrderDetail>().Sequence + seqInterval; } newOrderDetail.Item = hu.Item; newOrderDetail.Uom = hu.Uom; newOrderDetail.HuId = hu.HuId; newOrderDetail.HuQty = hu.Qty; if ((this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION && this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ) || this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN) { newOrderDetail.OrderedQty = -hu.Qty; } else { newOrderDetail.OrderedQty = hu.Qty; } if (this.IsReject) { newOrderDetail.LocationFrom = TheLocationMgr.GetRejectLocation(); } else { newOrderDetail.LocationFrom = TheOrder.LocationFrom; } newOrderDetail.LocationTo = TheOrder.LocationTo; newOrderDetail.UnitCount = hu.UnitCount; TheOrder.AddOrderDetail(newOrderDetail); } IList <OrderDetail> orderDetailList = new List <OrderDetail>(); foreach (OrderDetail od in TheOrder.OrderDetails) { if (od.IsScanHu) { orderDetailList.Add(od); } } this.GV_List.DataSource = orderDetailList; this.GV_List.DataBind(); InitialHuScan(); } }
protected void ODS_Flow_Updating(object sender, ObjectDataSourceMethodEventArgs e) { Flow flow = (Flow)e.InputParameters[0]; Flow oldFlow = TheFlowMgr.LoadFlow(FlowCode); CloneHelper.CopyProperty(oldFlow, flow, EditFields, true); Controls_TextBox tbRefFlow = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow"); Controls_TextBox tbPartyFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom"); Controls_TextBox tbPartyTo = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo"); Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom"); Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo"); Controls_TextBox tbShipFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbShipFrom"); Controls_TextBox tbShipTo = (Controls_TextBox)this.FV_Flow.FindControl("tbShipTo"); Controls_TextBox tbBillFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbBillFrom"); Controls_TextBox tbCarrier = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrier"); Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress"); Controls_TextBox tbCurrency = (Controls_TextBox)this.FV_Flow.FindControl("tbCurrency"); Controls_TextBox tbPriceListFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPriceListFrom"); com.Sconit.Control.CodeMstrDropDownList ddlGrGapTo = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo"); com.Sconit.Control.CodeMstrDropDownList ddlCheckDetailOption = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlCheckDetailOption")); com.Sconit.Control.CodeMstrDropDownList ddlOrderTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlOrderTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlAsnTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlAsnTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlReceiptTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlReceiptTemplate")); com.Sconit.Control.CodeMstrDropDownList ddlHuTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlHuTemplate")); DropDownList ddlBillSettleTerm = (DropDownList)this.FV_Flow.FindControl("ddlBillSettleTerm"); com.Sconit.Control.CodeMstrDropDownList ddlCreateHuOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption"); com.Sconit.Control.CodeMstrDropDownList ddlAntiResolveHu = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlAntiResolveHu"); if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty) { flow.ReferenceFlow = TheFlowMgr.CheckAndLoadFlow(tbRefFlow.Text.Trim()).Code; } if (tbPartyFrom != null && tbPartyFrom.Text.Trim() != string.Empty) { flow.PartyFrom = ThePartyMgr.LoadParty(tbPartyFrom.Text.Trim()); } if (tbPartyTo != null && tbPartyTo.Text.Trim() != string.Empty) { flow.PartyTo = ThePartyMgr.LoadParty(tbPartyTo.Text.Trim()); } if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty) { flow.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim()); } if (tbShipFrom != null && tbShipFrom.Text.Trim() != string.Empty) { flow.ShipFrom = TheAddressMgr.LoadShipAddress(tbShipFrom.Text.Trim()); } if (tbShipTo != null && tbShipTo.Text.Trim() != string.Empty) { flow.ShipTo = TheAddressMgr.LoadShipAddress(tbShipTo.Text.Trim()); } if (tbBillFrom != null && tbBillFrom.Text.Trim() != string.Empty) { flow.BillFrom = TheAddressMgr.LoadBillAddress(tbBillFrom.Text.Trim()); } if (ddlBillSettleTerm.SelectedIndex != -1) { flow.BillSettleTerm = ddlBillSettleTerm.SelectedValue; } if (ddlCreateHuOption.SelectedIndex != -1) { flow.CreateHuOption = ddlCreateHuOption.SelectedValue; } if (tbCarrier != null && tbCarrier.Text.Trim() != string.Empty) { flow.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim()); } if (tbCarrierBillAddress != null && tbCarrierBillAddress.Text.Trim() != string.Empty) { flow.CarrierBillAddress = TheAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim()); } if (ddlGrGapTo.SelectedIndex != -1) { flow.GoodsReceiptGapTo = ddlGrGapTo.SelectedValue; } if (ddlCheckDetailOption.SelectedIndex != -1) { flow.CheckDetailOption = ddlCheckDetailOption.SelectedValue; } if (ddlOrderTemplate.SelectedIndex != -1) { flow.OrderTemplate = ddlOrderTemplate.SelectedValue; } if (ddlAsnTemplate.SelectedIndex != -1) { flow.AsnTemplate = ddlAsnTemplate.SelectedValue; } if (ddlReceiptTemplate.SelectedIndex != -1) { flow.ReceiptTemplate = ddlReceiptTemplate.SelectedValue; } if (ddlHuTemplate.SelectedIndex != -1) { flow.HuTemplate = ddlHuTemplate.SelectedValue; } if (ddlAntiResolveHu.SelectedIndex != -1) { flow.AntiResolveHu = ddlAntiResolveHu.SelectedValue; } if (tbPriceListFrom != null && tbPriceListFrom.Text.Trim() != string.Empty) { flow.PriceListFrom = ThePurchasePriceListMgr.LoadPurchasePriceList(tbPriceListFrom.Text.Trim()); } if (tbCurrency != null && tbCurrency.Text.Trim() != string.Empty) { flow.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim()); } else { string currencyCode = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_BASE_CURRENCY).Value; flow.Currency = TheCurrencyMgr.LoadCurrency(currencyCode); } flow.LastModifyUser = this.CurrentUser; flow.LastModifyDate = DateTime.Now; flow.Version += 1; }
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); } }
protected void btnPrint_Click(object sender, EventArgs e) { IList <OrderDetail> orderDetailList = PopulateOrderDetailList(); IList <OrderDetail> targetOrderDetailList = new List <OrderDetail>(); if (orderDetailList != null && orderDetailList.Count > 0) { foreach (OrderDetail orderDetail in orderDetailList) { if (orderDetail.OrderedQty > 0) { targetOrderDetailList.Add(orderDetail); } } } if (targetOrderDetailList.Count == 0) { this.ShowErrorMessage("Inventory.Error.PrintHu.OrderDetail.Required"); return; } IList <Hu> huList = null; #region 内/外包装 string packageType = null; RadioButtonList rblPackageType = (RadioButtonList)this.Parent.FindControl("rblPackageType"); if (rblPackageType.SelectedValue == "0") { packageType = BusinessConstants.CODE_MASTER_PACKAGETYPE_INNER; } else if (rblPackageType.SelectedValue == "1") { packageType = BusinessConstants.CODE_MASTER_PACKAGETYPE_OUTER; } #endregion if (this.ModuleType == BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_SUPPLIER) { huList = TheHuMgr.CreateHu(targetOrderDetailList, this.CurrentUser, null, packageType); } else { EntityPreference entityPreference = this.TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_COMPANY_ID_MARK); huList = TheHuMgr.CreateHu(targetOrderDetailList, this.CurrentUser, entityPreference.Value, packageType); } String huTemplate = ""; if (this.ModuleType == BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION) { huTemplate = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_HU_TEMPLATE).Value; } else if (targetOrderDetailList != null && targetOrderDetailList.Count > 0 && targetOrderDetailList[0].OrderHead != null && targetOrderDetailList[0].OrderHead.HuTemplate != null && targetOrderDetailList[0].OrderHead.HuTemplate.Length > 0) { huTemplate = targetOrderDetailList[0].OrderHead.HuTemplate; } if (huTemplate != null && huTemplate.Length > 0) { IList <object> huDetailObj = new List <object>(); huDetailObj.Add(huList); huDetailObj.Add(CurrentUser.Code); string barCodeUrl = ""; if (packageType == BusinessConstants.CODE_MASTER_PACKAGETYPE_OUTER) { barCodeUrl = TheReportMgr.WriteToFile(huTemplate, huDetailObj, huTemplate); } else { barCodeUrl = TheReportMgr.WriteToFile("Inside" + huTemplate, huDetailObj, "Inside" + huTemplate); } Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>"); this.ShowSuccessMessage("Inventory.PrintHu.Successful"); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["Current_User"] == null) { this.Response.Redirect("~/Logoff.aspx"); } else { this.Title = TheEntityPreferenceMgr.LoadEntityPreference("CompanyName").Value; if (!Page.IsPostBack) { string ThemePage = string.Empty; HttpCookie cookieThemePage = new HttpCookie("ThemePage"); if (this.CurrentUser.UserThemePage == null || this.CurrentUser.UserThemePage.Trim() == string.Empty) { cookieThemePage.Value = TheCodeMasterMgr.GetDefaultCodeMaster(BusinessConstants.CODE_MASTER_USER_PREFERENCE_VALUE_THEMEPAGE).Value; Response.Cookies.Add(cookieThemePage); this.CurrentUser.UserThemePage = cookieThemePage.Value; UserPreference usrpf = new UserPreference(); usrpf.User = this.CurrentUser; usrpf.Code = BusinessConstants.CODE_MASTER_USER_PREFERENCE_VALUE_THEMEPAGE; usrpf.Value = cookieThemePage.Value; TheUserPreferenceMgr.CreateUserPreference(usrpf); } else { UserPreference userPreferenceThemePage = TheUserPreferenceMgr.LoadUserPreference(this.CurrentUser.Code, "ThemePage"); if (userPreferenceThemePage != null && userPreferenceThemePage.Value == BusinessConstants.CODE_MASTER_USER_PREFERENCE_VALUE_THEMEPAGE_RANDOM) { ThemePage = TheCodeMasterMgr.GetRandomTheme(BusinessConstants.CODE_MASTER_USER_PREFERENCE_VALUE_THEMEPAGE); } else { ThemePage = userPreferenceThemePage.Value; } cookieThemePage.Value = ThemePage; Response.Cookies.Add(cookieThemePage); } #region 随机框架主题 HttpCookie cookieThemeFrame = new HttpCookie("ThemeFrame"); if (this.CurrentUser.UserThemeFrame == null || this.CurrentUser.UserThemeFrame.Trim() == string.Empty) { cookieThemeFrame.Value = string.Empty; Response.Cookies.Add(cookieThemeFrame); this.CurrentUser.UserThemeFrame = TheCodeMasterMgr.GetDefaultCodeMaster(BusinessConstants.CODE_MASTER_USER_PREFERENCE_VALUE_THEMEFRAME).Value; UserPreference usrpf = new UserPreference(); usrpf.User = this.CurrentUser; usrpf.Code = BusinessConstants.CODE_MASTER_USER_PREFERENCE_VALUE_THEMEFRAME; usrpf.Value = this.CurrentUser.UserThemeFrame; TheUserPreferenceMgr.CreateUserPreference(usrpf); } else { string themeFrame = TheUserPreferenceMgr.LoadUserPreference(this.CurrentUser.Code, "ThemeFrame").Value; switch (themeFrame) { case "Picture": cookieThemeFrame.Value = string.Empty; Response.Cookies.Add(cookieThemeFrame); break; case "Random": cookieThemeFrame.Value = TheCodeMasterMgr.GetRandomTheme("ThemeFrame"); Response.Cookies.Add(cookieThemeFrame); break; default: cookieThemeFrame.Value = themeFrame; Response.Cookies.Add(cookieThemeFrame); break; } } #endregion } //确定MainFrame的页面为退出前的页面 if (Request.Params.Get("rightFrameUrl") == null) { IList <Favorites> listFavorites = TheFavoritesMgr.GetFavorites(this.CurrentUser.Code, "History"); if (listFavorites.Count != 0) { Favorites favorite = listFavorites[0]; url = "Main.aspx" + favorite.PageUrl; } else { url = "Main.aspx?mid=Security.UserPreference"; } } else { url = Request.Params.Get("rightFrameUrl"); } } }
protected override void DoSearch() { string partyCode = this.tbPartyCode.Text != string.Empty ? this.tbPartyCode.Text.Trim() : string.Empty; string receiver = this.tbReceiver.Text != string.Empty ? this.tbReceiver.Text.Trim() : string.Empty; string startDate = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty; string endDate = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty; string itemCode = this.tbItemCode.Text != string.Empty ? this.tbItemCode.Text.Trim() : string.Empty; string currency = this.tbCurrency.Text != string.Empty ? this.tbCurrency.Text.Trim() : string.Empty; string externalRece = ExternalReceiptNo.SelectedValue; DateTime?effDateFrom = null; if (startDate != string.Empty) { effDateFrom = DateTime.Parse(startDate); } DateTime?effDateTo = null; if (endDate != string.Empty) { effDateTo = DateTime.Parse(endDate).AddDays(1).AddMilliseconds(-1); } bool needRecalculate = bool.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_RECALCULATE_WHEN_BILL).Value); if (needRecalculate) { IList <ActingBill> allactingBillList = TheActingBillMgr.GetActingBill(partyCode, receiver, effDateFrom, effDateTo, itemCode, currency, this.ModuleType, this.billNo, true); TheActingBillMgr.RecalculatePrice(allactingBillList, this.CurrentUser); } //djin 2013-3-20 内部客户 if (partyCode != string.Empty) { var IsIntern = TheCustomerMgr.LoadCustomer(partyCode).IsIntern; this.tbIsIntern.Value = IsIntern.ToString(); } IList <ActingBill> actingBillList = TheActingBillMgr.GetActingBill(partyCode, receiver, effDateFrom, effDateTo, itemCode, currency, this.ModuleType, this.billNo, null); //djin 2013-3-20 客户回单 var hd = (from b in actingBillList where !string.IsNullOrEmpty(b.ExternalReceiptNo) //!= null select b.ExternalReceiptNo.Substring(0, 2)).Distinct(); ExternalReceiptNo.Items.Clear(); ExternalReceiptNo.Items.Add(new ListItem("ALL", "ALL")); foreach (var i in hd) { ListItem item = new ListItem(i); ExternalReceiptNo.Items.Add(item); } if (externalRece != "ALL") { var afterF = from a in actingBillList where (a.ExternalReceiptNo != null && a.ExternalReceiptNo.Count() >= 2 && a.ExternalReceiptNo.Substring(0, 2) == externalRece) select a; this.ucNewList.BindDataSource(afterF.ToList()); } else { this.ucNewList.BindDataSource(actingBillList != null && actingBillList.Count > 0 ? actingBillList : null); } //this.ucNewList.BindDataSource(actingBillList != null && actingBillList.Count > 0 ? actingBillList : null); this.ucNewList.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { try { //string entityCode = TheEntityPreferenceMgr.LoadEntityPreference("CompanyCode").Value; string entityCode = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_PORTAL_PARAM).Value; // read config string companyCode = string.Empty; string redirectUrl = string.Empty; string urlLogin = string.Empty; string userCode = string.Empty; string password = string.Empty; string partyCode = string.Empty; //string userCode = "su"; //string password = "******"; //string partyCode = "s0000208"; //?105=201027&language=en&redirectUrl=Main.aspx%3Fmid%3DOrder.OrderIssue__mp--ModuleType-SupplierDistribution_ModuleSubType-Nml&userCode=SupplyUser&password=supplyuser%40sconit.com string[] keys = Request.Params.AllKeys; foreach (string key in keys) { if (key.EndsWith(entityCode)) { partyCode = Request.Params.Get(key).ToLower(); } else if (key.EndsWith("languageId")) { language = Request.Params.Get(key); if (language == "zh_CN") { language = "zh-CN"; } else if (language == "en_US") { language = "en"; } InitializeCulture(); } else if (key.EndsWith("feature")) { redirectUrl = Request.Params.Get(key); } else if (key.EndsWith("urlLogin")) { urlLogin = Request.Params.Get(key); } else if (key.EndsWith("userid")) { userCode = Request.Params.Get(key).ToLower(); } else if (key.EndsWith("password")) { password = Request.Params.Get(key); } } //LoginPage HttpCookie loginPageCookie = new HttpCookie("LoginPage"); loginPageCookie.Value = urlLogin; Response.Cookies.Add(loginPageCookie); ////test //userCode = "SupplyUser"; //password = "******"; //partyCode = "ADKJ"; //this.message.Text = userCode + "|" + password + "|" + partyCode; //return; if (userCode != null && userCode.Trim() != string.Empty) { if ((userCode + password).ToLower() == @"supplyusersconit.yfkey") { User user = TheUserMgr.CheckAndLoadUser(partyCode.ToLower()); bool isExistUserPreferenceLanguage = false; if (user != null && user.UserPreferences != null) { foreach (UserPreference userPreference in user.UserPreferences) { if (userPreference.Code == BusinessConstants.CODE_MASTER_LANGUAGE) { userPreference.Value = language; isExistUserPreferenceLanguage = true; } } } if (!isExistUserPreferenceLanguage || user.UserPreferences == null) { UserPreference up = new UserPreference(); up.Code = BusinessConstants.CODE_MASTER_LANGUAGE; up.Value = language; up.User = user; user.UserPreferences.Add(up); } this.Session["Current_User"] = user; this.Session["Hiddensmp"] = "Hiddensmp"; this.TreeView1.TreeNodeDataBound += new TreeNodeEventHandler(TreeView1_TreeNodeDataBound); return; } } this.Response.Redirect("about:blank"); } catch (BusinessErrorException ex) { this.Response.Redirect("about:blank"); } }
/// <summary> /// 导出数据函数 /// </summary> /// <param name="FileType">导出文件MIME类型</param> /// <param name="FileName">导出文件的名称</param> protected void Export(GridView gridview, String FileType, String FileName) { /* * gridview.AllowPaging = false; * gridview.AllowSorting = false; */ if (gridview.Rows.Count > 5000) { ShowWarningMessage("Common.Export.Warning.GreatThan5000", gridview.Rows.Count.ToString()); } else if (gridview.Rows.Count == 0) { ShowWarningMessage("Common.GridView.NoRecordFound"); return; } //gridview.DataBind(); System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("ZH-CN", true); StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(cultureInfo); HtmlTextWriter htw = new HtmlTextWriter(sw); Page page = new Page(); HtmlForm form = new HtmlForm(); gridview.EnableViewState = false; // Deshabilitar la validación de eventos, sólo asp.net 2 page.EnableEventValidation = false; // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD. page.DesignerInitialize(); page.Controls.Add(form); form.Controls.Add(gridview); page.RenderControl(htw); Response.Clear(); Response.Buffer = true; // Response.ContentType = "application/vnd.ms-excel"; //Response.AddHeader("Content-Disposition", "attachment;filename=data.xls"); Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8)); //设置输出流HttpMiME类型(导出文件格式) Response.ContentType = FileType; //Response.Charset = "UTF-8"; //设定输出字符集 Response.Charset = "GB2312"; //Response.ContentEncoding = Encoding.Default; Response.ContentEncoding = System.Text.Encoding.UTF8; string content = sw.ToString(); if (CurrentUser != null && CurrentUser.UserLanguage != null && CurrentUser.UserLanguage != string.Empty) { content = TheLanguageMgr.ProcessLanguage(content, CurrentUser.UserLanguage); } else { EntityPreference defaultLanguage = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE); content = TheLanguageMgr.ProcessLanguage(content, defaultLanguage.Value); } Response.Write(content); Response.End(); Response.Flush(); /* * gridview.AllowPaging = true; * gridview.AllowSorting = true; */ //gridview.DataBind(); }
protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblSeq = (Label)e.Row.FindControl("lblSeq"); Label lblItemCode = (Label)e.Row.FindControl("lblItemCode"); Label lblItemDescription = (Label)e.Row.FindControl("lblItemDescription"); Label lblUom = (Label)e.Row.FindControl("lblUom"); Label lblUnitCount = (Label)e.Row.FindControl("lblUnitCount"); Label lblLocFrom = (Label)e.Row.FindControl("lblLocFrom"); Label lblLocTo = (Label)e.Row.FindControl("lblLocTo"); Label lblPrice = (Label)e.Row.FindControl("lblPrice"); Label lblDiscount = (Label)e.Row.FindControl("lblDiscount"); Label lblDiscountRate = (Label)e.Row.FindControl("lblDiscountRate"); Label lblUnitPrice = (Label)e.Row.FindControl("lblUnitPrice"); Label lblReferenceItemCode = (Label)e.Row.FindControl("lblReferenceItemCode"); Label lblOrderQty = (Label)e.Row.FindControl("tbOrderQty"); Label lblReceivedQty = (Label)e.Row.FindControl("lblReceivedQty"); HiddenField hfId = (HiddenField)e.Row.FindControl("hfId"); TextBox tbReceiveQty = (TextBox)e.Row.FindControl("tbReceiveQty"); HiddenField hfHuOpt = (HiddenField)e.Row.FindControl("hfHuOpt"); TextBox tbHuId = (TextBox)e.Row.FindControl("tbHuId"); TextBox tbHuReceiveQty = (TextBox)e.Row.FindControl("tbHuReceiveQty"); RangeValidator rvReceiveQty = (RangeValidator)e.Row.FindControl("rvReceiveQty"); if (this.ModuleType != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION) { #region 颜色 decimal OrderQty = lblOrderQty.Text == string.Empty ? 0M : Convert.ToDecimal(lblOrderQty.Text); decimal ReceivedQty = lblReceivedQty.Text == string.Empty ? 0M : Convert.ToDecimal(lblReceivedQty.Text); decimal ReceiveQty = tbReceiveQty.Text == string.Empty ? 0M : Convert.ToDecimal(tbReceiveQty.Text); if (ReceiveQty < OrderQty - ReceivedQty) { for (int i = 0; i < e.Row.Cells.Count; i++) { e.Row.Cells[i].Attributes.Add("class", "GVRow"); } } else { for (int i = 0; i < e.Row.Cells.Count; i++) { e.Row.Cells[i].Attributes.Add("class", "GVAlternatingRow"); } } #endregion } else { string defaultReceiptOpt = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_RECEIPT_OPTION).Value; OrderLocationTransaction orderLocTrans = (OrderLocationTransaction)e.Row.DataItem; tbReceiveQty.Text = OrderHelper.GetDefaultReceiptQty(orderLocTrans.OrderDetail, defaultReceiptOpt).ToString(); } #region 收货数控制 if (this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN) { rvReceiveQty.MaximumValue = "0"; rvReceiveQty.MinimumValue = "-999999999"; } #endregion } }